001    /*******************************************************************************
002     * Copyright (C) PicoContainer Organization. All rights reserved.
003     * ---------------------------------------------------------------------------
004     * The software in this package is published under the terms of the BSD style
005     * license a copy of which has been included with this distribution in the
006     * LICENSE.txt file. 
007     ******************************************************************************/
008    package org.picocontainer.script.groovy.nodes;
009    
010    import java.util.Map;
011    
012    import org.picocontainer.classname.DefaultClassLoadingPicoContainer;
013    import org.picocontainer.classname.ClassLoadingPicoContainer;
014    
015    /**
016     * @author Paul Hammant
017     */
018    @SuppressWarnings("serial")
019    public class ClassLoaderNode extends AbstractBuilderNode {
020    
021        public static final String NODE_NAME = "classLoader";
022    
023        public ClassLoaderNode() {
024            super(NODE_NAME);
025        }
026    
027        public Object createNewNode(Object current, Map<String, Object> attributes) {
028    
029            ClassLoadingPicoContainer container = (ClassLoadingPicoContainer) current;
030            return new DefaultClassLoadingPicoContainer(container.getComponentClassLoader(), container);
031        }
032    
033    }