svn commit: r628698 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service: DispatchContext.java ServiceDispatcher.java eca/ServiceEcaUtil.java

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

svn commit: r628698 - in /ofbiz/trunk/framework/service/src/org/ofbiz/service: DispatchContext.java ServiceDispatcher.java eca/ServiceEcaUtil.java

jonesde
Author: jonesde
Date: Mon Feb 18 04:16:11 2008
New Revision: 628698

URL: http://svn.apache.org/viewvc?rev=628698&view=rev
Log:
Small change to use List instead of Collection for ECA rule lists in the generic cached Map

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.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=628698&r1=628697&r2=628698&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/DispatchContext.java Mon Feb 18 04:16:11 2008
@@ -53,7 +53,7 @@
     public static final String module = DispatchContext.class.getName();
 
     protected static final String GLOBAL_KEY = "global.services";
-    protected static UtilCache<String, Map<String, ModelService>> modelServiceMapByDispatcher = new UtilCache<String, Map<String, ModelService>>("service.ModelServiceMapByDispatcher", 0, 0, false);
+    public 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;

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=628698&r1=628697&r2=628698&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Mon Feb 18 04:16:11 2008
@@ -261,7 +261,7 @@
         RunningService rs = this.logService(localName, modelService, GenericEngine.SYNC_MODE);
 
         // get eventMap once for all calls for speed, don't do event calls if it is null
-        Map<String, Collection<ServiceEcaRule>> eventMap = ServiceEcaUtil.getServiceEventMap(modelService.name);
+        Map<String, List<ServiceEcaRule>> eventMap = ServiceEcaUtil.getServiceEventMap(modelService.name);
 
         // check the locale
         Locale locale = this.checkLocale(context);
@@ -641,7 +641,7 @@
 
             try {
                 // get eventMap once for all calls for speed, don't do event calls if it is null
-                Map<String, Collection<ServiceEcaRule>> eventMap = ServiceEcaUtil.getServiceEventMap(service.name);
+                Map<String, List<ServiceEcaRule>> eventMap = ServiceEcaUtil.getServiceEventMap(service.name);
 
                 // pre-auth ECA
                 if (eventMap != null) ServiceEcaUtil.evalRules(service.name, eventMap, "auth", ctx, context, result, isError, isFailure);

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java?rev=628698&r1=628697&r2=628698&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaUtil.java Mon Feb 18 04:16:11 2008
@@ -50,7 +50,7 @@
     public static final String module = ServiceEcaUtil.class.getName();
 
     // using a cache is dangerous here because if someone clears it the ECAs won't run: public static UtilCache ecaCache = new UtilCache("service.ServiceECAs", 0, 0, false);
-    public static Map<String, Map<String, Collection<ServiceEcaRule>>> ecaCache = FastMap.newInstance();
+    public static Map<String, Map<String, List<ServiceEcaRule>>> ecaCache = FastMap.newInstance();
 
     public static void reloadConfig() {
         ecaCache.clear();
@@ -90,18 +90,18 @@
         for (Element e: UtilXml.childElementList(rootElement, "eca")) {
             String serviceName = e.getAttribute("service");
             String eventName = e.getAttribute("event");
-            Map<String, Collection<ServiceEcaRule>> eventMap = ecaCache.get(serviceName);
-            Collection<ServiceEcaRule> rules = null;
+            Map<String, List<ServiceEcaRule>> eventMap = ecaCache.get(serviceName);
+            List<ServiceEcaRule> rules = null;
 
             if (eventMap == null) {
                 eventMap = FastMap.newInstance();
-                rules = new LinkedList<ServiceEcaRule>();
+                rules = FastList.newInstance();
                 ecaCache.put(serviceName, eventMap);
                 eventMap.put(eventName, rules);
             } else {
                 rules = eventMap.get(eventName);
                 if (rules == null) {
-                    rules = new LinkedList<ServiceEcaRule>();
+                    rules = FastList.newInstance();
                     eventMap.put(eventName, rules);
                 }
             }
@@ -119,13 +119,13 @@
         }
     }
 
-    public static Map<String, Collection<ServiceEcaRule>> getServiceEventMap(String serviceName) {
+    public static Map<String, List<ServiceEcaRule>> getServiceEventMap(String serviceName) {
         if (ServiceEcaUtil.ecaCache == null) ServiceEcaUtil.readConfig();
         return ServiceEcaUtil.ecaCache.get(serviceName);
     }
 
-    public static Collection<ServiceEcaRule> getServiceEventRules(String serviceName, String event) {
-        Map<String, Collection<ServiceEcaRule>> eventMap = getServiceEventMap(serviceName);
+    public static List<ServiceEcaRule> getServiceEventRules(String serviceName, String event) {
+        Map<String, List<ServiceEcaRule>> eventMap = getServiceEventMap(serviceName);
         if (eventMap != null) {
             if (event != null) {
                 return eventMap.get(event);
@@ -140,7 +140,7 @@
         return null;
     }
 
-    public static void evalRules(String serviceName, Map<String, Collection<ServiceEcaRule>> eventMap, String event, DispatchContext dctx, Map<String, Object> context, Map<String, Object> result, boolean isError, boolean isFailure) throws GenericServiceException {
+    public static void evalRules(String serviceName, Map<String, List<ServiceEcaRule>> eventMap, String event, DispatchContext dctx, Map<String, Object> context, Map<String, Object> result, boolean isError, boolean isFailure) throws GenericServiceException {
         // if the eventMap is passed we save a Map lookup, but if not that's okay we'll just look it up now
         if (eventMap == null) eventMap = getServiceEventMap(serviceName);
         if (eventMap == null || eventMap.size() == 0) {