You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2009/08/09 20:04:27 UTC

svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Author: adrianc
Date: Sun Aug  9 18:04:26 2009
New Revision: 802567

URL: http://svn.apache.org/viewvc?rev=802567&view=rev
Log:
Refactored GenericDelegator:

1. Converted GenericDelegator to an interface. We already have DelegatorInterface, but it isn't being used anywhere. Removed DelegatorInterface.java.

2. Extracted the static, cached data from the GenericDelegator implementation and put it in its own class - DelegatorData. The GenericDelegator implementation holds a reference to the DelegatorData instance. This makes it possible to have per-thread instances of GenericDelegator.

3. Replaced the ThreadLocal variables with regular variables. ThreadLocal variables are no longer needed. Client code doesn't need to be concerned with pushing and popping the GenericDelegator state.

This commit paves the way for the forthcoming ExecutionContext.

User modifications will have to replace GenericDelegator.getGenericDelegator(...) with DelegatorFactory.getGenericDelegator(...). Also, replace the push code with the new setXxx methods, and remove the pop code. If modifications used DelegatorInterface, replace that with GenericDelegator.

Aside from those changes, this commit is backwards compatible.

Added:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java   (with props)
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java   (with props)
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java   (with props)
Removed:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java
Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
    ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java
    ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
    ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java
    ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
    ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiContainer.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java
    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java
    ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java
    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java
    ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
    ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java
    ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java
    ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java
    ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java
    ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/WebPosSession.java
    ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java Sun Aug  9 18:04:26 2009
@@ -28,6 +28,7 @@
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.webapp.stats.VisitHandler;
+import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -58,7 +59,7 @@
         String delegatorName = (String) session.getAttribute("delegatorName");
         GenericDelegator delegator = null;
         if (UtilValidate.isNotEmpty(delegatorName)) {
-            delegator = GenericDelegator.getGenericDelegator(delegatorName);
+            delegator = DelegatorFactory.getGenericDelegator(delegatorName);
         }
         if (delegator == null) {
             Debug.logError("Could not find delegator with delegatorName in session, not saving abandoned cart info.", module);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Sun Aug  9 18:04:26 2009
@@ -21,6 +21,7 @@
 import javolution.util.FastList;
 import javolution.util.FastMap;
 import org.ofbiz.base.util.*;
+import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericPK;
@@ -275,7 +276,7 @@
 
     public GenericDelegator getDelegator() {
         if (delegator == null) {
-            delegator = GenericDelegator.getGenericDelegator(delegatorName);
+            delegator = DelegatorFactory.getGenericDelegator(delegatorName);
         }
         return delegator;
     }

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Sun Aug  9 18:04:26 2009
@@ -41,6 +41,7 @@
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericPK;
@@ -2406,7 +2407,7 @@
             if (UtilValidate.isEmpty(delegatorName)) {
                 throw new IllegalStateException("Bad delegator name");
             }
-            delegator = GenericDelegator.getGenericDelegator(delegatorName);
+            delegator = DelegatorFactory.getGenericDelegator(delegatorName);
         }
         return delegator;
     }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java Sun Aug  9 18:04:26 2009
@@ -35,6 +35,7 @@
 import org.ofbiz.base.util.UtilFormatOut;
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -500,7 +501,7 @@
 
     public GenericDelegator getDelegator() {
         if (_delegator == null) {
-            _delegator = GenericDelegator.getGenericDelegator(delegatorName);
+            _delegator = DelegatorFactory.getGenericDelegator(delegatorName);
         }
         return _delegator;
     }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java Sun Aug  9 18:04:26 2009
@@ -32,6 +32,7 @@
 import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -76,7 +77,7 @@
 
     public GenericDelegator getDelegator() {
         if (_delegator == null) {
-            _delegator = GenericDelegator.getGenericDelegator(delegatorName);
+            _delegator = DelegatorFactory.getGenericDelegator(delegatorName);
         }
         return _delegator;
     }

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java Sun Aug  9 18:04:26 2009
@@ -34,6 +34,7 @@
 import org.ofbiz.base.util.UtilNumber;
 import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -102,7 +103,7 @@
 
     public GenericDelegator getDelegator() {
         if (_delegator == null) {
-            _delegator = GenericDelegator.getGenericDelegator(delegatorName);
+            _delegator = DelegatorFactory.getGenericDelegator(delegatorName);
         }
         return _delegator;
     }

Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff
==============================================================================
--- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java (original)
+++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java Sun Aug  9 18:04:26 2009
@@ -36,6 +36,7 @@
 import org.ofbiz.base.container.ContainerException;
 import org.ofbiz.base.container.ContainerConfig.Container.Property;
 import org.ofbiz.base.util.*;
+import org.ofbiz.entity.DelegatorFactory;
 import org.ofbiz.entity.GenericDelegator;
 
 import org.apache.catalina.Cluster;
@@ -168,7 +169,7 @@
         //int debug = ContainerConfig.getPropertyValue(cc, "debug", 0);
 
         // grab some global context settings
-        this.delegator = GenericDelegator.getGenericDelegator(ContainerConfig.getPropertyValue(cc, "delegator-name", "default"));
+        this.delegator = DelegatorFactory.getGenericDelegator(ContainerConfig.getPropertyValue(cc, "delegator-name", "default"));
         this.contextReloadable = ContainerConfig.getPropertyValue(cc, "apps-context-reloadable", false);
         this.crossContext = ContainerConfig.getPropertyValue(cc, "apps-cross-context", true);
         this.distribute = ContainerConfig.getPropertyValue(cc, "apps-distributable", true);

Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java (added)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java Sun Aug  9 18:04:26 2009
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.ofbiz.entity;
+
+import java.util.Map;
+
+import javolution.util.FastMap;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.entity.cache.Cache;
+import org.ofbiz.entity.config.DelegatorInfo;
+import org.ofbiz.entity.config.EntityConfigUtil;
+import org.ofbiz.entity.eca.EntityEcaHandler;
+import org.ofbiz.entity.model.ModelGroupReader;
+import org.ofbiz.entity.model.ModelReader;
+import org.ofbiz.entity.util.DistributedCacheClear;
+import org.ofbiz.entity.util.EntityCrypto;
+import org.ofbiz.entity.util.SequenceUtil;
+
+/** Data source for the DelegatorImpl Class. */
+public class DelegatorData implements Cloneable {
+
+    public static final String module = DelegatorData.class.getName();
+    /**
+     * the delegatorDataCache will now be a HashMap, allowing reload of
+     * definitions, but the delegator will always be the same object for the
+     * given name
+     */
+    protected static final Map<String, DelegatorData> delegatorDataCache = FastMap.newInstance();
+
+    /**
+     * keeps a list of field key sets used in the by and cache, a Set (of Sets
+     * of fieldNames) for each entityName
+     */
+    protected Map<?, ?> andCacheFieldSets = FastMap.newInstance();
+    protected Cache cache = null;
+    protected EntityCrypto crypto = null;
+    protected DelegatorInfo delegatorInfo = null;
+    protected String delegatorName = null;
+    protected DistributedCacheClear distributedCacheClear = null;
+    protected EntityEcaHandler<?> entityEcaHandler = null;
+    protected ModelGroupReader modelGroupReader = null;
+    protected ModelReader modelReader = null;
+    protected String originalDelegatorName = null;
+    protected SequenceUtil sequencer = null;
+    protected boolean initialized = false;
+
+    public static synchronized DelegatorData getInstance(String delegatorName) throws GenericEntityException {
+        if (delegatorName == null) {
+            delegatorName = "default";
+            Debug.logWarning(new Exception("Location where getting delegator with null name"), "Got a getGenericDelegator call with a null delegatorName, assuming \"default\" for the name.", module);
+        }
+        DelegatorData delegatorData = delegatorDataCache.get(delegatorName);
+        if (delegatorData == null) {
+            if (Debug.infoOn()) {
+                Debug.logInfo("Creating new delegator data instance [" + delegatorName + "] (" + Thread.currentThread().getName() + ")", module);
+            }
+            delegatorData = new DelegatorData(delegatorName);
+            delegatorDataCache.put(delegatorName, delegatorData);
+        }
+        return delegatorData;
+    }
+
+    /** Only allow creation through the factory method */
+    protected DelegatorData() {
+    }
+
+    /** Only allow creation through the factory method */
+    protected DelegatorData(String delegatorName) throws GenericEntityException {
+        this.delegatorName = delegatorName;
+        this.originalDelegatorName = delegatorName;
+        this.modelReader = ModelReader.getModelReader(delegatorName);
+        this.modelGroupReader = ModelGroupReader.getModelGroupReader(delegatorName);
+        this.cache = new Cache(delegatorName);
+        this.delegatorInfo = EntityConfigUtil.getDelegatorInfo(this.delegatorName);
+    }
+
+    @Override
+    protected Object clone() {
+        DelegatorData delegatorData = new DelegatorData();
+        delegatorData.modelReader = this.modelReader;
+        delegatorData.modelGroupReader = this.modelGroupReader;
+        delegatorData.delegatorName = this.delegatorName;
+        delegatorData.delegatorInfo = this.delegatorInfo;
+        delegatorData.cache = this.cache;
+        delegatorData.andCacheFieldSets = this.andCacheFieldSets;
+        delegatorData.distributedCacheClear = this.distributedCacheClear;
+        delegatorData.originalDelegatorName = this.originalDelegatorName;
+        delegatorData.entityEcaHandler = this.entityEcaHandler;
+        delegatorData.sequencer = this.sequencer;
+        delegatorData.crypto = this.crypto;
+        return delegatorData;
+    }
+}

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java (added)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java Sun Aug  9 18:04:26 2009
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.ofbiz.entity;
+
+import org.ofbiz.base.util.Debug;
+
+/** GenericDelegator Factory Class. */
+public class DelegatorFactory {
+
+    public static final String module = DelegatorFactory.class.getName();
+
+    public static GenericDelegator getGenericDelegator(String delegatorName) {
+        if (delegatorName == null) {
+            delegatorName = "default";
+            Debug.logWarning(new Exception("Location where getting delegator with null name"), "Got a getGenericDelegator call with a null delegatorName, assuming default for the name.", module);
+        }
+        DelegatorData delegatorData = null;
+        try {
+            delegatorData = DelegatorData.getInstance(delegatorName);
+        } catch (GenericEntityException e) {
+            Debug.logError(e, "Could not create delegator with name \"" + delegatorName + "\": ", module);
+        }
+        if (delegatorData != null) {
+            return new DelegatorImpl(delegatorData);
+        }
+        return null;
+    }
+}

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@yahoo.com>.
David,

I think I figured out where the confusion comes from - we have different ideas of the ExecutionContext role. I see it as a means to keep track of the execution path, plus a container for frequently used objects. I believe you see it doing much more than that.

I updated my local copy of the branch with my changes from the trunk, but there isn't much I can do to test it - since nothing will compile.

I'm at an impasse. I believe the ExecutionContext (and ultimately the security-aware artifacts) can be introduced into the project small steps at a time - with each step being backwards compatible. I can see from the branch your approach is to rewrite everything.

Please accept this in the spirit it is intended. I have collaborated with you in the past, and it has always been enjoyable and rewarding. I'm not trying to be argumentative or adversarial. I only want to help. But I don't like the direction you're taking with this.

Here's what I suggest: let's create a new branch, and introduce changes that can be compiled and tested. In other words, the branch is always functional.

I know you're busy, but please try to communicate more. A lot of what you have in mind is in your head. I can't see inside your head. Keep in mind that we have a design document we can use to share ideas and agree on designs.

I have my local copy of the trunk 50% there as far as the security-aware artifacts are concerned. I'd really like to get it into the project.

What do you think?

-Adrian

--- On Mon, 8/10/09, Adrian Crum <ad...@yahoo.com> wrote:

> From: Adrian Crum <ad...@yahoo.com>
> Subject: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...
> To: dev@ofbiz.apache.org
> Date: Monday, August 10, 2009, 5:15 PM
> lol - while i was driving home I
> realized that statement would cause confusion. The basic
> part of keeping track of the execution path is in
> framework/base. Other components extend it to add the higher
> level artifacts.
> 
> Let me fix the branch. Then I'll port my implementation
> over to it and commit it. Then you can try it out. It's
> working quite well.
> 
> -Adrian
> 
> --- On Mon, 8/10/09, David E Jones <de...@me.com>
> wrote:
> 
> > From: David E Jones <de...@me.com>
> > Subject: Re: svn commit: r802567 [1/5] - in
> /ofbiz/trunk:
> applications/order/src/org/ofbiz/order/shoppingcart/
> applications/product/src/org/ofbiz/shipment/packing/
> applications/product/src/org/ofbiz/shipment/verify/
> applications/product/src/org/ofbiz/shipment/weigh...
> > To: dev@ofbiz.apache.org
> > Date: Monday, August 10, 2009, 4:41 PM
> > 
> > If the ExecutionContext interface is in base and the
> > GenericDelegator interface is in entity and the
> > ExecutionContext needs to use the GenericDelegator
> > interface, how will that work?
> > 
> > -David
> > 
> > 
> > On Aug 10, 2009, at 5:19 PM, Adrian Crum wrote:
> > 
> > > In my implementation, I put the ExecutionContext
> in
> > framework/base.
> > > 
> > > I'll work on updating the branch - I caused the
> > problem, so I'll fix it.
> > > 
> > > -Adrian
> > > 
> > > David E Jones wrote:
> > >> Yes, that's why I did a similar thing in the
> > branch.
> > >> Stepping back a little... please keep in mind
> that
> > the interface will not be able to stay in the entity
> > component. Part of the point of making these
> interfaces is
> > so that we can have a ExecutionContext that knows
> certain
> > things about a number of framework components without
> > actually depending on those components at compile
> time.
> > Instead with the interfaces in the execution context
> > component all of the other components can depend on
> and
> > share that.
> > >> Without that pattern it will be impossible
> to
> > implement the execution context. As part of that, I'd
> rather
> > do them all together rather than separately otherwise
> (like
> > I mentioned before) merging the branch will become
> > difficult. In fact, even with the changes you've
> already
> > added to the trunk the merge is already a HUGE mess...
> (ie
> > just updating the branch against the trunk).
> > >> -David
> > >> On Aug 10, 2009, at 4:42 PM, Adrian Crum
> wrote:
> > >>> I checked out the branch and examined
> it.
> > After looking over your ideas, I saw a way to make
> > incremental changes to the trunk - negating the need
> for a
> > branch.
> > >>> 
> > >>> The GenericDelegator refactor was done
> for two
> > reasons:
> > >>> 
> > >>> 1. To eliminate the hundreds of
> references to
> > a concrete class, that have caused inconvenience in
> the
> > past.
> > >>> 2. Eliminate thread local variables and
> the
> > cumbersome pushing and popping of the
> GenericDelegator
> > state.
> > >>> 
> > >>> How it relates to the ExecutionContext
> is, we
> > have the ability to keep an instance in the
> GenericDelegator
> > without having to create more thread local variables
> and
> > have even more things to push/pop.
> > >>> 
> > >>> It's a cleaner design.
> > >>> 
> > >>> -Adrian
> > >>> 
> > >>> David E Jones wrote:
> > >>>> Adrian,
> > >>>> What is all of this, and how does it
> > relate to what I've been working on in the
> > executioncontext20090716 branch?
> > >>>> It seems like this will:
> > >>>> 1. cause some inconvenience now,
> while
> > more comprehensive changes are being made in the
> > executioncontext20090716 branch
> > >>>> 2. make it a LOT more difficult
> (perhaps
> > impossible) to merge the executioncontext20090716
> branch
> > >>>> What is your plan with this?
> > >>>> It would make life a lot easier for
> all of
> > us if you would do some research on what I've already
> done
> > in the executioncontext20090716 branch before
> continuing
> > with this.
> > >>>> -David
> > >>>> On Aug 9, 2009, at 12:04 PM, adrianc@apache.org
> > wrote:
> > >>>>> Author: adrianc
> > >>>>> Date: Sun Aug  9 18:04:26 2009
> > >>>>> New Revision: 802567
> > >>>>> 
> > >>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
> > >>>>> Log:
> > >>>>> Refactored GenericDelegator:
> > >>>>> 
> > >>>>> 1. Converted GenericDelegator to
> an
> > interface. We already have DelegatorInterface, but it
> isn't
> > being used anywhere. Removed DelegatorInterface.java.
> > >>>>> 
> > >>>>> 2. Extracted the static, cached
> data
> > from the GenericDelegator implementation and put it in
> its
> > own class - DelegatorData. The GenericDelegator
> > implementation holds a reference to the DelegatorData
> > instance. This makes it possible to have per-thread
> > instances of GenericDelegator.
> > >>>>> 
> > >>>>> 3. Replaced the ThreadLocal
> variables
> > with regular variables. ThreadLocal variables are no
> longer
> > needed. Client code doesn't need to be concerned with
> > pushing and popping the GenericDelegator state.
> > >>>>> 
> > >>>>> This commit paves the way for
> the
> > forthcoming ExecutionContext.
> > >>>>> 
> > >>>>> User modifications will have to
> > replace GenericDelegator.getGenericDelegator(...)
> with
> > DelegatorFactory.getGenericDelegator(...). Also,
> replace the
> > push code with the new setXxx methods, and remove the
> pop
> > code. If modifications used DelegatorInterface,
> replace that
> > with GenericDelegator.
> > >>>>> 
> > >>>>> Aside from those changes, this
> commit
> > is backwards compatible.
> > >>>>> 
> > >>>>> Added:
> > >>>>> 
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java   (with
> > props)
> > >>>>> 
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java   (with
> > props)
> > >>>>> 
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java   (with
> > props)
> > >>>>> Removed:
> > >>>>> 
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java
> > >>>>> Modified:
> > >>>>> 
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
> > >>>>> 
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> > >>>>> 
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> > >>>>> 
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> > >>>>> 
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
> > >>>>> 
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
> > >>>>> 
> >
> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> > >>>>> 
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
> > >>>>> 
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
> > >>>>> 
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java
> > >>>>> 
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
> > >>>>> 
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java
> > >>>>> 
> >
> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
> > >>>>> 
> >
> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java
> > >>>>> 
> >
> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
> > >>>>> 
> >
> ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiContainer.java
> > >>>>> 
> >
> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java
> > >>>>> 
> >
> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java
> > >>>>> 
> >
> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java
> > >>>>> 
> >
> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java
> > >>>>> 
> >
> ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
> > >>>>> 
> >
> ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java
> > >>>>> 
> >
> ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java
> > >>>>> 
> >
> ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java
> > >>>>> 
> >
> ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
> > >>>>> 
> >
> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java
> > >>>>> 
> >
> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java
> > >>>>> 
> >
> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java
> > >>>>> 
> >
> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java
> > >>>>> 
> >
> ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/WebPosSession.java
> > >>>>> 
> >
> ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java
> > >>>>> 
> > >>>>> Modified:
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
> > >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff
> > >>>>>
> >
> ==============================================================================
> > >>>>> ---
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
> > (original)
> > >>>>> +++
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
> > Sun Aug  9 18:04:26 2009
> > >>>>> @@ -28,6 +28,7 @@
> > >>>>> import
> org.ofbiz.base.util.Debug;
> > >>>>> import
> > org.ofbiz.base.util.UtilValidate;
> > >>>>> import
> > org.ofbiz.webapp.stats.VisitHandler;
> > >>>>> +import
> > org.ofbiz.entity.DelegatorFactory;
> > >>>>> import
> > org.ofbiz.entity.GenericDelegator;
> > >>>>> import
> > org.ofbiz.entity.GenericEntityException;
> > >>>>> import
> org.ofbiz.entity.GenericValue;
> > >>>>> @@ -58,7 +59,7 @@
> > >>>>>       String
> > delegatorName = (String)
> > session.getAttribute("delegatorName");
> > >>>>>   
> >    GenericDelegator delegator = null;
> > >>>>>       if
> > (UtilValidate.isNotEmpty(delegatorName)) {
> > >>>>> -         
> >   delegator =
> > GenericDelegator.getGenericDelegator(delegatorName);
> > >>>>> +         
> >   delegator =
> > DelegatorFactory.getGenericDelegator(delegatorName);
> > >>>>>       }
> > >>>>>       if
> > (delegator == null) {
> > >>>>>       
> >    Debug.logError("Could not find delegator
> > with delegatorName in session, not saving abandoned
> cart
> > info.", module);
> > >>>>> 
> > >>>>> Modified:
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> > >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff
> > >>>>>
> >
> ==============================================================================
> > >>>>> ---
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> > (original)
> > >>>>> +++
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> > Sun Aug  9 18:04:26 2009
> > >>>>> @@ -21,6 +21,7 @@
> > >>>>> import javolution.util.FastList;
> > >>>>> import javolution.util.FastMap;
> > >>>>> import org.ofbiz.base.util.*;
> > >>>>> +import
> > org.ofbiz.entity.DelegatorFactory;
> > >>>>> import
> > org.ofbiz.entity.GenericDelegator;
> > >>>>> import
> > org.ofbiz.entity.GenericEntityException;
> > >>>>> import
> org.ofbiz.entity.GenericPK;
> > >>>>> @@ -275,7 +276,7 @@
> > >>>>> 
> > >>>>>   public
> > GenericDelegator getDelegator() {
> > >>>>>       if
> > (delegator == null) {
> > >>>>> -         
> >   delegator =
> > GenericDelegator.getGenericDelegator(delegatorName);
> > >>>>> +         
> >   delegator =
> > DelegatorFactory.getGenericDelegator(delegatorName);
> > >>>>>       }
> > >>>>>       return
> > delegator;
> > >>>>>   }
> > >>>>> 
> > >>>>> Modified:
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> > >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff
> > >>>>>
> >
> ==============================================================================
> > >>>>> ---
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> > (original)
> > >>>>> +++
> >
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> > Sun Aug  9 18:04:26 2009
> > >>>>> @@ -41,6 +41,7 @@
> > >>>>> import
> org.ofbiz.base.util.UtilMisc;
> > >>>>> import
> > org.ofbiz.base.util.UtilProperties;
> > >>>>> import
> > org.ofbiz.base.util.UtilValidate;
> > >>>>> +import
> > org.ofbiz.entity.DelegatorFactory;
> > >>>>> import
> > org.ofbiz.entity.GenericDelegator;
> > >>>>> import
> > org.ofbiz.entity.GenericEntityException;
> > >>>>> import
> org.ofbiz.entity.GenericPK;
> > >>>>> @@ -2406,7 +2407,7 @@
> > >>>>>       
> >    if (UtilValidate.isEmpty(delegatorName))
> > {
> > >>>>>         
> >      throw new
> > IllegalStateException("Bad delegator name");
> > >>>>>       
> >    }
> > >>>>> -         
> >   delegator =
> > GenericDelegator.getGenericDelegator(delegatorName);
> > >>>>> +         
> >   delegator =
> > DelegatorFactory.getGenericDelegator(delegatorName);
> > >>>>>       }
> > >>>>>       return
> > delegator;
> > >>>>>   }
> > >>>>> 
> > >>>>> Modified:
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> > >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff
> > >>>>>
> >
> ==============================================================================
> > >>>>> ---
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> > (original)
> > >>>>> +++
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> > Sun Aug  9 18:04:26 2009
> > >>>>> @@ -35,6 +35,7 @@
> > >>>>> import
> > org.ofbiz.base.util.UtilFormatOut;
> > >>>>> import
> org.ofbiz.base.util.UtilMisc;
> > >>>>> import
> > org.ofbiz.base.util.UtilValidate;
> > >>>>> +import
> > org.ofbiz.entity.DelegatorFactory;
> > >>>>> import
> > org.ofbiz.entity.GenericDelegator;
> > >>>>> import
> > org.ofbiz.entity.GenericEntityException;
> > >>>>> import
> org.ofbiz.entity.GenericValue;
> > >>>>> @@ -500,7 +501,7 @@
> > >>>>> 
> > >>>>>   public
> > GenericDelegator getDelegator() {
> > >>>>>       if
> > (_delegator == null) {
> > >>>>> -         
> >   _delegator =
> > GenericDelegator.getGenericDelegator(delegatorName);
> > >>>>> +         
> >   _delegator =
> > DelegatorFactory.getGenericDelegator(delegatorName);
> > >>>>>       }
> > >>>>>       return
> > _delegator;
> > >>>>>   }
> > >>>>> 
> > >>>>> Modified:
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
> > >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff
> > >>>>>
> >
> ==============================================================================
> > >>>>> ---
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
> > (original)
> > >>>>> +++
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
> > Sun Aug  9 18:04:26 2009
> > >>>>> @@ -32,6 +32,7 @@
> > >>>>> import
> org.ofbiz.base.util.UtilMisc;
> > >>>>> import
> > org.ofbiz.base.util.UtilProperties;
> > >>>>> import
> > org.ofbiz.base.util.UtilValidate;
> > >>>>> +import
> > org.ofbiz.entity.DelegatorFactory;
> > >>>>> import
> > org.ofbiz.entity.GenericDelegator;
> > >>>>> import
> > org.ofbiz.entity.GenericEntityException;
> > >>>>> import
> org.ofbiz.entity.GenericValue;
> > >>>>> @@ -76,7 +77,7 @@
> > >>>>> 
> > >>>>>   public
> > GenericDelegator getDelegator() {
> > >>>>>       if
> > (_delegator == null) {
> > >>>>> -         
> >   _delegator =
> > GenericDelegator.getGenericDelegator(delegatorName);
> > >>>>> +         
> >   _delegator =
> > DelegatorFactory.getGenericDelegator(delegatorName);
> > >>>>>       }
> > >>>>>       return
> > _delegator;
> > >>>>>   }
> > >>>>> 
> > >>>>> Modified:
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
> > >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff
> > >>>>>
> >
> ==============================================================================
> > >>>>> ---
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
> > (original)
> > >>>>> +++
> >
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
> > Sun Aug  9 18:04:26 2009
> > >>>>> @@ -34,6 +34,7 @@
> > >>>>> import
> > org.ofbiz.base.util.UtilNumber;
> > >>>>> import
> > org.ofbiz.base.util.UtilProperties;
> > >>>>> import
> > org.ofbiz.base.util.UtilValidate;
> > >>>>> +import
> > org.ofbiz.entity.DelegatorFactory;
> > >>>>> import
> > org.ofbiz.entity.GenericDelegator;
> > >>>>> import
> > org.ofbiz.entity.GenericEntityException;
> > >>>>> import
> org.ofbiz.entity.GenericValue;
> > >>>>> @@ -102,7 +103,7 @@
> > >>>>> 
> > >>>>>   public
> > GenericDelegator getDelegator() {
> > >>>>>       if
> > (_delegator == null) {
> > >>>>> -         
> >   _delegator =
> > GenericDelegator.getGenericDelegator(delegatorName);
> > >>>>> +         
> >   _delegator =
> > DelegatorFactory.getGenericDelegator(delegatorName);
> > >>>>>       }
> > >>>>>       return
> > _delegator;
> > >>>>>   }
> > >>>>> 
> > >>>>> Modified:
> >
> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> > >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff
> > >>>>>
> >
> ==============================================================================
> > >>>>> ---
> >
> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> > (original)
> > >>>>> +++
> >
> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> > Sun Aug  9 18:04:26 2009
> > >>>>> @@ -36,6 +36,7 @@
> > >>>>> import
> > org.ofbiz.base.container.ContainerException;
> > >>>>> import
> >
> org.ofbiz.base.container.ContainerConfig.Container.Property;
> > >>>>> import org.ofbiz.base.util.*;
> > >>>>> +import
> > org.ofbiz.entity.DelegatorFactory;
> > >>>>> import
> > org.ofbiz.entity.GenericDelegator;
> > >>>>> 
> > >>>>> import
> org.apache.catalina.Cluster;
> > >>>>> @@ -168,7 +169,7 @@
> > >>>>>       //int
> > debug = ContainerConfig.getPropertyValue(cc, "debug",
> 0);
> > >>>>> 
> > >>>>>       // grab
> > some global context settings
> > >>>>> -       
> > this.delegator =
> >
> GenericDelegator.getGenericDelegator(ContainerConfig.getPropertyValue(cc,
> > "delegator-name", "default"));
> > >>>>> +       
> > this.delegator =
> >
> DelegatorFactory.getGenericDelegator(ContainerConfig.getPropertyValue(cc,
> > "delegator-name", "default"));
> > >>>>>   
> >    this.contextReloadable =
> > ContainerConfig.getPropertyValue(cc,
> > "apps-context-reloadable", false);
> > >>>>>   
> >    this.crossContext =
> > ContainerConfig.getPropertyValue(cc,
> "apps-cross-context",
> > true);
> > >>>>>   
> >    this.distribute =
> > ContainerConfig.getPropertyValue(cc,
> "apps-distributable",
> > true);
> > >>>>> 
> > >>>>> Added:
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> > >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto
> > >>>>>
> >
> ==============================================================================
> > >>>>> ---
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> > (added)
> > >>>>> +++
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> > Sun Aug  9 18:04:26 2009
> > >>>>> @@ -0,0 +1,110 @@
> > >>>>> +/*
> > >>>>> + * Licensed to the Apache
> Software
> > Foundation (ASF) under one
> > >>>>> + * or more contributor license
> > agreements.  See the NOTICE file
> > >>>>> + * distributed with this work
> for
> > additional information
> > >>>>> + * regarding copyright
> > ownership.  The ASF licenses this file
> > >>>>> + * to you under the Apache
> License,
> > Version 2.0 (the
> > >>>>> + * "License"); you may not use
> this
> > file except in compliance
> > >>>>> + * with the License.  You may
> > obtain a copy of the License at
> > >>>>> + *
> > >>>>> + * http://www.apache.org/licenses/LICENSE-2.0
> > >>>>> + *
> > >>>>> + * Unless required by applicable
> law
> > or agreed to in writing,
> > >>>>> + * software distributed under
> the
> > License is distributed on an
> > >>>>> + * "AS IS" BASIS, WITHOUT
> WARRANTIES
> > OR CONDITIONS OF ANY
> > >>>>> + * KIND, either express or
> > implied.  See the License for the
> > >>>>> + * specific language governing
> > permissions and limitations
> > >>>>> + * under the License.
> > >>>>> + */
> > >>>>> +package org.ofbiz.entity;
> > >>>>> +
> > >>>>> +import java.util.Map;
> > >>>>> +
> > >>>>> +import javolution.util.FastMap;
> > >>>>> +
> > >>>>> +import
> org.ofbiz.base.util.Debug;
> > >>>>> +import
> org.ofbiz.entity.cache.Cache;
> > >>>>> +import
> > org.ofbiz.entity.config.DelegatorInfo;
> > >>>>> +import
> > org.ofbiz.entity.config.EntityConfigUtil;
> > >>>>> +import
> > org.ofbiz.entity.eca.EntityEcaHandler;
> > >>>>> +import
> > org.ofbiz.entity.model.ModelGroupReader;
> > >>>>> +import
> > org.ofbiz.entity.model.ModelReader;
> > >>>>> +import
> > org.ofbiz.entity.util.DistributedCacheClear;
> > >>>>> +import
> > org.ofbiz.entity.util.EntityCrypto;
> > >>>>> +import
> > org.ofbiz.entity.util.SequenceUtil;
> > >>>>> +
> > >>>>> +/** Data source for the
> DelegatorImpl
> > Class. */
> > >>>>> +public class DelegatorData
> implements
> > Cloneable {
> > >>>>> +
> > >>>>> +    public static final
> > String module = DelegatorData.class.getName();
> > >>>>> +    /**
> > >>>>> +     * the
> > delegatorDataCache will now be a HashMap, allowing
> reload
> > of
> > >>>>> +     *
> > definitions, but the delegator will always be the
> same
> > object for the
> > >>>>> +     * given
> > name
> > >>>>> +     */
> > >>>>> +    protected static final
> > Map<String, DelegatorData> delegatorDataCache =
> > FastMap.newInstance();
> > >>>>> +
> > >>>>> +    /**
> > >>>>> +     * keeps a
> > list of field key sets used in the by and cache, a Set
> (of
> > Sets
> > >>>>> +     * of
> > fieldNames) for each entityName
> > >>>>> +     */
> > >>>>> +    protected Map<?,
> > ?> andCacheFieldSets = FastMap.newInstance();
> > >>>>> +    protected Cache cache =
> > null;
> > >>>>> +    protected EntityCrypto
> > crypto = null;
> > >>>>> +    protected DelegatorInfo
> > delegatorInfo = null;
> > >>>>> +    protected String
> > delegatorName = null;
> > >>>>> +    protected
> > DistributedCacheClear distributedCacheClear = null;
> > >>>>> +    protected
> > EntityEcaHandler<?> entityEcaHandler = null;
> > >>>>> +    protected
> > ModelGroupReader modelGroupReader = null;
> > >>>>> +    protected ModelReader
> > modelReader = null;
> > >>>>> +    protected String
> > originalDelegatorName = null;
> > >>>>> +    protected SequenceUtil
> > sequencer = null;
> > >>>>> +    protected boolean
> > initialized = false;
> > >>>>> +
> > >>>>> +    public static
> > synchronized DelegatorData getInstance(String
> delegatorName)
> > throws GenericEntityException {
> > >>>>> +        if
> > (delegatorName == null) {
> > >>>>> +         
> >   delegatorName = "default";
> > >>>>> +         
> >   Debug.logWarning(new Exception("Location where
> > getting delegator with null name"), "Got a
> > getGenericDelegator call with a null delegatorName,
> assuming
> > \"default\" for the name.", module);
> > >>>>> +        }
> > >>>>> +       
> > DelegatorData delegatorData =
> > delegatorDataCache.get(delegatorName);
> > >>>>> +        if
> > (delegatorData == null) {
> > >>>>> +         
> >   if (Debug.infoOn()) {
> > >>>>> +         
> >       Debug.logInfo("Creating new delegator
> > data instance [" + delegatorName + "] (" +
> > Thread.currentThread().getName() + ")", module);
> > >>>>> +         
> >   }
> > >>>>> +         
> >   delegatorData = new DelegatorData(delegatorName);
> > >>>>> +         
> >   delegatorDataCache.put(delegatorName,
> > delegatorData);
> > >>>>> +        }
> > >>>>> +        return
> > delegatorData;
> > >>>>> +    }
> > >>>>> +
> > >>>>> +    /** Only allow creation
> > through the factory method */
> > >>>>> +    protected
> > DelegatorData() {
> > >>>>> +    }
> > >>>>> +
> > >>>>> +    /** Only allow creation
> > through the factory method */
> > >>>>> +    protected
> > DelegatorData(String delegatorName) throws
> > GenericEntityException {
> > >>>>> +       
> > this.delegatorName = delegatorName;
> > >>>>> +       
> > this.originalDelegatorName = delegatorName;
> > >>>>> +       
> > this.modelReader =
> > ModelReader.getModelReader(delegatorName);
> > >>>>> +       
> > this.modelGroupReader =
> > ModelGroupReader.getModelGroupReader(delegatorName);
> > >>>>> +       
> > this.cache = new Cache(delegatorName);
> > >>>>> +       
> > this.delegatorInfo =
> >
> EntityConfigUtil.getDelegatorInfo(this.delegatorName);
> > >>>>> +    }
> > >>>>> +
> > >>>>> +    @Override
> > >>>>> +    protected Object
> > clone() {
> > >>>>> +       
> > DelegatorData delegatorData = new DelegatorData();
> > >>>>> +       
> > delegatorData.modelReader = this.modelReader;
> > >>>>> +       
> > delegatorData.modelGroupReader =
> this.modelGroupReader;
> > >>>>> +       
> > delegatorData.delegatorName = this.delegatorName;
> > >>>>> +       
> > delegatorData.delegatorInfo = this.delegatorInfo;
> > >>>>> +       
> > delegatorData.cache = this.cache;
> > >>>>> +       
> > delegatorData.andCacheFieldSets =
> this.andCacheFieldSets;
> > >>>>> +       
> > delegatorData.distributedCacheClear =
> > this.distributedCacheClear;
> > >>>>> +       
> > delegatorData.originalDelegatorName =
> > this.originalDelegatorName;
> > >>>>> +       
> > delegatorData.entityEcaHandler =
> this.entityEcaHandler;
> > >>>>> +       
> > delegatorData.sequencer = this.sequencer;
> > >>>>> +       
> > delegatorData.crypto = this.crypto;
> > >>>>> +        return
> > delegatorData;
> > >>>>> +    }
> > >>>>> +}
> > >>>>> 
> > >>>>> Propchange:
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> > >>>>>
> >
> ------------------------------------------------------------------------------
> > >>>>>  svn:eol-style = native
> > >>>>> 
> > >>>>> Propchange:
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> > >>>>>
> >
> ------------------------------------------------------------------------------
> > >>>>>  svn:keywords = "Date Rev
> Author
> > URL Id"
> > >>>>> 
> > >>>>> Propchange:
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> > >>>>>
> >
> ------------------------------------------------------------------------------
> > >>>>>  svn:mime-type = text/plain
> > >>>>> 
> > >>>>> Added:
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> > >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto
> > >>>>>
> >
> ==============================================================================
> > >>>>> ---
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> > (added)
> > >>>>> +++
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> > Sun Aug  9 18:04:26 2009
> > >>>>> @@ -0,0 +1,44 @@
> > >>>>> +/*
> > >>>>> + * Licensed to the Apache
> Software
> > Foundation (ASF) under one
> > >>>>> + * or more contributor license
> > agreements.  See the NOTICE file
> > >>>>> + * distributed with this work
> for
> > additional information
> > >>>>> + * regarding copyright
> > ownership.  The ASF licenses this file
> > >>>>> + * to you under the Apache
> License,
> > Version 2.0 (the
> > >>>>> + * "License"); you may not use
> this
> > file except in compliance
> > >>>>> + * with the License.  You may
> > obtain a copy of the License at
> > >>>>> + *
> > >>>>> + * http://www.apache.org/licenses/LICENSE-2.0
> > >>>>> + *
> > >>>>> + * Unless required by applicable
> law
> > or agreed to in writing,
> > >>>>> + * software distributed under
> the
> > License is distributed on an
> > >>>>> + * "AS IS" BASIS, WITHOUT
> WARRANTIES
> > OR CONDITIONS OF ANY
> > >>>>> + * KIND, either express or
> > implied.  See the License for the
> > >>>>> + * specific language governing
> > permissions and limitations
> > >>>>> + * under the License.
> > >>>>> + */
> > >>>>> +package org.ofbiz.entity;
> > >>>>> +
> > >>>>> +import
> org.ofbiz.base.util.Debug;
> > >>>>> +
> > >>>>> +/** GenericDelegator Factory
> Class.
> > */
> > >>>>> +public class DelegatorFactory {
> > >>>>> +
> > >>>>> +    public static final
> > String module = DelegatorFactory.class.getName();
> > >>>>> +
> > >>>>> +    public static
> > GenericDelegator getGenericDelegator(String
> delegatorName)
> > {
> > >>>>> +        if
> > (delegatorName == null) {
> > >>>>> +         
> >   delegatorName = "default";
> > >>>>> +         
> >   Debug.logWarning(new Exception("Location where
> > getting delegator with null name"), "Got a
> > getGenericDelegator call with a null delegatorName,
> assuming
> > default for the name.", module);
> > >>>>> +        }
> > >>>>> +       
> > DelegatorData delegatorData = null;
> > >>>>> +        try {
> > >>>>> +         
> >   delegatorData =
> > DelegatorData.getInstance(delegatorName);
> > >>>>> +        } catch
> > (GenericEntityException e) {
> > >>>>> +         
> >   Debug.logError(e, "Could not create delegator with
> > name \"" + delegatorName + "\": ", module);
> > >>>>> +        }
> > >>>>> +        if
> > (delegatorData != null) {
> > >>>>> +         
> >   return new DelegatorImpl(delegatorData);
> > >>>>> +        }
> > >>>>> +        return
> > null;
> > >>>>> +    }
> > >>>>> +}
> > >>>>> 
> > >>>>> Propchange:
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> > >>>>>
> >
> ------------------------------------------------------------------------------
> > >>>>>  svn:eol-style = native
> > >>>>> 
> > >>>>> Propchange:
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> > >>>>>
> >
> ------------------------------------------------------------------------------
> > >>>>>  svn:keywords = "Date Rev
> Author
> > URL Id"
> > >>>>> 
> > >>>>> Propchange:
> >
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> > >>>>>
> >
> ------------------------------------------------------------------------------
> > >>>>>  svn:mime-type = text/plain
> > >>>>> 
> > >>>>> 
> > 
> > 
> 
> 
>  
> 


      

Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@yahoo.com>.
lol - while i was driving home I realized that statement would cause confusion. The basic part of keeping track of the execution path is in framework/base. Other components extend it to add the higher level artifacts.

Let me fix the branch. Then I'll port my implementation over to it and commit it. Then you can try it out. It's working quite well.

-Adrian

--- On Mon, 8/10/09, David E Jones <de...@me.com> wrote:

> From: David E Jones <de...@me.com>
> Subject: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...
> To: dev@ofbiz.apache.org
> Date: Monday, August 10, 2009, 4:41 PM
> 
> If the ExecutionContext interface is in base and the
> GenericDelegator interface is in entity and the
> ExecutionContext needs to use the GenericDelegator
> interface, how will that work?
> 
> -David
> 
> 
> On Aug 10, 2009, at 5:19 PM, Adrian Crum wrote:
> 
> > In my implementation, I put the ExecutionContext in
> framework/base.
> > 
> > I'll work on updating the branch - I caused the
> problem, so I'll fix it.
> > 
> > -Adrian
> > 
> > David E Jones wrote:
> >> Yes, that's why I did a similar thing in the
> branch.
> >> Stepping back a little... please keep in mind that
> the interface will not be able to stay in the entity
> component. Part of the point of making these interfaces is
> so that we can have a ExecutionContext that knows certain
> things about a number of framework components without
> actually depending on those components at compile time.
> Instead with the interfaces in the execution context
> component all of the other components can depend on and
> share that.
> >> Without that pattern it will be impossible to
> implement the execution context. As part of that, I'd rather
> do them all together rather than separately otherwise (like
> I mentioned before) merging the branch will become
> difficult. In fact, even with the changes you've already
> added to the trunk the merge is already a HUGE mess... (ie
> just updating the branch against the trunk).
> >> -David
> >> On Aug 10, 2009, at 4:42 PM, Adrian Crum wrote:
> >>> I checked out the branch and examined it.
> After looking over your ideas, I saw a way to make
> incremental changes to the trunk - negating the need for a
> branch.
> >>> 
> >>> The GenericDelegator refactor was done for two
> reasons:
> >>> 
> >>> 1. To eliminate the hundreds of references to
> a concrete class, that have caused inconvenience in the
> past.
> >>> 2. Eliminate thread local variables and the
> cumbersome pushing and popping of the GenericDelegator
> state.
> >>> 
> >>> How it relates to the ExecutionContext is, we
> have the ability to keep an instance in the GenericDelegator
> without having to create more thread local variables and
> have even more things to push/pop.
> >>> 
> >>> It's a cleaner design.
> >>> 
> >>> -Adrian
> >>> 
> >>> David E Jones wrote:
> >>>> Adrian,
> >>>> What is all of this, and how does it
> relate to what I've been working on in the
> executioncontext20090716 branch?
> >>>> It seems like this will:
> >>>> 1. cause some inconvenience now, while
> more comprehensive changes are being made in the
> executioncontext20090716 branch
> >>>> 2. make it a LOT more difficult (perhaps
> impossible) to merge the executioncontext20090716 branch
> >>>> What is your plan with this?
> >>>> It would make life a lot easier for all of
> us if you would do some research on what I've already done
> in the executioncontext20090716 branch before continuing
> with this.
> >>>> -David
> >>>> On Aug 9, 2009, at 12:04 PM, adrianc@apache.org
> wrote:
> >>>>> Author: adrianc
> >>>>> Date: Sun Aug  9 18:04:26 2009
> >>>>> New Revision: 802567
> >>>>> 
> >>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
> >>>>> Log:
> >>>>> Refactored GenericDelegator:
> >>>>> 
> >>>>> 1. Converted GenericDelegator to an
> interface. We already have DelegatorInterface, but it isn't
> being used anywhere. Removed DelegatorInterface.java.
> >>>>> 
> >>>>> 2. Extracted the static, cached data
> from the GenericDelegator implementation and put it in its
> own class - DelegatorData. The GenericDelegator
> implementation holds a reference to the DelegatorData
> instance. This makes it possible to have per-thread
> instances of GenericDelegator.
> >>>>> 
> >>>>> 3. Replaced the ThreadLocal variables
> with regular variables. ThreadLocal variables are no longer
> needed. Client code doesn't need to be concerned with
> pushing and popping the GenericDelegator state.
> >>>>> 
> >>>>> This commit paves the way for the
> forthcoming ExecutionContext.
> >>>>> 
> >>>>> User modifications will have to
> replace GenericDelegator.getGenericDelegator(...) with
> DelegatorFactory.getGenericDelegator(...). Also, replace the
> push code with the new setXxx methods, and remove the pop
> code. If modifications used DelegatorInterface, replace that
> with GenericDelegator.
> >>>>> 
> >>>>> Aside from those changes, this commit
> is backwards compatible.
> >>>>> 
> >>>>> Added:
> >>>>> 
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java   (with
> props)
> >>>>> 
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java   (with
> props)
> >>>>> 
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java   (with
> props)
> >>>>> Removed:
> >>>>> 
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java
> >>>>> Modified:
> >>>>> 
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
> >>>>> 
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> >>>>> 
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> >>>>> 
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> >>>>> 
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
> >>>>> 
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
> >>>>> 
> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> >>>>> 
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
> >>>>> 
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
> >>>>> 
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java
> >>>>> 
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java
> >>>>> 
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java
> >>>>> 
> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
> >>>>> 
> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java
> >>>>> 
> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java
> >>>>> 
> ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiContainer.java
> >>>>> 
> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java
> >>>>> 
> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java
> >>>>> 
> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java
> >>>>> 
> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java
> >>>>> 
> ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
> >>>>> 
> ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java
> >>>>> 
> ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java
> >>>>> 
> ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java
> >>>>> 
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
> >>>>> 
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
> >>>>> 
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
> >>>>> 
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
> >>>>> 
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java
> >>>>> 
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java
> >>>>> 
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
> >>>>> 
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java
> >>>>> 
> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java
> >>>>> 
> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java
> >>>>> 
> ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
> >>>>> 
> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java
> >>>>> 
> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java
> >>>>> 
> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java
> >>>>> 
> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java
> >>>>> 
> ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/WebPosSession.java
> >>>>> 
> ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java
> >>>>> 
> >>>>> Modified:
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
> >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff
> >>>>>
> ==============================================================================
> >>>>> ---
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
> (original)
> >>>>> +++
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java
> Sun Aug  9 18:04:26 2009
> >>>>> @@ -28,6 +28,7 @@
> >>>>> import org.ofbiz.base.util.Debug;
> >>>>> import
> org.ofbiz.base.util.UtilValidate;
> >>>>> import
> org.ofbiz.webapp.stats.VisitHandler;
> >>>>> +import
> org.ofbiz.entity.DelegatorFactory;
> >>>>> import
> org.ofbiz.entity.GenericDelegator;
> >>>>> import
> org.ofbiz.entity.GenericEntityException;
> >>>>> import org.ofbiz.entity.GenericValue;
> >>>>> @@ -58,7 +59,7 @@
> >>>>>       String
> delegatorName = (String)
> session.getAttribute("delegatorName");
> >>>>>   
>    GenericDelegator delegator = null;
> >>>>>       if
> (UtilValidate.isNotEmpty(delegatorName)) {
> >>>>> -         
>   delegator =
> GenericDelegator.getGenericDelegator(delegatorName);
> >>>>> +         
>   delegator =
> DelegatorFactory.getGenericDelegator(delegatorName);
> >>>>>       }
> >>>>>       if
> (delegator == null) {
> >>>>>       
>    Debug.logError("Could not find delegator
> with delegatorName in session, not saving abandoned cart
> info.", module);
> >>>>> 
> >>>>> Modified:
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff
> >>>>>
> ==============================================================================
> >>>>> ---
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> (original)
> >>>>> +++
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
> Sun Aug  9 18:04:26 2009
> >>>>> @@ -21,6 +21,7 @@
> >>>>> import javolution.util.FastList;
> >>>>> import javolution.util.FastMap;
> >>>>> import org.ofbiz.base.util.*;
> >>>>> +import
> org.ofbiz.entity.DelegatorFactory;
> >>>>> import
> org.ofbiz.entity.GenericDelegator;
> >>>>> import
> org.ofbiz.entity.GenericEntityException;
> >>>>> import org.ofbiz.entity.GenericPK;
> >>>>> @@ -275,7 +276,7 @@
> >>>>> 
> >>>>>   public
> GenericDelegator getDelegator() {
> >>>>>       if
> (delegator == null) {
> >>>>> -         
>   delegator =
> GenericDelegator.getGenericDelegator(delegatorName);
> >>>>> +         
>   delegator =
> DelegatorFactory.getGenericDelegator(delegatorName);
> >>>>>       }
> >>>>>       return
> delegator;
> >>>>>   }
> >>>>> 
> >>>>> Modified:
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff
> >>>>>
> ==============================================================================
> >>>>> ---
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> (original)
> >>>>> +++
> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
> Sun Aug  9 18:04:26 2009
> >>>>> @@ -41,6 +41,7 @@
> >>>>> import org.ofbiz.base.util.UtilMisc;
> >>>>> import
> org.ofbiz.base.util.UtilProperties;
> >>>>> import
> org.ofbiz.base.util.UtilValidate;
> >>>>> +import
> org.ofbiz.entity.DelegatorFactory;
> >>>>> import
> org.ofbiz.entity.GenericDelegator;
> >>>>> import
> org.ofbiz.entity.GenericEntityException;
> >>>>> import org.ofbiz.entity.GenericPK;
> >>>>> @@ -2406,7 +2407,7 @@
> >>>>>       
>    if (UtilValidate.isEmpty(delegatorName))
> {
> >>>>>         
>      throw new
> IllegalStateException("Bad delegator name");
> >>>>>       
>    }
> >>>>> -         
>   delegator =
> GenericDelegator.getGenericDelegator(delegatorName);
> >>>>> +         
>   delegator =
> DelegatorFactory.getGenericDelegator(delegatorName);
> >>>>>       }
> >>>>>       return
> delegator;
> >>>>>   }
> >>>>> 
> >>>>> Modified:
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff
> >>>>>
> ==============================================================================
> >>>>> ---
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> (original)
> >>>>> +++
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java
> Sun Aug  9 18:04:26 2009
> >>>>> @@ -35,6 +35,7 @@
> >>>>> import
> org.ofbiz.base.util.UtilFormatOut;
> >>>>> import org.ofbiz.base.util.UtilMisc;
> >>>>> import
> org.ofbiz.base.util.UtilValidate;
> >>>>> +import
> org.ofbiz.entity.DelegatorFactory;
> >>>>> import
> org.ofbiz.entity.GenericDelegator;
> >>>>> import
> org.ofbiz.entity.GenericEntityException;
> >>>>> import org.ofbiz.entity.GenericValue;
> >>>>> @@ -500,7 +501,7 @@
> >>>>> 
> >>>>>   public
> GenericDelegator getDelegator() {
> >>>>>       if
> (_delegator == null) {
> >>>>> -         
>   _delegator =
> GenericDelegator.getGenericDelegator(delegatorName);
> >>>>> +         
>   _delegator =
> DelegatorFactory.getGenericDelegator(delegatorName);
> >>>>>       }
> >>>>>       return
> _delegator;
> >>>>>   }
> >>>>> 
> >>>>> Modified:
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
> >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff
> >>>>>
> ==============================================================================
> >>>>> ---
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
> (original)
> >>>>> +++
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
> Sun Aug  9 18:04:26 2009
> >>>>> @@ -32,6 +32,7 @@
> >>>>> import org.ofbiz.base.util.UtilMisc;
> >>>>> import
> org.ofbiz.base.util.UtilProperties;
> >>>>> import
> org.ofbiz.base.util.UtilValidate;
> >>>>> +import
> org.ofbiz.entity.DelegatorFactory;
> >>>>> import
> org.ofbiz.entity.GenericDelegator;
> >>>>> import
> org.ofbiz.entity.GenericEntityException;
> >>>>> import org.ofbiz.entity.GenericValue;
> >>>>> @@ -76,7 +77,7 @@
> >>>>> 
> >>>>>   public
> GenericDelegator getDelegator() {
> >>>>>       if
> (_delegator == null) {
> >>>>> -         
>   _delegator =
> GenericDelegator.getGenericDelegator(delegatorName);
> >>>>> +         
>   _delegator =
> DelegatorFactory.getGenericDelegator(delegatorName);
> >>>>>       }
> >>>>>       return
> _delegator;
> >>>>>   }
> >>>>> 
> >>>>> Modified:
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
> >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff
> >>>>>
> ==============================================================================
> >>>>> ---
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
> (original)
> >>>>> +++
> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
> Sun Aug  9 18:04:26 2009
> >>>>> @@ -34,6 +34,7 @@
> >>>>> import
> org.ofbiz.base.util.UtilNumber;
> >>>>> import
> org.ofbiz.base.util.UtilProperties;
> >>>>> import
> org.ofbiz.base.util.UtilValidate;
> >>>>> +import
> org.ofbiz.entity.DelegatorFactory;
> >>>>> import
> org.ofbiz.entity.GenericDelegator;
> >>>>> import
> org.ofbiz.entity.GenericEntityException;
> >>>>> import org.ofbiz.entity.GenericValue;
> >>>>> @@ -102,7 +103,7 @@
> >>>>> 
> >>>>>   public
> GenericDelegator getDelegator() {
> >>>>>       if
> (_delegator == null) {
> >>>>> -         
>   _delegator =
> GenericDelegator.getGenericDelegator(delegatorName);
> >>>>> +         
>   _delegator =
> DelegatorFactory.getGenericDelegator(delegatorName);
> >>>>>       }
> >>>>>       return
> _delegator;
> >>>>>   }
> >>>>> 
> >>>>> Modified:
> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff
> >>>>>
> ==============================================================================
> >>>>> ---
> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> (original)
> >>>>> +++
> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java
> Sun Aug  9 18:04:26 2009
> >>>>> @@ -36,6 +36,7 @@
> >>>>> import
> org.ofbiz.base.container.ContainerException;
> >>>>> import
> org.ofbiz.base.container.ContainerConfig.Container.Property;
> >>>>> import org.ofbiz.base.util.*;
> >>>>> +import
> org.ofbiz.entity.DelegatorFactory;
> >>>>> import
> org.ofbiz.entity.GenericDelegator;
> >>>>> 
> >>>>> import org.apache.catalina.Cluster;
> >>>>> @@ -168,7 +169,7 @@
> >>>>>       //int
> debug = ContainerConfig.getPropertyValue(cc, "debug", 0);
> >>>>> 
> >>>>>       // grab
> some global context settings
> >>>>> -       
> this.delegator =
> GenericDelegator.getGenericDelegator(ContainerConfig.getPropertyValue(cc,
> "delegator-name", "default"));
> >>>>> +       
> this.delegator =
> DelegatorFactory.getGenericDelegator(ContainerConfig.getPropertyValue(cc,
> "delegator-name", "default"));
> >>>>>   
>    this.contextReloadable =
> ContainerConfig.getPropertyValue(cc,
> "apps-context-reloadable", false);
> >>>>>   
>    this.crossContext =
> ContainerConfig.getPropertyValue(cc, "apps-cross-context",
> true);
> >>>>>   
>    this.distribute =
> ContainerConfig.getPropertyValue(cc, "apps-distributable",
> true);
> >>>>> 
> >>>>> Added:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto
> >>>>>
> ==============================================================================
> >>>>> ---
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> (added)
> >>>>> +++
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> Sun Aug  9 18:04:26 2009
> >>>>> @@ -0,0 +1,110 @@
> >>>>> +/*
> >>>>> + * Licensed to the Apache Software
> Foundation (ASF) under one
> >>>>> + * or more contributor license
> agreements.  See the NOTICE file
> >>>>> + * distributed with this work for
> additional information
> >>>>> + * regarding copyright
> ownership.  The ASF licenses this file
> >>>>> + * to you under the Apache License,
> Version 2.0 (the
> >>>>> + * "License"); you may not use this
> file except in compliance
> >>>>> + * with the License.  You may
> obtain a copy of the License at
> >>>>> + *
> >>>>> + * http://www.apache.org/licenses/LICENSE-2.0
> >>>>> + *
> >>>>> + * Unless required by applicable law
> or agreed to in writing,
> >>>>> + * software distributed under the
> License is distributed on an
> >>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES
> OR CONDITIONS OF ANY
> >>>>> + * KIND, either express or
> implied.  See the License for the
> >>>>> + * specific language governing
> permissions and limitations
> >>>>> + * under the License.
> >>>>> + */
> >>>>> +package org.ofbiz.entity;
> >>>>> +
> >>>>> +import java.util.Map;
> >>>>> +
> >>>>> +import javolution.util.FastMap;
> >>>>> +
> >>>>> +import org.ofbiz.base.util.Debug;
> >>>>> +import org.ofbiz.entity.cache.Cache;
> >>>>> +import
> org.ofbiz.entity.config.DelegatorInfo;
> >>>>> +import
> org.ofbiz.entity.config.EntityConfigUtil;
> >>>>> +import
> org.ofbiz.entity.eca.EntityEcaHandler;
> >>>>> +import
> org.ofbiz.entity.model.ModelGroupReader;
> >>>>> +import
> org.ofbiz.entity.model.ModelReader;
> >>>>> +import
> org.ofbiz.entity.util.DistributedCacheClear;
> >>>>> +import
> org.ofbiz.entity.util.EntityCrypto;
> >>>>> +import
> org.ofbiz.entity.util.SequenceUtil;
> >>>>> +
> >>>>> +/** Data source for the DelegatorImpl
> Class. */
> >>>>> +public class DelegatorData implements
> Cloneable {
> >>>>> +
> >>>>> +    public static final
> String module = DelegatorData.class.getName();
> >>>>> +    /**
> >>>>> +     * the
> delegatorDataCache will now be a HashMap, allowing reload
> of
> >>>>> +     *
> definitions, but the delegator will always be the same
> object for the
> >>>>> +     * given
> name
> >>>>> +     */
> >>>>> +    protected static final
> Map<String, DelegatorData> delegatorDataCache =
> FastMap.newInstance();
> >>>>> +
> >>>>> +    /**
> >>>>> +     * keeps a
> list of field key sets used in the by and cache, a Set (of
> Sets
> >>>>> +     * of
> fieldNames) for each entityName
> >>>>> +     */
> >>>>> +    protected Map<?,
> ?> andCacheFieldSets = FastMap.newInstance();
> >>>>> +    protected Cache cache =
> null;
> >>>>> +    protected EntityCrypto
> crypto = null;
> >>>>> +    protected DelegatorInfo
> delegatorInfo = null;
> >>>>> +    protected String
> delegatorName = null;
> >>>>> +    protected
> DistributedCacheClear distributedCacheClear = null;
> >>>>> +    protected
> EntityEcaHandler<?> entityEcaHandler = null;
> >>>>> +    protected
> ModelGroupReader modelGroupReader = null;
> >>>>> +    protected ModelReader
> modelReader = null;
> >>>>> +    protected String
> originalDelegatorName = null;
> >>>>> +    protected SequenceUtil
> sequencer = null;
> >>>>> +    protected boolean
> initialized = false;
> >>>>> +
> >>>>> +    public static
> synchronized DelegatorData getInstance(String delegatorName)
> throws GenericEntityException {
> >>>>> +        if
> (delegatorName == null) {
> >>>>> +         
>   delegatorName = "default";
> >>>>> +         
>   Debug.logWarning(new Exception("Location where
> getting delegator with null name"), "Got a
> getGenericDelegator call with a null delegatorName, assuming
> \"default\" for the name.", module);
> >>>>> +        }
> >>>>> +       
> DelegatorData delegatorData =
> delegatorDataCache.get(delegatorName);
> >>>>> +        if
> (delegatorData == null) {
> >>>>> +         
>   if (Debug.infoOn()) {
> >>>>> +         
>       Debug.logInfo("Creating new delegator
> data instance [" + delegatorName + "] (" +
> Thread.currentThread().getName() + ")", module);
> >>>>> +         
>   }
> >>>>> +         
>   delegatorData = new DelegatorData(delegatorName);
> >>>>> +         
>   delegatorDataCache.put(delegatorName,
> delegatorData);
> >>>>> +        }
> >>>>> +        return
> delegatorData;
> >>>>> +    }
> >>>>> +
> >>>>> +    /** Only allow creation
> through the factory method */
> >>>>> +    protected
> DelegatorData() {
> >>>>> +    }
> >>>>> +
> >>>>> +    /** Only allow creation
> through the factory method */
> >>>>> +    protected
> DelegatorData(String delegatorName) throws
> GenericEntityException {
> >>>>> +       
> this.delegatorName = delegatorName;
> >>>>> +       
> this.originalDelegatorName = delegatorName;
> >>>>> +       
> this.modelReader =
> ModelReader.getModelReader(delegatorName);
> >>>>> +       
> this.modelGroupReader =
> ModelGroupReader.getModelGroupReader(delegatorName);
> >>>>> +       
> this.cache = new Cache(delegatorName);
> >>>>> +       
> this.delegatorInfo =
> EntityConfigUtil.getDelegatorInfo(this.delegatorName);
> >>>>> +    }
> >>>>> +
> >>>>> +    @Override
> >>>>> +    protected Object
> clone() {
> >>>>> +       
> DelegatorData delegatorData = new DelegatorData();
> >>>>> +       
> delegatorData.modelReader = this.modelReader;
> >>>>> +       
> delegatorData.modelGroupReader = this.modelGroupReader;
> >>>>> +       
> delegatorData.delegatorName = this.delegatorName;
> >>>>> +       
> delegatorData.delegatorInfo = this.delegatorInfo;
> >>>>> +       
> delegatorData.cache = this.cache;
> >>>>> +       
> delegatorData.andCacheFieldSets = this.andCacheFieldSets;
> >>>>> +       
> delegatorData.distributedCacheClear =
> this.distributedCacheClear;
> >>>>> +       
> delegatorData.originalDelegatorName =
> this.originalDelegatorName;
> >>>>> +       
> delegatorData.entityEcaHandler = this.entityEcaHandler;
> >>>>> +       
> delegatorData.sequencer = this.sequencer;
> >>>>> +       
> delegatorData.crypto = this.crypto;
> >>>>> +        return
> delegatorData;
> >>>>> +    }
> >>>>> +}
> >>>>> 
> >>>>> Propchange:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> >>>>>
> ------------------------------------------------------------------------------
> >>>>>  svn:eol-style = native
> >>>>> 
> >>>>> Propchange:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> >>>>>
> ------------------------------------------------------------------------------
> >>>>>  svn:keywords = "Date Rev Author
> URL Id"
> >>>>> 
> >>>>> Propchange:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
> >>>>>
> ------------------------------------------------------------------------------
> >>>>>  svn:mime-type = text/plain
> >>>>> 
> >>>>> Added:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> >>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto
> >>>>>
> ==============================================================================
> >>>>> ---
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> (added)
> >>>>> +++
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> Sun Aug  9 18:04:26 2009
> >>>>> @@ -0,0 +1,44 @@
> >>>>> +/*
> >>>>> + * Licensed to the Apache Software
> Foundation (ASF) under one
> >>>>> + * or more contributor license
> agreements.  See the NOTICE file
> >>>>> + * distributed with this work for
> additional information
> >>>>> + * regarding copyright
> ownership.  The ASF licenses this file
> >>>>> + * to you under the Apache License,
> Version 2.0 (the
> >>>>> + * "License"); you may not use this
> file except in compliance
> >>>>> + * with the License.  You may
> obtain a copy of the License at
> >>>>> + *
> >>>>> + * http://www.apache.org/licenses/LICENSE-2.0
> >>>>> + *
> >>>>> + * Unless required by applicable law
> or agreed to in writing,
> >>>>> + * software distributed under the
> License is distributed on an
> >>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES
> OR CONDITIONS OF ANY
> >>>>> + * KIND, either express or
> implied.  See the License for the
> >>>>> + * specific language governing
> permissions and limitations
> >>>>> + * under the License.
> >>>>> + */
> >>>>> +package org.ofbiz.entity;
> >>>>> +
> >>>>> +import org.ofbiz.base.util.Debug;
> >>>>> +
> >>>>> +/** GenericDelegator Factory Class.
> */
> >>>>> +public class DelegatorFactory {
> >>>>> +
> >>>>> +    public static final
> String module = DelegatorFactory.class.getName();
> >>>>> +
> >>>>> +    public static
> GenericDelegator getGenericDelegator(String delegatorName)
> {
> >>>>> +        if
> (delegatorName == null) {
> >>>>> +         
>   delegatorName = "default";
> >>>>> +         
>   Debug.logWarning(new Exception("Location where
> getting delegator with null name"), "Got a
> getGenericDelegator call with a null delegatorName, assuming
> default for the name.", module);
> >>>>> +        }
> >>>>> +       
> DelegatorData delegatorData = null;
> >>>>> +        try {
> >>>>> +         
>   delegatorData =
> DelegatorData.getInstance(delegatorName);
> >>>>> +        } catch
> (GenericEntityException e) {
> >>>>> +         
>   Debug.logError(e, "Could not create delegator with
> name \"" + delegatorName + "\": ", module);
> >>>>> +        }
> >>>>> +        if
> (delegatorData != null) {
> >>>>> +         
>   return new DelegatorImpl(delegatorData);
> >>>>> +        }
> >>>>> +        return
> null;
> >>>>> +    }
> >>>>> +}
> >>>>> 
> >>>>> Propchange:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> >>>>>
> ------------------------------------------------------------------------------
> >>>>>  svn:eol-style = native
> >>>>> 
> >>>>> Propchange:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> >>>>>
> ------------------------------------------------------------------------------
> >>>>>  svn:keywords = "Date Rev Author
> URL Id"
> >>>>> 
> >>>>> Propchange:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
> >>>>>
> ------------------------------------------------------------------------------
> >>>>>  svn:mime-type = text/plain
> >>>>> 
> >>>>> 
> 
> 


      

Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by David E Jones <de...@me.com>.
If the ExecutionContext interface is in base and the GenericDelegator  
interface is in entity and the ExecutionContext needs to use the  
GenericDelegator interface, how will that work?

-David


On Aug 10, 2009, at 5:19 PM, Adrian Crum wrote:

> In my implementation, I put the ExecutionContext in framework/base.
>
> I'll work on updating the branch - I caused the problem, so I'll fix  
> it.
>
> -Adrian
>
> David E Jones wrote:
>> Yes, that's why I did a similar thing in the branch.
>> Stepping back a little... please keep in mind that the interface  
>> will not be able to stay in the entity component. Part of the point  
>> of making these interfaces is so that we can have a  
>> ExecutionContext that knows certain things about a number of  
>> framework components without actually depending on those components  
>> at compile time. Instead with the interfaces in the execution  
>> context component all of the other components can depend on and  
>> share that.
>> Without that pattern it will be impossible to implement the  
>> execution context. As part of that, I'd rather do them all together  
>> rather than separately otherwise (like I mentioned before) merging  
>> the branch will become difficult. In fact, even with the changes  
>> you've already added to the trunk the merge is already a HUGE  
>> mess... (ie just updating the branch against the trunk).
>> -David
>> On Aug 10, 2009, at 4:42 PM, Adrian Crum wrote:
>>> I checked out the branch and examined it. After looking over your  
>>> ideas, I saw a way to make incremental changes to the trunk -  
>>> negating the need for a branch.
>>>
>>> The GenericDelegator refactor was done for two reasons:
>>>
>>> 1. To eliminate the hundreds of references to a concrete class,  
>>> that have caused inconvenience in the past.
>>> 2. Eliminate thread local variables and the cumbersome pushing and  
>>> popping of the GenericDelegator state.
>>>
>>> How it relates to the ExecutionContext is, we have the ability to  
>>> keep an instance in the GenericDelegator without having to create  
>>> more thread local variables and have even more things to push/pop.
>>>
>>> It's a cleaner design.
>>>
>>> -Adrian
>>>
>>> David E Jones wrote:
>>>> Adrian,
>>>> What is all of this, and how does it relate to what I've been  
>>>> working on in the executioncontext20090716 branch?
>>>> It seems like this will:
>>>> 1. cause some inconvenience now, while more comprehensive changes  
>>>> are being made in the executioncontext20090716 branch
>>>> 2. make it a LOT more difficult (perhaps impossible) to merge the  
>>>> executioncontext20090716 branch
>>>> What is your plan with this?
>>>> It would make life a lot easier for all of us if you would do  
>>>> some research on what I've already done in the  
>>>> executioncontext20090716 branch before continuing with this.
>>>> -David
>>>> On Aug 9, 2009, at 12:04 PM, adrianc@apache.org wrote:
>>>>> Author: adrianc
>>>>> Date: Sun Aug  9 18:04:26 2009
>>>>> New Revision: 802567
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>>> Log:
>>>>> Refactored GenericDelegator:
>>>>>
>>>>> 1. Converted GenericDelegator to an interface. We already have  
>>>>> DelegatorInterface, but it isn't being used anywhere. Removed  
>>>>> DelegatorInterface.java.
>>>>>
>>>>> 2. Extracted the static, cached data from the GenericDelegator  
>>>>> implementation and put it in its own class - DelegatorData. The  
>>>>> GenericDelegator implementation holds a reference to the  
>>>>> DelegatorData instance. This makes it possible to have per- 
>>>>> thread instances of GenericDelegator.
>>>>>
>>>>> 3. Replaced the ThreadLocal variables with regular variables.  
>>>>> ThreadLocal variables are no longer needed. Client code doesn't  
>>>>> need to be concerned with pushing and popping the  
>>>>> GenericDelegator state.
>>>>>
>>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>>
>>>>> User modifications will have to replace  
>>>>> GenericDelegator.getGenericDelegator(...) with  
>>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the  
>>>>> push code with the new setXxx methods, and remove the pop code.  
>>>>> If modifications used DelegatorInterface, replace that with  
>>>>> GenericDelegator.
>>>>>
>>>>> Aside from those changes, this commit is backwards compatible.
>>>>>
>>>>> Added:
>>>>>  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorData.java   (with props)
>>>>>  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorFactory.java   (with props)
>>>>>  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorImpl.java   (with props)
>>>>> Removed:
>>>>>  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorInterface.java
>>>>> Modified:
>>>>>  ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
>>>>> CartEventListener.java
>>>>>  ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
>>>>> ShoppingCart.java
>>>>>  ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
>>>>> ShoppingCartItem.java
>>>>>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
>>>>> PackingSession.java
>>>>>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>>>>> VerifyPickSession.java
>>>>>  ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>>> weightPackage/WeightPackageSession.java
>>>>>  ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/ 
>>>>> CatalinaContainer.java
>>>>>  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> GenericDelegator.java
>>>>>  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> GenericEntity.java
>>>>>  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/ 
>>>>> AbstractCache.java
>>>>>  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/ 
>>>>> EntityExpr.java
>>>>>  ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ 
>>>>> ListFinder.java
>>>>>  ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/ 
>>>>> EntityDataLoadContainer.java
>>>>>  ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/ 
>>>>> synchronization/EntitySyncContext.java
>>>>>  ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/ 
>>>>> synchronization/EntitySyncServices.java
>>>>>  ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/ 
>>>>> XuiContainer.java
>>>>>  ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>>>> entityops/EntityCount.java
>>>>>  ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>>>> entityops/EntityData.java
>>>>>  ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>>>> entityops/FindByAnd.java
>>>>>  ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>>>> entityops/FindByPrimaryKey.java
>>>>>  ofbiz/trunk/framework/service/src/org/ofbiz/service/ 
>>>>> ServiceDispatcher.java
>>>>>  ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ 
>>>>> JavaMailContainer.java
>>>>>  ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/ 
>>>>> RmiServiceContainer.java
>>>>>  ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ 
>>>>> ModelTestSuite.java
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
>>>>> ContextFilter.java
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
>>>>> ControlServlet.java
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
>>>>> RequestHandler.java
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
>>>>> CoreEvents.java
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
>>>>> ServiceStreamHandler.java
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
>>>>> XmlRpcEventHandler.java
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ 
>>>>> ServerHitBin.java
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ 
>>>>> VisitHandler.java
>>>>>  ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/ 
>>>>> WebDavServlet.java
>>>>>  ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/ 
>>>>> WebslingerContextMapper.java
>>>>>  ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ 
>>>>> WebToolsServices.java
>>>>>  ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/ 
>>>>> AuditEntityObject.java
>>>>>  ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/ 
>>>>> SharkContainer.java
>>>>>  ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/ 
>>>>> InstanceEntityObject.java
>>>>>  ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/ 
>>>>> AbstractRequester.java
>>>>>  ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/ 
>>>>> WebPosSession.java
>>>>>  ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/ 
>>>>> definition/XpdlReader.java
>>>>>
>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>>>> shoppingcart/CartEventListener.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> ==================================================================
>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>>>> shoppingcart/CartEventListener.java (original)
>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>>>> shoppingcart/CartEventListener.java Sun Aug  9 18:04:26 2009
>>>>> @@ -28,6 +28,7 @@
>>>>> import org.ofbiz.base.util.Debug;
>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>> import org.ofbiz.webapp.stats.VisitHandler;
>>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>>> import org.ofbiz.entity.GenericDelegator;
>>>>> import org.ofbiz.entity.GenericEntityException;
>>>>> import org.ofbiz.entity.GenericValue;
>>>>> @@ -58,7 +59,7 @@
>>>>>       String delegatorName = (String)  
>>>>> session.getAttribute("delegatorName");
>>>>>       GenericDelegator delegator = null;
>>>>>       if (UtilValidate.isNotEmpty(delegatorName)) {
>>>>> -            delegator =  
>>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>>> +            delegator =  
>>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>>       }
>>>>>       if (delegator == null) {
>>>>>           Debug.logError("Could not find delegator with  
>>>>> delegatorName in session, not saving abandoned cart info.",  
>>>>> module);
>>>>>
>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>>>> shoppingcart/ShoppingCart.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> ==================================================================
>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>>>> shoppingcart/ShoppingCart.java (original)
>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>>>> shoppingcart/ShoppingCart.java Sun Aug  9 18:04:26 2009
>>>>> @@ -21,6 +21,7 @@
>>>>> import javolution.util.FastList;
>>>>> import javolution.util.FastMap;
>>>>> import org.ofbiz.base.util.*;
>>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>>> import org.ofbiz.entity.GenericDelegator;
>>>>> import org.ofbiz.entity.GenericEntityException;
>>>>> import org.ofbiz.entity.GenericPK;
>>>>> @@ -275,7 +276,7 @@
>>>>>
>>>>>   public GenericDelegator getDelegator() {
>>>>>       if (delegator == null) {
>>>>> -            delegator =  
>>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>>> +            delegator =  
>>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>>       }
>>>>>       return delegator;
>>>>>   }
>>>>>
>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>>>> shoppingcart/ShoppingCartItem.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> ==================================================================
>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>>>> shoppingcart/ShoppingCartItem.java (original)
>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>>>> shoppingcart/ShoppingCartItem.java Sun Aug  9 18:04:26 2009
>>>>> @@ -41,6 +41,7 @@
>>>>> import org.ofbiz.base.util.UtilMisc;
>>>>> import org.ofbiz.base.util.UtilProperties;
>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>>> import org.ofbiz.entity.GenericDelegator;
>>>>> import org.ofbiz.entity.GenericEntityException;
>>>>> import org.ofbiz.entity.GenericPK;
>>>>> @@ -2406,7 +2407,7 @@
>>>>>           if (UtilValidate.isEmpty(delegatorName)) {
>>>>>               throw new IllegalStateException("Bad delegator  
>>>>> name");
>>>>>           }
>>>>> -            delegator =  
>>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>>> +            delegator =  
>>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>>       }
>>>>>       return delegator;
>>>>>   }
>>>>>
>>>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/ 
>>>>> shipment/packing/PackingSession.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> ==================================================================
>>>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>>> packing/PackingSession.java (original)
>>>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>>> packing/PackingSession.java Sun Aug  9 18:04:26 2009
>>>>> @@ -35,6 +35,7 @@
>>>>> import org.ofbiz.base.util.UtilFormatOut;
>>>>> import org.ofbiz.base.util.UtilMisc;
>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>>> import org.ofbiz.entity.GenericDelegator;
>>>>> import org.ofbiz.entity.GenericEntityException;
>>>>> import org.ofbiz.entity.GenericValue;
>>>>> @@ -500,7 +501,7 @@
>>>>>
>>>>>   public GenericDelegator getDelegator() {
>>>>>       if (_delegator == null) {
>>>>> -            _delegator =  
>>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>>> +            _delegator =  
>>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>>       }
>>>>>       return _delegator;
>>>>>   }
>>>>>
>>>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/ 
>>>>> shipment/verify/VerifyPickSession.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> ==================================================================
>>>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>>> verify/VerifyPickSession.java (original)
>>>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>>> verify/VerifyPickSession.java Sun Aug  9 18:04:26 2009
>>>>> @@ -32,6 +32,7 @@
>>>>> import org.ofbiz.base.util.UtilMisc;
>>>>> import org.ofbiz.base.util.UtilProperties;
>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>>> import org.ofbiz.entity.GenericDelegator;
>>>>> import org.ofbiz.entity.GenericEntityException;
>>>>> import org.ofbiz.entity.GenericValue;
>>>>> @@ -76,7 +77,7 @@
>>>>>
>>>>>   public GenericDelegator getDelegator() {
>>>>>       if (_delegator == null) {
>>>>> -            _delegator =  
>>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>>> +            _delegator =  
>>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>>       }
>>>>>       return _delegator;
>>>>>   }
>>>>>
>>>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/ 
>>>>> shipment/weightPackage/WeightPackageSession.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> ==================================================================
>>>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>>> weightPackage/WeightPackageSession.java (original)
>>>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>>>> weightPackage/WeightPackageSession.java Sun Aug  9 18:04:26 2009
>>>>> @@ -34,6 +34,7 @@
>>>>> import org.ofbiz.base.util.UtilNumber;
>>>>> import org.ofbiz.base.util.UtilProperties;
>>>>> import org.ofbiz.base.util.UtilValidate;
>>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>>> import org.ofbiz.entity.GenericDelegator;
>>>>> import org.ofbiz.entity.GenericEntityException;
>>>>> import org.ofbiz.entity.GenericValue;
>>>>> @@ -102,7 +103,7 @@
>>>>>
>>>>>   public GenericDelegator getDelegator() {
>>>>>       if (_delegator == null) {
>>>>> -            _delegator =  
>>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>>> +            _delegator =  
>>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>>       }
>>>>>       return _delegator;
>>>>>   }
>>>>>
>>>>> Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
>>>>> container/CatalinaContainer.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> ==================================================================
>>>>> --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
>>>>> container/CatalinaContainer.java (original)
>>>>> +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
>>>>> container/CatalinaContainer.java Sun Aug  9 18:04:26 2009
>>>>> @@ -36,6 +36,7 @@
>>>>> import org.ofbiz.base.container.ContainerException;
>>>>> import  
>>>>> org.ofbiz.base.container.ContainerConfig.Container.Property;
>>>>> import org.ofbiz.base.util.*;
>>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>>> import org.ofbiz.entity.GenericDelegator;
>>>>>
>>>>> import org.apache.catalina.Cluster;
>>>>> @@ -168,7 +169,7 @@
>>>>>       //int debug = ContainerConfig.getPropertyValue(cc,  
>>>>> "debug", 0);
>>>>>
>>>>>       // grab some global context settings
>>>>> -        this.delegator =  
>>>>> GenericDelegator 
>>>>> .getGenericDelegator(ContainerConfig.getPropertyValue(cc,  
>>>>> "delegator-name", "default"));
>>>>> +        this.delegator =  
>>>>> DelegatorFactory 
>>>>> .getGenericDelegator(ContainerConfig.getPropertyValue(cc,  
>>>>> "delegator-name", "default"));
>>>>>       this.contextReloadable =  
>>>>> ContainerConfig.getPropertyValue(cc, "apps-context-reloadable",  
>>>>> false);
>>>>>       this.crossContext = ContainerConfig.getPropertyValue(cc,  
>>>>> "apps-cross-context", true);
>>>>>       this.distribute = ContainerConfig.getPropertyValue(cc,  
>>>>> "apps-distributable", true);
>>>>>
>>>>> Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorData.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> ==================================================================
>>>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorData.java (added)
>>>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorData.java Sun Aug  9 18:04:26 2009
>>>>> @@ -0,0 +1,110 @@
>>>>> +/*
>>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>>> + * or more contributor license agreements.  See the NOTICE file
>>>>> + * distributed with this work for additional information
>>>>> + * regarding copyright ownership.  The ASF licenses this file
>>>>> + * to you under the Apache License, Version 2.0 (the
>>>>> + * "License"); you may not use this file except in compliance
>>>>> + * with the License.  You may obtain a copy of the License at
>>>>> + *
>>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>>> + *
>>>>> + * Unless required by applicable law or agreed to in writing,
>>>>> + * software distributed under the License is distributed on an
>>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>>> + * KIND, either express or implied.  See the License for the
>>>>> + * specific language governing permissions and limitations
>>>>> + * under the License.
>>>>> + */
>>>>> +package org.ofbiz.entity;
>>>>> +
>>>>> +import java.util.Map;
>>>>> +
>>>>> +import javolution.util.FastMap;
>>>>> +
>>>>> +import org.ofbiz.base.util.Debug;
>>>>> +import org.ofbiz.entity.cache.Cache;
>>>>> +import org.ofbiz.entity.config.DelegatorInfo;
>>>>> +import org.ofbiz.entity.config.EntityConfigUtil;
>>>>> +import org.ofbiz.entity.eca.EntityEcaHandler;
>>>>> +import org.ofbiz.entity.model.ModelGroupReader;
>>>>> +import org.ofbiz.entity.model.ModelReader;
>>>>> +import org.ofbiz.entity.util.DistributedCacheClear;
>>>>> +import org.ofbiz.entity.util.EntityCrypto;
>>>>> +import org.ofbiz.entity.util.SequenceUtil;
>>>>> +
>>>>> +/** Data source for the DelegatorImpl Class. */
>>>>> +public class DelegatorData implements Cloneable {
>>>>> +
>>>>> +    public static final String module =  
>>>>> DelegatorData.class.getName();
>>>>> +    /**
>>>>> +     * the delegatorDataCache will now be a HashMap, allowing  
>>>>> reload of
>>>>> +     * definitions, but the delegator will always be the same  
>>>>> object for the
>>>>> +     * given name
>>>>> +     */
>>>>> +    protected static final Map<String, DelegatorData>  
>>>>> delegatorDataCache = FastMap.newInstance();
>>>>> +
>>>>> +    /**
>>>>> +     * keeps a list of field key sets used in the by and cache,  
>>>>> a Set (of Sets
>>>>> +     * of fieldNames) for each entityName
>>>>> +     */
>>>>> +    protected Map<?, ?> andCacheFieldSets =  
>>>>> FastMap.newInstance();
>>>>> +    protected Cache cache = null;
>>>>> +    protected EntityCrypto crypto = null;
>>>>> +    protected DelegatorInfo delegatorInfo = null;
>>>>> +    protected String delegatorName = null;
>>>>> +    protected DistributedCacheClear distributedCacheClear = null;
>>>>> +    protected EntityEcaHandler<?> entityEcaHandler = null;
>>>>> +    protected ModelGroupReader modelGroupReader = null;
>>>>> +    protected ModelReader modelReader = null;
>>>>> +    protected String originalDelegatorName = null;
>>>>> +    protected SequenceUtil sequencer = null;
>>>>> +    protected boolean initialized = false;
>>>>> +
>>>>> +    public static synchronized DelegatorData getInstance(String  
>>>>> delegatorName) throws GenericEntityException {
>>>>> +        if (delegatorName == null) {
>>>>> +            delegatorName = "default";
>>>>> +            Debug.logWarning(new Exception("Location where  
>>>>> getting delegator with null name"), "Got a getGenericDelegator  
>>>>> call with a null delegatorName, assuming \"default\" for the  
>>>>> name.", module);
>>>>> +        }
>>>>> +        DelegatorData delegatorData =  
>>>>> delegatorDataCache.get(delegatorName);
>>>>> +        if (delegatorData == null) {
>>>>> +            if (Debug.infoOn()) {
>>>>> +                Debug.logInfo("Creating new delegator data  
>>>>> instance [" + delegatorName + "] (" +  
>>>>> Thread.currentThread().getName() + ")", module);
>>>>> +            }
>>>>> +            delegatorData = new DelegatorData(delegatorName);
>>>>> +            delegatorDataCache.put(delegatorName, delegatorData);
>>>>> +        }
>>>>> +        return delegatorData;
>>>>> +    }
>>>>> +
>>>>> +    /** Only allow creation through the factory method */
>>>>> +    protected DelegatorData() {
>>>>> +    }
>>>>> +
>>>>> +    /** Only allow creation through the factory method */
>>>>> +    protected DelegatorData(String delegatorName) throws  
>>>>> GenericEntityException {
>>>>> +        this.delegatorName = delegatorName;
>>>>> +        this.originalDelegatorName = delegatorName;
>>>>> +        this.modelReader =  
>>>>> ModelReader.getModelReader(delegatorName);
>>>>> +        this.modelGroupReader =  
>>>>> ModelGroupReader.getModelGroupReader(delegatorName);
>>>>> +        this.cache = new Cache(delegatorName);
>>>>> +        this.delegatorInfo =  
>>>>> EntityConfigUtil.getDelegatorInfo(this.delegatorName);
>>>>> +    }
>>>>> +
>>>>> +    @Override
>>>>> +    protected Object clone() {
>>>>> +        DelegatorData delegatorData = new DelegatorData();
>>>>> +        delegatorData.modelReader = this.modelReader;
>>>>> +        delegatorData.modelGroupReader = this.modelGroupReader;
>>>>> +        delegatorData.delegatorName = this.delegatorName;
>>>>> +        delegatorData.delegatorInfo = this.delegatorInfo;
>>>>> +        delegatorData.cache = this.cache;
>>>>> +        delegatorData.andCacheFieldSets = this.andCacheFieldSets;
>>>>> +        delegatorData.distributedCacheClear =  
>>>>> this.distributedCacheClear;
>>>>> +        delegatorData.originalDelegatorName =  
>>>>> this.originalDelegatorName;
>>>>> +        delegatorData.entityEcaHandler = this.entityEcaHandler;
>>>>> +        delegatorData.sequencer = this.sequencer;
>>>>> +        delegatorData.crypto = this.crypto;
>>>>> +        return delegatorData;
>>>>> +    }
>>>>> +}
>>>>>
>>>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorData.java
>>>>> ------------------------------------------------------------------------------
>>>>>  svn:eol-style = native
>>>>>
>>>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorData.java
>>>>> ------------------------------------------------------------------------------
>>>>>  svn:keywords = "Date Rev Author URL Id"
>>>>>
>>>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorData.java
>>>>> ------------------------------------------------------------------------------
>>>>>  svn:mime-type = text/plain
>>>>>
>>>>> Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorFactory.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> = 
>>>>> ==================================================================
>>>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorFactory.java (added)
>>>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorFactory.java Sun Aug  9 18:04:26 2009
>>>>> @@ -0,0 +1,44 @@
>>>>> +/*
>>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>>> + * or more contributor license agreements.  See the NOTICE file
>>>>> + * distributed with this work for additional information
>>>>> + * regarding copyright ownership.  The ASF licenses this file
>>>>> + * to you under the Apache License, Version 2.0 (the
>>>>> + * "License"); you may not use this file except in compliance
>>>>> + * with the License.  You may obtain a copy of the License at
>>>>> + *
>>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>>> + *
>>>>> + * Unless required by applicable law or agreed to in writing,
>>>>> + * software distributed under the License is distributed on an
>>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>>> + * KIND, either express or implied.  See the License for the
>>>>> + * specific language governing permissions and limitations
>>>>> + * under the License.
>>>>> + */
>>>>> +package org.ofbiz.entity;
>>>>> +
>>>>> +import org.ofbiz.base.util.Debug;
>>>>> +
>>>>> +/** GenericDelegator Factory Class. */
>>>>> +public class DelegatorFactory {
>>>>> +
>>>>> +    public static final String module =  
>>>>> DelegatorFactory.class.getName();
>>>>> +
>>>>> +    public static GenericDelegator getGenericDelegator(String  
>>>>> delegatorName) {
>>>>> +        if (delegatorName == null) {
>>>>> +            delegatorName = "default";
>>>>> +            Debug.logWarning(new Exception("Location where  
>>>>> getting delegator with null name"), "Got a getGenericDelegator  
>>>>> call with a null delegatorName, assuming default for the name.",  
>>>>> module);
>>>>> +        }
>>>>> +        DelegatorData delegatorData = null;
>>>>> +        try {
>>>>> +            delegatorData =  
>>>>> DelegatorData.getInstance(delegatorName);
>>>>> +        } catch (GenericEntityException e) {
>>>>> +            Debug.logError(e, "Could not create delegator with  
>>>>> name \"" + delegatorName + "\": ", module);
>>>>> +        }
>>>>> +        if (delegatorData != null) {
>>>>> +            return new DelegatorImpl(delegatorData);
>>>>> +        }
>>>>> +        return null;
>>>>> +    }
>>>>> +}
>>>>>
>>>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorFactory.java
>>>>> ------------------------------------------------------------------------------
>>>>>  svn:eol-style = native
>>>>>
>>>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorFactory.java
>>>>> ------------------------------------------------------------------------------
>>>>>  svn:keywords = "Date Rev Author URL Id"
>>>>>
>>>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>>>> DelegatorFactory.java
>>>>> ------------------------------------------------------------------------------
>>>>>  svn:mime-type = text/plain
>>>>>
>>>>>


Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
In my implementation, I put the ExecutionContext in framework/base.

I'll work on updating the branch - I caused the problem, so I'll fix it.

-Adrian

David E Jones wrote:
> 
> Yes, that's why I did a similar thing in the branch.
> 
> Stepping back a little... please keep in mind that the interface will 
> not be able to stay in the entity component. Part of the point of making 
> these interfaces is so that we can have a ExecutionContext that knows 
> certain things about a number of framework components without actually 
> depending on those components at compile time. Instead with the 
> interfaces in the execution context component all of the other 
> components can depend on and share that.
> 
> Without that pattern it will be impossible to implement the execution 
> context. As part of that, I'd rather do them all together rather than 
> separately otherwise (like I mentioned before) merging the branch will 
> become difficult. In fact, even with the changes you've already added to 
> the trunk the merge is already a HUGE mess... (ie just updating the 
> branch against the trunk).
> 
> -David
> 
> 
> On Aug 10, 2009, at 4:42 PM, Adrian Crum wrote:
> 
>> I checked out the branch and examined it. After looking over your 
>> ideas, I saw a way to make incremental changes to the trunk - negating 
>> the need for a branch.
>>
>> The GenericDelegator refactor was done for two reasons:
>>
>> 1. To eliminate the hundreds of references to a concrete class, that 
>> have caused inconvenience in the past.
>> 2. Eliminate thread local variables and the cumbersome pushing and 
>> popping of the GenericDelegator state.
>>
>> How it relates to the ExecutionContext is, we have the ability to keep 
>> an instance in the GenericDelegator without having to create more 
>> thread local variables and have even more things to push/pop.
>>
>> It's a cleaner design.
>>
>> -Adrian
>>
>> David E Jones wrote:
>>> Adrian,
>>> What is all of this, and how does it relate to what I've been working 
>>> on in the executioncontext20090716 branch?
>>> It seems like this will:
>>> 1. cause some inconvenience now, while more comprehensive changes are 
>>> being made in the executioncontext20090716 branch
>>> 2. make it a LOT more difficult (perhaps impossible) to merge the 
>>> executioncontext20090716 branch
>>> What is your plan with this?
>>> It would make life a lot easier for all of us if you would do some 
>>> research on what I've already done in the executioncontext20090716 
>>> branch before continuing with this.
>>> -David
>>> On Aug 9, 2009, at 12:04 PM, adrianc@apache.org wrote:
>>>> Author: adrianc
>>>> Date: Sun Aug  9 18:04:26 2009
>>>> New Revision: 802567
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>> Log:
>>>> Refactored GenericDelegator:
>>>>
>>>> 1. Converted GenericDelegator to an interface. We already have 
>>>> DelegatorInterface, but it isn't being used anywhere. Removed 
>>>> DelegatorInterface.java.
>>>>
>>>> 2. Extracted the static, cached data from the GenericDelegator 
>>>> implementation and put it in its own class - DelegatorData. The 
>>>> GenericDelegator implementation holds a reference to the 
>>>> DelegatorData instance. This makes it possible to have per-thread 
>>>> instances of GenericDelegator.
>>>>
>>>> 3. Replaced the ThreadLocal variables with regular variables. 
>>>> ThreadLocal variables are no longer needed. Client code doesn't need 
>>>> to be concerned with pushing and popping the GenericDelegator state.
>>>>
>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>
>>>> User modifications will have to replace 
>>>> GenericDelegator.getGenericDelegator(...) with 
>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push 
>>>> code with the new setXxx methods, and remove the pop code. If 
>>>> modifications used DelegatorInterface, replace that with 
>>>> GenericDelegator.
>>>>
>>>> Aside from those changes, this commit is backwards compatible.
>>>>
>>>> Added:
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java   
>>>> (with props)
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java   
>>>> (with props)
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java   
>>>> (with props)
>>>> Removed:
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java 
>>>>
>>>> Modified:
>>>>   
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
>>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiContainer.java
>>>>   
>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/WebPosSession.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java 
>>>>
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -28,6 +28,7 @@
>>>> import org.ofbiz.base.util.Debug;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> import org.ofbiz.webapp.stats.VisitHandler;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericValue;
>>>> @@ -58,7 +59,7 @@
>>>>        String delegatorName = (String) 
>>>> session.getAttribute("delegatorName");
>>>>        GenericDelegator delegator = null;
>>>>        if (UtilValidate.isNotEmpty(delegatorName)) {
>>>> -            delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        if (delegator == null) {
>>>>            Debug.logError("Could not find delegator with 
>>>> delegatorName in session, not saving abandoned cart info.", module);
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -21,6 +21,7 @@
>>>> import javolution.util.FastList;
>>>> import javolution.util.FastMap;
>>>> import org.ofbiz.base.util.*;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericPK;
>>>> @@ -275,7 +276,7 @@
>>>>
>>>>    public GenericDelegator getDelegator() {
>>>>        if (delegator == null) {
>>>> -            delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -41,6 +41,7 @@
>>>> import org.ofbiz.base.util.UtilMisc;
>>>> import org.ofbiz.base.util.UtilProperties;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericPK;
>>>> @@ -2406,7 +2407,7 @@
>>>>            if (UtilValidate.isEmpty(delegatorName)) {
>>>>                throw new IllegalStateException("Bad delegator name");
>>>>            }
>>>> -            delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -35,6 +35,7 @@
>>>> import org.ofbiz.base.util.UtilFormatOut;
>>>> import org.ofbiz.base.util.UtilMisc;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericValue;
>>>> @@ -500,7 +501,7 @@
>>>>
>>>>    public GenericDelegator getDelegator() {
>>>>        if (_delegator == null) {
>>>> -            _delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            _delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return _delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -32,6 +32,7 @@
>>>> import org.ofbiz.base.util.UtilMisc;
>>>> import org.ofbiz.base.util.UtilProperties;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericValue;
>>>> @@ -76,7 +77,7 @@
>>>>
>>>>    public GenericDelegator getDelegator() {
>>>>        if (_delegator == null) {
>>>> -            _delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            _delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return _delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -34,6 +34,7 @@
>>>> import org.ofbiz.base.util.UtilNumber;
>>>> import org.ofbiz.base.util.UtilProperties;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericValue;
>>>> @@ -102,7 +103,7 @@
>>>>
>>>>    public GenericDelegator getDelegator() {
>>>>        if (_delegator == null) {
>>>> -            _delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            _delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return _delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -36,6 +36,7 @@
>>>> import org.ofbiz.base.container.ContainerException;
>>>> import org.ofbiz.base.container.ContainerConfig.Container.Property;
>>>> import org.ofbiz.base.util.*;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>>
>>>> import org.apache.catalina.Cluster;
>>>> @@ -168,7 +169,7 @@
>>>>        //int debug = ContainerConfig.getPropertyValue(cc, "debug", 0);
>>>>
>>>>        // grab some global context settings
>>>> -        this.delegator = 
>>>> GenericDelegator.getGenericDelegator(ContainerConfig.getPropertyValue(cc, 
>>>> "delegator-name", "default"));
>>>> +        this.delegator = 
>>>> DelegatorFactory.getGenericDelegator(ContainerConfig.getPropertyValue(cc, 
>>>> "delegator-name", "default"));
>>>>        this.contextReloadable = ContainerConfig.getPropertyValue(cc, 
>>>> "apps-context-reloadable", false);
>>>>        this.crossContext = ContainerConfig.getPropertyValue(cc, 
>>>> "apps-cross-context", true);
>>>>        this.distribute = ContainerConfig.getPropertyValue(cc, 
>>>> "apps-distributable", true);
>>>>
>>>> Added: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java 
>>>> (added)
>>>> +++ 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -0,0 +1,110 @@
>>>> +/*
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements.  See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership.  The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License.  You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied.  See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +package org.ofbiz.entity;
>>>> +
>>>> +import java.util.Map;
>>>> +
>>>> +import javolution.util.FastMap;
>>>> +
>>>> +import org.ofbiz.base.util.Debug;
>>>> +import org.ofbiz.entity.cache.Cache;
>>>> +import org.ofbiz.entity.config.DelegatorInfo;
>>>> +import org.ofbiz.entity.config.EntityConfigUtil;
>>>> +import org.ofbiz.entity.eca.EntityEcaHandler;
>>>> +import org.ofbiz.entity.model.ModelGroupReader;
>>>> +import org.ofbiz.entity.model.ModelReader;
>>>> +import org.ofbiz.entity.util.DistributedCacheClear;
>>>> +import org.ofbiz.entity.util.EntityCrypto;
>>>> +import org.ofbiz.entity.util.SequenceUtil;
>>>> +
>>>> +/** Data source for the DelegatorImpl Class. */
>>>> +public class DelegatorData implements Cloneable {
>>>> +
>>>> +    public static final String module = DelegatorData.class.getName();
>>>> +    /**
>>>> +     * the delegatorDataCache will now be a HashMap, allowing 
>>>> reload of
>>>> +     * definitions, but the delegator will always be the same 
>>>> object for the
>>>> +     * given name
>>>> +     */
>>>> +    protected static final Map<String, DelegatorData> 
>>>> delegatorDataCache = FastMap.newInstance();
>>>> +
>>>> +    /**
>>>> +     * keeps a list of field key sets used in the by and cache, a 
>>>> Set (of Sets
>>>> +     * of fieldNames) for each entityName
>>>> +     */
>>>> +    protected Map<?, ?> andCacheFieldSets = FastMap.newInstance();
>>>> +    protected Cache cache = null;
>>>> +    protected EntityCrypto crypto = null;
>>>> +    protected DelegatorInfo delegatorInfo = null;
>>>> +    protected String delegatorName = null;
>>>> +    protected DistributedCacheClear distributedCacheClear = null;
>>>> +    protected EntityEcaHandler<?> entityEcaHandler = null;
>>>> +    protected ModelGroupReader modelGroupReader = null;
>>>> +    protected ModelReader modelReader = null;
>>>> +    protected String originalDelegatorName = null;
>>>> +    protected SequenceUtil sequencer = null;
>>>> +    protected boolean initialized = false;
>>>> +
>>>> +    public static synchronized DelegatorData getInstance(String 
>>>> delegatorName) throws GenericEntityException {
>>>> +        if (delegatorName == null) {
>>>> +            delegatorName = "default";
>>>> +            Debug.logWarning(new Exception("Location where getting 
>>>> delegator with null name"), "Got a getGenericDelegator call with a 
>>>> null delegatorName, assuming \"default\" for the name.", module);
>>>> +        }
>>>> +        DelegatorData delegatorData = 
>>>> delegatorDataCache.get(delegatorName);
>>>> +        if (delegatorData == null) {
>>>> +            if (Debug.infoOn()) {
>>>> +                Debug.logInfo("Creating new delegator data instance 
>>>> [" + delegatorName + "] (" + Thread.currentThread().getName() + ")", 
>>>> module);
>>>> +            }
>>>> +            delegatorData = new DelegatorData(delegatorName);
>>>> +            delegatorDataCache.put(delegatorName, delegatorData);
>>>> +        }
>>>> +        return delegatorData;
>>>> +    }
>>>> +
>>>> +    /** Only allow creation through the factory method */
>>>> +    protected DelegatorData() {
>>>> +    }
>>>> +
>>>> +    /** Only allow creation through the factory method */
>>>> +    protected DelegatorData(String delegatorName) throws 
>>>> GenericEntityException {
>>>> +        this.delegatorName = delegatorName;
>>>> +        this.originalDelegatorName = delegatorName;
>>>> +        this.modelReader = ModelReader.getModelReader(delegatorName);
>>>> +        this.modelGroupReader = 
>>>> ModelGroupReader.getModelGroupReader(delegatorName);
>>>> +        this.cache = new Cache(delegatorName);
>>>> +        this.delegatorInfo = 
>>>> EntityConfigUtil.getDelegatorInfo(this.delegatorName);
>>>> +    }
>>>> +
>>>> +    @Override
>>>> +    protected Object clone() {
>>>> +        DelegatorData delegatorData = new DelegatorData();
>>>> +        delegatorData.modelReader = this.modelReader;
>>>> +        delegatorData.modelGroupReader = this.modelGroupReader;
>>>> +        delegatorData.delegatorName = this.delegatorName;
>>>> +        delegatorData.delegatorInfo = this.delegatorInfo;
>>>> +        delegatorData.cache = this.cache;
>>>> +        delegatorData.andCacheFieldSets = this.andCacheFieldSets;
>>>> +        delegatorData.distributedCacheClear = 
>>>> this.distributedCacheClear;
>>>> +        delegatorData.originalDelegatorName = 
>>>> this.originalDelegatorName;
>>>> +        delegatorData.entityEcaHandler = this.entityEcaHandler;
>>>> +        delegatorData.sequencer = this.sequencer;
>>>> +        delegatorData.crypto = this.crypto;
>>>> +        return delegatorData;
>>>> +    }
>>>> +}
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:eol-style = native
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:keywords = "Date Rev Author URL Id"
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:mime-type = text/plain
>>>>
>>>> Added: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java 
>>>> (added)
>>>> +++ 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -0,0 +1,44 @@
>>>> +/*
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements.  See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership.  The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License.  You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied.  See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +package org.ofbiz.entity;
>>>> +
>>>> +import org.ofbiz.base.util.Debug;
>>>> +
>>>> +/** GenericDelegator Factory Class. */
>>>> +public class DelegatorFactory {
>>>> +
>>>> +    public static final String module = 
>>>> DelegatorFactory.class.getName();
>>>> +
>>>> +    public static GenericDelegator getGenericDelegator(String 
>>>> delegatorName) {
>>>> +        if (delegatorName == null) {
>>>> +            delegatorName = "default";
>>>> +            Debug.logWarning(new Exception("Location where getting 
>>>> delegator with null name"), "Got a getGenericDelegator call with a 
>>>> null delegatorName, assuming default for the name.", module);
>>>> +        }
>>>> +        DelegatorData delegatorData = null;
>>>> +        try {
>>>> +            delegatorData = DelegatorData.getInstance(delegatorName);
>>>> +        } catch (GenericEntityException e) {
>>>> +            Debug.logError(e, "Could not create delegator with name 
>>>> \"" + delegatorName + "\": ", module);
>>>> +        }
>>>> +        if (delegatorData != null) {
>>>> +            return new DelegatorImpl(delegatorData);
>>>> +        }
>>>> +        return null;
>>>> +    }
>>>> +}
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:eol-style = native
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:keywords = "Date Rev Author URL Id"
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:mime-type = text/plain
>>>>
>>>>
> 
> 

Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by David E Jones <de...@me.com>.
Yes, that's why I did a similar thing in the branch.

Stepping back a little... please keep in mind that the interface will  
not be able to stay in the entity component. Part of the point of  
making these interfaces is so that we can have a ExecutionContext that  
knows certain things about a number of framework components without  
actually depending on those components at compile time. Instead with  
the interfaces in the execution context component all of the other  
components can depend on and share that.

Without that pattern it will be impossible to implement the execution  
context. As part of that, I'd rather do them all together rather than  
separately otherwise (like I mentioned before) merging the branch will  
become difficult. In fact, even with the changes you've already added  
to the trunk the merge is already a HUGE mess... (ie just updating the  
branch against the trunk).

-David


On Aug 10, 2009, at 4:42 PM, Adrian Crum wrote:

> I checked out the branch and examined it. After looking over your  
> ideas, I saw a way to make incremental changes to the trunk -  
> negating the need for a branch.
>
> The GenericDelegator refactor was done for two reasons:
>
> 1. To eliminate the hundreds of references to a concrete class, that  
> have caused inconvenience in the past.
> 2. Eliminate thread local variables and the cumbersome pushing and  
> popping of the GenericDelegator state.
>
> How it relates to the ExecutionContext is, we have the ability to  
> keep an instance in the GenericDelegator without having to create  
> more thread local variables and have even more things to push/pop.
>
> It's a cleaner design.
>
> -Adrian
>
> David E Jones wrote:
>> Adrian,
>> What is all of this, and how does it relate to what I've been  
>> working on in the executioncontext20090716 branch?
>> It seems like this will:
>> 1. cause some inconvenience now, while more comprehensive changes  
>> are being made in the executioncontext20090716 branch
>> 2. make it a LOT more difficult (perhaps impossible) to merge the  
>> executioncontext20090716 branch
>> What is your plan with this?
>> It would make life a lot easier for all of us if you would do some  
>> research on what I've already done in the executioncontext20090716  
>> branch before continuing with this.
>> -David
>> On Aug 9, 2009, at 12:04 PM, adrianc@apache.org wrote:
>>> Author: adrianc
>>> Date: Sun Aug  9 18:04:26 2009
>>> New Revision: 802567
>>>
>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>> Log:
>>> Refactored GenericDelegator:
>>>
>>> 1. Converted GenericDelegator to an interface. We already have  
>>> DelegatorInterface, but it isn't being used anywhere. Removed  
>>> DelegatorInterface.java.
>>>
>>> 2. Extracted the static, cached data from the GenericDelegator  
>>> implementation and put it in its own class - DelegatorData. The  
>>> GenericDelegator implementation holds a reference to the  
>>> DelegatorData instance. This makes it possible to have per-thread  
>>> instances of GenericDelegator.
>>>
>>> 3. Replaced the ThreadLocal variables with regular variables.  
>>> ThreadLocal variables are no longer needed. Client code doesn't  
>>> need to be concerned with pushing and popping the GenericDelegator  
>>> state.
>>>
>>> This commit paves the way for the forthcoming ExecutionContext.
>>>
>>> User modifications will have to replace  
>>> GenericDelegator.getGenericDelegator(...) with  
>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push  
>>> code with the new setXxx methods, and remove the pop code. If  
>>> modifications used DelegatorInterface, replace that with  
>>> GenericDelegator.
>>>
>>> Aside from those changes, this commit is backwards compatible.
>>>
>>> Added:
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java   (with props)
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java   (with props)
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorImpl.java   (with props)
>>> Removed:
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorInterface.java
>>> Modified:
>>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
>>> CartEventListener.java
>>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
>>> ShoppingCart.java
>>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
>>> ShoppingCartItem.java
>>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
>>> PackingSession.java
>>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>>> VerifyPickSession.java
>>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> weightPackage/WeightPackageSession.java
>>>   ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/ 
>>> CatalinaContainer.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> GenericDelegator.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> GenericEntity.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/ 
>>> AbstractCache.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/ 
>>> EntityExpr.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ 
>>> ListFinder.java
>>>   ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/ 
>>> EntityDataLoadContainer.java
>>>   ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/ 
>>> synchronization/EntitySyncContext.java
>>>   ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/ 
>>> synchronization/EntitySyncServices.java
>>>   ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/ 
>>> XuiContainer.java
>>>   ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>> entityops/EntityCount.java
>>>   ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>> entityops/EntityData.java
>>>   ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>> entityops/FindByAnd.java
>>>   ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>> entityops/FindByPrimaryKey.java
>>>   ofbiz/trunk/framework/service/src/org/ofbiz/service/ 
>>> ServiceDispatcher.java
>>>   ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ 
>>> JavaMailContainer.java
>>>   ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/ 
>>> RmiServiceContainer.java
>>>   ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ 
>>> ModelTestSuite.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
>>> ContextFilter.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
>>> ControlServlet.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
>>> RequestHandler.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
>>> CoreEvents.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
>>> ServiceStreamHandler.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
>>> XmlRpcEventHandler.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ 
>>> ServerHitBin.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ 
>>> VisitHandler.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/ 
>>> WebDavServlet.java
>>>   ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/ 
>>> WebslingerContextMapper.java
>>>   ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ 
>>> WebToolsServices.java
>>>   ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/ 
>>> AuditEntityObject.java
>>>   ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/ 
>>> SharkContainer.java
>>>   ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/ 
>>> InstanceEntityObject.java
>>>   ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/ 
>>> AbstractRequester.java
>>>   ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/ 
>>> WebPosSession.java
>>>   ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/ 
>>> definition/XpdlReader.java
>>>
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/CartEventListener.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/CartEventListener.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/CartEventListener.java Sun Aug  9 18:04:26 2009
>>> @@ -28,6 +28,7 @@
>>> import org.ofbiz.base.util.Debug;
>>> import org.ofbiz.base.util.UtilValidate;
>>> import org.ofbiz.webapp.stats.VisitHandler;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericValue;
>>> @@ -58,7 +59,7 @@
>>>        String delegatorName = (String)  
>>> session.getAttribute("delegatorName");
>>>        GenericDelegator delegator = null;
>>>        if (UtilValidate.isNotEmpty(delegatorName)) {
>>> -            delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        if (delegator == null) {
>>>            Debug.logError("Could not find delegator with  
>>> delegatorName in session, not saving abandoned cart info.", module);
>>>
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCart.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCart.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCart.java Sun Aug  9 18:04:26 2009
>>> @@ -21,6 +21,7 @@
>>> import javolution.util.FastList;
>>> import javolution.util.FastMap;
>>> import org.ofbiz.base.util.*;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericPK;
>>> @@ -275,7 +276,7 @@
>>>
>>>    public GenericDelegator getDelegator() {
>>>        if (delegator == null) {
>>> -            delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCartItem.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCartItem.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCartItem.java Sun Aug  9 18:04:26 2009
>>> @@ -41,6 +41,7 @@
>>> import org.ofbiz.base.util.UtilMisc;
>>> import org.ofbiz.base.util.UtilProperties;
>>> import org.ofbiz.base.util.UtilValidate;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericPK;
>>> @@ -2406,7 +2407,7 @@
>>>            if (UtilValidate.isEmpty(delegatorName)) {
>>>                throw new IllegalStateException("Bad delegator  
>>> name");
>>>            }
>>> -            delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/PackingSession.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/PackingSession.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/PackingSession.java Sun Aug  9 18:04:26 2009
>>> @@ -35,6 +35,7 @@
>>> import org.ofbiz.base.util.UtilFormatOut;
>>> import org.ofbiz.base.util.UtilMisc;
>>> import org.ofbiz.base.util.UtilValidate;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericValue;
>>> @@ -500,7 +501,7 @@
>>>
>>>    public GenericDelegator getDelegator() {
>>>        if (_delegator == null) {
>>> -            _delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            _delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return _delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> verify/VerifyPickSession.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>>> VerifyPickSession.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>>> VerifyPickSession.java Sun Aug  9 18:04:26 2009
>>> @@ -32,6 +32,7 @@
>>> import org.ofbiz.base.util.UtilMisc;
>>> import org.ofbiz.base.util.UtilProperties;
>>> import org.ofbiz.base.util.UtilValidate;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericValue;
>>> @@ -76,7 +77,7 @@
>>>
>>>    public GenericDelegator getDelegator() {
>>>        if (_delegator == null) {
>>> -            _delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            _delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return _delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> weightPackage/WeightPackageSession.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> weightPackage/WeightPackageSession.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> weightPackage/WeightPackageSession.java Sun Aug  9 18:04:26 2009
>>> @@ -34,6 +34,7 @@
>>> import org.ofbiz.base.util.UtilNumber;
>>> import org.ofbiz.base.util.UtilProperties;
>>> import org.ofbiz.base.util.UtilValidate;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericValue;
>>> @@ -102,7 +103,7 @@
>>>
>>>    public GenericDelegator getDelegator() {
>>>        if (_delegator == null) {
>>> -            _delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            _delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return _delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
>>> container/CatalinaContainer.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
>>> container/CatalinaContainer.java (original)
>>> +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
>>> container/CatalinaContainer.java Sun Aug  9 18:04:26 2009
>>> @@ -36,6 +36,7 @@
>>> import org.ofbiz.base.container.ContainerException;
>>> import org.ofbiz.base.container.ContainerConfig.Container.Property;
>>> import org.ofbiz.base.util.*;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>>
>>> import org.apache.catalina.Cluster;
>>> @@ -168,7 +169,7 @@
>>>        //int debug = ContainerConfig.getPropertyValue(cc, "debug",  
>>> 0);
>>>
>>>        // grab some global context settings
>>> -        this.delegator =  
>>> GenericDelegator 
>>> .getGenericDelegator(ContainerConfig.getPropertyValue(cc,  
>>> "delegator-name", "default"));
>>> +        this.delegator =  
>>> DelegatorFactory 
>>> .getGenericDelegator(ContainerConfig.getPropertyValue(cc,  
>>> "delegator-name", "default"));
>>>        this.contextReloadable =  
>>> ContainerConfig.getPropertyValue(cc, "apps-context-reloadable",  
>>> false);
>>>        this.crossContext = ContainerConfig.getPropertyValue(cc,  
>>> "apps-cross-context", true);
>>>        this.distribute = ContainerConfig.getPropertyValue(cc,  
>>> "apps-distributable", true);
>>>
>>> Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java (added)
>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java Sun Aug  9 18:04:26 2009
>>> @@ -0,0 +1,110 @@
>>> +/*
>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>> + * or more contributor license agreements.  See the NOTICE file
>>> + * distributed with this work for additional information
>>> + * regarding copyright ownership.  The ASF licenses this file
>>> + * to you under the Apache License, Version 2.0 (the
>>> + * "License"); you may not use this file except in compliance
>>> + * with the License.  You may obtain a copy of the License at
>>> + *
>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>> + *
>>> + * Unless required by applicable law or agreed to in writing,
>>> + * software distributed under the License is distributed on an
>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> + * KIND, either express or implied.  See the License for the
>>> + * specific language governing permissions and limitations
>>> + * under the License.
>>> + */
>>> +package org.ofbiz.entity;
>>> +
>>> +import java.util.Map;
>>> +
>>> +import javolution.util.FastMap;
>>> +
>>> +import org.ofbiz.base.util.Debug;
>>> +import org.ofbiz.entity.cache.Cache;
>>> +import org.ofbiz.entity.config.DelegatorInfo;
>>> +import org.ofbiz.entity.config.EntityConfigUtil;
>>> +import org.ofbiz.entity.eca.EntityEcaHandler;
>>> +import org.ofbiz.entity.model.ModelGroupReader;
>>> +import org.ofbiz.entity.model.ModelReader;
>>> +import org.ofbiz.entity.util.DistributedCacheClear;
>>> +import org.ofbiz.entity.util.EntityCrypto;
>>> +import org.ofbiz.entity.util.SequenceUtil;
>>> +
>>> +/** Data source for the DelegatorImpl Class. */
>>> +public class DelegatorData implements Cloneable {
>>> +
>>> +    public static final String module =  
>>> DelegatorData.class.getName();
>>> +    /**
>>> +     * the delegatorDataCache will now be a HashMap, allowing  
>>> reload of
>>> +     * definitions, but the delegator will always be the same  
>>> object for the
>>> +     * given name
>>> +     */
>>> +    protected static final Map<String, DelegatorData>  
>>> delegatorDataCache = FastMap.newInstance();
>>> +
>>> +    /**
>>> +     * keeps a list of field key sets used in the by and cache, a  
>>> Set (of Sets
>>> +     * of fieldNames) for each entityName
>>> +     */
>>> +    protected Map<?, ?> andCacheFieldSets = FastMap.newInstance();
>>> +    protected Cache cache = null;
>>> +    protected EntityCrypto crypto = null;
>>> +    protected DelegatorInfo delegatorInfo = null;
>>> +    protected String delegatorName = null;
>>> +    protected DistributedCacheClear distributedCacheClear = null;
>>> +    protected EntityEcaHandler<?> entityEcaHandler = null;
>>> +    protected ModelGroupReader modelGroupReader = null;
>>> +    protected ModelReader modelReader = null;
>>> +    protected String originalDelegatorName = null;
>>> +    protected SequenceUtil sequencer = null;
>>> +    protected boolean initialized = false;
>>> +
>>> +    public static synchronized DelegatorData getInstance(String  
>>> delegatorName) throws GenericEntityException {
>>> +        if (delegatorName == null) {
>>> +            delegatorName = "default";
>>> +            Debug.logWarning(new Exception("Location where  
>>> getting delegator with null name"), "Got a getGenericDelegator  
>>> call with a null delegatorName, assuming \"default\" for the  
>>> name.", module);
>>> +        }
>>> +        DelegatorData delegatorData =  
>>> delegatorDataCache.get(delegatorName);
>>> +        if (delegatorData == null) {
>>> +            if (Debug.infoOn()) {
>>> +                Debug.logInfo("Creating new delegator data  
>>> instance [" + delegatorName + "] (" +  
>>> Thread.currentThread().getName() + ")", module);
>>> +            }
>>> +            delegatorData = new DelegatorData(delegatorName);
>>> +            delegatorDataCache.put(delegatorName, delegatorData);
>>> +        }
>>> +        return delegatorData;
>>> +    }
>>> +
>>> +    /** Only allow creation through the factory method */
>>> +    protected DelegatorData() {
>>> +    }
>>> +
>>> +    /** Only allow creation through the factory method */
>>> +    protected DelegatorData(String delegatorName) throws  
>>> GenericEntityException {
>>> +        this.delegatorName = delegatorName;
>>> +        this.originalDelegatorName = delegatorName;
>>> +        this.modelReader =  
>>> ModelReader.getModelReader(delegatorName);
>>> +        this.modelGroupReader =  
>>> ModelGroupReader.getModelGroupReader(delegatorName);
>>> +        this.cache = new Cache(delegatorName);
>>> +        this.delegatorInfo =  
>>> EntityConfigUtil.getDelegatorInfo(this.delegatorName);
>>> +    }
>>> +
>>> +    @Override
>>> +    protected Object clone() {
>>> +        DelegatorData delegatorData = new DelegatorData();
>>> +        delegatorData.modelReader = this.modelReader;
>>> +        delegatorData.modelGroupReader = this.modelGroupReader;
>>> +        delegatorData.delegatorName = this.delegatorName;
>>> +        delegatorData.delegatorInfo = this.delegatorInfo;
>>> +        delegatorData.cache = this.cache;
>>> +        delegatorData.andCacheFieldSets = this.andCacheFieldSets;
>>> +        delegatorData.distributedCacheClear =  
>>> this.distributedCacheClear;
>>> +        delegatorData.originalDelegatorName =  
>>> this.originalDelegatorName;
>>> +        delegatorData.entityEcaHandler = this.entityEcaHandler;
>>> +        delegatorData.sequencer = this.sequencer;
>>> +        delegatorData.crypto = this.crypto;
>>> +        return delegatorData;
>>> +    }
>>> +}
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java
>>> ------------------------------------------------------------------------------
>>>   svn:eol-style = native
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java
>>> ------------------------------------------------------------------------------
>>>   svn:keywords = "Date Rev Author URL Id"
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java
>>> ------------------------------------------------------------------------------
>>>   svn:mime-type = text/plain
>>>
>>> Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java (added)
>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java Sun Aug  9 18:04:26 2009
>>> @@ -0,0 +1,44 @@
>>> +/*
>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>> + * or more contributor license agreements.  See the NOTICE file
>>> + * distributed with this work for additional information
>>> + * regarding copyright ownership.  The ASF licenses this file
>>> + * to you under the Apache License, Version 2.0 (the
>>> + * "License"); you may not use this file except in compliance
>>> + * with the License.  You may obtain a copy of the License at
>>> + *
>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>> + *
>>> + * Unless required by applicable law or agreed to in writing,
>>> + * software distributed under the License is distributed on an
>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> + * KIND, either express or implied.  See the License for the
>>> + * specific language governing permissions and limitations
>>> + * under the License.
>>> + */
>>> +package org.ofbiz.entity;
>>> +
>>> +import org.ofbiz.base.util.Debug;
>>> +
>>> +/** GenericDelegator Factory Class. */
>>> +public class DelegatorFactory {
>>> +
>>> +    public static final String module =  
>>> DelegatorFactory.class.getName();
>>> +
>>> +    public static GenericDelegator getGenericDelegator(String  
>>> delegatorName) {
>>> +        if (delegatorName == null) {
>>> +            delegatorName = "default";
>>> +            Debug.logWarning(new Exception("Location where  
>>> getting delegator with null name"), "Got a getGenericDelegator  
>>> call with a null delegatorName, assuming default for the name.",  
>>> module);
>>> +        }
>>> +        DelegatorData delegatorData = null;
>>> +        try {
>>> +            delegatorData =  
>>> DelegatorData.getInstance(delegatorName);
>>> +        } catch (GenericEntityException e) {
>>> +            Debug.logError(e, "Could not create delegator with  
>>> name \"" + delegatorName + "\": ", module);
>>> +        }
>>> +        if (delegatorData != null) {
>>> +            return new DelegatorImpl(delegatorData);
>>> +        }
>>> +        return null;
>>> +    }
>>> +}
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java
>>> ------------------------------------------------------------------------------
>>>   svn:eol-style = native
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java
>>> ------------------------------------------------------------------------------
>>>   svn:keywords = "Date Rev Author URL Id"
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java
>>> ------------------------------------------------------------------------------
>>>   svn:mime-type = text/plain
>>>
>>>


Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
I don't see it as a battleground. The changes I made have benefit 
outside the work David is doing in the branch.

-Adrian

Scott Gray wrote:
> I would repository not be a battle ground for conflicting designs, if 
> David started the work first then that work should be discussed fully 
> before just dumping code into the trunk that conflicts with what he's 
> already done in the branch (even if it is in your opinion cleaner).
> 
> Regards
> Scott
> 
> On 11/08/2009, at 10:42 AM, Adrian Crum wrote:
> 
>> I checked out the branch and examined it. After looking over your 
>> ideas, I saw a way to make incremental changes to the trunk - negating 
>> the need for a branch.
>>
>> The GenericDelegator refactor was done for two reasons:
>>
>> 1. To eliminate the hundreds of references to a concrete class, that 
>> have caused inconvenience in the past.
>> 2. Eliminate thread local variables and the cumbersome pushing and 
>> popping of the GenericDelegator state.
>>
>> How it relates to the ExecutionContext is, we have the ability to keep 
>> an instance in the GenericDelegator without having to create more 
>> thread local variables and have even more things to push/pop.
>>
>> It's a cleaner design.
>>
>> -Adrian
>>
>> David E Jones wrote:
>>> Adrian,
>>> What is all of this, and how does it relate to what I've been working 
>>> on in the executioncontext20090716 branch?
>>> It seems like this will:
>>> 1. cause some inconvenience now, while more comprehensive changes are 
>>> being made in the executioncontext20090716 branch
>>> 2. make it a LOT more difficult (perhaps impossible) to merge the 
>>> executioncontext20090716 branch
>>> What is your plan with this?
>>> It would make life a lot easier for all of us if you would do some 
>>> research on what I've already done in the executioncontext20090716 
>>> branch before continuing with this.
>>> -David
>>> On Aug 9, 2009, at 12:04 PM, adrianc@apache.org wrote:
>>>> Author: adrianc
>>>> Date: Sun Aug  9 18:04:26 2009
>>>> New Revision: 802567
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>> Log:
>>>> Refactored GenericDelegator:
>>>>
>>>> 1. Converted GenericDelegator to an interface. We already have 
>>>> DelegatorInterface, but it isn't being used anywhere. Removed 
>>>> DelegatorInterface.java.
>>>>
>>>> 2. Extracted the static, cached data from the GenericDelegator 
>>>> implementation and put it in its own class - DelegatorData. The 
>>>> GenericDelegator implementation holds a reference to the 
>>>> DelegatorData instance. This makes it possible to have per-thread 
>>>> instances of GenericDelegator.
>>>>
>>>> 3. Replaced the ThreadLocal variables with regular variables. 
>>>> ThreadLocal variables are no longer needed. Client code doesn't need 
>>>> to be concerned with pushing and popping the GenericDelegator state.
>>>>
>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>
>>>> User modifications will have to replace 
>>>> GenericDelegator.getGenericDelegator(...) with 
>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push 
>>>> code with the new setXxx methods, and remove the pop code. If 
>>>> modifications used DelegatorInterface, replace that with 
>>>> GenericDelegator.
>>>>
>>>> Aside from those changes, this commit is backwards compatible.
>>>>
>>>> Added:
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java   
>>>> (with props)
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java   
>>>> (with props)
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java   
>>>> (with props)
>>>> Removed:
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java 
>>>>
>>>> Modified:
>>>>   
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>>>
>>>>   
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
>>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiContainer.java
>>>>   
>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java 
>>>>
>>>>   
>>>> ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/WebPosSession.java 
>>>>
>>>>   
>>>> ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java 
>>>>
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -28,6 +28,7 @@
>>>> import org.ofbiz.base.util.Debug;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> import org.ofbiz.webapp.stats.VisitHandler;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericValue;
>>>> @@ -58,7 +59,7 @@
>>>>        String delegatorName = (String) 
>>>> session.getAttribute("delegatorName");
>>>>        GenericDelegator delegator = null;
>>>>        if (UtilValidate.isNotEmpty(delegatorName)) {
>>>> -            delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        if (delegator == null) {
>>>>            Debug.logError("Could not find delegator with 
>>>> delegatorName in session, not saving abandoned cart info.", module);
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -21,6 +21,7 @@
>>>> import javolution.util.FastList;
>>>> import javolution.util.FastMap;
>>>> import org.ofbiz.base.util.*;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericPK;
>>>> @@ -275,7 +276,7 @@
>>>>
>>>>    public GenericDelegator getDelegator() {
>>>>        if (delegator == null) {
>>>> -            delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -41,6 +41,7 @@
>>>> import org.ofbiz.base.util.UtilMisc;
>>>> import org.ofbiz.base.util.UtilProperties;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericPK;
>>>> @@ -2406,7 +2407,7 @@
>>>>            if (UtilValidate.isEmpty(delegatorName)) {
>>>>                throw new IllegalStateException("Bad delegator name");
>>>>            }
>>>> -            delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -35,6 +35,7 @@
>>>> import org.ofbiz.base.util.UtilFormatOut;
>>>> import org.ofbiz.base.util.UtilMisc;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericValue;
>>>> @@ -500,7 +501,7 @@
>>>>
>>>>    public GenericDelegator getDelegator() {
>>>>        if (_delegator == null) {
>>>> -            _delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            _delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return _delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -32,6 +32,7 @@
>>>> import org.ofbiz.base.util.UtilMisc;
>>>> import org.ofbiz.base.util.UtilProperties;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericValue;
>>>> @@ -76,7 +77,7 @@
>>>>
>>>>    public GenericDelegator getDelegator() {
>>>>        if (_delegator == null) {
>>>> -            _delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            _delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return _delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -34,6 +34,7 @@
>>>> import org.ofbiz.base.util.UtilNumber;
>>>> import org.ofbiz.base.util.UtilProperties;
>>>> import org.ofbiz.base.util.UtilValidate;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>> import org.ofbiz.entity.GenericEntityException;
>>>> import org.ofbiz.entity.GenericValue;
>>>> @@ -102,7 +103,7 @@
>>>>
>>>>    public GenericDelegator getDelegator() {
>>>>        if (_delegator == null) {
>>>> -            _delegator = 
>>>> GenericDelegator.getGenericDelegator(delegatorName);
>>>> +            _delegator = 
>>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>>        }
>>>>        return _delegator;
>>>>    }
>>>>
>>>> Modified: 
>>>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>>>
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>>> (original)
>>>> +++ 
>>>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -36,6 +36,7 @@
>>>> import org.ofbiz.base.container.ContainerException;
>>>> import org.ofbiz.base.container.ContainerConfig.Container.Property;
>>>> import org.ofbiz.base.util.*;
>>>> +import org.ofbiz.entity.DelegatorFactory;
>>>> import org.ofbiz.entity.GenericDelegator;
>>>>
>>>> import org.apache.catalina.Cluster;
>>>> @@ -168,7 +169,7 @@
>>>>        //int debug = ContainerConfig.getPropertyValue(cc, "debug", 0);
>>>>
>>>>        // grab some global context settings
>>>> -        this.delegator = 
>>>> GenericDelegator.getGenericDelegator(ContainerConfig.getPropertyValue(cc, 
>>>> "delegator-name", "default"));
>>>> +        this.delegator = 
>>>> DelegatorFactory.getGenericDelegator(ContainerConfig.getPropertyValue(cc, 
>>>> "delegator-name", "default"));
>>>>        this.contextReloadable = ContainerConfig.getPropertyValue(cc, 
>>>> "apps-context-reloadable", false);
>>>>        this.crossContext = ContainerConfig.getPropertyValue(cc, 
>>>> "apps-cross-context", true);
>>>>        this.distribute = ContainerConfig.getPropertyValue(cc, 
>>>> "apps-distributable", true);
>>>>
>>>> Added: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java 
>>>> (added)
>>>> +++ 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -0,0 +1,110 @@
>>>> +/*
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements.  See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership.  The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License.  You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied.  See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +package org.ofbiz.entity;
>>>> +
>>>> +import java.util.Map;
>>>> +
>>>> +import javolution.util.FastMap;
>>>> +
>>>> +import org.ofbiz.base.util.Debug;
>>>> +import org.ofbiz.entity.cache.Cache;
>>>> +import org.ofbiz.entity.config.DelegatorInfo;
>>>> +import org.ofbiz.entity.config.EntityConfigUtil;
>>>> +import org.ofbiz.entity.eca.EntityEcaHandler;
>>>> +import org.ofbiz.entity.model.ModelGroupReader;
>>>> +import org.ofbiz.entity.model.ModelReader;
>>>> +import org.ofbiz.entity.util.DistributedCacheClear;
>>>> +import org.ofbiz.entity.util.EntityCrypto;
>>>> +import org.ofbiz.entity.util.SequenceUtil;
>>>> +
>>>> +/** Data source for the DelegatorImpl Class. */
>>>> +public class DelegatorData implements Cloneable {
>>>> +
>>>> +    public static final String module = DelegatorData.class.getName();
>>>> +    /**
>>>> +     * the delegatorDataCache will now be a HashMap, allowing 
>>>> reload of
>>>> +     * definitions, but the delegator will always be the same 
>>>> object for the
>>>> +     * given name
>>>> +     */
>>>> +    protected static final Map<String, DelegatorData> 
>>>> delegatorDataCache = FastMap.newInstance();
>>>> +
>>>> +    /**
>>>> +     * keeps a list of field key sets used in the by and cache, a 
>>>> Set (of Sets
>>>> +     * of fieldNames) for each entityName
>>>> +     */
>>>> +    protected Map<?, ?> andCacheFieldSets = FastMap.newInstance();
>>>> +    protected Cache cache = null;
>>>> +    protected EntityCrypto crypto = null;
>>>> +    protected DelegatorInfo delegatorInfo = null;
>>>> +    protected String delegatorName = null;
>>>> +    protected DistributedCacheClear distributedCacheClear = null;
>>>> +    protected EntityEcaHandler<?> entityEcaHandler = null;
>>>> +    protected ModelGroupReader modelGroupReader = null;
>>>> +    protected ModelReader modelReader = null;
>>>> +    protected String originalDelegatorName = null;
>>>> +    protected SequenceUtil sequencer = null;
>>>> +    protected boolean initialized = false;
>>>> +
>>>> +    public static synchronized DelegatorData getInstance(String 
>>>> delegatorName) throws GenericEntityException {
>>>> +        if (delegatorName == null) {
>>>> +            delegatorName = "default";
>>>> +            Debug.logWarning(new Exception("Location where getting 
>>>> delegator with null name"), "Got a getGenericDelegator call with a 
>>>> null delegatorName, assuming \"default\" for the name.", module);
>>>> +        }
>>>> +        DelegatorData delegatorData = 
>>>> delegatorDataCache.get(delegatorName);
>>>> +        if (delegatorData == null) {
>>>> +            if (Debug.infoOn()) {
>>>> +                Debug.logInfo("Creating new delegator data instance 
>>>> [" + delegatorName + "] (" + Thread.currentThread().getName() + ")", 
>>>> module);
>>>> +            }
>>>> +            delegatorData = new DelegatorData(delegatorName);
>>>> +            delegatorDataCache.put(delegatorName, delegatorData);
>>>> +        }
>>>> +        return delegatorData;
>>>> +    }
>>>> +
>>>> +    /** Only allow creation through the factory method */
>>>> +    protected DelegatorData() {
>>>> +    }
>>>> +
>>>> +    /** Only allow creation through the factory method */
>>>> +    protected DelegatorData(String delegatorName) throws 
>>>> GenericEntityException {
>>>> +        this.delegatorName = delegatorName;
>>>> +        this.originalDelegatorName = delegatorName;
>>>> +        this.modelReader = ModelReader.getModelReader(delegatorName);
>>>> +        this.modelGroupReader = 
>>>> ModelGroupReader.getModelGroupReader(delegatorName);
>>>> +        this.cache = new Cache(delegatorName);
>>>> +        this.delegatorInfo = 
>>>> EntityConfigUtil.getDelegatorInfo(this.delegatorName);
>>>> +    }
>>>> +
>>>> +    @Override
>>>> +    protected Object clone() {
>>>> +        DelegatorData delegatorData = new DelegatorData();
>>>> +        delegatorData.modelReader = this.modelReader;
>>>> +        delegatorData.modelGroupReader = this.modelGroupReader;
>>>> +        delegatorData.delegatorName = this.delegatorName;
>>>> +        delegatorData.delegatorInfo = this.delegatorInfo;
>>>> +        delegatorData.cache = this.cache;
>>>> +        delegatorData.andCacheFieldSets = this.andCacheFieldSets;
>>>> +        delegatorData.distributedCacheClear = 
>>>> this.distributedCacheClear;
>>>> +        delegatorData.originalDelegatorName = 
>>>> this.originalDelegatorName;
>>>> +        delegatorData.entityEcaHandler = this.entityEcaHandler;
>>>> +        delegatorData.sequencer = this.sequencer;
>>>> +        delegatorData.crypto = this.crypto;
>>>> +        return delegatorData;
>>>> +    }
>>>> +}
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:eol-style = native
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:keywords = "Date Rev Author URL Id"
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:mime-type = text/plain
>>>>
>>>> Added: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>>>> URL: 
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto 
>>>>
>>>> ============================================================================== 
>>>>
>>>> --- 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java 
>>>> (added)
>>>> +++ 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java 
>>>> Sun Aug  9 18:04:26 2009
>>>> @@ -0,0 +1,44 @@
>>>> +/*
>>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>>> + * or more contributor license agreements.  See the NOTICE file
>>>> + * distributed with this work for additional information
>>>> + * regarding copyright ownership.  The ASF licenses this file
>>>> + * to you under the Apache License, Version 2.0 (the
>>>> + * "License"); you may not use this file except in compliance
>>>> + * with the License.  You may obtain a copy of the License at
>>>> + *
>>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>>> + *
>>>> + * Unless required by applicable law or agreed to in writing,
>>>> + * software distributed under the License is distributed on an
>>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>> + * KIND, either express or implied.  See the License for the
>>>> + * specific language governing permissions and limitations
>>>> + * under the License.
>>>> + */
>>>> +package org.ofbiz.entity;
>>>> +
>>>> +import org.ofbiz.base.util.Debug;
>>>> +
>>>> +/** GenericDelegator Factory Class. */
>>>> +public class DelegatorFactory {
>>>> +
>>>> +    public static final String module = 
>>>> DelegatorFactory.class.getName();
>>>> +
>>>> +    public static GenericDelegator getGenericDelegator(String 
>>>> delegatorName) {
>>>> +        if (delegatorName == null) {
>>>> +            delegatorName = "default";
>>>> +            Debug.logWarning(new Exception("Location where getting 
>>>> delegator with null name"), "Got a getGenericDelegator call with a 
>>>> null delegatorName, assuming default for the name.", module);
>>>> +        }
>>>> +        DelegatorData delegatorData = null;
>>>> +        try {
>>>> +            delegatorData = DelegatorData.getInstance(delegatorName);
>>>> +        } catch (GenericEntityException e) {
>>>> +            Debug.logError(e, "Could not create delegator with name 
>>>> \"" + delegatorName + "\": ", module);
>>>> +        }
>>>> +        if (delegatorData != null) {
>>>> +            return new DelegatorImpl(delegatorData);
>>>> +        }
>>>> +        return null;
>>>> +    }
>>>> +}
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:eol-style = native
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:keywords = "Date Rev Author URL Id"
>>>>
>>>> Propchange: 
>>>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>>>> ------------------------------------------------------------------------------ 
>>>>
>>>>   svn:mime-type = text/plain
>>>>
>>>>
> 

Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Scott Gray <sc...@hotwaxmedia.com>.
I would repository not be a battle ground for conflicting designs, if  
David started the work first then that work should be discussed fully  
before just dumping code into the trunk that conflicts with what he's  
already done in the branch (even if it is in your opinion cleaner).

Regards
Scott

On 11/08/2009, at 10:42 AM, Adrian Crum wrote:

> I checked out the branch and examined it. After looking over your  
> ideas, I saw a way to make incremental changes to the trunk -  
> negating the need for a branch.
>
> The GenericDelegator refactor was done for two reasons:
>
> 1. To eliminate the hundreds of references to a concrete class, that  
> have caused inconvenience in the past.
> 2. Eliminate thread local variables and the cumbersome pushing and  
> popping of the GenericDelegator state.
>
> How it relates to the ExecutionContext is, we have the ability to  
> keep an instance in the GenericDelegator without having to create  
> more thread local variables and have even more things to push/pop.
>
> It's a cleaner design.
>
> -Adrian
>
> David E Jones wrote:
>> Adrian,
>> What is all of this, and how does it relate to what I've been  
>> working on in the executioncontext20090716 branch?
>> It seems like this will:
>> 1. cause some inconvenience now, while more comprehensive changes  
>> are being made in the executioncontext20090716 branch
>> 2. make it a LOT more difficult (perhaps impossible) to merge the  
>> executioncontext20090716 branch
>> What is your plan with this?
>> It would make life a lot easier for all of us if you would do some  
>> research on what I've already done in the executioncontext20090716  
>> branch before continuing with this.
>> -David
>> On Aug 9, 2009, at 12:04 PM, adrianc@apache.org wrote:
>>> Author: adrianc
>>> Date: Sun Aug  9 18:04:26 2009
>>> New Revision: 802567
>>>
>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>> Log:
>>> Refactored GenericDelegator:
>>>
>>> 1. Converted GenericDelegator to an interface. We already have  
>>> DelegatorInterface, but it isn't being used anywhere. Removed  
>>> DelegatorInterface.java.
>>>
>>> 2. Extracted the static, cached data from the GenericDelegator  
>>> implementation and put it in its own class - DelegatorData. The  
>>> GenericDelegator implementation holds a reference to the  
>>> DelegatorData instance. This makes it possible to have per-thread  
>>> instances of GenericDelegator.
>>>
>>> 3. Replaced the ThreadLocal variables with regular variables.  
>>> ThreadLocal variables are no longer needed. Client code doesn't  
>>> need to be concerned with pushing and popping the GenericDelegator  
>>> state.
>>>
>>> This commit paves the way for the forthcoming ExecutionContext.
>>>
>>> User modifications will have to replace  
>>> GenericDelegator.getGenericDelegator(...) with  
>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push  
>>> code with the new setXxx methods, and remove the pop code. If  
>>> modifications used DelegatorInterface, replace that with  
>>> GenericDelegator.
>>>
>>> Aside from those changes, this commit is backwards compatible.
>>>
>>> Added:
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java   (with props)
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java   (with props)
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorImpl.java   (with props)
>>> Removed:
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorInterface.java
>>> Modified:
>>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
>>> CartEventListener.java
>>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
>>> ShoppingCart.java
>>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
>>> ShoppingCartItem.java
>>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
>>> PackingSession.java
>>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>>> VerifyPickSession.java
>>>   ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> weightPackage/WeightPackageSession.java
>>>   ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/ 
>>> CatalinaContainer.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> GenericDelegator.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> GenericEntity.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/ 
>>> AbstractCache.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/ 
>>> EntityExpr.java
>>>   ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ 
>>> ListFinder.java
>>>   ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/ 
>>> EntityDataLoadContainer.java
>>>   ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/ 
>>> synchronization/EntitySyncContext.java
>>>   ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/ 
>>> synchronization/EntitySyncServices.java
>>>   ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/ 
>>> XuiContainer.java
>>>   ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>> entityops/EntityCount.java
>>>   ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>> entityops/EntityData.java
>>>   ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>> entityops/FindByAnd.java
>>>   ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
>>> entityops/FindByPrimaryKey.java
>>>   ofbiz/trunk/framework/service/src/org/ofbiz/service/ 
>>> ServiceDispatcher.java
>>>   ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ 
>>> JavaMailContainer.java
>>>   ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/ 
>>> RmiServiceContainer.java
>>>   ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ 
>>> ModelTestSuite.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
>>> ContextFilter.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
>>> ControlServlet.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
>>> RequestHandler.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
>>> CoreEvents.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
>>> ServiceStreamHandler.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
>>> XmlRpcEventHandler.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ 
>>> ServerHitBin.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ 
>>> VisitHandler.java
>>>   ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/ 
>>> WebDavServlet.java
>>>   ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/ 
>>> WebslingerContextMapper.java
>>>   ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ 
>>> WebToolsServices.java
>>>   ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/ 
>>> AuditEntityObject.java
>>>   ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/ 
>>> SharkContainer.java
>>>   ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/ 
>>> InstanceEntityObject.java
>>>   ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/ 
>>> AbstractRequester.java
>>>   ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/ 
>>> WebPosSession.java
>>>   ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/ 
>>> definition/XpdlReader.java
>>>
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/CartEventListener.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/CartEventListener.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/CartEventListener.java Sun Aug  9 18:04:26 2009
>>> @@ -28,6 +28,7 @@
>>> import org.ofbiz.base.util.Debug;
>>> import org.ofbiz.base.util.UtilValidate;
>>> import org.ofbiz.webapp.stats.VisitHandler;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericValue;
>>> @@ -58,7 +59,7 @@
>>>        String delegatorName = (String)  
>>> session.getAttribute("delegatorName");
>>>        GenericDelegator delegator = null;
>>>        if (UtilValidate.isNotEmpty(delegatorName)) {
>>> -            delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        if (delegator == null) {
>>>            Debug.logError("Could not find delegator with  
>>> delegatorName in session, not saving abandoned cart info.", module);
>>>
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCart.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCart.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCart.java Sun Aug  9 18:04:26 2009
>>> @@ -21,6 +21,7 @@
>>> import javolution.util.FastList;
>>> import javolution.util.FastMap;
>>> import org.ofbiz.base.util.*;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericPK;
>>> @@ -275,7 +276,7 @@
>>>
>>>    public GenericDelegator getDelegator() {
>>>        if (delegator == null) {
>>> -            delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCartItem.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCartItem.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
>>> shoppingcart/ShoppingCartItem.java Sun Aug  9 18:04:26 2009
>>> @@ -41,6 +41,7 @@
>>> import org.ofbiz.base.util.UtilMisc;
>>> import org.ofbiz.base.util.UtilProperties;
>>> import org.ofbiz.base.util.UtilValidate;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericPK;
>>> @@ -2406,7 +2407,7 @@
>>>            if (UtilValidate.isEmpty(delegatorName)) {
>>>                throw new IllegalStateException("Bad delegator  
>>> name");
>>>            }
>>> -            delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/PackingSession.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/PackingSession.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> packing/PackingSession.java Sun Aug  9 18:04:26 2009
>>> @@ -35,6 +35,7 @@
>>> import org.ofbiz.base.util.UtilFormatOut;
>>> import org.ofbiz.base.util.UtilMisc;
>>> import org.ofbiz.base.util.UtilValidate;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericValue;
>>> @@ -500,7 +501,7 @@
>>>
>>>    public GenericDelegator getDelegator() {
>>>        if (_delegator == null) {
>>> -            _delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            _delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return _delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> verify/VerifyPickSession.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>>> VerifyPickSession.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
>>> VerifyPickSession.java Sun Aug  9 18:04:26 2009
>>> @@ -32,6 +32,7 @@
>>> import org.ofbiz.base.util.UtilMisc;
>>> import org.ofbiz.base.util.UtilProperties;
>>> import org.ofbiz.base.util.UtilValidate;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericValue;
>>> @@ -76,7 +77,7 @@
>>>
>>>    public GenericDelegator getDelegator() {
>>>        if (_delegator == null) {
>>> -            _delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            _delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return _delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> weightPackage/WeightPackageSession.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> weightPackage/WeightPackageSession.java (original)
>>> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
>>> weightPackage/WeightPackageSession.java Sun Aug  9 18:04:26 2009
>>> @@ -34,6 +34,7 @@
>>> import org.ofbiz.base.util.UtilNumber;
>>> import org.ofbiz.base.util.UtilProperties;
>>> import org.ofbiz.base.util.UtilValidate;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>> import org.ofbiz.entity.GenericEntityException;
>>> import org.ofbiz.entity.GenericValue;
>>> @@ -102,7 +103,7 @@
>>>
>>>    public GenericDelegator getDelegator() {
>>>        if (_delegator == null) {
>>> -            _delegator =  
>>> GenericDelegator.getGenericDelegator(delegatorName);
>>> +            _delegator =  
>>> DelegatorFactory.getGenericDelegator(delegatorName);
>>>        }
>>>        return _delegator;
>>>    }
>>>
>>> Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
>>> container/CatalinaContainer.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
>>> container/CatalinaContainer.java (original)
>>> +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
>>> container/CatalinaContainer.java Sun Aug  9 18:04:26 2009
>>> @@ -36,6 +36,7 @@
>>> import org.ofbiz.base.container.ContainerException;
>>> import org.ofbiz.base.container.ContainerConfig.Container.Property;
>>> import org.ofbiz.base.util.*;
>>> +import org.ofbiz.entity.DelegatorFactory;
>>> import org.ofbiz.entity.GenericDelegator;
>>>
>>> import org.apache.catalina.Cluster;
>>> @@ -168,7 +169,7 @@
>>>        //int debug = ContainerConfig.getPropertyValue(cc, "debug",  
>>> 0);
>>>
>>>        // grab some global context settings
>>> -        this.delegator =  
>>> GenericDelegator 
>>> .getGenericDelegator(ContainerConfig.getPropertyValue(cc,  
>>> "delegator-name", "default"));
>>> +        this.delegator =  
>>> DelegatorFactory 
>>> .getGenericDelegator(ContainerConfig.getPropertyValue(cc,  
>>> "delegator-name", "default"));
>>>        this.contextReloadable =  
>>> ContainerConfig.getPropertyValue(cc, "apps-context-reloadable",  
>>> false);
>>>        this.crossContext = ContainerConfig.getPropertyValue(cc,  
>>> "apps-cross-context", true);
>>>        this.distribute = ContainerConfig.getPropertyValue(cc,  
>>> "apps-distributable", true);
>>>
>>> Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java (added)
>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java Sun Aug  9 18:04:26 2009
>>> @@ -0,0 +1,110 @@
>>> +/*
>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>> + * or more contributor license agreements.  See the NOTICE file
>>> + * distributed with this work for additional information
>>> + * regarding copyright ownership.  The ASF licenses this file
>>> + * to you under the Apache License, Version 2.0 (the
>>> + * "License"); you may not use this file except in compliance
>>> + * with the License.  You may obtain a copy of the License at
>>> + *
>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>> + *
>>> + * Unless required by applicable law or agreed to in writing,
>>> + * software distributed under the License is distributed on an
>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> + * KIND, either express or implied.  See the License for the
>>> + * specific language governing permissions and limitations
>>> + * under the License.
>>> + */
>>> +package org.ofbiz.entity;
>>> +
>>> +import java.util.Map;
>>> +
>>> +import javolution.util.FastMap;
>>> +
>>> +import org.ofbiz.base.util.Debug;
>>> +import org.ofbiz.entity.cache.Cache;
>>> +import org.ofbiz.entity.config.DelegatorInfo;
>>> +import org.ofbiz.entity.config.EntityConfigUtil;
>>> +import org.ofbiz.entity.eca.EntityEcaHandler;
>>> +import org.ofbiz.entity.model.ModelGroupReader;
>>> +import org.ofbiz.entity.model.ModelReader;
>>> +import org.ofbiz.entity.util.DistributedCacheClear;
>>> +import org.ofbiz.entity.util.EntityCrypto;
>>> +import org.ofbiz.entity.util.SequenceUtil;
>>> +
>>> +/** Data source for the DelegatorImpl Class. */
>>> +public class DelegatorData implements Cloneable {
>>> +
>>> +    public static final String module =  
>>> DelegatorData.class.getName();
>>> +    /**
>>> +     * the delegatorDataCache will now be a HashMap, allowing  
>>> reload of
>>> +     * definitions, but the delegator will always be the same  
>>> object for the
>>> +     * given name
>>> +     */
>>> +    protected static final Map<String, DelegatorData>  
>>> delegatorDataCache = FastMap.newInstance();
>>> +
>>> +    /**
>>> +     * keeps a list of field key sets used in the by and cache, a  
>>> Set (of Sets
>>> +     * of fieldNames) for each entityName
>>> +     */
>>> +    protected Map<?, ?> andCacheFieldSets = FastMap.newInstance();
>>> +    protected Cache cache = null;
>>> +    protected EntityCrypto crypto = null;
>>> +    protected DelegatorInfo delegatorInfo = null;
>>> +    protected String delegatorName = null;
>>> +    protected DistributedCacheClear distributedCacheClear = null;
>>> +    protected EntityEcaHandler<?> entityEcaHandler = null;
>>> +    protected ModelGroupReader modelGroupReader = null;
>>> +    protected ModelReader modelReader = null;
>>> +    protected String originalDelegatorName = null;
>>> +    protected SequenceUtil sequencer = null;
>>> +    protected boolean initialized = false;
>>> +
>>> +    public static synchronized DelegatorData getInstance(String  
>>> delegatorName) throws GenericEntityException {
>>> +        if (delegatorName == null) {
>>> +            delegatorName = "default";
>>> +            Debug.logWarning(new Exception("Location where  
>>> getting delegator with null name"), "Got a getGenericDelegator  
>>> call with a null delegatorName, assuming \"default\" for the  
>>> name.", module);
>>> +        }
>>> +        DelegatorData delegatorData =  
>>> delegatorDataCache.get(delegatorName);
>>> +        if (delegatorData == null) {
>>> +            if (Debug.infoOn()) {
>>> +                Debug.logInfo("Creating new delegator data  
>>> instance [" + delegatorName + "] (" +  
>>> Thread.currentThread().getName() + ")", module);
>>> +            }
>>> +            delegatorData = new DelegatorData(delegatorName);
>>> +            delegatorDataCache.put(delegatorName, delegatorData);
>>> +        }
>>> +        return delegatorData;
>>> +    }
>>> +
>>> +    /** Only allow creation through the factory method */
>>> +    protected DelegatorData() {
>>> +    }
>>> +
>>> +    /** Only allow creation through the factory method */
>>> +    protected DelegatorData(String delegatorName) throws  
>>> GenericEntityException {
>>> +        this.delegatorName = delegatorName;
>>> +        this.originalDelegatorName = delegatorName;
>>> +        this.modelReader =  
>>> ModelReader.getModelReader(delegatorName);
>>> +        this.modelGroupReader =  
>>> ModelGroupReader.getModelGroupReader(delegatorName);
>>> +        this.cache = new Cache(delegatorName);
>>> +        this.delegatorInfo =  
>>> EntityConfigUtil.getDelegatorInfo(this.delegatorName);
>>> +    }
>>> +
>>> +    @Override
>>> +    protected Object clone() {
>>> +        DelegatorData delegatorData = new DelegatorData();
>>> +        delegatorData.modelReader = this.modelReader;
>>> +        delegatorData.modelGroupReader = this.modelGroupReader;
>>> +        delegatorData.delegatorName = this.delegatorName;
>>> +        delegatorData.delegatorInfo = this.delegatorInfo;
>>> +        delegatorData.cache = this.cache;
>>> +        delegatorData.andCacheFieldSets = this.andCacheFieldSets;
>>> +        delegatorData.distributedCacheClear =  
>>> this.distributedCacheClear;
>>> +        delegatorData.originalDelegatorName =  
>>> this.originalDelegatorName;
>>> +        delegatorData.entityEcaHandler = this.entityEcaHandler;
>>> +        delegatorData.sequencer = this.sequencer;
>>> +        delegatorData.crypto = this.crypto;
>>> +        return delegatorData;
>>> +    }
>>> +}
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java
>>> ------------------------------------------------------------------------------
>>>   svn:eol-style = native
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java
>>> ------------------------------------------------------------------------------
>>>   svn:keywords = "Date Rev Author URL Id"
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorData.java
>>> ------------------------------------------------------------------------------
>>>   svn:mime-type = text/plain
>>>
>>> Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java (added)
>>> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java Sun Aug  9 18:04:26 2009
>>> @@ -0,0 +1,44 @@
>>> +/*
>>> + * Licensed to the Apache Software Foundation (ASF) under one
>>> + * or more contributor license agreements.  See the NOTICE file
>>> + * distributed with this work for additional information
>>> + * regarding copyright ownership.  The ASF licenses this file
>>> + * to you under the Apache License, Version 2.0 (the
>>> + * "License"); you may not use this file except in compliance
>>> + * with the License.  You may obtain a copy of the License at
>>> + *
>>> + * http://www.apache.org/licenses/LICENSE-2.0
>>> + *
>>> + * Unless required by applicable law or agreed to in writing,
>>> + * software distributed under the License is distributed on an
>>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>> + * KIND, either express or implied.  See the License for the
>>> + * specific language governing permissions and limitations
>>> + * under the License.
>>> + */
>>> +package org.ofbiz.entity;
>>> +
>>> +import org.ofbiz.base.util.Debug;
>>> +
>>> +/** GenericDelegator Factory Class. */
>>> +public class DelegatorFactory {
>>> +
>>> +    public static final String module =  
>>> DelegatorFactory.class.getName();
>>> +
>>> +    public static GenericDelegator getGenericDelegator(String  
>>> delegatorName) {
>>> +        if (delegatorName == null) {
>>> +            delegatorName = "default";
>>> +            Debug.logWarning(new Exception("Location where  
>>> getting delegator with null name"), "Got a getGenericDelegator  
>>> call with a null delegatorName, assuming default for the name.",  
>>> module);
>>> +        }
>>> +        DelegatorData delegatorData = null;
>>> +        try {
>>> +            delegatorData =  
>>> DelegatorData.getInstance(delegatorName);
>>> +        } catch (GenericEntityException e) {
>>> +            Debug.logError(e, "Could not create delegator with  
>>> name \"" + delegatorName + "\": ", module);
>>> +        }
>>> +        if (delegatorData != null) {
>>> +            return new DelegatorImpl(delegatorData);
>>> +        }
>>> +        return null;
>>> +    }
>>> +}
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java
>>> ------------------------------------------------------------------------------
>>>   svn:eol-style = native
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java
>>> ------------------------------------------------------------------------------
>>>   svn:keywords = "Date Rev Author URL Id"
>>>
>>> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
>>> DelegatorFactory.java
>>> ------------------------------------------------------------------------------
>>>   svn:mime-type = text/plain
>>>
>>>


Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
I checked out the branch and examined it. After looking over your ideas, 
I saw a way to make incremental changes to the trunk - negating the need 
for a branch.

The GenericDelegator refactor was done for two reasons:

1. To eliminate the hundreds of references to a concrete class, that 
have caused inconvenience in the past.
2. Eliminate thread local variables and the cumbersome pushing and 
popping of the GenericDelegator state.

How it relates to the ExecutionContext is, we have the ability to keep 
an instance in the GenericDelegator without having to create more thread 
local variables and have even more things to push/pop.

It's a cleaner design.

-Adrian

David E Jones wrote:
> 
> Adrian,
> 
> What is all of this, and how does it relate to what I've been working on 
> in the executioncontext20090716 branch?
> 
> It seems like this will:
> 
> 1. cause some inconvenience now, while more comprehensive changes are 
> being made in the executioncontext20090716 branch
> 2. make it a LOT more difficult (perhaps impossible) to merge the 
> executioncontext20090716 branch
> 
> What is your plan with this?
> 
> It would make life a lot easier for all of us if you would do some 
> research on what I've already done in the executioncontext20090716 
> branch before continuing with this.
> 
> -David
> 
> 
> On Aug 9, 2009, at 12:04 PM, adrianc@apache.org wrote:
> 
>> Author: adrianc
>> Date: Sun Aug  9 18:04:26 2009
>> New Revision: 802567
>>
>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>> Log:
>> Refactored GenericDelegator:
>>
>> 1. Converted GenericDelegator to an interface. We already have 
>> DelegatorInterface, but it isn't being used anywhere. Removed 
>> DelegatorInterface.java.
>>
>> 2. Extracted the static, cached data from the GenericDelegator 
>> implementation and put it in its own class - DelegatorData. The 
>> GenericDelegator implementation holds a reference to the DelegatorData 
>> instance. This makes it possible to have per-thread instances of 
>> GenericDelegator.
>>
>> 3. Replaced the ThreadLocal variables with regular variables. 
>> ThreadLocal variables are no longer needed. Client code doesn't need 
>> to be concerned with pushing and popping the GenericDelegator state.
>>
>> This commit paves the way for the forthcoming ExecutionContext.
>>
>> User modifications will have to replace 
>> GenericDelegator.getGenericDelegator(...) with 
>> DelegatorFactory.getGenericDelegator(...). Also, replace the push code 
>> with the new setXxx methods, and remove the pop code. If modifications 
>> used DelegatorInterface, replace that with GenericDelegator.
>>
>> Aside from those changes, this commit is backwards compatible.
>>
>> Added:
>>    
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java   
>> (with props)
>>    
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java   
>> (with props)
>>    
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java   
>> (with props)
>> Removed:
>>    
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorInterface.java
>> Modified:
>>    
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>
>>    
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>
>>    
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>
>>    
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>
>>    
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>
>>    
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>
>>    
>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>
>>    
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
>>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java
>>    
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/AbstractCache.java 
>>
>>    
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java 
>>
>>    
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java
>>    
>> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java 
>>
>>    
>> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncContext.java 
>>
>>    
>> ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/synchronization/EntitySyncServices.java 
>>
>>    
>> ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/XuiContainer.java
>>    
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityCount.java 
>>
>>    
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/EntityData.java 
>>
>>    
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByAnd.java 
>>
>>    
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/entityops/FindByPrimaryKey.java 
>>
>>    
>> ofbiz/trunk/framework/service/src/org/ofbiz/service/ServiceDispatcher.java 
>>
>>    
>> ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/JavaMailContainer.java 
>>
>>    
>> ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java 
>>
>>    
>> ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ModelTestSuite.java 
>>
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java 
>>
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java 
>>
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java 
>>
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/CoreEvents.java
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceStreamHandler.java 
>>
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/XmlRpcEventHandler.java 
>>
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ServerHitBin.java
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/VisitHandler.java
>>    
>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/WebDavServlet.java 
>>
>>    
>> ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/WebslingerContextMapper.java 
>>
>>    
>> ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java 
>>
>>    
>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java 
>>
>>    
>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java 
>>
>>    
>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java 
>>
>>    
>> ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java 
>>
>>    
>> ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/WebPosSession.java 
>>
>>    
>> ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/definition/XpdlReader.java 
>>
>>
>> Modified: 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>> (original)
>> +++ 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java 
>> Sun Aug  9 18:04:26 2009
>> @@ -28,6 +28,7 @@
>> import org.ofbiz.base.util.Debug;
>> import org.ofbiz.base.util.UtilValidate;
>> import org.ofbiz.webapp.stats.VisitHandler;
>> +import org.ofbiz.entity.DelegatorFactory;
>> import org.ofbiz.entity.GenericDelegator;
>> import org.ofbiz.entity.GenericEntityException;
>> import org.ofbiz.entity.GenericValue;
>> @@ -58,7 +59,7 @@
>>         String delegatorName = (String) 
>> session.getAttribute("delegatorName");
>>         GenericDelegator delegator = null;
>>         if (UtilValidate.isNotEmpty(delegatorName)) {
>> -            delegator = 
>> GenericDelegator.getGenericDelegator(delegatorName);
>> +            delegator = 
>> DelegatorFactory.getGenericDelegator(delegatorName);
>>         }
>>         if (delegator == null) {
>>             Debug.logError("Could not find delegator with 
>> delegatorName in session, not saving abandoned cart info.", module);
>>
>> Modified: 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>> (original)
>> +++ 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java 
>> Sun Aug  9 18:04:26 2009
>> @@ -21,6 +21,7 @@
>> import javolution.util.FastList;
>> import javolution.util.FastMap;
>> import org.ofbiz.base.util.*;
>> +import org.ofbiz.entity.DelegatorFactory;
>> import org.ofbiz.entity.GenericDelegator;
>> import org.ofbiz.entity.GenericEntityException;
>> import org.ofbiz.entity.GenericPK;
>> @@ -275,7 +276,7 @@
>>
>>     public GenericDelegator getDelegator() {
>>         if (delegator == null) {
>> -            delegator = 
>> GenericDelegator.getGenericDelegator(delegatorName);
>> +            delegator = 
>> DelegatorFactory.getGenericDelegator(delegatorName);
>>         }
>>         return delegator;
>>     }
>>
>> Modified: 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>> (original)
>> +++ 
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java 
>> Sun Aug  9 18:04:26 2009
>> @@ -41,6 +41,7 @@
>> import org.ofbiz.base.util.UtilMisc;
>> import org.ofbiz.base.util.UtilProperties;
>> import org.ofbiz.base.util.UtilValidate;
>> +import org.ofbiz.entity.DelegatorFactory;
>> import org.ofbiz.entity.GenericDelegator;
>> import org.ofbiz.entity.GenericEntityException;
>> import org.ofbiz.entity.GenericPK;
>> @@ -2406,7 +2407,7 @@
>>             if (UtilValidate.isEmpty(delegatorName)) {
>>                 throw new IllegalStateException("Bad delegator name");
>>             }
>> -            delegator = 
>> GenericDelegator.getGenericDelegator(delegatorName);
>> +            delegator = 
>> DelegatorFactory.getGenericDelegator(delegatorName);
>>         }
>>         return delegator;
>>     }
>>
>> Modified: 
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>> (original)
>> +++ 
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java 
>> Sun Aug  9 18:04:26 2009
>> @@ -35,6 +35,7 @@
>> import org.ofbiz.base.util.UtilFormatOut;
>> import org.ofbiz.base.util.UtilMisc;
>> import org.ofbiz.base.util.UtilValidate;
>> +import org.ofbiz.entity.DelegatorFactory;
>> import org.ofbiz.entity.GenericDelegator;
>> import org.ofbiz.entity.GenericEntityException;
>> import org.ofbiz.entity.GenericValue;
>> @@ -500,7 +501,7 @@
>>
>>     public GenericDelegator getDelegator() {
>>         if (_delegator == null) {
>> -            _delegator = 
>> GenericDelegator.getGenericDelegator(delegatorName);
>> +            _delegator = 
>> DelegatorFactory.getGenericDelegator(delegatorName);
>>         }
>>         return _delegator;
>>     }
>>
>> Modified: 
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>> (original)
>> +++ 
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java 
>> Sun Aug  9 18:04:26 2009
>> @@ -32,6 +32,7 @@
>> import org.ofbiz.base.util.UtilMisc;
>> import org.ofbiz.base.util.UtilProperties;
>> import org.ofbiz.base.util.UtilValidate;
>> +import org.ofbiz.entity.DelegatorFactory;
>> import org.ofbiz.entity.GenericDelegator;
>> import org.ofbiz.entity.GenericEntityException;
>> import org.ofbiz.entity.GenericValue;
>> @@ -76,7 +77,7 @@
>>
>>     public GenericDelegator getDelegator() {
>>         if (_delegator == null) {
>> -            _delegator = 
>> GenericDelegator.getGenericDelegator(delegatorName);
>> +            _delegator = 
>> DelegatorFactory.getGenericDelegator(delegatorName);
>>         }
>>         return _delegator;
>>     }
>>
>> Modified: 
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>> (original)
>> +++ 
>> ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java 
>> Sun Aug  9 18:04:26 2009
>> @@ -34,6 +34,7 @@
>> import org.ofbiz.base.util.UtilNumber;
>> import org.ofbiz.base.util.UtilProperties;
>> import org.ofbiz.base.util.UtilValidate;
>> +import org.ofbiz.entity.DelegatorFactory;
>> import org.ofbiz.entity.GenericDelegator;
>> import org.ofbiz.entity.GenericEntityException;
>> import org.ofbiz.entity.GenericValue;
>> @@ -102,7 +103,7 @@
>>
>>     public GenericDelegator getDelegator() {
>>         if (_delegator == null) {
>> -            _delegator = 
>> GenericDelegator.getGenericDelegator(delegatorName);
>> +            _delegator = 
>> DelegatorFactory.getGenericDelegator(delegatorName);
>>         }
>>         return _delegator;
>>     }
>>
>> Modified: 
>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>>
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>> (original)
>> +++ 
>> ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java 
>> Sun Aug  9 18:04:26 2009
>> @@ -36,6 +36,7 @@
>> import org.ofbiz.base.container.ContainerException;
>> import org.ofbiz.base.container.ContainerConfig.Container.Property;
>> import org.ofbiz.base.util.*;
>> +import org.ofbiz.entity.DelegatorFactory;
>> import org.ofbiz.entity.GenericDelegator;
>>
>> import org.apache.catalina.Cluster;
>> @@ -168,7 +169,7 @@
>>         //int debug = ContainerConfig.getPropertyValue(cc, "debug", 0);
>>
>>         // grab some global context settings
>> -        this.delegator = 
>> GenericDelegator.getGenericDelegator(ContainerConfig.getPropertyValue(cc, 
>> "delegator-name", "default"));
>> +        this.delegator = 
>> DelegatorFactory.getGenericDelegator(ContainerConfig.getPropertyValue(cc, 
>> "delegator-name", "default"));
>>         this.contextReloadable = ContainerConfig.getPropertyValue(cc, 
>> "apps-context-reloadable", false);
>>         this.crossContext = ContainerConfig.getPropertyValue(cc, 
>> "apps-cross-context", true);
>>         this.distribute = ContainerConfig.getPropertyValue(cc, 
>> "apps-distributable", true);
>>
>> Added: 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java 
>> (added)
>> +++ 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java 
>> Sun Aug  9 18:04:26 2009
>> @@ -0,0 +1,110 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License.  You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.ofbiz.entity;
>> +
>> +import java.util.Map;
>> +
>> +import javolution.util.FastMap;
>> +
>> +import org.ofbiz.base.util.Debug;
>> +import org.ofbiz.entity.cache.Cache;
>> +import org.ofbiz.entity.config.DelegatorInfo;
>> +import org.ofbiz.entity.config.EntityConfigUtil;
>> +import org.ofbiz.entity.eca.EntityEcaHandler;
>> +import org.ofbiz.entity.model.ModelGroupReader;
>> +import org.ofbiz.entity.model.ModelReader;
>> +import org.ofbiz.entity.util.DistributedCacheClear;
>> +import org.ofbiz.entity.util.EntityCrypto;
>> +import org.ofbiz.entity.util.SequenceUtil;
>> +
>> +/** Data source for the DelegatorImpl Class. */
>> +public class DelegatorData implements Cloneable {
>> +
>> +    public static final String module = DelegatorData.class.getName();
>> +    /**
>> +     * the delegatorDataCache will now be a HashMap, allowing reload of
>> +     * definitions, but the delegator will always be the same object 
>> for the
>> +     * given name
>> +     */
>> +    protected static final Map<String, DelegatorData> 
>> delegatorDataCache = FastMap.newInstance();
>> +
>> +    /**
>> +     * keeps a list of field key sets used in the by and cache, a Set 
>> (of Sets
>> +     * of fieldNames) for each entityName
>> +     */
>> +    protected Map<?, ?> andCacheFieldSets = FastMap.newInstance();
>> +    protected Cache cache = null;
>> +    protected EntityCrypto crypto = null;
>> +    protected DelegatorInfo delegatorInfo = null;
>> +    protected String delegatorName = null;
>> +    protected DistributedCacheClear distributedCacheClear = null;
>> +    protected EntityEcaHandler<?> entityEcaHandler = null;
>> +    protected ModelGroupReader modelGroupReader = null;
>> +    protected ModelReader modelReader = null;
>> +    protected String originalDelegatorName = null;
>> +    protected SequenceUtil sequencer = null;
>> +    protected boolean initialized = false;
>> +
>> +    public static synchronized DelegatorData getInstance(String 
>> delegatorName) throws GenericEntityException {
>> +        if (delegatorName == null) {
>> +            delegatorName = "default";
>> +            Debug.logWarning(new Exception("Location where getting 
>> delegator with null name"), "Got a getGenericDelegator call with a 
>> null delegatorName, assuming \"default\" for the name.", module);
>> +        }
>> +        DelegatorData delegatorData = 
>> delegatorDataCache.get(delegatorName);
>> +        if (delegatorData == null) {
>> +            if (Debug.infoOn()) {
>> +                Debug.logInfo("Creating new delegator data instance 
>> [" + delegatorName + "] (" + Thread.currentThread().getName() + ")", 
>> module);
>> +            }
>> +            delegatorData = new DelegatorData(delegatorName);
>> +            delegatorDataCache.put(delegatorName, delegatorData);
>> +        }
>> +        return delegatorData;
>> +    }
>> +
>> +    /** Only allow creation through the factory method */
>> +    protected DelegatorData() {
>> +    }
>> +
>> +    /** Only allow creation through the factory method */
>> +    protected DelegatorData(String delegatorName) throws 
>> GenericEntityException {
>> +        this.delegatorName = delegatorName;
>> +        this.originalDelegatorName = delegatorName;
>> +        this.modelReader = ModelReader.getModelReader(delegatorName);
>> +        this.modelGroupReader = 
>> ModelGroupReader.getModelGroupReader(delegatorName);
>> +        this.cache = new Cache(delegatorName);
>> +        this.delegatorInfo = 
>> EntityConfigUtil.getDelegatorInfo(this.delegatorName);
>> +    }
>> +
>> +    @Override
>> +    protected Object clone() {
>> +        DelegatorData delegatorData = new DelegatorData();
>> +        delegatorData.modelReader = this.modelReader;
>> +        delegatorData.modelGroupReader = this.modelGroupReader;
>> +        delegatorData.delegatorName = this.delegatorName;
>> +        delegatorData.delegatorInfo = this.delegatorInfo;
>> +        delegatorData.cache = this.cache;
>> +        delegatorData.andCacheFieldSets = this.andCacheFieldSets;
>> +        delegatorData.distributedCacheClear = 
>> this.distributedCacheClear;
>> +        delegatorData.originalDelegatorName = 
>> this.originalDelegatorName;
>> +        delegatorData.entityEcaHandler = this.entityEcaHandler;
>> +        delegatorData.sequencer = this.sequencer;
>> +        delegatorData.crypto = this.crypto;
>> +        return delegatorData;
>> +    }
>> +}
>>
>> Propchange: 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>> ------------------------------------------------------------------------------ 
>>
>>    svn:eol-style = native
>>
>> Propchange: 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>> ------------------------------------------------------------------------------ 
>>
>>    svn:keywords = "Date Rev Author URL Id"
>>
>> Propchange: 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java
>> ------------------------------------------------------------------------------ 
>>
>>    svn:mime-type = text/plain
>>
>> Added: 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java 
>> (added)
>> +++ 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java 
>> Sun Aug  9 18:04:26 2009
>> @@ -0,0 +1,44 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License.  You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing,
>> + * software distributed under the License is distributed on an
>> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + */
>> +package org.ofbiz.entity;
>> +
>> +import org.ofbiz.base.util.Debug;
>> +
>> +/** GenericDelegator Factory Class. */
>> +public class DelegatorFactory {
>> +
>> +    public static final String module = 
>> DelegatorFactory.class.getName();
>> +
>> +    public static GenericDelegator getGenericDelegator(String 
>> delegatorName) {
>> +        if (delegatorName == null) {
>> +            delegatorName = "default";
>> +            Debug.logWarning(new Exception("Location where getting 
>> delegator with null name"), "Got a getGenericDelegator call with a 
>> null delegatorName, assuming default for the name.", module);
>> +        }
>> +        DelegatorData delegatorData = null;
>> +        try {
>> +            delegatorData = DelegatorData.getInstance(delegatorName);
>> +        } catch (GenericEntityException e) {
>> +            Debug.logError(e, "Could not create delegator with name 
>> \"" + delegatorName + "\": ", module);
>> +        }
>> +        if (delegatorData != null) {
>> +            return new DelegatorImpl(delegatorData);
>> +        }
>> +        return null;
>> +    }
>> +}
>>
>> Propchange: 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>> ------------------------------------------------------------------------------ 
>>
>>    svn:eol-style = native
>>
>> Propchange: 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>> ------------------------------------------------------------------------------ 
>>
>>    svn:keywords = "Date Rev Author URL Id"
>>
>> Propchange: 
>> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
>> ------------------------------------------------------------------------------ 
>>
>>    svn:mime-type = text/plain
>>
>>
> 
> 

Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by David E Jones <de...@me.com>.
Adrian,

What is all of this, and how does it relate to what I've been working  
on in the executioncontext20090716 branch?

It seems like this will:

1. cause some inconvenience now, while more comprehensive changes are  
being made in the executioncontext20090716 branch
2. make it a LOT more difficult (perhaps impossible) to merge the  
executioncontext20090716 branch

What is your plan with this?

It would make life a lot easier for all of us if you would do some  
research on what I've already done in the executioncontext20090716  
branch before continuing with this.

-David


On Aug 9, 2009, at 12:04 PM, adrianc@apache.org wrote:

> Author: adrianc
> Date: Sun Aug  9 18:04:26 2009
> New Revision: 802567
>
> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
> Log:
> Refactored GenericDelegator:
>
> 1. Converted GenericDelegator to an interface. We already have  
> DelegatorInterface, but it isn't being used anywhere. Removed  
> DelegatorInterface.java.
>
> 2. Extracted the static, cached data from the GenericDelegator  
> implementation and put it in its own class - DelegatorData. The  
> GenericDelegator implementation holds a reference to the  
> DelegatorData instance. This makes it possible to have per-thread  
> instances of GenericDelegator.
>
> 3. Replaced the ThreadLocal variables with regular variables.  
> ThreadLocal variables are no longer needed. Client code doesn't need  
> to be concerned with pushing and popping the GenericDelegator state.
>
> This commit paves the way for the forthcoming ExecutionContext.
>
> User modifications will have to replace  
> GenericDelegator.getGenericDelegator(...) with  
> DelegatorFactory.getGenericDelegator(...). Also, replace the push  
> code with the new setXxx methods, and remove the pop code. If  
> modifications used DelegatorInterface, replace that with  
> GenericDelegator.
>
> Aside from those changes, this commit is backwards compatible.
>
> Added:
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorData.java   (with props)
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorFactory.java   (with props)
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorImpl.java   (with props)
> Removed:
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorInterface.java
> Modified:
>    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
> CartEventListener.java
>    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
> ShoppingCart.java
>    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
> ShoppingCartItem.java
>    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
> PackingSession.java
>    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
> VerifyPickSession.java
>    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
> weightPackage/WeightPackageSession.java
>    ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/ 
> CatalinaContainer.java
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> GenericDelegator.java
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> GenericEntity.java
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/cache/ 
> AbstractCache.java
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/ 
> EntityExpr.java
>    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ 
> ListFinder.java
>    ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/ 
> EntityDataLoadContainer.java
>    ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/ 
> synchronization/EntitySyncContext.java
>    ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/ 
> synchronization/EntitySyncServices.java
>    ofbiz/trunk/framework/guiapp/src/org/ofbiz/guiapp/xui/ 
> XuiContainer.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
> entityops/EntityCount.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
> entityops/EntityData.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
> entityops/FindByAnd.java
>    ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/ 
> entityops/FindByPrimaryKey.java
>    ofbiz/trunk/framework/service/src/org/ofbiz/service/ 
> ServiceDispatcher.java
>    ofbiz/trunk/framework/service/src/org/ofbiz/service/mail/ 
> JavaMailContainer.java
>    ofbiz/trunk/framework/service/src/org/ofbiz/service/rmi/ 
> RmiServiceContainer.java
>    ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/ 
> ModelTestSuite.java
>    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
> ContextFilter.java
>    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
> ControlServlet.java
>    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/ 
> RequestHandler.java
>    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
> CoreEvents.java
>    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
> ServiceStreamHandler.java
>    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ 
> XmlRpcEventHandler.java
>    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ 
> ServerHitBin.java
>    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/stats/ 
> VisitHandler.java
>    ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/webdav/ 
> WebDavServlet.java
>    ofbiz/trunk/framework/webslinger/src/org/ofbiz/webslinger/ 
> WebslingerContextMapper.java
>    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/ 
> WebToolsServices.java
>    ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/audit/ 
> AuditEntityObject.java
>    ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/container/ 
> SharkContainer.java
>    ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/instance/ 
> InstanceEntityObject.java
>    ofbiz/trunk/specialpurpose/shark/src/org/ofbiz/shark/requester/ 
> AbstractRequester.java
>    ofbiz/trunk/specialpurpose/webpos/src/org/ofbiz/webpos/session/ 
> WebPosSession.java
>    ofbiz/trunk/specialpurpose/workflow/src/org/ofbiz/workflow/ 
> definition/XpdlReader.java
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
> shoppingcart/CartEventListener.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java?rev=802567&r1=802566&r2=802567&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
> CartEventListener.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
> CartEventListener.java Sun Aug  9 18:04:26 2009
> @@ -28,6 +28,7 @@
> import org.ofbiz.base.util.Debug;
> import org.ofbiz.base.util.UtilValidate;
> import org.ofbiz.webapp.stats.VisitHandler;
> +import org.ofbiz.entity.DelegatorFactory;
> import org.ofbiz.entity.GenericDelegator;
> import org.ofbiz.entity.GenericEntityException;
> import org.ofbiz.entity.GenericValue;
> @@ -58,7 +59,7 @@
>         String delegatorName = (String)  
> session.getAttribute("delegatorName");
>         GenericDelegator delegator = null;
>         if (UtilValidate.isNotEmpty(delegatorName)) {
> -            delegator =  
> GenericDelegator.getGenericDelegator(delegatorName);
> +            delegator =  
> DelegatorFactory.getGenericDelegator(delegatorName);
>         }
>         if (delegator == null) {
>             Debug.logError("Could not find delegator with  
> delegatorName in session, not saving abandoned cart info.", module);
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
> shoppingcart/ShoppingCart.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=802567&r1=802566&r2=802567&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
> ShoppingCart.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
> ShoppingCart.java Sun Aug  9 18:04:26 2009
> @@ -21,6 +21,7 @@
> import javolution.util.FastList;
> import javolution.util.FastMap;
> import org.ofbiz.base.util.*;
> +import org.ofbiz.entity.DelegatorFactory;
> import org.ofbiz.entity.GenericDelegator;
> import org.ofbiz.entity.GenericEntityException;
> import org.ofbiz.entity.GenericPK;
> @@ -275,7 +276,7 @@
>
>     public GenericDelegator getDelegator() {
>         if (delegator == null) {
> -            delegator =  
> GenericDelegator.getGenericDelegator(delegatorName);
> +            delegator =  
> DelegatorFactory.getGenericDelegator(delegatorName);
>         }
>         return delegator;
>     }
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/ 
> shoppingcart/ShoppingCartItem.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=802567&r1=802566&r2=802567&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
> ShoppingCartItem.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ 
> ShoppingCartItem.java Sun Aug  9 18:04:26 2009
> @@ -41,6 +41,7 @@
> import org.ofbiz.base.util.UtilMisc;
> import org.ofbiz.base.util.UtilProperties;
> import org.ofbiz.base.util.UtilValidate;
> +import org.ofbiz.entity.DelegatorFactory;
> import org.ofbiz.entity.GenericDelegator;
> import org.ofbiz.entity.GenericEntityException;
> import org.ofbiz.entity.GenericPK;
> @@ -2406,7 +2407,7 @@
>             if (UtilValidate.isEmpty(delegatorName)) {
>                 throw new IllegalStateException("Bad delegator name");
>             }
> -            delegator =  
> GenericDelegator.getGenericDelegator(delegatorName);
> +            delegator =  
> DelegatorFactory.getGenericDelegator(delegatorName);
>         }
>         return delegator;
>     }
>
> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
> packing/PackingSession.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/PackingSession.java?rev=802567&r1=802566&r2=802567&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
> PackingSession.java (original)
> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/packing/ 
> PackingSession.java Sun Aug  9 18:04:26 2009
> @@ -35,6 +35,7 @@
> import org.ofbiz.base.util.UtilFormatOut;
> import org.ofbiz.base.util.UtilMisc;
> import org.ofbiz.base.util.UtilValidate;
> +import org.ofbiz.entity.DelegatorFactory;
> import org.ofbiz.entity.GenericDelegator;
> import org.ofbiz.entity.GenericEntityException;
> import org.ofbiz.entity.GenericValue;
> @@ -500,7 +501,7 @@
>
>     public GenericDelegator getDelegator() {
>         if (_delegator == null) {
> -            _delegator =  
> GenericDelegator.getGenericDelegator(delegatorName);
> +            _delegator =  
> DelegatorFactory.getGenericDelegator(delegatorName);
>         }
>         return _delegator;
>     }
>
> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
> verify/VerifyPickSession.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=802567&r1=802566&r2=802567&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
> VerifyPickSession.java (original)
> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/ 
> VerifyPickSession.java Sun Aug  9 18:04:26 2009
> @@ -32,6 +32,7 @@
> import org.ofbiz.base.util.UtilMisc;
> import org.ofbiz.base.util.UtilProperties;
> import org.ofbiz.base.util.UtilValidate;
> +import org.ofbiz.entity.DelegatorFactory;
> import org.ofbiz.entity.GenericDelegator;
> import org.ofbiz.entity.GenericEntityException;
> import org.ofbiz.entity.GenericValue;
> @@ -76,7 +77,7 @@
>
>     public GenericDelegator getDelegator() {
>         if (_delegator == null) {
> -            _delegator =  
> GenericDelegator.getGenericDelegator(delegatorName);
> +            _delegator =  
> DelegatorFactory.getGenericDelegator(delegatorName);
>         }
>         return _delegator;
>     }
>
> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
> weightPackage/WeightPackageSession.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=802567&r1=802566&r2=802567&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
> weightPackage/WeightPackageSession.java (original)
> +++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/ 
> weightPackage/WeightPackageSession.java Sun Aug  9 18:04:26 2009
> @@ -34,6 +34,7 @@
> import org.ofbiz.base.util.UtilNumber;
> import org.ofbiz.base.util.UtilProperties;
> import org.ofbiz.base.util.UtilValidate;
> +import org.ofbiz.entity.DelegatorFactory;
> import org.ofbiz.entity.GenericDelegator;
> import org.ofbiz.entity.GenericEntityException;
> import org.ofbiz.entity.GenericValue;
> @@ -102,7 +103,7 @@
>
>     public GenericDelegator getDelegator() {
>         if (_delegator == null) {
> -            _delegator =  
> GenericDelegator.getGenericDelegator(delegatorName);
> +            _delegator =  
> DelegatorFactory.getGenericDelegator(delegatorName);
>         }
>         return _delegator;
>     }
>
> Modified: ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/ 
> container/CatalinaContainer.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/CatalinaContainer.java?rev=802567&r1=802566&r2=802567&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/ 
> CatalinaContainer.java (original)
> +++ ofbiz/trunk/framework/catalina/src/org/ofbiz/catalina/container/ 
> CatalinaContainer.java Sun Aug  9 18:04:26 2009
> @@ -36,6 +36,7 @@
> import org.ofbiz.base.container.ContainerException;
> import org.ofbiz.base.container.ContainerConfig.Container.Property;
> import org.ofbiz.base.util.*;
> +import org.ofbiz.entity.DelegatorFactory;
> import org.ofbiz.entity.GenericDelegator;
>
> import org.apache.catalina.Cluster;
> @@ -168,7 +169,7 @@
>         //int debug = ContainerConfig.getPropertyValue(cc, "debug",  
> 0);
>
>         // grab some global context settings
> -        this.delegator =  
> GenericDelegator 
> .getGenericDelegator(ContainerConfig.getPropertyValue(cc, "delegator- 
> name", "default"));
> +        this.delegator =  
> DelegatorFactory 
> .getGenericDelegator(ContainerConfig.getPropertyValue(cc, "delegator- 
> name", "default"));
>         this.contextReloadable =  
> ContainerConfig.getPropertyValue(cc, "apps-context-reloadable",  
> false);
>         this.crossContext = ContainerConfig.getPropertyValue(cc,  
> "apps-cross-context", true);
>         this.distribute = ContainerConfig.getPropertyValue(cc, "apps- 
> distributable", true);
>
> Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorData.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorData.java?rev=802567&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorData.java (added)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorData.java Sun Aug  9 18:04:26 2009
> @@ -0,0 +1,110 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License.  You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied.  See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.ofbiz.entity;
> +
> +import java.util.Map;
> +
> +import javolution.util.FastMap;
> +
> +import org.ofbiz.base.util.Debug;
> +import org.ofbiz.entity.cache.Cache;
> +import org.ofbiz.entity.config.DelegatorInfo;
> +import org.ofbiz.entity.config.EntityConfigUtil;
> +import org.ofbiz.entity.eca.EntityEcaHandler;
> +import org.ofbiz.entity.model.ModelGroupReader;
> +import org.ofbiz.entity.model.ModelReader;
> +import org.ofbiz.entity.util.DistributedCacheClear;
> +import org.ofbiz.entity.util.EntityCrypto;
> +import org.ofbiz.entity.util.SequenceUtil;
> +
> +/** Data source for the DelegatorImpl Class. */
> +public class DelegatorData implements Cloneable {
> +
> +    public static final String module =  
> DelegatorData.class.getName();
> +    /**
> +     * the delegatorDataCache will now be a HashMap, allowing  
> reload of
> +     * definitions, but the delegator will always be the same  
> object for the
> +     * given name
> +     */
> +    protected static final Map<String, DelegatorData>  
> delegatorDataCache = FastMap.newInstance();
> +
> +    /**
> +     * keeps a list of field key sets used in the by and cache, a  
> Set (of Sets
> +     * of fieldNames) for each entityName
> +     */
> +    protected Map<?, ?> andCacheFieldSets = FastMap.newInstance();
> +    protected Cache cache = null;
> +    protected EntityCrypto crypto = null;
> +    protected DelegatorInfo delegatorInfo = null;
> +    protected String delegatorName = null;
> +    protected DistributedCacheClear distributedCacheClear = null;
> +    protected EntityEcaHandler<?> entityEcaHandler = null;
> +    protected ModelGroupReader modelGroupReader = null;
> +    protected ModelReader modelReader = null;
> +    protected String originalDelegatorName = null;
> +    protected SequenceUtil sequencer = null;
> +    protected boolean initialized = false;
> +
> +    public static synchronized DelegatorData getInstance(String  
> delegatorName) throws GenericEntityException {
> +        if (delegatorName == null) {
> +            delegatorName = "default";
> +            Debug.logWarning(new Exception("Location where getting  
> delegator with null name"), "Got a getGenericDelegator call with a  
> null delegatorName, assuming \"default\" for the name.", module);
> +        }
> +        DelegatorData delegatorData =  
> delegatorDataCache.get(delegatorName);
> +        if (delegatorData == null) {
> +            if (Debug.infoOn()) {
> +                Debug.logInfo("Creating new delegator data instance  
> [" + delegatorName + "] (" + Thread.currentThread().getName() + ")",  
> module);
> +            }
> +            delegatorData = new DelegatorData(delegatorName);
> +            delegatorDataCache.put(delegatorName, delegatorData);
> +        }
> +        return delegatorData;
> +    }
> +
> +    /** Only allow creation through the factory method */
> +    protected DelegatorData() {
> +    }
> +
> +    /** Only allow creation through the factory method */
> +    protected DelegatorData(String delegatorName) throws  
> GenericEntityException {
> +        this.delegatorName = delegatorName;
> +        this.originalDelegatorName = delegatorName;
> +        this.modelReader = ModelReader.getModelReader(delegatorName);
> +        this.modelGroupReader =  
> ModelGroupReader.getModelGroupReader(delegatorName);
> +        this.cache = new Cache(delegatorName);
> +        this.delegatorInfo =  
> EntityConfigUtil.getDelegatorInfo(this.delegatorName);
> +    }
> +
> +    @Override
> +    protected Object clone() {
> +        DelegatorData delegatorData = new DelegatorData();
> +        delegatorData.modelReader = this.modelReader;
> +        delegatorData.modelGroupReader = this.modelGroupReader;
> +        delegatorData.delegatorName = this.delegatorName;
> +        delegatorData.delegatorInfo = this.delegatorInfo;
> +        delegatorData.cache = this.cache;
> +        delegatorData.andCacheFieldSets = this.andCacheFieldSets;
> +        delegatorData.distributedCacheClear =  
> this.distributedCacheClear;
> +        delegatorData.originalDelegatorName =  
> this.originalDelegatorName;
> +        delegatorData.entityEcaHandler = this.entityEcaHandler;
> +        delegatorData.sequencer = this.sequencer;
> +        delegatorData.crypto = this.crypto;
> +        return delegatorData;
> +    }
> +}
>
> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorData.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorData.java
> ------------------------------------------------------------------------------
>    svn:keywords = "Date Rev Author URL Id"
>
> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorData.java
> ------------------------------------------------------------------------------
>    svn:mime-type = text/plain
>
> Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorFactory.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=802567&view=auto
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorFactory.java (added)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorFactory.java Sun Aug  9 18:04:26 2009
> @@ -0,0 +1,44 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements.  See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership.  The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License.  You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied.  See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + */
> +package org.ofbiz.entity;
> +
> +import org.ofbiz.base.util.Debug;
> +
> +/** GenericDelegator Factory Class. */
> +public class DelegatorFactory {
> +
> +    public static final String module =  
> DelegatorFactory.class.getName();
> +
> +    public static GenericDelegator getGenericDelegator(String  
> delegatorName) {
> +        if (delegatorName == null) {
> +            delegatorName = "default";
> +            Debug.logWarning(new Exception("Location where getting  
> delegator with null name"), "Got a getGenericDelegator call with a  
> null delegatorName, assuming default for the name.", module);
> +        }
> +        DelegatorData delegatorData = null;
> +        try {
> +            delegatorData = DelegatorData.getInstance(delegatorName);
> +        } catch (GenericEntityException e) {
> +            Debug.logError(e, "Could not create delegator with name  
> \"" + delegatorName + "\": ", module);
> +        }
> +        if (delegatorData != null) {
> +            return new DelegatorImpl(delegatorData);
> +        }
> +        return null;
> +    }
> +}
>
> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorFactory.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorFactory.java
> ------------------------------------------------------------------------------
>    svn:keywords = "Date Rev Author URL Id"
>
> Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/ 
> DelegatorFactory.java
> ------------------------------------------------------------------------------
>    svn:mime-type = text/plain
>
>


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
Adam Heath wrote:
> Adrian Crum wrote:
>> Adam Heath wrote:
>>> adrianc@apache.org wrote:
>>>> Author: adrianc
>>>> Date: Sun Aug  9 18:04:26 2009
>>>> New Revision: 802567
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>> Log:
>>>> Refactored GenericDelegator:
>>>>
>>>> 1. Converted GenericDelegator to an interface. We already have
>>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>>> DelegatorInterface.java.
>>>>
>>>> 2. Extracted the static, cached data from the GenericDelegator
>>>> implementation and put it in its own class - DelegatorData. The
>>>> GenericDelegator implementation holds a reference to the
>>>> DelegatorData instance. This makes it possible to have per-thread
>>>> instances of GenericDelegator.
>>>>
>>>> 3. Replaced the ThreadLocal variables with regular variables.
>>>> ThreadLocal variables are no longer needed. Client code doesn't need
>>>> to be concerned with pushing and popping the GenericDelegator state.
>>>>
>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>
>>>> User modifications will have to replace
>>>> GenericDelegator.getGenericDelegator(...) with
>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push
>>>> code with the new setXxx methods, and remove the pop code. If
>>>> modifications used DelegatorInterface, replace that with
>>>> GenericDelegator.
>>>>
>>>> Aside from those changes, this commit is backwards compatible.
>>> No, it is not backwards compatible.
>>>
>>> When a java class is compiled, the bytecode requests an interface
>>> named 'foo', or a class named 'foo'.  If 'foo' changes from class to
>>> interface, then pre-compiled classes will *not* load.
>>>
>>> Please, change GenericDelegator back to a class.
>>>
>>> If DelegatorInterface wasn't used, and was just not uptodate with the
>>> method signatures, wouldn't the simpler thing have been to improve
>>> DelegatorInterface, then to change the class itself?  It seems more
>>> work to change the class to an interface.
>>>
>>> I have external code(webslinger) that needs to support multiple
>>> versions of ofbiz(one all the way back to 512946).  This change makes
>>> that impossible.  I have to have multiple versions of ofbiz
>>> installed(pre/post this change), and compile the class once for each
>>> ofbiz version.
>> Which is easier: rewrite all your Webslinger code to reference
>> DelegatorInterface instead of GenericDelegator, or just recompile your
>> existing code without making any changes?
> 
> That's just it, I wouldn't have to recompile *at all*, if
> GenericDelegator stayed a class.  Nor would anyone else.
> 

Namely, it's a conflict with invokevirtual vs. invokeinterface.

   4:   invokevirtual   #45; //Method
org/ofbiz/entity/GenericDelegator.getCache:()Lorg/ofbiz/entity/cache/Cache;



Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by David E Jones <de...@me.com>.
On Sep 8, 2009, at 1:18 PM, Adam Heath wrote:

> David E Jones wrote:
>>
>> On Sep 8, 2009, at 11:58 AM, Adam Heath wrote:
>>
>>> Adrian Crum wrote:
>>>> Adam Heath wrote:
>>>>> Adrian Crum wrote:
>>>>>> Adam Heath wrote:
>>>>>>> adrianc@apache.org wrote:
>>>>>>>> Author: adrianc
>>>>>>>> Date: Sun Aug  9 18:04:26 2009
>>>>>>>> New Revision: 802567
>>>>>>>>
>>>>>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>>>>>> Log:
>>>>>>>> Refactored GenericDelegator:
>>>>>>>>
>>>>>>>> 1. Converted GenericDelegator to an interface. We already have
>>>>>>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>>>>>>> DelegatorInterface.java.
>>>>>>>>
>>>>>>>> 2. Extracted the static, cached data from the GenericDelegator
>>>>>>>> implementation and put it in its own class - DelegatorData. The
>>>>>>>> GenericDelegator implementation holds a reference to the
>>>>>>>> DelegatorData instance. This makes it possible to have per- 
>>>>>>>> thread
>>>>>>>> instances of GenericDelegator.
>>>>>>>>
>>>>>>>> 3. Replaced the ThreadLocal variables with regular variables.
>>>>>>>> ThreadLocal variables are no longer needed. Client code  
>>>>>>>> doesn't need
>>>>>>>> to be concerned with pushing and popping the GenericDelegator  
>>>>>>>> state.
>>>>>>>>
>>>>>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>>>>>
>>>>>>>> User modifications will have to replace
>>>>>>>> GenericDelegator.getGenericDelegator(...) with
>>>>>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the  
>>>>>>>> push
>>>>>>>> code with the new setXxx methods, and remove the pop code. If
>>>>>>>> modifications used DelegatorInterface, replace that with
>>>>>>>> GenericDelegator.
>>>>>>>>
>>>>>>>> Aside from those changes, this commit is backwards compatible.
>>>>>>> No, it is not backwards compatible.
>>>>>>>
>>>>>>> When a java class is compiled, the bytecode requests an  
>>>>>>> interface
>>>>>>> named 'foo', or a class named 'foo'.  If 'foo' changes from  
>>>>>>> class to
>>>>>>> interface, then pre-compiled classes will *not* load.
>>>>>>>
>>>>>>> Please, change GenericDelegator back to a class.
>>>>>>>
>>>>>>> If DelegatorInterface wasn't used, and was just not uptodate  
>>>>>>> with the
>>>>>>> method signatures, wouldn't the simpler thing have been to  
>>>>>>> improve
>>>>>>> DelegatorInterface, then to change the class itself?  It seems  
>>>>>>> more
>>>>>>> work to change the class to an interface.
>>>>>>>
>>>>>>> I have external code(webslinger) that needs to support multiple
>>>>>>> versions of ofbiz(one all the way back to 512946).  This  
>>>>>>> change makes
>>>>>>> that impossible.  I have to have multiple versions of ofbiz
>>>>>>> installed(pre/post this change), and compile the class once  
>>>>>>> for each
>>>>>>> ofbiz version.
>>>>>> Which is easier: rewrite all your Webslinger code to reference
>>>>>> DelegatorInterface instead of GenericDelegator, or just  
>>>>>> recompile your
>>>>>> existing code without making any changes?
>>>>>
>>>>> That's just it, I wouldn't have to recompile *at all*, if
>>>>> GenericDelegator stayed a class.  Nor would anyone else.
>>>>
>>>> I don't have a problem with reverting it, but GenericDelegator will
>>>> become an interface eventually. If you take a look at David's
>>>> ExecutionContext branch, that is what he has planned.
>>>
>>> Why?  We already had DelegatorInterface, that has existed for years;
>>> it was just never fleshed out.
>>
>> There was a lot of discussion about this in the context of the
>> reasons/goals behind the executioncontext branch(es). The basic  
>> idea is
>> to move the framework to be accessible through a set of interfaces  
>> that
>> are in a single place, a low-level component that other framework
>> components will depend on, and then all code will use the framework
>> through the interfaces instead of going directly to classes (which  
>> will
>> just be internal implementations of the framework interfaces and not
>> generally used directly).
>>
>> For the rationale behind this, please see the write up I sent to this
>> mailing list a few weeks ago about the ExecutionContext and related  
>> stuff.
>
> Sure, understand all that.  But this broke ABI.  And I understand that
> such a set of changes will *have* to break ABI.
>
> If this change is to support the ExecutionContext branch, then it
> should stay in that branch, 'til it is ready.

That is one thing I DO agree with, which is why I was doing all of the  
work I did in a branch and refactoring dependent code there.

> I'm seeing this done in the reverse order.  Introduce a *new*
> interface, that existing implementations will use.  Alter all users to
> use the interface.  When all users are so modified, rename the
> implementation to whatever.
>
> What has happened, is that the last step was done first.

Profound.

-David



Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
+1

On Sep 8, 2009, at 1:49 PM, Adam Heath wrote:

> Adrian Crum wrote:
>> David and I are in agreement on the end result, and this point is  
>> where
>> we disagree. Like you, David wants all changes to be made in the  
>> branch.
>> I don't think a branch is needed. The interface extractions can be  
>> done
>> a little at a time in the trunk.
>>
>> A branch with the kind of extensive changes that are planned will  
>> open
>> up a HUGE can of worms when it is merged with the trunk. Consider  
>> that
>> this one interface extraction resulted in three bug reports - what  
>> would
>> happen if we introduced dozens of interface extractions in a single  
>> commit?
>
> I agree with you as well, this does *not* need to be done in a
> separate branch.
>
> However, what you did by doing the last step first, in trunk, is the
> wrong approach.
>
> * Adding a new interface to some base component does not break
> unreleated code(short amount of time).
> * Implementing said interface by an existing object does not break
> unreleated code(short amount of time).
> * Modifying other code to use the interface does not break unrelated
> code(takes a long time to do, and can be done incrementally by many
> people).
> * When other code no longer references concrete class, then
> remove/rename it(breaks unreleated code, but that needs to be
> announced, not just discussed).
>
> This set of changes does *not* need to be done in a hole; it can be
> done incrementally.
>


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> Adrian Crum wrote:
>> So, the code:
>>
>> GenericDelegator delegator = GenericDelegator.getGenericDelegator(String
>> delegatorName);
>>
>> would be replaced with something like:
>>
>> DelegatorFactory factory = (DelegatorFactory)
>> UtilObject.getServiceProviderByClass(DelegatorFactory.class);
>> DelegatorInterface delegator = DelegatorFactory
>> .getGenericDelegator(String delegatorName);
> 
> ==
> public interface Factory<T> {
> 	T getInstance(String name);
> }
> public interface GenericDelegatorFactory implements
> Factory<GenericDelegator> {
> }
> public class GenericDelegatorFactoryImpl implements
> GenericDelegatorFactory {
> 	public GenericDelegator getInstance(String name) {
> 	}
> }
> public class UtilObject {
> 	public static <T> T getImplementation(Factory<T> factory, String name) {
> 
> 		Iterator<Factory<T>> it = ServiceRegistry.lookupProviders(factory,
> loader);
> 		while (it.hasNext()) {
> 			Factory<T> factory = it.next();
> 			T instance = factory.getInstance(name);
> 			if (instance != null) return instance;
> 		}
> 		throw GeneralException("foo");
> 	}
> }
> GenericDelegator delegator =
> UtilObject.getImplementation(GenericDelegatorFactory.class, name);
> 
> src/META-INF/services/org.ofbiz.entity.GenericDelegatorFactory:
> org.ofbiz.entity.GenericDelegatorFactoryImpl
> ==
> 
> The above is completely untested.

Cool - thanks!

-Adrian


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> So, the code:
> 
> GenericDelegator delegator = GenericDelegator.getGenericDelegator(String
> delegatorName);
> 
> would be replaced with something like:
> 
> DelegatorFactory factory = (DelegatorFactory)
> UtilObject.getServiceProviderByClass(DelegatorFactory.class);
> DelegatorInterface delegator = DelegatorFactory
> .getGenericDelegator(String delegatorName);

==
public interface Factory<T> {
	T getInstance(String name);
}
public interface GenericDelegatorFactory implements
Factory<GenericDelegator> {
}
public class GenericDelegatorFactoryImpl implements
GenericDelegatorFactory {
	public GenericDelegator getInstance(String name) {
	}
}
public class UtilObject {
	public static <T> T getImplementation(Factory<T> factory, String name) {

		Iterator<Factory<T>> it = ServiceRegistry.lookupProviders(factory,
loader);
		while (it.hasNext()) {
			Factory<T> factory = it.next();
			T instance = factory.getInstance(name);
			if (instance != null) return instance;
		}
		throw GeneralException("foo");
	}
}
GenericDelegator delegator =
UtilObject.getImplementation(GenericDelegatorFactory.class, name);

src/META-INF/services/org.ofbiz.entity.GenericDelegatorFactory:
org.ofbiz.entity.GenericDelegatorFactoryImpl
==

The above is completely untested.


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> Adrian Crum wrote:
>> Adam Heath wrote:
>>> However, if there was a central factory, that used the ServiceRegistry
>>> pattern, and framework/entity implemented that, getGenericDelegator
>>> then called the ServiceRegistry implementation, logging a warning(from
>>> perspective of caller) while doing so, and the base factory then
>>> loaded the delegator thru ServiceRegistry, then existing code will
>>> still work, you'd get a logged warning, and you'd support the new design.
>> Are you referring to this:
>>
>> http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider
> 
> Yes, using javax.imageio.spi.ServiceRegistry; an example of it's use
> is in CachedClassLoader.
> 
> java 1.6 has java.util.ServiceLoader, but it's a slightly different api.
> 

So, the code:

GenericDelegator delegator = GenericDelegator.getGenericDelegator(String 
delegatorName);

would be replaced with something like:

DelegatorFactory factory = (DelegatorFactory) 
UtilObject.getServiceProviderByClass(DelegatorFactory.class);
DelegatorInterface delegator = DelegatorFactory 
.getGenericDelegator(String delegatorName);

where the method

public static Object UtilObject.getServiceProviderByClass(Class 
providerClass);

would use javax.imageio.spi.ServiceRegistry to look up the provider class.

Is that correct?

-Adrian

Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> Adam Heath wrote:
>> However, if there was a central factory, that used the ServiceRegistry
>> pattern, and framework/entity implemented that, getGenericDelegator
>> then called the ServiceRegistry implementation, logging a warning(from
>> perspective of caller) while doing so, and the base factory then
>> loaded the delegator thru ServiceRegistry, then existing code will
>> still work, you'd get a logged warning, and you'd support the new design.
> 
> Are you referring to this:
> 
> http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider

Yes, using javax.imageio.spi.ServiceRegistry; an example of it's use
is in CachedClassLoader.

java 1.6 has java.util.ServiceLoader, but it's a slightly different api.

Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> However, if there was a central factory, that used the ServiceRegistry
> pattern, and framework/entity implemented that, getGenericDelegator
> then called the ServiceRegistry implementation, logging a warning(from
> perspective of caller) while doing so, and the base factory then
> loaded the delegator thru ServiceRegistry, then existing code will
> still work, you'd get a logged warning, and you'd support the new design.

Are you referring to this:

http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Service%20Provider

?

-Adrian


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> Adam Heath wrote:
>> Adrian Crum wrote:
>>> David and I are in agreement on the end result, and this point is where
>>> we disagree. Like you, David wants all changes to be made in the branch.
>>> I don't think a branch is needed. The interface extractions can be done
>>> a little at a time in the trunk.
>>>
>>> A branch with the kind of extensive changes that are planned will open
>>> up a HUGE can of worms when it is merged with the trunk. Consider that
>>> this one interface extraction resulted in three bug reports - what would
>>> happen if we introduced dozens of interface extractions in a single
>>> commit?
>>
>> I agree with you as well, this does *not* need to be done in a
>> separate branch.
>>
>> However, what you did by doing the last step first, in trunk, is the
>> wrong approach.
>>
>> * Adding a new interface to some base component does not break
>> unreleated code(short amount of time).
>> * Implementing said interface by an existing object does not break
>> unreleated code(short amount of time).
>> * Modifying other code to use the interface does not break unrelated
>> code(takes a long time to do, and can be done incrementally by many
>> people).
>> * When other code no longer references concrete class, then
>> remove/rename it(breaks unreleated code, but that needs to be
>> announced, not just discussed).
>>
>> This set of changes does *not* need to be done in a hole; it can be
>> done incrementally.
> 
> I was thinking of the hundreds of OFBiz users who will have to rewrite
> add-ons/modifications if it was done that way. I was trying to keep
> things reasonably backwards-compatible.

Not possible.  You removed GenericDelegator.getGenericDelegator, so
the external code wouldn't compile anyways.

However, if there was a central factory, that used the ServiceRegistry
pattern, and framework/entity implemented that, getGenericDelegator
then called the ServiceRegistry implementation, logging a warning(from
perspective of caller) while doing so, and the base factory then
loaded the delegator thru ServiceRegistry, then existing code will
still work, you'd get a logged warning, and you'd support the new design.

Again, all without needing to do it in a branch.

And, as a bonus, the entire community can accept patches for getting
rid of GenericDelegator.getGenericDelegator.


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> Adrian Crum wrote:
>> David and I are in agreement on the end result, and this point is where
>> we disagree. Like you, David wants all changes to be made in the branch.
>> I don't think a branch is needed. The interface extractions can be done
>> a little at a time in the trunk.
>>
>> A branch with the kind of extensive changes that are planned will open
>> up a HUGE can of worms when it is merged with the trunk. Consider that
>> this one interface extraction resulted in three bug reports - what would
>> happen if we introduced dozens of interface extractions in a single commit?
> 
> I agree with you as well, this does *not* need to be done in a
> separate branch.
> 
> However, what you did by doing the last step first, in trunk, is the
> wrong approach.
> 
> * Adding a new interface to some base component does not break
> unreleated code(short amount of time).
> * Implementing said interface by an existing object does not break
> unreleated code(short amount of time).
> * Modifying other code to use the interface does not break unrelated
> code(takes a long time to do, and can be done incrementally by many
> people).
> * When other code no longer references concrete class, then
> remove/rename it(breaks unreleated code, but that needs to be
> announced, not just discussed).
> 
> This set of changes does *not* need to be done in a hole; it can be
> done incrementally.

I was thinking of the hundreds of OFBiz users who will have to rewrite 
add-ons/modifications if it was done that way. I was trying to keep 
things reasonably backwards-compatible.

I'm working on the revert now. It will take a while to review and test.

-Adrian




Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> David and I are in agreement on the end result, and this point is where
> we disagree. Like you, David wants all changes to be made in the branch.
> I don't think a branch is needed. The interface extractions can be done
> a little at a time in the trunk.
> 
> A branch with the kind of extensive changes that are planned will open
> up a HUGE can of worms when it is merged with the trunk. Consider that
> this one interface extraction resulted in three bug reports - what would
> happen if we introduced dozens of interface extractions in a single commit?

I agree with you as well, this does *not* need to be done in a
separate branch.

However, what you did by doing the last step first, in trunk, is the
wrong approach.

* Adding a new interface to some base component does not break
unreleated code(short amount of time).
* Implementing said interface by an existing object does not break
unreleated code(short amount of time).
* Modifying other code to use the interface does not break unrelated
code(takes a long time to do, and can be done incrementally by many
people).
* When other code no longer references concrete class, then
remove/rename it(breaks unreleated code, but that needs to be
announced, not just discussed).

This set of changes does *not* need to be done in a hole; it can be
done incrementally.


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
On Sep 8, 2009, at 1:36 PM, Adrian Crum wrote:

> Adam Heath wrote:
>> David E Jones wrote:
>>> On Sep 8, 2009, at 11:58 AM, Adam Heath wrote:
>>>
>>>> Adrian Crum wrote:
>>>>> Adam Heath wrote:
>>>>>> Adrian Crum wrote:
>>>>>>> Adam Heath wrote:
>>>>>>>> adrianc@apache.org wrote:
>>>>>>>>> Author: adrianc
>>>>>>>>> Date: Sun Aug  9 18:04:26 2009
>>>>>>>>> New Revision: 802567
>>>>>>>>>
>>>>>>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>>>>>>> Log:
>>>>>>>>> Refactored GenericDelegator:
>>>>>>>>>
>>>>>>>>> 1. Converted GenericDelegator to an interface. We already have
>>>>>>>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>>>>>>>> DelegatorInterface.java.
>>>>>>>>>
>>>>>>>>> 2. Extracted the static, cached data from the GenericDelegator
>>>>>>>>> implementation and put it in its own class - DelegatorData.  
>>>>>>>>> The
>>>>>>>>> GenericDelegator implementation holds a reference to the
>>>>>>>>> DelegatorData instance. This makes it possible to have per- 
>>>>>>>>> thread
>>>>>>>>> instances of GenericDelegator.
>>>>>>>>>
>>>>>>>>> 3. Replaced the ThreadLocal variables with regular variables.
>>>>>>>>> ThreadLocal variables are no longer needed. Client code  
>>>>>>>>> doesn't need
>>>>>>>>> to be concerned with pushing and popping the  
>>>>>>>>> GenericDelegator state.
>>>>>>>>>
>>>>>>>>> This commit paves the way for the forthcoming  
>>>>>>>>> ExecutionContext.
>>>>>>>>>
>>>>>>>>> User modifications will have to replace
>>>>>>>>> GenericDelegator.getGenericDelegator(...) with
>>>>>>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the  
>>>>>>>>> push
>>>>>>>>> code with the new setXxx methods, and remove the pop code. If
>>>>>>>>> modifications used DelegatorInterface, replace that with
>>>>>>>>> GenericDelegator.
>>>>>>>>>
>>>>>>>>> Aside from those changes, this commit is backwards compatible.
>>>>>>>> No, it is not backwards compatible.
>>>>>>>>
>>>>>>>> When a java class is compiled, the bytecode requests an  
>>>>>>>> interface
>>>>>>>> named 'foo', or a class named 'foo'.  If 'foo' changes from  
>>>>>>>> class to
>>>>>>>> interface, then pre-compiled classes will *not* load.
>>>>>>>>
>>>>>>>> Please, change GenericDelegator back to a class.
>>>>>>>>
>>>>>>>> If DelegatorInterface wasn't used, and was just not uptodate  
>>>>>>>> with the
>>>>>>>> method signatures, wouldn't the simpler thing have been to  
>>>>>>>> improve
>>>>>>>> DelegatorInterface, then to change the class itself?  It  
>>>>>>>> seems more
>>>>>>>> work to change the class to an interface.
>>>>>>>>
>>>>>>>> I have external code(webslinger) that needs to support multiple
>>>>>>>> versions of ofbiz(one all the way back to 512946).  This  
>>>>>>>> change makes
>>>>>>>> that impossible.  I have to have multiple versions of ofbiz
>>>>>>>> installed(pre/post this change), and compile the class once  
>>>>>>>> for each
>>>>>>>> ofbiz version.
>>>>>>> Which is easier: rewrite all your Webslinger code to reference
>>>>>>> DelegatorInterface instead of GenericDelegator, or just  
>>>>>>> recompile your
>>>>>>> existing code without making any changes?
>>>>>> That's just it, I wouldn't have to recompile *at all*, if
>>>>>> GenericDelegator stayed a class.  Nor would anyone else.
>>>>> I don't have a problem with reverting it, but GenericDelegator  
>>>>> will
>>>>> become an interface eventually. If you take a look at David's
>>>>> ExecutionContext branch, that is what he has planned.
>>>> Why?  We already had DelegatorInterface, that has existed for  
>>>> years;
>>>> it was just never fleshed out.
>>> There was a lot of discussion about this in the context of the
>>> reasons/goals behind the executioncontext branch(es). The basic  
>>> idea is
>>> to move the framework to be accessible through a set of interfaces  
>>> that
>>> are in a single place, a low-level component that other framework
>>> components will depend on, and then all code will use the framework
>>> through the interfaces instead of going directly to classes (which  
>>> will
>>> just be internal implementations of the framework interfaces and not
>>> generally used directly).
>>>
>>> For the rationale behind this, please see the write up I sent to  
>>> this
>>> mailing list a few weeks ago about the ExecutionContext and  
>>> related stuff.
>> Sure, understand all that.  But this broke ABI.  And I understand  
>> that
>> such a set of changes will *have* to break ABI.
>> If this change is to support the ExecutionContext branch, then it
>> should stay in that branch, 'til it is ready.
>
> David and I are in agreement on the end result, and this point is  
> where we disagree. Like you, David wants all changes to be made in  
> the branch. I don't think a branch is needed. The interface  
> extractions can be done a little at a time in the trunk.
>
> A branch with the kind of extensive changes that are planned will  
> open up a HUGE can of worms when it is merged with the trunk.  
> Consider that this one interface extraction resulted in three bug  
> reports - what would happen if we introduced dozens of interface  
> extractions in a single commit?
>
> Anyways, I don't mind reverting it. I'm just making the point that  
> you will have to resolve these issues at some time in the future.

I have to admit that keeping everything outside and then merging  
things back is HUGE risk without proper unit tests on everything that  
it will touch.  In this case - that would be everything in the  
system.  I would rather it be incremental once the plan is laid down  
rather than hitting all at once.

>
> -Adrian
>


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> David E Jones wrote:
>> On Sep 8, 2009, at 11:58 AM, Adam Heath wrote:
>>
>>> Adrian Crum wrote:
>>>> Adam Heath wrote:
>>>>> Adrian Crum wrote:
>>>>>> Adam Heath wrote:
>>>>>>> adrianc@apache.org wrote:
>>>>>>>> Author: adrianc
>>>>>>>> Date: Sun Aug  9 18:04:26 2009
>>>>>>>> New Revision: 802567
>>>>>>>>
>>>>>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>>>>>> Log:
>>>>>>>> Refactored GenericDelegator:
>>>>>>>>
>>>>>>>> 1. Converted GenericDelegator to an interface. We already have
>>>>>>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>>>>>>> DelegatorInterface.java.
>>>>>>>>
>>>>>>>> 2. Extracted the static, cached data from the GenericDelegator
>>>>>>>> implementation and put it in its own class - DelegatorData. The
>>>>>>>> GenericDelegator implementation holds a reference to the
>>>>>>>> DelegatorData instance. This makes it possible to have per-thread
>>>>>>>> instances of GenericDelegator.
>>>>>>>>
>>>>>>>> 3. Replaced the ThreadLocal variables with regular variables.
>>>>>>>> ThreadLocal variables are no longer needed. Client code doesn't need
>>>>>>>> to be concerned with pushing and popping the GenericDelegator state.
>>>>>>>>
>>>>>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>>>>>
>>>>>>>> User modifications will have to replace
>>>>>>>> GenericDelegator.getGenericDelegator(...) with
>>>>>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push
>>>>>>>> code with the new setXxx methods, and remove the pop code. If
>>>>>>>> modifications used DelegatorInterface, replace that with
>>>>>>>> GenericDelegator.
>>>>>>>>
>>>>>>>> Aside from those changes, this commit is backwards compatible.
>>>>>>> No, it is not backwards compatible.
>>>>>>>
>>>>>>> When a java class is compiled, the bytecode requests an interface
>>>>>>> named 'foo', or a class named 'foo'.  If 'foo' changes from class to
>>>>>>> interface, then pre-compiled classes will *not* load.
>>>>>>>
>>>>>>> Please, change GenericDelegator back to a class.
>>>>>>>
>>>>>>> If DelegatorInterface wasn't used, and was just not uptodate with the
>>>>>>> method signatures, wouldn't the simpler thing have been to improve
>>>>>>> DelegatorInterface, then to change the class itself?  It seems more
>>>>>>> work to change the class to an interface.
>>>>>>>
>>>>>>> I have external code(webslinger) that needs to support multiple
>>>>>>> versions of ofbiz(one all the way back to 512946).  This change makes
>>>>>>> that impossible.  I have to have multiple versions of ofbiz
>>>>>>> installed(pre/post this change), and compile the class once for each
>>>>>>> ofbiz version.
>>>>>> Which is easier: rewrite all your Webslinger code to reference
>>>>>> DelegatorInterface instead of GenericDelegator, or just recompile your
>>>>>> existing code without making any changes?
>>>>> That's just it, I wouldn't have to recompile *at all*, if
>>>>> GenericDelegator stayed a class.  Nor would anyone else.
>>>> I don't have a problem with reverting it, but GenericDelegator will
>>>> become an interface eventually. If you take a look at David's
>>>> ExecutionContext branch, that is what he has planned.
>>> Why?  We already had DelegatorInterface, that has existed for years;
>>> it was just never fleshed out.
>> There was a lot of discussion about this in the context of the
>> reasons/goals behind the executioncontext branch(es). The basic idea is
>> to move the framework to be accessible through a set of interfaces that
>> are in a single place, a low-level component that other framework
>> components will depend on, and then all code will use the framework
>> through the interfaces instead of going directly to classes (which will
>> just be internal implementations of the framework interfaces and not
>> generally used directly).
>>
>> For the rationale behind this, please see the write up I sent to this
>> mailing list a few weeks ago about the ExecutionContext and related stuff.
> 
> Sure, understand all that.  But this broke ABI.  And I understand that
> such a set of changes will *have* to break ABI.
> 
> If this change is to support the ExecutionContext branch, then it
> should stay in that branch, 'til it is ready.

David and I are in agreement on the end result, and this point is where 
we disagree. Like you, David wants all changes to be made in the branch. 
I don't think a branch is needed. The interface extractions can be done 
a little at a time in the trunk.

A branch with the kind of extensive changes that are planned will open 
up a HUGE can of worms when it is merged with the trunk. Consider that 
this one interface extraction resulted in three bug reports - what would 
happen if we introduced dozens of interface extractions in a single commit?

Anyways, I don't mind reverting it. I'm just making the point that you 
will have to resolve these issues at some time in the future.

-Adrian


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
David E Jones wrote:
> 
> On Sep 8, 2009, at 11:58 AM, Adam Heath wrote:
> 
>> Adrian Crum wrote:
>>> Adam Heath wrote:
>>>> Adrian Crum wrote:
>>>>> Adam Heath wrote:
>>>>>> adrianc@apache.org wrote:
>>>>>>> Author: adrianc
>>>>>>> Date: Sun Aug  9 18:04:26 2009
>>>>>>> New Revision: 802567
>>>>>>>
>>>>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>>>>> Log:
>>>>>>> Refactored GenericDelegator:
>>>>>>>
>>>>>>> 1. Converted GenericDelegator to an interface. We already have
>>>>>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>>>>>> DelegatorInterface.java.
>>>>>>>
>>>>>>> 2. Extracted the static, cached data from the GenericDelegator
>>>>>>> implementation and put it in its own class - DelegatorData. The
>>>>>>> GenericDelegator implementation holds a reference to the
>>>>>>> DelegatorData instance. This makes it possible to have per-thread
>>>>>>> instances of GenericDelegator.
>>>>>>>
>>>>>>> 3. Replaced the ThreadLocal variables with regular variables.
>>>>>>> ThreadLocal variables are no longer needed. Client code doesn't need
>>>>>>> to be concerned with pushing and popping the GenericDelegator state.
>>>>>>>
>>>>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>>>>
>>>>>>> User modifications will have to replace
>>>>>>> GenericDelegator.getGenericDelegator(...) with
>>>>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push
>>>>>>> code with the new setXxx methods, and remove the pop code. If
>>>>>>> modifications used DelegatorInterface, replace that with
>>>>>>> GenericDelegator.
>>>>>>>
>>>>>>> Aside from those changes, this commit is backwards compatible.
>>>>>> No, it is not backwards compatible.
>>>>>>
>>>>>> When a java class is compiled, the bytecode requests an interface
>>>>>> named 'foo', or a class named 'foo'.  If 'foo' changes from class to
>>>>>> interface, then pre-compiled classes will *not* load.
>>>>>>
>>>>>> Please, change GenericDelegator back to a class.
>>>>>>
>>>>>> If DelegatorInterface wasn't used, and was just not uptodate with the
>>>>>> method signatures, wouldn't the simpler thing have been to improve
>>>>>> DelegatorInterface, then to change the class itself?  It seems more
>>>>>> work to change the class to an interface.
>>>>>>
>>>>>> I have external code(webslinger) that needs to support multiple
>>>>>> versions of ofbiz(one all the way back to 512946).  This change makes
>>>>>> that impossible.  I have to have multiple versions of ofbiz
>>>>>> installed(pre/post this change), and compile the class once for each
>>>>>> ofbiz version.
>>>>> Which is easier: rewrite all your Webslinger code to reference
>>>>> DelegatorInterface instead of GenericDelegator, or just recompile your
>>>>> existing code without making any changes?
>>>>
>>>> That's just it, I wouldn't have to recompile *at all*, if
>>>> GenericDelegator stayed a class.  Nor would anyone else.
>>>
>>> I don't have a problem with reverting it, but GenericDelegator will
>>> become an interface eventually. If you take a look at David's
>>> ExecutionContext branch, that is what he has planned.
>>
>> Why?  We already had DelegatorInterface, that has existed for years;
>> it was just never fleshed out.
> 
> There was a lot of discussion about this in the context of the
> reasons/goals behind the executioncontext branch(es). The basic idea is
> to move the framework to be accessible through a set of interfaces that
> are in a single place, a low-level component that other framework
> components will depend on, and then all code will use the framework
> through the interfaces instead of going directly to classes (which will
> just be internal implementations of the framework interfaces and not
> generally used directly).
> 
> For the rationale behind this, please see the write up I sent to this
> mailing list a few weeks ago about the ExecutionContext and related stuff.

Sure, understand all that.  But this broke ABI.  And I understand that
such a set of changes will *have* to break ABI.

If this change is to support the ExecutionContext branch, then it
should stay in that branch, 'til it is ready.

I'm seeing this done in the reverse order.  Introduce a *new*
interface, that existing implementations will use.  Alter all users to
use the interface.  When all users are so modified, rename the
implementation to whatever.

What has happened, is that the last step was done first.

Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by David E Jones <de...@me.com>.
On Sep 8, 2009, at 11:58 AM, Adam Heath wrote:

> Adrian Crum wrote:
>> Adam Heath wrote:
>>> Adrian Crum wrote:
>>>> Adam Heath wrote:
>>>>> adrianc@apache.org wrote:
>>>>>> Author: adrianc
>>>>>> Date: Sun Aug  9 18:04:26 2009
>>>>>> New Revision: 802567
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>>>> Log:
>>>>>> Refactored GenericDelegator:
>>>>>>
>>>>>> 1. Converted GenericDelegator to an interface. We already have
>>>>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>>>>> DelegatorInterface.java.
>>>>>>
>>>>>> 2. Extracted the static, cached data from the GenericDelegator
>>>>>> implementation and put it in its own class - DelegatorData. The
>>>>>> GenericDelegator implementation holds a reference to the
>>>>>> DelegatorData instance. This makes it possible to have per-thread
>>>>>> instances of GenericDelegator.
>>>>>>
>>>>>> 3. Replaced the ThreadLocal variables with regular variables.
>>>>>> ThreadLocal variables are no longer needed. Client code doesn't  
>>>>>> need
>>>>>> to be concerned with pushing and popping the GenericDelegator  
>>>>>> state.
>>>>>>
>>>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>>>
>>>>>> User modifications will have to replace
>>>>>> GenericDelegator.getGenericDelegator(...) with
>>>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push
>>>>>> code with the new setXxx methods, and remove the pop code. If
>>>>>> modifications used DelegatorInterface, replace that with
>>>>>> GenericDelegator.
>>>>>>
>>>>>> Aside from those changes, this commit is backwards compatible.
>>>>> No, it is not backwards compatible.
>>>>>
>>>>> When a java class is compiled, the bytecode requests an interface
>>>>> named 'foo', or a class named 'foo'.  If 'foo' changes from  
>>>>> class to
>>>>> interface, then pre-compiled classes will *not* load.
>>>>>
>>>>> Please, change GenericDelegator back to a class.
>>>>>
>>>>> If DelegatorInterface wasn't used, and was just not uptodate  
>>>>> with the
>>>>> method signatures, wouldn't the simpler thing have been to improve
>>>>> DelegatorInterface, then to change the class itself?  It seems  
>>>>> more
>>>>> work to change the class to an interface.
>>>>>
>>>>> I have external code(webslinger) that needs to support multiple
>>>>> versions of ofbiz(one all the way back to 512946).  This change  
>>>>> makes
>>>>> that impossible.  I have to have multiple versions of ofbiz
>>>>> installed(pre/post this change), and compile the class once for  
>>>>> each
>>>>> ofbiz version.
>>>> Which is easier: rewrite all your Webslinger code to reference
>>>> DelegatorInterface instead of GenericDelegator, or just recompile  
>>>> your
>>>> existing code without making any changes?
>>>
>>> That's just it, I wouldn't have to recompile *at all*, if
>>> GenericDelegator stayed a class.  Nor would anyone else.
>>
>> I don't have a problem with reverting it, but GenericDelegator will
>> become an interface eventually. If you take a look at David's
>> ExecutionContext branch, that is what he has planned.
>
> Why?  We already had DelegatorInterface, that has existed for years;
> it was just never fleshed out.

There was a lot of discussion about this in the context of the reasons/ 
goals behind the executioncontext branch(es). The basic idea is to  
move the framework to be accessible through a set of interfaces that  
are in a single place, a low-level component that other framework  
components will depend on, and then all code will use the framework  
through the interfaces instead of going directly to classes (which  
will just be internal implementations of the framework interfaces and  
not generally used directly).

For the rationale behind this, please see the write up I sent to this  
mailing list a few weeks ago about the ExecutionContext and related  
stuff.

-David



Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> Adrian Crum wrote:
>> Adam Heath wrote:
>>> Adrian Crum wrote:
>>>> Adam Heath wrote:
>>>>> adrianc@apache.org wrote:
>>>>>> Author: adrianc
>>>>>> Date: Sun Aug  9 18:04:26 2009
>>>>>> New Revision: 802567
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>>>> Log:
>>>>>> Refactored GenericDelegator:
>>>>>>
>>>>>> 1. Converted GenericDelegator to an interface. We already have
>>>>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>>>>> DelegatorInterface.java.
>>>>>>
>>>>>> 2. Extracted the static, cached data from the GenericDelegator
>>>>>> implementation and put it in its own class - DelegatorData. The
>>>>>> GenericDelegator implementation holds a reference to the
>>>>>> DelegatorData instance. This makes it possible to have per-thread
>>>>>> instances of GenericDelegator.
>>>>>>
>>>>>> 3. Replaced the ThreadLocal variables with regular variables.
>>>>>> ThreadLocal variables are no longer needed. Client code doesn't need
>>>>>> to be concerned with pushing and popping the GenericDelegator state.
>>>>>>
>>>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>>>
>>>>>> User modifications will have to replace
>>>>>> GenericDelegator.getGenericDelegator(...) with
>>>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push
>>>>>> code with the new setXxx methods, and remove the pop code. If
>>>>>> modifications used DelegatorInterface, replace that with
>>>>>> GenericDelegator.
>>>>>>
>>>>>> Aside from those changes, this commit is backwards compatible.
>>>>> No, it is not backwards compatible.
>>>>>
>>>>> When a java class is compiled, the bytecode requests an interface
>>>>> named 'foo', or a class named 'foo'.  If 'foo' changes from class to
>>>>> interface, then pre-compiled classes will *not* load.
>>>>>
>>>>> Please, change GenericDelegator back to a class.
>>>>>
>>>>> If DelegatorInterface wasn't used, and was just not uptodate with the
>>>>> method signatures, wouldn't the simpler thing have been to improve
>>>>> DelegatorInterface, then to change the class itself?  It seems more
>>>>> work to change the class to an interface.
>>>>>
>>>>> I have external code(webslinger) that needs to support multiple
>>>>> versions of ofbiz(one all the way back to 512946).  This change makes
>>>>> that impossible.  I have to have multiple versions of ofbiz
>>>>> installed(pre/post this change), and compile the class once for each
>>>>> ofbiz version.
>>>> Which is easier: rewrite all your Webslinger code to reference
>>>> DelegatorInterface instead of GenericDelegator, or just recompile your
>>>> existing code without making any changes?
>>> That's just it, I wouldn't have to recompile *at all*, if
>>> GenericDelegator stayed a class.  Nor would anyone else.
>> I don't have a problem with reverting it, but GenericDelegator will
>> become an interface eventually. If you take a look at David's
>> ExecutionContext branch, that is what he has planned.
> 
> Why?  We already had DelegatorInterface, that has existed for years;
> it was just never fleshed out.

It's only one class in a number of framework classes that will be 
converted to interfaces. There has been considerable discussion about it 
for about three months now.


-Adrian

Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> Adam Heath wrote:
>> Adrian Crum wrote:
>>> Adam Heath wrote:
>>>> adrianc@apache.org wrote:
>>>>> Author: adrianc
>>>>> Date: Sun Aug  9 18:04:26 2009
>>>>> New Revision: 802567
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>>> Log:
>>>>> Refactored GenericDelegator:
>>>>>
>>>>> 1. Converted GenericDelegator to an interface. We already have
>>>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>>>> DelegatorInterface.java.
>>>>>
>>>>> 2. Extracted the static, cached data from the GenericDelegator
>>>>> implementation and put it in its own class - DelegatorData. The
>>>>> GenericDelegator implementation holds a reference to the
>>>>> DelegatorData instance. This makes it possible to have per-thread
>>>>> instances of GenericDelegator.
>>>>>
>>>>> 3. Replaced the ThreadLocal variables with regular variables.
>>>>> ThreadLocal variables are no longer needed. Client code doesn't need
>>>>> to be concerned with pushing and popping the GenericDelegator state.
>>>>>
>>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>>
>>>>> User modifications will have to replace
>>>>> GenericDelegator.getGenericDelegator(...) with
>>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push
>>>>> code with the new setXxx methods, and remove the pop code. If
>>>>> modifications used DelegatorInterface, replace that with
>>>>> GenericDelegator.
>>>>>
>>>>> Aside from those changes, this commit is backwards compatible.
>>>> No, it is not backwards compatible.
>>>>
>>>> When a java class is compiled, the bytecode requests an interface
>>>> named 'foo', or a class named 'foo'.  If 'foo' changes from class to
>>>> interface, then pre-compiled classes will *not* load.
>>>>
>>>> Please, change GenericDelegator back to a class.
>>>>
>>>> If DelegatorInterface wasn't used, and was just not uptodate with the
>>>> method signatures, wouldn't the simpler thing have been to improve
>>>> DelegatorInterface, then to change the class itself?  It seems more
>>>> work to change the class to an interface.
>>>>
>>>> I have external code(webslinger) that needs to support multiple
>>>> versions of ofbiz(one all the way back to 512946).  This change makes
>>>> that impossible.  I have to have multiple versions of ofbiz
>>>> installed(pre/post this change), and compile the class once for each
>>>> ofbiz version.
>>> Which is easier: rewrite all your Webslinger code to reference
>>> DelegatorInterface instead of GenericDelegator, or just recompile your
>>> existing code without making any changes?
>>
>> That's just it, I wouldn't have to recompile *at all*, if
>> GenericDelegator stayed a class.  Nor would anyone else.
> 
> I don't have a problem with reverting it, but GenericDelegator will
> become an interface eventually. If you take a look at David's
> ExecutionContext branch, that is what he has planned.

Why?  We already had DelegatorInterface, that has existed for years;
it was just never fleshed out.


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> Adrian Crum wrote:
>> Adam Heath wrote:
>>> adrianc@apache.org wrote:
>>>> Author: adrianc
>>>> Date: Sun Aug  9 18:04:26 2009
>>>> New Revision: 802567
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>>> Log:
>>>> Refactored GenericDelegator:
>>>>
>>>> 1. Converted GenericDelegator to an interface. We already have
>>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>>> DelegatorInterface.java.
>>>>
>>>> 2. Extracted the static, cached data from the GenericDelegator
>>>> implementation and put it in its own class - DelegatorData. The
>>>> GenericDelegator implementation holds a reference to the
>>>> DelegatorData instance. This makes it possible to have per-thread
>>>> instances of GenericDelegator.
>>>>
>>>> 3. Replaced the ThreadLocal variables with regular variables.
>>>> ThreadLocal variables are no longer needed. Client code doesn't need
>>>> to be concerned with pushing and popping the GenericDelegator state.
>>>>
>>>> This commit paves the way for the forthcoming ExecutionContext.
>>>>
>>>> User modifications will have to replace
>>>> GenericDelegator.getGenericDelegator(...) with
>>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push
>>>> code with the new setXxx methods, and remove the pop code. If
>>>> modifications used DelegatorInterface, replace that with
>>>> GenericDelegator.
>>>>
>>>> Aside from those changes, this commit is backwards compatible.
>>> No, it is not backwards compatible.
>>>
>>> When a java class is compiled, the bytecode requests an interface
>>> named 'foo', or a class named 'foo'.  If 'foo' changes from class to
>>> interface, then pre-compiled classes will *not* load.
>>>
>>> Please, change GenericDelegator back to a class.
>>>
>>> If DelegatorInterface wasn't used, and was just not uptodate with the
>>> method signatures, wouldn't the simpler thing have been to improve
>>> DelegatorInterface, then to change the class itself?  It seems more
>>> work to change the class to an interface.
>>>
>>> I have external code(webslinger) that needs to support multiple
>>> versions of ofbiz(one all the way back to 512946).  This change makes
>>> that impossible.  I have to have multiple versions of ofbiz
>>> installed(pre/post this change), and compile the class once for each
>>> ofbiz version.
>> Which is easier: rewrite all your Webslinger code to reference
>> DelegatorInterface instead of GenericDelegator, or just recompile your
>> existing code without making any changes?
> 
> That's just it, I wouldn't have to recompile *at all*, if
> GenericDelegator stayed a class.  Nor would anyone else.

I don't have a problem with reverting it, but GenericDelegator will 
become an interface eventually. If you take a look at David's 
ExecutionContext branch, that is what he has planned.

-Adrian

Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> Adam Heath wrote:
>> adrianc@apache.org wrote:
>>> Author: adrianc
>>> Date: Sun Aug  9 18:04:26 2009
>>> New Revision: 802567
>>>
>>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>>> Log:
>>> Refactored GenericDelegator:
>>>
>>> 1. Converted GenericDelegator to an interface. We already have
>>> DelegatorInterface, but it isn't being used anywhere. Removed
>>> DelegatorInterface.java.
>>>
>>> 2. Extracted the static, cached data from the GenericDelegator
>>> implementation and put it in its own class - DelegatorData. The
>>> GenericDelegator implementation holds a reference to the
>>> DelegatorData instance. This makes it possible to have per-thread
>>> instances of GenericDelegator.
>>>
>>> 3. Replaced the ThreadLocal variables with regular variables.
>>> ThreadLocal variables are no longer needed. Client code doesn't need
>>> to be concerned with pushing and popping the GenericDelegator state.
>>>
>>> This commit paves the way for the forthcoming ExecutionContext.
>>>
>>> User modifications will have to replace
>>> GenericDelegator.getGenericDelegator(...) with
>>> DelegatorFactory.getGenericDelegator(...). Also, replace the push
>>> code with the new setXxx methods, and remove the pop code. If
>>> modifications used DelegatorInterface, replace that with
>>> GenericDelegator.
>>>
>>> Aside from those changes, this commit is backwards compatible.
>>
>> No, it is not backwards compatible.
>>
>> When a java class is compiled, the bytecode requests an interface
>> named 'foo', or a class named 'foo'.  If 'foo' changes from class to
>> interface, then pre-compiled classes will *not* load.
>>
>> Please, change GenericDelegator back to a class.
>>
>> If DelegatorInterface wasn't used, and was just not uptodate with the
>> method signatures, wouldn't the simpler thing have been to improve
>> DelegatorInterface, then to change the class itself?  It seems more
>> work to change the class to an interface.
>>
>> I have external code(webslinger) that needs to support multiple
>> versions of ofbiz(one all the way back to 512946).  This change makes
>> that impossible.  I have to have multiple versions of ofbiz
>> installed(pre/post this change), and compile the class once for each
>> ofbiz version.
> 
> Which is easier: rewrite all your Webslinger code to reference
> DelegatorInterface instead of GenericDelegator, or just recompile your
> existing code without making any changes?

That's just it, I wouldn't have to recompile *at all*, if
GenericDelegator stayed a class.  Nor would anyone else.


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adrian Crum <ad...@hlmksw.com>.
Adam Heath wrote:
> adrianc@apache.org wrote:
>> Author: adrianc
>> Date: Sun Aug  9 18:04:26 2009
>> New Revision: 802567
>>
>> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
>> Log:
>> Refactored GenericDelegator:
>>
>> 1. Converted GenericDelegator to an interface. We already have DelegatorInterface, but it isn't being used anywhere. Removed DelegatorInterface.java.
>>
>> 2. Extracted the static, cached data from the GenericDelegator implementation and put it in its own class - DelegatorData. The GenericDelegator implementation holds a reference to the DelegatorData instance. This makes it possible to have per-thread instances of GenericDelegator.
>>
>> 3. Replaced the ThreadLocal variables with regular variables. ThreadLocal variables are no longer needed. Client code doesn't need to be concerned with pushing and popping the GenericDelegator state.
>>
>> This commit paves the way for the forthcoming ExecutionContext.
>>
>> User modifications will have to replace GenericDelegator.getGenericDelegator(...) with DelegatorFactory.getGenericDelegator(...). Also, replace the push code with the new setXxx methods, and remove the pop code. If modifications used DelegatorInterface, replace that with GenericDelegator.
>>
>> Aside from those changes, this commit is backwards compatible.
> 
> No, it is not backwards compatible.
> 
> When a java class is compiled, the bytecode requests an interface
> named 'foo', or a class named 'foo'.  If 'foo' changes from class to
> interface, then pre-compiled classes will *not* load.
> 
> Please, change GenericDelegator back to a class.
> 
> If DelegatorInterface wasn't used, and was just not uptodate with the
> method signatures, wouldn't the simpler thing have been to improve
> DelegatorInterface, then to change the class itself?  It seems more
> work to change the class to an interface.
> 
> I have external code(webslinger) that needs to support multiple
> versions of ofbiz(one all the way back to 512946).  This change makes
> that impossible.  I have to have multiple versions of ofbiz
> installed(pre/post this change), and compile the class once for each
> ofbiz version.

Which is easier: rewrite all your Webslinger code to reference 
DelegatorInterface instead of GenericDelegator, or just recompile your 
existing code without making any changes?

-Adrian


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/prod

Posted by Jacques Le Roux <ja...@les7arts.com>.
+1, I agree Adam has well shown the way

Jacques

From: "Tim Ruppert" <ti...@hotwaxmedia.com>
> +1 - thanks Adam - I agree whole heartedly on the incremental approach.
> 
> Cheers,
> Ruppert
> --
> Tim Ruppert
> HotWax Media
> http://www.hotwaxmedia.com
> 
> o:801.649.6594
> f:801.649.6595
> 
> On Sep 8, 2009, at 4:56 PM, Adam Heath wrote:
> 
>> Adam Heath wrote:
>>> I have external code(webslinger) that needs to support multiple
>>> versions of ofbiz(one all the way back to 512946).  This change makes
>>> that impossible.  I have to have multiple versions of ofbiz
>>> installed(pre/post this change), and compile the class once for each
>>> ofbiz version.
>>
>> Well, based on this change, and what will eventually happen with
>> ExecutionContext, I've changed my build to support this.  Kinda slick
>> actually.
>>
>> I copied the old GenericDelegator.java, new GenericDelegator.java, and
>> DelegatorInterface.java, into my local build system.  Modified the old
>> delegator, removing all comments, all method bodies, and made them all
>> throw UnsupportedOperationException.  Compiled these classes locally.
>> Do some classpath tweaks during the build phase, and have 2 versions
>> of ofbiz-webslinger.jar.  I then use debian versioned dependencies to
>> install the correct jar.
>>
>> So, I don't need this backed out right now, altho I do think it is
>> still the correct thing to do.  I also think an incremental approach
>> to ExecutionContext is also the preferred way.
> 
>


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
+1 - thanks Adam - I agree whole heartedly on the incremental approach.

Cheers,
Ruppert
--
Tim Ruppert
HotWax Media
http://www.hotwaxmedia.com

o:801.649.6594
f:801.649.6595

On Sep 8, 2009, at 4:56 PM, Adam Heath wrote:

> Adam Heath wrote:
>> I have external code(webslinger) that needs to support multiple
>> versions of ofbiz(one all the way back to 512946).  This change makes
>> that impossible.  I have to have multiple versions of ofbiz
>> installed(pre/post this change), and compile the class once for each
>> ofbiz version.
>
> Well, based on this change, and what will eventually happen with
> ExecutionContext, I've changed my build to support this.  Kinda slick
> actually.
>
> I copied the old GenericDelegator.java, new GenericDelegator.java, and
> DelegatorInterface.java, into my local build system.  Modified the old
> delegator, removing all comments, all method bodies, and made them all
> throw UnsupportedOperationException.  Compiled these classes locally.
> Do some classpath tweaks during the build phase, and have 2 versions
> of ofbiz-webslinger.jar.  I then use debian versioned dependencies to
> install the correct jar.
>
> So, I don't need this backed out right now, altho I do think it is
> still the correct thing to do.  I also think an incremental approach
> to ExecutionContext is also the preferred way.


Re: Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
Adam Heath wrote:
> I have external code(webslinger) that needs to support multiple
> versions of ofbiz(one all the way back to 512946).  This change makes
> that impossible.  I have to have multiple versions of ofbiz
> installed(pre/post this change), and compile the class once for each
> ofbiz version.

Well, based on this change, and what will eventually happen with
ExecutionContext, I've changed my build to support this.  Kinda slick
actually.

I copied the old GenericDelegator.java, new GenericDelegator.java, and
DelegatorInterface.java, into my local build system.  Modified the old
delegator, removing all comments, all method bodies, and made them all
throw UnsupportedOperationException.  Compiled these classes locally.
 Do some classpath tweaks during the build phase, and have 2 versions
of ofbiz-webslinger.jar.  I then use debian versioned dependencies to
install the correct jar.

So, I don't need this backed out right now, altho I do think it is
still the correct thing to do.  I also think an incremental approach
to ExecutionContext is also the preferred way.

Please do a partial revert: Re: svn commit: r802567 [1/5] - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/shipment/packing/ applications/product/src/org/ofbiz/shipment/verify/ applications/product/src/org/ofbiz/shipment/weigh...

Posted by Adam Heath <do...@brainfood.com>.
adrianc@apache.org wrote:
> Author: adrianc
> Date: Sun Aug  9 18:04:26 2009
> New Revision: 802567
> 
> URL: http://svn.apache.org/viewvc?rev=802567&view=rev
> Log:
> Refactored GenericDelegator:
> 
> 1. Converted GenericDelegator to an interface. We already have DelegatorInterface, but it isn't being used anywhere. Removed DelegatorInterface.java.
> 
> 2. Extracted the static, cached data from the GenericDelegator implementation and put it in its own class - DelegatorData. The GenericDelegator implementation holds a reference to the DelegatorData instance. This makes it possible to have per-thread instances of GenericDelegator.
> 
> 3. Replaced the ThreadLocal variables with regular variables. ThreadLocal variables are no longer needed. Client code doesn't need to be concerned with pushing and popping the GenericDelegator state.
> 
> This commit paves the way for the forthcoming ExecutionContext.
> 
> User modifications will have to replace GenericDelegator.getGenericDelegator(...) with DelegatorFactory.getGenericDelegator(...). Also, replace the push code with the new setXxx methods, and remove the pop code. If modifications used DelegatorInterface, replace that with GenericDelegator.
> 
> Aside from those changes, this commit is backwards compatible.

No, it is not backwards compatible.

When a java class is compiled, the bytecode requests an interface
named 'foo', or a class named 'foo'.  If 'foo' changes from class to
interface, then pre-compiled classes will *not* load.

Please, change GenericDelegator back to a class.

If DelegatorInterface wasn't used, and was just not uptodate with the
method signatures, wouldn't the simpler thing have been to improve
DelegatorInterface, then to change the class itself?  It seems more
work to change the class to an interface.

I have external code(webslinger) that needs to support multiple
versions of ofbiz(one all the way back to 512946).  This change makes
that impossible.  I have to have multiple versions of ofbiz
installed(pre/post this change), and compile the class once for each
ofbiz version.