incubator-depot-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickcha...@apache.org
Subject svn commit: rev 31029 - in incubator/depot/trunk/version/src: java/org/apache/depot/version java/org/apache/depot/version/experimental/sample java/org/apache/depot/version/impl java/org/apache/depot/version/specification java/org/apache/depot/version/specification/experimental test/java/org/apache/depot/version/impl
Date Sat, 31 Jul 2004 08:46:49 GMT
Author: nickchalko
Date: Sat Jul 31 01:46:49 2004
New Revision: 31029

Modified:
   incubator/depot/trunk/version/src/java/org/apache/depot/version/VersionManager.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/experimental/sample/Overview.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/VersionImporter.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/ApacheVersionSpecification.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/DatetimestampedVersionSpecification.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/EclipseVersionSpecification.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/JavasoftVersionSpecification.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/VersionSpecification.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/VersionSpecificationFactory.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/experimental/JakartaCommonsVersionSpecification.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/experimental/MavenVersionSpecification.java
   incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ImporterTests.java
   incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/VersionImporterTests.java
Log:
Droped some overkill static methods.
Added start of creatinga  VersionMarker from a generated version class.

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/VersionManager.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/VersionManager.java	(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/VersionManager.java	Sat
Jul 31 01:46:49 2004
@@ -16,8 +16,11 @@
 
 package org.apache.depot.version;
 
+import java.util.Map;
+
 import org.apache.depot.version.impl.ApacheVersion;
 import org.apache.depot.version.impl.ApacheVersionMarker;
+import org.apache.depot.version.impl.VersionIdentifier;
 import org.apache.depot.version.impl.data.VersionData;
 import org.apache.depot.version.specification.VersionSpecification;
 import org.apache.depot.version.specification.VersionSpecificationFactory;
@@ -32,12 +35,88 @@
 		return new VersionManager();
 	}
 
+	/**
+	 * Create a version marker from and ID and a version string.
+	 * 
+	 * @param id
+	 *            The id of the versioned artifact
+	 * @param version
+	 *            as a String
+	 * @return a VersinMarker object.
+	 * @throws VersionException
+	 */
 	public final VersionMarker createVersionMarker(String id, String version)
 			throws VersionException {
 		return new ApacheVersionMarker(id, version);
 	}
 
 	/**
+	 * Create a VersionMarker from an arbitrary object. Usually a generated
+	 * version stamp.
+	 * 
+	 * @param stamp
+	 *            A instance if a version stamp.
+	 * @return VersionMarker of the correct spec with all values filled in.
+	 */
+	VersionMarker createVersionMarker(Object stamp) {
+
+		try {
+			String specId = getSpecificationId(stamp);
+			String versionString = getVersionString(stamp);
+			VersionIdentifier id = VersionIdentifier
+					.extractVersionIdentifier(stamp);
+			Map properties = getProperties(stamp);
+			VersionSpecification spec = VersionSpecificationFactory
+					.createVersionSpecificationFromId(specId);
+
+			final VersionMarker marker = spec.createVersionMarker(
+					new VersionIdentifier(id), versionString, properties);
+
+			return marker;
+
+		} catch (VersionException e) {
+			return VersionMarker.UNKNOWN;
+		}
+
+	}
+
+	/**
+	 * @param stamp
+	 * @return
+	 */
+	private Map getProperties(Object stamp) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
+	 * @param stamp
+	 * @return
+	 */
+	private String getStampId(Object stamp) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
+	 * @param stamp
+	 * @return
+	 */
+	private String getVersionString(Object stamp) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
+	 * @param stamp
+	 * @return
+	 */
+	private String getSpecificationId(Object stamp) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/**
 	 * Create a Version object from the given string.
 	 * 
 	 * @param versionString
@@ -46,7 +125,8 @@
 	 */
 	public Version createVersion(String versionString)
 			throws VersionFormatException {
-		VersionSpecification spec = VersionSpecificationFactory.createDefaultVersionSpecification();
+		VersionSpecification spec = VersionSpecificationFactory
+				.createDefaultVersionSpecification();
 		VersionData data = spec.getVersionFormat().parseVersion(versionString);
 
 		return new ApacheVersion(spec, data);

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/experimental/sample/Overview.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/experimental/sample/Overview.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/experimental/sample/Overview.java
Sat Jul 31 01:46:49 2004
@@ -26,8 +26,11 @@
 import org.apache.depot.version.impl.data.VersionDataElement;
 import org.apache.depot.version.impl.data.util.VersionDataIncrementor;
 import org.apache.depot.version.impl.data.util.VersionDataRangeIterator;
+import org.apache.depot.version.specification.ApacheVersionSpecification;
+import org.apache.depot.version.specification.JavasoftVersionSpecification;
 import org.apache.depot.version.specification.VersionSpecification;
 import org.apache.depot.version.specification.VersionSpecificationFactory;
+import org.apache.depot.version.specification.experimental.JakartaCommonsVersionSpecification;
 
 /**
  * @author ajack
@@ -136,12 +139,11 @@
 		presentSection("Version Specifications");
 
 		VersionSpecification kf =
-			VersionSpecificationFactory.createApacheVersionSpecification();
+			new ApacheVersionSpecification();
 		VersionSpecification jf =
-			VersionSpecificationFactory.createJavasoftVersionSpecification();
+			new JavasoftVersionSpecification();
 		VersionSpecification cf =
-			VersionSpecificationFactory
-				.createJakartaCommonsVersionSpecification();
+			new JakartaCommonsVersionSpecification();
 		VersionSpecification df =
 			VersionSpecificationFactory.createDefaultVersionSpecification();
 

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/ApacheVersion.java
Sat Jul 31 01:46:49 2004
@@ -35,6 +35,8 @@
 import org.apache.depot.version.impl.data.VersionDataElement;
 import org.apache.depot.version.impl.data.VersionDataElementSet;
 import org.apache.depot.version.impl.data.util.VersionDataIncrementor;
+import org.apache.depot.version.specification.ApacheVersionSpecification;
+import org.apache.depot.version.specification.DatetimestampedVersionSpecification;
 import org.apache.depot.version.specification.VersionSpecification;
 import org.apache.depot.version.specification.VersionSpecificationFactory;
 import org.apache.depot.version.specification.formatting.VersionFormatException;
@@ -50,7 +52,7 @@
 	public final static String VERSION_TAG = "version";
 	
 	public final static ApacheVersion UNKNOWN =
-		new ApacheVersion(VersionSpecificationFactory.createApacheVersionSpecification(),
+		new ApacheVersion(new ApacheVersionSpecification(),
 							VersionData.UNSET);
 	
 	/** The specification for this type of format */
@@ -180,7 +182,7 @@
 		super();
 
 		m_specification =
-			VersionSpecificationFactory.createDatetimestampedVersionSpecification();
+			new DatetimestampedVersionSpecification();
 		m_data = new VersionData(date);
 	}
 

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/VersionImporter.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/VersionImporter.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/VersionImporter.java
Sat Jul 31 01:46:49 2004
@@ -25,6 +25,7 @@
 import org.apache.depot.version.VersionException;
 import org.apache.depot.version.VersionMarker;
 import org.apache.depot.version.impl.data.VersionData;
+import org.apache.depot.version.specification.DatetimestampedVersionSpecification;
 import org.apache.depot.version.specification.VersionSpecification;
 import org.apache.depot.version.specification.VersionSpecificationFactory;
 import org.apache.depot.version.specification.formatting.VersionFormat;
@@ -153,7 +154,7 @@
 		//  Favour our Datetimestamped specification
 		//
 		VersionSpecification datetimeSpecification =
-			VersionSpecificationFactory.createDatetimestampedVersionSpecification();
+			new DatetimestampedVersionSpecification();
 
 		try {
 			VersionFormat format = datetimeSpecification.getVersionFormat();

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/ApacheVersionSpecification.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/ApacheVersionSpecification.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/ApacheVersionSpecification.java
Sat Jul 31 01:46:49 2004
@@ -16,46 +16,63 @@
 
 package org.apache.depot.version.specification;
 
+import java.util.Map;
+
+import org.apache.depot.version.VersionException;
+import org.apache.depot.version.VersionMarker;
+import org.apache.depot.version.impl.ApacheVersionMarker;
+import org.apache.depot.version.impl.VersionIdentifier;
 import org.apache.depot.version.impl.VersionImplementationConstants;
 import org.apache.depot.version.impl.data.VersionDataElementSet;
 import org.apache.depot.version.specification.formatting.VersionFormat;
 import org.apache.depot.version.specification.formatting.format.ApacheVersionFormat;
 
 /**
- *
+ * 
  * @author $Author: arb_jack $
  * @version $Revision: 1.2 $
- * 
+ *  
  */
 public class ApacheVersionSpecification extends VersionSpecificationImpl {
-	
-	
-    /**
-     * @see org.apache.depot.version.specification.VersionSpecification#getId()
-     */
-    public String getId() {
-        return VersionImplementationConstants.VERSION_PACKAGE;
-    }
-
-    /**
-     * @see org.apache.depot.version.specification.VersionSpecification#getDescription()
-     */
-    public String getDescription() {
-        return "Apache Version Default Specification";
-    }
-
-    /**
-     * @see org.apache.depot.version.specification.VersionSpecification#getElementMask()
-     */
-    public int getElementMask() {
-        return VersionDataElementSet.DEFAULT.getElementMask();
-    }
-
-    /**
-     * @see org.apache.depot.version.specification.VersionSpecification#getVersionFormat()
-     */
-    public VersionFormat getVersionFormat() {
-        return new ApacheVersionFormat();
-    }
 
-}
+	/**
+	 * @see org.apache.depot.version.specification.VersionSpecification#getId()
+	 */
+	public String getId() {
+		return VersionImplementationConstants.VERSION_PACKAGE;
+	}
+
+	/**
+	 * @see org.apache.depot.version.specification.VersionSpecification#getDescription()
+	 */
+	public String getDescription() {
+		return "Apache Version Default Specification";
+	}
+
+	/**
+	 * @see org.apache.depot.version.specification.VersionSpecification#getElementMask()
+	 */
+	public int getElementMask() {
+		return VersionDataElementSet.DEFAULT.getElementMask();
+	}
+
+	/**
+	 * @see org.apache.depot.version.specification.VersionSpecification#getVersionFormat()
+	 */
+	public VersionFormat getVersionFormat() {
+		return new ApacheVersionFormat();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.depot.version.specification.VersionSpecification#createVersionMarker(java.lang.String,
+	 *      java.lang.String)
+	 */
+	public VersionMarker createVersionMarker(VersionIdentifier id,
+			String versionString, Map properties) throws VersionException {
+
+		return new ApacheVersionMarker(id.getKey(), versionString,properties);
+	}
+
+}
\ No newline at end of file

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/DatetimestampedVersionSpecification.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/DatetimestampedVersionSpecification.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/DatetimestampedVersionSpecification.java
Sat Jul 31 01:46:49 2004
@@ -16,6 +16,11 @@
 
 package org.apache.depot.version.specification;
 
+import java.util.Map;
+
+import org.apache.depot.version.VersionException;
+import org.apache.depot.version.VersionMarker;
+import org.apache.depot.version.impl.VersionIdentifier;
 import org.apache.depot.version.impl.VersionImplementationConstants;
 import org.apache.depot.version.impl.data.VersionDataElement;
 import org.apache.depot.version.specification.formatting.VersionFormat;
@@ -56,4 +61,12 @@
     public VersionFormat getVersionFormat() {
         return new DatetimestampedVersionFormat();
     }
+
+	/* (non-Javadoc)
+	 * @see org.apache.depot.version.specification.VersionSpecification#createVersionMarker(org.apache.depot.version.impl.VersionIdentifier,
java.lang.String, java.util.Map)
+	 */
+	public VersionMarker createVersionMarker(VersionIdentifier id, String versionString, Map
properties) throws VersionException {
+		// TODO Auto-generated method stub
+		return null;
+	}
 }

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/EclipseVersionSpecification.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/EclipseVersionSpecification.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/EclipseVersionSpecification.java
Sat Jul 31 01:46:49 2004
@@ -16,6 +16,11 @@
 
 package org.apache.depot.version.specification;
 
+import java.util.Map;
+
+import org.apache.depot.version.VersionException;
+import org.apache.depot.version.VersionMarker;
+import org.apache.depot.version.impl.VersionIdentifier;
 import org.apache.depot.version.impl.VersionImplementationConstants;
 import org.apache.depot.version.impl.data.VersionDataElement;
 import org.apache.depot.version.specification.formatting.VersionFormat;
@@ -59,5 +64,13 @@
     public VersionFormat getVersionFormat() {
         return new EclipseVersionFormat();
     }
+
+	/* (non-Javadoc)
+	 * @see org.apache.depot.version.specification.VersionSpecification#createVersionMarker(org.apache.depot.version.impl.VersionIdentifier,
java.lang.String, java.util.Map)
+	 */
+	public VersionMarker createVersionMarker(VersionIdentifier id, String versionString, Map
properties) throws VersionException {
+		// TODO Auto-generated method stub
+		return null;
+	}
 
 }

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/JavasoftVersionSpecification.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/JavasoftVersionSpecification.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/JavasoftVersionSpecification.java
Sat Jul 31 01:46:49 2004
@@ -16,6 +16,11 @@
 
 package org.apache.depot.version.specification;
 
+import java.util.Map;
+
+import org.apache.depot.version.VersionException;
+import org.apache.depot.version.VersionMarker;
+import org.apache.depot.version.impl.VersionIdentifier;
 import org.apache.depot.version.impl.VersionImplementationConstants;
 import org.apache.depot.version.impl.data.VersionDataElementSet;
 import org.apache.depot.version.specification.formatting.VersionFormat;
@@ -56,5 +61,13 @@
     public VersionFormat getVersionFormat() {
         return new JavasoftVersionFormat();
     }
+
+	/* (non-Javadoc)
+	 * @see org.apache.depot.version.specification.VersionSpecification#createVersionMarker(org.apache.depot.version.impl.VersionIdentifier,
java.lang.String, java.util.Map)
+	 */
+	public VersionMarker createVersionMarker(VersionIdentifier id, String versionString, Map
properties) throws VersionException {
+		// TODO Auto-generated method stub
+		return null;
+	}
 
 }

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/VersionSpecification.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/VersionSpecification.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/VersionSpecification.java
Sat Jul 31 01:46:49 2004
@@ -16,7 +16,12 @@
 
 package org.apache.depot.version.specification;
 
+import java.util.Map;
+
 import org.apache.depot.common.util.debug.Dumpable;
+import org.apache.depot.version.VersionException;
+import org.apache.depot.version.VersionMarker;
+import org.apache.depot.version.impl.VersionIdentifier;
 import org.apache.depot.version.specification.formatting.VersionFormat;
 
 /**
@@ -49,4 +54,11 @@
 
     // Serialized Format
     VersionFormat getVersionFormat();
+	/**
+	 * @param id
+	 * @param versionString
+	 * @return
+	 * @throws VersionException
+	 */
+	VersionMarker createVersionMarker(VersionIdentifier id, String versionString, Map properties)
throws VersionException;
 }

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/VersionSpecificationFactory.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/VersionSpecificationFactory.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/VersionSpecificationFactory.java
Sat Jul 31 01:46:49 2004
@@ -30,119 +30,94 @@
  */
 public class VersionSpecificationFactory {
 
-    private static Map l_registry = null;
+	private final static VersionSpecificationFactory INSTANCE = new VersionSpecificationFactory();
 
-    static {
+	private static Map l_registry = null;
 
-        l_registry = new HashMap();
+	static {
 
-        registerVersionSpecification(
-            VersionImplementationConstants.DATETIMESTAMPED_VERSION_ID,
-            DatetimestampedVersionSpecification.class);
-        registerVersionSpecification(
-            VersionImplementationConstants.APACHE_VERSION_ID,
-            ApacheVersionSpecification.class);
-        registerVersionSpecification(
-            VersionImplementationConstants.ECLIPSE_VERSION_ID,
-            EclipseVersionSpecification.class);
-        registerVersionSpecification(
-            VersionImplementationConstants.JAVASOFT_VERSION_ID,
-            JavasoftVersionSpecification.class);
-        registerVersionSpecification(
-            VersionImplementationConstants.JAKARTA_COMMONS_VERSION_ID,
-            JakartaCommonsVersionSpecification.class);
-        registerVersionSpecification(
-            VersionImplementationConstants.MAVEN_VERSION_ID,
-            MavenVersionSpecification.class);
-
-    }
-
-    public static VersionSpecification createEclipseVersionSpecification() {
-        return new EclipseVersionSpecification();
-    }
-
-    public static VersionSpecification createMavenVersionSpecification() {
-        return new MavenVersionSpecification();
-    }
-
-    public static VersionSpecification createJavasoftVersionSpecification() {
-        return new JavasoftVersionSpecification();
-    }
-
-    public static VersionSpecification createApacheVersionSpecification() {
-        return new ApacheVersionSpecification();
-    }
-
-    public static VersionSpecification createDatetimestampedVersionSpecification() {
-        return new DatetimestampedVersionSpecification();
-    }
-
-    public static VersionSpecification createJakartaCommonsVersionSpecification() {
-        return new JakartaCommonsVersionSpecification();
-    }
-
-    /** Default */
-    public static VersionSpecification createDefaultVersionSpecification() {
-        return new ApacheVersionSpecification();
-    }
-    /** Named */
-    public static VersionSpecification createVersionSpecificationFromId(final String identifier)
-        throws VersionException {
-        //:TODO: Implement..
-        // Register existing formats by ID
-        // allow users to register...
-        VersionSpecification specification = null;
-
-        synchronized (l_registry) {
-
-            Class registeredClass = (Class) l_registry.get(identifier);
-
-            if (null != registeredClass) {
-                try {
-                    Object formatInst = registeredClass.newInstance();
+		l_registry = new HashMap();
+
+		registerVersionSpecification(
+				VersionImplementationConstants.DATETIMESTAMPED_VERSION_ID,
+				DatetimestampedVersionSpecification.class);
+		registerVersionSpecification(
+				VersionImplementationConstants.APACHE_VERSION_ID,
+				ApacheVersionSpecification.class);
+		registerVersionSpecification(
+				VersionImplementationConstants.ECLIPSE_VERSION_ID,
+				EclipseVersionSpecification.class);
+		registerVersionSpecification(
+				VersionImplementationConstants.JAVASOFT_VERSION_ID,
+				JavasoftVersionSpecification.class);
+		registerVersionSpecification(
+				VersionImplementationConstants.JAKARTA_COMMONS_VERSION_ID,
+				JakartaCommonsVersionSpecification.class);
+		registerVersionSpecification(
+				VersionImplementationConstants.MAVEN_VERSION_ID,
+				MavenVersionSpecification.class);
+
+	}
+
+
+	/** Default */
+	public static VersionSpecification createDefaultVersionSpecification() {
+		return new ApacheVersionSpecification();
+	}
+
+	/** Named */
+	public static VersionSpecification createVersionSpecificationFromId(
+			final String identifier) throws VersionException {
+		//:TODO: Implement..
+		// Register existing formats by ID
+		// allow users to register...
+		VersionSpecification specification = null;
+
+		synchronized (l_registry) {
+
+			Class registeredClass = (Class) l_registry.get(identifier);
+
+			if (null != registeredClass) {
+				try {
+					Object formatInst = registeredClass.newInstance();
 
 					specification = (VersionSpecification) formatInst;
-                }
-                catch (Exception e) {
-                    throw new VersionException(
-                        "Failed to instantiate registered format for identifier ["
-                            + identifier
-                            + "]",
-                        e);
-                }
-            }
-            else {
-                //:TODO: Be helpful, show them what you do have...
-                throw new VersionException(
-                    "No registered format for identifier [" + identifier + "]");
-            }
-        }
-
-        return specification;
-    }
-
-    public static void registerVersionSpecification(
-        String id,
-        Class formatClass) {
-        synchronized (l_registry) {
-            l_registry.put(id, formatClass);
-        }
-    }
-
-    public static Iterator getRegisteredSpecificationIds() {
-        return l_registry.keySet().iterator();
-    }
-
-    public static Iterator getRegisteredSpecifications() {
-        return l_registry.entrySet().iterator();
-    }
+				} catch (Exception e) {
+					throw new VersionException(
+							"Failed to instantiate registered format for identifier ["
+									+ identifier + "]", e);
+				}
+			} else {
+				//:TODO: Be helpful, show them what you do have...
+				throw new VersionException(
+						"No registered format for identifier [" + identifier
+								+ "]");
+			}
+		}
+
+		return specification;
+	}
+
+	public static void registerVersionSpecification(String id, Class formatClass) {
+		synchronized (l_registry) {
+			l_registry.put(id, formatClass);
+		}
+	}
+
+	public static Iterator getRegisteredSpecificationIds() {
+		return l_registry.keySet().iterator();
+	}
+
+	public static Iterator getRegisteredSpecifications() {
+		return l_registry.entrySet().iterator();
+	}
 
 	/**
 	 * @param specId
 	 */
-	public VersionSpecification  getSpecification(String specId) {
-		// TODO  Actually check id.
+	public VersionSpecification getSpecification(String specId) {
+		// TODO Actually check id.
 		return new ApacheVersionSpecification();
-		
+
 	}
-}
+}
\ No newline at end of file

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/experimental/JakartaCommonsVersionSpecification.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/experimental/JakartaCommonsVersionSpecification.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/experimental/JakartaCommonsVersionSpecification.java
Sat Jul 31 01:46:49 2004
@@ -16,6 +16,11 @@
 
 package org.apache.depot.version.specification.experimental;
 
+import java.util.Map;
+
+import org.apache.depot.version.VersionException;
+import org.apache.depot.version.VersionMarker;
+import org.apache.depot.version.impl.VersionIdentifier;
 import org.apache.depot.version.impl.VersionImplementationConstants;
 import org.apache.depot.version.impl.data.VersionDataElementSet;
 import org.apache.depot.version.specification.VersionSpecificationImpl;
@@ -57,5 +62,13 @@
     public VersionFormat getVersionFormat() {
         return new JakartaCommonsVersionFormat();
     }
+
+	/* (non-Javadoc)
+	 * @see org.apache.depot.version.specification.VersionSpecification#createVersionMarker(org.apache.depot.version.impl.VersionIdentifier,
java.lang.String, java.util.Map)
+	 */
+	public VersionMarker createVersionMarker(VersionIdentifier id, String versionString, Map
properties) throws VersionException {
+		// TODO Auto-generated method stub
+		return null;
+	}
 
 }

Modified: incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/experimental/MavenVersionSpecification.java
==============================================================================
--- incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/experimental/MavenVersionSpecification.java
(original)
+++ incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/experimental/MavenVersionSpecification.java
Sat Jul 31 01:46:49 2004
@@ -16,6 +16,11 @@
 
 package org.apache.depot.version.specification.experimental;
 
+import java.util.Map;
+
+import org.apache.depot.version.VersionException;
+import org.apache.depot.version.VersionMarker;
+import org.apache.depot.version.impl.VersionIdentifier;
 import org.apache.depot.version.impl.data.VersionDataElementSet;
 import org.apache.depot.version.specification.VersionSpecificationImpl;
 import org.apache.depot.version.specification.formatting.VersionFormat;
@@ -55,5 +60,13 @@
 	 */
 	public VersionFormat getVersionFormat() {
 		return new ApacheVersionFormat();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.depot.version.specification.VersionSpecification#createVersionMarker(org.apache.depot.version.impl.VersionIdentifier,
java.lang.String, java.util.Map)
+	 */
+	public VersionMarker createVersionMarker(VersionIdentifier id, String versionString, Map
properties) throws VersionException {
+		// TODO Auto-generated method stub
+		return null;
 	}
 }

Modified: incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ImporterTests.java
==============================================================================
--- incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ImporterTests.java
(original)
+++ incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ImporterTests.java
Sat Jul 31 01:46:49 2004
@@ -22,7 +22,9 @@
 
 import org.apache.depot.version.VersionException;
 import org.apache.depot.version.impl.data.VersionData;
+import org.apache.depot.version.specification.DatetimestampedVersionSpecification;
 import org.apache.depot.version.specification.VersionSpecificationFactory;
+import org.apache.depot.version.specification.formatting.format.DatetimestampedVersionFormat;
 
 /**
  *
@@ -47,8 +49,7 @@
         test(
             dated,
             new ApacheVersion(
-                VersionSpecificationFactory
-                    .createDatetimestampedVersionSpecification(),
+                new DatetimestampedVersionSpecification(),
                 new VersionData(date)));
     }
 

Modified: incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/VersionImporterTests.java
==============================================================================
--- incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/VersionImporterTests.java
(original)
+++ incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/VersionImporterTests.java
Sat Jul 31 01:46:49 2004
@@ -20,6 +20,7 @@
 
 import org.apache.depot.version.VersionException;
 import org.apache.depot.version.impl.data.ReleaseLevel;
+import org.apache.depot.version.specification.ApacheVersionSpecification;
 import org.apache.depot.version.specification.VersionSpecification;
 import org.apache.depot.version.specification.VersionSpecificationFactory;
 
@@ -27,67 +28,52 @@
  * @author ajack
  */
 public class VersionImporterTests extends TestCase {
-    public VersionImporterTests(String arg0) {
-        super(arg0);
-    }
-
-    public static void main(String[] args) {
-        junit.textui.TestRunner.run(VersionImporterTests.class);
-    }
-
-    public void testApacheFormatIsDefaulted() throws VersionException {
-
-        ApacheVersion version = importVersion("1.0");
-
-        VersionSpecification spec = version.getSpecification();
-
-        assertTrue(
-            "Apache Specification Used",
-            spec.equals(
-                VersionSpecificationFactory
-                    .createApacheVersionSpecification()));
-    }
-
-    public void testTypical() throws VersionException {
-        ApacheVersion version = importVersion("1.2.3-alpha-20030302");
-
-        assertEquals(
-            "Release Qualifier Correct",
-            ReleaseLevel.ALPHA,
-			version.getReleaseLevelObject());
-            
-        VersionSpecification spec = version.getSpecification();
-
-        assertEquals(
-            "Apache Specification Used",
-            spec,
-			VersionSpecificationFactory
-                    .createApacheVersionSpecification());
-    }
-
-    public void testReleaseQualifier() throws VersionException {
-        ApacheVersion version = importVersion("1.2.3-alpha1-20030302");
-
-        assertEquals(
-            "Release Qualifier Correct",
-            1,version.getReleaseQualifier());
-            
-        VersionSpecification spec = version.getSpecification();
-
-        assertTrue(
-            "Apache Specification Used",
-            spec.equals(
-                VersionSpecificationFactory
-                    .createApacheVersionSpecification()));
-    }
-
-    private ApacheVersion importVersion(String data)
-        throws VersionException {
-        ApacheVersion version =
-            VersionImporter.importApacheVersion(
-                data);
+	public VersionImporterTests(String arg0) {
+		super(arg0);
+	}
 
-        return version;
-    }
+	public static void main(String[] args) {
+		junit.textui.TestRunner.run(VersionImporterTests.class);
+	}
 
-}
+	public void testApacheFormatIsDefaulted() throws VersionException {
+
+		ApacheVersion version = importVersion("1.0");
+
+		VersionSpecification spec = version.getSpecification();
+
+		assertTrue("Apache Specification Used", spec
+				.equals(new ApacheVersionSpecification()));
+	}
+
+	public void testTypical() throws VersionException {
+		ApacheVersion version = importVersion("1.2.3-alpha-20030302");
+
+		assertEquals("Release Qualifier Correct", ReleaseLevel.ALPHA, version
+				.getReleaseLevelObject());
+
+		VersionSpecification spec = version.getSpecification();
+
+		assertEquals("Apache Specification Used", spec,
+				new ApacheVersionSpecification());
+	}
+
+	public void testReleaseQualifier() throws VersionException {
+		ApacheVersion version = importVersion("1.2.3-alpha1-20030302");
+
+		assertEquals("Release Qualifier Correct", 1, version
+				.getReleaseQualifier());
+
+		VersionSpecification spec = version.getSpecification();
+
+		assertTrue("Apache Specification Used", spec
+				.equals(new ApacheVersionSpecification()));
+	}
+
+	private ApacheVersion importVersion(String data) throws VersionException {
+		ApacheVersion version = VersionImporter.importApacheVersion(data);
+
+		return version;
+	}
+
+}
\ No newline at end of file

Mime
View raw message