mcconnell 2003/06/15 11:22:30
Modified: merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl
DefaultAppliance.java DefaultApplianceContext.java
merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl
DefaultProfileRepository.java
DefaultRepositoryManager.java
DefaultTypeRepository.java EngineClassLoader.java
merlin/assembly/src/java/org/apache/avalon/assembly/lifecycle/impl
DefaultDeploymentService.java
Log:
Seperated logging channels for appliances under system category as distinct from
user components.
Revision Changes Path
1.11 +9 -3
avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/DefaultAppliance.java
Index: DefaultAppliance.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/DefaultAppliance.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DefaultAppliance.java 12 Jun 2003 18:56:20 -0000 1.10
+++ DefaultAppliance.java 15 Jun 2003 18:22:29 -0000 1.11
@@ -150,7 +150,6 @@
*/
static final String APPLIANCE_ENGINE_KEY =
"urn:assembly:engine";
-
/**
* Appliance system context key.
*/
@@ -254,7 +253,14 @@
*/
private ApplianceRepository m_repository;
+ /**
+ * Flag holding the contextualized state of the block.
+ */
private boolean m_contextualized = false;
+
+ /**
+ * Flag holding the initialized state of the block.
+ */
private boolean m_initialized = false;
//=====================================================================
@@ -784,7 +790,7 @@
// object on demand
//
- File base = (File) m_system.get( "urn:assembly:home" );
+ File base = (File) m_system.get( APPLIANCE_HOME_KEY );
File working = new File( base, "working" );
File home = new File( working, "home" );
1.4 +3 -2
avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/DefaultApplianceContext.java
Index: DefaultApplianceContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/impl/DefaultApplianceContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultApplianceContext.java 29 Apr 2003 17:26:26 -0000 1.3
+++ DefaultApplianceContext.java 15 Jun 2003 18:22:29 -0000 1.4
@@ -249,7 +249,8 @@
if( m_name == null )
{
return getProfile().getName();
- } else
+ }
+ else
{
return m_name;
}
1.2 +12 -17
avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultProfileRepository.java
Index: DefaultProfileRepository.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultProfileRepository.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultProfileRepository.java 29 Apr 2003 14:39:41 -0000 1.1
+++ DefaultProfileRepository.java 15 Jun 2003 18:22:30 -0000 1.2
@@ -70,6 +70,7 @@
import org.apache.avalon.meta.model.Profile;
import org.apache.avalon.meta.model.builder.ProfileBuilder;
import org.apache.avalon.meta.model.verifier.ProfileVerifier;
+import org.apache.avalon.meta.verifier.VerifyException;
import org.apache.excalibur.configuration.ConfigurationUtil;
/**
@@ -169,7 +170,8 @@
try
{
return PROFILE_BUILDER.build( m_classloader, type );
- } catch( Throwable e )
+ }
+ catch( Throwable e )
{
final String error =
"Unable to create packaged profiles for type: "
@@ -201,11 +203,12 @@
try
{
return PROFILE_BUILDER.build( type, config );
- } catch( Throwable e )
+ }
+ catch( Throwable e )
{
final String error =
- "Profile build error while constructing a profile from supplied
configuration:\n"
- + ConfigurationUtil.list( config );
+ "Profile build error while constructing a profile from supplied
configuration:\n"
+ + ConfigurationUtil.list( config );
throw new ProfileException( error, e );
}
}
@@ -265,7 +268,8 @@
try
{
verify( profile );
- } catch( Throwable e )
+ }
+ catch( Throwable e )
{
final String error =
"Could not register the profile: " + profile
@@ -498,7 +502,7 @@
* @param profile the profile to verify
* @exception ProfileException if the verification failes
*/
- private void verify( Profile profile ) throws ProfileException
+ private void verify( Profile profile ) throws VerifyException
{
if( profile == null )
{
@@ -506,15 +510,6 @@
}
ProfileVerifier verifier = new ProfileVerifier();
- try
- {
- verifier.verifyType( profile, m_classloader );
- } catch( Throwable e )
- {
- final String error = "Verification failure for profile: "
- + profile.getName() + " from type: "
- + profile.getType().getInfo().getClassname();
- throw new ProfileException( error, e );
- }
+ verifier.verifyType( profile, m_classloader );
}
}
1.3 +24 -15
avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultRepositoryManager.java
Index: DefaultRepositoryManager.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultRepositoryManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultRepositoryManager.java 29 Apr 2003 14:39:41 -0000 1.2
+++ DefaultRepositoryManager.java 15 Jun 2003 18:22:30 -0000 1.3
@@ -361,10 +361,12 @@
{
Profile[] profiles = m_profiles.loadProfiles( type );
m_profiles.addProfiles( profiles );
- } catch( Throwable e )
+ }
+ catch( Throwable e )
{
- final String warning =
- "Profile registration error from type: " +
type.getInfo().getClassname();
+ final String error =
+ "Profile registration error from type: " +
type.getInfo().getClassname();
+ String warning = ExceptionHelper.packException( error, e, false );
getLogger().warn( warning, e );
}
}
@@ -431,11 +433,11 @@
} catch( Throwable e )
{
final String error =
- "Could not create service defintion from classname: " +
classname;
+ "Could not create service defintion from classname: " + classname;
if( getLogger().isWarnEnabled() )
{
final String warning =
- ExceptionHelper.packException( error, e, false );
+ ExceptionHelper.packException( error, e, false );
getLogger().warn( warning );
}
}
@@ -461,7 +463,8 @@
if( name.endsWith( X_TYPE ) )
{
addType( types, name );
- } else if( name.endsWith( X_INFO ) )
+ }
+ else if( name.endsWith( X_INFO ) )
{
addType( types, name );
}
@@ -474,7 +477,8 @@
try
{
entry = base.getNextEntry();
- } catch( Throwable e )
+ }
+ catch( Throwable e )
{
entry = null;
}
@@ -488,16 +492,18 @@
{
Profile[] profiles = m_profiles.loadProfiles( type );
m_profiles.addProfiles( profiles );
- } catch( Throwable e )
+ }
+ catch( Throwable e )
{
+ final String error =
+ "Profile registration error from type: " +
type.getInfo().getClassname();
final String warning =
- "Profile registration error from type: " +
type.getInfo().getClassname();
- getLogger().warn( warning, e );
+ ExceptionHelper.packException( error, e, false );
+ getLogger().warn( warning );
}
}
}
-
private void load( JarFile base )
{
List types = new ArrayList();
@@ -510,7 +516,8 @@
if( name.endsWith( X_TYPE ) )
{
addType( types, name );
- } else if( name.endsWith( X_INFO ) )
+ }
+ else if( name.endsWith( X_INFO ) )
{
addType( types, name );
}
@@ -531,9 +538,11 @@
m_profiles.addProfiles( profiles );
} catch( Throwable e )
{
- final String warning =
+ final String error =
"Profile registration error from type: " +
type.getInfo().getClassname();
- getLogger().warn( warning, e );
+ final String warning =
+ ExceptionHelper.packException( error, e, false );
+ getLogger().warn( warning );
}
}
}
1.3 +3 -2
avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultTypeRepository.java
Index: DefaultTypeRepository.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/DefaultTypeRepository.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultTypeRepository.java 8 May 2003 03:02:39 -0000 1.2
+++ DefaultTypeRepository.java 15 Jun 2003 18:22:30 -0000 1.3
@@ -190,7 +190,8 @@
{
Class clazz = m_classloader.loadClass( classname );
return createType( clazz );
- } catch( Throwable e )
+ }
+ catch( Throwable e )
{
final String error =
"Unexpected error while attempting to build a type from the
classname: "
1.7 +14 -11
avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/EngineClassLoader.java
Index: EngineClassLoader.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/impl/EngineClassLoader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- EngineClassLoader.java 9 Jun 2003 00:59:14 -0000 1.6
+++ EngineClassLoader.java 15 Jun 2003 18:22:30 -0000 1.7
@@ -344,10 +344,11 @@
new DefaultClasspath( new ClasspathDescriptor() );
}
- if( context.hasEntry( "urn:assembly:home" ) )
+ if( context.hasEntry( Appliance.APPLIANCE_HOME_KEY ) )
{
- m_home = (File) context.get( "urn:assembly:home" );
- } else
+ m_home = (File) context.get( Appliance.APPLIANCE_HOME_KEY );
+ }
+ else
{
m_home = new File( System.getProperty( "user.dir" ) );
}
@@ -711,7 +712,7 @@
context.put( ApplianceRepository.KEY, manager );
context.put( LoggingManager.KEY, m_logging );
- context.put( "urn:assembly:home", m_home );
+ context.put( Appliance.APPLIANCE_HOME_KEY, m_home );
context.put( "urn:assembly:engine.bootstrap", "false" );
context.put( PoolManager.ROLE, m_pool );
@@ -1190,18 +1191,20 @@
try
{
- context.get( "urn:assembly:home" );
- } catch( ContextException ce )
+ context.get( Appliance.APPLIANCE_HOME_KEY );
+ }
+ catch( ContextException ce )
{
- context.put( "urn:assembly:home", m_home );
+ context.put( Appliance.APPLIANCE_HOME_KEY, m_home );
}
try
{
- context.get( "urn:assembly:domain" );
- } catch( ContextException ce )
+ context.get( DOMAIN_KEY );
+ }
+ catch( ContextException ce )
{
- context.put( "urn:assembly:domain", "localhost" );
+ context.put( DOMAIN_KEY, "localhost" );
}
context.put( LoggingManager.KEY, getLoggingManager() );
1.13 +21 -10
avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/lifecycle/impl/DefaultDeploymentService.java
Index: DefaultDeploymentService.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/lifecycle/impl/DefaultDeploymentService.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- DefaultDeploymentService.java 12 Jun 2003 18:56:19 -0000 1.12
+++ DefaultDeploymentService.java 15 Jun 2003 18:22:30 -0000 1.13
@@ -418,20 +418,31 @@
private void handleLogging( Appliance appliance, LogEnabled object ) throws
Exception
{
String path = appliance.getPath();
-
- if( getLogger().isDebugEnabled() )
+ LoggingDirective logging = appliance.getLoggingDirective();
+ if( object instanceof Appliance )
{
- getLogger().debug( "logging: " + appliance );
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "logging (sys): " + appliance + " on path: " +
path );
+ }
+ m_logging.addSystemCategories( path, logging );
+ Logger logger = m_logging.getSystemLoggerForCategory( path );
+ ((LogEnabled)object).enableLogging( logger );
+ }
+ else
+ {
+ if( getLogger().isDebugEnabled() )
+ {
+ getLogger().debug( "logging: " + appliance + " on path: " + path );
+ }
+ m_logging.addCategories( path, logging );
+ Logger logger = m_logging.getLoggerForCategory( path );
+ ((LogEnabled)object).enableLogging( logger );
}
-
- LoggingDirective logging = appliance.getLoggingDirective();
- m_logging.addCategories( path, logging );
- Logger logger = m_logging.getLoggerForCategory( path );
- ((LogEnabled)object).enableLogging( logger );
}
/**
- * Configure a configuratble object based ot he configuration information
+ * Configure a configurable object based on the configuration information
* exposed by the supplied appliance.
*
* @param object the object to configure
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]