mcconnell 2004/01/04 05:38:17
Modified: merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl
DefaultFactory.java
Log:
Addition of standard system context entries.
Revision Changes Path
1.9 +43 -21
avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java
Index: DefaultFactory.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultFactory.java 4 Jan 2004 12:06:29 -0000 1.8
+++ DefaultFactory.java 4 Jan 2004 13:38:17 -0000 1.9
@@ -61,6 +61,7 @@
import org.apache.avalon.activation.appliance.Block;
import org.apache.avalon.activation.appliance.Composite;
+import org.apache.avalon.activation.appliance.BlockContext;
import org.apache.avalon.activation.appliance.impl.AbstractBlock;
import org.apache.avalon.activation.appliance.impl.DefaultServiceContext;
@@ -384,7 +385,7 @@
File anchor = criteria.getAnchorDirectory();
- SystemContext systemContext =
+ DefaultSystemContext applicationContext =
new DefaultSystemContext(
m_logging,
anchor,
@@ -396,20 +397,52 @@
params );
//
- // create the system model and block
+ // create the application model
//
- final Logger systemLogger = getLogger();
+ getLogger().info( "building application model" );
+ final Logger applicationLogger = m_logging.getLoggerForCategory("");
+ ClassLoader api = applicationContext.getCommonClassLoader();
+ ContainmentModel application =
+ new DefaultContainmentModel(
+ createContainmentContext(
+ applicationContext, applicationLogger, api,
+ getContainmentProfile(
+ kernelConfig.getChild( "container" ) ) ) );
+
+ //
+ // create the system model and add the application model
+ // as an available system context entry
+ //
+
+ getLogger().info( "facilities deployment" );
+
+ Configuration facilities =
+ kernelConfig.getChild( "system" );
+
+ DefaultSystemContext systemContext =
+ new DefaultSystemContext(
+ m_logging,
+ anchor,
+ criteria.getContextDirectory(),
+ criteria.getTempDirectory(),
+ repository,
+ loggingDescriptor.getName(),
+ criteria.isDebugEnabled() );
+
+ systemContext.put( "urn:merlin:dir", criteria.getWorkingDirectory() );
+ systemContext.put( "urn:merlin:anchor", criteria.getAnchorDirectory() );
+ systemContext.put( "urn:merlin:model", application );
- //ClassLoader impl =
- // Thread.currentThread().getContextClassLoader();
+ systemContext.makeReadOnly();
+ ClassLoader spi = BlockContext.class.getClassLoader();
+ final Logger systemLogger = getLogger();
ContainmentModel system =
new DefaultContainmentModel(
createContainmentContext(
- systemContext, systemLogger, m_classloader,
- getContainmentProfile(
- kernelConfig.getChild( "system" ) ) ) );
+ systemContext, systemLogger, spi,
+ getContainmentProfile( facilities ) ) );
//
// TODO: now that the system context is established we
@@ -462,22 +495,10 @@
}
//
- // create the application model
- //
-
- final Logger applicationLogger = m_logging.getLoggerForCategory("");
- ClassLoader api = systemContext.getCommonClassLoader();
- ContainmentModel application =
- new DefaultContainmentModel(
- createContainmentContext(
- systemContext, applicationLogger, api,
- getContainmentProfile(
- kernelConfig.getChild( "container" ) ) ) );
-
- //
// install any blocks declared within the kernel context
//
+ getLogger().info( "block installation" );
getLogger().debug( "install phase" );
URL[] urls = criteria.getDeploymentURLs();
for( int i=0; i<urls.length; i++ )
@@ -528,6 +549,7 @@
//
// instantiate the runtime root application block
//
+ getLogger().info( "deployment" );
getLogger().debug( "activation phase" );
try
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]