mcconnell 2004/01/11 21:41:05
Modified: merlin Tag: Ver_3_4 maven.xml
merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl
Tag: Ver_3_4 AbstractBlock.java DefaultBlock.java
DefaultBlockContext.java
merlin/activation/impl/src/test/org/apache/avalon/playground
Tag: Ver_3_4 ComplexComponent.java
merlin/composition/api/src/java/org/apache/avalon/composition/model
Tag: Ver_3_4 ContainmentModel.java
merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
Tag: Ver_3_4 DefaultContainmentModel.java
merlin/kernel/unit Tag: Ver_3_4 maven.xml
Added: merlin/composition/api/src/java/org/apache/avalon/composition/model
Tag: Ver_3_4 ServiceModel.java
merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl
Tag: Ver_3_4 DefaultServiceModel.java
Log:
Update the meta model to formally handle binding of a service export directive with
the implementing class.
Revision Changes Path
No revision
No revision
1.31.2.5 +2 -1 avalon/merlin/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/maven.xml,v
retrieving revision 1.31.2.4
retrieving revision 1.31.2.5
diff -u -r1.31.2.4 -r1.31.2.5
--- maven.xml 12 Jan 2004 02:11:24 -0000 1.31.2.4
+++ maven.xml 12 Jan 2004 05:41:05 -0000 1.31.2.5
@@ -146,6 +146,7 @@
<include name="bin/**/*"/>
<exclude name="bin/**/*.jar"/>
<exclude name="bin/**/*.exe"/>
+ <exclude name="bin/**/*.dll"/>
</fileset>
<fileset dir="${basedir}">
<include name="README.TXT"/>
@@ -158,12 +159,12 @@
</ant:copy>
<ant:copy toDir="${merlin.build.inst.dir}">
- </fileset>
<fileset dir="${basedir}/platform/src">
<include name="config/**/*"/>
<include name="system/**/*"/>
<include name="bin/**/*.jar"/>
<include name="bin/**/*.exe"/>
+ <include name="bin/**/*.dll"/>
</fileset>
<fileset dir="${basedir}">
<include name="LICENSE.txt"/>
No revision
No revision
1.10.2.8 +1 -2
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java
Index: AbstractBlock.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java,v
retrieving revision 1.10.2.7
retrieving revision 1.10.2.8
diff -u -r1.10.2.7 -r1.10.2.8
--- AbstractBlock.java 12 Jan 2004 00:17:19 -0000 1.10.2.7
+++ AbstractBlock.java 12 Jan 2004 05:41:05 -0000 1.10.2.8
@@ -101,7 +101,6 @@
/**
* Create a root containment block.
- * @param system the system context
* @param model the root containment model
* @return the appliance
*/
1.7.2.7 +9 -30
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/Attic/DefaultBlock.java
Index: DefaultBlock.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/Attic/DefaultBlock.java,v
retrieving revision 1.7.2.6
retrieving revision 1.7.2.7
diff -u -r1.7.2.6 -r1.7.2.7
--- DefaultBlock.java 12 Jan 2004 02:11:24 -0000 1.7.2.6
+++ DefaultBlock.java 12 Jan 2004 05:41:05 -0000 1.7.2.7
@@ -64,8 +64,11 @@
import org.apache.avalon.activation.appliance.ApplianceRuntimeException;
import org.apache.avalon.activation.appliance.BlockContext;
import org.apache.avalon.activation.appliance.Home;
+
import org.apache.avalon.composition.data.ServiceDirective;
import org.apache.avalon.composition.model.ContainmentModel;
+import org.apache.avalon.composition.model.ServiceModel;
+
import org.apache.avalon.framework.logger.Logger;
/**
@@ -163,34 +166,11 @@
ContainmentModel model = m_context.getContainmentModel();
ClassLoader loader = model.getClassLoaderModel().getClassLoader();
ArrayList list = new ArrayList();
- ServiceDirective[] services = model.getExportDirectives();
+ ServiceModel[] services = model.getServiceModels();
for( int i=0; i<services.length; i++ )
{
- final ServiceDirective service = services[i];
- final String classname = service.getReference().getClassname();
- try
- {
- Class clazz = loader.loadClass( classname );
- list.add( clazz );
- }
- catch( ClassNotFoundException cnfe )
- {
- final String error =
- "Class not found: [" + classname
- + "] in block [" + this
- + "] with classloader content: \n";
- StringBuffer buffer = new StringBuffer( error );
- if( loader instanceof URLClassLoader )
- {
- URL[] urls = ((URLClassLoader)loader).getURLs();
- for( int j=0; j<urls.length; j++ )
- {
- buffer.append( "\n " + urls[j].toString() );
- }
- }
- String message = buffer.toString();
- throw new ApplianceException( message );
- }
+ final ServiceModel service = services[i];
+ list.add( service.getServiceClass() );
}
return (Class[]) list.toArray( new Class[0] );
}
@@ -245,8 +225,7 @@
final ContainmentModel model = m_context.getContainmentModel();
Class source = method.getDeclaringClass();
- ServiceDirective service =
- model.getExportDirective( source );
+ ServiceModel service = model.getServiceModel( source );
if( null == service )
{
final String error =
@@ -256,7 +235,7 @@
throw new IllegalStateException( error );
}
- String path = service.getPath();
+ String path = service.getServiceDirective().getPath();
Appliance provider = (Appliance) m_block.locate( path );
m_logger.debug( "delegating: " + method.getName() );
1.3.2.4 +1 -3
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlockContext.java
Index: DefaultBlockContext.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlockContext.java,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -r1.3.2.3 -r1.3.2.4
--- DefaultBlockContext.java 12 Jan 2004 00:17:19 -0000 1.3.2.3
+++ DefaultBlockContext.java 12 Jan 2004 05:41:05 -0000 1.3.2.4
@@ -70,9 +70,7 @@
/**
* Creation of a new block context.
- * @param logger the logging channel to assign
* @param model the containment model describing the block
- * @param context the service context
* @param engine the engine from which dependent applicance
* instances may be resolved
*/
No revision
No revision
1.1.1.1.2.3 +2 -0
avalon/merlin/activation/impl/src/test/org/apache/avalon/playground/ComplexComponent.java
Index: ComplexComponent.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/playground/ComplexComponent.java,v
retrieving revision 1.1.1.1.2.2
retrieving revision 1.1.1.1.2.3
diff -u -r1.1.1.1.2.2 -r1.1.1.1.2.3
--- ComplexComponent.java 8 Jan 2004 10:40:53 -0000 1.1.1.1.2.2
+++ ComplexComponent.java 12 Jan 2004 05:41:05 -0000 1.1.1.1.2.3
@@ -146,6 +146,7 @@
{
m_simple = (SimpleService) m_manager.lookup( "simple" );
getLogger().info( m_simple.getClass().toString() );
+ getLogger().info( "simple: " + m_simple );
}
catch( ServiceException e )
{
@@ -157,6 +158,7 @@
{
m_basic = (BasicService) m_manager.lookup( "basic" );
getLogger().info( m_basic.getClass().toString() );
+ getLogger().info( "basic: " + m_basic );
}
catch( ServiceException e )
{
No revision
No revision
1.9.2.9 +7 -6
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ContainmentModel.java
Index: ContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ContainmentModel.java,v
retrieving revision 1.9.2.8
retrieving revision 1.9.2.9
diff -u -r1.9.2.8 -r1.9.2.9
--- ContainmentModel.java 9 Jan 2004 20:29:48 -0000 1.9.2.8
+++ ContainmentModel.java 12 Jan 2004 05:41:05 -0000 1.9.2.9
@@ -157,17 +157,18 @@
*/
void removeModel( String name );
+
/**
- * Return the set of service export directives.
+ * Return the set of service export models.
* @return t he export directives
*/
- ServiceDirective[] getExportDirectives();
+ ServiceModel[] getServiceModels();
/**
- * Return the set of service export directives for a supplied class.
- * @return the export directives
+ * Return a service exoport model matching a supplied class.
+ * @return the service model
*/
- ServiceDirective getExportDirective( Class clazz );
+ ServiceModel getServiceModel( Class clazz );
/**
* Apply a set of override targets resolvable from a supplied url.
No revision
Index: ContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ContainmentModel.java,v
retrieving revision 1.9.2.8
retrieving revision 1.9.2.9
diff -u -r1.9.2.8 -r1.9.2.9
--- ContainmentModel.java 9 Jan 2004 20:29:48 -0000 1.9.2.8
+++ ContainmentModel.java 12 Jan 2004 05:41:05 -0000 1.9.2.9
@@ -157,17 +157,18 @@
*/
void removeModel( String name );
+
/**
- * Return the set of service export directives.
+ * Return the set of service export models.
* @return t he export directives
*/
- ServiceDirective[] getExportDirectives();
+ ServiceModel[] getServiceModels();
/**
- * Return the set of service export directives for a supplied class.
- * @return the export directives
+ * Return a service exoport model matching a supplied class.
+ * @return the service model
*/
- ServiceDirective getExportDirective( Class clazz );
+ ServiceModel getServiceModel( Class clazz );
/**
* Apply a set of override targets resolvable from a supplied url.
No revision
Index: ContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/ContainmentModel.java,v
retrieving revision 1.9.2.8
retrieving revision 1.9.2.9
diff -u -r1.9.2.8 -r1.9.2.9
--- ContainmentModel.java 9 Jan 2004 20:29:48 -0000 1.9.2.8
+++ ContainmentModel.java 12 Jan 2004 05:41:05 -0000 1.9.2.9
@@ -157,17 +157,18 @@
*/
void removeModel( String name );
+
/**
- * Return the set of service export directives.
+ * Return the set of service export models.
* @return t he export directives
*/
- ServiceDirective[] getExportDirectives();
+ ServiceModel[] getServiceModels();
/**
- * Return the set of service export directives for a supplied class.
- * @return the export directives
+ * Return a service exoport model matching a supplied class.
+ * @return the service model
*/
- ServiceDirective getExportDirective( Class clazz );
+ ServiceModel getServiceModel( Class clazz );
/**
* Apply a set of override targets resolvable from a supplied url.
1.1.2.1 +75 -0
avalon/merlin/composition/api/src/java/org/apache/avalon/composition/model/Attic/ServiceModel.java
No revision
No revision
1.13.2.16 +56 -26
avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
Index: DefaultContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
retrieving revision 1.13.2.15
retrieving revision 1.13.2.16
diff -u -r1.13.2.15 -r1.13.2.16
--- DefaultContainmentModel.java 12 Jan 2004 02:11:24 -0000 1.13.2.15
+++ DefaultContainmentModel.java 12 Jan 2004 05:41:05 -0000 1.13.2.16
@@ -92,6 +92,7 @@
import org.apache.avalon.composition.model.ModelRepository;
import org.apache.avalon.composition.model.ModelSelector;
import org.apache.avalon.composition.model.ProfileSelector;
+import org.apache.avalon.composition.model.ServiceModel;
import org.apache.avalon.composition.model.SystemContext;
import org.apache.avalon.composition.model.StageModel;
import org.apache.avalon.composition.model.TypeRepository;
@@ -170,6 +171,8 @@
private final String m_partition;
+ private final ServiceModel[] m_services;
+
//--------------------------------------------------------------
// state
//--------------------------------------------------------------
@@ -205,6 +208,29 @@
+ DeploymentModel.SEPARATOR;
}
+ ClassLoader classloader = context.getClassLoader();
+ ServiceDirective[] export =
+ context.getContainmentProfile().getExportDirectives();
+ m_services = new DefaultServiceModel[ export.length ];
+ for( int i=0; i<export.length; i++ )
+ {
+ ServiceDirective service = export[i];
+ String classname = service.getReference().getClassname();
+ try
+ {
+ Class clazz = classloader.loadClass( classname );
+ m_services[i] = new DefaultServiceModel( service, clazz );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Cannot load service class ["
+ + classname
+ + "].";
+ throw new ModelException( error, e );
+ }
+ }
+
DeploymentProfile[] profiles =
context.getContainmentProfile().getProfiles();
for( int i=0; i<profiles.length; i++ )
{
@@ -252,7 +278,7 @@
*/
public ServiceDescriptor[] getServices()
{
- return getExportDirectives();
+ return m_context.getContainmentProfile().getExportDirectives();
}
/**
@@ -731,6 +757,34 @@
}
}
+ /**
+ * Return the set of service export mappings
+ * @return the set of export directives published by the model
+ */
+ public ServiceModel[] getServiceModels()
+ {
+ return m_services;
+ }
+
+ /**
+ * Return the set of service export directives for a supplied class.
+ * @param clazz a cleaa identifying the directive
+ * @return the export directives
+ */
+ public ServiceModel getServiceModel( Class clazz )
+ {
+ ServiceModel[] models = getServiceModels();
+ for( int i=0; i<models.length; i++ )
+ {
+ ServiceModel model = models[i];
+ if( model.getServiceClass().isAssignableFrom( clazz ) )
+ {
+ return model;
+ }
+ }
+ return null;
+ }
+
/**
* Get the startup sequence for the model.
*/
@@ -1554,30 +1608,6 @@
private String getRemainder( String name, String path )
{
return path.substring( name.length() + 1 );
- }
-
- /**
- * Return the set of service export mappings
- * @return the set of export directives published by the model
- */
- public ServiceDirective[] getExportDirectives()
- {
- return m_context.getContainmentProfile().getExportDirectives();
- }
-
- /**
- * Return the set of service export directives for a supplied class.
- * @param clazz a cleaa identifying the directive
- * @return the export directives
- */
- public ServiceDirective getExportDirective( Class clazz )
- {
- // ##
- // ## BUG
- // ## need to resolve class agaisnt class loaded from
- // ## service export classname
- // ##
- return m_context.getContainmentProfile().getExportDirective( clazz );
}
//==============================================================
No revision
Index: DefaultContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
retrieving revision 1.13.2.15
retrieving revision 1.13.2.16
diff -u -r1.13.2.15 -r1.13.2.16
--- DefaultContainmentModel.java 12 Jan 2004 02:11:24 -0000 1.13.2.15
+++ DefaultContainmentModel.java 12 Jan 2004 05:41:05 -0000 1.13.2.16
@@ -92,6 +92,7 @@
import org.apache.avalon.composition.model.ModelRepository;
import org.apache.avalon.composition.model.ModelSelector;
import org.apache.avalon.composition.model.ProfileSelector;
+import org.apache.avalon.composition.model.ServiceModel;
import org.apache.avalon.composition.model.SystemContext;
import org.apache.avalon.composition.model.StageModel;
import org.apache.avalon.composition.model.TypeRepository;
@@ -170,6 +171,8 @@
private final String m_partition;
+ private final ServiceModel[] m_services;
+
//--------------------------------------------------------------
// state
//--------------------------------------------------------------
@@ -205,6 +208,29 @@
+ DeploymentModel.SEPARATOR;
}
+ ClassLoader classloader = context.getClassLoader();
+ ServiceDirective[] export =
+ context.getContainmentProfile().getExportDirectives();
+ m_services = new DefaultServiceModel[ export.length ];
+ for( int i=0; i<export.length; i++ )
+ {
+ ServiceDirective service = export[i];
+ String classname = service.getReference().getClassname();
+ try
+ {
+ Class clazz = classloader.loadClass( classname );
+ m_services[i] = new DefaultServiceModel( service, clazz );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Cannot load service class ["
+ + classname
+ + "].";
+ throw new ModelException( error, e );
+ }
+ }
+
DeploymentProfile[] profiles =
context.getContainmentProfile().getProfiles();
for( int i=0; i<profiles.length; i++ )
{
@@ -252,7 +278,7 @@
*/
public ServiceDescriptor[] getServices()
{
- return getExportDirectives();
+ return m_context.getContainmentProfile().getExportDirectives();
}
/**
@@ -731,6 +757,34 @@
}
}
+ /**
+ * Return the set of service export mappings
+ * @return the set of export directives published by the model
+ */
+ public ServiceModel[] getServiceModels()
+ {
+ return m_services;
+ }
+
+ /**
+ * Return the set of service export directives for a supplied class.
+ * @param clazz a cleaa identifying the directive
+ * @return the export directives
+ */
+ public ServiceModel getServiceModel( Class clazz )
+ {
+ ServiceModel[] models = getServiceModels();
+ for( int i=0; i<models.length; i++ )
+ {
+ ServiceModel model = models[i];
+ if( model.getServiceClass().isAssignableFrom( clazz ) )
+ {
+ return model;
+ }
+ }
+ return null;
+ }
+
/**
* Get the startup sequence for the model.
*/
@@ -1554,30 +1608,6 @@
private String getRemainder( String name, String path )
{
return path.substring( name.length() + 1 );
- }
-
- /**
- * Return the set of service export mappings
- * @return the set of export directives published by the model
- */
- public ServiceDirective[] getExportDirectives()
- {
- return m_context.getContainmentProfile().getExportDirectives();
- }
-
- /**
- * Return the set of service export directives for a supplied class.
- * @param clazz a cleaa identifying the directive
- * @return the export directives
- */
- public ServiceDirective getExportDirective( Class clazz )
- {
- // ##
- // ## BUG
- // ## need to resolve class agaisnt class loaded from
- // ## service export classname
- // ##
- return m_context.getContainmentProfile().getExportDirective( clazz );
}
//==============================================================
No revision
Index: DefaultContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
retrieving revision 1.13.2.15
retrieving revision 1.13.2.16
diff -u -r1.13.2.15 -r1.13.2.16
--- DefaultContainmentModel.java 12 Jan 2004 02:11:24 -0000 1.13.2.15
+++ DefaultContainmentModel.java 12 Jan 2004 05:41:05 -0000 1.13.2.16
@@ -92,6 +92,7 @@
import org.apache.avalon.composition.model.ModelRepository;
import org.apache.avalon.composition.model.ModelSelector;
import org.apache.avalon.composition.model.ProfileSelector;
+import org.apache.avalon.composition.model.ServiceModel;
import org.apache.avalon.composition.model.SystemContext;
import org.apache.avalon.composition.model.StageModel;
import org.apache.avalon.composition.model.TypeRepository;
@@ -170,6 +171,8 @@
private final String m_partition;
+ private final ServiceModel[] m_services;
+
//--------------------------------------------------------------
// state
//--------------------------------------------------------------
@@ -205,6 +208,29 @@
+ DeploymentModel.SEPARATOR;
}
+ ClassLoader classloader = context.getClassLoader();
+ ServiceDirective[] export =
+ context.getContainmentProfile().getExportDirectives();
+ m_services = new DefaultServiceModel[ export.length ];
+ for( int i=0; i<export.length; i++ )
+ {
+ ServiceDirective service = export[i];
+ String classname = service.getReference().getClassname();
+ try
+ {
+ Class clazz = classloader.loadClass( classname );
+ m_services[i] = new DefaultServiceModel( service, clazz );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Cannot load service class ["
+ + classname
+ + "].";
+ throw new ModelException( error, e );
+ }
+ }
+
DeploymentProfile[] profiles =
context.getContainmentProfile().getProfiles();
for( int i=0; i<profiles.length; i++ )
{
@@ -252,7 +278,7 @@
*/
public ServiceDescriptor[] getServices()
{
- return getExportDirectives();
+ return m_context.getContainmentProfile().getExportDirectives();
}
/**
@@ -731,6 +757,34 @@
}
}
+ /**
+ * Return the set of service export mappings
+ * @return the set of export directives published by the model
+ */
+ public ServiceModel[] getServiceModels()
+ {
+ return m_services;
+ }
+
+ /**
+ * Return the set of service export directives for a supplied class.
+ * @param clazz a cleaa identifying the directive
+ * @return the export directives
+ */
+ public ServiceModel getServiceModel( Class clazz )
+ {
+ ServiceModel[] models = getServiceModels();
+ for( int i=0; i<models.length; i++ )
+ {
+ ServiceModel model = models[i];
+ if( model.getServiceClass().isAssignableFrom( clazz ) )
+ {
+ return model;
+ }
+ }
+ return null;
+ }
+
/**
* Get the startup sequence for the model.
*/
@@ -1554,30 +1608,6 @@
private String getRemainder( String name, String path )
{
return path.substring( name.length() + 1 );
- }
-
- /**
- * Return the set of service export mappings
- * @return the set of export directives published by the model
- */
- public ServiceDirective[] getExportDirectives()
- {
- return m_context.getContainmentProfile().getExportDirectives();
- }
-
- /**
- * Return the set of service export directives for a supplied class.
- * @param clazz a cleaa identifying the directive
- * @return the export directives
- */
- public ServiceDirective getExportDirective( Class clazz )
- {
- // ##
- // ## BUG
- // ## need to resolve class agaisnt class loaded from
- // ## service export classname
- // ##
- return m_context.getContainmentProfile().getExportDirective( clazz );
}
//==============================================================
1.1.2.1 +91 -0
avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/model/impl/Attic/DefaultServiceModel.java
No revision
No revision
1.7.2.1 +1 -0 avalon/merlin/kernel/unit/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/kernel/unit/maven.xml,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- maven.xml 14 Dec 2003 09:56:08 -0000 1.7
+++ maven.xml 12 Jan 2004 05:41:05 -0000 1.7.2.1
@@ -5,6 +5,7 @@
Add the merlin.properties file.
-->
<postGoal name="java:compile">
+ <mkdir dir="${maven.build.dir}/classes"/>
<ant:copy
file="${maven.repo.local}/${pom.groupId}/properties/merlin.properties"
toDir="${maven.build.dir}/classes" verbose="yes"/>
</postGoal>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]