Index: src/java/org/apache/maven/project/ArtifactType.java =================================================================== RCS file: /home/cvspublic/maven/src/java/org/apache/maven/project/ArtifactType.java,v retrieving revision 1.5 diff -u -r1.5 ArtifactType.java --- src/java/org/apache/maven/project/ArtifactType.java 21 Sep 2003 21:22:52 -0000 1.5 +++ src/java/org/apache/maven/project/ArtifactType.java 8 Dec 2003 20:21:58 -0000 @@ -65,12 +65,33 @@ */ public class ArtifactType { + + /* + * John Casey, 2003-12-08 + * ------------------------------------------------------------------------ + * NOTE: To add build-in types (constants) to this class, simply create the + * new constant entry below, then add it to the TYPES array specification. + * The findType() method will search this array for matches, and will pickup + * the new type automatically. + * ------------------------------------------------------------------------ + */ + + /** + * Plain old jar mapping. + */ + public static final ArtifactType JAR = new ArtifactType("jar", "jar"); + /** * EJB artifact mapping. */ public static final ArtifactType EJB = new ArtifactType("ejb", "jar"); /** + * Reusable EJB client mapping. + */ + public static final ArtifactType EJB_CLIENT = new ArtifactType("ejb-client", "client.jar"); + + /** * Plugin artifact mapping. */ public static final ArtifactType PLUGIN = new ArtifactType("plugin", "jar"); @@ -81,6 +102,14 @@ public static final ArtifactType ASPECT = new ArtifactType("aspect", "jar"); /** + * Array of artifact types for searching. + */ + private static final ArtifactType[] TYPES = + { + JAR, EJB, EJB_CLIENT, PLUGIN, ASPECT + }; + + /** * Artifact type. */ private String type; @@ -124,28 +153,23 @@ */ public static ArtifactType findType(String type) { - ArtifactType result; + ArtifactType result = null; - if (type == null) - { - result = null; - } - else if (type.equalsIgnoreCase("ejb")) - { - result = EJB; - } - else if (type.equalsIgnoreCase("plugin")) - { - result = PLUGIN; - } - else if (type.equalsIgnoreCase("aspect")) + if (type != null) { - result = ASPECT; + for (int i = 0; i < TYPES.length; i++) { + ArtifactType toCheck = TYPES[i]; + if(toCheck.getType().equalsIgnoreCase(type)){ + result = toCheck; + } + } } - else + + if(result == null) { result = new ArtifactType(type, type); } + return result; } } Index: src/java/org/apache/maven/project/Dependency.java =================================================================== RCS file: /home/cvspublic/maven/src/java/org/apache/maven/project/Dependency.java,v retrieving revision 1.42 diff -u -r1.42 Dependency.java --- src/java/org/apache/maven/project/Dependency.java 17 Oct 2003 05:58:03 -0000 1.42 +++ src/java/org/apache/maven/project/Dependency.java 8 Dec 2003 20:21:58 -0000 @@ -364,7 +364,10 @@ if (type != null) { String artifactType = type.getType(); - return artifactType.equals("jar") || artifactType.equalsIgnoreCase("ejb"); + + return ArtifactType.JAR.getType().equalsIgnoreCase(artifactType) || + ArtifactType.EJB.getType().equalsIgnoreCase(artifactType) || + ArtifactType.EJB_CLIENT.getType().equalsIgnoreCase(artifactType); } return false; }