You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by cr...@apache.org on 2002/06/27 18:48:36 UTC
cvs commit: jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/util ContextManager.java
crafterm 2002/06/27 09:48:36
Modified: fortress/src/java/org/apache/excalibur/fortress
DefaultContainerManager.java
fortress/src/java/org/apache/excalibur/fortress/util
ContextManager.java
Log:
Fixed validator check when container is Serviceable.
Added initializeServiceManager() method to ContextManager so that
Serviceable containers don't throw a ContextException when being created.
Revision Changes Path
1.11 +2 -2 jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/DefaultContainerManager.java
Index: DefaultContainerManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/DefaultContainerManager.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DefaultContainerManager.java 25 Jun 2002 13:39:37 -0000 1.10
+++ DefaultContainerManager.java 27 Jun 2002 16:48:36 -0000 1.11
@@ -149,7 +149,7 @@
if( instance instanceof Serviceable )
{
- validator.checkComposed();
+ validator.checkServiced();
( (Serviceable)instance ).service( (ServiceManager)initParameters.get( SERVICE_MANAGER ) );
}
1.22 +40 -1 jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/util/ContextManager.java
Index: ContextManager.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/util/ContextManager.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ContextManager.java 13 Jun 2002 17:24:51 -0000 1.21
+++ ContextManager.java 27 Jun 2002 16:48:36 -0000 1.22
@@ -26,6 +26,8 @@
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.DefaultServiceManager;
+import org.apache.avalon.framework.service.ServiceManager;
import org.apache.excalibur.event.Queue;
import org.apache.excalibur.event.command.CommandManager;
import org.apache.excalibur.mpool.DefaultPoolManager;
@@ -151,6 +153,7 @@
initializeLoggerManager();
initializeRoleManager();
initializeComponentManager();
+ initializeServiceManager();
initializeCommandQueue();
initializePoolManager();
initializeContext();
@@ -296,6 +299,42 @@
containerManagerContext.put( COMPONENT_MANAGER, cm );
}
+ /**
+ * Will set up a ServiceLocator if none is supplied.
+ *
+ * The postcondition is that childContext.get( Container.SERVICE_MANAGER )
+ * should return a valid logger manager.
+ */
+ protected void initializeServiceManager() throws Exception
+ {
+ try
+ {
+ childContext.put( SERVICE_MANAGER, rootContext.get( SERVICE_MANAGER ) );
+ return;
+ }
+ catch( ContextException ce )
+ {
+ }
+
+ // See if we can inherit from the parent...
+ try
+ {
+ childContext.get( SERVICE_MANAGER );
+
+ // OK, done.
+ return;
+ }
+ catch( ContextException ce )
+ {
+ // No ComponentLocator available anywhere. (Set one up.)
+ }
+
+ ServiceManager sm = new DefaultServiceManager(
+ (ServiceManager)get( rootContext, SERVICE_MANAGER_PARENT, null ) );
+ assumeOwnership( sm );
+ containerManagerContext.put( SERVICE_MANAGER, sm );
+ }
+
protected void initializeCommandQueue() throws Exception
{
try
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>