donaldp 2002/11/10 03:44:16 Modified: fortress/src/java/org/apache/excalibur/fortress/util ContextManager.java Log: Use rols strings rather than keys in constants class Revision Changes Path 1.51 +26 -23 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.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- ContextManager.java 10 Nov 2002 03:26:43 -0000 1.50 +++ ContextManager.java 10 Nov 2002 11:44:16 -0000 1.51 @@ -70,12 +70,15 @@ import org.apache.avalon.framework.service.DefaultServiceSelector; import org.apache.avalon.framework.service.ServiceManager; 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; import org.apache.excalibur.fortress.role.ConfigurableRoleManager; import org.apache.excalibur.fortress.role.ExcaliburRoleManager; +import org.apache.excalibur.fortress.role.RoleManager; import org.apache.excalibur.instrument.manager.DefaultInstrumentManager; +import org.apache.excalibur.instrument.InstrumentManager; import org.apache.excalibur.mpool.DefaultPoolManager; import org.apache.excalibur.mpool.PoolManager; import org.apache.excalibur.source.Source; @@ -404,7 +407,7 @@ { try { - m_childContext.put( COMMAND_QUEUE, m_rootContext.get( COMMAND_QUEUE ) ); + m_childContext.put( Queue.ROLE, m_rootContext.get( Queue.ROLE ) ); return; } catch( ContextException ce ) @@ -413,7 +416,7 @@ try { - m_childContext.get( COMMAND_QUEUE ); + m_childContext.get( Queue.ROLE ); return; } catch( ContextException ce ) @@ -421,7 +424,7 @@ } // No CommandQueue specified, create a default one - m_childContext.put( COMMAND_QUEUE, createCommandSink() ); + m_childContext.put( Queue.ROLE, createCommandSink() ); } /** @@ -439,7 +442,7 @@ assumeOwnership( tm ); // Get the context Logger Manager - LoggerManager loggerManager = (LoggerManager)m_childContext.get( LOGGER_MANAGER ); + LoggerManager loggerManager = (LoggerManager)m_childContext.get( LoggerManager.ROLE ); // Get the logger for the thread m_manager Logger tmLogger = loggerManager.getLoggerForCategory( "system.threadmgr" ); @@ -508,16 +511,16 @@ { try { - m_childContext.put( POOL_MANAGER, m_rootContext.get( POOL_MANAGER ) ); + m_childContext.put( PoolManager.ROLE, m_rootContext.get( PoolManager.ROLE ) ); return; } catch( ContextException ce ) { } - PoolManager pm = new DefaultPoolManager( (Sink)m_childContext.get( COMMAND_QUEUE ) ); + PoolManager pm = new DefaultPoolManager( (Sink)m_childContext.get( Queue.ROLE ) ); assumeOwnership( pm ); - m_childContext.put( POOL_MANAGER, pm ); + m_childContext.put( PoolManager.ROLE, pm ); } /** @@ -529,7 +532,7 @@ { try { - m_childContext.put( ROLE_MANAGER, m_rootContext.get( ROLE_MANAGER ) ); + m_childContext.put( RoleManager.ROLE, m_rootContext.get( RoleManager.ROLE ) ); return; } catch( ContextException ce ) @@ -544,7 +547,7 @@ // See if we can inherit from the parent... try { - m_childContext.get( ROLE_MANAGER ); + m_childContext.get( RoleManager.ROLE ); // OK, done. return; @@ -557,7 +560,7 @@ } // Get the context Logger Manager - LoggerManager loggerManager = (LoggerManager)m_childContext.get( LOGGER_MANAGER ); + LoggerManager loggerManager = (LoggerManager)m_childContext.get( LoggerManager.ROLE ); // Create a logger for the role m_manager Logger rmLogger = loggerManager.getLoggerForCategory( @@ -577,7 +580,7 @@ rm.configure( roleConfig ); assumeOwnership( rm ); - m_childContext.put( ROLE_MANAGER, rm ); + m_childContext.put( RoleManager.ROLE, rm ); } /** @@ -705,7 +708,7 @@ * overridden if you don't want a LogKitLoggerManager. * * <p>The postcondition is that - * <code>childContext.get( Container.LOGGER_MANAGER )</code> should + * <code>childContext.get( LoggerManager.ROLE )</code> should * return a valid logger m_manager.</p> * * @throws Exception if it cannot instantiate the LoggerManager @@ -716,7 +719,7 @@ { // Try copying an already existing logger m_manager from the override context. - m_childContext.put( LOGGER_MANAGER, m_rootContext.get( LOGGER_MANAGER ) ); + m_childContext.put( LoggerManager.ROLE, m_rootContext.get( LoggerManager.ROLE ) ); } catch( ContextException ce ) { @@ -731,7 +734,7 @@ // Does the parent supply a logger m_manager? try { - m_childContext.get( LOGGER_MANAGER ); + m_childContext.get( LoggerManager.ROLE ); // OK, done. return; @@ -785,7 +788,7 @@ assumeOwnership( logManager ); - m_childContext.put( LOGGER_MANAGER, logManager ); + m_childContext.put( LoggerManager.ROLE, logManager ); } // Since we now have a LoggerManager, we can update the this.logger field @@ -795,7 +798,7 @@ { getLogger().debug( "Switching to default Logger provided by LoggerManager." ); - LoggerManager loggerManager = (LoggerManager)m_childContext.get( LOGGER_MANAGER ); + LoggerManager loggerManager = (LoggerManager)m_childContext.get( LoggerManager.ROLE ); m_logger = loggerManager.getDefaultLogger(); } } @@ -805,7 +808,7 @@ * overridden if you don't want a LogKitLoggerManager. * * <p>The postcondition is that - * <code>childContext.get( Container.LOGGER_MANAGER )</code> should + * <code>childContext.get( LoggerManager.ROLE )</code> should * return a valid logger m_manager.</p> * * @throws Exception if it cannot instantiate the LoggerManager @@ -816,7 +819,7 @@ { // Try copying an already existing instrument m_manager from the override context. - m_childContext.put( INSTRUMENT_MANAGER, m_rootContext.get( INSTRUMENT_MANAGER ) ); + m_childContext.put( InstrumentManager.ROLE, m_rootContext.get( InstrumentManager.ROLE ) ); } catch( ContextException ce ) { @@ -829,7 +832,7 @@ // Does the parent supply a logger m_manager? try { - m_childContext.get( INSTRUMENT_MANAGER ); + m_childContext.get( InstrumentManager.ROLE ); // OK, done. return; @@ -842,7 +845,7 @@ } // Get the context Logger Manager - LoggerManager loggerManager = (LoggerManager)m_childContext.get( LOGGER_MANAGER ); + LoggerManager loggerManager = (LoggerManager)m_childContext.get( LoggerManager.ROLE ); // Get the logger for the instrument m_manager Logger imLogger = loggerManager.getLoggerForCategory( @@ -856,7 +859,7 @@ assumeOwnership( instrumentManager ); - m_childContext.put( INSTRUMENT_MANAGER, instrumentManager ); + m_childContext.put( InstrumentManager.ROLE, instrumentManager ); } } @@ -864,7 +867,7 @@ * Will set up a Assembly Descriptor if none is supplied. * * <p>The postcondition is that - * <code>childContext.get( Container.LOGGER_MANAGER )</code> should + * <code>childContext.get( LoggerManager.ROLE )</code> should * return a valid logger m_manager.</p> * * @throws Exception if it cannot instantiate the LoggerManager
-- To unsubscribe, e-mail: <mailto:avalon-cvs-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:avalon-cvs-help@;jakarta.apache.org>