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/19 16:27:46 UTC

svn commit: r586479 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service: DispatchContext.java config/ServiceConfigUtil.java engine/BSFEngine.java engine/BeanShellEngine.java mail/ServiceMcaUtil.java

Author: doogie
Date: Fri Oct 19 07:27:45 2007
New Revision: 586479

URL: http://svn.apache.org/viewvc?rev=586479&view=rev
Log:
Add generics markup to code that deals with UtilCache directly.

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BSFEngine.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.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=586479&r1=586478&r2=586479&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java Fri Oct 19 07:27:45 2007
@@ -53,7 +53,7 @@
     public static final String module = DispatchContext.class.getName();
 
     protected static final String GLOBAL_KEY = "global.services";
-    protected static UtilCache modelServiceMapByDispatcher = new UtilCache("service.ModelServiceMapByDispatcher", 0, 0, false);
+    protected static UtilCache<String, Map<String, ModelService>> modelServiceMapByDispatcher = new UtilCache<String, Map<String, ModelService>>("service.ModelServiceMapByDispatcher", 0, 0, false);
 
     protected transient LocalDispatcher dispatcher;
     protected transient ClassLoader loader;
@@ -254,18 +254,18 @@
         return dispatcher.getSecurity();
     }
 
-    private Map getLocalServiceMap() {
-        Map serviceMap = (Map) modelServiceMapByDispatcher.get(name);
+    private Map<String, ModelService> getLocalServiceMap() {
+        Map<String, ModelService> serviceMap = modelServiceMapByDispatcher.get(name);
         if (serviceMap == null) {
             synchronized (this) {
-                serviceMap = (Map) modelServiceMapByDispatcher.get(name);
+                serviceMap = modelServiceMapByDispatcher.get(name);
                 if (serviceMap == null) {
                     if (this.localReaders != null) {
                         serviceMap = FastMap.newInstance();
                         Iterator urlIter = this.localReaders.iterator();
                         while (urlIter.hasNext()) {
                             URL readerURL = (URL) urlIter.next();
-                            Map readerServiceMap = ModelServiceReader.getModelServiceMap(readerURL, this);
+                            Map<String, ModelService> readerServiceMap = ModelServiceReader.getModelServiceMap(readerURL, this);
                             if (readerServiceMap != null) {
                                 serviceMap.putAll(readerServiceMap);
                             }
@@ -282,11 +282,11 @@
         return serviceMap;
     }
     
-    private Map getGlobalServiceMap() {
-        Map serviceMap = (Map) modelServiceMapByDispatcher.get(GLOBAL_KEY);
+    private Map<String, ModelService> getGlobalServiceMap() {
+        Map<String, ModelService> serviceMap = modelServiceMapByDispatcher.get(GLOBAL_KEY);
         if (serviceMap == null) {
             synchronized (this) {
-                serviceMap = (Map) modelServiceMapByDispatcher.get(GLOBAL_KEY);
+                serviceMap = modelServiceMapByDispatcher.get(GLOBAL_KEY);
                 if (serviceMap == null) {
                     serviceMap = FastMap.newInstance();
 
@@ -303,7 +303,7 @@
                         ResourceHandler handler = new MainResourceHandler(
                                 ServiceConfigUtil.SERVICE_ENGINE_XML_FILENAME, globalServicesElement);
 
-                        Map servicesMap = ModelServiceReader.getModelServiceMap(handler, this);
+                        Map<String, ModelService> servicesMap = ModelServiceReader.getModelServiceMap(handler, this);
                         if (servicesMap != null) {
                             serviceMap.putAll(servicesMap);
                         }
@@ -331,11 +331,11 @@
         return serviceMap;
     }
 
-    public Set getAllServiceNames() {
-        Set serviceNames = new TreeSet();
+    public Set<String> getAllServiceNames() {
+        Set<String> serviceNames = new TreeSet<String>();
 
-        Map globalServices = (Map) modelServiceMapByDispatcher.get(GLOBAL_KEY);
-        Map localServices = (Map) modelServiceMapByDispatcher.get(name);
+        Map<String, ModelService> globalServices = modelServiceMapByDispatcher.get(GLOBAL_KEY);
+        Map<String, ModelService> localServices = modelServiceMapByDispatcher.get(name);
         if (globalServices != null) {
             serviceNames.addAll(globalServices.keySet());
         }

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=586479&r1=586478&r2=586479&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 Fri Oct 19 07:27:45 2007
@@ -41,7 +41,7 @@
     public static final String module = ServiceConfigUtil.class.getName();
     public static final String engine = "default";
     public static final String SERVICE_ENGINE_XML_FILENAME = "serviceengine.xml";
-    protected static UtilCache notificationGroupCache = new UtilCache("service.NotificationGroups", 0, 0, false);
+    protected static UtilCache<String, Map<String, NotificationGroup>> notificationGroupCache = new UtilCache<String, Map<String, NotificationGroup>>("service.NotificationGroups", 0, 0, false);
 
     public static Element getXmlRootElement() throws GenericConfigException {
         Element root = ResourceLoader.getXmlRootElement(ServiceConfigUtil.SERVICE_ENGINE_XML_FILENAME);
@@ -128,15 +128,15 @@
     }
 
     public static NotificationGroup getNotificationGroup(String group) {
-        Map engineNotifyMap = (Map) notificationGroupCache.get(engine);
+        Map<String, NotificationGroup> engineNotifyMap = notificationGroupCache.get(engine);
         if (engineNotifyMap == null) {
             synchronized(ServiceConfigUtil.class) {
-                engineNotifyMap = (Map) notificationGroupCache.get(engine);
+                engineNotifyMap = notificationGroupCache.get(engine);
                 if (engineNotifyMap == null) {
                     readNotificationGroups();
                 }
             }
-            engineNotifyMap = (Map) notificationGroupCache.get(engine);
+            engineNotifyMap = notificationGroupCache.get(engine);
         }
         if (engineNotifyMap != null) {
            return (NotificationGroup) engineNotifyMap.get(group);

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BSFEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BSFEngine.java?rev=586479&r1=586478&r2=586479&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BSFEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BSFEngine.java Fri Oct 19 07:27:45 2007
@@ -39,7 +39,7 @@
 public class BSFEngine extends GenericAsyncEngine {
     
     public static final String module = BSFEngine.class.getName();
-    public static UtilCache scriptCache = new UtilCache("BSFScripts", 0, 0);
+    public static UtilCache<String, String> scriptCache = new UtilCache<String, String>("BSFScripts", 0, 0);
             
     public BSFEngine(ServiceDispatcher dispatcher) {
         super(dispatcher);
@@ -98,11 +98,11 @@
         }
         
         // source the script into a string
-        String script = (String) scriptCache.get(localName + "_" + location);
+        String script = scriptCache.get(localName + "_" + location);
 
         if (script == null) {
             synchronized (this) {
-                script = (String) scriptCache.get(localName + "_" + location);
+                script = scriptCache.get(localName + "_" + location);
                 if (script == null) {
                     URL scriptUrl = UtilURL.fromResource(location, cl);
 

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java?rev=586479&r1=586478&r2=586479&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java Fri Oct 19 07:27:45 2007
@@ -38,7 +38,7 @@
  */
 public final class BeanShellEngine extends GenericAsyncEngine {
 
-    public static UtilCache scriptCache = new UtilCache("BeanShellScripts", 0, 0);
+    public static UtilCache<String, String> scriptCache = new UtilCache<String, String>("BeanShellScripts", 0, 0);
 
     public BeanShellEngine(ServiceDispatcher dispatcher) {
         super(dispatcher);
@@ -82,11 +82,11 @@
         String location = this.getLocation(modelService);
 
         // source the script into a string
-        String script = (String) scriptCache.get(localName + "_" + location);
+        String script = scriptCache.get(localName + "_" + location);
 
         if (script == null) {
             synchronized (this) {
-                script = (String) scriptCache.get(localName + "_" + location);
+                script = scriptCache.get(localName + "_" + location);
                 if (script == null) {
                     URL scriptUrl = UtilURL.fromResource(location, cl);
 

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java?rev=586479&r1=586478&r2=586479&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java Fri Oct 19 07:27:45 2007
@@ -39,7 +39,7 @@
 public class ServiceMcaUtil {
 
     public static final String module = ServiceMcaUtil.class.getName();
-    public static UtilCache mcaCache = new UtilCache("service.ServiceMCAs", 0, 0, false);
+    public static UtilCache<String, ServiceMcaRule> mcaCache = new UtilCache<String, ServiceMcaRule>("service.ServiceMCAs", 0, 0, false);
 
     public static void reloadConfig() {
         mcaCache.clear();
@@ -97,7 +97,7 @@
         }
     }
 
-    public static List getServiceMcaRules() {
+    public static List<ServiceMcaRule> getServiceMcaRules() {
 	if (mcaCache.size() == 0) {
 	    readConfig();
 	}