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 36495 - in incubator/depot/trunk/version/src: java/org/apache/depot/version/impl java/org/apache/depot/version/specification test/java/org/apache/depot/version/impl
Date Tue, 17 Aug 2004 06:23:05 GMT
Author: nickchalko
Date: Mon Aug 16 23:23:04 2004
New Revision: 36495

Modified:
   incubator/depot/trunk/version/src/java/org/apache/depot/version/impl/VersionImporter.java
   incubator/depot/trunk/version/src/java/org/apache/depot/version/specification/VersionSpecificationFactory.java
   incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ApacheVersionSpecTest.java
Log:
Retugn a collection not a iterator.

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
Mon Aug 16 23:23:04 2004
@@ -154,7 +154,7 @@
 		//
 		if (null == version)
 			for (Iterator i =
-				VersionSpecificationFactory.getRegisteredSpecificationIds();
+				VersionSpecificationFactory.getRegisteredSpecificationIds().iterator();
 				i.hasNext() && (null == version);
 				) {
 				String specId = (String) i.next();

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
Mon Aug 16 23:23:04 2004
@@ -17,10 +17,12 @@
 package org.apache.depot.version.specification;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.depot.version.VersionException;
 import org.apache.depot.version.impl.VersionImplementationConstants;
@@ -33,13 +35,14 @@
 
 	private final static VersionSpecificationFactory INSTANCE = new VersionSpecificationFactory();
 
-	private static List l_order = null;
-	private static Map l_registry = null;
+	private static List orderList = null;
+
+	private static Map registryMap = null;
 
 	static {
 
-		l_order = new ArrayList(); 
-		l_registry = new HashMap();
+		orderList = new ArrayList();
+		registryMap = new HashMap();
 
 		registerVersionSpecification(
 				VersionImplementationConstants.DATETIMESTAMPED_VERSION_ID,
@@ -71,9 +74,9 @@
 		// allow users to register...
 		VersionSpecification specification = null;
 
-		synchronized (l_registry) {
+		synchronized (registryMap) {
 
-			Class registeredClass = (Class) l_registry.get(identifier);
+			Class registeredClass = (Class) registryMap.get(identifier);
 
 			if (null != registeredClass) {
 				try {
@@ -97,18 +100,19 @@
 	}
 
 	public static void registerVersionSpecification(String id, Class formatClass) {
-		synchronized (l_registry) {
-			if ( !l_registry.containsKey(id))
-				l_order.add(id);
-			l_registry.put(id, formatClass);
+		synchronized (registryMap) {
+			if (!registryMap.containsKey(id))
+				orderList.add(id);
+			registryMap.put(id, formatClass);
 		}
 	}
 
-	public static Iterator getRegisteredSpecificationIds() {
-		return l_order.iterator();
+	public static List getRegisteredSpecificationIds() {
+		return Collections.unmodifiableList(orderList);
 	}
+	
 
-	public static Iterator getRegisteredSpecifications() {
-		return l_registry.entrySet().iterator();
+	public static Set getRegisteredSpecifications() {
+		return Collections.unmodifiableSet(registryMap.entrySet());
 	}
 }

Modified: incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ApacheVersionSpecTest.java
==============================================================================
--- incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ApacheVersionSpecTest.java
(original)
+++ incubator/depot/trunk/version/src/test/java/org/apache/depot/version/impl/ApacheVersionSpecTest.java
Mon Aug 16 23:23:04 2004
@@ -51,7 +51,7 @@
     	int count = 0;
     
     	for (Iterator i =
-			VersionSpecificationFactory.getRegisteredSpecificationIds();
+			VersionSpecificationFactory.getRegisteredSpecificationIds().iterator();
 			i.hasNext();
 			) {    	
     		VersionSpecification spec = VersionSpecificationFactory.createVersionSpecificationFromId((String)i.next());

Mime
View raw message