    001    /*****************************************************************************
    002     * Copyright (C) NanoContainer Organization. All rights reserved.            *
    003     * ------------------------------------------------------------------------- *
    004     * The software in this package is published under the terms of the BSD      *
    005     * style license a copy of which has been included with this distribution in *
    006     * the LICENSE.txt file.                                                     *
    007     *                                                                           *
    008     * Original code by James Strachan                                           *
    009     *****************************************************************************/
    010
    011    package org.nanocontainer.script.groovy.buildernodes;
    012
    013    import java.util.Map;
    014
    015    import org.nanocontainer.NanoContainer;
    016    import org.nanocontainer.DefaultNanoContainer;
    017
    018    /**
    019     * @author Paul Hammant
    020     * @version $Revision: 2695 $
    021     */
    022    public class ClassLoaderNode extends AbstractBuilderNode {
    023
    024        public static final String NODE_NAME = "classLoader";
    025
    026        public ClassLoaderNode() {
    027            super(NODE_NAME);
    028        }
    029
    030
    031        public Object createNewNode(Object current, Map attributes) {
    032
    033            NanoContainer nanoContainer = (NanoContainer) current;
    034            return new DefaultNanoContainer(nanoContainer.getComponentClassLoader(), nanoContainer.getPico());
    035        }
    036
    037    }