svn commit: r1351866 [41/48] - in /ofbiz/branches/20120329_portletWidget: ./ applications/accounting/ applications/accounting/config/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/i...

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

svn commit: r1351866 [41/48] - in /ofbiz/branches/20120329_portletWidget: ./ applications/accounting/ applications/accounting/config/ applications/accounting/data/ applications/accounting/entitydef/ applications/accounting/script/org/ofbiz/accounting/i...

erwan
Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java Tue Jun 19 21:36:11 2012
@@ -146,7 +146,7 @@ public class TemporalExpressionWorker {
         }
         Set<TemporalExpression> exprList = new TreeSet<TemporalExpression>();
         for (GenericValue value : valueList) {
-            exprList.add(makeTemporalExpression(delegator, value.getRelatedOne("ToTemporalExpression")));
+            exprList.add(makeTemporalExpression(delegator, value.getRelatedOne("ToTemporalExpression", false)));
         }
         return exprList;
     }

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/config/ServiceConfigUtil.java Tue Jun 19 21:36:11 2012
@@ -43,7 +43,7 @@ public class ServiceConfigUtil implement
     public static final String module = ServiceConfigUtil.class.getName();
     public static final String engine = "default";
     public static final String SERVICE_ENGINE_XML_FILENAME = "serviceengine.xml";
-    protected static UtilCache<String, Map<String, NotificationGroup>> notificationGroupCache = UtilCache.createUtilCache("service.NotificationGroups", 0, 0, false);
+    private static final UtilCache<String, Map<String, NotificationGroup>> notificationGroupCache = UtilCache.createUtilCache("service.NotificationGroups", 0, 0, false);
 
     public static Element getXmlRootElement() throws GenericConfigException {
         Element root = ResourceLoader.getXmlRootElement(ServiceConfigUtil.SERVICE_ENGINE_XML_FILENAME);
@@ -110,35 +110,22 @@ public class ServiceConfigUtil implement
         return retryMin;
     }
 
-    public static void readNotificationGroups() {
-        Element rootElement = null;
-
-        try {
-            rootElement = ServiceConfigUtil.getXmlRootElement();
-        } catch (GenericConfigException e) {
-            Debug.logError(e, "Error getting Service Engine XML root element", module);
-        }
-
-        FastMap<String, NotificationGroup> engineNotifyMap = FastMap.newInstance();
-
-        for (Element e: UtilXml.childElementList(rootElement, "notification-group")) {
-            NotificationGroup ng = new NotificationGroup(e);
-            engineNotifyMap.put(ng.getName(), ng);
-        }
-
-        notificationGroupCache.put(engine, engineNotifyMap);
-    }
-
     public static NotificationGroup getNotificationGroup(String group) {
         Map<String, NotificationGroup> engineNotifyMap = notificationGroupCache.get(engine);
         if (engineNotifyMap == null) {
-            synchronized(ServiceConfigUtil.class) {
-                engineNotifyMap = notificationGroupCache.get(engine);
-                if (engineNotifyMap == null) {
-                    readNotificationGroups();
-                }
+            //
+            Element rootElement = null;
+            try {
+                rootElement = ServiceConfigUtil.getXmlRootElement();
+            } catch (GenericConfigException e) {
+                Debug.logError(e, "Error getting Service Engine XML root element", module);
+            }
+            engineNotifyMap = FastMap.newInstance();
+            for (Element e: UtilXml.childElementList(rootElement, "notification-group")) {
+                NotificationGroup ng = new NotificationGroup(e);
+                engineNotifyMap.put(ng.getName(), ng);
             }
-            engineNotifyMap = notificationGroupCache.get(engine);
+            engineNotifyMap = notificationGroupCache.putIfAbsentAndGet(engine, engineNotifyMap);
         }
         if (engineNotifyMap != null) {
            return engineNotifyMap.get(group);

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/engine/BSFEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/engine/BSFEngine.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/engine/BSFEngine.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/engine/BSFEngine.java Tue Jun 19 21:36:11 2012
@@ -40,7 +40,7 @@ import org.apache.bsf.BSFManager;
 public class BSFEngine extends GenericAsyncEngine {
 
     public static final String module = BSFEngine.class.getName();
-    public static UtilCache<String, String> scriptCache = UtilCache.createUtilCache("BSFScripts", 0, 0);
+    private static final UtilCache<String, String> scriptCache = UtilCache.createUtilCache("BSFScripts", 0, 0);
 
     public BSFEngine(ServiceDispatcher dispatcher) {
         super(dispatcher);
@@ -104,27 +104,22 @@ public class BSFEngine extends GenericAs
         String script = scriptCache.get(localName + "_" + location);
 
         if (script == null) {
-            synchronized (this) {
-                script = scriptCache.get(localName + "_" + location);
-                if (script == null) {
-                    URL scriptUrl = UtilURL.fromResource(location, cl);
-
-                    if (scriptUrl != null) {
-                        try {
-                            HttpClient http = new HttpClient(scriptUrl);
-                            script = http.get();
-                        } catch (HttpClientException e) {
-                            throw new GenericServiceException("Cannot read script from resource", e);
-                        }
-                    } else {
-                        throw new GenericServiceException("Cannot read script, resource [" + location + "] not found");
-                    }
-                    if (script == null || script.length() < 2) {
-                        throw new GenericServiceException("Null or empty script");
-                    }
-                    scriptCache.put(localName + "_" + location, script);
+            URL scriptUrl = UtilURL.fromResource(location, cl);
+
+            if (scriptUrl != null) {
+                try {
+                    HttpClient http = new HttpClient(scriptUrl);
+                    script = http.get();
+                } catch (HttpClientException e) {
+                    throw new GenericServiceException("Cannot read script from resource", e);
                 }
+            } else {
+                throw new GenericServiceException("Cannot read script, resource [" + location + "] not found");
+            }
+            if (script == null || script.length() < 2) {
+                throw new GenericServiceException("Null or empty script");
             }
+            script = scriptCache.putIfAbsentAndGet(localName + "_" + location, script);
         }
 
         // now invoke the script

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/engine/BeanShellEngine.java Tue Jun 19 21:36:11 2012
@@ -36,8 +36,6 @@ import org.ofbiz.service.ServiceUtil;
  */
 public final class BeanShellEngine extends GenericAsyncEngine {
 
-    public static UtilCache<String, String> scriptCache = UtilCache.createUtilCache("BeanShellScripts", 0, 0);
-
     public BeanShellEngine(ServiceDispatcher dispatcher) {
         super(dispatcher);
     }

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=1351866&r1=1351865&r2=1351866&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 Tue Jun 19 21:36:11 2012
@@ -460,7 +460,7 @@ public class JobManager {
                     // cancel has been flagged, no more recurrence
                     return null;
                 }
-                GenericValue ri = job.getRelatedOne("RecurrenceInfo");
+                GenericValue ri = job.getRelatedOne("RecurrenceInfo", false);
 
                 if (ri != null) {
                     return new RecurrenceInfo(ri);

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=1351866&r1=1351865&r2=1351866&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 Tue Jun 19 21:36:11 2012
@@ -280,7 +280,7 @@ public class PersistedServiceJob extends
         try {
             GenericValue jobObj = getJob();
             if (!UtilValidate.isEmpty(jobObj.getString("runtimeDataId"))) {
-                GenericValue contextObj = jobObj.getRelatedOne("RuntimeData");
+                GenericValue contextObj = jobObj.getRelatedOne("RuntimeData", false);
                 if (contextObj != null) {
                     context = UtilGenerics.checkMap(XmlSerializer.deserialize(contextObj.getString("runtimeInfo"), delegator), String.class, Object.class);
                 }

Modified: ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/service/src/org/ofbiz/service/mail/ServiceMcaUtil.java Tue Jun 19 21:36:11 2012
@@ -38,7 +38,7 @@ import org.w3c.dom.Element;
 public class ServiceMcaUtil {
 
     public static final String module = ServiceMcaUtil.class.getName();
-    public static UtilCache<String, ServiceMcaRule> mcaCache = UtilCache.createUtilCache("service.ServiceMCAs", 0, 0, false);
+    private static final UtilCache<String, ServiceMcaRule> mcaCache = UtilCache.createUtilCache("service.ServiceMCAs", 0, 0, false);
 
     public static void reloadConfig() {
         mcaCache.clear();

Modified: ofbiz/branches/20120329_portletWidget/framework/testtools/data/helpdata/HELP_WEBTOOLS_selenium.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/testtools/data/helpdata/HELP_WEBTOOLS_selenium.xml?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/testtools/data/helpdata/HELP_WEBTOOLS_selenium.xml (original)
+++ ofbiz/branches/20120329_portletWidget/framework/testtools/data/helpdata/HELP_WEBTOOLS_selenium.xml Tue Jun 19 21:36:11 2012
@@ -34,7 +34,7 @@
                     <para>ant download-selenium</para>
                 </listitem>
                 <listitem>
-                    <para>ant run-install-extseed (For run install help data and example test)</para>
+                    <para>ant load-extseed (To load data and example test)</para>
                 </listitem>
                 <listitem>
                     <para>Build the source by running "ant" in the testtools directory or your OFBIZ_HOME</para>

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/config/url.properties
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/config/url.properties?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/config/url.properties (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/config/url.properties Tue Jun 19 21:36:11 2012
@@ -43,3 +43,9 @@ link.remove_lsessionid.user_agent_list =
 # Should HTTP parameters sent to services require encryption?
 # This is generally advised for more secure webapps as it makes it more difficult to spoof requests (XSRF) that change data.
 service.http.parameters.require.encrypted=Y
+
+# FOP configurable folder
+fop.path=component://webapp/config
+# Font path for FOP
+fop.font.base.path=component://webapp/config/
+

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/dtd/site-conf.xsd
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/dtd/site-conf.xsd?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/dtd/site-conf.xsd (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/dtd/site-conf.xsd Tue Jun 19 21:36:11 2012
@@ -26,13 +26,13 @@ under the License.
                 <xs:element minOccurs="0" ref="owner"/>
                 <xs:element minOccurs="0" ref="errorpage"/>
                 <xs:element minOccurs="0" maxOccurs="unbounded" ref="handler"/>
-                <xs:element minOccurs="0" maxOccurs="1" ref="protect"/>
+                <xs:element minOccurs="0" ref="protect"/>
                 <xs:element minOccurs="0" ref="firstvisit"/>
                 <xs:element minOccurs="0" ref="preprocessor"/>
                 <xs:element minOccurs="0" ref="postprocessor"/>
                 <xs:element minOccurs="0" ref="after-login"/>
                 <xs:element minOccurs="0" ref="before-logout"/>
-                <xs:element minOccurs="0" maxOccurs="1" ref="default-request"/>
+                <xs:element minOccurs="0" ref="default-request"/>
                 <xs:element minOccurs="0" maxOccurs="unbounded" ref="request-map"/>
                 <xs:element minOccurs="0" maxOccurs="unbounded" ref="view-map"/>
             </xs:sequence>
@@ -59,6 +59,12 @@ under the License.
     <xs:element name="owner" type="xs:string"/>
     <xs:element name="errorpage" type="xs:string"/>
     <xs:element name="handler">
+        <xs:annotation>
+            <xs:documentation>
+                Defines a Java class which handles a specific named type (either request or view).
+                This allows different logics for processing input from requests.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:attributeGroup ref="attlist.handler"/>
         </xs:complexType>
@@ -66,16 +72,28 @@ under the License.
     <xs:attributeGroup name="attlist.handler">
         <xs:attribute type="xs:string" name="name" use="required"/>
         <xs:attribute name="type" default="request">
+            <xs:annotation>
+                <xs:documentation>
+                    To keep it short, request is for action when view is for rendering
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
-                    <xs:enumeration value="view"/>
                     <xs:enumeration value="request"/>
+                    <xs:enumeration value="view"/>
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>
         <xs:attribute type="xs:string" name="class" use="required"/>
     </xs:attributeGroup>
     <xs:element name="protect">
+        <xs:annotation>
+            <xs:documentation>
+                Mechanism used to protect from data leakage (data stolen from a login/password couple compromised).
+                It works like the grey list anti-spam feature (aka tarpitting).
+                Any error will be ignored and will not affect the requests processing flow.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:attributeGroup ref="attlist.protect"/>
         </xs:complexType>
@@ -84,6 +102,12 @@ under the License.
         <xs:attribute type="xs:string" name="view" use="required"/>
     </xs:attributeGroup>
     <xs:element name="firstvisit">
+        <xs:annotation>
+            <xs:documentation>
+                Event runs at the 1st visit and only then.
+                Any error will be ignored and will not affect the requests processing flow.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/>
@@ -91,6 +115,12 @@ under the License.
         </xs:complexType>
     </xs:element>
     <xs:element name="preprocessor">
+        <xs:annotation>
+            <xs:documentation>
+                Event runs before each request.
+                Any error will be ignored and will not affect the requests processing flow.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/>
@@ -98,6 +128,12 @@ under the License.
         </xs:complexType>
     </xs:element>
     <xs:element name="postprocessor">
+        <xs:annotation>
+            <xs:documentation>
+                Event runs after each request.
+                Any error will be ignored and will not affect the requests processing flow.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/>
@@ -105,6 +141,12 @@ under the License.
         </xs:complexType>
     </xs:element>
     <xs:element name="after-login">
+        <xs:annotation>
+            <xs:documentation>
+                Event runs after login and only then.
+                Any error will be ignored and will not affect the requests processing flow.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/>
@@ -112,6 +154,12 @@ under the License.
         </xs:complexType>
     </xs:element>
     <xs:element name="before-logout">
+        <xs:annotation>
+            <xs:documentation>
+                Event runs before logout and only then.
+                Any error will be ignored and will not affect the requests processing flow.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/>
@@ -119,6 +167,11 @@ under the License.
         </xs:complexType>
     </xs:element>
     <xs:element name="default-request">
+        <xs:annotation>
+            <xs:documentation>
+                If a request cannot be called, or is not defined, the default-request is used
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:attributeGroup ref="attlist.default-request"/>
         </xs:complexType>
@@ -127,6 +180,11 @@ under the License.
         <xs:attribute type="xs:string" name="request-uri" use="required"/>
     </xs:attributeGroup>
     <xs:element name="request-map">
+        <xs:annotation>
+            <xs:documentation>
+                Place where are defined the elements of a request.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" ref="description"/>
@@ -138,8 +196,19 @@ under the License.
         </xs:complexType>
     </xs:element>
     <xs:attributeGroup name="attlist.request-map">
-        <xs:attribute type="xs:string" name="uri" use="required"/>
+        <xs:attribute type="xs:string" name="uri" use="required">
+            <xs:annotation>
+                <xs:documentation>
+                    The name of this request. This will be the name used to access the request.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
         <xs:attribute name="edit" default="true">
+            <xs:annotation>
+                <xs:documentation>
+                    Reserved for future use (not used yet).
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="true"/>
@@ -148,23 +217,50 @@ under the License.
             </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="track-visit" default="true">
+            <xs:annotation>
+                <xs:documentation>
+                    Allow or not to track first visit (related to firstvisit preprocessor).
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="true"/>
-                    <xs:enumeration value="false"/>
+                    <xs:enumeration value="false">
+                        <xs:annotation>
+                            <xs:documentation>
+                                Don't track as first visit (related to firstvisit preprocessor).
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="track-serverhit" default="true">
+            <xs:annotation>
+                <xs:documentation>
+                    Allow or not to track statistics.
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="true"/>
-                    <xs:enumeration value="false"/>
+                    <xs:enumeration value="false">
+                        <xs:annotation>
+                            <xs:documentation>
+                                Don't track in the statistics.
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>
     </xs:attributeGroup>
     <xs:element name="security">
+        <xs:annotation>
+            <xs:documentation>
+                Define the security of the request-map, using https and auth boolean attributes.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:attributeGroup ref="attlist.security"/>
         </xs:complexType>
@@ -173,12 +269,23 @@ under the License.
         <xs:attribute name="https" default="false">
             <xs:simpleType>
                 <xs:restriction base="xs:token">
-                    <xs:enumeration value="true"/>
+                    <xs:enumeration value="true">
+                        <xs:annotation>
+                            <xs:documentation>
+                                Redirects to/uses/generates the secured HTTPS protocol if necessary and possible
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
                     <xs:enumeration value="false"/>
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="auth" default="false">
+            <xs:annotation>
+                <xs:documentation>
+                    If auth=true, when you hit the request if you are not logged in you will be forwarded to the login page.
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="true"/>
@@ -187,6 +294,12 @@ under the License.
             </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="cert" default="false">
+            <xs:annotation>
+                <xs:documentation>
+                    It true, check for HTTPS client (x.509) security.
+                    If the request is not secured throws an exception
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="true"/>
@@ -195,6 +308,13 @@ under the License.
             </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="external-view" default="true">
+            <xs:annotation>
+                <xs:documentation>
+                    If false, prevent to pass a view through the url ("chaining" it after the request,
+                    like control/request/view in an FTL file).
+                    Default to true.
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="true"/>
@@ -203,6 +323,11 @@ under the License.
             </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="direct-request" default="true">
+            <xs:annotation>
+                <xs:documentation>
+                    If false the request can only be accessed in a chained request
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="true"/>
@@ -212,16 +337,62 @@ under the License.
         </xs:attribute>
     </xs:attributeGroup>
     <xs:element name="event">
+        <xs:annotation>
+            <xs:documentation>
+                Defines a piece of code (see handlers) which will handles the request need.
+                Return any string which is then used to route to different responses.
+                Only one event by request-map.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:attributeGroup ref="attlist.event"/>
         </xs:complexType>
     </xs:element>
     <xs:attributeGroup name="attlist.event">
-        <xs:attribute name="type" type="xs:string" use="required"/>
-        <xs:attribute name="name" type="xs:string"/>
-        <xs:attribute name="path" type="xs:string"/>
-        <xs:attribute name="invoke" type="xs:string"/>
+        <xs:attribute name="type" type="xs:string" use="required">
+            <xs:annotation>
+                <xs:documentation>
+                    There are as much as types (of type request) as available defined and accessible event handlers.
+                    Most used are java, service, service-multi, simple and bsf (or groovy).
+                    A most comprehensive list can be found in the common-controller.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="name" type="xs:string">
+            <xs:annotation>
+                <xs:documentation>
+                    Event name, mostly used with special events
+                    (firstvisit,
+                    preprocessor,
+                    postprocessor,
+                    after-login,
+                    before-logout)
+                    where the name allows to differentiate them.
+                    Most of the time reques-maps, which have only 1 event, don't use it.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="path" type="xs:string">
+            <xs:annotation>
+                <xs:documentation>
+                    The path to the class or XML file containing this event.
+                    Leave empty for services, except if you want to run it as a job, then use "async"
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="invoke" type="xs:string">
+            <xs:annotation>
+                <xs:documentation>
+                    The name of the method or service to be run.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
         <xs:attribute name="global-transaction" default="true">
+            <xs:annotation>
+                <xs:documentation>
+                    For service-multi, defines if the event should be wrapped in a transaction, default to true
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="true"/>
@@ -231,47 +402,144 @@ under the License.
         </xs:attribute>
     </xs:attributeGroup>
     <xs:element name="response">
+        <xs:annotation>
+            <xs:documentation>
+                You can have one response for each possible return code from the event.
+                An event can return any string, and that string can be used to route to different responses.
+                At least one reponse by request-map.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:sequence>
-                <xs:element minOccurs="0" maxOccurs="unbounded" ref="redirect-parameter"/>
+                <xs:element minOccurs="0" maxOccurs="unbounded" ref="redirect-parameter">
+                    <xs:annotation>
+                        <xs:documentation>
+                            Defines a possible parameter to redirect
+                        </xs:documentation>
+                    </xs:annotation>
+                </xs:element>
             </xs:sequence>
             <xs:attributeGroup ref="attlist.response"/>
         </xs:complexType>
     </xs:element>
     <xs:attributeGroup name="attlist.response">
-        <xs:attribute name="name" type="xs:string" use="required"/>
+        <xs:attribute name="name" type="xs:string" use="required">
+            <xs:annotation>
+                <xs:documentation>
+                    The name of the response, wich also matches the string returned by the event
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
         <xs:attribute name="type" use="required">
+            <xs:annotation>
+                <xs:documentation>
+                    One of the possible types between:
+                    none,
+                    view,
+                    view-last,
+                    view-last-noparam,
+                    view-home,
+                    request,
+                    request-redirect,
+                    request-redirect-noparam,
+                    url
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
-                    <xs:enumeration value="none"/>
-                    <xs:enumeration value="view"/>
+                    <xs:enumeration value="none">
+                        <xs:annotation>
+                            <xs:documentation>
+                                This is used in situations where the event will actually
+                                be generating the response. If you have an event that
+                                returns a binary download for example, you would use
+                                a response of type=none, so that the control servlet
+                                doesn't try to render anything and send it down to the
+                                client.
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
+                    <xs:enumeration value="view">
+                        <xs:annotation>
+                            <xs:documentation>
+                                Send to a view for final rendering
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
                     <xs:enumeration value="view-last">
                         <xs:annotation>
-                            <xs:documentation>Will use the view from the last request unless there
+                            <xs:documentation>
+                                Will use the view from the last request unless there
                                 is a saved from some previous request (using the save-last-view
                                 attribute).  Use the value attribute to specify a default view
-                                in case no previous view can be retrieved.</xs:documentation>
+                                in case no previous view can be retrieved.
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
+                    <xs:enumeration value="view-last-noparam">
+                        <xs:annotation>
+                            <xs:documentation>
+                                Same than view-last but no parameters are redirect
+                            </xs:documentation>
                         </xs:annotation>
                     </xs:enumeration>
-                    <xs:enumeration value="view-last-noparam"/>                            
                     <xs:enumeration value="view-home">
                         <xs:annotation>
-                            <xs:documentation>Will use the view from the last saved 'home' position
-                                (using the save-home-view attribute).</xs:documentation>
+                            <xs:documentation>
+                                Will use the view from the last saved 'home' position
+                                (using the save-home-view attribute).
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
+                    <xs:enumeration value="request">
+                        <xs:annotation>
+                            <xs:documentation>
+                                Internally chains to another request
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
+                    <xs:enumeration value="request-redirect">
+                        <xs:annotation>
+                            <xs:documentation>
+                                Send a redirect down to the browser telling it to go to the new request.
+                                Automatically redirect all current request parameters to the new request.
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
+                    <xs:enumeration value="request-redirect-noparam">
+                        <xs:annotation>
+                            <xs:documentation>
+                                Send a redirect down to the browser telling it to go to the new request.
+                                No current request parameters are sent to the new request.
+                            </xs:documentation>
+                        </xs:annotation>
+                    </xs:enumeration>
+                    <xs:enumeration value="url">
+                        <xs:annotation>
+                            <xs:documentation>
+                                Any URL, relative or absolute
+                            </xs:documentation>
                         </xs:annotation>
                     </xs:enumeration>
-                    <xs:enumeration value="request"/>
-                    <xs:enumeration value="request-redirect"/>
-                    <xs:enumeration value="request-redirect-noparam"/>
-                    <xs:enumeration value="url"/>
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>
-        <xs:attribute name="value" type="xs:string"/>
+        <xs:attribute name="value" type="xs:string">
+            <xs:annotation>
+                <xs:documentation>
+                    Depending on the type of response, will either
+                    be the view or request name (ie view-map-name or request-map URI).
+
+                    Can be an URL.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
         <xs:attribute name="save-last-view" default="false">
             <xs:annotation>
-                <xs:documentation>Saves the last (previous) request's view for future use, generally
-                    with the view-last type of response.</xs:documentation>
+                <xs:documentation>
+                    Saves the last (previous) request's view for future use, generally
+                    with the view-last type of response.
+                </xs:documentation>
             </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
@@ -282,8 +550,10 @@ under the License.
         </xs:attribute>
         <xs:attribute name="save-current-view" default="false">
             <xs:annotation>
-                <xs:documentation>Saves the current request's view for future use, generally with
-                    the view-last type of response.</xs:documentation>
+                <xs:documentation>
+                    Saves the current request's view for future use, generally with
+                    the view-last type of response.
+                </xs:documentation>
             </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
@@ -294,8 +564,10 @@ under the License.
         </xs:attribute>
         <xs:attribute name="save-home-view" default="false">
             <xs:annotation>
-                <xs:documentation>Saves the current request's view for future use, generally with
-                    the view-home type of response.</xs:documentation>
+                <xs:documentation>
+                    Saves the current request's view for future use, generally with
+                    the view-home type of response.
+                </xs:documentation>
             </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
@@ -307,25 +579,46 @@ under the License.
     </xs:attributeGroup>
     <xs:element name="redirect-parameter">
         <xs:annotation>
-            <xs:documentation>Adds a parameter with the given name to the redirect. Finds value in a
-                request attribute if exists, or a request parameter if no attribute is
-                found.</xs:documentation>
+            <xs:documentation>
+                Adds a parameter with the given name to the redirect. Finds value in a
+                request attribute if exists, or a request parameter if no attribute is found.
+            </xs:documentation>
         </xs:annotation>
         <xs:complexType>
             <xs:attributeGroup ref="attlist.redirect-parameter"/>
         </xs:complexType>
     </xs:element>
     <xs:attributeGroup name="attlist.redirect-parameter">
-        <xs:attribute type="xs:string" name="name" use="required"/>
+        <xs:attribute type="xs:string" name="name" use="required">
+            <xs:annotation>
+                <xs:documentation>
+                    Name of the parameter to redirect
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
         <xs:attribute type="xs:string" name="from" use="optional">
             <xs:annotation>
-                <xs:documentation>If specified used instead of the value of name for the key to find
-                    a request attribute or parameter.</xs:documentation>
+                <xs:documentation>
+                    If specified used instead of the value of name for the key to find
+                    a request attribute or parameter.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute type="xs:string" name="value" use="optional">
+            <xs:annotation>
+                <xs:documentation>
+                    Set a string value to the parameter.
+                </xs:documentation>
             </xs:annotation>
+            
         </xs:attribute>
-        <xs:attribute type="xs:string" name="value" use="optional"/>
     </xs:attributeGroup>
     <xs:element name="view-map">
+        <xs:annotation>
+            <xs:documentation>
+                Place where are defined the elements of a view.
+            </xs:documentation>
+        </xs:annotation>
         <xs:complexType>
             <xs:sequence>
                 <xs:element minOccurs="0" ref="description"/>
@@ -334,22 +627,63 @@ under the License.
         </xs:complexType>
     </xs:element>
     <xs:attributeGroup name="attlist.view-map">
-        <xs:attribute type="xs:string" name="name" use="required"/>
-        <xs:attribute type="xs:string" name="page"/>
-        <xs:attribute type="xs:string" name="type" default="default"/>
-        <xs:attribute type="xs:string" name="info"/>
-        <xs:attribute type="xs:string" name="content-type"/>
-        <xs:attribute type="xs:string" name="encoding"/>
+        <xs:attribute type="xs:string" name="name" use="required">
+            <xs:annotation>
+                <xs:documentation>
+                    The name of this view. This will be the name used to access the view.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute type="xs:string" name="page">
+            <xs:annotation>
+                <xs:documentation>
+                    The page mapped to this view.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <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
+                    A most comprehensive list can be found in the common-controller.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute type="xs:string" name="info">
+            <xs:annotation>
+                <xs:documentation>
+                    Extended information passed to the view handler.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute type="xs:string" name="content-type">
+            <xs:annotation>
+                <xs:documentation>
+                    Content-type in the HTML sense
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
+        <xs:attribute type="xs:string" name="encoding">
+            <xs:annotation>
+                <xs:documentation>
+                    Charset  in the HTML sense. By default "text/html" is used.
+                    If the encoding is "none" then no charset will be used.
+                </xs:documentation>
+            </xs:annotation>
+        </xs:attribute>
         <xs:attribute name="no-cache" default="false">
             <xs:annotation>
-                <xs:documentation>Send no-cache headers if set to true.</xs:documentation>
-            </xs:annotation>        
+                <xs:documentation>
+                    Send no-cache headers if set to true.
+                </xs:documentation>
+            </xs:annotation>
             <xs:simpleType>
                 <xs:restriction base="xs:token">
                     <xs:enumeration value="true"/>
                     <xs:enumeration value="false"/>
                 </xs:restriction>
             </xs:simpleType>
-        </xs:attribute>        
+        </xs:attribute>
     </xs:attributeGroup>
 </xs:schema>

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ConfigXMLReader.java Tue Jun 19 21:36:11 2012
@@ -52,8 +52,8 @@ public class ConfigXMLReader {
     public static final String module = ConfigXMLReader.class.getName();
     public static final String controllerXmlFileName = "/WEB-INF/controller.xml";
 
-    public static UtilCache<URL, ControllerConfig> controllerCache = UtilCache.createUtilCache("webapp.ControllerConfig");
-    public static UtilCache<String, List<ControllerConfig>> controllerSearchResultsCache = UtilCache.createUtilCache("webapp.ControllerSearchResults");
+    private static final UtilCache<URL, ControllerConfig> controllerCache = UtilCache.createUtilCache("webapp.ControllerConfig");
+    private static final UtilCache<String, List<ControllerConfig>> controllerSearchResultsCache = UtilCache.createUtilCache("webapp.ControllerSearchResults");
 
     public static URL getControllerConfigURL(ServletContext context) {
         try {
@@ -66,15 +66,8 @@ public class ConfigXMLReader {
 
     public static ControllerConfig getControllerConfig(URL url) {
         ControllerConfig controllerConfig = controllerCache.get(url);
-        if (controllerConfig == null) { // don't want to block here
-            synchronized (ConfigXMLReader.class) {
-                // must check if null again as one of the blocked threads can still enter
-                controllerConfig = controllerCache.get(url);
-                if (controllerConfig == null) {
-                    controllerConfig = new ControllerConfig(url);
-                    controllerCache.put(url, controllerConfig);
-                }
-            }
+        if (controllerConfig == null) {
+            controllerConfig = controllerCache.putIfAbsentAndGet(url, new ControllerConfig(url));
         }
         return controllerConfig;
     }
@@ -447,7 +440,7 @@ public class ConfigXMLReader {
                     controllerConfigs.add(cc);
                 }
 
-                controllerSearchResultsCache.put(cacheId, controllerConfigs);
+                controllerConfigs = controllerSearchResultsCache.putIfAbsentAndGet(cacheId, controllerConfigs);
             } catch (IOException e) {
                 throw new GeneralException("Error finding controller XML files to lookup request references: " + e.toString(), e);
             }

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/control/ControlEventListener.java Tue Jun 19 21:36:11 2012
@@ -91,7 +91,7 @@ public class ControlEventListener implem
             GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
             if (userLogin != null && userLoginSessionString != null) {
                 GenericValue userLoginSession = null;
-                userLoginSession = userLogin.getRelatedOne("UserLoginSession");
+                userLoginSession = userLogin.getRelatedOne("UserLoginSession", false);
 
                 if (userLoginSession == null) {
                     userLoginSession = userLogin.getDelegator().makeValue("UserLoginSession",

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=1351866&r1=1351865&r2=1351866&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 Tue Jun 19 21:36:11 2012
@@ -568,8 +568,8 @@ public class LoginWorker {
         if (modelUserLogin.isField("partyId")) {
             // if partyId is a field, then we should have these relations defined
             try {
-                GenericValue person = userLogin.getRelatedOne("Person");
-                GenericValue partyGroup = userLogin.getRelatedOne("PartyGroup");
+                GenericValue person = userLogin.getRelatedOne("Person", false);
+                GenericValue partyGroup = userLogin.getRelatedOne("PartyGroup", false);
                 if (person != null) session.setAttribute("person", person);
                 if (partyGroup != null) session.setAttribute("partyGroup", partyGroup);
             } catch (GenericEntityException e) {
@@ -1055,7 +1055,7 @@ public class LoginWorker {
         GenericValue userLoginSession;
         Map<String, Object> userLoginSessionMap = null;
         try {
-            userLoginSession = userLogin.getRelatedOne("UserLoginSession");
+            userLoginSession = userLogin.getRelatedOne("UserLoginSession", false);
             if (userLoginSession != null) {
                 Object deserObj = XmlSerializer.deserialize(userLoginSession.getString("sessionData"), delegator);
                 //don't check, just cast, if it fails it will get caught and reported below; if (deserObj instanceof Map)

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/event/BsfEventHandler.java Tue Jun 19 21:36:11 2012
@@ -43,7 +43,7 @@ import org.ofbiz.webapp.control.ConfigXM
 public class BsfEventHandler implements EventHandler {
 
     public static final String module = BsfEventHandler.class.getName();
-    public static UtilCache<String, String> eventCache = UtilCache.createUtilCache("webapp.BsfEvents");
+    private static final UtilCache<String, String> eventCache = UtilCache.createUtilCache("webapp.BsfEvents");
 
     /**
      * @see org.ofbiz.webapp.event.EventHandler#init(javax.servlet.ServletContext)
@@ -85,38 +85,30 @@ public class BsfEventHandler implements
                 cacheName = event.invoke;
                 scriptString = eventCache.get(cacheName);
                 if (scriptString == null) {
-                    synchronized(eventCache) {
-                        if (scriptString == null) {
-                            if (Debug.verboseOn()) {
-                                Debug.logVerbose("Loading BSF Script at location: " + cacheName, module);
-                            }
-                            URL scriptUrl = FlexibleLocation.resolveLocation(cacheName);
-                            if (scriptUrl == null) {
-                                throw new EventHandlerException("BSF script not found at location [" + cacheName + "]");
-                            }
-                            scriptStream = scriptUrl.openStream();
-                            scriptString = IOUtils.getStringFromReader(new InputStreamReader(scriptStream));
-                            scriptStream.close();
-                            eventCache.put(cacheName, scriptString);
-                        }
+                    if (Debug.verboseOn()) {
+                        Debug.logVerbose("Loading BSF Script at location: " + cacheName, module);
                     }
+                    URL scriptUrl = FlexibleLocation.resolveLocation(cacheName);
+                    if (scriptUrl == null) {
+                        throw new EventHandlerException("BSF script not found at location [" + cacheName + "]");
+                    }
+                    scriptStream = scriptUrl.openStream();
+                    scriptString = IOUtils.getStringFromReader(new InputStreamReader(scriptStream));
+                    scriptStream.close();
+                    scriptString = eventCache.putIfAbsentAndGet(cacheName, scriptString);
                 }
             } else {
                 // we are a script in the webapp - load by resource
                 cacheName = context.getServletContextName() + ":" + event.path + event.invoke;
                 scriptString = eventCache.get(cacheName);
                 if (scriptString == null) {
-                    synchronized(eventCache) {
-                        if (scriptString == null) {
-                            scriptStream = context.getResourceAsStream(event.path + event.invoke);
-                            if (scriptStream == null) {
-                                throw new EventHandlerException("Could not find BSF script file in webapp context: " + event.path + event.invoke);
-                            }
-                            scriptString = IOUtils.getStringFromReader(new InputStreamReader(scriptStream));
-                            scriptStream.close();
-                            eventCache.put(cacheName, scriptString);
-                        }
+                    scriptStream = context.getResourceAsStream(event.path + event.invoke);
+                    if (scriptStream == null) {
+                        throw new EventHandlerException("Could not find BSF script file in webapp context: " + event.path + event.invoke);
                     }
+                    scriptString = IOUtils.getStringFromReader(new InputStreamReader(scriptStream));
+                    scriptStream.close();
+                    scriptString = eventCache.putIfAbsentAndGet(cacheName, scriptString);
                 }
             }
 

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewHandler.java Tue Jun 19 21:36:11 2012
@@ -98,7 +98,7 @@ public class FreeMarkerViewHandler exten
         root.put("application", servletContext);
 
         // add the servlet context -- this has been deprecated, and now requires servlet, do we really need it?
-        //root.put("applicationAttributes", new ServletContextHashModel(servletContext, FreeMarkerWorker.defaultOfbizWrapper));
+        //root.put("applicationAttributes", new ServletContextHashModel(servletContext, FreeMarkerWorker.getDefaultOfbizWrapper()));
 
         // add the session object (for transforms) to the context as a BeanModel
         root.put("session", session);

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewRenderer.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewRenderer.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/ftl/FreeMarkerViewRenderer.java Tue Jun 19 21:36:11 2012
@@ -32,13 +32,13 @@ import freemarker.template.WrappingTempl
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.base.util.template.FreeMarkerWorker;
 
 import org.jpublish.JPublishContext;
 import org.jpublish.Page;
 import org.jpublish.SiteContext;
 import org.jpublish.page.PageInstance;
 import org.jpublish.view.ViewRenderException;
-import org.ofbiz.base.util.template.FreeMarkerWorker;
 
 /**
  * JPublish View Renderer For Freemarker Template Engine

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/region/RegionManager.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/region/RegionManager.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/region/RegionManager.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/region/RegionManager.java Tue Jun 19 21:36:11 2012
@@ -38,7 +38,7 @@ public class RegionManager {
 
     public static final String module = RegionManager.class.getName();
 
-    protected static UtilCache<URL, Map<String, Region>> regionCache = UtilCache.createUtilCache("webapp.Regions.Config", 0, 0);
+    private static final UtilCache<URL, Map<String, Region>> regionCache = UtilCache.createUtilCache("webapp.Regions.Config", 0, 0);
 
     protected URL regionFile = null;
 
@@ -54,14 +54,8 @@ public class RegionManager {
     public Map<String, Region> getRegions() {
         Map<String, Region> regions = regionCache.get(regionFile);
         if (regions == null) {
-            synchronized (this) {
-                regions = regionCache.get(regionFile);
-                if (regions == null) {
-                    if (Debug.verboseOn()) Debug.logVerbose("Regions not loaded for " + regionFile + ", loading now", module);
-                    regions = readRegionXml(regionFile);
-                    regionCache.put(regionFile, regions);
-                }
-            }
+            if (Debug.verboseOn()) Debug.logVerbose("Regions not loaded for " + regionFile + ", loading now", module);
+            regions = regionCache.putIfAbsentAndGet(regionFile, readRegionXml(regionFile));
         }
         return regions;
     }

Modified: ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java (original)
+++ ofbiz/branches/20120329_portletWidget/framework/webapp/src/org/ofbiz/webapp/view/ApacheFopWorker.java Tue Jun 19 21:36:11 2012
@@ -44,8 +44,13 @@ import org.apache.fop.apps.MimeConstants
 import org.ofbiz.base.location.FlexibleLocation;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.FileUtil;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
+import org.ofbiz.entity.Delegator;
+import org.ofbiz.entity.DelegatorFactory;
+import org.ofbiz.entity.util.EntityUtilProperties;
 
 /**
  * Apache FOP worker class.
@@ -66,6 +71,16 @@ public class ApacheFopWorker {
      * @return FopFactory The FopFactory instance
      */
     public static FopFactory getFactoryInstance() {
+        Delegator delegator = DelegatorFactory.getDelegator("default");
+        return getFactoryInstance(delegator);
+    }
+
+    /** Returns an instance of the FopFactory class. FOP documentation recommends
+     * the reuse of the factory instance because of the startup time.
+     * @param delegator the delegator
+     * @return FopFactory The FopFactory instance
+     */
+    public static FopFactory getFactoryInstance(Delegator delegator) {
         if (fopFactory == null) {
             synchronized (ApacheFopWorker.class) {
                 if (fopFactory != null) {
@@ -78,13 +93,13 @@ public class ApacheFopWorker {
                 fopFactory.setStrictValidation(false);
 
                 try {
-                    String ofbizHome = System.getProperty("ofbiz.home");
-                    String fopPath = UtilProperties.getPropertyValue("fop.properties", "fop.path", ofbizHome + "/framework/webapp/config");
+                    String fopPath = EntityUtilProperties.getPropertyValue("url.properties", "fop.path", delegator);
                     File userConfigFile = FileUtil.getFile(fopPath + "/fop.xconf");
                     fopFactory.setUserConfig(userConfigFile);
-                    String fopFontBaseUrl = UtilProperties.getPropertyValue("fop.properties", "fop.font.base.url", "file:///" + ofbizHome + "/framework/webapp/config/");
-                    fopFactory.getFontManager().setFontBaseURL(fopFontBaseUrl);
-                    Debug.logInfo("FOP-FontBaseURL: " + fopFontBaseUrl, module);
+                    String fopFontBasePath = EntityUtilProperties.getPropertyValue("url.properties", "fop.font.base.path", delegator);
+                    File fopFontBasePathFile = new File(fopFontBasePath);
+                    URL fopFontBaseUrl = FlexibleLocation.resolveLocation(fopFontBasePathFile.toString());
+                    fopFactory.getFontManager().setFontBaseURL(fopFontBaseUrl.toString());
                 } catch (Exception e) {
                     Debug.logWarning("Error reading FOP configuration", module);
                 }