bloritsch 2003/05/30 10:21:07
Modified: fortress/src/java/org/apache/avalon/fortress/util
ContextManager.java
Log:
Add compatibility layer for early adopters of Fortress.
Revision Changes Path
1.36 +38 -3
avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java
Index: ContextManager.java
===================================================================
RCS file:
/home/cvs/avalon-excalibur/fortress/src/java/org/apache/avalon/fortress/util/ContextManager.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- ContextManager.java 30 May 2003 16:11:46 -0000 1.35
+++ ContextManager.java 30 May 2003 17:21:07 -0000 1.36
@@ -74,7 +74,9 @@
import org.apache.avalon.framework.service.DefaultServiceManager;
import org.apache.avalon.framework.service.DefaultServiceSelector;
import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceException;
import org.apache.excalibur.event.Sink;
+import org.apache.excalibur.event.Queue;
import org.apache.excalibur.event.command.CommandManager;
import org.apache.excalibur.event.command.TPCThreadManager;
import org.apache.excalibur.event.command.ThreadManager;
@@ -341,6 +343,7 @@
m_childContext.put( Sink.ROLE, null );
m_childContext.put( MetaInfoManager.ROLE, null );
m_childContext.put( PoolManager.ROLE, null );
+ m_childContext.put( LifecycleExtensionManager.ROLE, null );
}
/**
@@ -680,7 +683,7 @@
protected void initializeServiceManager() throws Exception
{
final ServiceManager parent = (ServiceManager) get( m_rootContext,
SERVICE_MANAGER, null );
- final DefaultServiceManager manager = new DefaultServiceManager( parent );
+ final DefaultServiceManager manager = new EAServiceManager( parent,
getLogger().getChildLogger("compat") );
/**
* We assume that if there is a parent ServiceManager provided,
@@ -748,7 +751,6 @@
return null;
}
- SourceResolver resolver = null;
Source src = null;
try
{
@@ -1011,6 +1013,39 @@
if ( obj instanceof LoggerManager ) retVal = 3;
return retVal;
+ }
+ }
+
+ /**
+ * This is a compatibility thing for early adopters of Fortress so that they
will use the
+ * correct ROLE for the CommandSink.
+ */
+ private static final class EAServiceManager extends DefaultServiceManager
+ {
+ private final Logger m_ealogger;
+
+ public EAServiceManager( ServiceManager parent, Logger logger )
+ {
+ super( parent );
+ m_ealogger = logger;
+ }
+
+ public Object lookup(String role) throws ServiceException
+ {
+ if ( Queue.ROLE.equals( role ) )
+ {
+ m_ealogger.info("Using deprecated role (Queue.ROLE) for the Command
Sink. Use \"Sink.ROLE\" instead.");
+ return lookup(Sink.ROLE);
+ }
+
+ return super.lookup( role );
+ }
+
+ public boolean hasService(String role)
+ {
+ if (Queue.ROLE.equals( role ) ) return hasService(Sink.ROLE);
+
+ return super.hasService( role );
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]