mcconnell 2003/07/11 04:06:31
Modified: merlin/composition/src/java/org/apache/avalon/composition/model/impl
DefaultContainmentModel.java
DefaultContextModel.java
DefaultDeploymentContext.java
DefaultDeploymentModel.java Resources.properties
merlin/composition/src/test/conf block.xml
merlin/composition-spi/src/java/org/apache/avalon/composition/model
DeploymentContext.java DeploymentModel.java
Added: merlin/composition/src/java/org/apache/avalon/composition/model/impl
DefaultConstructorModel.java
DefaultContextEntryModel.java
DefaultImportModel.java
merlin/composition-spi/src/java/org/apache/avalon/composition/model
ContextEntryModel.java ModelRuntimeException.java
Log:
Add meta-model implementations for imported and constructed context.
Revision Changes Path
1.11 +2 -2
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DefaultContainmentModel.java 9 Jul 2003 05:02:05 -0000 1.10
+++ DefaultContainmentModel.java 11 Jul 2003 11:06:30 -0000 1.11
@@ -278,7 +278,7 @@
final File temp = new File( m_context.getTempDirectory(), name );
DefaultDeploymentContext context =
new DefaultDeploymentContext(
- logger, m_context, profile, type, base, home, temp, partition );
+ logger, name, m_context, profile, type, base, home, temp, partition
);
//
// TODO: lookup the profile for a factory declaration, then
1.2 +107 -56
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContextModel.java
Index: DefaultContextModel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContextModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultContextModel.java 8 Jul 2003 13:47:06 -0000 1.1
+++ DefaultContextModel.java 11 Jul 2003 11:06:30 -0000 1.2
@@ -55,14 +55,22 @@
import org.apache.avalon.composition.model.ContextModel;
import org.apache.avalon.composition.model.ModelException;
+import org.apache.avalon.composition.model.DeploymentContext;
import org.apache.avalon.composition.model.SystemContext;
+import org.apache.avalon.excalibur.i18n.ResourceManager;
+import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.DefaultContext;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.meta.info.ContextDescriptor;
+import org.apache.avalon.meta.info.EntryDescriptor;
import org.apache.avalon.meta.data.ContextDirective;
+import org.apache.avalon.meta.data.EntryDirective;
+import org.apache.avalon.meta.data.ImportDirective;
+import org.apache.avalon.meta.data.ConstructorDirective;
/**
* <p>Specification of a context model from which a
@@ -77,6 +85,9 @@
// static
//==============================================================
+ private static final Resources REZ =
+ ResourceManager.getPackageResources( DefaultContextModel.class );
+
/**
* The default context implementation class to be used if
* no context class is defined.
@@ -88,31 +99,6 @@
*/
public static final Class DEFAULT_STRATEGY_CLASS = Contextualizable.class;
- /**
- * The standard context entry key for the partition name.
- */
- public static final String PARTITION_KEY = "urn:avalon:partition.name";
-
- /**
- * The standard context entry key for the partition name.
- */
- public static final String NAME_KEY = "urn:avalon:name";
-
- /**
- * The standard context entry key for the partition name.
- */
- public static final String CLASSLOADER_KEY = "urn:avalon:classloader";
-
- /**
- * The standard context entry key for the partition name.
- */
- public static final String HOME_KEY = "urn:avalon:home.dir";
-
- /**
- * The standard context entry key for the partition name.
- */
- public static final String TEMP_KEY = "urn:avalon:temp.dir";
-
//==============================================================
// immutable state
//==============================================================
@@ -121,15 +107,17 @@
private final ContextDirective m_directive;
- private final SystemContext m_system;
+ private final DeploymentContext m_context;
- private final ClassLoader m_classLoader;
+ // --
private final Class m_strategy;
private final Class m_contextClass;
- private final Map m_map;
+ private final Map m_models = new Hashtable();
+
+ private final Map m_map = new Hashtable();
//==============================================================
// constructor
@@ -146,24 +134,100 @@
* @param system the system context
*/
public DefaultContextModel(
- Logger logger, ContextDescriptor descriptor, ContextDirective directive,
- ClassLoader classLoader, SystemContext system, String partition, String name )
+ Logger logger, ContextDescriptor descriptor, ContextDirective directive,
DeploymentContext context )
throws ModelException
{
enableLogging( logger );
m_descriptor = descriptor;
m_directive = directive;
- m_classLoader = classLoader;
- m_system = system;
-
- m_strategy = loadStrategyClass( descriptor, classLoader );
- m_contextClass = loadContextClass( directive, classLoader );
+ m_context = context;
+ ClassLoader classLoader = context.getClassLoader();
+ m_strategy =
+ loadStrategyClass( descriptor, classLoader );
+ m_contextClass =
+ loadContextClass( directive, classLoader );
validateCastingConstraint(
descriptor, classLoader, m_contextClass );
- m_map = buildContextMap( system, classLoader, partition, name );
+ //
+ // get the set of context entries declared by the component type
+ // and for for each entry determine the context entry model to
+ // use for context entry value resolution
+ //
+
+ EntryDescriptor[] entries = descriptor.getEntries();
+ for( int i=0; i<entries.length; i++ )
+ {
+ EntryDescriptor entry = entries[i];
+ final String key = entry.getKey();
+ if( key.startsWith( "urn:avalon:" ) )
+ {
+ try
+ {
+ Object value = m_context.resolve( key );
+ }
+ catch( ContextException e )
+ {
+ final String error =
+ REZ.getString(
+ "context.non-standard-avalon-key.error", key );
+ throw new ModelException( error );
+ }
+ }
+ else
+ {
+ //
+ // its a non standard context entry so check for a
+ // entry directive with a matching key to define
+ // the mechanism for building the context entry
+ //
+
+ EntryDirective entryDirective =
+ directive.getEntryDirective( key );
+ if( entryDirective == null )
+ {
+ final String error =
+ REZ.getString(
+ "context.missing-directive.error", key );
+ throw new ModelException( error );
+ }
+
+ //
+ // there are only two context entry models - import
+ // and constructor - identify the model to use then add
+ // the resolved model to the map
+ //
+
+ if( entryDirective instanceof ImportDirective )
+ {
+ ImportDirective importDirective =
+ (ImportDirective) entryDirective;
+ DefaultImportModel model =
+ new DefaultImportModel( entry, importDirective, context,
m_map );
+ m_context.register( key, model );
+ m_map.put( key, model.getValue() );
+ }
+ else if( entryDirective instanceof ConstructorDirective )
+ {
+ ConstructorDirective constructor =
+ (ConstructorDirective) entryDirective;
+ DefaultConstructorModel model =
+ new DefaultConstructorModel( entry, constructor, context,
m_map );
+ m_context.register( key, model );
+ m_map.put( key, model.getValue() );
+ }
+ else
+ {
+ String modelClass = entryDirective.getClass().getName();
+ final String error =
+ REZ.getString(
+ "context.unsupported-directive.error", key, modelClass );
+ throw new ModelException( error );
+ }
+ }
+ }
if( getLogger().isDebugEnabled() )
{
@@ -171,23 +235,6 @@
}
}
- private Map buildContextMap(
- SystemContext system, ClassLoader classLoader, String partition, String name )
- {
- Map map = new Hashtable();
- map.put( PARTITION_KEY, partition );
- map.put( NAME_KEY, name );
- map.put( CLASSLOADER_KEY, classLoader );
- map.put( HOME_KEY, system.getHomeDirectory() );
- map.put( TEMP_KEY, system.getTempDirectory() );
-
- //
- // TODO: build any entries based on imports or constructed arguments
- //
-
- return map;
- }
-
//==============================================================
// ContextModel
//==============================================================
@@ -213,7 +260,12 @@
}
/**
- * Return the context map established for the component.
+ * Return the context map established for the component. The
+ * map contains a set of keys corresponding to the context
+ * entries declared by the component type. Each key maps to
+ * either the directly resolved stardard context key, or,
+ * an instance of ContextEntryModel from which a contest entry
+ * value may be resolved at runtime.
*
* @return the context map
*/
@@ -348,5 +400,4 @@
throw new ModelException( error );
}
}
-
}
1.3 +117 -3
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentContext.java
Index: DefaultDeploymentContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultDeploymentContext.java 9 Jul 2003 05:02:05 -0000 1.2
+++ DefaultDeploymentContext.java 11 Jul 2003 11:06:30 -0000 1.3
@@ -52,11 +52,16 @@
import java.io.File;
import java.util.Map;
+import java.util.Hashtable;
import org.apache.avalon.composition.model.SystemContext;
+import org.apache.avalon.composition.model.ContextEntryModel;
import org.apache.avalon.composition.model.ContainmentContext;
import org.apache.avalon.composition.model.DeploymentContext;
+import org.apache.avalon.composition.model.ModelException;
+import org.apache.avalon.composition.model.ModelRuntimeException;
import org.apache.avalon.framework.context.DefaultContext;
+import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
@@ -84,6 +89,8 @@
// immutable state
//==============================================================
+ private final String m_name;
+
private final ContainmentContext m_context;
private final DeploymentProfile m_profile;
@@ -100,6 +107,12 @@
private final String m_partition;
+ /**
+ * Map containing the supplimentary context entries
+ * key by context enty key.
+ */
+ private final Map m_map = new Hashtable();
+
//==============================================================
// constructor
//==============================================================
@@ -108,11 +121,11 @@
* Creation of a new deployment context.
*
* @param context the containment context
- * @param home the directory
+ * @param home the home working directory
* @param temp a temporary directory
*/
public DefaultDeploymentContext(
- Logger logger, ContainmentContext context,
+ Logger logger, String name, ContainmentContext context,
DeploymentProfile profile, Type type, Class clazz,
File home, File temp, String partition )
{
@@ -154,6 +167,7 @@
throw new IllegalArgumentException( error );
}
+ m_name = name;
m_home = home;
m_temp = temp;
m_context = context;
@@ -162,6 +176,7 @@
m_profile = profile;
m_partition = partition;
m_class = clazz;
+
}
//==============================================================
@@ -179,6 +194,16 @@
}
/**
+ * Return the name that the component will execute under.
+ *
+ * @return the name
+ */
+ public String getName()
+ {
+ return m_name;
+ }
+
+ /**
* Return the system context.
*
* @return the system context
@@ -189,6 +214,16 @@
}
/**
+ * Return the containment context.
+ *
+ * @return the containment context
+ */
+ public ContainmentContext getContainmentContext()
+ {
+ return m_context;
+ }
+
+ /**
* Return the working directory.
*
* @return the working directory
@@ -257,5 +292,84 @@
{
return m_context.getClassLoader();
}
+
+ /**
+ * Add a context entry model to the deployment context.
+ * @param key
+ * @param value
+ */
+ public void register( String key, ContextEntryModel model )
+ {
+ if( m_map.get( key ) == null )
+ {
+ m_map.put( key, model );
+ }
+ else
+ {
+ final String error =
+ "Illegal attempt to override an existing model entry: " + key;
+ throw new IllegalArgumentException( error );
+ }
+ }
+
+ /**
+ * Get a context entry from the deployment context.
+ * @param key the entry lookup key
+ * @return value the corresponding value
+ * @exception ContextException if the key is unknown
+ */
+ public Object resolve( String key ) throws ContextException
+ {
+ Object object = m_map.get( key );
+ if( object == null )
+ {
+ if( key.equals( NAME_KEY ) )
+ {
+ return getName();
+ }
+ else if( key.equals( PARTITION_KEY ) )
+ {
+ return getPartitionName();
+ }
+ else if( key.equals( CLASSLOADER_KEY ) )
+ {
+ return getClassLoader();
+ }
+ else if( key.equals( HOME_KEY ) )
+ {
+ return getHomeDirectory();
+ }
+ else if( key.equals( TEMP_KEY ) )
+ {
+ return getTempDirectory();
+ }
+ else
+ {
+ throw new ContextException( key );
+ }
+ }
+
+ if( object instanceof ContextEntryModel )
+ {
+ final String classname = object.getClass().getName();
+ try
+ {
+ return ((ContextEntryModel)object).getValue();
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ REZ.getString(
+ "deployment.context.runtime-get",
+ key, classname );
+ throw new ModelRuntimeException( error, e );
+ }
+ }
+ else
+ {
+ return object;
+ }
+ }
+
}
1.11 +41 -33
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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DefaultDeploymentModel.java 9 Jul 2003 05:02:05 -0000 1.10
+++ DefaultDeploymentModel.java 11 Jul 2003 11:06:30 -0000 1.11
@@ -111,6 +111,7 @@
private final ContextModel m_contextModel;
+
//==============================================================
// mutable state
//==============================================================
@@ -119,6 +120,8 @@
private Parameters m_parameters;
+ private boolean m_activation;
+
//==============================================================
// constructor
//==============================================================
@@ -144,6 +147,8 @@
m_context = context;
+
+
ClassLoader classLoader = m_context.getClassLoader();
if( isConfigurable() )
@@ -187,38 +192,7 @@
m_context.getSystemContext();
m_contextModel = new DefaultContextModel(
- log, contextDescriptor, contextDirective,
- classLoader, system, getPath(), getName() );
-
- /*
- //
- // setup the home and working directory for the component but don't
- // actually create the directories - that needs to be handled in a
- // context object on demand
- //
-
- File base = m_system.getHomeDirectory();
- File rootWorking = new File( base, "working" );
- File rootHome = new File( rootWorking, "home" );
- File persistentDir = new File( rootHome, getPath() );
- File rootTemp = new File( rootWorking, "temp" );
- rootWorking.deleteOnExit();
- File transientDir = new File( rootTemp, getPath() );
- transientDir.deleteOnExit();
-
- map.put( "urn:avalon:home", persistentDir );
- map.put( "urn:avalon:work", transientDir );
-
- //
- // at this point we should be evaluating the context directives
- // to determin any additional context entries to populate into
- // the map
- //
-
- //ContextBuilder.buildMap( this );
-
- m_map = map;
- */
+ log, contextDescriptor, contextDirective, context );
}
else
{
@@ -271,6 +245,40 @@
//==============================================================
// DeploymentModel
//==============================================================
+
+
+ /**
+ * Return the activation policy for the model.
+ * @return the activaltion policy
+ */
+ public boolean getActivationPolicy()
+ {
+ return m_activation;
+ }
+
+ /**
+ * Set the activation policy for the model.
+ * @param the activaltion policy
+ */
+ public void setActivationPolicy( boolean policy )
+ {
+ m_activation = policy;
+ }
+
+ /**
+ * Set the activation policy for the model to the default value.
+ */
+ public void revertActivationPolicy()
+ {
+ if( m_context.getProfile().getMode() == Mode.EXPLICIT )
+ {
+ m_activation = true;
+ }
+ else
+ {
+ m_activation = false;
+ }
+ }
public Type getType()
{
1.8 +18 -0
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Resources.properties
Index: Resources.properties
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Resources.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Resources.properties 8 Jul 2003 13:47:06 -0000 1.7
+++ Resources.properties 11 Jul 2003 11:06:30 -0000 1.8
@@ -23,6 +23,7 @@
deployment.configuration.irrational=Illegal attempt to set a configuration value
for a component type '{0}' that is not configurable in the model: {1}.
deployment.context.home.not-a-directory.error=Supplied home dir is not a directory:
{0}
deployment.context.temp.not-a-directory.error=Supplied temp dir is not a directory:
{0}
+deployment.context.runtime-get="Unable to resolve context value for key {0} due to
an unexpected runtime error in: " {1}
# DefaultModel
created=created: {0}
@@ -51,4 +52,21 @@
scanner.type.missing-class.error=Could not locate implementation class for type: {0}
scanner.url-not-a-directory.error=URL does not refer to a directory: {0}
scanner.not-file-protocol.error=URL protocol does not match the required 'file'
protocol: {0}
+
+# DefaultImportModel
+import.type-conflict.error=The object returned from the internal deployment context
matching the import directive key: {0} does not implement the context entry class: {1}
requested by the component under its local key: {2}.;
+
+import.missing-entry.error=Cannot import context entry {0} requested for the
component context entry key {1} because the requested import key is unknown within the
scope of the supplied containment context.
+
+import.load.error=Cannot load context entry for the component key: {0} because a
corresponding import directive could not load the class {1} declared as a constraint
by the component type entry declaration.
+
+import.null-object.error=Resolution of the include directive for the containment
key {0} undeer the component context entry {1) return a null object reference.
+
+#DefaultContextModel
+context.non-standard-avalon-key.error=The component has requested a Avalon context
entry that is not know within the family of standard Avalon context keys. The
offending key is: {0}.
+
+context.missing-directive.error=The component has requested a non-avalon context
entry. The container cannot resolve this request because no entry directive can be
found the matches the key: {0}.
+
+context.unsupported-directive.error=The component has requested a context entry
under the key [{0}]. The container cannot resolve this request because the entry
directive type [{1}] is not supported at this time.
+
1.1
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultConstructorModel.java
Index: DefaultConstructorModel.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.composition.model.impl;
import java.lang.reflect.Constructor;
import java.util.Map;
import org.apache.avalon.composition.model.ModelException;
import org.apache.avalon.composition.model.DeploymentContext;
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.meta.data.EntryDirective;
import org.apache.avalon.meta.data.ConstructorDirective;
import org.apache.avalon.meta.data.Parameter;
import org.apache.avalon.meta.info.EntryDescriptor;
/**
* Default implementation of a the context entry constructor model.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2003/07/11 11:06:30 $
*/
public class DefaultConstructorModel extends DefaultContextEntryModel
{
//==============================================================
// static
//==============================================================
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultConstructorModel.class );
//==============================================================
// immutable state
//==============================================================
private final ConstructorDirective m_directive;
private final EntryDescriptor m_descriptor;
private final DeploymentContext m_context;
private final Map m_map;
//==============================================================
// mutable state
//==============================================================
private Object m_value;
//==============================================================
// constructor
//==============================================================
/**
* Creation of a new context entry import model.
*
* @param descriptor the context entry descriptor
* @param directive the context entry directive
* @param context the containment context
*/
public DefaultConstructorModel(
EntryDescriptor descriptor, ConstructorDirective directive, DeploymentContext
context, Map map )
{
if( descriptor == null )
{
throw new NullPointerException( "descriptor" );
}
if( directive == null )
{
throw new NullPointerException( "directive" );
}
if( context == null )
{
throw new NullPointerException( "context" );
}
m_descriptor = descriptor;
m_directive = directive;
m_context = context;
m_map = map;
}
//==============================================================
// ContextEntryModel
//==============================================================
/**
* Return the context entry value.
*
* @return the context entry value
*/
public Object getValue() throws ModelException
{
if( m_value != null )
{
return m_value;
}
String target = m_descriptor.getKey();
Object object = null;
try
{
ClassLoader loader = m_context.getClassLoader();
String classname = m_directive.getClassname();
String argument = m_directive.getArgument();
Parameter[] params = m_directive.getParameters();
Class clazz = getParameterClass( classname, loader );
object = getValue( loader, clazz, argument, params );
}
catch( Throwable e )
{
final String error =
"Cannot establish a constructed context entry for the key " + target
+ " due to a runtime failure.";
throw new ModelException( error, e );
}
if( !m_descriptor.isVolatile() )
{
m_value = object;
}
return object;
}
/**
* Return the context entry value.
*
* @return the context entry value
*/
public Object getValue( Parameter p ) throws ModelException
{
ClassLoader loader = m_context.getClassLoader();
String classname = p.getClassname();
String argument = p.getArgument();
Parameter[] params = p.getParameters();
Class clazz = getParameterClass( classname, loader );
return getValue( loader, clazz, argument, params );
}
/**
* Return the derived parameter value.
* @param loader the classloader to use
* @param map a map of context values from which import directives may be
resolved
* @return the value
* @exception ModelException if the parameter value cannot be resolved
*/
public Object getValue(
ClassLoader loader, Class clazz, String argument,
Parameter[] parameters ) throws ModelException
{
//
// if the parameter contains a text argument then check if its a reference
// to a map entry (in the form"${<key>}" ), otherwise its a simple
constructor
// case with a single string paremeter
//
if( argument != null )
{
return getSingleArgumentConstructorValue( loader, clazz, argument );
}
else
{
return getMultiArgumentConstructorValue( loader, clazz, parameters );
}
}
private Object getMultiArgumentConstructorValue(
ClassLoader classLoader, Class clazz, Parameter[] parameters )
throws ModelException
{
//
// getting here means we are dealing with 0..n types parameter constructor
where the
// parameters are defined by the nested parameter definitions
//
if ( parameters.length == 0 )
{
try
{
return clazz.newInstance();
}
catch ( InstantiationException e )
{
final String error =
"Unable to instantiate instance of class: " + clazz.getName();
throw new ModelException( error, e );
}
catch ( IllegalAccessException e )
{
final String error =
"Cannot access null constructor for the class: '"
+ clazz.getName() + "'.";
throw new ModelException( error, e );
}
}
else
{
Class[] params = new Class[ parameters.length ];
for ( int i = 0; i < parameters.length; i++ )
{
String classname = parameters[i].getClassname();
try
{
params[i] = classLoader.loadClass( classname );
}
catch ( Throwable e )
{
final String error =
"Unable to resolve sub-parameter class: "
+ classname
+ " for the parameter " + clazz.getName();
throw new ModelException( error, e );
}
}
Object[] values = new Object[ parameters.length ];
for ( int i = 0; i < parameters.length; i++ )
{
Parameter p = parameters[i];
String classname = p.getClassname();
try
{
values[i] = getValue( p );
}
catch ( Throwable e )
{
final String error =
"Unable to instantiate sub-parameter for value: "
+ classname
+ " inside the parameter " + clazz.getName();
throw new ModelException( error, e );
}
}
Constructor constructor = null;
try
{
constructor = clazz.getConstructor( params );
}
catch ( NoSuchMethodException e )
{
final String error =
"Supplied parameters for "
+ clazz.getName()
+ " do not match the available class constructors.";
throw new ModelException( error, e );
}
try
{
return constructor.newInstance( values );
}
catch ( InstantiationException e )
{
final String error =
"Unable to instantiate an instance of a multi-parameter
constructor for class: '"
+ clazz.getName() + "'.";
throw new ModelException( error, e );
}
catch ( IllegalAccessException e )
{
final String error =
"Cannot access multi-parameter constructor for the class: '"
+ clazz.getName() + "'.";
throw new ModelException( error, e );
}
catch ( Throwable e )
{
final String error =
"Unexpected error while attmpting to instantiate a multi-parameter
constructor "
+ "for the class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
}
}
}
private Object getSingleArgumentConstructorValue(
ClassLoader classLoader, Class clazz, String argument )
throws ModelException
{
if ( argument.startsWith( "${" ) )
{
if ( argument.endsWith( "}" ) )
{
final String key = argument.substring( 2, argument.length() - 1 );
Object value = null;
try
{
return m_context.resolve( key );
}
catch( ContextException e )
{
value = m_map.get( key );
if ( value != null )
{
return value;
}
else
{
final String error = "Unresolvable primative context value:
'" + key + "'.";
throw new ModelException( error );
}
}
}
else
{
final String error =
"Illegal format for context reference: '" + argument + "'.";
throw new ModelException( error );
}
}
else
{
//
// the argument is a simple type that takes a single String value
// as a constructor argument
//
try
{
final Class[] params = new Class[]{ String.class };
Constructor constructor = clazz.getConstructor( params );
final Object[] values = new Object[]{ argument };
return constructor.newInstance( values );
}
catch ( NoSuchMethodException e )
{
final String error =
"Class: '" + clazz.getName()
+ "' does not implement a single string argument constructor.";
throw new ModelException( error );
}
catch ( InstantiationException e )
{
final String error =
"Unable to instantiate instance of class: " + clazz.getName()
+ " with the single argument: '" + argument + "'";
throw new ModelException( error, e );
}
catch ( IllegalAccessException e )
{
final String error =
"Cannot access single string parameter constructor for the class:
'"
+ clazz.getName() + "'.";
throw new ModelException( error, e );
}
catch ( Throwable e )
{
final String error =
"Unexpected exception while creating a single string parameter
value for the class: '"
+ clazz.getName() + "'.";
throw new ModelException( error, e );
}
}
}
/**
* Return the classname of the parameter implementation to use.
* @param loader the classloader to use
* @return the parameter class
* @exception ModelException if the parameter class cannot be resolved
*/
Class getParameterClass( String classname, ClassLoader classLoader ) throws
ModelException
{
try
{
return classLoader.loadClass( classname );
}
catch ( final ClassNotFoundException e )
{
if ( classname.equals( "int" ) )
{
return int.class;
}
else if ( classname.equals( "short" ) )
{
return short.class;
}
else if ( classname.equals( "long" ) )
{
return long.class;
}
else if ( classname.equals( "byte" ) )
{
return byte.class;
}
else if ( classname.equals( "double" ) )
{
return double.class;
}
else if ( classname.equals( "byte" ) )
{
return byte.class;
}
else if ( classname.equals( "float" ) )
{
return float.class;
}
else if ( classname.equals( "char" ) )
{
return char.class;
}
else if ( classname.equals( "char" ) )
{
return char.class;
}
else if ( classname.equals( "boolean" ) )
{
return boolean.class;
}
else
{
throw new ModelException(
"Could not locate the parameter implemetation for class: '"
+ classname + "'.", e );
}
}
}
}
1.1
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContextEntryModel.java
Index: DefaultContextEntryModel.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.composition.model.impl;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.composition.model.ContextEntryModel;
import org.apache.avalon.composition.model.ModelException;
/**
* Abstract implementation of a the context entry model.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2003/07/11 11:06:30 $
*/
public abstract class DefaultContextEntryModel implements ContextEntryModel
{
//==============================================================
// ContextEntryModel
//==============================================================
/**
* Return the context entry value.
*
* @return the context entry value
*/
public abstract Object getValue() throws ModelException;
}
1.1
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultImportModel.java
Index: DefaultImportModel.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.composition.model.impl;
import java.util.Map;
import org.apache.avalon.composition.model.ModelException;
import org.apache.avalon.composition.model.DeploymentContext;
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.meta.data.EntryDirective;
import org.apache.avalon.meta.data.ImportDirective;
import org.apache.avalon.meta.data.ConstructorDirective;
import org.apache.avalon.meta.info.EntryDescriptor;
/**
* Default implementation of a the context entry import model.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2003/07/11 11:06:30 $
*/
public class DefaultImportModel extends DefaultContextEntryModel
{
//==============================================================
// static
//==============================================================
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultImportModel.class );
//==============================================================
// immutable state
//==============================================================
private final ImportDirective m_directive;
private final EntryDescriptor m_descriptor;
private final DeploymentContext m_context;
private final Map m_map;
//==============================================================
// mutable state
//==============================================================
private Object m_value;
//==============================================================
// constructor
//==============================================================
/**
* Creation of a new context entry import model.
*
* @param descriptor the context entry descriptor
* @param directive the context entry directive
* @param context the containment context
*/
public DefaultImportModel(
EntryDescriptor descriptor, ImportDirective directive,
DeploymentContext context, Map map )
{
if( descriptor == null )
{
throw new NullPointerException( "descriptor" );
}
if( directive == null )
{
throw new NullPointerException( "directive" );
}
if( context == null )
{
throw new NullPointerException( "context" );
}
m_descriptor = descriptor;
m_directive = directive;
m_context = context;
m_map = map;
}
//==============================================================
// ContainmentContext
//==============================================================
/**
* Return the context entry value.
*
* @return the context entry value
*/
public Object getValue() throws ModelException
{
if( m_value != null )
{
return m_value;
}
String target = m_descriptor.getKey();
String key = m_directive.getImportKey();
Object object = null;
try
{
object = m_context.resolve( key );
}
catch( ContextException e )
{
object = m_map.get( key );
if( object == null )
{
final String error =
REZ.getString(
"import.missing-entry.error", key, target );
throw new ModelException( error );
}
}
//
// validate the value before returning it
// (should move this code up to the context model)
//
String classname = m_descriptor.getClassname();
Class clazz = null;
try
{
clazz = m_context.getClassLoader().loadClass( classname );
}
catch( Throwable e )
{
final String error =
REZ.getString(
"import.load.error", target, classname );
throw new ModelException( error, e );
}
if( !( clazz.isAssignableFrom( object.getClass() ) ) )
{
final String error =
REZ.getString(
"import.type-conflict.error", key, classname, target );
throw new ModelException( error );
}
if( !m_descriptor.isVolatile() )
{
m_value = object;
}
return object;
}
}
1.6 +7 -1 avalon-sandbox/merlin/composition/src/test/conf/block.xml
Index: block.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/test/conf/block.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- block.xml 8 Jul 2003 14:05:16 -0000 1.5
+++ block.xml 11 Jul 2003 11:06:31 -0000 1.6
@@ -45,7 +45,13 @@
</classloader>
<container name="block">
- <component name="test"
class="org.apache.avalon.composition.model.teste.TestE"/>
+ <component name="test"
class="org.apache.avalon.composition.model.teste.TestE">
+ <context>
+ <entry key="home">
+ <import key="urn:avalon:home"/>
+ </entry>
+ </context>
+ </component>
</container>
</container>
1.3 +57 -2
avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/DeploymentContext.java
Index: DeploymentContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/DeploymentContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DeploymentContext.java 9 Jul 2003 05:02:06 -0000 1.2
+++ DeploymentContext.java 11 Jul 2003 11:06:31 -0000 1.3
@@ -53,6 +53,7 @@
import java.io.File;
import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.meta.info.Type;
import org.apache.avalon.meta.data.DeploymentProfile;
@@ -63,8 +64,33 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision$ $Date$
*/
-public interface DeploymentContext extends Context
+public interface DeploymentContext
{
+ /**
+ * The standard context entry key for the partition name.
+ */
+ static final String PARTITION_KEY = "urn:avalon:partition.name";
+
+ /**
+ * The standard context entry key for the partition name.
+ */
+ static final String NAME_KEY = "urn:avalon:name";
+
+ /**
+ * The standard context entry key for the partition name.
+ */
+ static final String CLASSLOADER_KEY = "urn:avalon:classloader";
+
+ /**
+ * The standard context entry key for the partition name.
+ */
+ static final String HOME_KEY = "urn:avalon:home.dir";
+
+ /**
+ * The standard context entry key for the partition name.
+ */
+ static final String TEMP_KEY = "urn:avalon:temp.dir";
+
/**
* Return the partition name that the component will execute within.
*
@@ -73,6 +99,13 @@
String getPartitionName();
/**
+ * Return the name that the component will execute under.
+ *
+ * @return the name
+ */
+ String getName();
+
+ /**
* Return the system context.
*
* @return the system context
@@ -80,6 +113,13 @@
SystemContext getSystemContext();
/**
+ * Return the containment context.
+ *
+ * @return the containment context
+ */
+ ContainmentContext getContainmentContext();
+
+ /**
* Return the working directory for the component.
*
* @return the working directory
@@ -127,5 +167,20 @@
* @return the classloader
*/
ClassLoader getClassLoader();
+
+ /**
+ * Add a context entry model to the deployment context.
+ * @param key the context entry key
+ * @param model the entry model
+ */
+ public void register( String key, ContextEntryModel model );
+
+ /**
+ * Get a context entry from the deployment context.
+ * @param key the entry lookup key
+ * @return value the corresponding value
+ * @exception ContextException if the key is unknown
+ */
+ Object resolve( String key ) throws ContextException;
}
1.6 +18 -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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DeploymentModel.java 8 Jul 2003 13:45:10 -0000 1.5
+++ DeploymentModel.java 11 Jul 2003 11:06:31 -0000 1.6
@@ -73,6 +73,23 @@
Type getType();
/**
+ * Return the activation policy for the model.
+ * @return the activaltion policy
+ */
+ boolean getActivationPolicy();
+
+ /**
+ * Set the activation policy for the model.
+ * @param the activaltion policy
+ */
+ void setActivationPolicy( boolean policy );
+
+ /**
+ * Set the activation policy for the model to the default value.
+ */
+ void revertActivationPolicy();
+
+ /**
* Return the class for the deployable target.
* @return the class
*/
1.1
avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ContextEntryModel.java
Index: ContextEntryModel.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.composition.model;
import java.util.Map;
import org.apache.avalon.framework.context.Context;
/**
* <p>Specification of a context enty model from which a
* a context value can be established.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2003/07/11 11:06:31 $
*/
public interface ContextEntryModel
{
/**
* Return the context entry value.
*
* @return the context entry value
*/
Object getValue() throws ModelException;
}
1.1
avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ModelRuntimeException.java
Index: ModelRuntimeException.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.composition.model;
import org.apache.avalon.framework.CascadingRuntimeException;
/**
* Exception to indicate that there was a model related error.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision: 1.1 $ $Date: 2003/07/11 11:06:31 $
*/
public class ModelRuntimeException
extends CascadingRuntimeException
{
/**
* Construct a new <code>ModelRuntimeException</code> instance.
*
* @param message The detail message for this exception.
*/
public ModelRuntimeException( final String message )
{
this( message, null );
}
/**
* Construct a new <code>ModelRuntimeException</code> instance.
*
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
public ModelRuntimeException( final String message, final Throwable throwable )
{
super( message, throwable );
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]