ClassLoader parentClassLoader = null;
MutablePicoContainer childContainer = null;
if (parent != null) {
parentClassLoader = parent.getComponentClassLoader();
if ( isAttribute(attributes, COMPONENT_ADAPTER_FACTORY) ) {
ComponentAdapterFactory componentAdapterFactory = createComponentAdapterFactory(attributes);
childContainer = new DefaultPicoContainer(
getDecorationDelegate().decorate(componentAdapterFactory, attributes), parent.getPico());
if ( isAttribute(attributes, COMPONENT_MONITOR) ) {
changeComponentMonitor(childContainer, createComponentMonitor(attributes));
}
parent.getPico().addChildContainer(childContainer);
} else if ( isAttribute(attributes, COMPONENT_MONITOR) ) {
ComponentAdapterFactory componentAdapterFactory = new DefaultComponentAdapterFactory(
createComponentMonitor(attributes));
childContainer = new DefaultPicoContainer(
getDecorationDelegate().decorate(componentAdapterFactory, attributes), parent.getPico());
} else {
childContainer = parent.getPico().makeChildContainer();
}
} else {
parentClassLoader = (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return PicoContainer.class.getClassLoader();
}
});
ComponentAdapterFactory componentAdapterFactory = createComponentAdapterFactory(attributes);
childContainer = new DefaultPicoContainer(
getDecorationDelegate().decorate(componentAdapterFactory, attributes));
if ( isAttribute(attributes, COMPONENT_MONITOR) ) {
changeComponentMonitor(childContainer, createComponentMonitor(attributes));
}