svn commit: r586475 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r586475 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java

doogie-3
Author: doogie
Date: Fri Oct 19 07:23:50 2007
New Revision: 586475

URL: http://svn.apache.org/viewvc?rev=586475&view=rev
Log:
Java 1.5 markup.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java?rev=586475&r1=586474&r2=586475&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ModelServiceReader.java Fri Oct 19 07:23:50 2007
@@ -64,10 +64,10 @@
     protected boolean isFromURL;
     protected URL readerURL = null;
     protected ResourceHandler handler = null;
-    protected Map modelServices = null;
+    protected Map<String, ModelService> modelServices = null;
     protected DispatchContext dctx = null;
 
-    public static Map getModelServiceMap(URL readerURL, DispatchContext dctx) {
+    public static Map<String, ModelService> getModelServiceMap(URL readerURL, DispatchContext dctx) {
         if (readerURL == null) {
             Debug.logError("Cannot add reader with a null reader URL", module);
             return null;
@@ -77,7 +77,7 @@
         return reader.getModelServices();
     }
 
-    public static Map getModelServiceMap(ResourceHandler handler, DispatchContext dctx) {
+    public static Map<String, ModelService> getModelServiceMap(ResourceHandler handler, DispatchContext dctx) {
         ModelServiceReader reader = new ModelServiceReader(handler, dctx);
         return reader.getModelServices();
     }
@@ -100,7 +100,7 @@
         getModelServices();
     }
 
-    public Map getModelServices() {
+    public Map<String, ModelService> getModelServices() {
         if (modelServices == null) { // don't want to block here
             synchronized (ModelServiceReader.class) {
                 // must check if null again as one of the blocked threads can still enter
@@ -220,10 +220,10 @@
      * @return An Service object describing the specified service of the specified descriptor file.
      */
     public ModelService getModelService(String serviceName) {
-        Map ec = getModelServices();
+        Map<String, ModelService> ec = getModelServices();
 
         if (ec != null)
-            return (ModelService) ec.get(serviceName);
+            return ec.get(serviceName);
         else
             return null;
     }
@@ -232,8 +232,8 @@
      * Creates a Iterator with the serviceName of each Service defined in the specified XML Service Descriptor file.
      * @return A Iterator of serviceName Strings
      */
-    public Iterator getServiceNamesIterator() {
-        Collection collection = getServiceNames();
+    public Iterator<String> getServiceNamesIterator() {
+        Collection<String> collection = getServiceNames();
 
         if (collection != null) {
             return collection.iterator();
@@ -246,8 +246,8 @@
      * Creates a Collection with the serviceName of each Service defined in the specified XML Service Descriptor file.
      * @return A Collection of serviceName Strings
      */
-    public Collection getServiceNames() {
-        Map ec = getModelServices();
+    public Collection<String> getServiceNames() {
+        Map<String, ModelService> ec = getModelServices();
 
         return ec.keySet();
     }
@@ -480,7 +480,7 @@
         }
         
         if (delegator != null && entityName != null) {
-            Map modelParamMap = new LinkedHashMap();
+            Map<String, ModelParam> modelParamMap = new LinkedHashMap<String, ModelParam>();
             try {            
                 ModelEntity entity = delegator.getModelEntity(entityName);
                 if (entity == null) {
@@ -516,10 +516,7 @@
                     }
                     
                     // now add in all the remaining params
-                    Set keySet = modelParamMap.keySet();
-                    Iterator setIter = keySet.iterator();
-                    while (setIter.hasNext()) {
-                        ModelParam thisParam = (ModelParam) modelParamMap.get(setIter.next());
+                    for (ModelParam thisParam: modelParamMap.values()) {
                         //Debug.logInfo("Adding Param to " + service.name + ": " + thisParam.name + " [" + thisParam.mode + "] " + thisParam.type + " (" + thisParam.optional + ")", module);                      
                         service.addParam(thisParam);
                     }