You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by sa...@apache.org on 2012/08/07 08:26:13 UTC

svn commit: r1370126 [12/15] - in /ofbiz/branches/jackrabbit20120501: ./ applications/accounting/script/org/ofbiz/accounting/payment/ applications/accounting/src/org/ofbiz/accounting/payment/ applications/accounting/webapp/accounting/WEB-INF/ applicati...

Modified: ofbiz/branches/jackrabbit20120501/framework/start/src/org/ofbiz/base/start/test.properties
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/start/src/org/ofbiz/base/start/test.properties?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/start/src/org/ofbiz/base/start/test.properties (original)
+++ ofbiz/branches/jackrabbit20120501/framework/start/src/org/ofbiz/base/start/test.properties Tue Aug  7 06:25:59 2012
@@ -39,10 +39,11 @@
 #ofbiz.log.dir=runtime/logs
 
 # --- Location (relative to ofbiz.home) for (normal) container configuration
-ofbiz.container.config=framework/base/config/test-containers.xml
+#ofbiz.container.config=framework/base/config/ofbiz-containers.xml
 
 # --- StartupLoader implementations to load (in order)
 ofbiz.start.loader1=org.ofbiz.base.container.ContainerLoader
+ofbiz.start.loader1.loaders=test,rmi
 
 # -- Enable the shutdown hook
 #ofbiz.enable.hook=true

Modified: ofbiz/branches/jackrabbit20120501/framework/start/src/org/ofbiz/base/start/testlist.properties
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/start/src/org/ofbiz/base/start/testlist.properties?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/start/src/org/ofbiz/base/start/testlist.properties (original)
+++ ofbiz/branches/jackrabbit20120501/framework/start/src/org/ofbiz/base/start/testlist.properties Tue Aug  7 06:25:59 2012
@@ -39,10 +39,11 @@
 #ofbiz.log.dir=runtime/logs
 
 # --- Location (relative to ofbiz.home) for (normal) container configuration
-ofbiz.container.config=framework/base/config/testlist-containers.xml
+#ofbiz.container.config=framework/base/config/ofbiz-containers.xml
 
 # --- StartupLoader implementations to load (in order)
 ofbiz.start.loader1=org.ofbiz.base.container.ContainerLoader
+ofbiz.start.loader1.loaders=testlist
 
 # -- Enable the shutdown hook
 #ofbiz.enable.hook=true

Modified: ofbiz/branches/jackrabbit20120501/framework/testtools/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/testtools/ofbiz-component.xml?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/testtools/ofbiz-component.xml (original)
+++ ofbiz/branches/jackrabbit20120501/framework/testtools/ofbiz-component.xml Tue Aug  7 06:25:59 2012
@@ -33,5 +33,8 @@
     
     <!-- service resources: model(s), eca(s) and group definitions -->
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>
-    
+
+    <container name="testtools-container" loaders="test" class="org.ofbiz.testtools.TestRunContainer"/>
+    <container name="testtools-container" loaders="testlist" class="org.ofbiz.testtools.TestListContainer"/>
+
 </ofbiz-component>
\ No newline at end of file

Modified: ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java Tue Aug  7 06:25:59 2012
@@ -38,8 +38,8 @@ import org.ofbiz.entity.DelegatorFactory
 import org.ofbiz.entity.testtools.EntityTestCase;
 import org.ofbiz.minilang.MiniLangException;
 import org.ofbiz.minilang.SimpleMethod;
-import org.ofbiz.service.GenericDispatcher;
 import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceContainer;
 import org.ofbiz.service.testtools.OFBizTestCase;
 import org.w3c.dom.Element;
 
@@ -71,7 +71,7 @@ public class ModelTestSuite {
         String uniqueSuffix = "-" + RandomStringUtils.randomAlphanumeric(10);
 
         this.delegator = DelegatorFactory.getDelegator(this.originalDelegatorName).makeTestDelegator(this.originalDelegatorName + uniqueSuffix);
-        this.dispatcher = GenericDispatcher.getLocalDispatcher(originalDispatcherName + uniqueSuffix, delegator);
+        this.dispatcher = ServiceContainer.getLocalDispatcher(originalDispatcherName + uniqueSuffix, delegator);
 
         for (Element testCaseElement : UtilXml.childElementList(mainElement, UtilMisc.toSet("test-case", "test-group"))) {
             String caseName = testCaseElement.getAttribute("case-name");

Modified: ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/TestListContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/TestListContainer.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/TestListContainer.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/TestListContainer.java Tue Aug  7 06:25:59 2012
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.lang.String;
 import java.util.List;
 
 import javolution.util.FastList;
@@ -43,6 +44,7 @@ public class TestListContainer implement
 
     public static final String module = TestListContainer.class.getName();
 
+    private String name;
     private String outputLocation;
     private String mode = "text";
 
@@ -56,10 +58,9 @@ public class TestListContainer implement
         }
     }
 
-    /**
-     * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String)
-     */
-    public void init(String[] args, String configFile) {
+    @Override
+    public void init(String[] args, String name, String configFile) {
+        this.name = name;
         this.outputLocation = args[0];
         for (int i = 1; i < args.length; i++) {
             if ("-ant".equals(args[i])) {
@@ -102,8 +103,7 @@ public class TestListContainer implement
                     pout.format("%s:%s", foundTest.componentName, foundTest.suiteName);
                 }
                 pout.println("\"/>\n");
-                for (int i = 0; i < foundTests.size(); i++) {
-                    FoundTest foundTest = foundTests.get(i);
+                for (FoundTest foundTest : foundTests) {
                     pout.format(" <target name=\"%1$s:%2$s\">\n  <ant antfile=\"build.xml\" target=\"run-single-test-suite\">\n   <property name=\"test.component\" value=\"%1$s\"/>\n   <property name=\"test.suiteName\" value=\"%2$s\"/>\n  </ant>\n </target>\n", foundTest.componentName, foundTest.suiteName);
                 }
                 pout.println("</project>");
@@ -121,4 +121,8 @@ public class TestListContainer implement
 
     public void stop() throws ContainerException {
     }
+
+    public String getName() {
+       return name;
+    }
 }

Modified: ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java Tue Aug  7 06:25:59 2012
@@ -22,6 +22,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.OutputStream;
+import java.lang.String;
 import java.util.Enumeration;
 import java.util.Map;
 
@@ -56,14 +57,14 @@ public class TestRunContainer implements
     protected String testCase = null;
     protected String logLevel = null;
 
-    /**
-     * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String)
-     */
-    public void init(String[] args, String configFile) {
+    private String name;
+
+    @Override
+    public void init(String[] args, String name, String configFile) {
+        this.name = name;
         this.configFile = configFile;
         if (args != null) {
-            for (int i = 0; i < args.length; i++) {
-                String argument = args[i];
+            for (String argument : args) {
                 // arguments can prefix w/ a '-'. Just strip them off
                 if (argument.startsWith("-")) {
                     int subIdx = 1;
@@ -198,6 +199,10 @@ public class TestRunContainer implements
     public void stop() throws ContainerException {
     }
 
+    public String getName() {
+        return name;
+    }
+
     class JunitXmlListener extends XMLJUnitResultFormatter {
 
         Map<String, Long> startTimes = FastMap.newInstance();

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/dtd/site-conf.xsd
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/dtd/site-conf.xsd?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/dtd/site-conf.xsd (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/dtd/site-conf.xsd Tue Aug  7 06:25:59 2012
@@ -189,6 +189,7 @@ under the License.
             <xs:sequence>
                 <xs:element minOccurs="0" ref="description"/>
                 <xs:element minOccurs="0" ref="security"/>
+                <xs:element minOccurs="0" ref="metric"/>
                 <xs:element minOccurs="0" ref="event"/>
                 <xs:element maxOccurs="unbounded" ref="response"/>
             </xs:sequence>
@@ -325,7 +326,7 @@ under the License.
         <xs:attribute name="direct-request" default="true">
             <xs:annotation>
                 <xs:documentation>
-                    If false the request can only be accessed in a chained request
+                    If false the request can only be accessed in a chained request, default to true.
                 </xs:documentation>
             </xs:annotation>
             <xs:simpleType>
@@ -336,6 +337,60 @@ under the License.
             </xs:simpleType>
         </xs:attribute>
     </xs:attributeGroup>
+    <xs:element name="metric">
+        <xs:annotation>
+            <xs:documentation>
+                Calculate and maintain an average response time for this request. Request metrics can be used
+                for monitoring and reporting. Metrics can also be used to trigger an alternate
+                response if the optional threshold attribute is used.
+                &lt;br/&gt;&lt;br/&gt;
+                The metric works by gathering statistics until a configurable maximum is reached (number of
+                requests or elapsed time), then the average is calculated. A smoothing factor is used to
+                smooth differences between calculations.
+            </xs:documentation>
+        </xs:annotation>
+        <xs:complexType>
+            <xs:attribute name="name" type="xs:string" use="required">
+                <xs:annotation>
+                    <xs:documentation>
+                        Each metric must have a unique name. 
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+            <xs:attribute name="estimation-size" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        Positive integer number of requests to include in the metrics calculation. Defaults to "100". 
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+            <xs:attribute name="estimation-time" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        Positive integer number of milliseconds to include in the metrics calculation. Defaults to "1000". 
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+            <xs:attribute name="smoothing" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        Positive decimal smoothing factor - used to smooth the differences between calculations. A value of "1" disables smoothing. Defaults to "0.7". 
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+            <xs:attribute name="threshold" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        The metric threshold in milliseconds. If the average response time exceeds this setting,
+                        then a "threshold-exceeded" response code will be generated. That response code can be used
+                        in a response element. The threshold check will ignore the first three requests - to give
+                        the metric a chance to stablize after startup. A value of "0.0" disables the threshold.
+                        Defaults to "0.0". 
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:attribute>
+        </xs:complexType>
+    </xs:element>
     <xs:element name="event">
         <xs:annotation>
             <xs:documentation>
@@ -652,8 +707,7 @@ under the License.
         <xs:attribute type="xs:string" name="type" default="default">
             <xs:annotation>
                 <xs:documentation>
-                    There are as much as types (of type view) as available defined and accessible event handlers.
-                    Most used is screen, others are notably screenxml, screentext, screencsv, screenfop, ftl, http and birt
+                    The name of the view handler that will render the output: screen, screenfop, ftl etc...
                     A most comprehensive list can be found in the common-controller.
                 </xs:documentation>
             </xs:annotation>

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java Tue Aug  7 06:25:59 2012
@@ -33,6 +33,8 @@ import javolution.util.FastMap;
 import javolution.util.FastSet;
 
 import org.ofbiz.base.location.FlexibleLocation;
+import org.ofbiz.base.metrics.Metrics;
+import org.ofbiz.base.metrics.MetricsFactory;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.FileUtil;
 import org.ofbiz.base.util.GeneralException;
@@ -523,6 +525,7 @@ public class ConfigXMLReader {
         public boolean securityDirectRequest = true;
 
         public Map<String, RequestResponse> requestResponseMap = FastMap.newInstance();
+        public Metrics metrics = null;
 
         public RequestMap(Element requestMapElement) {
 
@@ -556,6 +559,11 @@ public class ConfigXMLReader {
                 RequestResponse response = new RequestResponse(responseElement);
                 requestResponseMap.put(response.name, response);
             }
+            // Get metrics.
+            Element metricsElement = UtilXml.firstChildElement(requestMapElement, "metric");
+            if (metricsElement != null) {
+                this.metrics = MetricsFactory.getInstance(metricsElement);
+            }
         }
     }
 

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Tue Aug  7 06:25:59 2012
@@ -40,9 +40,6 @@ import javax.servlet.http.HttpServletRes
 
 import javolution.util.FastList;
 
-import org.ofbiz.base.container.Container;
-import org.ofbiz.base.container.ContainerException;
-import org.ofbiz.base.container.ContainerLoader;
 import org.ofbiz.base.util.CachedClassLoader;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.StringUtil;
@@ -61,11 +58,8 @@ import org.ofbiz.entity.util.EntityUtil;
 import org.ofbiz.security.Security;
 import org.ofbiz.security.SecurityConfigurationException;
 import org.ofbiz.security.SecurityFactory;
-import org.ofbiz.security.authz.AbstractAuthorization;
-import org.ofbiz.security.authz.Authorization;
-import org.ofbiz.security.authz.AuthorizationFactory;
-import org.ofbiz.service.GenericDispatcher;
 import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceContainer;
 
 /**
  * ContextFilter - Restricts access to raw files and configures servlet objects.
@@ -73,14 +67,11 @@ import org.ofbiz.service.LocalDispatcher
 public class ContextFilter implements Filter {
 
     public static final String module = ContextFilter.class.getName();
-    public static final String CONTAINER_CONFIG = "limited-containers.xml";
     public static final String FORWARDED_FROM_SERVLET = "_FORWARDED_FROM_SERVLET_";
 
     protected ClassLoader localCachedClassLoader = null;
     protected FilterConfig config = null;
     protected boolean debug = false;
-    protected Container rmiLoadedContainer = null; // used in Geronimo/WASCE to allow to deregister
-
 
     /**
      * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
@@ -101,17 +92,10 @@ public class ContextFilter implements Fi
             debug = Debug.verboseOn();
         }
 
-        // load the containers
-        Container container = getContainers();
-        if (container != null) {
-            rmiLoadedContainer = container; // used in Geronimo/WASCE to allow to deregister
-        }
         // check the serverId
         getServerId();
         // initialize the delegator
         getDelegator(config.getServletContext());
-        // initialize authorizer
-        getAuthz();
         // initialize security
         getSecurity();
         // initialize the services dispatcher
@@ -305,12 +289,9 @@ public class ContextFilter implements Fi
                     config.getServletContext().setAttribute("delegator", delegator);
 
                     // clear web context objects
-                    config.getServletContext().setAttribute("authz", null);
                     config.getServletContext().setAttribute("security", null);
                     config.getServletContext().setAttribute("dispatcher", null);
 
-                    // initialize authorizer
-                    getAuthz();
                     // initialize security
                     Security security = getSecurity();
                     // initialize the services dispatcher
@@ -335,9 +316,6 @@ public class ContextFilter implements Fi
 
         // we're done checking; continue on
         chain.doFilter(httpRequest, httpResponse);
-
-        // reset thread local security
-        AbstractAuthorization.clearThreadLocal();
     }
 
     /**
@@ -345,11 +323,6 @@ public class ContextFilter implements Fi
      */
     public void destroy() {
         getDispatcher(config.getServletContext()).deregister();
-        try {
-            destroyRmiContainer(); // used in Geronimo/WASCE to allow to deregister
-        } catch (ServletException e) {
-            Debug.logError("Error when stopping containers, this exception should not arise...", module);
-        }
         config = null;
     }
 
@@ -369,22 +342,6 @@ public class ContextFilter implements Fi
             Debug.logError("[ContextFilter.init] ERROR: delegator not defined.", module);
             return null;
         }
-        Collection<URL> readers = null;
-        String readerFiles = servletContext.getInitParameter("serviceReaderUrls");
-
-        if (readerFiles != null) {
-            readers = FastList.newInstance();
-            for (String name: StringUtil.split(readerFiles, ";")) {
-                try {
-                    URL readerURL = servletContext.getResource(name);
-                    if (readerURL != null) readers.add(readerURL);
-                } catch (NullPointerException npe) {
-                    Debug.logInfo(npe, "[ContextFilter.init] ERROR: Null pointer exception thrown.", module);
-                } catch (MalformedURLException e) {
-                    Debug.logError(e, "[ContextFilter.init] ERROR: cannot get URL from String.", module);
-                }
-            }
-        }
         // get the unique name of this dispatcher
         String dispatcherName = servletContext.getInitParameter("localDispatcherName");
 
@@ -393,7 +350,7 @@ public class ContextFilter implements Fi
             dispatcherName = delegator.getDelegatorName();
         }
 
-        LocalDispatcher dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator, readers, null);
+        LocalDispatcher dispatcher = ServiceContainer.getLocalDispatcher(dispatcherName, delegator);
         if (dispatcher == null) {
             Debug.logError("[ContextFilter.init] ERROR: dispatcher could not be initialized.", module);
         }
@@ -419,27 +376,6 @@ public class ContextFilter implements Fi
         return delegator;
     }
 
-    protected Authorization getAuthz() {
-        Authorization authz = (Authorization) config.getServletContext().getAttribute("authz");
-        if (authz == null) {
-            Delegator delegator = (Delegator) config.getServletContext().getAttribute("delegator");
-
-            if (delegator != null) {
-                try {
-                    authz = AuthorizationFactory.getInstance(delegator);
-                } catch (SecurityConfigurationException e) {
-                    Debug.logError(e, "[ServiceDispatcher.init] : No instance of authorization implementation found.", module);
-                }
-            }
-            config.getServletContext().setAttribute("authz", authz);
-            if (authz == null) {
-                Debug.logError("[ContextFilter.init] ERROR: authorization create failed.", module);
-            }
-        }
-        return authz;
-    }
-
-    @Deprecated
     protected Security getSecurity() {
         Security security = (Security) config.getServletContext().getAttribute("security");
         if (security == null) {
@@ -449,12 +385,12 @@ public class ContextFilter implements Fi
                 try {
                     security = SecurityFactory.getInstance(delegator);
                 } catch (SecurityConfigurationException e) {
-                    Debug.logError(e, "[ServiceDispatcher.init] : No instance of security imeplemtation found.", module);
+                    Debug.logError(e, "Unable to obtain an instance of the security object.", module);
                 }
             }
             config.getServletContext().setAttribute("security", security);
             if (security == null) {
-                Debug.logError("[ContextFilter.init] ERROR: security create failed.", module);
+                Debug.logError("An invalid (null) Security object has been set in the servlet context.", module);
             }
         }
         return security;
@@ -487,20 +423,4 @@ public class ContextFilter implements Fi
         }
         return serverId;
     }
-
-    protected Container getContainers() throws ServletException {
-        return ContainerLoader.getContainer("rmi-dispatcher");
-    }
-
-    // used in Geronimo/WASCE to allow to deregister
-    protected void destroyRmiContainer() throws ServletException {
-        if (rmiLoadedContainer != null) {
-            try {
-                rmiLoadedContainer.stop();
-            } catch (ContainerException e) {
-                Debug.logError(e, module);
-                throw new ServletException("Error when stopping the RMI loaded container");
-            }
-        }
-    }
 }

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java Tue Aug  7 06:25:59 2012
@@ -46,7 +46,6 @@ import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.transaction.GenericTransactionException;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.security.Security;
-import org.ofbiz.security.authz.Authorization;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.webapp.stats.ServerHitBin;
 import org.ofbiz.webapp.stats.VisitHandler;
@@ -177,15 +176,6 @@ public class ControlServlet extends Http
         }
         request.setAttribute("dispatcher", dispatcher);
 
-        Authorization authz = (Authorization) session.getAttribute("authz");
-        if (authz == null) {
-            authz = (Authorization) getServletContext().getAttribute("authz");
-        }
-        if (authz == null) {
-            Debug.logError("[ControlServlet] ERROR: authorization not found in ServletContext", module);
-        }
-        request.setAttribute("authz", authz); // maybe we should also add the value to 'security'
-
         Security security = (Security) session.getAttribute("security");
         if (security == null) {
             security = (Security) getServletContext().getAttribute("security");

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Tue Aug  7 06:25:59 2012
@@ -63,8 +63,6 @@ import org.ofbiz.entity.transaction.Tran
 import org.ofbiz.security.Security;
 import org.ofbiz.security.SecurityConfigurationException;
 import org.ofbiz.security.SecurityFactory;
-import org.ofbiz.security.authz.Authorization;
-import org.ofbiz.security.authz.AuthorizationFactory;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ModelService;
@@ -478,25 +476,17 @@ public class LoginWorker {
     private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher) {
         HttpSession session = request.getSession();
         // NOTE: we do NOT want to set this in the servletContext, only in the request and session
-        // We also need to setup the security and authz objects since they are dependent on the delegator
+        // We also need to setup the security objects since they are dependent on the delegator
         Security security = null;
         try {
             security = SecurityFactory.getInstance(delegator);
         } catch (SecurityConfigurationException e) {
             Debug.logError(e, module);
         }
-        Authorization authz = null;
-        try {
-            authz = AuthorizationFactory.getInstance(delegator);
-        } catch (SecurityConfigurationException e) {
-            Debug.logError(e, module);
-        }
-
         session.setAttribute("delegatorName", delegator.getDelegatorName());
         request.setAttribute("delegator", delegator);
         request.setAttribute("dispatcher", dispatcher);
         request.setAttribute("security", security);
-        request.setAttribute("authz", authz);
 
         // get rid of the visit info since it was pointing to the previous database, and get a new one
         session.removeAttribute("visitor");
@@ -612,7 +602,6 @@ public class LoginWorker {
         request.removeAttribute("delegator");
         request.removeAttribute("dispatcher");
         request.removeAttribute("security");
-        request.removeAttribute("authz");
 
         // now empty out the session
         session.invalidate();
@@ -991,14 +980,12 @@ public class LoginWorker {
         Security security = (Security) request.getAttribute("security");
         if (security != null) {
             ServletContext context = (ServletContext) request.getAttribute("servletContext");
-            Authorization authz = (Authorization) request.getAttribute("authz");
             String serverId = (String) context.getAttribute("_serverId");
             String contextPath = request.getContextPath();
             ComponentConfig.WebappInfo info = ComponentConfig.getWebAppInfo(serverId, contextPath);
             if (info != null) {
                 for (String permission: info.getBasePermission()) {
-                    if (!"NONE".equals(permission) && !security.hasEntityPermission(permission, "_VIEW", userLogin) &&
-                            !authz.hasPermission(userLogin.getString("userLoginId"), permission, null)) {
+                    if (!"NONE".equals(permission) && !security.hasEntityPermission(permission, "_VIEW", userLogin)) {
                         return false;
                     }
                 }

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java Tue Aug  7 06:25:59 2012
@@ -106,6 +106,7 @@ public class RequestHandler {
     public void doRequest(HttpServletRequest request, HttpServletResponse response, String chain,
             GenericValue userLogin, Delegator delegator) throws RequestHandlerException {
 
+        long startTime = System.currentTimeMillis();
         HttpSession session = request.getSession();
 
         // get the controllerConfig once for this method so we don't have to get it over and over inside the method
@@ -155,8 +156,11 @@ public class RequestHandler {
         if (requestMap == null) {
             throw new RequestHandlerException(requestMissingErrorMessage);
         }
-
         String eventReturn = null;
+        if (requestMap.metrics != null && requestMap.metrics.getThreshold() != 0.0 && requestMap.metrics.getTotalEvents() > 3 && requestMap.metrics.getThreshold() < requestMap.metrics.getServiceRate()) {
+            eventReturn = "threshold-exceeded";
+        }
+
         boolean interruptRequest = false;
 
         // Check for chained request.
@@ -650,6 +654,9 @@ public class RequestHandler {
                 if (Debug.verboseOn()) Debug.logVerbose("[RequestHandler.doRequest]: Response is handled by the event." + " sessionId=" + UtilHttp.getSessionId(request), module);
             }
         }
+        if (requestMap.metrics != null) {
+            requestMap.metrics.recordServiceRate(1, System.currentTimeMillis() - startTime);
+        }
     }
 
     /** Find the event handler and invoke an event. */

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java Tue Aug  7 06:25:59 2012
@@ -43,17 +43,12 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.entity.Delegator;
-import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericEntity;
 import org.ofbiz.entity.GenericValue;
-import org.ofbiz.security.authz.Authorization;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.GenericDispatcher;
+import org.ofbiz.security.Security;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ModelService;
-import org.ofbiz.service.ServiceDispatcher;
 import org.ofbiz.service.calendar.RecurrenceRule;
 import org.ofbiz.webapp.control.RequestHandler;
 import org.ofbiz.webapp.control.ConfigXMLReader.Event;
@@ -110,8 +105,8 @@ public class CoreEvents {
      * @return Response code string
      */
     public static String scheduleService(HttpServletRequest request, HttpServletResponse response) {
+        Security security = (Security) request.getAttribute("security");
         GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
-        Authorization authz = (Authorization) request.getAttribute("authz");
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         //Delegator delegator = (Delegator) request.getAttribute("delegator");
         Locale locale = UtilHttp.getLocale(request);
@@ -216,7 +211,7 @@ public class CoreEvents {
             serviceContext.put("locale", locale);
         }
 
-        if (!modelService.export && !authz.hasPermission(request.getSession(), "SERVICE_INVOKE_ANY", null)) {
+        if (!modelService.export && !security.hasPermission("SERVICE_INVOKE_ANY", request.getSession())) {
             String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.not_authorized_to_call", locale);
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
@@ -438,7 +433,7 @@ public class CoreEvents {
         }
 
         // now do a security check
-        Authorization authz = (Authorization) request.getAttribute("authz");
+        Security security = (Security) request.getAttribute("security");
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
 
         //lookup the service definition to see if this service is externally available, if not require the SERVICE_INVOKE_ANY permission
@@ -457,7 +452,7 @@ public class CoreEvents {
             return "error";
         }
 
-        if (!modelService.export && !authz.hasPermission(request.getSession(), "SERVICE_INVOKE_ANY", null)) {
+        if (!modelService.export && !security.hasPermission("SERVICE_INVOKE_ANY", request.getSession())) {
             String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.not_authorized_to_call", locale);
             request.setAttribute("_ERROR_MESSAGE_", errMsg + ".");
             return "error";

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java Tue Aug  7 06:25:59 2012
@@ -34,9 +34,9 @@ import javolution.util.FastMap;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.DelegatorFactory;
-import org.ofbiz.service.GenericDispatcher;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceContainer;
 import org.ofbiz.service.ServiceUtil;
 import org.ofbiz.webapp.control.ConfigXMLReader.Event;
 import org.ofbiz.webapp.control.ConfigXMLReader.RequestMap;
@@ -53,7 +53,7 @@ public class ServiceStreamHandler implem
     public void init(ServletContext context) throws EventHandlerException {
         String delegatorName = context.getInitParameter("entityDelegatorName");
         this.delegator = DelegatorFactory.getDelegator(delegatorName);
-        this.dispatcher = GenericDispatcher.getLocalDispatcher(this.delegator.getDelegatorName(), delegator);
+        this.dispatcher = ServiceContainer.getLocalDispatcher(this.delegator.getDelegatorName(), delegator);
     }
 
     public String invoke(Event event, RequestMap requestMap, HttpServletRequest request, HttpServletResponse response) throws EventHandlerException {

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java Tue Aug  7 06:25:59 2012
@@ -52,10 +52,10 @@ import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.GenericDispatcher;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ModelService;
+import org.ofbiz.service.ServiceContainer;
 import org.ofbiz.service.ServiceUtil;
 import org.ofbiz.webapp.control.ConfigXMLReader;
 import org.ofbiz.webapp.control.ConfigXMLReader.Event;
@@ -76,7 +76,7 @@ public class XmlRpcEventHandler extends 
     public void init(ServletContext context) throws EventHandlerException {
         String delegatorName = context.getInitParameter("entityDelegatorName");
         this.delegator = DelegatorFactory.getDelegator(delegatorName);
-        this.dispatcher = GenericDispatcher.getLocalDispatcher(delegator.getDelegatorName(), delegator);
+        this.dispatcher = ServiceContainer.getLocalDispatcher(delegator.getDelegatorName(), delegator);
         this.setHandlerMapping(new ServiceRpcHandler());
 
         String extensionsEnabledString = context.getInitParameter("xmlrpc.enabledForExtensions");

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java Tue Aug  7 06:25:59 2012
@@ -87,7 +87,6 @@ public class FreeMarkerViewHandler exten
         // add in the OFBiz objects
         root.put("delegator", request.getAttribute("delegator"));
         root.put("dispatcher", request.getAttribute("dispatcher"));
-        root.put("authz", request.getAttribute("authz"));
         root.put("security", request.getAttribute("security"));
         root.put("userLogin", session.getAttribute("userLogin"));
 

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java Tue Aug  7 06:25:59 2012
@@ -207,7 +207,11 @@ public class ServerHitBin {
                 }
                 if (bin == null) {
                     bin = new ServerHitBin(id, type, true, delegator);
-                    binList.add(0, bin);
+                    if (binList.size() > 0) {
+                        binList.add(0, bin);
+                    } else {
+                        binList.add(bin);
+                    }
                 }
             }
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/webdav/RequestHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/webdav/RequestHandler.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/webdav/RequestHandler.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/webdav/RequestHandler.java Tue Aug  7 06:25:59 2012
@@ -32,7 +32,6 @@ public interface RequestHandler {
      *   <tr><td>delegator</td><td>A <code>GenericDelgator</code> instance</td></tr>
      *   <tr><td>dispatcher</td><td>A <code>LocalDispatcher</code> instance</td></tr>
      *   <tr><td>security</td><td>A <code>Security</code> instance</td></tr>
-     *   <tr><td>authz</td><td>An <code>Authorization</code> instance</td></tr>
      * </table></p>
      */
     public void handleRequest(HttpServletRequest request, HttpServletResponse response, ServletContext context) throws ServletException, IOException;

Modified: ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java Tue Aug  7 06:25:59 2012
@@ -36,10 +36,8 @@ import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.security.Security;
 import org.ofbiz.security.SecurityFactory;
-import org.ofbiz.security.authz.Authorization;
-import org.ofbiz.security.authz.AuthorizationFactory;
-import org.ofbiz.service.GenericDispatcher;
 import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceContainer;
 
 /** Implements a WebDAV servlet. The servlet simply forwards WebDAV requests
  * to a <code>RequestHandlerFactory</code> instance, whose class is specified
@@ -54,7 +52,6 @@ public class WebDavServlet extends Gener
 
     public static final String module = WebDavServlet.class.getName();
 
-    protected Authorization authz = null;
     protected Delegator delegator = null;
     protected LocalDispatcher dispatcher = null;
     protected RequestHandlerFactory handlerFactory = null;
@@ -70,9 +67,8 @@ public class WebDavServlet extends Gener
             String delegatorName = context.getInitParameter("entityDelegatorName");
             this.delegator = DelegatorFactory.getDelegator(delegatorName);
             String dispatcherName = context.getInitParameter("localDispatcherName");
-            this.dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, this.delegator);
+            this.dispatcher = ServiceContainer.getLocalDispatcher(dispatcherName, this.delegator);
             this.security = SecurityFactory.getInstance(this.delegator);
-            this.authz = AuthorizationFactory.getInstance(this.delegator);
             String factoryClassName = context.getInitParameter("requestHandlerFactoryClass");
             this.handlerFactory = (RequestHandlerFactory) loader.loadClass(factoryClassName).newInstance();
         } catch (Exception e) {
@@ -86,8 +82,6 @@ public class WebDavServlet extends Gener
             buff.append(this.dispatcher.getName());
             buff.append(", security = ");
             buff.append(this.security.getClass().getName());
-            buff.append(", authz = ");
-            buff.append(this.authz.getClass().getName());
             buff.append(", handler factory = ");
             buff.append(this.handlerFactory.getClass().getName());
             Debug.logVerbose(buff.toString(), module);
@@ -99,7 +93,6 @@ public class WebDavServlet extends Gener
         request.setAttribute("delegator", this.delegator);
         request.setAttribute("dispatcher", this.dispatcher);
         request.setAttribute("security", this.security);
-        request.setAttribute("authz", this.authz);
         HttpServletRequest httpRequest = (HttpServletRequest) request;
         RequestHandler handler = this.handlerFactory.getHandler(httpRequest.getMethod());
         try {

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/config/WebtoolsUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/config/WebtoolsUiLabels.xml?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/config/WebtoolsUiLabels.xml (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/config/WebtoolsUiLabels.xml Tue Aug  7 06:25:59 2012
@@ -18,7 +18,7 @@
     specific language governing permissions and limitations
     under the License.
 -->
-<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz.properties.xsd">
     <property key="ConnectionPoolStatus">
         <value xml:lang="en">Connection Pool Status</value>
         <value xml:lang="vi">Trạng thái chia sẻ kết nối cơ sở dữ liệu</value>
@@ -3052,14 +3052,17 @@
         <value xml:lang="zh">内存</value>
         <value xml:lang="zh_TW">記憶體</value>
     </property>
-    <property key="WebtoolsMinervaConnectionObjects">
-        <value xml:lang="de">Minerva Verbindungsobjekte</value>
-        <value xml:lang="en">Minerva Connection Objects</value>
-        <value xml:lang="it">Oggetti connessione Minerva</value>
-        <value xml:lang="pt">Objetos de Conexão Minerva</value>
-        <value xml:lang="vi">Đối tượng kết nối Minerva</value>
-        <value xml:lang="zh">智能连接对象</value>
-        <value xml:lang="zh_TW">智慧連接物件</value>
+    <property key="WebtoolsMetrics">
+        <value xml:lang="en">Metrics</value>
+    </property>
+    <property key="WebtoolsMetricsRate">
+        <value xml:lang="en">Service Rate (mS)</value>
+    </property>
+    <property key="WebtoolsMetricsThreshold">
+        <value xml:lang="en">Threshold</value>
+    </property>
+    <property key="WebtoolsMetricsTotalEvents">
+        <value xml:lang="en">Total Events</value>
     </property>
     <property key="WebtoolsMiscSetupTools">
         <value xml:lang="de">Versch. Setup Tools</value>
@@ -5122,6 +5125,9 @@
         <value xml:lang="zh">浏览日志</value>
         <value xml:lang="zh_TW">瀏覽日誌</value>
     </property>
+    <property key="WebtoolsViewMetrics">
+        <value xml:lang="en">View Metrics</value>
+    </property>
     <property key="WebtoolsViewPermissionError">
         <value xml:lang="de">Sie haben keine Berechtigung um diesen Bereich anzusehen (Sie benötigen OFBTOOLS_VIEW oder OFBIZTOOLS_ADMIN Berechtigung)</value>
         <value xml:lang="en">You do not have permission to view this page. ("OFBTOOLS_VIEW" or "OFBTOOLS_ADMIN" needed)</value>

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ArtifactInfoFactory.java Tue Aug  7 06:25:59 2012
@@ -22,32 +22,35 @@ import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Future;
 
 import javax.xml.parsers.ParserConfigurationException;
 
-import javolution.util.FastMap;
 import javolution.util.FastSet;
 
 import org.ofbiz.base.component.ComponentConfig;
+import org.ofbiz.base.concurrent.ExecutionPool;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.FileUtil;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.config.DelegatorInfo;
+import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelReader;
-import org.ofbiz.entityext.eca.EntityEcaRule;
-import org.ofbiz.entityext.eca.EntityEcaUtil;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
 import org.ofbiz.service.ModelService;
 import org.ofbiz.service.eca.ServiceEcaRule;
-import org.ofbiz.service.eca.ServiceEcaUtil;
 import org.ofbiz.webapp.control.ConfigXMLReader;
 import org.ofbiz.webapp.control.ConfigXMLReader.ControllerConfig;
 import org.ofbiz.widget.form.FormFactory;
@@ -56,9 +59,6 @@ import org.ofbiz.widget.screen.ModelScre
 import org.ofbiz.widget.screen.ScreenFactory;
 import org.xml.sax.SAXException;
 
-/**
- *
- */
 public class ArtifactInfoFactory {
 
     public static final String module = ArtifactInfoFactory.class.getName();
@@ -73,46 +73,44 @@ public class ArtifactInfoFactory {
     public static final String ControllerRequestInfoTypeId = "request";
     public static final String ControllerViewInfoTypeId = "view";
 
-    protected String delegatorName;
-    protected ModelReader entityModelReader;
-    protected DispatchContext dispatchContext;
-    protected Map<String, Map<String, List<EntityEcaRule>>> entityEcaCache;
-    protected Map<String, Map<String, List<ServiceEcaRule>>> serviceEcaCache;
-
-    public Map<String, EntityArtifactInfo> allEntityInfos = FastMap.newInstance();
-    public Map<String, ServiceArtifactInfo> allServiceInfos = FastMap.newInstance();
-    public Map<ServiceEcaRule, ServiceEcaArtifactInfo> allServiceEcaInfos = FastMap.newInstance();
-    public Map<String, FormWidgetArtifactInfo> allFormInfos = FastMap.newInstance();
-    public Map<String, ScreenWidgetArtifactInfo> allScreenInfos = FastMap.newInstance();
-    public Map<String, ControllerRequestArtifactInfo> allControllerRequestInfos = FastMap.newInstance();
-    public Map<String, ControllerViewArtifactInfo> allControllerViewInfos = FastMap.newInstance();
+    protected final String delegatorName;
+    protected final ModelReader entityModelReader;
+    protected final DispatchContext dispatchContext;
+
+    public Map<String, EntityArtifactInfo> allEntityInfos = new ConcurrentHashMap<String, EntityArtifactInfo>();
+    public Map<String, ServiceArtifactInfo> allServiceInfos = new ConcurrentHashMap<String, ServiceArtifactInfo>();
+    public Map<ServiceEcaRule, ServiceEcaArtifactInfo> allServiceEcaInfos = new ConcurrentHashMap<ServiceEcaRule, ServiceEcaArtifactInfo>();
+    public Map<String, FormWidgetArtifactInfo> allFormInfos = new ConcurrentHashMap<String, FormWidgetArtifactInfo>();
+    public Map<String, ScreenWidgetArtifactInfo> allScreenInfos = new ConcurrentHashMap<String, ScreenWidgetArtifactInfo>();
+    public Map<String, ControllerRequestArtifactInfo> allControllerRequestInfos = new ConcurrentHashMap<String, ControllerRequestArtifactInfo>();
+    public Map<String, ControllerViewArtifactInfo> allControllerViewInfos = new ConcurrentHashMap<String, ControllerViewArtifactInfo>();
 
     // reverse-associative caches for walking backward in the diagram
-    public Map<String, Set<ServiceEcaArtifactInfo>> allServiceEcaInfosReferringToServiceName = FastMap.newInstance();
-    public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToServiceName = FastMap.newInstance();
-    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToServiceName = FastMap.newInstance();
-    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosBasedOnServiceName = FastMap.newInstance();
-    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToServiceName = FastMap.newInstance();
-    public Map<String, Set<ControllerRequestArtifactInfo>> allRequestInfosReferringToServiceName = FastMap.newInstance();
-
-    public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToEntityName = FastMap.newInstance();
-    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToEntityName = FastMap.newInstance();
-    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToEntityName = FastMap.newInstance();
-
-    public Map<ServiceEcaRule, Set<ServiceArtifactInfo>> allServiceInfosReferringToServiceEcaRule = FastMap.newInstance();
-
-    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosExtendingForm = FastMap.newInstance();
-    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToForm = FastMap.newInstance();
-
-    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToScreen = FastMap.newInstance();
-    public Map<String, Set<ControllerViewArtifactInfo>> allViewInfosReferringToScreen = FastMap.newInstance();
-
-    public Map<String, Set<ControllerRequestArtifactInfo>> allRequestInfosReferringToView = FastMap.newInstance();
-
-    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosTargetingRequest = FastMap.newInstance();
-    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToRequest = FastMap.newInstance();
-    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToRequest = FastMap.newInstance();
-    public Map<String, Set<ControllerRequestArtifactInfo>> allRequestInfosReferringToRequest = FastMap.newInstance();
+    public Map<String, Set<ServiceEcaArtifactInfo>> allServiceEcaInfosReferringToServiceName = new ConcurrentHashMap<String, Set<ServiceEcaArtifactInfo>>();
+    public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToServiceName = new ConcurrentHashMap<String, Set<ServiceArtifactInfo>>();
+    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToServiceName = new ConcurrentHashMap<String, Set<FormWidgetArtifactInfo>>();
+    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosBasedOnServiceName = new ConcurrentHashMap<String, Set<FormWidgetArtifactInfo>>();
+    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToServiceName = new ConcurrentHashMap<String, Set<ScreenWidgetArtifactInfo>>();
+    public Map<String, Set<ControllerRequestArtifactInfo>> allRequestInfosReferringToServiceName = new ConcurrentHashMap<String, Set<ControllerRequestArtifactInfo>>();
+
+    public Map<String, Set<ServiceArtifactInfo>> allServiceInfosReferringToEntityName = new ConcurrentHashMap<String, Set<ServiceArtifactInfo>>();
+    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToEntityName = new ConcurrentHashMap<String, Set<FormWidgetArtifactInfo>>();
+    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToEntityName = new ConcurrentHashMap<String, Set<ScreenWidgetArtifactInfo>>();
+
+    public Map<ServiceEcaRule, Set<ServiceArtifactInfo>> allServiceInfosReferringToServiceEcaRule = new ConcurrentHashMap<ServiceEcaRule, Set<ServiceArtifactInfo>>();
+
+    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosExtendingForm = new ConcurrentHashMap<String, Set<FormWidgetArtifactInfo>>();
+    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToForm = new ConcurrentHashMap<String, Set<ScreenWidgetArtifactInfo>>();
+
+    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToScreen = new ConcurrentHashMap<String, Set<ScreenWidgetArtifactInfo>>();
+    public Map<String, Set<ControllerViewArtifactInfo>> allViewInfosReferringToScreen = new ConcurrentHashMap<String, Set<ControllerViewArtifactInfo>>();
+
+    public Map<String, Set<ControllerRequestArtifactInfo>> allRequestInfosReferringToView = new ConcurrentHashMap<String, Set<ControllerRequestArtifactInfo>>();
+
+    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosTargetingRequest = new ConcurrentHashMap<String, Set<FormWidgetArtifactInfo>>();
+    public Map<String, Set<FormWidgetArtifactInfo>> allFormInfosReferringToRequest = new ConcurrentHashMap<String, Set<FormWidgetArtifactInfo>>();
+    public Map<String, Set<ScreenWidgetArtifactInfo>> allScreenInfosReferringToRequest = new ConcurrentHashMap<String, Set<ScreenWidgetArtifactInfo>>();
+    public Map<String, Set<ControllerRequestArtifactInfo>> allRequestInfosReferringToRequest = new ConcurrentHashMap<String, Set<ControllerRequestArtifactInfo>>();
 
     public static ArtifactInfoFactory getArtifactInfoFactory(String delegatorName) throws GeneralException {
         if (UtilValidate.isEmpty(delegatorName)) {
@@ -129,14 +127,23 @@ public class ArtifactInfoFactory {
     protected ArtifactInfoFactory(String delegatorName) throws GeneralException {
         this.delegatorName = delegatorName;
         this.entityModelReader = ModelReader.getModelReader(delegatorName);
-        this.dispatchContext = new DispatchContext("ArtifactInfoDispCtx", null, this.getClass().getClassLoader(), null);
-        this.entityEcaCache = EntityEcaUtil.getEntityEcaCache(EntityEcaUtil.getEntityEcaReaderName(delegatorName));
-        this.serviceEcaCache = ServiceEcaUtil.ecaCache;
+        DelegatorInfo delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegatorName);
+        String modelName;
+        if (delegatorInfo != null) {
+            modelName = delegatorInfo.entityModelReader;
+        } else {
+            modelName = "main";
+        }
+        // since we do not associate a dispatcher to this DispatchContext, it is important to set a name of an existing entity model reader:
+        // in this way it will be possible to retrieve the service models from the cache
+        this.dispatchContext = new DispatchContext(modelName, this.getClass().getClassLoader(), null);
 
         this.prepareAll();
     }
 
     public void prepareAll() throws GeneralException {
+        Debug.logInfo("Loading artifact info objects...", module);
+        List<Future<Void>> futures = new ArrayList();
         Set<String> entityNames = this.getEntityModelReader().getEntityNames();
         for (String entityName: entityNames) {
             this.getEntityArtifactInfo(entityName);
@@ -144,79 +151,18 @@ public class ArtifactInfoFactory {
 
         Set<String> serviceNames = this.getDispatchContext().getAllServiceNames();
         for (String serviceName: serviceNames) {
-            this.getServiceArtifactInfo(serviceName);
+            futures.add(ExecutionPool.GLOBAL_EXECUTOR.submit(prepareTaskForServiceAnalysis(serviceName)));
         }
-
         // how to get all Service ECAs to prepare? don't worry about it, will be populated from service load, ie all ECAs for each service
 
         Collection<ComponentConfig> componentConfigs = ComponentConfig.getAllComponents();
+        ExecutionPool.getAllFutures(futures);
+        futures = new ArrayList();
         for (ComponentConfig componentConfig: componentConfigs) {
-            String componentName = componentConfig.getGlobalName();
-            String rootComponentPath = componentConfig.getRootLocation();
-            List<File> screenFiles;
-            List<File> formFiles;
-            List<File> controllerFiles;
-            try {
-                screenFiles = FileUtil.findXmlFiles(rootComponentPath, null, "screens", "widget-screen.xsd");
-                formFiles = FileUtil.findXmlFiles(rootComponentPath, null, "forms", "widget-form.xsd");
-                controllerFiles = FileUtil.findXmlFiles(rootComponentPath, null, "site-conf", "site-conf.xsd");
-            } catch (IOException ioe) {
-                throw new GeneralException(ioe.getMessage());
-            }
-            for (File screenFile: screenFiles) {
-                String screenFilePath = screenFile.getAbsolutePath();
-                screenFilePath = screenFilePath.replace('\\', '/');
-                String screenFileRelativePath = screenFilePath.substring(rootComponentPath.length());
-                String screenLocation = "component://" + componentName + "/" + screenFileRelativePath;
-                Map<String, ModelScreen> modelScreenMap = null;
-                try {
-                    modelScreenMap = ScreenFactory.getScreensFromLocation(screenLocation);
-                } catch (Exception exc) {
-                    throw new GeneralException(exc.toString(), exc);
-                }
-                for (String screenName : modelScreenMap.keySet()) {
-                    this.getScreenWidgetArtifactInfo(screenName, screenLocation);
-                }
-            }
-            for (File formFile: formFiles) {
-                String formFilePath = formFile.getAbsolutePath();
-                formFilePath = formFilePath.replace('\\', '/');
-                String formFileRelativePath = formFilePath.substring(rootComponentPath.length());
-                String formLocation = "component://" + componentName + "/" + formFileRelativePath;
-                Map<String, ModelForm> modelFormMap = null;
-                try {
-                    modelFormMap = FormFactory.getFormsFromLocation(formLocation, this.getEntityModelReader(), this.getDispatchContext());
-                } catch (Exception exc) {
-                    throw new GeneralException(exc.toString(), exc);
-                }
-                for (String formName : modelFormMap.keySet()) {
-                    this.getFormWidgetArtifactInfo(formName, formLocation);
-                }
-            }
-            for (File controllerFile: controllerFiles) {
-                URL controllerUrl = null;
-                try {
-                    controllerUrl = controllerFile.toURI().toURL();
-                } catch (MalformedURLException mue) {
-                    throw new GeneralException(mue.getMessage());
-                }
-                ControllerConfig cc = ConfigXMLReader.getControllerConfig(controllerUrl);
-                for (String requestUri: cc.getRequestMapMap().keySet()) {
-                    try {
-                        this.getControllerRequestArtifactInfo(controllerUrl, requestUri);
-                    } catch (GeneralException e) {
-                        Debug.logWarning(e.getMessage(), module);
-                    }
-                }
-                for (String viewUri: cc.getViewMapMap().keySet()) {
-                    try {
-                        this.getControllerViewArtifactInfo(controllerUrl, viewUri);
-                    } catch (GeneralException e) {
-                        Debug.logWarning(e.getMessage(), module);
-                    }
-                }
-            }
+            futures.add(ExecutionPool.GLOBAL_EXECUTOR.submit(prepareTaskForComponentAnalysis(componentConfig)));
         }
+        ExecutionPool.getAllFutures(futures);
+        Debug.logInfo("Artifact info objects loaded.", module);
     }
 
     public ModelReader getEntityModelReader() {
@@ -298,7 +244,7 @@ public class ArtifactInfoFactory {
         return curInfo;
     }
 
-    public ScreenWidgetArtifactInfo getScreenWidgetArtifactInfo(String screenName, String screenLocation) throws GeneralException {
+    public ScreenWidgetArtifactInfo getScreenWidgetArtifactInfo(String screenName, String screenLocation) {
         ScreenWidgetArtifactInfo curInfo = this.allScreenInfos.get(screenLocation + "#" + screenName);
         if (curInfo == null) {
             try {
@@ -314,6 +260,12 @@ public class ArtifactInfoFactory {
     }
 
     public ControllerRequestArtifactInfo getControllerRequestArtifactInfo(URL controllerXmlUrl, String requestUri) throws GeneralException {
+        if (controllerXmlUrl == null) {
+            throw new GeneralException("Got a null URL controller");
+        }
+        if (requestUri == null) {
+            throw new GeneralException("Got a null requestUri for controller: " + controllerXmlUrl);
+        }
         ControllerRequestArtifactInfo curInfo = this.allControllerRequestInfos.get(controllerXmlUrl.toExternalForm() + "#" + requestUri);
         if (curInfo == null) {
             curInfo = new ControllerRequestArtifactInfo(controllerXmlUrl, requestUri, this);
@@ -416,4 +368,105 @@ public class ArtifactInfoFactory {
 
         return aiBaseSet;
     }
+
+    // private methods
+    private Callable<Void> prepareTaskForServiceAnalysis(final String serviceName) {
+        return new Callable() {
+            public Callable<Void> call() throws Exception {
+                try {
+                    getServiceArtifactInfo(serviceName);
+                } catch(Exception exc) {
+                    Debug.logWarning(exc, "Error processing service: " + serviceName, module);
+                }
+                return null;
+            }
+        };
+    }
+
+    private Callable<Void> prepareTaskForComponentAnalysis(final ComponentConfig componentConfig) {
+        return new Callable() {
+            public Callable<Void> call() throws Exception {
+                String componentName = componentConfig.getGlobalName();
+                String rootComponentPath = componentConfig.getRootLocation();
+                List<File> screenFiles = new ArrayList<File>();
+                List<File> formFiles = new ArrayList<File>();
+                List<File> controllerFiles = new ArrayList<File>();
+                try {
+                    screenFiles = FileUtil.findXmlFiles(rootComponentPath, null, "screens", "widget-screen.xsd");
+                } catch (IOException ioe) {
+                    Debug.logWarning(ioe.getMessage(), module);
+                }
+                try {
+                    formFiles = FileUtil.findXmlFiles(rootComponentPath, null, "forms", "widget-form.xsd");
+                } catch (IOException ioe) {
+                    Debug.logWarning(ioe.getMessage(), module);
+                }
+                try {
+                    controllerFiles = FileUtil.findXmlFiles(rootComponentPath, null, "site-conf", "site-conf.xsd");
+                } catch (IOException ioe) {
+                    Debug.logWarning(ioe.getMessage(), module);
+                }
+                for (File screenFile: screenFiles) {
+                    String screenFilePath = screenFile.getAbsolutePath();
+                    screenFilePath = screenFilePath.replace('\\', '/');
+                    String screenFileRelativePath = screenFilePath.substring(rootComponentPath.length());
+                    String screenLocation = "component://" + componentName + "/" + screenFileRelativePath;
+                    Map<String, ModelScreen> modelScreenMap = null;
+                    try {
+                        modelScreenMap = ScreenFactory.getScreensFromLocation(screenLocation);
+                    } catch (Exception exc) {
+                        Debug.logWarning(exc.getMessage(), module);
+                    }
+                    for (String screenName : modelScreenMap.keySet()) {
+                        getScreenWidgetArtifactInfo(screenName, screenLocation);
+                    }
+                }
+                for (File formFile: formFiles) {
+                    String formFilePath = formFile.getAbsolutePath();
+                    formFilePath = formFilePath.replace('\\', '/');
+                    String formFileRelativePath = formFilePath.substring(rootComponentPath.length());
+                    String formLocation = "component://" + componentName + "/" + formFileRelativePath;
+                    Map<String, ModelForm> modelFormMap = null;
+                    try {
+                        modelFormMap = FormFactory.getFormsFromLocation(formLocation, getEntityModelReader(), getDispatchContext());
+                    } catch (Exception exc) {
+                        Debug.logWarning(exc.getMessage(), module);
+                    }
+                    for (String formName : modelFormMap.keySet()) {
+                        try {
+                            getFormWidgetArtifactInfo(formName, formLocation);
+                        } catch (GeneralException ge) {
+                            Debug.logWarning(ge.getMessage(), module);
+                        }
+                    }
+                }
+                for (File controllerFile: controllerFiles) {
+                    URL controllerUrl = null;
+                    try {
+                        controllerUrl = controllerFile.toURI().toURL();
+                    } catch (MalformedURLException mue) {
+                        Debug.logWarning(mue.getMessage(), module);
+                    }
+                    if (controllerUrl == null) continue;
+                    ControllerConfig cc = ConfigXMLReader.getControllerConfig(controllerUrl);
+                    for (String requestUri: cc.getRequestMapMap().keySet()) {
+                        try {
+                            getControllerRequestArtifactInfo(controllerUrl, requestUri);
+                        } catch (GeneralException e) {
+                            Debug.logWarning(e.getMessage(), module);
+                        }
+                    }
+                    for (String viewUri: cc.getViewMapMap().keySet()) {
+                        try {
+                            getControllerViewArtifactInfo(controllerUrl, viewUri);
+                        } catch (GeneralException e) {
+                            Debug.logWarning(e.getMessage(), module);
+                        }
+                    }
+                }
+                return null;
+            }
+        };
+    }
+
 }

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerRequestArtifactInfo.java Tue Aug  7 06:25:59 2012
@@ -57,10 +57,6 @@ public class ControllerRequestArtifactIn
         if (this.requestInfoMap == null) {
             throw new GeneralException("Controller request with name [" + requestUri + "] is not defined in controller file [" + controllerXmlUrl + "].");
         }
-
-        if (this.requestInfoMap == null) {
-            throw new GeneralException("Could not find Controller Request [" + requestUri + "] at URL [" + controllerXmlUrl.toExternalForm() + "]");
-        }
     }
 
     /** note this is mean to be called after the object is created and added to the ArtifactInfoFactory.allControllerRequestInfos in ArtifactInfoFactory.getControllerRequestArtifactInfo */
@@ -69,14 +65,10 @@ public class ControllerRequestArtifactIn
 
         if (this.requestInfoMap.event != null && this.requestInfoMap.event.type != null && (this.requestInfoMap.event.type.indexOf("service") >= 0)) {
             String serviceName = this.requestInfoMap.event.invoke;
-            try {
-                this.serviceCalledByRequestEvent = this.aif.getServiceArtifactInfo(serviceName);
-                if (this.serviceCalledByRequestEvent != null) {
-                    // add the reverse association
-                    UtilMisc.addToSortedSetInMap(this, aif.allRequestInfosReferringToServiceName, this.serviceCalledByRequestEvent.getUniqueId());
-                }
-            } catch (GeneralException e) {
-                Debug.logWarning(e.toString(), module);
+            this.serviceCalledByRequestEvent = this.aif.getServiceArtifactInfo(serviceName);
+            if (this.serviceCalledByRequestEvent != null) {
+                // add the reverse association
+                UtilMisc.addToSortedSetInMap(this, aif.allRequestInfosReferringToServiceName, this.serviceCalledByRequestEvent.getUniqueId());
             }
         }
 

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/artifactinfo/ControllerViewArtifactInfo.java Tue Aug  7 06:25:59 2012
@@ -63,14 +63,10 @@ public class ControllerViewArtifactInfo 
             String fullScreenName = this.viewInfoMap.page;
             if (UtilValidate.isNotEmpty(fullScreenName)) {
                 int poundIndex = fullScreenName.indexOf('#');
-                try {
-                    this.screenCalledByThisView = this.aif.getScreenWidgetArtifactInfo(fullScreenName.substring(poundIndex+1), fullScreenName.substring(0, poundIndex));
-                    if (this.screenCalledByThisView != null) {
-                        // add the reverse association
-                        UtilMisc.addToSortedSetInMap(this, aif.allViewInfosReferringToScreen, this.screenCalledByThisView.getUniqueId());
-                    }
-                } catch (GeneralException e) {
-                    Debug.logWarning(e.toString(), module);
+                this.screenCalledByThisView = this.aif.getScreenWidgetArtifactInfo(fullScreenName.substring(poundIndex+1), fullScreenName.substring(0, poundIndex));
+                if (this.screenCalledByThisView != null) {
+                    // add the reverse association
+                    UtilMisc.addToSortedSetInMap(this, aif.allViewInfosReferringToScreen, this.screenCalledByThisView.getUniqueId());
                 }
             }
         }

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/src/org/ofbiz/webtools/labelmanager/LabelReferences.java Tue Aug  7 06:25:59 2012
@@ -39,6 +39,8 @@ import org.ofbiz.base.util.UtilFormatOut
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.config.DelegatorInfo;
+import org.ofbiz.entity.config.EntityConfigUtil;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
 import org.ofbiz.service.DispatchContext;
@@ -67,7 +69,16 @@ public class LabelReferences {
     public LabelReferences(Delegator delegator, LabelManagerFactory factory) {
         this.delegator = delegator;
         this.labels = factory.getLabels();
-        this.dispatchContext = new DispatchContext("LabelManagerDispCtx:" + delegator.getDelegatorName(), null, this.getClass().getClassLoader(), null);
+        DelegatorInfo delegatorInfo = EntityConfigUtil.getDelegatorInfo(delegator.getDelegatorBaseName());
+        String modelName;
+        if (delegatorInfo != null) {
+            modelName = delegatorInfo.entityModelReader;
+        } else {
+            modelName = "main";
+        }
+        // since we do not associate a dispatcher to this DispatchContext, it is important to set a name of an existing entity model reader:
+        // in this way it will be possible to retrieve the service models from the cache
+        this.dispatchContext = new DispatchContext(modelName, this.getClass().getClassLoader(), null);
         Collection<LabelInfo> infoList = this.labels.values();
         for (LabelInfo labelInfo : infoList) {
             this.labelSet.add(labelInfo.getLabelKey());

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/AvailableServices.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/AvailableServices.groovy?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/AvailableServices.groovy (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/AvailableServices.groovy Tue Aug  7 06:25:59 2012
@@ -25,7 +25,7 @@ import org.ofbiz.base.util.UtilPropertie
 import org.ofbiz.service.eca.ServiceEcaUtil;
 import org.ofbiz.service.ModelPermGroup;
 import org.ofbiz.service.ModelPermission;
-import org.ofbiz.service.GenericDispatcher;
+import org.ofbiz.service.ServiceContainer;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilProperties;
 
@@ -331,7 +331,7 @@ List getEcaListForService(String selecte
 
 //Local Dispatchers
 dispArrList = new TreeSet();
-dispArrList.addAll(GenericDispatcher.getAllDispatcherNames());
+dispArrList.addAll(ServiceContainer.getAllDispatcherNames());
 context.dispArrList = dispArrList;
 
 uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
@@ -339,9 +339,8 @@ uiLabelMap.addBottomResourceBundle("Comm
 
 selDisp = parameters.selDisp ?: "webtools";
 
-curLocalDispatcher = dispatcher.getLocalDispatcher(selDisp, delegator);
-curDispatchContext = curLocalDispatcher.getDispatchContext();
-context.dispatcherName = curLocalDispatcher.getName();
+curDispatchContext = dispatcher.getDispatchContext();
+context.dispatcherName = dispatcher.getName();
 
 selectedService = parameters.sel_service_name;
 

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/ScheduleJob.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/ScheduleJob.groovy?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/ScheduleJob.groovy (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/ScheduleJob.groovy Tue Aug  7 06:25:59 2012
@@ -27,7 +27,6 @@ import java.sql.Timestamp;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.service.ServiceDispatcher;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.ModelService;
 import org.ofbiz.service.ModelParam;

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/Threads.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/Threads.groovy?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/Threads.groovy (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/actions/service/Threads.groovy Tue Aug  7 06:25:59 2012
@@ -25,7 +25,6 @@ import java.util.Map;
 import java.sql.Timestamp;
 
 import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.service.ServiceDispatcher;
 import org.ofbiz.service.RunningService;
 import org.ofbiz.service.engine.GenericEngine;
 import org.ofbiz.base.util.UtilHttp;
@@ -35,19 +34,9 @@ uiLabelMap = UtilProperties.getResourceB
 uiLabelMap.addBottomResourceBundle("CommonUiLabels");
 
 threads = [];
-jobs = dispatcher.getJobManager().processList();
-jobs.each { job ->
-    state = job.status;
-    switch (state) {
-        case 0 : status = uiLabelMap.WebtoolsStatusSleeping; break;
-        case 1 : status = uiLabelMap.WebtoolsStatusRunning; break;
-        case -1: status = uiLabelMap.WebtoolsStatusShuttingDown; break;
-        default: status = uiLabelMap.WebtoolsStatusInvalid; break;
-    }
-    job.status = status;
-    threads.add(job);
-}
-context.threads = threads;
+poolState = dispatcher.getJobManager().getPoolState();
+context.poolState = poolState;
+context.threads = poolState.taskList;
 
 // Some stuff for general threads on the server
 currentThread = Thread.currentThread();

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/controller.xml?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/controller.xml Tue Aug  7 06:25:59 2012
@@ -226,6 +226,18 @@ under the License.
         <security https="true" auth="true"/>
         <response name="success" type="view" value="StatBinsHistory"/>
     </request-map>
+    <request-map uri="ViewMetrics">
+        <security https="true" auth="true"/>
+        <metric name="URL: webtools/ViewMetrics" /><!-- Here for demonstration -->
+        <response name="success" type="view" value="ViewMetrics"/>
+    </request-map>
+    <request-map uri="ResetMetric">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="resetMetric"/>
+        <response name="success" type="view" value="ViewMetrics"/>
+        <response name="error" type="view" value="ViewMetrics"/>
+    </request-map>
+
 
     <!-- Loggin Setup -->
     <request-map uri="LogConfiguration">
@@ -639,6 +651,7 @@ under the License.
 
     <view-map name="StatsSinceStart" type="screen" page="component://webtools/widget/StatsScreens.xml#StatsSinceStart"/>
     <view-map name="StatBinsHistory" type="screen" page="component://webtools/widget/StatsScreens.xml#StatBinsHistory"/>
+    <view-map name="ViewMetrics" type="screen" page="component://webtools/widget/StatsScreens.xml#ViewMetrics"/>
 
     <view-map name="EntityPerformanceTest" type="screen" page="component://webtools/widget/EntityScreens.xml#EntityPerformanceTest"/>
 
@@ -668,7 +681,6 @@ under the License.
     <view-map name="EntityImportReaders" page="component://webtools/widget/EntityScreens.xml#EntityImportReaders" type="screen"/>
 
     <view-map name="ViewComponents" page="component://webtools/widget/MiscScreens.xml#ViewComponents" type="screen"/>
-    <view-map name="minervaobjects" page="component://webtools/widget/EntityScreens.xml#minervaobjects" type="screen"/>
 
     <!-- cert views -->
     <view-map name="viewbrowsercerts" type="screen" page="component://webtools/widget/CommonScreens.xml#browsercerts"/>

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/web.xml?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/web.xml (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/WEB-INF/web.xml Tue Aug  7 06:25:59 2012
@@ -35,16 +35,6 @@ under the License.
     <!--<description>A unique name used to identify/recognize the local dispatcher for the Service Engine</description>-->
   </context-param>
   <context-param>
-    <param-name>serviceReaderUrls</param-name>
-    <param-value>/WEB-INF/services.xml</param-value>
-    <!--<description>Configuration File(s) For The Service Dispatcher</description>-->
-  </context-param>
-  <context-param>
-    <param-name>scriptLocationPath</param-name>
-    <param-value>/WEB-INF/bsh</param-value>
-    <!--<description>BeanShell Script Location</description>-->
-  </context-param>
-  <context-param>
     <param-name>xmlrpc.enabledForExtensions</param-name>
     <param-value>true</param-value>
   </context-param>

Modified: ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/main.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/main.ftl?rev=1370126&r1=1370125&r2=1370126&view=diff
==============================================================================
--- ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/main.ftl (original)
+++ ofbiz/branches/jackrabbit20120501/framework/webtools/webapp/webtools/main.ftl Tue Aug  7 06:25:59 2012
@@ -61,7 +61,6 @@ under the License.
           <li><a href="<@o...@ofbizUrl>">${uiLabelMap.WebtoolsExportEntityEoModelBundle}</a></li>
           <li><a href="<@o...@ofbizUrl>">${uiLabelMap.WebtoolsCheckUpdateDatabase}</a></li>
           <li><a href="<@o...@ofbizUrl>">${uiLabelMap.ConnectionPoolStatus}</a></li>
-          <#-- not using Minerva by default any more <li><a href="<@o...@ofbizUrl>">Minerva Connection Info</a></li> -->
           <#-- want to leave these out because they are only working so-so, and cause people more problems that they solve, IMHO
             <li><a href="<@o...@ofbizUrl>"  target="_blank">Edit Entity Definitions</a></li>
             <li><a href="<@o...@ofbizUrl>" target="_blank">Generate Entity Model XML (all in one)</a></li>