You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2007/10/21 06:00:42 UTC

svn commit: r586852 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service: DispatchContext.java GenericDispatcher.java config/ServiceConfigUtil.java

Author: doogie
Date: Sat Oct 20 21:00:41 2007
New Revision: 586852

URL: http://svn.apache.org/viewvc?rev=586852&view=rev
Log:
Another set of java 1.5 changes.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java?rev=586852&r1=586851&r2=586852&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java Sat Oct 20 21:00:41 2007
@@ -57,8 +57,8 @@
 
     protected transient LocalDispatcher dispatcher;
     protected transient ClassLoader loader;
-    protected Collection localReaders;
-    protected Map attributes;
+    protected Collection<URL> localReaders;
+    protected Map<String, Object> attributes;
     protected String name;
 
     /** 
@@ -66,7 +66,7 @@
      * @param localReaders a collection of reader URLs
      * @param loader the classloader to use for dispatched services
      */
-    public DispatchContext(String name, Collection localReaders, ClassLoader loader, LocalDispatcher dispatcher) {
+    public DispatchContext(String name, Collection<URL> localReaders, ClassLoader loader, LocalDispatcher dispatcher) {
         this.name = name;
         this.localReaders = localReaders;
         this.loader = loader;
@@ -111,7 +111,7 @@
      * Gets the collection of readers associated with this context
      * @return Collection of reader URLs
      */
-    public Collection getReaders() {
+    public Collection<URL> getReaders() {
         return localReaders;
     }
 
@@ -262,9 +262,7 @@
                 if (serviceMap == null) {
                     if (this.localReaders != null) {
                         serviceMap = FastMap.newInstance();
-                        Iterator urlIter = this.localReaders.iterator();
-                        while (urlIter.hasNext()) {
-                            URL readerURL = (URL) urlIter.next();
+                        for (URL readerURL: this.localReaders) {
                             Map<String, ModelService> readerServiceMap = ModelServiceReader.getModelServiceMap(readerURL, this);
                             if (readerServiceMap != null) {
                                 serviceMap.putAll(readerServiceMap);

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java?rev=586852&r1=586851&r2=586852&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/GenericDispatcher.java Sat Oct 20 21:00:41 2007
@@ -33,7 +33,7 @@
 
     public static final String module = GenericDispatcher.class.getName();
     
-    protected static Map dispatcherCache = FastMap.newInstance();
+    protected static Map<String, LocalDispatcher> dispatcherCache = FastMap.newInstance();
     
     public static LocalDispatcher getLocalDispatcher(String dispatcherName, GenericDelegator delegator) {
         return getLocalDispatcher(dispatcherName, delegator, null, null);
@@ -48,12 +48,12 @@
             dispatcherName = "default";
             Debug.logWarning("Got a getGenericDelegator call with a null dispatcherName, assuming default for the name.", module);
         }
-        LocalDispatcher dispatcher = (LocalDispatcher) dispatcherCache.get(dispatcherName);
+        LocalDispatcher dispatcher = dispatcherCache.get(dispatcherName);
 
         if (dispatcher == null) {
             synchronized (GenericDelegator.class) {
                 // must check if null again as one of the blocked threads can still enter
-                dispatcher = (GenericDispatcher) dispatcherCache.get(dispatcherName);
+                dispatcher = dispatcherCache.get(dispatcherName);
                 if (dispatcher == null) {
                     if (Debug.infoOn()) Debug.logInfo("Creating new dispatcher [" + dispatcherName + "] (" + Thread.currentThread().getName() + ")", module);
                     //Debug.logInfo(new Exception(), "Showing stack where new dispatcher is being created...", module);

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java?rev=586852&r1=586851&r2=586852&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java Sat Oct 20 21:00:41 2007
@@ -70,8 +70,8 @@
         return getElementAttr("thread-pool", "send-to-pool");        
     }
     
-    public static List getRunPools() {
-        List readPools = null;
+    public static List<String> getRunPools() {
+        List<String> readPools = null;
         
         Element threadPool = getElement("thread-pool");
         List<? extends Element> readPoolElements = UtilXml.childElementList(threadPool, "run-from-pool");
@@ -117,7 +117,7 @@
             Debug.logError(e, "Error getting Service Engine XML root element", module);
         }
 
-        FastMap engineNotifyMap = FastMap.newInstance();
+        FastMap<String, NotificationGroup> engineNotifyMap = FastMap.newInstance();
 
         for (Element e: UtilXml.childElementList(rootElement, "notification-group")) {
             NotificationGroup ng = new NotificationGroup(e);
@@ -139,7 +139,7 @@
             engineNotifyMap = notificationGroupCache.get(engine);
         }
         if (engineNotifyMap != null) {
-           return (NotificationGroup) engineNotifyMap.get(group);
+           return engineNotifyMap.get(group);
         }
 
         return null;
@@ -147,7 +147,7 @@
         
     public static class NotificationGroup implements Serializable {
         protected Notification notification;
-        protected List notify;
+        protected List<Notify> notify;
         protected String name;
 
         protected NotificationGroup(Element e) {
@@ -168,7 +168,7 @@
             return notification;
         }
 
-        public List getNotify() {
+        public List<Notify> getNotify() {
             return notify;
         }
 
@@ -184,11 +184,9 @@
             return notification.getScreen();
         }
 
-        public List getAddress(String type) {
-            List l = FastList.newInstance();
-            Iterator i = notify.iterator();
-            while (i.hasNext()) {
-                Notify n = (Notify) i.next();
+        public List<String> getAddress(String type) {
+            List<String> l = FastList.newInstance();
+            for (Notify n: notify) {
                 if (n.getType().equals(type)) {
                     l.add(n.getValue());
                 }