mcconnell 2003/07/27 08:03:47
Modified: merlin/composition/src/java/org/apache/avalon/composition/model/impl
DefaultContainmentModel.java
Log:
Sync. with interface updates on containment simplification.
Revision Changes Path
1.18 +11 -26
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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- DefaultContainmentModel.java 27 Jul 2003 11:50:05 -0000 1.17
+++ DefaultContainmentModel.java 27 Jul 2003 15:03:47 -0000 1.18
@@ -164,7 +164,7 @@
Profile[] profiles = context.getContainmentProfile().getProfiles();
for( int i=0; i<profiles.length; i++ )
{
- addProfile( profiles[i] );
+ addModel( profiles[i] );
}
}
@@ -213,8 +213,10 @@
/**
* Return TRUE is this model is capable of supporting a supplied
- * stage dependency.
- * @return true if this model can fulfill the dependency
+ * stage dependency. The containment model implementation will
+ * allways return FALSE.
+ *
+ * @return FALSE containers don't export stage handling support
*/
public boolean isaCandidate( StageDescriptor stage )
{
@@ -227,20 +229,11 @@
return false;
}
- /**
- * Return the set of services that this model consumes.
- * @return the consumed dependencies
- */
- public DependencyDescriptor[] getDependencies()
- {
- return m_context.getContainmentProfile().getDependencies();
- }
-
//==============================================================
// ContainmentModel
//==============================================================
- public Model addProfile( Profile profile ) throws ModelException
+ public Model addModel( Profile profile ) throws ModelException
{
if( profile instanceof ContainmentProfile )
{
@@ -275,7 +268,7 @@
* @param profile a containment profile
* @return the composition model
*/
- public DeploymentModel addDeploymentProfile( final DeploymentProfile profile )
+ private DeploymentModel addDeploymentProfile( final DeploymentProfile profile )
throws ModelException
{
final String name = profile.getName();
@@ -329,7 +322,7 @@
* @param profile a containment profile
* @return the composition model
*/
- public ContainmentModel addContainmentProfile( final ContainmentProfile profile
)
+ private ContainmentModel addContainmentProfile( final ContainmentProfile
profile )
throws ModelException
{
final String name = profile.getName();
@@ -418,11 +411,10 @@
//
// if an existing model exists return it
//
-System.out.println("1");
+
Model[] models = getModels();
ModelSelector modelSelector = new DefaultModelSelector();
Model model = modelSelector.select( models, dependency );
-System.out.println("2");
if( model != null ) return model;
//
@@ -430,20 +422,15 @@
// we could use to construct the model
//
-System.out.println("3");
TypeRepository repository =
m_context.getClassLoaderModel().getTypeRepository();
-System.out.println("4");
ArrayList list = new ArrayList();
try
{
Type[] types = repository.getTypes( dependency );
-System.out.println("5: " + types.length );
for( int i=0; i<types.length; i++ )
{
-System.out.println("5.1");
Profile[] profiles = repository.getProfiles( types[i] );
-System.out.println("5.2: " + profiles.length );
for( int j=0; j<profiles.length; j++ )
{
list.add( profiles[j] );
@@ -458,12 +445,10 @@
// DependencyDirective instead of the descriptor.
//
-System.out.println("6");
Profile[] collection = (Profile[]) list.toArray( new Profile[0] );
ProfileSelector selector = new DefaultProfileSelector();
Profile profile = selector.select( collection, dependency );
-System.out.println("7: " + profile );
- if( profile != null ) return addProfile( profile );
+ if( profile != null ) return addModel( profile );
return null;
}
catch( Throwable e )
@@ -528,7 +513,7 @@
Profile[] collection = (Profile[]) list.toArray( new Profile[0] );
ProfileSelector selector = new DefaultProfileSelector();
Profile profile = selector.select( collection, stage );
- if( profile != null ) return addProfile( profile );
+ if( profile != null ) return addModel( profile );
return null;
}
catch( Throwable e )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]