mcconnell 2003/08/18 04:26:06
Modified: merlin/activation/src/java/org/apache/avalon/activation/appliance/impl
DefaultAppliance.java DefaultBlock.java
merlin/activation/src/test/org/apache/avalon/activation/appliance
AbstractTestCase.java
merlin/composition/src/java/org/apache/avalon/composition/logging/impl
DefaultLoggingManager.java
merlin/composition/src/java/org/apache/avalon/composition/model/impl
DefaultContainmentModel.java
DefaultDeploymentModel.java
DefaultSystemContext.java
merlin/composition-spi/src/java/org/apache/avalon/composition/data
CategoriesDirective.java
merlin/composition-spi/src/java/org/apache/avalon/composition/logging
LoggingDescriptor.java LoggingManager.java
merlin/composition-spi/src/java/org/apache/avalon/composition/model
DeploymentModel.java
merlin/kernel/bootstrap/src/java Merlin.java
merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
CLIKernelLoader.java DefaultKernel.java
DefaultKernelContext.java
merlin/kernel/spi project.xml
merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel
Kernel.java KernelContext.java
merlin/merlin-platform/src/repository/merlin/xmls
kernel-3.0.xml kernel-service-3.0.xml
merlin/merlin-platform/tutorials project.xml
merlin/merlin-platform/tutorials/configuration/block
maven.xml project.xml
Log:
Enhancements to the logging system and error management.
Revision Changes Path
1.3 +2 -18
avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java
Index: DefaultAppliance.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultAppliance.java 8 Aug 2003 10:59:00 -0000 1.2
+++ DefaultAppliance.java 18 Aug 2003 11:26:05 -0000 1.3
@@ -154,11 +154,6 @@
*/
private final ServiceContext m_context;
- /**
- * The logging channel for components created by this appliance.
- */
- private final Logger m_targetLogger;
-
//-------------------------------------------------------------------
// mutable state
//-------------------------------------------------------------------
@@ -199,8 +194,6 @@
m_context = context;
m_model = (DeploymentModel) model;
m_engine = engine;
- m_targetLogger =
- getTargetLogger( context.getLoggingManager(), m_model );
}
//-------------------------------------------------------------------
@@ -705,16 +698,7 @@
{
if( instance instanceof LogEnabled )
{
- if( m_targetLogger != null )
- {
- ((LogEnabled)instance).enableLogging( m_targetLogger );
- }
- else
- {
- final String error =
- REZ.getString( "lifecycle.logging.internal.error" );
- throw new IllegalStateException( error );
- }
+ ((LogEnabled)instance).enableLogging( getLogger() );
}
}
1.6 +11 -7
avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlock.java
Index: DefaultBlock.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlock.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultBlock.java 17 Aug 2003 15:06:41 -0000 1.5
+++ DefaultBlock.java 18 Aug 2003 11:26:05 -0000 1.6
@@ -117,7 +117,7 @@
ServiceContext context, ContainmentModel model ) throws Exception
{
Logger logger =
- context.getLoggingManager().getSystemLoggerForCategory( "" );
+ context.getLoggingManager().getLoggerForCategory( "" );
ApplianceRepository repository =
new DefaultApplianceRepository();
DependencyGraph graph = new DependencyGraph();
@@ -848,23 +848,27 @@
public Appliance createAppliance( Model model ) throws ApplianceException
{
final String path = model.getPath() + model.getName();
- Logger logger = m_context.getLoggingManager().getSystemLoggerForCategory(
path );
-
Appliance appliance = null;
if( model instanceof DeploymentModel )
{
- logger.debug( "creating appliance: " + path );
+ getLogger().debug( "creating appliance: " + path );
DeploymentModel deployment = (DeploymentModel) model;
+ CategoriesDirective categories = deployment.getCategories();
+ if( categories != null )
+ {
+ m_context.getLoggingManager().addCategories( path, categories );
+ }
+ Logger logger = m_context.getLoggingManager().getLoggerForCategory(
path );
appliance = new DefaultAppliance( logger, m_context, deployment, this );
}
else if( model instanceof ContainmentModel )
{
- logger.debug( "creating block: " + path );
+ getLogger().debug( "creating block: " + path );
ContainmentModel containment = (ContainmentModel) model;
ApplianceRepository repository =
new DefaultApplianceRepository( m_repository );
-
+ Logger logger = m_context.getLoggingManager().getLoggerForCategory(
path );
appliance =
new DefaultBlock(
logger, containment, new DependencyGraph( m_graph ), m_context,
1.3 +4 -5
avalon-sandbox/merlin/activation/src/test/org/apache/avalon/activation/appliance/AbstractTestCase.java
Index: AbstractTestCase.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/activation/src/test/org/apache/avalon/activation/appliance/AbstractTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractTestCase.java 11 Aug 2003 22:58:46 -0000 1.2
+++ AbstractTestCase.java 18 Aug 2003 11:26:05 -0000 1.3
@@ -82,7 +82,7 @@
{
File base = new File( getTestDir(), "test-classes" );
LoggingManager logging = createLoggingManager( base );
- m_logger = logging.getSystemLoggerForCategory( "" );
+ m_logger = logging.getLoggerForCategory( "" );
PoolManager pool = createPoolManager();
//
@@ -202,12 +202,11 @@
LoggingDescriptor logging =
new LoggingDescriptor(
"", "DEBUG", null,
- new TargetDescriptor[0],
- new CategoryDirective( "logging", "WARN" ),
- null );
+ new CategoryDirective[0],
+ new TargetDescriptor[0] );
DefaultLoggingManager manager =
- new DefaultLoggingManager( base, "sys", logging );
+ new DefaultLoggingManager( base, logging );
return manager;
}
1.4 +81 -151
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/logging/impl/DefaultLoggingManager.java
Index: DefaultLoggingManager.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/logging/impl/DefaultLoggingManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultLoggingManager.java 11 Aug 2003 22:58:49 -0000 1.3
+++ DefaultLoggingManager.java 18 Aug 2003 11:26:05 -0000 1.4
@@ -64,6 +64,7 @@
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.logger.AvalonFormatter;
import org.apache.avalon.framework.logger.LogKitLogger;
+import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.composition.data.CategoryDirective;
import org.apache.avalon.composition.data.CategoriesDirective;
import org.apache.log.Hierarchy;
@@ -81,66 +82,41 @@
*/
public class DefaultLoggingManager implements LoggingManager
{
- //===============================================================
+ //---------------------------------------------------------------
// static
- //===============================================================
-
- public static final String SYSTEM_CATEGORY_DEFAULT = "sys";
-
- public static final String USER_CATEGORY_DEFAULT = "root";
+ //---------------------------------------------------------------
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultLoggingManager.class );
- /**
- * The default logging priority value.
- */
- public static final String DEFAULT_PRIORITY = "INFO";
-
- /**
- * The default logging target name.
- */
- public static final String DEFAULT_TARGET = "default";
-
- private static final String DEFAULT_FORMAT =
- "[%7.7{priority}] (%{category}): %{message}\\n%{throwable}";
-
- /**
- * The default fallback log target.
- */
private static final StreamTarget DEFAULT_STREAM =
new StreamTarget( System.out, new AvalonFormatter( DEFAULT_FORMAT ) );
- //===============================================================
+ //---------------------------------------------------------------
// state
- //===============================================================
+ //---------------------------------------------------------------
/**
- * Base directory of file targets.
+ * Base directory for file targets.
*/
private File m_baseDirectory;
/**
- * The list of logging targets.
+ * The list of named logging targets.
*/
- private LoggingDescriptor m_descriptor;
+ private final HashMap m_targets = new HashMap();
/**
* The implementation log hierarchy.
*/
- private Hierarchy m_logHierarchy;
+ private Hierarchy m_hierarchy = new Hierarchy();
/**
- * The default logging channel.
+ * The bootstrap logging channel.
*/
private org.apache.avalon.framework.logger.Logger m_logger;
- /**
- * The list of logging targets.
- */
- private final HashMap m_targets = new HashMap();
-
- private String m_system;
+ private final boolean m_debug;
//==============================================================
// constructor
@@ -155,73 +131,56 @@
* @param descriptor the logging system descriptor (may be null)
*/
public DefaultLoggingManager(
- File base, String system, LoggingDescriptor descriptor ) throws Exception
+ File base, LoggingDescriptor descriptor ) throws Exception
{
- m_baseDirectory = base;
- if( system != null )
- {
- m_system = filter( system );
- }
- else
- {
- m_system = SYSTEM_CATEGORY_DEFAULT;
- }
+ this( base, descriptor, false );
+ }
- if( descriptor != null )
- {
- m_descriptor = descriptor;
- }
- else
- {
- m_descriptor =
- new LoggingDescriptor(
- "", null, null, new TargetDescriptor[0],
- new CategoryDirective( "logging", "DEBUG", null ),
- null );
- }
+ /**
+ * <p>Application of a runtime context to the manager.
+ * The context value will be passed directly to lifestyle handlers
+ * established by this service.
+ * @param logger the bootstrap logging channel
+ * @param base the directory for logging targets
+ * @param system the name of the system logging category (may be null)
+ * @param descriptor the logging system descriptor (may be null)
+ */
+ public DefaultLoggingManager(
+ File base, LoggingDescriptor descriptor, boolean debug ) throws Exception
+ {
+ if( descriptor == null ) throw new NullPointerException( "descriptor" );
+ if( base == null ) throw new NullPointerException( "base" );
+
+ m_baseDirectory = base;
+ m_debug = debug;
//
// setup the hierarchy, default logging target, and default priority
//
- m_logHierarchy = new Hierarchy();
getHierarchy().setDefaultLogTarget( DEFAULT_STREAM );
m_targets.put( DEFAULT_TARGET, DEFAULT_STREAM );
- String priority;
- if( m_descriptor.getPriority() != null )
+ if( descriptor.getPriority() != null )
{
- priority = m_descriptor.getPriority();
- }
+ getHierarchy().setDefaultPriority(
+ Priority.getPriorityForName( descriptor.getPriority() ) );
+ if( m_debug ) log( "setting default priority: " +
descriptor.getPriority() );
+ }
else
{
- priority = DEFAULT_PRIORITY;
+ getHierarchy().setDefaultPriority(
+ Priority.getPriorityForName( DEFAULT_PRIORITY ) );
+ if( m_debug ) log( "using default priority: " + DEFAULT_PRIORITY );
}
- getHierarchy().setDefaultPriority( Priority.getPriorityForName( priority )
);
-
- //
- // setup the bootstrap logging category
- //
-
- CategoryDirective bootstrap = m_descriptor.getBootstrapCategory();
-
- m_logger =
- new LogKitLogger(
- addCategory(
- bootstrap.getName(),
- bootstrap.getPriority(),
- bootstrap.getTarget(),
- false ) );
-
- m_logger.debug( "setting default priority: " + priority );
-
//
// build targets based on the information contained in the descriptor
//
- TargetDescriptor[] targets = m_descriptor.getTargetDescriptors();
+ TargetDescriptor[] targets = descriptor.getTargetDescriptors();
for( int i = 0; i < targets.length; i++ )
{
+ TargetDescriptor target = targets[i];
addTarget( targets[i] );
}
@@ -229,7 +188,7 @@
// set the default target
//
- String name = m_descriptor.getTarget();
+ String name = descriptor.getTarget();
if( name != null )
{
LogTarget target = (LogTarget) m_targets.get( name );
@@ -240,16 +199,20 @@
else
{
throw new LoggerException(
- "Supplied default logging target: '"
- + name + "' does not exist." );
+ "Supplied default logging target: '"
+ + name + "' does not exist." );
}
}
-
- if( m_descriptor.getSystemCategories() != null )
+ else
{
- addCategories( m_descriptor.getSystemCategories() );
+ getHierarchy().setDefaultLogTarget( DEFAULT_STREAM );
}
+ addCategories( descriptor.getName(), descriptor );
+
+ final String channel = descriptor.getName() + ".logging";
+ m_logger = getLoggerForCategory( channel );
+ if( m_debug ) log( "logging category: " + channel );
}
//===============================================================
@@ -268,14 +231,15 @@
/**
* Add a set of category entries relative to the supplied base category
* path, using the supplied descriptor as the definition of subcategories.
- * @param path the category base path
+ * @param root the category base path
* @param descriptor a set of category descriptors to be added under
* the base path
*/
- public void addCategories( String path, CategoriesDirective descriptor )
+ public void addCategories( String root, CategoriesDirective directive )
{
- addCategory( path, descriptor.getPriority(), descriptor.getTarget() );
- CategoryDirective[] categories = descriptor.getCategories();
+ final String path = filter( root );
+ addCategory( path, directive.getPriority(), directive.getTarget() );
+ CategoryDirective[] categories = directive.getCategories();
for( int i = 0; i < categories.length; i++ )
{
CategoryDirective category = categories[i];
@@ -284,7 +248,8 @@
if( path.equals( "" ) )
{
addCategory( category.getName(), priority, target );
- } else
+ }
+ else
{
addCategory( path + "." + category.getName(), priority, target );
}
@@ -292,31 +257,6 @@
}
/**
- * Add a set of category entries relative to the system category
- * using the supplied descriptor as the definition of subcategories.
- * @param path the category base path
- * @param descriptor a set of category descriptors to be added under
- * the system path
- */
- public void addSystemCategories( String path, CategoriesDirective descriptor )
- {
- final String category = convertToSystem( path );
- addCategories( category, descriptor );
- }
-
- /**
- * Create a system logging channel.
- *
- * @param path the category path
- * @return the logging channel
- */
- public org.apache.avalon.framework.logger.Logger getSystemLoggerForCategory(
final String path )
- {
- final String category = convertToSystem( path );
- return getLoggerForCategory( category );
- }
-
- /**
* Create a logging channel configured with the supplied category path,
* priority and target.
*
@@ -341,8 +281,9 @@
* @return the logging channel
* @throws Exception if an error occurs
*/
- public org.apache.avalon.framework.logger.Logger getLoggerForCategory( final
CategoryDirective category )
- throws Exception
+ public org.apache.avalon.framework.logger.Logger getLoggerForCategory(
+ final CategoryDirective category )
+ throws Exception
{
return new LogKitLogger(
addCategory(
@@ -367,33 +308,21 @@
if( category == null )
{
return new LogKitLogger( getHierarchy().getLoggerFor( "" ) );
- } else
+ }
+ else
{
String cat = filter( category );
try
{
return new LogKitLogger( getHierarchy().getLoggerFor( cat ) );
- } catch( Throwable e )
+ }
+ catch( Throwable e )
{
throw new RuntimeException( "Bad category: " + cat );
}
}
}
- /**
- * Return the default Logger. This is the same
- * as getting the Logger for the "" category.
- * @return the default logging channel
- */
- public org.apache.avalon.framework.logger.Logger getDefaultLogger()
- {
- if( m_logger == null )
- {
- m_logger = getLoggerForCategory( "" );
- }
- return m_logger;
- }
-
private Logger addCategory( String path, String priority, String target )
{
return addCategory( path, priority, target, true );
@@ -404,13 +333,15 @@
final String name = filter( path );
final Logger logger;
+ if( m_debug ) log( "add category: " + name );
+
try
{
logger = getHierarchy().getLoggerFor( name );
- }
+ }
catch( Throwable e )
{
- throw new RuntimeException( "Bad category: " + path + " or trans: " +
name );
+ throw new RuntimeException( "Bad category: " + name );
}
if( priority != null )
@@ -418,7 +349,7 @@
final Priority priorityValue = Priority.getPriorityForName( priority );
if( !priorityValue.getName().equals( priority ) )
{
- final String message = REZ.getString( "unknown-priority", priority,
path );
+ final String message = REZ.getString( "unknown-priority", priority,
name );
throw new IllegalArgumentException( message );
}
logger.setPriority( priorityValue );
@@ -436,18 +367,12 @@
}
}
- if( notify && getLogger().isInfoEnabled() )
- {
- final String message =
- REZ.getString( "category-create", name, target, priority );
- getLogger().debug( message );
- }
-
return logger;
}
private String filter( String name )
{
+ if( name == null ) return "";
String path = name.replace( '/', '.' );
if( path.startsWith( "." ) )
{
@@ -500,13 +425,18 @@
private Hierarchy getHierarchy()
{
- return m_logHierarchy;
+ return m_hierarchy;
}
- private String convertToSystem( String path )
+ private void log( String message )
{
- return m_system + "." + filter( path );
+ if( getLogger() != null )
+ {
+ getLogger().debug( message );
+ }
+ else
+ {
+ System.out.println( message );
+ }
}
-
-
}
1.25 +28 -1
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
Index: DefaultContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- DefaultContainmentModel.java 17 Aug 2003 15:06:41 -0000 1.24
+++ DefaultContainmentModel.java 18 Aug 2003 11:26:05 -0000 1.25
@@ -538,6 +538,33 @@
return createContainmentModel( getName( name, profile ), profile );
}
+ else if( path.endsWith( "/" ) )
+ {
+ final URL blockURL = new URL( url.toString() +
"BLOCK-INF/block.xml" );
+ final InputStream stream = blockURL.openStream();
+
+ try
+ {
+ final ContainmentProfile profile =
+ BUILDER.createContainmentProfile( stream );
+
+ final String message =
+ "including block: " + blockURL.toString();
+ getLogger().debug( message );
+
+ return createContainmentModel(
+ getName( name, profile ), profile, new URL[]{ url } );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unable to create local block [" + blockURL.toString()
+ + "] in the containmment model ["
+ + getQualifiedName()
+ + "] due to a build related error.";
+ throw new ModelException( error, e );
+ }
+ }
else
{
final String error =
1.21 +18 -2
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java
Index: DefaultDeploymentModel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModel.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- DefaultDeploymentModel.java 17 Aug 2003 06:35:51 -0000 1.20
+++ DefaultDeploymentModel.java 18 Aug 2003 11:26:05 -0000 1.21
@@ -129,6 +129,8 @@
// mutable state
//==============================================================
+ private CategoriesDirective m_categories;
+
private Configuration m_config;
private Parameters m_parameters;
@@ -155,6 +157,7 @@
m_context = context;
m_activation = m_context.getProfile().getActivationPolicy();
+ m_categories = m_context.getProfile().getCategories();
ClassLoader classLoader = m_context.getClassLoader();
@@ -299,7 +302,20 @@
*/
public CategoriesDirective getCategories()
{
- return m_context.getProfile().getCategories();
+ return m_categories;
+ }
+
+ /**
+ * Set categories.
+ * @param categories
+ */
+ public void setCategories( CategoriesDirective categories )
+ {
+ //
+ // TODO: merge categories with profile categories
+ //
+
+ m_categories = categories;
}
/**
1.11 +6 -8
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContext.java
Index: DefaultSystemContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultSystemContext.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DefaultSystemContext.java 17 Aug 2003 06:35:51 -0000 1.10
+++ DefaultSystemContext.java 18 Aug 2003 11:26:05 -0000 1.11
@@ -101,7 +101,7 @@
File base, File root, int priority ) throws Exception
{
LoggingManager logging = createLoggingManager( base, priority );
- Logger logger = logging.getSystemLoggerForCategory( "" );
+ Logger logger = logging.getLoggerForCategory( "" );
Repository repository = createRepository( root );
return new DefaultSystemContext( logging, base, repository );
}
@@ -118,12 +118,11 @@
LoggingDescriptor logging =
new LoggingDescriptor(
"", level, null,
- new TargetDescriptor[0],
- new CategoryDirective( "logging", "WARN" ),
- null );
+ new CategoryDirective[0],
+ new TargetDescriptor[0] );
DefaultLoggingManager manager =
- new DefaultLoggingManager( base, "sys", logging );
+ new DefaultLoggingManager( base, logging );
return manager;
}
@@ -292,7 +291,7 @@
m_trace = trace;
m_repository = repository;
m_logging = logging;
- m_logger = m_logging.getSystemLoggerForCategory( "" );
+ m_logger = m_logging.getLoggerForCategory( "" );
m_system = DefaultSystemContext.class.getClassLoader();
m_common = Logger.class.getClassLoader();
@@ -407,5 +406,4 @@
{
return m_logger;
}
-
}
1.3 +13 -3
avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/CategoriesDirective.java
Index: CategoriesDirective.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/CategoriesDirective.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CategoriesDirective.java 19 Jul 2003 01:54:37 -0000 1.2
+++ CategoriesDirective.java 18 Aug 2003 11:26:05 -0000 1.3
@@ -62,7 +62,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision$ $Date$
*/
-public final class CategoriesDirective extends CategoryDirective implements
Serializable
+public class CategoriesDirective extends CategoryDirective implements Serializable
{
/**
* The root category hierachy.
@@ -74,9 +74,19 @@
*
* @param name the base category name
*/
+ public CategoriesDirective()
+ {
+ this( "" );
+ }
+
+ /**
+ * Create a CategoriesDirective instance.
+ *
+ * @param name the base category name
+ */
public CategoriesDirective( final String name )
{
- this( name, null, null, new CategoryDirective[ 0 ] );
+ this( name, null, null, new CategoryDirective[0] );
}
/**
1.4 +14 -45
avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/logging/LoggingDescriptor.java
Index: LoggingDescriptor.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/logging/LoggingDescriptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LoggingDescriptor.java 11 Aug 2003 22:58:50 -0000 1.3
+++ LoggingDescriptor.java 18 Aug 2003 11:26:05 -0000 1.4
@@ -85,7 +85,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision$ $Date$
*/
-public final class LoggingDescriptor extends CategoryDirective
+public final class LoggingDescriptor extends CategoriesDirective
{
/**
@@ -94,25 +94,11 @@
private final TargetDescriptor[] m_targets;
/**
- * The bootstrap logging category.
- */
- private final CategoryDirective m_bootstrap;
-
- /**
- * The system logging directives
- */
- private final CategoriesDirective m_system;
-
- /**
* Create a LoggingDescriptor instance.
*/
public LoggingDescriptor()
{
- this(
- "", null, null, new TargetDescriptor[0],
- new CategoryDirective( "logging" ),
- null
- );
+ this( "", null, null, new CategoryDirective[0], new TargetDescriptor[0] );
}
/**
@@ -130,14 +116,18 @@
final String root,
final String priority,
final String target,
- final TargetDescriptor[] targets,
- final CategoryDirective bootstrap,
- final CategoriesDirective system )
+ final CategoryDirective[] categories,
+ final TargetDescriptor[] targets )
{
- super( root, priority, target );
- m_targets = targets;
- m_bootstrap = bootstrap;
- m_system = system;
+ super( root, priority, target, categories );
+ if( targets == null )
+ {
+ m_targets = new TargetDescriptor[0];
+ }
+ else
+ {
+ m_targets = targets;
+ }
}
/**
@@ -148,26 +138,5 @@
public TargetDescriptor[] getTargetDescriptors()
{
return m_targets;
- }
-
- /**
- * Return the bootstrap logging category to which the logging manager will
- * log information about its own activities.
- *
- * @return the category
- */
- public CategoryDirective getBootstrapCategory()
- {
- return m_bootstrap;
- }
-
- /**
- * Return the system logging category directives.
- *
- * @return the categories
- */
- public CategoriesDirective getSystemCategories()
- {
- return m_system;
}
}
1.3 +16 -26
avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/logging/LoggingManager.java
Index: LoggingManager.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/logging/LoggingManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LoggingManager.java 17 Jul 2003 21:22:00 -0000 1.2
+++ LoggingManager.java 18 Aug 2003 11:26:05 -0000 1.3
@@ -63,9 +63,23 @@
/**
* Standard context key for the logging manager.
*/
- static final String KEY = "urn:assembly:logging";
+ String KEY = "urn:assembly:logging";
- static final String SYSTEM_CATEGORY_KEY =
"urn:avalon:assembly.logging.system-category";
+ /**
+ * The default logging priority value.
+ */
+ String DEFAULT_PRIORITY = "INFO";
+
+ /**
+ * The default logging target name.
+ */
+ String DEFAULT_TARGET = "default";
+
+ /**
+ * The default logging format.
+ */
+ String DEFAULT_FORMAT =
+ "[%7.7{priority}] (%{category}): %{message}\\n%{throwable}";
/**
* Add a set of category entries using the supplied categories descriptor.
@@ -83,24 +97,6 @@
public void addCategories( String path, CategoriesDirective descriptor );
/**
- * Add a set of category entries relative to the system category
- * using the supplied descriptor as the definition of subcategories.
- * @param path the category base path
- * @param descriptor a set of category descriptors to be added under
- * the system path
- */
- public void addSystemCategories( String path, CategoriesDirective descriptor );
-
- /**
- * Create a system logging channel.
- *
- * @param category the category path
- * @return the logging channel
- */
- public Logger getSystemLoggerForCategory( final String category );
-
-
- /**
* Create a logging channel configured with the supplied category path,
* priority and target.
*
@@ -132,10 +128,4 @@
*/
public Logger getLoggerForCategory( final String category );
- /**
- * Return the default Logger. This is the same
- * as getting the Logger for the "" category.
- * @return the default logging channel
- */
- public Logger getDefaultLogger();
}
1.12 +7 -1
avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/DeploymentModel.java
Index: DeploymentModel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/DeploymentModel.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DeploymentModel.java 2 Aug 2003 09:12:34 -0000 1.11
+++ DeploymentModel.java 18 Aug 2003 11:26:05 -0000 1.12
@@ -86,6 +86,12 @@
CategoriesDirective getCategories();
/**
+ * Set categories.
+ * @param categories
+ */
+ void setCategories( CategoriesDirective categories );
+
+ /**
* Set the activation policy for the model.
* @param the activaltion policy
*/
1.5 +0 -4 avalon-sandbox/merlin/kernel/bootstrap/src/java/Merlin.java
Index: Merlin.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/kernel/bootstrap/src/java/Merlin.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Merlin.java 17 Aug 2003 15:06:41 -0000 1.4
+++ Merlin.java 18 Aug 2003 11:26:05 -0000 1.5
@@ -217,10 +217,6 @@
constructor.newInstance(
new Object[]{ repository, args } );
}
- catch( InvocationTargetException e )
- {
- return;
- }
catch( Throwable e )
{
final String error =
1.5 +17 -4
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/CLIKernelLoader.java
Index: CLIKernelLoader.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/CLIKernelLoader.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CLIKernelLoader.java 17 Aug 2003 15:06:41 -0000 1.4
+++ CLIKernelLoader.java 18 Aug 2003 11:26:05 -0000 1.5
@@ -69,11 +69,24 @@
if( context.getDebugFlag() )
{
- System.out.println( "\n");
+ System.out.println( "");
System.out.println( context.toString() );
+ System.out.println( "");
+ }
+
+ try
+ {
+ Kernel kernel = new DefaultKernel( context );
+ setShutdownHook( kernel );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "\nInternal error during kernel instantiation.";
+ String msg =
+ ExceptionHelper.packException( error, e, true );
+ System.err.println( msg );
}
- Kernel kernel = new DefaultKernel( context );
- setShutdownHook( kernel );
}
//--------------------------------------------------------------------------
@@ -204,7 +217,7 @@
catch( Throwable e )
{
final String error =
- "Internal error during kernel creation.";
+ "Internal error during kernel context creation.";
throw new KernelException( error, e );
}
}
1.5 +101 -48
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java
Index: DefaultKernel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultKernel.java 17 Aug 2003 15:06:41 -0000 1.4
+++ DefaultKernel.java 18 Aug 2003 11:26:05 -0000 1.5
@@ -118,19 +118,19 @@
// constructor
//--------------------------------------------------------------
- public DefaultKernel( final KernelContext context ) throws Exception
+ public DefaultKernel( final KernelContext context ) throws KernelException
{
if( context == null ) throw new NullPointerException( "context" );
m_context = context;
- LoggingManager logging = context.getLoggingManager();
- enableLogging( logging.getSystemLoggerForCategory( "" ) );
+
+ enableLogging( context.getKernelLogger() );
//
// create the root block into which we install application blocks
//
- getLogger().info( "context establishment" );
+ getLogger().debug( "containment context establishment" );
ContainmentContext contaiment = null;
try
{
@@ -139,20 +139,16 @@
context.getKernelDirective().getChild( "container" ) );
contaiment = context.getModelFactory().createContainmentContext(
profile );
- Thread.currentThread().setContextClassLoader(
contaiment.getClassLoader() );
+ Thread.currentThread().setContextClassLoader(
contaiment.getClassLoader() );
}
catch( Throwable e )
{
final String error =
"Internal error while build default containment context.";
- String msg =
- ExceptionHelper.packException( error, e, context.getDebugFlag() );
- getLogger().error( msg );
- shutdown();
- throw new RuntimeException( msg );
+ throw new KernelException( error, e );
}
- getLogger().info( "construction phase" );
+ getLogger().debug( "construction phase" );
try
{
@@ -162,11 +158,7 @@
{
final String error =
"Internal error while build default containment model.";
- String msg =
- ExceptionHelper.packException( error, e, context.getDebugFlag() );
- getLogger().error( msg );
- shutdown();
- throw new RuntimeException( msg );
+ throw new KernelException( error, e );
}
m_self.setEnabled( true );
@@ -175,12 +167,12 @@
// install any block declared within the kernel context
//
- getLogger().info( "install phase" );
+ getLogger().debug( "install phase" );
URL[] urls = context.getInstallSequence();
for( int i=0; i<urls.length; i++ )
{
URL url = urls[i];
- getLogger().info( "installing block: " + url );
+ getLogger().info( "installing: " + url );
try
{
m_model.addModel( url );
@@ -189,11 +181,7 @@
{
final String error =
"Block install failure: " + url;
- String msg =
- ExceptionHelper.packException( error, e, context.getDebugFlag() );
- getLogger().error( msg );
- shutdown();
- throw new RuntimeException( msg );
+ throw new KernelException( error, e );
}
}
@@ -202,7 +190,7 @@
// targets directive
//
- getLogger().info( "customization phase" );
+ getLogger().debug( "customization phase" );
TargetDirective[] targets = context.getTargetDirectives();
for( int i=0; i<targets.length; i++ )
{
@@ -212,7 +200,14 @@
if( model instanceof DeploymentModel )
{
DeploymentModel deployment = (DeploymentModel) model;
- deployment.setConfiguration( target.getConfiguration() );
+ if( target.getConfiguration() != null )
+ {
+ deployment.setConfiguration( target.getConfiguration() );
+ }
+ if( target.getCategoriesDirective() != null )
+ {
+ deployment.setCategories( target.getCategoriesDirective() );
+ }
}
else
{
@@ -227,7 +222,7 @@
// of appliance establishment
//
- getLogger().info( "composition phase" );
+ getLogger().debug( "composition phase" );
try
{
DefaultServiceContext services = new DefaultServiceContext();
@@ -238,12 +233,8 @@
catch( Throwable e )
{
final String error =
- "Root block composition failure.";
- String msg =
- ExceptionHelper.packException( error, e, context.getDebugFlag() );
- getLogger().error( msg );
- shutdown();
- throw new RuntimeException( msg );
+ "Composition failure.";
+ throw new KernelException( error, e );
}
try
@@ -257,33 +248,95 @@
catch( Throwable e )
{
final String error =
- "Root block assembly failure.";
- String msg =
- ExceptionHelper.packException( error, e, context.getDebugFlag() );
- getLogger().error( msg );
- shutdown();
- throw new RuntimeException( msg );
+ "Assembly failure.";
+ throw new KernelException( error, e );
}
+ Throwable cause = null;
try
{
- getLogger().info( "deployment phase" );
+ getLogger().debug( "deployment phase" );
m_block.deploy();
}
catch( Throwable e )
{
+ cause = e;
final String error =
- "Root block deployment failure.";
- String msg =
- ExceptionHelper.packException( error, e, context.getDebugFlag() );
- getLogger().error( msg );
- shutdown();
- throw new RuntimeException( msg );
+ "Deployment failure.";
+ throw new KernelException( error, e );
+ }
+ finally
+ {
+ if( cause != null )
+ {
+ shutdown();
+ }
+ else if( !context.getServerFlag() )
+ {
+ shutdown();
+ }
+ }
+ }
+
+ //==============================================================
+ // Home
+ //==============================================================
+
+ /**
+ * Resolve a object to a value.
+ *
+ * @param source the context within the the resolution is applied
+ * @return the resolved object
+ * @throws Exception if an error occurs
+ */
+ public Object resolve( Object source ) throws Exception
+ {
+ if( m_self.isEnabled() )
+ {
+ return m_block.resolve( source );
+ }
+ else
+ {
+ throw new IllegalStateException( "kernel" );
+ }
+ }
+
+ /**
+ * Resolve a object to a value relative to a supplied set of
+ * interface classes.
+ *
+ * @param source the aquiring source
+ * @param ref the castable service classes
+ * @return the resolved object
+ * @throws Exception if an error occurs
+ */
+ public Object resolve( Object source, Class[] ref ) throws Exception
+ {
+ if( m_self.isEnabled() )
+ {
+ return m_block.resolve( source, ref );
+ }
+ else
+ {
+ throw new IllegalStateException( "kernel" );
}
+ }
- if( !context.getServerFlag() )
+ /**
+ * Release an object
+ *
+ * @param source the client that obtained the intial reference
+ * @param instance the object to be released
+ */
+ public void release( Object source, Object instance )
+ {
+ if( m_self.isEnabled() )
+ {
+ m_block.release( source, instance );
+ }
+ else
{
- shutdown();
+ throw new IllegalStateException( "kernel" );
}
}
1.7 +74 -48
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java
Index: DefaultKernelContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DefaultKernelContext.java 17 Aug 2003 15:06:41 -0000 1.6
+++ DefaultKernelContext.java 18 Aug 2003 11:26:05 -0000 1.7
@@ -60,6 +60,7 @@
import org.apache.avalon.repository.ProxyContext;
import org.apache.avalon.repository.impl.DefaultAuthenticator;
import org.apache.avalon.repository.impl.DefaultFileRepository;
+import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -98,14 +99,14 @@
public static final String VERSION = "3.0";
- private static final String ROOT_CATEGORY_NAME = "sys";
-
private static final XMLDeploymentProfileCreator CREATOR =
new XMLDeploymentProfileCreator();
private static final XMLTargetsCreator TARGETS =
new XMLTargetsCreator();
+ private static final String CATEGORY_NAME = "context";
+
//==============================================================
// immutable state
//==============================================================
@@ -131,6 +132,11 @@
private final File m_home;
/**
+ * The temp path
+ */
+ private final File m_temp;
+
+ /**
* The kernel configuration url.
*/
private final Configuration m_kernel;
@@ -180,6 +186,8 @@
*/
private TargetDirective[] m_targets;
+ private final Logger m_kernelLogger;
+
//--------------------------------------------------------------
// constructor
//--------------------------------------------------------------
@@ -208,9 +216,10 @@
if( repository == null ) throw new NullPointerException( "repository" );
- m_home = home;
m_system = system;
m_library = library;
+ m_home = new File( home, "home" );
+ m_temp = new File( System.getProperty( "java.io.tmpdir" ) );
m_kernelURL = kernel;
if( kernel != null )
@@ -241,10 +250,14 @@
// as the directive source
//
- Configuration logConfig = m_kernel.getChild( "logging" );
- m_logging =
- bootstrapLoggingManager( home, logConfig, ROOT_CATEGORY_NAME, debug );
- enableLogging( m_logging.getSystemLoggerForCategory( "context" ) );
+ Configuration conf = m_kernel.getChild( "logging" );
+ LoggingDescriptor logging = createLoggingDescriptor( conf );
+ boolean trace = conf.getAttributeAsBoolean( "trace", false );
+ m_logging = bootstrapLoggingManager( home, logging, trace );
+
+ m_kernelLogger = m_logging.getLoggerForCategory( logging.getName() );
+ enableLogging( getKernelLogger().getChildLogger( CATEGORY_NAME ) );
+ getLogger().debug( "logging system established" );
//
// if the kernel configuration declares a repository then we build
@@ -254,6 +267,7 @@
Configuration repositoryConfig = m_kernel.getChild( "repository" );
m_repository = createRepository( system, repositoryConfig );
+ getLogger().debug( "repository established" );
//
// setup the pool manager
@@ -273,7 +287,10 @@
getLoggingManager(),
getLibraryPath(),
getHomePath(),
- getRepository() ) );
+ getTempPath(),
+ getRepository(),
+ debug ) );
+ getLogger().debug( "model factory established" );
}
catch( Throwable e )
{
@@ -391,6 +408,15 @@
//--------------------------------------------------------------
/**
+ * Return the kernel logging channel.
+ * @return the kernel logging channel
+ */
+ public Logger getKernelLogger()
+ {
+ return m_kernelLogger;
+ }
+
+ /**
* Return the model factory.
* @return the factory
*/
@@ -436,6 +462,15 @@
}
/**
+ * Return the temporary directory path
+ * @return the path (possibly null)
+ */
+ public File getTempPath()
+ {
+ return m_temp;
+ }
+
+ /**
* Return the URL for the kernel configuration directive.
* @return the kernel directive url
*/
@@ -587,21 +622,18 @@
/**
* Creation of the bootstrap logging manager.
*
- * @param root the root logging channel
- * @param system the logging catagery for logging related messages
- * @param debug the system debug flag
+ * @param base the base directory for file logging targets
+ * @param descriptor the logging descriptor
* @return the logging manager
* @exception Exception if a logging manager establishment error occurs
*/
private LoggingManager bootstrapLoggingManager(
- File base, Configuration config, String system, boolean debug )
+ File base, LoggingDescriptor descriptor, boolean debug )
throws KernelException
{
try
{
- LoggingDescriptor descriptor =
- createLoggingDescriptor( config, system, debug );
- return new DefaultLoggingManager( base, system, descriptor );
+ return new DefaultLoggingManager( base, descriptor, debug );
}
catch( Throwable e )
{
@@ -615,34 +647,28 @@
* Utility method to create a new logging descriptor from a
* configuration instance.
* @param config a configuration defining the logging descriptor
- * @param name a default name value
* @return the logging descriptor
* @exception ConfigurationException if the configuration is
* incomplete
*/
private LoggingDescriptor createLoggingDescriptor(
- Configuration config, String root, boolean debug )
- throws ConfigurationException, KernelException
+ Configuration config )
+ throws KernelException
{
- final String target = config.getAttribute( "target", null );
- String priority = null;
- if( debug )
+ final String name = config.getAttribute( "name", "" );
+ CategoriesDirective categories = null;
+ try
{
- priority = "DEBUG";
+ categories = CREATOR.getCategoriesDirective( config, name );
}
- else
+ catch( Throwable e )
{
- priority = config.getAttribute( "priority", null );
+ final String error =
+ "Invalid logging directive.";
+ throw new KernelException( error, e );
}
//
- // get the logging managers logging channel
- //
-
- CategoryDirective internal =
- CREATOR.getCategoryDirective( config.getChild( "category" ) );
-
- //
// create any custom targets declared in the kernel directive
//
@@ -651,32 +677,32 @@
for( int i = 0; i < configs.length; i++ )
{
Configuration c = configs[ i ];
- list.add( createTargetDescriptor( c ) );
+ try
+ {
+ list.add( createTargetDescriptor( c ) );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Invalid target descriptor.";
+ throw new KernelException( error, e );
+ }
}
+
TargetDescriptor[] targets =
(TargetDescriptor[])list.toArray(
new TargetDescriptor[ 0 ] );
- CategoriesDirective system = null;
- try
- {
- system =
- CREATOR.getCategoriesDirective(
- config.getChild( "categories" ), ROOT_CATEGORY_NAME );
- }
- catch( Throwable e )
- {
- final String error =
- "Unexpected exception while creating system logging categories.";
- throw new KernelException( error, e );
- }
-
//
// return the logging descriptor
//
return new LoggingDescriptor(
- root, priority, target, targets, internal, system );
+ categories.getName(),
+ categories.getPriority(),
+ categories.getTarget(),
+ categories.getCategories(),
+ targets );
}
/**
1.2 +6 -0 avalon-sandbox/merlin/kernel/spi/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/kernel/spi/project.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.xml 11 Aug 2003 22:34:51 -0000 1.1
+++ project.xml 18 Aug 2003 11:26:06 -0000 1.2
@@ -37,6 +37,12 @@
</dependency>
<dependency>
+ <groupId>avalon-activation</groupId>
+ <artifactId>avalon-activation-spi</artifactId>
+ <version>SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
<id>excalibur-event</id>
<version>1.0.3</version>
</dependency>
1.2 +4 -2
avalon-sandbox/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/Kernel.java
Index: Kernel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/Kernel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Kernel.java 11 Aug 2003 22:34:51 -0000 1.1
+++ Kernel.java 18 Aug 2003 11:26:06 -0000 1.2
@@ -52,6 +52,8 @@
import java.net.URL;
+import org.apache.avalon.activation.appliance.Home;
+
/**
* A service that provides support for the establishment and management of a set
* of component container.
@@ -61,7 +63,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision$ $Date$
*/
-public interface Kernel
+public interface Kernel extends Home
{
//=======================================================================
// static
1.3 +7 -0
avalon-sandbox/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelContext.java
Index: KernelContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- KernelContext.java 12 Aug 2003 05:30:44 -0000 1.2
+++ KernelContext.java 18 Aug 2003 11:26:06 -0000 1.3
@@ -6,6 +6,7 @@
import java.net.URL;
import org.apache.avalon.repository.Repository;
+import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.composition.data.TargetDirective;
import org.apache.avalon.composition.logging.LoggingManager;
@@ -71,6 +72,12 @@
* @return the logging manager
*/
LoggingManager getLoggingManager();
+
+ /**
+ * Return the kernel logging channel.
+ * @return the kernel logging channel
+ */
+ Logger getKernelLogger();
/**
* Return the kernel pool manager.
1.3 +2 -82
avalon-sandbox/merlin/merlin-platform/src/repository/merlin/xmls/kernel-3.0.xml
Index: kernel-3.0.xml
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-platform/src/repository/merlin/xmls/kernel-3.0.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- kernel-3.0.xml 16 Aug 2003 11:16:33 -0000 1.2
+++ kernel-3.0.xml 18 Aug 2003 11:26:06 -0000 1.3
@@ -1,95 +1,15 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-kernel.xml
-The kernel.xml file contains the definition of a Merlin kernel. The kernel
-can contain the following declarations:
-
- 1. a system descriptor that declares the hostname of this machine
- 2. a logging descriptor for establishment of the logging subsystem
- 3. a catagories descriptor that establishes logging priority
- for the kernel
- 4. the pool configuration
-
-Once a kernel is established the controlling application supplies a root
-block configurations to the kernel for deployment.
--->
-
<kernel>
- <!-- logging system parameters -->
-
- <logging target="default" priority="INFO">
-
- <category name="/sys/logger" priority="WARN"/>
-
- <!-- file target example -->
- <!--
- <target name="kernel">
- <file location="logs/kernel.log" />
- </target>
- -->
-
+ <logging name="smp" target="default" priority="INFO">
+ <category name="" priority="WARN"/>
</logging>
- <!-- logging categories for the kernel -->
-
- <categories>
- <category name="/sys" priority="WARN"/>
- </categories>
-
- <!-- pool configuration -->
-
- <pool>
- <threads-per-processor>2</threads-per-processor>
- <sleep>1000</sleep>
- <timeout>250</timeout>
- </pool>
-
- <!-- declaration of the local repository -->
-
<repository>
-
- <!--
- The default local cache is the [MERLIN-HOME]/repository.
- If you want to override this then uncomment and cache
- entry and include the absolute path of the alternative
- repository directory.
- -->
- <!-- <cache>C:/my/repository</cache> -->
-
- <!--
- If an resource cannot be located in the local repository cache,
- Merlin will attempt to locate the resource in one or more remote
- repositories. If you have a proxy server you will need to declare
- it under the propxy element. If you declare a proxy, the host and
- port elements must be declared. You can also declare a 'credentials'
- element if your proxy requires password authentication.
- -->
-
- <!--
- <proxy>
- <host>proxy.somewhere.com</host>
- <port>proxy.somewhere.com</port>
- <credentials>
- <username>test</username>
- <password>test</password>
- </credentials>
- </proxy>
- -->
-
- <!--
- Merlin will attempt to locate resource from the local cache. If a
- resource is unavailable, Merlin willl attempt to download the
- resource from one or more remote hosts. The hosts element contains
- the list of hosts that Merlin should attempt to connect to when
- resolving unsatisfied resource requests.
- -->
-
<hosts>
<host>http://www.ibiblio.org/maven/</host>
</hosts>
-
</repository>
</kernel>
1.3 +2 -19
avalon-sandbox/merlin/merlin-platform/src/repository/merlin/xmls/kernel-service-3.0.xml
Index: kernel-service-3.0.xml
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-platform/src/repository/merlin/xmls/kernel-service-3.0.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- kernel-service-3.0.xml 16 Aug 2003 11:16:33 -0000 1.2
+++ kernel-service-3.0.xml 18 Aug 2003 11:26:06 -0000 1.3
@@ -17,29 +17,12 @@
<kernel>
- <system host="localhost"/>
-
<!-- logging system parameters -->
-
- <logging target="kernel" priority="INFO">
- <category name="/sys/logger" priority="WARN"/>
+ <logging name="smp" target="kernel" priority="INFO">
+ <category name="" priority="WARN"/>
<target name="kernel">
<file location="logs/kernel.log" />
</target>
</logging>
-
- <!-- logging categories for the kernel -->
-
- <categories>
- <category name="/sys" priority="WARN"/>
- </categories>
-
- <!-- pool configuration -->
-
- <pool>
- <threads-per-processor>2</threads-per-processor>
- <sleep>1000</sleep>
- <timeout>250</timeout>
- </pool>
</kernel>
1.2 +1 -1 avalon-sandbox/merlin/merlin-platform/tutorials/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/tutorials/project.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.xml 24 Jun 2003 13:23:53 -0000 1.1
+++ project.xml 18 Aug 2003 11:26:06 -0000 1.2
@@ -71,7 +71,7 @@
</includes>
</resource>
<resource>
- <directory>${maven.conf.dir}</directory>
+ <directory>${basedir}/conf</directory>
<targetPath>BLOCK-INF</targetPath>
<includes>
<include>block.xml</include>
1.2 +2 -2
avalon-sandbox/merlin/merlin-platform/tutorials/configuration/block/maven.xml
Index: maven.xml
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-platform/tutorials/configuration/block/maven.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- maven.xml 14 Jun 2003 08:45:58 -0000 1.1
+++ maven.xml 18 Aug 2003 11:26:06 -0000 1.2
@@ -1,7 +1,7 @@
-<project default="java:jar" xmlns:maven="jelly:maven" xmlns:j="jelly:core"
xmlns:util="jelly:util">
+<project default="jar:jar" xmlns:maven="jelly:maven" xmlns:j="jelly:core"
xmlns:util="jelly:util">
<preGoal name="java:compile">
- <attainGoal name="merlin:meta"/>
+ <attainGoal name="avalon:meta"/>
</preGoal>
</project>
1.4 +3 -3
avalon-sandbox/merlin/merlin-platform/tutorials/configuration/block/project.xml
Index: project.xml
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-platform/tutorials/configuration/block/project.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- project.xml 20 Jun 2003 05:25:26 -0000 1.3
+++ project.xml 18 Aug 2003 11:26:06 -0000 1.4
@@ -15,12 +15,12 @@
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-api</artifactId>
- <version>4.1.5-dev</version>
+ <version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
- <version>4.1.5-dev</version>
+ <version>SNAPSHOT</version>
</dependency>
</dependencies>
@@ -30,7 +30,7 @@
<resources>
<resource>
- <directory>${maven.conf.dir}</directory>
+ <directory>${basedir}/conf</directory>
<targetPath>BLOCK-INF</targetPath>
<includes>
<include>block.xml</include>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]