You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/03/04 10:07:33 UTC
cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/service ServiceFactory.java ServiceLoader.java ServiceLoaderContext.java
mcconnell 02/03/04 01:07:33
Modified: src/scratchpad/org/apache/avalon/excalibur/service
ServiceFactory.java ServiceLoader.java
ServiceLoaderContext.java
Log:
context cleanup
Revision Changes Path
1.5 +3 -1 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/service/ServiceFactory.java
Index: ServiceFactory.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/service/ServiceFactory.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ServiceFactory.java 4 Mar 2002 04:38:22 -0000 1.4
+++ ServiceFactory.java 4 Mar 2002 09:07:33 -0000 1.5
@@ -59,6 +59,7 @@
private Hashtable m_transients = new Hashtable();
private File m_root;
private boolean m_verbose;
+ private Logger m_base_logger;
private Hashtable m_services = new Hashtable();
private Hashtable m_lookup = new Hashtable();
@@ -73,6 +74,7 @@
public void enableLogging( Logger logger )
{
+ m_base_logger = logger;
super.enableLogging( logger.getChildLogger( "factory" ) );
m_registry.enableLogging( logger.getChildLogger("registry") );
}
@@ -249,7 +251,7 @@
if( m_object instanceof LogEnabled ) try
{
if( m_verbose ) getLogger().debug( "applying logger to " + role );
- ((LogEnabled)m_object).enableLogging( getLogger().getChildLogger( role ) );
+ ((LogEnabled)m_object).enableLogging( m_base_logger.getChildLogger( role ) );
}
catch( Throwable e )
{
1.5 +12 -14 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/service/ServiceLoader.java
Index: ServiceLoader.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/service/ServiceLoader.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ServiceLoader.java 4 Mar 2002 04:38:22 -0000 1.4
+++ ServiceLoader.java 4 Mar 2002 09:07:33 -0000 1.5
@@ -120,14 +120,6 @@
* that may be instantiated during the recursive dependecy resolution process.
* </td></tr>
* <tr>
- * <td width="20%" valign="top"><code>CONFIGURATION_FILE_KEY</code></td>
- * <td>
- * A <code>File</code> instance that may or may not exist. If the file exists and is
- * confiugration, it will be used as the base configuration reference when looking up
- * service configuration details. The default behaviour is to look for a file named
- * "config.xml" in the user's working directory.
- * </td></tr>
- * <tr>
* <td width="20%" valign="top"><code>DISPOSAL_POLICY_KEY</code></td>
* <td>
* A <code>Boolean</code> value that is applied on completionof the startup of a
@@ -174,7 +166,6 @@
private String[] m_args;
private PipelineClassLoader m_classloader;
- private Priority m_priority = Priority.INFO;
private String m_target;
private Object m_object;
private File[] m_includes;
@@ -270,8 +261,7 @@
{
CLI cli = new CLI( args );
- ServiceLoaderContext context = cli.getContext();
- Hierarchy hierarchy = createBootstrapLogger( context.getLoggingPriority() );
+ Hierarchy hierarchy = createBootstrapLogger( cli.getLoggingPriority() );
Logger logger = new LogKitLogger( hierarchy.getLoggerFor( "loader" ) );
File path = cli.getConfigurationPath();
@@ -281,7 +271,7 @@
pipeline = new ServiceLoader();
pipeline.enableLogging( logger );
pipeline.configure( config );
- pipeline.contextualize( context );
+ pipeline.contextualize( cli.getContext() );
pipeline.initialize();
}
catch( IllegalParameterException ipe )
@@ -338,7 +328,6 @@
ServiceLoaderContext c = (ServiceLoaderContext) context;
m_includes = c.getIncludes();
m_verbose = c.getVerbose();
- m_priority = c.getLoggingPriority();
m_policy = c.getDisposalPolicy();
m_target = c.getTarget();
}
@@ -813,12 +802,21 @@
public ServiceLoaderContext getContext()
{
- return new ServiceLoaderContext( m_args, m_target, m_files, m_policy, m_priority, m_verbose );
+ return new ServiceLoaderContext( m_args, m_target, m_files, m_policy, m_verbose );
}
public File getConfigurationPath()
{
return m_path;
+ }
+
+ /**
+ * Returns the logging priority.
+ * @return Priority the logging priority to apply.
+ */
+ public Priority getLoggingPriority()
+ {
+ return m_priority;
}
}
}
1.2 +1 -25 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/service/ServiceLoaderContext.java
Index: ServiceLoaderContext.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/service/ServiceLoaderContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceLoaderContext.java 3 Mar 2002 15:51:12 -0000 1.1
+++ ServiceLoaderContext.java 4 Mar 2002 09:07:33 -0000 1.2
@@ -52,12 +52,6 @@
public static final String DISPOSAL_POLICY_KEY = "DISPOSAL.POLICY";
/**
- * Context key for the logging priority.
- * @see #getLoggingPriority()
- */
- public static final String LOGGING_PRIORITY_KEY = "LOGGING.PRIORITY";
-
- /**
* Context key for the verbose policy.
* @see #getVerbose()
*/
@@ -73,7 +67,7 @@
* @param priority logging priority
* @param verbose policy concerning display of loader debug messages
*/
- public ServiceLoaderContext( final String[] args, final String target, final File[] includes, final boolean disposal, final Priority priority, final boolean verbose )
+ public ServiceLoaderContext( final String[] args, final String target, final File[] includes, final boolean disposal, final boolean verbose )
{
super.put( ARGS_KEY, args );
super.put( TARGET_KEY, target );
@@ -81,7 +75,6 @@
super.put( INCLUDES_KEY, includes );
super.put( DISPOSAL_POLICY_KEY, new Boolean( disposal ));
super.put( VERBOSE_POLICY_KEY, new Boolean( verbose ));
- super.put( LOGGING_PRIORITY_KEY, priority );
}
/**
@@ -166,23 +159,6 @@
catch( ContextException e )
{
final String error = "Unexpected exception while retrieving include files.";
- throw new PipelineRuntimeException( error, e );
- }
- }
-
- /**
- * Returns the logging priority.
- * @return Priority the logging priority to apply.
- */
- public Priority getLoggingPriority()
- {
- try
- {
- return (Priority) super.get( LOGGING_PRIORITY_KEY );
- }
- catch( ContextException e )
- {
- final String error = "Unexpected exception while retrieving logging priority.";
throw new PipelineRuntimeException( error, e );
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>