You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/07/07 20:45:36 UTC
cvs commit: avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info ContextDescriptor.java
mcconnell 2003/07/07 11:45:36
Modified: merlin .cvsignore
merlin/assembly-spi/src/java/org/apache/avalon/assembly/logging
TargetDescriptor.java
merlin/composition/src/java/org/apache/avalon/composition/model/impl
DefaultClassLoaderModel.java
DefaultContainmentModel.java
DefaultContainmentModelFactory.java
DefaultDeploymentModel.java
DefaultDeploymentModelFactory.java
DefaultSystemContext.java Scanner.java
merlin/composition/src/test/org/apache/avalon/composition/model
CompositionTestCase.java
merlin/composition-spi/src/java/org/apache/avalon/composition/model
ClassLoaderModel.java ContainmentModel.java
ContainmentModelFactory.java DeploymentModel.java
DeploymentModelFactory.java Model.java
SystemContext.java
merlin/meta-spi/src/java/org/apache/avalon/meta/data
ClasspathDirective.java ContainmentProfile.java
merlin/meta-spi/src/java/org/apache/avalon/meta/info
ContextDescriptor.java
Log:
General commit to bring everything up-to-date. Changes relate to meta-data and composition packages only.
Revision Changes Path
1.10 +3 -0 avalon-sandbox/merlin/.cvsignore
Index: .cvsignore
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/.cvsignore,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- .cvsignore 20 Apr 2003 12:56:54 -0000 1.9
+++ .cvsignore 7 Jul 2003 18:45:34 -0000 1.10
@@ -4,3 +4,6 @@
target
logs
build.xml
+activation-spi
+activation
+
1.3 +2 -2 avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/logging/TargetDescriptor.java
Index: TargetDescriptor.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/logging/TargetDescriptor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TargetDescriptor.java 11 Apr 2003 20:28:33 -0000 1.2
+++ TargetDescriptor.java 7 Jul 2003 18:45:34 -0000 1.3
@@ -80,7 +80,7 @@
private final TargetProvider m_provider;
/**
- * Create a LoggingDescriptor instance.
+ * Create a TargetDescriptor instance.
*
* @param name the target name
* @param provider the target provider description
1.8 +22 -1 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultClassLoaderModel.java
Index: DefaultClassLoaderModel.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultClassLoaderModel.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DefaultClassLoaderModel.java 7 Jul 2003 08:31:18 -0000 1.7
+++ DefaultClassLoaderModel.java 7 Jul 2003 18:45:34 -0000 1.8
@@ -213,6 +213,10 @@
m_parent = parent;
m_system = system;
+ getLogger().debug( "base: " + system.getBaseDirectory() );
+ getLogger().debug( "home: " + system.getHomeDirectory() );
+ getLogger().debug( "temp: " + system.getTempDirectory() );
+
if( parent != null )
{
DefaultExtensionManager local =
@@ -236,6 +240,22 @@
//
m_classpath = createClassPath( system, directive );
+
+ StringBuffer buffer = new StringBuffer( "classpath: " );
+ for( int i=0; i<m_classpath.length; i++ )
+ {
+ if( i==0 )
+ {
+ buffer.append( m_classpath[i] );
+ }
+ else
+ {
+ buffer.append( ";" + m_classpath[i] );
+ }
+ }
+
+ getLogger().debug( buffer.toString() );
+
if( parent != null )
{
m_packages = buildOptionalPackages(
@@ -248,6 +268,7 @@
m_urls = buildQualifiedClassPath();
m_classLoader = new URLClassLoader( m_urls, classLoader );
+
//
// create a type repository
1.8 +31 -21 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DefaultContainmentModel.java 7 Jul 2003 08:31:18 -0000 1.7
+++ DefaultContainmentModel.java 7 Jul 2003 18:45:34 -0000 1.8
@@ -97,6 +97,8 @@
// state
//==============================================================
+ private SystemContext m_system;
+
private String m_partition;
private final ContainmentProfile m_profile;
@@ -122,13 +124,14 @@
* @param profile the composition profile
*/
public DefaultContainmentModel(
- final Logger logger, ClassLoaderModel classLoaderModel,
+ final Logger logger, SystemContext system, ClassLoaderModel classLoaderModel,
ContainmentProfile profile )
throws Exception
{
super( logger, SEPERATOR, "", profile.getMode() );
m_partition = SEPERATOR;
m_profile = profile;
+ m_system = system;
m_classLoaderModel = classLoaderModel;
expandContainmentModel();
}
@@ -152,9 +155,11 @@
{
super( logger, parent.getPartition(), profile.getName(), profile.getMode() );
- m_partition = getPath() + getName() + SEPERATOR;
m_profile = profile;
+ m_system = parent.getContext();
m_classLoaderModel = classLoaderModel;
+
+ m_partition = getPath() + getName() + SEPERATOR;
expandContainmentModel();
}
@@ -188,7 +193,7 @@
}
//==============================================================
- // Producer
+ // Model
//==============================================================
/**
@@ -201,6 +206,15 @@
}
/**
+ * Return the containment context object.
+ * @return the system context
+ */
+ public SystemContext getContext()
+ {
+ return m_system;
+ }
+
+ /**
* Return TRUE is this model is capable of supporting a supplied
* depedendency.
* @return true if this model can fulfill the dependency
@@ -220,10 +234,6 @@
return false;
}
- //==============================================================
- // Consumer
- //==============================================================
-
/**
* Return the set of services that this model consumes.
* @return the cumsumed depedencies
@@ -254,7 +264,7 @@
try
{
final DeploymentModel model = new DefaultDeploymentModel(
- logger, m_classLoaderModel, profile, partition );
+ logger, m_system, m_classLoaderModel, profile, partition );
m_models.add( model );
return model;
}
@@ -313,15 +323,6 @@
}
/**
- * Return the set of service export mappings
- * @return the block implementation model
- */
- public ServiceDirective[] getServiceDirectives()
- {
- return m_profile.getServiceDirectives();
- }
-
- /**
* Return the classloader model.
* @return the classloader model
*/
@@ -332,16 +333,25 @@
/**
* Return the set of models nested within this model.
- * @return the classloader model
+ * @return the nested model
*/
- public Model[] getNestedModels()
+ public Model[] getModels()
{
return (Model[]) m_models.toArray( new Model[0] );
}
//==============================================================
- // protected implementation
+ // implementation
//==============================================================
+
+ /**
+ * Return the set of service export mappings
+ * @return the block implementation model
+ */
+ private ServiceDirective[] getServiceDirectives()
+ {
+ return m_profile.getServiceDirectives();
+ }
public String toString()
{
1.2 +5 -6 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModelFactory.java
Index: DefaultContainmentModelFactory.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModelFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultContainmentModelFactory.java 6 Jul 2003 10:08:16 -0000 1.1
+++ DefaultContainmentModelFactory.java 7 Jul 2003 18:45:34 -0000 1.2
@@ -146,7 +146,7 @@
profile.getClassLoaderDirective() );
return new DefaultContainmentModel(
- logger, classLoaderModel, profile );
+ logger, system, classLoaderModel, profile );
}
catch( Throwable e )
{
@@ -157,11 +157,10 @@
}
/**
- * Creation of a new containment model using
- * a supplied system context, classloader and containment profile.
+ * Creation of a new nested containment model.
*
- * @param system the system context
- * @param parent the parent containment model
+ * @param parent the containment model into which the new
+ * containment model is to be added
* @param profile the containment profile
* @return the containment model
*/
1.8 +88 -7 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DefaultDeploymentModel.java 7 Jul 2003 08:31:18 -0000 1.7
+++ DefaultDeploymentModel.java 7 Jul 2003 18:45:34 -0000 1.8
@@ -54,15 +54,19 @@
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Properties;
+import java.util.Hashtable;
+import java.util.Map;
import org.apache.avalon.composition.model.DeploymentModel;
import org.apache.avalon.composition.model.ClassLoaderModel;
+import org.apache.avalon.composition.model.SystemContext;
import org.apache.avalon.composition.repository.Repository;
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
import org.apache.avalon.framework.configuration.Configurable;
+import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.parameters.Parameterizable;
import org.apache.avalon.framework.logger.Logger;
@@ -98,6 +102,8 @@
// immutable state
//==============================================================
+ private final SystemContext m_system;
+
private final ClassLoaderModel m_classLoaderModel;
private final DeploymentProfile m_profile;
@@ -106,6 +112,8 @@
private final Class m_class;
+ private final Map m_map;
+
//==============================================================
// mutable state
//==============================================================
@@ -129,7 +137,7 @@
* @param path the partition name
*/
public DefaultDeploymentModel(
- final Logger logger, ClassLoaderModel classLoaderModel,
+ final Logger logger, SystemContext system, ClassLoaderModel classLoaderModel,
final DeploymentProfile profile, String path )
throws Exception
{
@@ -143,8 +151,10 @@
throw new NullPointerException( "path" );
}
+ m_system = system;
m_profile = profile;
m_classLoaderModel = classLoaderModel;
+
if( profile.getClassname() == null )
{
m_class = NullComponent.class;
@@ -154,6 +164,7 @@
m_class = m_classLoaderModel.getClassLoader().loadClass(
profile.getClassname() );
}
+
m_type = m_classLoaderModel.getTypeRepository().getType( m_class );
if( isConfigurable() )
@@ -184,10 +195,51 @@
m_parameters = Parameters.EMPTY_PARAMETERS;
}
}
+
+ if( isContextDependent() )
+ {
+
+ Map map = new Hashtable();
+ map.put( "urn:avalon:name", getName() );
+ map.put( "urn:avalon:partition", getPath() );
+ map.put( "urn:avalon:classloader", m_classLoaderModel.getClassLoader() );
+
+ //
+ // 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;
+ }
+ else
+ {
+ m_map = null;
+ }
}
//==============================================================
- // Producer
+ // Model
//==============================================================
/**
@@ -219,10 +271,6 @@
return getType().getExtension( stage ) != null;
}
- //==============================================================
- // Consumer
- //==============================================================
-
/**
* Return the set of services that this model consumes.
* @return the cumsumed depedencies
@@ -425,6 +473,39 @@
public Configuration getConfiguration()
{
return m_config;
+ }
+
+ /**
+ * Rest if the component type backing the model requires the
+ * establishment of a runtime context.
+ *
+ * @param return TRUE if the component type requires a runtime
+ * context otherwise FALSE
+ */
+ public boolean isContextDependent()
+ {
+ if( getType().getStages().length > 0 )
+ {
+ return true;
+ }
+ else if( Contextualizable.class.isAssignableFrom( m_class ) )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Return the context map established for the component.
+ *
+ * @return the context map
+ */
+ public Map getContextMap()
+ {
+ return m_map;
}
//==============================================================
1.2 +3 -2 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModelFactory.java
Index: DefaultDeploymentModelFactory.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultDeploymentModelFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultDeploymentModelFactory.java 6 Jul 2003 10:08:16 -0000 1.1
+++ DefaultDeploymentModelFactory.java 7 Jul 2003 18:45:34 -0000 1.2
@@ -102,11 +102,12 @@
final String name = profile.getName();
final String partition = parent.getPartition();
ClassLoaderModel classLoaderModel = parent.getClassLoaderModel();
+ SystemContext system = parent.getContext();
try
{
return new DefaultDeploymentModel(
- logger, classLoaderModel, profile, partition );
+ logger, system, classLoaderModel, profile, partition );
}
catch( Throwable e )
{
1.4 +65 -3 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultSystemContext.java 6 Jul 2003 04:07:52 -0000 1.3
+++ DefaultSystemContext.java 7 Jul 2003 18:45:34 -0000 1.4
@@ -81,6 +81,10 @@
private final File m_base;
+ private final File m_home;
+
+ private final File m_temp;
+
private final Repository m_repository;
//==============================================================
@@ -97,6 +101,39 @@
*/
public DefaultSystemContext( File base, Repository repository )
{
+ this(
+ base,
+ new File( System.getProperty( "user.work" ), "working" ),
+ repository );
+ }
+
+ /**
+ * Creation of a new system context.
+ *
+ * @param base the base directory from which relative references
+ * within a classpath or library directive shall be resolved
+ * @param repository a resource repository to be used when resolving
+ * resource directives
+ */
+ public DefaultSystemContext( File base, File work, Repository repository )
+ {
+ this(
+ base,
+ new File( work, "home" ),
+ new File( work, "temp" ),
+ repository );
+ }
+
+ /**
+ * Creation of a new system context.
+ *
+ * @param base the base directory from which relative references
+ * within a classpath or library directive shall be resolved
+ * @param repository a resource repository to be used when resolving
+ * resource directives
+ */
+ public DefaultSystemContext( File base, File home, File temp, Repository repository )
+ {
if( base == null )
{
throw new NullPointerException( "base" );
@@ -113,6 +150,9 @@
}
m_base = base;
+ m_home = home;
+ m_temp = temp;
+
m_repository = repository;
}
@@ -121,14 +161,36 @@
//==============================================================
/**
- * Return the base directory from which relative references
- * should be resolved.
+ * Return the base directory from which relative classloader
+ * references may be resolved.
*
* @return the base directory
*/
public File getBaseDirectory()
{
return m_base;
+ }
+
+ /**
+ * Return the working directory from which containers may
+ * establish persistent content.
+ *
+ * @return the working directory
+ */
+ public File getHomeDirectory()
+ {
+ return m_home;
+ }
+
+ /**
+ * Return the temporary directory from which a container
+ * may use to establish a transient content directory.
+ *
+ * @return the temporary directory
+ */
+ public File getTempDirectory()
+ {
+ return m_temp;
}
/**
1.4 +1 -4 avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Scanner.java
Index: Scanner.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/Scanner.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Scanner.java 7 Jul 2003 08:31:18 -0000 1.3
+++ Scanner.java 7 Jul 2003 18:45:34 -0000 1.4
@@ -100,11 +100,8 @@
ResourceManager.getPackageResources( Scanner.class );
private static final String X_INFO = ".xinfo";
-
private static final String X_TYPE = ".xtype";
-
private static final String X_SERVICE = ".xservice";
-
private static final String X_PROFILE = ".xprofile";
/**
1.3 +12 -9 avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/CompositionTestCase.java
Index: CompositionTestCase.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition/src/test/org/apache/avalon/composition/model/CompositionTestCase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CompositionTestCase.java 6 Jul 2003 10:08:17 -0000 1.2
+++ CompositionTestCase.java 7 Jul 2003 18:45:35 -0000 1.3
@@ -13,6 +13,7 @@
import org.apache.avalon.meta.data.ContainmentProfile;
import org.apache.avalon.meta.data.ClassLoaderDirective;
import org.apache.avalon.meta.info.DependencyDescriptor;
+import org.apache.avalon.meta.info.ServiceDescriptor;
import junit.framework.TestCase;
@@ -51,9 +52,9 @@
public void testContainmentModel() throws Exception
{
assertEquals( "", m_model.getName() );
- assertEquals( 2, m_model.getServiceDirectives().length );
+ assertEquals( 2, m_model.getServices().length );
assertEquals( 1, m_model.getDependencies().length );
- testServiceDirectives( m_model.getServiceDirectives() );
+ testServices( m_model.getServices() );
testDependencies( m_model.getDependencies() );
testImplementation( m_model );
}
@@ -61,10 +62,12 @@
/**
* Validate the service exports model.
*/
- public void testServiceDirectives( ServiceDirective[] services ) throws Exception
+ public void testServices( ServiceDescriptor[] services ) throws Exception
{
- assertEquals( "primary", services[0].getPath() );
- assertEquals( "my-component", services[1].getPath() );
+ assertEquals( "org.apache.avalon.composition.model.testa.A",
+ services[0].getReference().getClassname() );
+ assertEquals( "org.apache.avalon.composition.model.testd.D",
+ services[1].getReference().getClassname() );
}
/**
@@ -81,9 +84,9 @@
public void testImplementation( ContainmentModel model ) throws Exception
{
assertEquals( 4, model.getClassLoaderModel().getQualifiedClassPath().length );
- assertEquals( 2, model.getNestedModels().length );
- testFirstDeploymentModel( (DeploymentModel) model.getNestedModels()[0] );
- testFirstContainmentModel( (ContainmentModel) model.getNestedModels()[1] );
+ assertEquals( 2, model.getModels().length );
+ testFirstDeploymentModel( (DeploymentModel) model.getModels()[0] );
+ testFirstContainmentModel( (ContainmentModel) model.getModels()[1] );
}
/**
@@ -92,7 +95,7 @@
public void testFirstContainmentModel( ContainmentModel model ) throws Exception
{
assertEquals( 1, model.getClassLoaderModel().getQualifiedClassPath().length );
- assertEquals( 1, model.getNestedModels().length );
+ assertEquals( 1, model.getModels().length );
}
/**
1.5 +2 -1 avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ClassLoaderModel.java
Index: ClassLoaderModel.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ClassLoaderModel.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ClassLoaderModel.java 6 Jul 2003 10:08:17 -0000 1.4
+++ ClassLoaderModel.java 7 Jul 2003 18:45:35 -0000 1.5
@@ -130,6 +130,7 @@
*
* @param profile the containment profile
* @return a new class loader model
+ * @exception ModelException if an error occurs during model establishment
*/
ClassLoaderModel createChild( ContainmentProfile profile )
throws ModelException;
1.6 +7 -5 avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ContainmentModel.java
Index: ContainmentModel.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ContainmentModel.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ContainmentModel.java 7 Jul 2003 08:31:19 -0000 1.5
+++ ContainmentModel.java 7 Jul 2003 18:45:35 -0000 1.6
@@ -75,10 +75,10 @@
String getPartition();
/**
- * Return the set of service export mappings
- * @return the block implementation model
+ * Return the containment context object.
+ * @return the system context
*/
- ServiceDirective[] getServiceDirectives();
+ SystemContext getContext();
/**
* Return the classloader model assigned to this
@@ -92,7 +92,7 @@
* Return the set of models nested within this model.
* @return the classloader model
*/
- Model[] getNestedModels();
+ Model[] getModels();
/**
* Addition of a new instance of a deployment model within
@@ -100,6 +100,7 @@
*
* @param profile a deployment profile
* @return the deployment model
+ * @exception ModelException if an error occurs during model establishment
*/
DeploymentModel addDeploymentProfile( DeploymentProfile profile )
throws ModelException;
@@ -110,6 +111,7 @@
*
* @param profile a containment profile
* @return the composition model
+ * @exception ModelException if an error occurs during model establishment
*/
ContainmentModel addContainmentProfile( ContainmentProfile profile )
throws ModelException;
1.2 +16 -1 avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ContainmentModelFactory.java
Index: ContainmentModelFactory.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ContainmentModelFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContainmentModelFactory.java 6 Jul 2003 10:08:17 -0000 1.1
+++ ContainmentModelFactory.java 7 Jul 2003 18:45:35 -0000 1.2
@@ -71,6 +71,7 @@
* @param repository the system wide resource repository
* @param profile a containment profile
* @return the composition model
+ * @exception ModelException if an error occurs during model establishment
*/
ContainmentModel createContainmentModel(
SystemContext system, ContainmentProfile profile )
@@ -84,8 +85,22 @@
* @param classloader a classloader
* @param profile a containment profile
* @return the containment model
+ * @exception ModelException if an error occurs during model establishment
*/
ContainmentModel createContainmentModel(
SystemContext system, ClassLoader classloader, ContainmentProfile profile )
+ throws ModelException;
+
+ /**
+ * Creation of a new nested containment model.
+ *
+ * @param parent the containment model into which the new
+ * containment model is to be added
+ * @param profile the containment profile
+ * @return the containment model
+ * @exception ModelException if an error occurs during model establishment
+ */
+ public ContainmentModel createContainmentModel(
+ final ContainmentModel parent, ContainmentProfile profile )
throws ModelException;
}
1.4 +60 -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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DeploymentModel.java 6 Jul 2003 02:58:06 -0000 1.3
+++ DeploymentModel.java 7 Jul 2003 18:45:35 -0000 1.4
@@ -50,7 +50,10 @@
package org.apache.avalon.composition.model;
+import java.util.Map;
+
import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.meta.info.Type;
/**
@@ -104,4 +107,60 @@
* @return the qualified configuration
*/
Configuration getConfiguration();
+
+ /**
+ * Rest if the component type backing the model is
+ * parameterizable.
+ *
+ * @param return TRUE if the component type is parameterizable
+ * otherwise FALSE
+ */
+ public boolean isParameterizable();
+
+ /**
+ * Set the parameters to the supplied value. The supplied
+ * parameters value will replace the existing parameters value.
+ *
+ * @param parameters the supplied parameters value
+ */
+ public void setParameters( Parameters parameters );
+
+ /**
+ * Set the parameters to the supplied value. The supplied
+ * parameters value may suppliment or replace the existing
+ * parameters value.
+ *
+ * @param parameters the supplied parameters
+ * @param policy if TRUE the supplied parameters replaces the current
+ * parameters value otherwise the existing and supplied values
+ * are aggregrated
+ */
+ void setParameters( Parameters parameters, boolean policy );
+
+ /**
+ * Return the configuration to be applied to the component.
+ * The implementation returns the current configuration state.
+ * If the the component type does not implementation the
+ * Configurable interface, the implementation returns null.
+ *
+ * @return the qualified configuration
+ */
+ Parameters getParameters();
+
+ /**
+ * Rest if the component type backing the model requires the
+ * establishment of a runtime context.
+ *
+ * @param return TRUE if the component type requires a runtime
+ * context otherwise FALSE
+ */
+ boolean isContextDependent();
+
+ /**
+ * Return the context map established for the component.
+ *
+ * @return the context map
+ */
+ Map getContextMap();
+
}
1.2 +2 -1 avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/DeploymentModelFactory.java
Index: DeploymentModelFactory.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/DeploymentModelFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeploymentModelFactory.java 6 Jul 2003 10:08:17 -0000 1.1
+++ DeploymentModelFactory.java 7 Jul 2003 18:45:35 -0000 1.2
@@ -70,6 +70,7 @@
* @param profile a containment profile
* @return a deployment model contained within the parent
* containment model
+ * @exception ModelException if an error occurs during model establishment
*/
DeploymentModel createDeploymentModel(
Logger logger, ContainmentModel parent, DeploymentProfile profile )
1.4 +2 -2 avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/Model.java
Index: Model.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/Model.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Model.java 7 Jul 2003 08:40:02 -0000 1.3
+++ Model.java 7 Jul 2003 18:45:35 -0000 1.4
@@ -115,7 +115,7 @@
/**
* Return the set of services that this model consumes.
- * @return the cumsumed depedencies
+ * @return the dependencies
*/
DependencyDescriptor[] getDependencies();
}
1.2 +17 -1 avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/SystemContext.java
Index: SystemContext.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/SystemContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SystemContext.java 4 Jul 2003 07:28:20 -0000 1.1
+++ SystemContext.java 7 Jul 2003 18:45:35 -0000 1.2
@@ -72,6 +72,22 @@
File getBaseDirectory();
/**
+ * Return the working directory from containers may establish
+ * persistent content.
+ *
+ * @return the working directory
+ */
+ File getHomeDirectory();
+
+ /**
+ * Return the temporary directory from which a container
+ * may use to establish transient content.
+ *
+ * @return the temporary directory
+ */
+ File getTempDirectory();
+
+ /**
* Return the system wide repository from which resource
* directives can be resolved.
*
1.2 +13 -4 avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/data/ClasspathDirective.java
Index: ClasspathDirective.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/data/ClasspathDirective.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClasspathDirective.java 3 Jul 2003 04:28:55 -0000 1.1
+++ ClasspathDirective.java 7 Jul 2003 18:45:36 -0000 1.2
@@ -150,17 +150,26 @@
//
FilesetDirective[] filesets = getFilesets();
+
for( int i=0; i<filesets.length; i++ )
{
FilesetDirective fileset = filesets[i];
File anchor = getDirectory( base, fileset.getBaseDirectory() );
IncludeDirective[] includes = fileset.getIncludes();
- for( int j=0; j<includes.length; j++ )
+ if( includes.length > 0 )
{
- File file = new File( anchor, includes[i].getPath() );
- list.add( file );
+ for( int j=0; j<includes.length; j++ )
+ {
+ File file = new File( anchor, includes[i].getPath() );
+ list.add( file );
+ }
+ }
+ else
+ {
+ list.add( anchor );
}
}
+
return (File[]) list.toArray( new File[0] );
}
1.4 +38 -13 avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/data/ContainmentProfile.java
Index: ContainmentProfile.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/data/ContainmentProfile.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ContainmentProfile.java 7 Jul 2003 08:31:20 -0000 1.3
+++ ContainmentProfile.java 7 Jul 2003 18:45:36 -0000 1.4
@@ -64,8 +64,9 @@
import org.apache.avalon.framework.configuration.Configuration;
/**
- * A containment profile is a extended deployment profile that
- * aggregates a set of profiles.
+ * A containment profile describes a containment context including
+ * a classloader and the set of profiles explicitly included within
+ * the a container.
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version $Revision$ $Date$
@@ -121,11 +122,27 @@
// constructor
//--------------------------------------------------------------------------
+ /**
+ * Creation of a new empty containment profile.
+ */
public ContainmentProfile()
{
this( "container", null, null, null, new Profile[0] );
}
+ /**
+ * Creation of a new containment profile.
+ *
+ * @param name the profile name
+ * @param classloader the description of the classloader to be
+ * created for this containment profile
+ * @param imports the set of dependencies that this containment
+ * profile has on external services
+ * @param exports the set of servides that this component is
+ * dependent on for normal execution
+ * @param profile the set of profiles contained within this
+ * containment profile
+ */
public ContainmentProfile(
final String name, final ClassLoaderDirective classloader,
final DependencyDescriptor[] imports, final ServiceDirective[] exports,
@@ -159,9 +176,10 @@
//--------------------------------------------------------------------------
/**
- * Return the classloader directive..
+ * Return the classloader directive that describes the creation
+ * arguments for the classloader required by this container.
*
- * @return classloader directive.
+ * @return the classloader directive
*/
public ClassLoaderDirective getClassLoaderDirective()
{
@@ -169,7 +187,10 @@
}
/**
- * Return the classloader directive..
+ * Return the classloader directive that describes the creation
+ * arguments for the classloader required by this container. If the
+ * assigned classloader directive is null and 'create' is true, a
+ * new empty classloader directive will be returned.
*
* @return classloader directive.
*/
@@ -183,9 +204,11 @@
}
/**
- * Return the set of service directives.
+ * Return the set of service directives that describe the mapping
+ * between services exposrted by the container and its implementation
+ * model.
*
- * @return the service directive set
+ * @return the array of service directives
*/
public ServiceDirective[] getServiceDirectives()
{
@@ -193,8 +216,10 @@
}
/**
- * Get the imported dependencies.
- * @return the dependecy import
+ * Get the imported dependencies that the container requires
+ * for normal execution.
+ *
+ * @return the dependencies
*/
public DependencyDescriptor[] getDependencies()
{
@@ -205,7 +230,7 @@
* Retrieve a service directive matching a supplied class.
*
* @param class the class to match
- * @return the service descriptor or null if it does not exist
+ * @return the service directive or null if it does not exist
*/
public ServiceDirective getServiceDirective( final Class clazz )
{
@@ -223,9 +248,9 @@
}
/**
- * Return the set of nested profiles.
+ * Return the set of nested profiles wihin this containment profile.
*
- * @return the profiles nested in this containment directive
+ * @return the profiles nested in this containment profile
*/
public Profile[] getProfiles()
{
1.4 +4 -2 avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/ContextDescriptor.java
Index: ContextDescriptor.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/ContextDescriptor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ContextDescriptor.java 16 Apr 2003 14:15:00 -0000 1.3
+++ ContextDescriptor.java 7 Jul 2003 18:45:36 -0000 1.4
@@ -116,7 +116,9 @@
}
/**
- * Return the reference decription for the context.
+ * Return the reference decription for the context
+ * object interface that the supplied context argument
+ * supports under a type-safe cast.
*
* @return the reference descriptor.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org