svn commit: r1356181 [6/8] - in /ofbiz/branches/20120329_portletWidget: ./ applications/accounting/ applications/accounting/data/ applications/accounting/script/org/ofbiz/accounting/payment/ applications/accounting/src/org/ofbiz/accounting/payment/ app...

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

svn commit: r1356181 [6/8] - in /ofbiz/branches/20120329_portletWidget: ./ applications/accounting/ applications/accounting/data/ applications/accounting/script/org/ofbiz/accounting/payment/ applications/accounting/src/org/ofbiz/accounting/payment/ app...

erwan
Modified: ofbiz/branches/20120329_portletWidget/framework/service/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/ofbiz-component.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/ofbiz-component.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/ofbiz-component.xml Mon Jul  2 11:02:34 2012
@@ -31,7 +31,8 @@ under the License.
     <entity-resource type="data" reader-name="seed" loader="main" location="data/ScheduledServiceData.xml"/>
     <entity-resource type="data" reader-name="seed-initial" loader="main" location="data/ScheduledServices.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/ServiceSeedData.xml"/>
-    <entity-resource type="data" reader-name="security" loader="main" location="data/ServiceSecurityData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/ServiceSecurityPermissionSeedData.xml"/>
+    <entity-resource type="data" reader-name="demo" loader="main" location="data/ServiceSecurityGroupDemoData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/ServiceDemoData.xml"/>
 
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/ServiceDispatcher.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/ServiceDispatcher.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/ServiceDispatcher.java Mon Jul  2 11:02:34 2012
@@ -1080,15 +1080,6 @@ public class ServiceDispatcher {
         ServiceDispatcher.enableJMS = enable;
     }
 
-
-    /**
-     * Get Enabled/Disabled JMS listeners status
-     * @return boolean true is JMS listeners are enabled
-     */
-    public static boolean getEnableJMS() {
-        return ServiceDispatcher.enableJMS;
-    }
-
     /**
      * Enables/Disables the startup services globally
      * (this will not effect any dispatchers already running)

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/ServiceUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/ServiceUtil.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/ServiceUtil.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/ServiceUtil.java Mon Jul  2 11:02:34 2012
@@ -184,6 +184,9 @@ public class ServiceUtil {
      *<b>security check</b>: userLogin partyId must equal partyId, or must have [secEntity][secOperation] permission
      */
     public static String getPartyIdCheckSecurity(GenericValue userLogin, Security security, Map<String, ? extends Object> context, Map<String, Object> result, String secEntity, String secOperation) {
+        return getPartyIdCheckSecurity(userLogin, security, context, result, secEntity, secOperation, null, null);
+    }
+    public static String getPartyIdCheckSecurity(GenericValue userLogin, Security security, Map<String, ? extends Object> context, Map<String, Object> result, String secEntity, String secOperation, String adminSecEntity, String adminSecOperation) {
         String partyId = (String) context.get("partyId");
         Locale locale = getLocale(context);
         if (UtilValidate.isEmpty(partyId)) {
@@ -198,9 +201,9 @@ public class ServiceUtil {
             return partyId;
         }
 
-        // <b>security check</b>: userLogin partyId must equal partyId, or must have PARTYMGR_CREATE permission
+        // <b>security check</b>: userLogin partyId must equal partyId, or must have either of the two permissions
         if (!partyId.equals(userLogin.getString("partyId"))) {
-            if (!security.hasEntityPermission(secEntity, secOperation, userLogin)) {
+            if (!security.hasEntityPermission(secEntity, secOperation, userLogin) && !(adminSecEntity != null && adminSecOperation != null && security.hasEntityPermission(adminSecEntity, adminSecOperation, userLogin))) {
                 result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);
                 String errMsg = UtilProperties.getMessage(ServiceUtil.resource, "serviceUtil.no_permission_to_operation", locale) + ".";
                 result.put(ModelService.ERROR_MESSAGE, errMsg);

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/GenericServiceJob.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/GenericServiceJob.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/GenericServiceJob.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/GenericServiceJob.java Mon Jul  2 11:02:34 2012
@@ -24,7 +24,7 @@ import org.ofbiz.base.util.Debug;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericRequester;
 import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.service.ModelService;
+import org.ofbiz.service.ServiceUtil;
 
 /**
  * Generic Service Job - A generic async-service Job.
@@ -64,17 +64,16 @@ public class GenericServiceJob extends A
     public void exec() throws InvalidJobException {
         init();
 
+        Map<String, Object> result = null;
         // no transaction is necessary since runSync handles this
         try {
             // get the dispatcher and invoke the service via runSync -- will run all ECAs
             LocalDispatcher dispatcher = dctx.getDispatcher();
-            Map<String, Object> result = dispatcher.runSync(getServiceName(), getContext());
+            result = dispatcher.runSync(getServiceName(), getContext());
 
             // check for a failure
-            boolean isError = ModelService.RESPOND_ERROR.equals(result.get(ModelService.RESPONSE_MESSAGE));
-            if (isError) {
-                 String errorMessage = (String) result.get(ModelService.ERROR_MESSAGE);
-                 this.failed(new Exception(errorMessage));
+            if (ServiceUtil.isError(result)) {
+                 this.failed(new Exception(ServiceUtil.getErrorMessage(result)));
             }
 
             if (requester != null) {
@@ -92,7 +91,7 @@ public class GenericServiceJob extends A
         }
 
         // call the finish method
-        this.finish();
+        this.finish(result);
     }
 
     /**
@@ -105,7 +104,7 @@ public class GenericServiceJob extends A
     /**
      * Method is called after the service has finished.
      */
-    protected void finish() throws InvalidJobException {
+    protected void finish(Map<String, Object> result) throws InvalidJobException {
         if (Debug.verboseOn()) Debug.logVerbose("Async-Service finished.", module);
         runtime = 0;
     }

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/JobManager.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/JobManager.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/JobManager.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/JobManager.java Mon Jul  2 11:02:34 2012
@@ -410,6 +410,7 @@ public class JobManager {
 
         // set the max retry
         jFields.put("maxRetry", Long.valueOf(maxRetry));
+        jFields.put("currentRetryCount", new Long(0));
 
         // create the value and store
         GenericValue jobV;

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/job/PersistedServiceJob.java Mon Jul  2 11:02:34 2012
@@ -49,6 +49,8 @@ import org.ofbiz.service.calendar.Recurr
 import org.ofbiz.service.config.ServiceConfigUtil;
 import org.xml.sax.SAXException;
 
+import org.apache.commons.lang.StringUtils;
+
 /**
  * Entity Service Job - Store => Schedule => Run
  */
@@ -61,6 +63,7 @@ public class PersistedServiceJob extends
     private Timestamp storedDate = null;
     private long nextRecurrence = -1;
     private long maxRetry = -1;
+    private long currentRetryCount = 0;
     private boolean warningLogged = false;
 
     /**
@@ -77,7 +80,14 @@ public class PersistedServiceJob extends
         this.storedDate = jobValue.getTimestamp("runTime");
         this.runtime = storedDate.getTime();
         this.maxRetry = jobValue.get("maxRetry") != null ? jobValue.getLong("maxRetry").longValue() : -1;
-        
+        Long retryCount = jobValue.getLong("currentRetryCount");
+        if (retryCount != null) {
+            this.currentRetryCount = retryCount.longValue();
+        } else {
+            // backward compatibility
+            this.currentRetryCount = PersistedServiceJob.getRetries(jobValue, this.delegator);
+        }
+
         // Debug.logInfo("=============== New PersistedServiceJob, delegator from dctx is [" + dctx.getDelegator().getDelegatorName() + "] and delegator from jobValue is [" + jobValue.getDelegator().getDelegatorName() + "]", module);
     }
 
@@ -171,7 +181,7 @@ public class PersistedServiceJob extends
                 }
                 Calendar next = expr.next(Calendar.getInstance());
                 if (next != null) {
-                    createRecurrence(job, next.getTimeInMillis());
+                    createRecurrence(job, next.getTimeInMillis(), false);
                 }
             }
         } catch (GenericEntityException e) {
@@ -180,7 +190,7 @@ public class PersistedServiceJob extends
         if (Debug.infoOn()) Debug.logInfo("Job  [" + getJobName() + "] Id ["  + getJobId() + "] -- Next runtime: " + new Date(nextRecurrence), module);
     }
 
-    private void createRecurrence(GenericValue job, long next) throws GenericEntityException {
+    private void createRecurrence(GenericValue job, long next, boolean isRetryOnFailure) throws GenericEntityException {
         if (Debug.verboseOn()) Debug.logVerbose("Next runtime returned: " + next, module);
 
         if (next > runtime) {
@@ -196,6 +206,11 @@ public class PersistedServiceJob extends
             newJob.set("startDateTime", null);
             newJob.set("runByInstanceId", null);
             newJob.set("runTime", new java.sql.Timestamp(next));
+            if (isRetryOnFailure) {
+                newJob.set("currentRetryCount", new Long(currentRetryCount + 1));
+            } else {
+                newJob.set("currentRetryCount", new Long(0));
+            }
             nextRecurrence = next;
             delegator.createSetNextSeqId(newJob);
             if (Debug.verboseOn()) Debug.logVerbose("Created next job entry: " + newJob, module);
@@ -206,8 +221,8 @@ public class PersistedServiceJob extends
      * @see org.ofbiz.service.job.GenericServiceJob#finish()
      */
     @Override
-    protected void finish() throws InvalidJobException {
-        super.finish();
+    protected void finish(Map<String, Object> result) throws InvalidJobException {
+        super.finish(result);
 
         // set the finish date
         GenericValue job = getJob();
@@ -216,6 +231,15 @@ public class PersistedServiceJob extends
             job.set("statusId", "SERVICE_FINISHED");
         }
         job.set("finishDateTime", UtilDateTime.nowTimestamp());
+        String jobResult = null;
+        if (ServiceUtil.isError(result)) {
+            jobResult = StringUtils.substring(ServiceUtil.getErrorMessage(result), 0, 255);
+        } else {
+            jobResult = StringUtils.substring(ServiceUtil.makeSuccessMessage(result, "", "", "", ""), 0, 255);
+        }
+        if (UtilValidate.isNotEmpty(jobResult)) {
+            job.set("jobResult", jobResult);
+        }
         try {
             job.store();
         } catch (GenericEntityException e) {
@@ -240,7 +264,7 @@ public class PersistedServiceJob extends
                 cal.add(Calendar.MINUTE, ServiceConfigUtil.getFailedRetryMin());
                 long next = cal.getTimeInMillis();
                 try {
-                    createRecurrence(job, next);
+                    createRecurrence(job, next, true);
                 } catch (GenericEntityException gee) {
                     Debug.logError(gee, "ERROR: Unable to re-schedule job [" + getJobId() + "] to re-run : " + job, module);
                 }
@@ -252,6 +276,7 @@ public class PersistedServiceJob extends
         // set the failed status
         job.set("statusId", "SERVICE_FAILED");
         job.set("finishDateTime", UtilDateTime.nowTimestamp());
+        job.set("jobResult", StringUtils.substring(t.getMessage(), 0, 255));
         try {
             job.store();
         } catch (GenericEntityException e) {
@@ -327,8 +352,7 @@ public class PersistedServiceJob extends
     }
 
     // returns the number of current retries
-    private long getRetries() throws InvalidJobException {
-        GenericValue job = this.getJob();
+    private static long getRetries(GenericValue job, Delegator delegator) {
         String pJobId = job.getString("parentJobId");
         if (pJobId == null) {
             return 0;
@@ -349,9 +373,6 @@ public class PersistedServiceJob extends
         if (maxRetry == -1) {
             return true;
         }
-        if (this.getRetries() < maxRetry) {
-            return true;
-        }
-        return false;
+        return currentRetryCount < maxRetry;
     }
 }

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java Mon Jul  2 11:02:34 2012
@@ -67,7 +67,7 @@ public class JavaMailContainer implement
 
     protected String configFile = null;
     protected Map<Store, Session> stores = null;
-
+    private String name;
     /**
      * Initialize the container
      *
@@ -76,7 +76,8 @@ public class JavaMailContainer implement
      * @throws org.ofbiz.base.container.ContainerException
      *
      */
-    public void init(String[] args, String configFile) throws ContainerException {
+    public void init(String[] args, String name, String configFile) throws ContainerException {
+        this.name = name;
         this.configFile = configFile;
         this.stores = new LinkedHashMap<Store, Session>();
         this.pollTimer = new Timer();
@@ -90,7 +91,7 @@ public class JavaMailContainer implement
      *
      */
     public boolean start() throws ContainerException {
-        ContainerConfig.Container cfg = ContainerConfig.getContainer("javamail-container", configFile);
+        ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
         String dispatcherName = ContainerConfig.getPropertyValue(cfg, "dispatcher-name", "JavaMailDispatcher");
         String delegatorName = ContainerConfig.getPropertyValue(cfg, "delegator-name", "default");
         this.deleteMail = "true".equals(ContainerConfig.getPropertyValue(cfg, "delete-mail", "false"));
@@ -145,6 +146,10 @@ public class JavaMailContainer implement
         Debug.logWarning("stop JavaMail poller", module);
     }
 
+    public String getName() {
+        return name;
+    }
+
     // java-mail methods
     protected Session makeSession(ContainerConfig.Container.Property client) {
         Properties props = new Properties();

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java Mon Jul  2 11:02:34 2012
@@ -45,19 +45,20 @@ public class RmiServiceContainer impleme
     protected RemoteDispatcherImpl remote = null;
     protected String configFile = null;
     protected String name = null;
-
+    private String containerName;
     // Container methods
 
     /**
      * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String)
      */
-    public void init(String[] args, String configFile) {
+    public void init(String[] args, String name, String configFile) {
+        this.containerName = name;
         this.configFile = configFile;
     }
 
     public boolean start() throws ContainerException {
         // get the container config
-        ContainerConfig.Container cfg = ContainerConfig.getContainer("rmi-dispatcher", configFile);
+        ContainerConfig.Container cfg = ContainerConfig.getContainer(containerName, configFile);
         ContainerConfig.Container.Property initialCtxProp = cfg.getProperty("use-initial-context");
         ContainerConfig.Container.Property lookupHostProp = cfg.getProperty("bound-host");
         ContainerConfig.Container.Property lookupPortProp = cfg.getProperty("bound-port");
@@ -170,4 +171,8 @@ public class RmiServiceContainer impleme
     public void stop() throws ContainerException {
         remote.deregister();
     }
+
+    public String getName() {
+        return containerName;
+    }
 }

Modified: ofbiz/branches/20120329_portletWidget/framework/start/src/org/ofbiz/base/start/jetty.properties
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/start/src/org/ofbiz/base/start/jetty.properties?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/start/src/org/ofbiz/base/start/jetty.properties (original)
+++ ofbiz/branches/20120329_portletWidget/framework/start/src/org/ofbiz/base/start/jetty.properties Mon Jul  2 11:02:34 2012
@@ -48,7 +48,7 @@ ofbiz.admin.key=so3du5kasd5dn
 #ofbiz.log.dir=runtime/logs
 
 # --- Location (relative to ofbiz.home) for (normal) container configuration
-ofbiz.container.config=framework/base/config/jetty-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

Modified: ofbiz/branches/20120329_portletWidget/framework/testtools/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/testtools/build.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/testtools/build.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/testtools/build.xml Mon Jul  2 11:02:34 2012
@@ -32,7 +32,6 @@ under the License.
     <path id="local.class.path">
         <fileset dir="${lib.dir}" includes="*.jar"/>
         <fileset dir="../base/lib" includes="*.jar"/>
-        <fileset dir="../base/lib/scripting" includes="*.jar"/>
         <fileset dir="../base/lib/j2eespecs" includes="*.jar"/>
         <fileset dir="../base/lib/commons" includes="*.jar"/>
         <fileset dir="../base/build/lib" includes="*.jar"/>
@@ -42,59 +41,10 @@ under the License.
         <fileset dir="../service/lib" includes="*.jar"/>
         <fileset dir="../service/build/lib" includes="*.jar"/>
         <fileset dir="../minilang/build/lib" includes="*.jar"/>
-        <fileset dir="../webapp/lib" includes="*.jar"/>
     </path>
     
     <path id="runtime.class.path">
         <fileset dir="${build.dir}/lib" includes="*.jar"/>
     </path>    
     
-    <target name="init">
-        
-        <property name="lib.dir" value="lib"/>
-        <property name="selenium.lib.dir" value="${lib.dir}"/>
-    </target>
-
-    <target name="run-seleniumxml" depends="init, jar" description="Runs the selenium xml test cases">
-        <java classname="org.ofbiz.testtools.seleniumxml.SeleniumXml" fork="true">
-            <jvmarg value="-Dselenium.config=config/seleniumXml.properties"/>
-            <arg value="testdef/seleniumxml/example/example_testsuite.xml"/>
-            <classpath>
-                   <path refid="runtime.class.path"/>
-                <path refid="local.class.path"/>
-              </classpath>
-        </java>
-    </target>
-
-    <target name="run-seleniumserver" depends="init, jar" description="Runs the selenium RC server">
-        <java jar="../../framework/testtools/lib/selenium-server.jar" fork="true">
-            <!-- arg value="-timeout 240"/ -->
-            <classpath>
-                   <path refid="runtime.class.path"/>
-                <path refid="local.class.path"/>
-              </classpath>
-            <arg value="-timeout"/>
-            <arg value="240"/>
-            <arg value="-firefoxProfileTemplate"/>
-            <arg value="./config/firefox_profile"/>
-        </java>
-    </target>
-    
-    <target name="install-seleniumxml" depends="init" description="Download the selenium files">
-        <!--
-            Quick way to download and extract the selenium-server.jar
-            If someone has a better way to do the same, please suggest !
-        -->
-        <get src="http://selenium.googlecode.com/files/selenium-remote-control-1.0.3.zip"
-             dest="${selenium.lib.dir}/selenium-remote-control-1.0.3.zip" usetimestamp="true" verbose="true"/>
-        <unzip src="${selenium.lib.dir}/selenium-remote-control-1.0.3.zip"
-                dest="${selenium.lib.dir}">
-            <patternset>
-                <include name="selenium-server-1.0.3/selenium-server.jar"/>
-            </patternset>
-        </unzip>
-        <move file="${selenium.lib.dir}/selenium-server-1.0.3/selenium-server.jar" todir="${selenium.lib.dir}"/>
-        <delete dir="${selenium.lib.dir}/selenium-server-1.0.3"/>
-        <delete file="${selenium.lib.dir}/selenium-remote-control-1.0.3.zip"/>
-    </target>
 </project>

Modified: ofbiz/branches/20120329_portletWidget/framework/testtools/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/testtools/ofbiz-component.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/testtools/ofbiz-component.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/testtools/ofbiz-component.xml Mon Jul  2 11:02:34 2012
@@ -23,8 +23,7 @@
     xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
     <!-- define resource loaders; most common is to use the component resource loader -->
     <resource-loader name="main" type="component"/>
-    <classpath type="dir" location="config"/>
-    
+
     <!-- place the config directory on the classpath to access configuration files -->
     <classpath type="dir" location="dtd"/>
     
@@ -32,10 +31,8 @@
     <classpath type="jar" location="lib/*"/>
     <classpath type="jar" location="build/lib/*"/>
     
-    <!-- entitydef -->
-    <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
-    
     <!-- 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"/>
 </ofbiz-component>
\ No newline at end of file

Modified: ofbiz/branches/20120329_portletWidget/framework/testtools/src/org/ofbiz/testtools/TestListContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/testtools/src/org/ofbiz/testtools/TestListContainer.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/testtools/src/org/ofbiz/testtools/TestListContainer.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/testtools/src/org/ofbiz/testtools/TestListContainer.java Mon Jul  2 11:02:34 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";
 
@@ -59,7 +61,8 @@ public class TestListContainer implement
     /**
      * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String)
      */
-    public void init(String[] args, String configFile) {
+    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])) {
@@ -121,4 +124,8 @@ public class TestListContainer implement
 
     public void stop() throws ContainerException {
     }
+
+    public String getName() {
+       return name;
+    }
 }

Modified: ofbiz/branches/20120329_portletWidget/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/testtools/src/org/ofbiz/testtools/TestRunContainer.java Mon Jul  2 11:02:34 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,10 +57,13 @@ public class TestRunContainer implements
     protected String testCase = null;
     protected String logLevel = null;
 
+    private String name;
+
     /**
      * @see org.ofbiz.base.container.Container#init(java.lang.String[], java.lang.String)
      */
-    public void init(String[] args, String configFile) {
+    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++) {
@@ -198,6 +202,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/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Mon Jul  2 11:02:34 2012
@@ -305,7 +305,7 @@ public class ContextFilter implements Fi
                     config.getServletContext().setAttribute("delegator", delegator);
 
                     // clear web context objects
-                    config.getServletContext().setAttribute("authorization", null);
+                    config.getServletContext().setAttribute("authz", null);
                     config.getServletContext().setAttribute("security", null);
                     config.getServletContext().setAttribute("dispatcher", null);
 
@@ -317,10 +317,10 @@ public class ContextFilter implements Fi
                     LocalDispatcher dispatcher = getDispatcher(config.getServletContext());
 
                     // set web context objects
-                    httpRequest.getSession().setAttribute("dispatcher", dispatcher);
-                    httpRequest.getSession().setAttribute("security", security);
+                    request.setAttribute("dispatcher", dispatcher);
+                    request.setAttribute("security", security);
                     
-                    httpRequest.setAttribute("tenantId", tenantId);
+                    request.setAttribute("tenantId", tenantId);
                 }
 
                 // NOTE DEJ20101130: do NOT always put the delegator name in the user's session because the user may
@@ -420,7 +420,7 @@ public class ContextFilter implements Fi
     }
 
     protected Authorization getAuthz() {
-        Authorization authz = (Authorization) config.getServletContext().getAttribute("authorization");
+        Authorization authz = (Authorization) config.getServletContext().getAttribute("authz");
         if (authz == null) {
             Delegator delegator = (Delegator) config.getServletContext().getAttribute("delegator");
 

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java Mon Jul  2 11:02:34 2012
@@ -96,7 +96,7 @@ public class ControlServlet extends Http
         RequestHandler requestHandler = this.getRequestHandler();
         HttpSession session = request.getSession();
 
-        // setup DEFAULT chararcter encoding and content type, this will be overridden in the RequestHandler for view rendering
+        // setup DEFAULT character encoding and content type, this will be overridden in the RequestHandler for view rendering
         String charset = getServletContext().getInitParameter("charset");
         if (UtilValidate.isEmpty(charset)) charset = request.getCharacterEncoding();
         if (UtilValidate.isEmpty(charset)) charset = "UTF-8";
@@ -224,10 +224,17 @@ public class ControlServlet extends Http
             requestHandler.doRequest(request, response, null, userLogin, delegator);
         } catch (RequestHandlerException e) {
             Throwable throwable = e.getNested() != null ? e.getNested() : e;
-            Debug.logError(throwable, "Error in request handler: ", module);
-            StringUtil.HtmlEncoder encoder = new StringUtil.HtmlEncoder();
-            request.setAttribute("_ERROR_MESSAGE_", encoder.encode(throwable.toString()));
-            errorPage = requestHandler.getDefaultErrorPage(request);
+            if (throwable instanceof IOException) {
+                // when an IOException occurs (most of the times caused by the browser window being closed before the request is completed)
+                // the connection with the browser is lost and so there is no need to serve the error page; a message is logged to record the event
+                if (Debug.warningOn()) Debug.logWarning("Communication error with the client while processing the request: " + request.getAttribute("_CONTROL_PATH_") + request.getPathInfo(), module);
+                if (Debug.verboseOn()) Debug.logVerbose(throwable, module);
+            } else {
+                Debug.logError(throwable, "Error in request handler: ", module);
+                StringUtil.HtmlEncoder encoder = new StringUtil.HtmlEncoder();
+                request.setAttribute("_ERROR_MESSAGE_", encoder.encode(throwable.toString()));
+                errorPage = requestHandler.getDefaultErrorPage(request);
+            }
         } catch (Exception e) {
             Debug.logError(e, "Error in request handler: ", module);
             StringUtil.HtmlEncoder encoder = new StringUtil.HtmlEncoder();

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Mon Jul  2 11:02:34 2012
@@ -39,18 +39,16 @@ import javolution.util.FastList;
 import javolution.util.FastMap;
 
 import org.ofbiz.base.component.ComponentConfig;
-import org.ofbiz.base.container.ContainerConfig;
-import org.ofbiz.base.container.ContainerException;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.KeyStoreUtil;
 import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.StringUtil.StringWrapper;
 import org.ofbiz.base.util.UtilFormatOut;
 import org.ofbiz.base.util.UtilHttp;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.StringUtil.StringWrapper;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericEntityException;
@@ -447,7 +445,7 @@ public class LoginWorker {
 
             if (setupNewDelegatorEtc) {
                 // now set the delegator and dispatcher in a bunch of places just in case they were changed
-                setWebContextObjects(request, response, delegator, dispatcher, true);
+                setWebContextObjects(request, response, delegator, dispatcher);
             }
 
             // check to see if a password change is required for the user
@@ -477,47 +475,28 @@ public class LoginWorker {
         }
     }
 
-    /*         persistSerialized is set at false in the context of a cluster when using (at least) DeltaManager.
-            Because we have no easy ways to set DeltaManager.pathname to null from OFBiz
-           So persistSerialized is set to true when login out. This prevent a NPE due to non serialized objects put in session*/
-    private static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher, Boolean persistSerialized) {
+    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
+        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);
+        }
 
-        // NOTE: we do NOT want to set this in the servletContet, only in the request and session
         session.setAttribute("delegatorName", delegator.getDelegatorName());
-
         request.setAttribute("delegator", delegator);
-        if (!persistSerialized) {
-            session.setAttribute("delegator", null);
-        } else {
-            session.setAttribute("delegator", delegator);
-        }
-
         request.setAttribute("dispatcher", dispatcher);
-        if (!persistSerialized) {
-            session.setAttribute("dispatcher", null);
-        } else {
-            session.setAttribute("dispatcher", dispatcher);
-        }
-
-        if (persistSerialized) {
-            // we also need to setup the security and authz objects since they are dependent on the delegator
-            try {
-                Security security = SecurityFactory.getInstance(delegator);
-                request.setAttribute("security", security);
-                session.setAttribute("security", security);
-            } catch (SecurityConfigurationException e) {
-                Debug.logError(e, module);
-            }
-
-            try {
-                Authorization authz = AuthorizationFactory.getInstance(delegator);
-                request.setAttribute("authz", authz);
-                session.setAttribute("authz", authz);
-            } catch (SecurityConfigurationException e) {
-                Debug.logError(e, module);
-            }
-        }
+        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");
@@ -652,22 +631,7 @@ public class LoginWorker {
 
             delegator = DelegatorFactory.getDelegator(delegatorName);
             LocalDispatcher dispatcher = ContextFilter.makeWebappDispatcher(session.getServletContext(), delegator);
-            // get the container configuration
-            String ofbizHome = System.getProperty("ofbiz.home");
-            String configFile = ofbizHome + "/framework/base/config/ofbiz-containers.xml";
-            ContainerConfig.Container cc = null;
-            String mgrClassName = null;
-            try {
-                cc = ContainerConfig.getContainer("catalina-container", configFile);
-                mgrClassName = ContainerConfig.getPropertyValue(cc, "manager-class", "org.apache.catalina.ha.session.DeltaManager");
-            } catch (ContainerException e) {
-                Debug.logError(e, "No catalina-container configuration found in container config!");
-            }
-            if ("org.apache.catalina.ha.session.DeltaManager".equals(mgrClassName)) {
-                setWebContextObjects(request, response, delegator, dispatcher, false);
-            } else {
-                setWebContextObjects(request, response, delegator, dispatcher, true);
-            }
+            setWebContextObjects(request, response, delegator, dispatcher);
         }
 
         // DON'T save the cart, causes too many problems: if (shoppingCart != null) session.setAttribute("shoppingCart", new WebShoppingCart(shoppingCart, session));
@@ -981,7 +945,7 @@ public class LoginWorker {
             if (!oldDelegatorName.equals(userLogin.getDelegator().getDelegatorName())) {
                 delegator = DelegatorFactory.getDelegator(userLogin.getDelegator().getDelegatorName());
                 dispatcher = ContextFilter.makeWebappDispatcher(servletContext, delegator);
-                setWebContextObjects(request, response, delegator, dispatcher, true);
+                setWebContextObjects(request, response, delegator, dispatcher);
             }
             // found userLogin, do the external login...
 
@@ -1024,15 +988,13 @@ public class LoginWorker {
     }
 
     protected static boolean hasBasePermission(GenericValue userLogin, HttpServletRequest request) {
-        ServletContext context = (ServletContext) request.getAttribute("servletContext");
-        Authorization authz = (Authorization) request.getAttribute("authz");
         Security security = (Security) request.getAttribute("security");
-
-        String serverId = (String) context.getAttribute("_serverId");
-        String contextPath = request.getContextPath();
-
-        ComponentConfig.WebappInfo info = ComponentConfig.getWebAppInfo(serverId, contextPath);
         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) &&

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java Mon Jul  2 11:02:34 2012
@@ -97,96 +97,6 @@ public class CoreEvents {
     }
 
     /**
-     * Change delegator event. Changes the delegator for the current session
-     * @param request HttpServletRequest
-     * @param response HttpServletResponse
-     * @return Response code string
-     */
-    public static String changeDelegator(HttpServletRequest request, HttpServletResponse response) {
-        String delegatorName = request.getParameter("delegator");
-        Authorization authz = (Authorization) request.getAttribute("authz");
-        Locale locale = UtilHttp.getLocale(request);
-
-        if (!authz.hasPermission(request.getSession(), "ENTITY_MAINT", null)) {
-            String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.not_authorized_use_fct", locale);
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-        if (delegatorName == null) {
-            String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.delegator_not_passed", locale);
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        Delegator delegator = DelegatorFactory.getDelegator(delegatorName);
-
-        if (delegator == null) {
-            String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.no_delegator_name_defined", locale);
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        // now change the dispatcher to use this delegator
-        LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
-        DispatchContext dctx = dispatcher.getDispatchContext();
-        String dispatcherName = dispatcher.getName();
-
-        if (dispatcherName == null) {
-            String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.dispatcher_name_null", locale);
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-        if (dctx == null) {
-            String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.dispatcher_context_null", locale);
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherName, delegator);
-
-        request.getSession().setAttribute("delegator", delegator);
-        request.getSession().setAttribute("dispatcher", dispatcher);
-
-        return "success";
-    }
-
-    /**
-     * Change dispatcher event. Changes the dispatch for the current session
-     * @param request HttpServletRequest
-     * @param response HttpServletResponse
-     * @return Response code string
-     */
-    public static String changeDispatcher(HttpServletRequest request, HttpServletResponse response) {
-        String dispatcherName = request.getParameter("dispatcher");
-        Authorization authz = (Authorization) request.getAttribute("authz");
-        Locale locale = UtilHttp.getLocale(request);
-
-        if (!authz.hasPermission(request.getSession(), "ENTITY_MAINT", null)) {
-            String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.not_authorized_use_fct", locale);
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-        if (dispatcherName == null) {
-            String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.dispatcher_not_passed", locale);
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-
-        Delegator delegator = (Delegator) request.getAttribute("delegator");
-        ServiceDispatcher sd = ServiceDispatcher.getInstance(dispatcherName, delegator);
-
-        if (sd == null) {
-            String errMsg = UtilProperties.getMessage(CoreEvents.err_resource, "coreEvents.no_dispachter_name_registered", locale);
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);
-            return "error";
-        }
-        LocalDispatcher dispatcher = sd.getLocalContext(dispatcherName).getDispatcher();
-
-        request.getSession().setAttribute("dispatcher", dispatcher);
-        return "success";
-    }
-
-    /**
      * Schedule a service for a specific time or recurrence
      *  Request Parameters which are used for this service:
      *

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/config/WebtoolsUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/config/WebtoolsUiLabels.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/config/WebtoolsUiLabels.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/config/WebtoolsUiLabels.xml Mon Jul  2 11:02:34 2012
@@ -525,6 +525,9 @@
         <value xml:lang="zh">任务列表</value>
         <value xml:lang="zh_TW">任務列表</value>
     </property>
+    <property key="PageTitleJobDetails">
+        <value xml:lang="en">Job Details</value>
+    </property>
     <property key="PageTitleLogConfiguration">
         <value xml:lang="de">Log Konfiguration</value>
         <value xml:lang="en">Log Configuration</value>
@@ -823,6 +826,9 @@
         <value xml:lang="zh">缓存维护</value>
         <value xml:lang="zh_TW">緩存維護</value>
     </property>
+    <property key="WebtoolsCacheMemory">
+        <value xml:lang="en">Cache Memory</value>
+    </property>
     <property key="WebtoolsCacheName">
         <value xml:lang="de">Cache Name</value>
         <value xml:lang="en">Cache Name</value>
@@ -3996,6 +4002,9 @@
         <value xml:lang="zh">运行时间</value>
         <value xml:lang="zh_TW">運行時間</value>
     </property>
+    <property key="WebtoolsRunTimeDataInfo">
+        <value xml:lang="en">Run Time Data Info</value>
+    </property>
     <property key="WebtoolsSchedule">
         <value xml:lang="de">Einplanen</value>
         <value xml:lang="en">Schedule</value>

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/data/helpdata/HELP_WEBTOOLS.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/data/helpdata/HELP_WEBTOOLS.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/data/helpdata/HELP_WEBTOOLS.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/data/helpdata/HELP_WEBTOOLS.xml Mon Jul  2 11:02:34 2012
@@ -19,5 +19,4 @@ License.
     xmlns="http://docbook.org/ns/docbook">
     <title>The Webtools Introduction.</title>
     <xi:include href="HELP_WEBTOOLS_main.xml" />
-    <xi:include href="../../../testtools/data/helpdata/HELP_WEBTOOLS_selenium.xml" />
 </section>
\ No newline at end of file

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/data/helpdata/HELP_WEBTOOLS_main.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/data/helpdata/HELP_WEBTOOLS_main.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/data/helpdata/HELP_WEBTOOLS_main.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/data/helpdata/HELP_WEBTOOLS_main.xml Mon Jul  2 11:02:34 2012
@@ -47,8 +47,5 @@ License.
       <listitem>
         <para>The <link xl:href="">Portal Page Admin.</link> section is used to browse and edit all Portal Pages defined in the system.</para>
       </listitem>
-      <listitem>
-        <para>The <link xl:href="showHelp?helpTopic=WEBTOOLS_selenium">Tests</link> section is used to run system tests.</para>
-      </listitem>
     </itemizedlist>
 </section>

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/ofbiz-component.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/ofbiz-component.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/ofbiz-component.xml Mon Jul  2 11:02:34 2012
@@ -24,7 +24,8 @@ under the License.
     <resource-loader name="main" type="component"/>
     <classpath type="jar" location="build/lib/*"/>
     <classpath type="dir" location="config"/>
-    <entity-resource type="data" reader-name="security" loader="main" location="data/WebtoolsSecurityData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/WebtoolsSecurityPermissionSeedData.xml"/>
+    <entity-resource type="data" reader-name="demo" loader="main" location="data/WebtoolsSecurityGroupDemoData.xml"/>
     <service-resource type="model" loader="main" location="servicedef/services.xml"/>
     <webapp name="webtools"
         title="WebTools"

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/WEB-INF/actions/cache/FindUtilCache.groovy Mon Jul  2 11:02:34 2012
@@ -23,13 +23,8 @@ import org.ofbiz.security.Security;
 
 context.hasUtilCacheEdit = security.hasEntityPermission("UTIL_CACHE", "_EDIT", session);
 
-rt = Runtime.getRuntime();
-context.memory = UtilFormatOut.formatQuantity(rt.totalMemory());
-context.freeMemory = UtilFormatOut.formatQuantity(rt.freeMemory());
-context.usedMemory = UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory()));
-context.maxMemory = UtilFormatOut.formatQuantity(rt.maxMemory());
-
 cacheList = [];
+totalCacheMemory = 0.0;
 names = new TreeSet(UtilCache.getUtilCacheTableKeySet());
 names.each { cacheName ->
         utilCache = UtilCache.findCache(cacheName);
@@ -48,7 +43,9 @@ names.each { cacheName ->
         cache.expireTime = UtilFormatOut.formatQuantity(utilCache.getExpireTime());
         cache.useSoftReference = utilCache.getUseSoftReference().toString();
         cache.useFileSystemStore = utilCache.getUseFileSystemStore().toString();
-
+        cache.useFileSystemStore = utilCache.getUseFileSystemStore().toString();
+        cache.cacheMemory = utilCache.getSizeInBytes();
+        totalCacheMemory += cache.cacheMemory;
         cacheList.add(cache);
 }
 sortField = parameters.sortField;
@@ -57,3 +54,13 @@ if (sortField) {
 } else {
     context.cacheList = cacheList;
 }
+context.totalCacheMemory = totalCacheMemory;
+
+rt = Runtime.getRuntime();
+memoryInfo = [:];
+memoryInfo.memory = UtilFormatOut.formatQuantity(rt.totalMemory());
+memoryInfo.freeMemory = UtilFormatOut.formatQuantity(rt.freeMemory());
+memoryInfo.usedMemory = UtilFormatOut.formatQuantity((rt.totalMemory() - rt.freeMemory()));
+memoryInfo.maxMemory = UtilFormatOut.formatQuantity(rt.maxMemory());
+memoryInfo.totalCacheMemory = totalCacheMemory;
+context.memoryInfo = memoryInfo;

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/WEB-INF/controller.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/WEB-INF/controller.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/WEB-INF/controller.xml Mon Jul  2 11:02:34 2012
@@ -24,7 +24,6 @@ under the License.
     <include location="component://common/webcommon/WEB-INF/portal-controller.xml"/>
     <include location="component://common/webcommon/WEB-INF/security-controller.xml"/>
     <include location="component://common/webcommon/WEB-INF/tempexpr-controller.xml"/>
-    <include location="component://testtools/webapp/testtools/WEB-INF/controller.xml"/>
     <description>WebTools Site Configuration File</description>
 
     <handler name="ftl" type="view" class="org.ofbiz.webapp.ftl.FreeMarkerViewHandler"/>
@@ -92,12 +91,6 @@ under the License.
         <response name="success" type="url" value="http://www.yahoo.com"/>
     </request-map>
 
-    <request-map uri="changeDelegator">
-        <event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
-        <response name="success" type="view" value="main"/>
-        <response name="error" type="view" value="main"/>
-    </request-map>
-
     <request-map uri="view">
         <security https="true" auth="false"/>
         <response name="success" type="view" value="main"/>
@@ -277,6 +270,10 @@ under the License.
         <security https="true" auth="true"/>
         <response name="success" type="view" value="FindJob"/>
     </request-map>
+    <request-map uri="JobDetails">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="JobDetails"/>
+    </request-map>
     <request-map uri="cancelJob">
         <security https="true" auth="true"/>
         <event type="service" invoke="cancelScheduledJob"/>
@@ -650,6 +647,7 @@ under the License.
     <view-map name="ServiceLog" type="screen" page="component://webtools/widget/LogScreens.xml#ServiceLog"/>
     <view-map name="ServiceList" type="screen" page="component://webtools/widget/ServiceScreens.xml#ServiceList"/>
     <view-map name="FindJob" type="screen" page="component://webtools/widget/ServiceScreens.xml#FindJob"/>
+    <view-map name="JobDetails" type="screen" page="component://webtools/widget/ServiceScreens.xml#JobDetails"/>
     <view-map name="serviceResult" type="screen" page="component://webtools/widget/ServiceScreens.xml#ServiceResult"/>
     <view-map name="threadList" type="screen" page="component://webtools/widget/ServiceScreens.xml#ThreadList"/>
     <view-map name="scheduleJob" type="screen" page="component://webtools/widget/ServiceScreens.xml#ScheduleJob"/>

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/main.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/main.ftl?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/main.ftl (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/webapp/webtools/main.ftl Mon Jul  2 11:02:34 2012
@@ -116,8 +116,6 @@ under the License.
         </#if>
         <li><h3>${uiLabelMap.WebtoolsCertsX509}</h3></li>
         <li><a href="<@ofbizUrl>myCertificates</@ofbizUrl>">${uiLabelMap.WebtoolsMyCertificates}</a></li>
-        <li><h3>Selenium</h3></li>
-        <li><a href="<@ofbizUrl>selenium</@ofbizUrl>">Selenium</a></li>
       </ul>
     </#if>
   </div>

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/widget/CacheForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/widget/CacheForms.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/widget/CacheForms.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/widget/CacheForms.xml Mon Jul  2 11:02:34 2012
@@ -21,6 +21,13 @@ under the License.
 <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
 
+    <form name="MemoryInfo" type="single" default-map-name="memoryInfo">
+        <field name="memory" title="${uiLabelMap.WebtoolsTotalMemory}"><display/></field>
+        <field name="maxMemory" title="${uiLabelMap.WebtoolsMaxMemory}"><display/></field>
+        <field name="freeMemory" title="${uiLabelMap.WebtoolsFreeMemory}"><display/></field>
+        <field name="usedMemory" title="${uiLabelMap.WebtoolsUsedMemory}"><display/></field>
+        <field name="totalCacheMemory" title="${uiLabelMap.WebtoolsCacheMemory}"><display/></field>
+    </form>
     <form name="ListCache" type="list" list-name="cacheList" paginate-target="FindUtilCache" separate-columns="true" odd-row-style="alternate-row" default-table-style="basic-table hover-bar" header-row-style="header-row-2">
         <field name="cacheName" title="${uiLabelMap.WebtoolsCacheName}" sort-field="true"><display/></field>
         <field name="cacheSize" title="${uiLabelMap.WebtoolsSize}" sort-field="true"><display/></field>
@@ -31,6 +38,7 @@ under the License.
         <field name="expireTime" title="${uiLabelMap.WebtoolsExpireTime}" sort-field="true"><display/></field>
         <field name="useSoftReference" title="${uiLabelMap.WebtoolsUseSoftRef}" sort-field="true"><display/></field>
         <field name="useFileSystemStore" title="${uiLabelMap.WebtoolsUseFileStore}" sort-field="true"><display/></field>
+        <field name="cacheMemory" title="${uiLabelMap.WebtoolsCacheMemory}" sort-field="true"><display/></field>
         <field name="administration" title=" " widget-style="buttontext" use-when="hasUtilCacheEdit">
             <hyperlink description="${uiLabelMap.WebtoolsElements}" target="FindUtilCacheElements">
                 <parameter param-name="UTIL_CACHE_NAME" from-field="cacheName"/>

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/widget/CacheScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/widget/CacheScreens.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/widget/CacheScreens.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/widget/CacheScreens.xml Mon Jul  2 11:02:34 2012
@@ -36,9 +36,10 @@ under the License.
                                 <if-has-permission permission="UTIL_CACHE" action="_VIEW"/>
                             </condition>
                             <widgets>
+                                <screenlet title="${uiLabelMap.WebtoolsMemory}">
+                                    <include-form name="MemoryInfo" location="component://webtools/widget/CacheForms.xml"/>
+                                </screenlet>
                                 <screenlet>
-                                    <label>${uiLabelMap.WebtoolsMemory} ${uiLabelMap.WebtoolsTotalMemory} ${memory} ${uiLabelMap.WebtoolsFreeMemory} ${freeMemory} ${uiLabelMap.WebtoolsUsedMemory} ${usedMemory}
-                                        ${uiLabelMap.WebtoolsMaxMemory} ${maxMemory}</label>
                                     <include-menu name="FindCache" location="component://webtools/widget/Menus.xml"/>
                                     <include-form name="ListCache" location="component://webtools/widget/CacheForms.xml"/>
                                     <include-menu name="FindCache" location="component://webtools/widget/Menus.xml"/>

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/widget/Menus.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/widget/Menus.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/widget/Menus.xml Mon Jul  2 11:02:34 2012
@@ -58,9 +58,6 @@ under the License.
             </condition>
             <link target="security"/>
         </menu-item>
-        <menu-item name="tests" title="Tests">
-            <link target="selenium"/>
-        </menu-item>
         <menu-item name="LayoutDemo" title="${uiLabelMap.WebtoolsLayoutDemo}">
             <link target="WebtoolsLayoutDemo" />
         </menu-item>

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/widget/ServiceForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/widget/ServiceForms.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/widget/ServiceForms.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/widget/ServiceForms.xml Mon Jul  2 11:02:34 2012
@@ -42,7 +42,7 @@ under the License.
         </field>
         <field name="SERVICE_INTERVAL" title="${uiLabelMap.WebtoolsInterval}" tooltip="${uiLabelMap.WebtoolsForUseWithFrequency}"><text/></field>
         <field name="SERVICE_COUNT" title="${uiLabelMap.WebtoolsCount}" tooltip="${uiLabelMap.WebtoolsNumberOfTimeTheJobWillRun}"><text default-value="1"/></field>
-        <field name="SERVICE_MAXRETRY" title="${uiLabelMap.WebtoolsMaxRetry}" tooltip="${uiLabelMap.WebtoolsNumberOfJobRetry}"><text/></field>
+        <field name="SERVICE_MAXRETRY" title="${uiLabelMap.WebtoolsMaxRetry}" tooltip="${uiLabelMap.WebtoolsNumberOfJobRetry}"><text default-value="0"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonSubmit}"><submit button-type="button"/></field>
     </form>
 
@@ -60,7 +60,7 @@ under the License.
         <field name="jobId" title="${uiLabelMap.CommonId}"><text-find/></field>
         <field name="serviceName" title="${uiLabelMap.WebtoolsServiceName}"><text-find/></field>
         <field name="statusId" title="${uiLabelMap.CommonStatus}">
-            <drop-down allow-empty="true" current-description="" current="selected" no-current-selected-key="SERVICE_PENDING">
+            <drop-down allow-empty="true">
                 <entity-options description="${description}" key-field-name="statusId" entity-name="StatusItem">
                     <entity-constraint name="statusTypeId" operator="equals" value="SERVICE_STATUS"/>
                     <entity-order-by field-name="description"/>
@@ -82,7 +82,11 @@ under the License.
             </service>
         </actions>
         <field name="jobName" title="${uiLabelMap.WebtoolsJob}" sort-field="true"><display/></field>
-        <field name="jobId" title="${uiLabelMap.CommonId}" sort-field="true"><display/></field>
+        <field name="jobId" title="${uiLabelMap.CommonId}" sort-field="true">
+            <hyperlink also-hidden="false" description="${jobId}" target="JobDetails">
+                <parameter param-name="jobId" from-field="jobId"/>
+            </hyperlink>
+        </field>
         <field name="poolId" title="${uiLabelMap.WebtoolsPool}" sort-field="true"><display/></field>
         <field name="runTime" title="${uiLabelMap.WebtoolsRunTime}" sort-field="true"><display/></field>
         <field name="startDateTime" title="${uiLabelMap.CommonStartDateTime}" sort-field="true"><display/></field>
@@ -99,6 +103,13 @@ under the License.
             </hyperlink>
         </field>
     </form>
+    <form name="JobDetails" type="single">
+        <auto-fields-entity entity-name="JobSandbox" map-name="job" default-field-type="display"/>
+    </form>
+    <form name="JobRuntimeDataInfo" type="list" list-name="runtimeInfoList" default-table-style="basic-table hover-bar" paginate="false">
+        <field name="key"><display/></field>
+        <field name="value"><display/></field>
+    </form>
     <form name="ListJavaThread" type="list" list-name="threads" paginate-target="threadList" separate-columns="true"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar">
         <field name="threadId" title="${uiLabelMap.WebtoolsThread}"><display description="${threadId} ${threadName}"/></field>

Modified: ofbiz/branches/20120329_portletWidget/framework/webtools/widget/ServiceScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webtools/widget/ServiceScreens.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webtools/widget/ServiceScreens.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webtools/widget/ServiceScreens.xml Mon Jul  2 11:02:34 2012
@@ -70,6 +70,27 @@ under the License.
             </widgets>
         </section>
     </screen>
+    <screen name="JobDetails">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleJobDetails"/>
+                <set field="tabButtonItem" value="findJob"/>
+                <script location="component://webtools/webapp/webtools/WEB-INF/actions/service/JobDetails.groovy"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="CommonServiceDecorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <screenlet title="${uiLabelMap.PageTitleJobDetails}">
+                            <include-form name="JobDetails" location="component://webtools/widget/ServiceForms.xml"/>
+                        </screenlet>
+                        <screenlet title="${uiLabelMap.WebtoolsRunTimeDataInfo}">
+                            <include-form name="JobRuntimeDataInfo" location="component://webtools/widget/ServiceForms.xml"/>
+                        </screenlet>
+                    </decorator-section>
+                </decorator-screen>
+            </widgets>
+        </section>
+    </screen>
 
     <screen name="ThreadList">
         <section>

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/FormFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/FormFactory.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/FormFactory.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/FormFactory.java Mon Jul  2 11:02:34 2012
@@ -47,8 +47,8 @@ import org.xml.sax.SAXException;
 public class FormFactory {
 
     public static final String module = FormFactory.class.getName();
-    public static final UtilCache<String, ModelForm> formLocationCache = UtilCache.createUtilCache("widget.form.locationResource", 0, 0, false);
-    public static final UtilCache<String, ModelForm> formWebappCache = UtilCache.createUtilCache("widget.form.webappResource", 0, 0, false);
+    private static final UtilCache<String, ModelForm> formLocationCache = UtilCache.createUtilCache("widget.form.locationResource", 0, 0, false);
+    private static final UtilCache<String, ModelForm> formWebappCache = UtilCache.createUtilCache("widget.form.webappResource", 0, 0, false);
 
     public static Map<String, ModelForm> getFormsFromLocation(String resourceName, ModelReader entityModelReader, DispatchContext dispatchContext)
             throws IOException, SAXException, ParserConfigurationException {
@@ -68,24 +68,19 @@ public class FormFactory {
         String cacheKey = resourceName + "#" + formName;
         ModelForm modelForm = formLocationCache.get(cacheKey);
         if (modelForm == null) {
-            synchronized (formLocationCache) {
-                modelForm = formLocationCache.get(cacheKey);
-                if (modelForm == null) {
-                    /*
-                    ClassLoader loader = Thread.currentThread().getContextClassLoader();
-                    if (loader == null) {
-                        loader = FormFactory.class.getClassLoader();
-                    }
-                    */
-                    URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); //, loader);
-                    Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, true);
-                    if (formFileDoc == null) {
-                        throw new IllegalArgumentException("Could not find resource [" + resourceName + "]");
-                    }
-                    modelForm = createModelForm(formFileDoc, entityModelReader, dispatchContext, resourceName, formName);
-                    formLocationCache.put(cacheKey, modelForm);
-                }
+            /*
+            ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            if (loader == null) {
+                loader = FormFactory.class.getClassLoader();
+            }
+            */
+            URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); //, loader);
+            Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, true);
+            if (formFileDoc == null) {
+                throw new IllegalArgumentException("Could not find resource [" + resourceName + "]");
             }
+            modelForm = createModelForm(formFileDoc, entityModelReader, dispatchContext, resourceName, formName);
+            modelForm = formLocationCache.putIfAbsentAndGet(cacheKey, modelForm);
         }
         if (modelForm == null) {
             throw new IllegalArgumentException("Could not find form with name [" + formName + "] in class resource [" + resourceName + "]");
@@ -99,20 +94,15 @@ public class FormFactory {
         String cacheKey = webappName + "::" + resourceName + "::" + formName;
         ModelForm modelForm = formWebappCache.get(cacheKey);
         if (modelForm == null) {
-            synchronized (formWebappCache) {
-                modelForm = formWebappCache.get(cacheKey);
-                if (modelForm == null) {
-                    ServletContext servletContext = (ServletContext) request.getAttribute("servletContext");
-                    Delegator delegator = (Delegator) request.getAttribute("delegator");
-                    LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
-                    URL formFileUrl = servletContext.getResource(resourceName);
-                    Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, true);
-                    Element formElement = UtilXml.firstChildElement(formFileDoc.getDocumentElement(), "form", "name", formName);
-                    modelForm = new ModelForm(formElement, delegator.getModelReader(), dispatcher.getDispatchContext());
-                    modelForm.setFormLocation(resourceName);
-                    formWebappCache.put(cacheKey, modelForm);
-                }
-            }
+            ServletContext servletContext = (ServletContext) request.getAttribute("servletContext");
+            Delegator delegator = (Delegator) request.getAttribute("delegator");
+            LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
+            URL formFileUrl = servletContext.getResource(resourceName);
+            Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, true);
+            Element formElement = UtilXml.firstChildElement(formFileDoc.getDocumentElement(), "form", "name", formName);
+            modelForm = new ModelForm(formElement, delegator.getModelReader(), dispatcher.getDispatchContext());
+            modelForm.setFormLocation(resourceName);
+            modelForm = formWebappCache.putIfAbsentAndGet(cacheKey, modelForm);
         }
         if (modelForm == null) {
             throw new IllegalArgumentException("Could not find form with name [" + formName + "] in webapp resource [" + resourceName + "] in the webapp [" + webappName + "]");
@@ -131,13 +121,8 @@ public class FormFactory {
                 String cacheKey = formLocation + "#" + formName;
                 ModelForm modelForm = formLocationCache.get(cacheKey);
                 if (modelForm == null) {
-                    synchronized (formLocationCache) {
-                        modelForm = formLocationCache.get(cacheKey);
-                        if (modelForm == null) {
-                            modelForm = createModelForm(formElement, entityModelReader, dispatchContext, formLocation, formName);
-                            formLocationCache.put(cacheKey, modelForm);
-                        }
-                    }
+                    modelForm = createModelForm(formElement, entityModelReader, dispatchContext, formLocation, formName);
+                    modelForm = formLocationCache.putIfAbsentAndGet(cacheKey, modelForm);
                 }
                 modelFormMap.put(formName, modelForm);
             }

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java Mon Jul  2 11:02:34 2012
@@ -212,7 +212,7 @@ public class ModelTreeCondition {
                 String permission = permissionExdr.expandString(context);
                 String action = actionExdr.expandString(context);
 
-                Authorization authz = (Authorization) context.get("authorization");
+                Authorization authz = (Authorization) context.get("authz");
                 Security security = (Security) context.get("security");
                 if (UtilValidate.isNotEmpty(action)) {
                     //Debug.logWarning("Deprecated method hasEntityPermission() was called; the action field should no longer be used", module);

Modified: ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlFormMacroLibrary.ftl
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlFormMacroLibrary.ftl (original)
+++ ofbiz/branches/20120329_portletWidget/framework/widget/templates/htmlFormMacroLibrary.ftl Mon Jul  2 11:02:34 2012
@@ -274,9 +274,10 @@ if(disa && document.styleSheets)
 
 <#macro renderCheckField items className alert id allChecked currentValue name event action>
 <#list items as item>
-<input type="checkbox"<#if (item_index == 0)> id="${id}"</#if> <@renderClass className alert /><#rt/>
+<span <@renderClass className alert />><#rt/>
+<input type="checkbox"<#if (item_index == 0)> id="${id}"</#if><#rt/>
 <#if allChecked?has_content && allChecked> checked="checked" <#elseif allChecked?has_content && !allChecked><#elseif currentValue?has_content && currentValue==item.value> checked="checked"</#if> name="${name?default("")?html}" value="${item.value?default("")?html}"<#if event?has_content> ${event}="${action}"</#if>/><#rt/>
-${item.description?default("")}
+${item.description?default("")}</span>
 </#list>
 </#macro>
 
@@ -674,23 +675,41 @@ Parameter: lastViewName, String, optiona
           </#if>
       </#if>
     </#if>
-    <script type="text/javascript">
+ <script type="text/javascript">
         jQuery(document).ready(function(){
-            new ConstructLookup("${fieldFormName}", "${id}", document.${formName?html}.${name?html}, <#if descriptionFieldName?has_content>document.${formName?html}.${descriptionFieldName}<#else>null</#if>, "${formName?html}", "${width}", "${height}", "${position}", "${fadeBackground}", <#if ajaxEnabled?has_content && ajaxEnabled>"${ajaxUrl}", ${showDescription}<#else>"", false</#if>, "${presentation!}", "${defaultMinLength!2}", "${defaultDelay!300}"<#rt/>
-    <#if targetParameterIter?has_content>
-      <#assign isFirst = true>
-      <#lt/>, [<#rt/>
-      <#list targetParameterIter as item>
-        <#if isFirst>
-          <#lt/>document.${formName}.${item}<#rt/>
-          <#assign isFirst = false>
-        <#else>
-          <#lt/> ,document.${formName}.${item}<#rt/>
-        </#if>
-      </#list>
-      <#lt/>]<#rt/>
-    </#if>
-            <#lt/>);
+         var options = {
+         requestUrl : "${fieldFormName}",
+ inputFieldId : "${id}",
+ dialogTarget : document.${formName?html}.${name?html},
+ dialogOptionalTarget : <#if descriptionFieldName?has_content>document.${formName?html}.${descriptionFieldName}<#else>null</#if>,
+ formName : "${formName?html}",
+ width : "${width}",
+ height : "${height}",
+ position : "${position}",
+ modal : "${fadeBackground}",
+ ajaxUrl : <#if ajaxEnabled?has_content && ajaxEnabled>"${ajaxUrl}"<#else>""</#if>,
+ showDescription : <#if ajaxEnabled?has_content && ajaxEnabled>"${showDescription}"<#else>false</#if>,
+ presentation : "${presentation!}",
+ defaultMinLength : "${defaultMinLength!2}",
+ defaultDelay : "${defaultDelay!300}",
+ args : <#rt/>
+    <#if targetParameterIter?has_content>
+    <#assign isFirst = true>
+    <#lt/>, [<#rt/>
+    <#list targetParameterIter as item>
+      <#if isFirst>
+          <#lt/>document.${formName}.${item}<#rt/>
+          <#assign isFirst = false>
+      <#else>
+          <#lt/> ,document.${formName}.${item}<#rt/>
+      </#if>
+    </#list>
+    <#lt/>]<#rt/>
+    <#else>[]
+    </#if>
+               <#lt/>
+         };
+ new Lookup(options).init();
         });
     </script>
 </#if>

Modified: ofbiz/branches/20120329_portletWidget/specialpurpose/assetmaint/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/specialpurpose/assetmaint/ofbiz-component.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/specialpurpose/assetmaint/ofbiz-component.xml (original)
+++ ofbiz/branches/20120329_portletWidget/specialpurpose/assetmaint/ofbiz-component.xml Mon Jul  2 11:02:34 2012
@@ -32,7 +32,8 @@
 
     <!-- entity resources: model(s), eca(s), group, and data definitions -->
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
-    <entity-resource type="data" reader-name="security" loader="main" location="data/AssetMaintSecurityData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/AssetMaintSecurityPermissionSeedData.xml"/>
+    <entity-resource type="data" reader-name="demo" loader="main" location="data/AssetMaintSecurityGroupDemoData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/AssetMaintSeedData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoAssetMaintData.xml"/>
 

Modified: ofbiz/branches/20120329_portletWidget/specialpurpose/ebay/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/specialpurpose/ebay/ofbiz-component.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/specialpurpose/ebay/ofbiz-component.xml (original)
+++ ofbiz/branches/20120329_portletWidget/specialpurpose/ebay/ofbiz-component.xml Mon Jul  2 11:02:34 2012
@@ -26,7 +26,8 @@ under the License.
     <classpath type="jar" location="build/lib/*"/>
     
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
-    <entity-resource type="data" reader-name="security" loader="main" location="data/EbaySecurityData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/EbaySecurityPermissionSeedData.xml"/>
+    <entity-resource type="data" reader-name="demo" loader="main" location="data/EbaySecurityGroupDemoData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayTypeData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayHelpData.xml"/>
     <entity-resource type="data" reader-name="demo" loader="main" location="data/DemoEbayData.xml"/>

Propchange: ofbiz/branches/20120329_portletWidget/specialpurpose/ebaystore/lib/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk/specialpurpose/ebaystore/lib:r1351867-1355999

Modified: ofbiz/branches/20120329_portletWidget/specialpurpose/ebaystore/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/specialpurpose/ebaystore/ofbiz-component.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/specialpurpose/ebaystore/ofbiz-component.xml (original)
+++ ofbiz/branches/20120329_portletWidget/specialpurpose/ebaystore/ofbiz-component.xml Mon Jul  2 11:02:34 2012
@@ -28,7 +28,8 @@ under the License.
 
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>
 
-    <entity-resource type="data" reader-name="security" loader="main" location="data/EbayStoreSecurityData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayStoreSecurityPermissionSeedData.xml"/>
+    <entity-resource type="data" reader-name="demo" loader="main" location="data/EbayStoreSecurityGroupDemoData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayStoreTypeData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayStoreHelpData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/EbayStorePortletData.xml"/>

Modified: ofbiz/branches/20120329_portletWidget/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml?rev=1356181&r1=1356180&r2=1356181&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml (original)
+++ ofbiz/branches/20120329_portletWidget/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/controller.xml Mon Jul  2 11:02:34 2012
@@ -1193,13 +1193,6 @@ under the License.
         <response name="error" type="view" value="login"/>
     </request-map>
 
-    <request-map uri="changeDelegator">
-        <security https="false" auth="false"/>
-        <event type="java" path="org.ofbiz.webapp.event.CoreEvents" invoke="changeDelegator"/>
-        <response name="success" type="view" value="main"/>
-        <response name="error" type="view" value="error"/>
-    </request-map>
-
     <request-map uri="tellafriend"><security https="false" auth="false"/><response name="success" type="view" value="tellafriend"/></request-map>
     <request-map uri="emailFriend">
         <security https="false" auth="false"/>