public PlexusContainer createChildContainer( String name, ClassRealm realm ) throws PlexusContainerException { if ( hasChildContainer( name ) ) { throw new DuplicateChildContainerException( getName(), name ); } ContainerConfiguration c = new DefaultContainerConfiguration() .setName( name ).setParentContainer( this ).setClassWorld( new ClassWorld( name, realm ) ); PlexusContainer childContainer = new DefaultPlexusContainer( c ); childContainers.put( name, childContainer ); return childContainer; }
cc.setContext( containerContext ); cc.setContainerConfigurationURL( resolveConfig( context ) ); cc.setParentContainer( parentContainer );
public void execute( AppDeploymentContext context ) throws AppDeploymentException { String name = "plexus.application." + context.getApplicationId(); // ---------------------------------------------------------------------------- // Create the container and start // ---------------------------------------------------------------------------- DefaultPlexusContainer applicationContainer; try { addLibJars( context, name ); // This call will initialise and start the container String config = context.getAppConfigurationFile() == null ? null : context.getAppConfigurationFile().getAbsolutePath(); ContainerConfiguration cc= new DefaultContainerConfiguration(); cc.setName( name ); cc.setContext( context.getContextValues() ); cc.setClassWorld( context .getAppRuntimeProfile().getApplicationWorld() ); cc.setContainerConfiguration( config ); cc.setParentContainer( context.getAppServerContainer() ); applicationContainer = new DefaultPlexusContainer( cc ); } catch ( PlexusContainerException e ) { throw new AppDeploymentException( "Error starting container.", e ); } context.getAppRuntimeProfile().setApplicationContainer( applicationContainer ); }