You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by tb...@apache.org on 2004/04/16 22:08:13 UTC
cvs commit: avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder XMLContainmentProfileCreator.java
tbennett 2004/04/16 13:08:12
Modified: merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder
XMLContainmentProfileCreator.java
Log:
Modified the profile creator to scan the classpath directive for fileset excludes, and populate the FilesetDirective with them.
Revision Changes Path
1.14 +50 -2 avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java
Index: XMLContainmentProfileCreator.java
===================================================================
RCS file: /home/cvs/avalon/merlin/composition/impl/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XMLContainmentProfileCreator.java 7 Apr 2004 16:49:22 -0000 1.13
+++ XMLContainmentProfileCreator.java 16 Apr 2004 20:08:12 -0000 1.14
@@ -29,6 +29,7 @@
import org.apache.avalon.composition.data.ClasspathDirective;
import org.apache.avalon.composition.data.ContainmentProfile;
import org.apache.avalon.composition.data.DeploymentProfile;
+import org.apache.avalon.composition.data.ExcludeDirective;
import org.apache.avalon.composition.data.FilesetDirective;
import org.apache.avalon.composition.data.IncludeDirective;
import org.apache.avalon.composition.data.LibraryDirective;
@@ -271,7 +272,8 @@
{
String base = config.getAttribute( "dir", "." );
IncludeDirective[] includes = createIncludeDirectives( config );
- return new FilesetDirective( base, includes );
+ ExcludeDirective[] excludes = createExcludeDirectives( config );
+ return new FilesetDirective( base, includes, excludes );
}
/**
@@ -301,6 +303,32 @@
}
/**
+ * Utility method to create a set in exclude directives.
+ * @param config a configuration defining the fileset
+ * @return the excludes
+ * @exception ConfigurationException if the configuration is
+ * incomplete
+ */
+ protected ExcludeDirective[] createExcludeDirectives( Configuration config )
+ throws ConfigurationException
+ {
+ if( config == null )
+ {
+ return new ExcludeDirective[0];
+ }
+
+ ArrayList list = new ArrayList();
+ Configuration[] children = config.getChildren( "exclude" );
+ for( int i = 0; i < children.length; i++ )
+ {
+ Configuration child = children[i];
+ list.add( createExcludeDirective( child ) );
+ }
+
+ return (ExcludeDirective[]) list.toArray( new ExcludeDirective[0] );
+ }
+
+ /**
* Utility method to create a new include directive from a
* configuration instance.
* @param config a configuration defining the include directive
@@ -314,6 +342,20 @@
return new IncludeDirective( getIncludeValue( config ) );
}
+ /**
+ * Utility method to create a new exclude directive from a
+ * configuration instance.
+ * @param config a configuration defining the exclude directive
+ * @return the exclude directive
+ * @exception ConfigurationException if the configuration does not
+ * declare the name attribute
+ */
+ protected ExcludeDirective createExcludeDirective( Configuration config )
+ throws ConfigurationException
+ {
+ return new ExcludeDirective( getExcludeValue( config ) );
+ }
+
private String getIncludeValue( Configuration config )
throws ConfigurationException
{
@@ -329,6 +371,12 @@
{
return config.getValue();
}
+ }
+
+ private String getExcludeValue( Configuration config )
+ throws ConfigurationException
+ {
+ return getIncludeValue( config );
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org