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/12 22:09:35 UTC

svn commit: r803693 [1/2] - in /ofbiz/branches/executioncontext20090812: ./ applications/accounting/ applications/content/ applications/humanres/ applications/manufacturing/ applications/marketing/ applications/order/ applications/party/ applications/p...

Author: adrianc
Date: Wed Aug 12 20:09:32 2009
New Revision: 803693

URL: http://svn.apache.org/viewvc?rev=803693&view=rev
Log:
Initial implementation of the ExecutionContext.

I created two new folders in framework: api and context. The api folder will be used to contain interfaces for commonly used framework artifacts. The implementations will remain in the existing components. The context folder contains the implementation of ExecutionContext.

I was able to solve the cross-dependency issue by having each component in the compiler chain extend the ExecutionContext interface and add its own artifacts. The final version of the interface is in the service component. I know this is unusual, but it is only temporary. When the api folder is built out, the ExecutionContext interfaces will be consolidated into one - and that will be kept in the api folder.

Right now the ExecutionContext doesn't do anything except contain commonly used objects, and it keeps track of the thread's execution path. The idea is to have this one object passed around instead of the current half-dozen or so objects. The execution path will be used for the forthcoming security redesign.

If you want to see it in action, change the executionContext.verbose property in api.properties to true, and uncomment the blocks of screen widget code in the Example component: line 40 in ExampleScreens.xml, and line 25 in ExampleForms.xml. The console log will show the ExecutionContext pushing and popping artifacts, and the Find Example screen will display the execution path for the screen.

Added:
    ofbiz/branches/executioncontext20090812/framework/api/   (with props)
    ofbiz/branches/executioncontext20090812/framework/api/build.xml   (with props)
    ofbiz/branches/executioncontext20090812/framework/api/config/
    ofbiz/branches/executioncontext20090812/framework/api/config/api.properties   (with props)
    ofbiz/branches/executioncontext20090812/framework/api/lib/
    ofbiz/branches/executioncontext20090812/framework/api/ofbiz-component.xml   (with props)
    ofbiz/branches/executioncontext20090812/framework/api/src/
    ofbiz/branches/executioncontext20090812/framework/api/src/org/
    ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/
    ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/
    ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/
    ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java   (with props)
    ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContext.java   (with props)
    ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java   (with props)
    ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextImpl.java   (with props)
    ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java
    ofbiz/branches/executioncontext20090812/framework/context/   (with props)
    ofbiz/branches/executioncontext20090812/framework/context/build.xml   (with props)
    ofbiz/branches/executioncontext20090812/framework/context/lib/
    ofbiz/branches/executioncontext20090812/framework/context/ofbiz-component.xml   (with props)
    ofbiz/branches/executioncontext20090812/framework/context/src/
    ofbiz/branches/executioncontext20090812/framework/context/src/org/
    ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/
    ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/context/
    ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java   (with props)
    ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/ExecutionContext.java   (with props)
    ofbiz/branches/executioncontext20090812/framework/security/src/org/ofbiz/security/ExecutionContext.java   (with props)
    ofbiz/branches/executioncontext20090812/framework/service/src/org/ofbiz/service/ExecutionContext.java   (with props)
Modified:
    ofbiz/branches/executioncontext20090812/.classpath
    ofbiz/branches/executioncontext20090812/applications/accounting/build.xml
    ofbiz/branches/executioncontext20090812/applications/content/build.xml
    ofbiz/branches/executioncontext20090812/applications/humanres/build.xml
    ofbiz/branches/executioncontext20090812/applications/manufacturing/build.xml
    ofbiz/branches/executioncontext20090812/applications/marketing/build.xml
    ofbiz/branches/executioncontext20090812/applications/order/build.xml
    ofbiz/branches/executioncontext20090812/applications/party/build.xml
    ofbiz/branches/executioncontext20090812/applications/product/build.xml
    ofbiz/branches/executioncontext20090812/applications/securityext/build.xml
    ofbiz/branches/executioncontext20090812/applications/workeffort/build.xml
    ofbiz/branches/executioncontext20090812/framework/bi/build.xml
    ofbiz/branches/executioncontext20090812/framework/build.xml
    ofbiz/branches/executioncontext20090812/framework/common/build.xml
    ofbiz/branches/executioncontext20090812/framework/component-load.xml
    ofbiz/branches/executioncontext20090812/framework/entity/build.xml
    ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
    ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java
    ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
    ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/GenericEntity.java
    ofbiz/branches/executioncontext20090812/framework/entityext/build.xml
    ofbiz/branches/executioncontext20090812/framework/example/build.xml
    ofbiz/branches/executioncontext20090812/framework/example/widget/example/ExampleForms.xml
    ofbiz/branches/executioncontext20090812/framework/example/widget/example/ExampleScreens.xml
    ofbiz/branches/executioncontext20090812/framework/minilang/build.xml
    ofbiz/branches/executioncontext20090812/framework/security/build.xml
    ofbiz/branches/executioncontext20090812/framework/service/build.xml
    ofbiz/branches/executioncontext20090812/framework/service/src/org/ofbiz/service/ModelService.java
    ofbiz/branches/executioncontext20090812/framework/service/src/org/ofbiz/service/ModelServiceReader.java
    ofbiz/branches/executioncontext20090812/framework/service/src/org/ofbiz/service/ServiceDispatcher.java
    ofbiz/branches/executioncontext20090812/framework/webapp/build.xml
    ofbiz/branches/executioncontext20090812/framework/webapp/src/org/ofbiz/webapp/control/ControlServlet.java
    ofbiz/branches/executioncontext20090812/framework/webapp/src/org/ofbiz/webapp/control/RequestHandler.java
    ofbiz/branches/executioncontext20090812/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java
    ofbiz/branches/executioncontext20090812/framework/webtools/build.xml
    ofbiz/branches/executioncontext20090812/framework/widget/build.xml
    ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
    ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
    ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java
    ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
    ofbiz/branches/executioncontext20090812/specialpurpose/assetmaint/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/crowd/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/ebay/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/ecommerce/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/googlebase/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/googlecheckout/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/hhfacility/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/ldap/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/oagis/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/pos/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/projectmgr/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/shark/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/webpos/build.xml
    ofbiz/branches/executioncontext20090812/specialpurpose/workflow/build.xml

Modified: ofbiz/branches/executioncontext20090812/.classpath
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/.classpath?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/.classpath (original)
+++ ofbiz/branches/executioncontext20090812/.classpath Wed Aug 12 20:09:32 2009
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
     <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+    <classpathentry kind="src" path="framework/api/src"/>
+    <classpathentry kind="src" path="framework/context/src"/>
     <classpathentry kind="src" path="framework/testtools/src"/>
     <classpathentry kind="src" path="framework/webslinger/src"/>
     <classpathentry kind="src" path="specialpurpose/oagis/src"/>

Modified: ofbiz/branches/executioncontext20090812/applications/accounting/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/accounting/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/accounting/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/accounting/build.xml Wed Aug 12 20:09:32 2009
@@ -30,6 +30,7 @@
     <property name="ofbiz.home.dir" value="../.."/>
 
     <path id="local.class.path">
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/commons" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/applications/content/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/content/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/content/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/content/build.xml Wed Aug 12 20:09:32 2009
@@ -32,6 +32,7 @@
     <path id="local.class.path">
         <fileset dir="${lib.dir}" includes="*.jar"/>
         <fileset dir="${lib.dir}/uno" includes="*.jar"/>
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/commons" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/applications/humanres/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/humanres/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/humanres/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/humanres/build.xml Wed Aug 12 20:09:32 2009
@@ -31,6 +31,7 @@
 
     <path id="local.class.path">
         <!--<fileset dir="${lib.dir}" includes="*.jar"/>-->
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/entity/lib" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/applications/manufacturing/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/manufacturing/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/manufacturing/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/manufacturing/build.xml Wed Aug 12 20:09:32 2009
@@ -31,6 +31,7 @@
 
     <path id="local.class.path">
         <!-- <fileset dir="${lib.dir}" includes="*.jar"/> -->
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>
         <fileset dir="../../framework/base/build/lib" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/applications/marketing/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/marketing/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/marketing/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/marketing/build.xml Wed Aug 12 20:09:32 2009
@@ -30,6 +30,7 @@
     <property name="ofbiz.home.dir" value="../.."/>
 
     <path id="local.class.path">
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>
         <fileset dir="../../framework/base/build/lib" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/applications/order/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/order/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/order/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/order/build.xml Wed Aug 12 20:09:32 2009
@@ -31,6 +31,7 @@
 
     <path id="local.class.path">
         <!--<fileset dir="${lib.dir}" includes="*.jar"/>-->
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/commons" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/applications/party/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/party/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/party/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/party/build.xml Wed Aug 12 20:09:32 2009
@@ -31,6 +31,7 @@
 
     <path id="local.class.path">
         <!--<fileset dir="${lib.dir}" includes="*.jar"/>-->
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>
         <fileset dir="../../framework/base/build/lib" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/applications/product/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/product/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/product/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/product/build.xml Wed Aug 12 20:09:32 2009
@@ -31,6 +31,7 @@
 
     <path id="local.class.path">
         <!--<fileset dir="${lib.dir}" includes="*.jar"/>-->
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/commons" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/applications/securityext/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/securityext/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/securityext/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/securityext/build.xml Wed Aug 12 20:09:32 2009
@@ -31,6 +31,7 @@
 
     <path id="local.class.path">
         <!--<fileset dir="${lib.dir}" includes="*.jar"/>-->
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>
         <fileset dir="../../framework/base/build/lib" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/applications/workeffort/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/applications/workeffort/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/applications/workeffort/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/applications/workeffort/build.xml Wed Aug 12 20:09:32 2009
@@ -31,6 +31,7 @@
 
     <path id="local.class.path">
         <!--<fileset dir="${lib.dir}" includes="*.jar"/>-->
+        <fileset dir="../../framework/api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/scripting" includes="*.jar"/>

Propchange: ofbiz/branches/executioncontext20090812/framework/api/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug 12 20:09:32 2009
@@ -0,0 +1 @@
+build

Added: ofbiz/branches/executioncontext20090812/framework/api/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/api/build.xml?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/api/build.xml (added)
+++ ofbiz/branches/executioncontext20090812/framework/api/build.xml Wed Aug 12 20:09:32 2009
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<project name="OFBiz - Framework API" default="jar" basedir=".">
+    <import file="../../common.xml"/>
+
+    <!-- ================================================================== -->
+    <!-- Initialization of all property settings                            -->
+    <!-- ================================================================== -->
+
+    <property name="name" value="ofbiz-api"/>
+    <property name="ofbiz.home.dir" value="../.."/>
+
+    <path id="local.class.path">
+        <fileset dir="${lib.dir}" includes="*.jar"/>
+        <fileset dir="../base/lib" includes="*.jar"/>
+        <fileset dir="../base/lib/commons" includes="*.jar"/>
+        <fileset dir="../base/lib/j2eespecs" includes="*.jar"/>
+        <fileset dir="../base/lib/scripting" includes="*.jar"/>
+        <fileset dir="../base/build/lib" includes="*.jar"/>
+    </path>
+
+    <!-- ================================================================== -->
+    <!-- Compilation of the source files                                    -->
+    <!-- ================================================================== -->
+
+    <target name="classes" depends="prepare">
+        <javac15/>
+    </target>
+
+    <target name="jar" depends="classes">
+        <jar jarfile="${build.dir}/lib/${name}.jar">
+            <fileset dir="${build.dir}/classes"/>
+            <fileset dir="${src.dir}">
+                <include name="**/*.properties,**/*.xml,**/*.bsh,**/*.logic,**/*.js,**/*.jacl,**/*.py"/>
+                <include name="META-INF/**"/>
+            </fileset>
+            <!-- now add the NOTICE and LICENSE files to allow the jar file to be distributed alone -->
+            <zipfileset dir="${ofbiz.home.dir}" prefix="META-INF" includes="NOTICE,LICENSE"/>
+        </jar>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Build JavaDoc                                                      -->
+    <!-- ================================================================== -->
+
+    <target name="docs" depends="prepare-docs">
+        <javadoc packagenames="org.ofbiz.base.*"
+                 classpathref="local.class.path"
+                 destdir="${build.dir}/javadocs"
+                 Windowtitle="Open for Business - Framework API">
+            <sourcepath path="${src.dir}"/>
+        </javadoc>
+    </target>
+</project>

Propchange: ofbiz/branches/executioncontext20090812/framework/api/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/api/build.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/api/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/branches/executioncontext20090812/framework/api/config/api.properties
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/api/config/api.properties?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/api/config/api.properties (added)
+++ ofbiz/branches/executioncontext20090812/framework/api/config/api.properties Wed Aug 12 20:09:32 2009
@@ -0,0 +1,30 @@
+###############################################################################
+# 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.
+###############################################################################
+
+####
+# Apache OFBiz Framework API Settings
+####
+
+# Set to true to enable ExecutionContext info messages. This property is for
+# development only, it will be removed when the ExecutionContext implementation
+# is complete.
+executionContext.verbose=false
+
+# Class name of the ExecutionContext implementation
+executionContext.class=org.ofbiz.context.ExecutionContextImpl

Propchange: ofbiz/branches/executioncontext20090812/framework/api/config/api.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/api/config/api.properties
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/api/config/api.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/executioncontext20090812/framework/api/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/api/ofbiz-component.xml?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/api/ofbiz-component.xml (added)
+++ ofbiz/branches/executioncontext20090812/framework/api/ofbiz-component.xml Wed Aug 12 20:09:32 2009
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<ofbiz-component name="api"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
+    <resource-loader name="main" type="component"/>
+    <classpath type="jar" location="build/lib/*"/>
+    <classpath type="dir" location="config"/>
+    <classpath type="jar" location="lib/*"/>
+</ofbiz-component>

Propchange: ofbiz/branches/executioncontext20090812/framework/api/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/api/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/api/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java (added)
+++ ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java Wed Aug 12 20:09:32 2009
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * 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.api.context;
+
+/** ExecutionArtifact interface. */
+public interface ExecutionArtifact {
+	/**
+	 * Returns the location of this artifact.
+	 * 
+	 * @return Location of this artifact
+	 */
+	public String getLocation();
+
+	/**
+	 * Returns the name of this artifact.
+	 * 
+	 * @return Name of this artifact
+	 */
+	public String getName();
+}

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContext.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContext.java?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContext.java (added)
+++ ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContext.java Wed Aug 12 20:09:32 2009
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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.api.context;
+
+import java.util.Locale;
+import java.util.TimeZone;
+
+/** ExecutionContext interface. */
+public interface ExecutionContext {
+
+    /** Returns the currency unit of measure.
+     * 
+     * @return The ISO currency code
+     */
+    public String getCurrencyUom();
+
+    /** Returns the current execution path. Artifacts in the path are separated
+     * with a slash.
+     * 
+     * @return The current execution path
+     */
+    public String getExecutionPath();
+
+    /** Returns the current <code>Locale</code>.
+     * 
+     * @return The current <code>Locale</code>
+     */
+    public Locale getLocale();
+
+    /** Returns the specified property.
+     * 
+     * @param key property whose associated value is to be returned
+     * @return the specified property, or null if the property doesn't exist 
+     */
+    public Object getProperty(String key);
+
+    /** Returns the current <code>TimeZone</code>.
+     * 
+     * @return The current <code>TimeZone</code>
+     */
+    public TimeZone getTimeZone();
+
+    /** Pop an <code>ExecutionArtifact</code> off the stack. */
+    public void popExecutionArtifact();
+
+    /** Push an <code>ExecutionArtifact</code> on the stack.
+     * 
+     * @param artifact
+     */
+    public void pushExecutionArtifact(ExecutionArtifact artifact);
+
+    /** Sets the currency unit of measure.
+     * 
+     * @param currencyUom The ISO currency code
+     */
+    public void setCurrencyUom(String currencyUom);
+
+    /** Sets the current <code>Locale</code>.
+     * 
+     * @param locale The current <code>Locale</code>
+     */
+    public void setLocale(Locale locale);
+
+    /** Associates the specified value with the specified key.
+     * If the context contained a previous property for this key,
+     * then the old value is replaced by the specified value.
+     * 
+     * @param key the key with which the specified value is to be associated
+     * @param value the value to be associated with the specified key
+     * @return the previous value associated with specified key, or null  if there was no mapping for key
+     */
+    public Object setProperty(String key, Object value);
+
+    /** Sets the current <code>TimeZone</code>.
+     * 
+     * @param timeZone The current <code>TimeZone</code>
+     */
+    public void setTimeZone(TimeZone timeZone);
+}

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContext.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java (added)
+++ ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java Wed Aug 12 20:09:32 2009
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.api.context;
+
+import org.ofbiz.base.util.UtilProperties;
+
+/** ExecutionContext factory. */
+public class ExecutionContextFactory {
+
+    public static ExecutionContext getInstance() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+        String className = UtilProperties.getPropertyValue("api.properties", "executionContext.class");
+        Object obj = loader.loadClass(className).newInstance();
+        return (ExecutionContext) obj;
+    }
+}

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextImpl.java?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextImpl.java (added)
+++ ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextImpl.java Wed Aug 12 20:09:32 2009
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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.api.context;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.Stack;
+import java.util.TimeZone;
+
+import javolution.util.FastMap;
+
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilProperties;
+
+/** Implementation of the ExecutionContext interface. */
+public class ExecutionContextImpl implements ExecutionContext {
+
+    public static final String module = ExecutionContextImpl.class.getName();
+
+	protected final Stack<ExecutionArtifact> artifactStack = new Stack<ExecutionArtifact>();
+	protected String currencyUom = null;
+	protected Locale locale = Locale.getDefault();
+	protected TimeZone timeZone = TimeZone.getDefault();
+	protected final Map<String, Object> properties;
+	// Temporary - will be removed later
+	protected boolean verbose = false;
+
+	protected ExecutionContextImpl() {
+	    this.properties = FastMap.newInstance();
+	    this.verbose = "true".equals(UtilProperties.getPropertyValue("api.properties", "executionContext.verbose"));
+	}
+	
+    protected ExecutionContextImpl(Map<String, Object> properties) {
+        this.properties = properties;
+        this.verbose = "true".equals(UtilProperties.getPropertyValue("api.properties", "executionContext.verbose"));
+    }
+
+    public String getCurrencyUom() {
+        return this.currencyUom;
+    }
+
+    public String getExecutionPath() {
+		StringBuilder sb = new StringBuilder("ofbiz");
+		for (ExecutionArtifact artifact : this.artifactStack) {
+			sb.append("/");
+			sb.append(artifact.getName());
+		}
+		return sb.toString();
+	}
+
+	public Locale getLocale() {
+        return this.locale;
+    }
+
+	public Object getProperty(String key) {
+        return this.properties.get(key);
+    }
+
+    public TimeZone getTimeZone() {
+        return this.timeZone;
+    }
+
+    public void popExecutionArtifact() {
+	    ExecutionArtifact artifact = this.artifactStack.pop();
+	    if (this.verbose) {
+	    	Debug.logInfo("Popping artifact [" + artifact.getClass().getName() +
+	    			"] location = " + artifact.getLocation() + 
+	    			", name = " + artifact.getName(), module);
+	    }
+	}
+
+    public void pushExecutionArtifact(ExecutionArtifact artifact) {
+		this.artifactStack.push(artifact);
+		if (this.verbose) {
+			Debug.logInfo("Pushing artifact [" + artifact.getClass().getName() +
+					"] location = " + artifact.getLocation() + 
+					", name = " + artifact.getName(), module);
+		}
+	}
+
+    public void setCurrencyUom(String currencyUom) {
+        if (currencyUom != null) {
+            this.currencyUom = currencyUom;
+        }
+    }
+
+    public void setLocale(Locale locale) {
+        if (locale != null) {
+            this.locale = locale;
+        }
+    }
+
+    public Object setProperty(String key, Object value) {
+        return this.properties.put(key, value);
+    }
+
+    public void setTimeZone(TimeZone timeZone) {
+        if (timeZone != null) {
+            this.timeZone = timeZone;
+        }
+    }
+
+    @Override
+	public String toString() {
+		return this.getExecutionPath();
+	}
+}

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/ExecutionContextImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java (added)
+++ ofbiz/branches/executioncontext20090812/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java Wed Aug 12 20:09:32 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.api.context;
+
+/** A basic implementation of the ExecutionArtifact interface. */
+public class GenericExecutionArtifact implements ExecutionArtifact {
+	
+	protected final String location;
+	protected final String name;
+
+	public GenericExecutionArtifact(String location, String name) {
+		this.location = location;
+		this.name = name;
+	}
+
+	public String getLocation() {
+		return this.location;
+	}
+
+	public String getName() {
+		return this.name;
+	}
+
+	@Override
+	public String toString() {
+		return "GenericExecutionArtifact: location = " + this.location + ", name = " + this.name;
+	}
+}

Modified: ofbiz/branches/executioncontext20090812/framework/bi/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/bi/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/bi/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/framework/bi/build.xml Wed Aug 12 20:09:32 2009
@@ -29,6 +29,7 @@
     <property name="name" value="ofbiz-bi"/>
 
     <path id="local.class.path">
+        <fileset dir="../api/build/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/commons" includes="*.jar"/>
         <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/framework/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/framework/build.xml Wed Aug 12 20:09:32 2009
@@ -22,10 +22,11 @@
     <import file="../macros.xml"/>
 
     <filelist id="framework-builds" dir="."
-        files="start/build.xml,base/build.xml,
+        files="start/build.xml,base/build.xml,api/build.xml,
                entity/build.xml,geronimo/build.xml,
                catalina/build.xml,jetty/build.xml,
-               security/build.xml,service/build.xml,entityext/build.xml,
+               security/build.xml,service/build.xml,
+    	       context/build.xml, entityext/build.xml,
                webslinger/build.xml,
                bi/build.xml,datafile/build.xml,minilang/build.xml,
                webapp/build.xml,guiapp/build.xml,widget/build.xml,

Modified: ofbiz/branches/executioncontext20090812/framework/common/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/common/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/common/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/framework/common/build.xml Wed Aug 12 20:09:32 2009
@@ -30,6 +30,7 @@
     <property name="ofbiz.home.dir" value="../.."/>
 
     <path id="local.class.path">
+        <fileset dir="../api/build/lib" includes="*.jar"/>
         <fileset dir="../base/lib" includes="*.jar"/>
         <fileset dir="../base/lib/commons" includes="*.jar"/>
         <fileset dir="../base/lib/j2eespecs" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/framework/component-load.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/component-load.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/component-load.xml (original)
+++ ofbiz/branches/executioncontext20090812/framework/component-load.xml Wed Aug 12 20:09:32 2009
@@ -21,6 +21,8 @@
 <component-loader xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/component-loader.xsd">
     <load-component component-location="geronimo"/>
+    <load-component component-location="api"/>
+    <load-component component-location="context"/>
     <load-component component-location="entity"/>
     <load-component component-location="catalina"/>
     <!-- <load-component component-location="jetty"/> -->

Propchange: ofbiz/branches/executioncontext20090812/framework/context/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug 12 20:09:32 2009
@@ -0,0 +1 @@
+build

Added: ofbiz/branches/executioncontext20090812/framework/context/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/context/build.xml?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/context/build.xml (added)
+++ ofbiz/branches/executioncontext20090812/framework/context/build.xml Wed Aug 12 20:09:32 2009
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<project name="OFBiz - Execution Context" default="jar" basedir=".">
+    <import file="../../common.xml"/>
+
+    <!-- ================================================================== -->
+    <!-- Initialization of all property settings                            -->
+    <!-- ================================================================== -->
+
+    <property name="name" value="ofbiz-context"/>
+    <property name="ofbiz.home.dir" value="../.."/>
+
+    <path id="local.class.path">
+        <fileset dir="../api/build/lib" includes="*.jar"/>
+        <fileset dir="${lib.dir}" includes="*.jar"/>
+        <fileset dir="../base/lib" includes="*.jar"/>
+        <fileset dir="../base/lib/commons" includes="*.jar"/>
+        <fileset dir="../base/lib/j2eespecs" includes="*.jar"/>
+        <fileset dir="../base/lib/scripting" includes="*.jar"/>
+        <fileset dir="../base/build/lib" includes="*.jar"/>
+        <fileset dir="../entity/build/lib" includes="*.jar"/>
+        <fileset dir="../security/build/lib" includes="*.jar"/>
+        <fileset dir="../service/build/lib" includes="*.jar"/>
+    </path>
+
+    <!-- ================================================================== -->
+    <!-- Compilation of the source files                                    -->
+    <!-- ================================================================== -->
+
+    <target name="classes" depends="prepare">
+        <javac15/>
+    </target>
+
+    <target name="jar" depends="classes">
+        <jar jarfile="${build.dir}/lib/${name}.jar">
+            <fileset dir="${build.dir}/classes"/>
+            <fileset dir="${src.dir}">
+                <include name="**/*.properties,**/*.xml,**/*.bsh,**/*.logic,**/*.js,**/*.jacl,**/*.py"/>
+                <include name="META-INF/**"/>
+            </fileset>
+            <!-- now add the NOTICE and LICENSE files to allow the jar file to be distributed alone -->
+            <zipfileset dir="${ofbiz.home.dir}" prefix="META-INF" includes="NOTICE,LICENSE"/>
+        </jar>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Build JavaDoc                                                      -->
+    <!-- ================================================================== -->
+
+    <target name="docs" depends="prepare-docs">
+        <javadoc packagenames="org.ofbiz.base.*"
+                 classpathref="local.class.path"
+                 destdir="${build.dir}/javadocs"
+                 Windowtitle="Open for Business - Execution Context">
+            <sourcepath path="${src.dir}"/>
+        </javadoc>
+    </target>
+</project>

Propchange: ofbiz/branches/executioncontext20090812/framework/context/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/context/build.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/context/build.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/branches/executioncontext20090812/framework/context/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/context/ofbiz-component.xml?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/context/ofbiz-component.xml (added)
+++ ofbiz/branches/executioncontext20090812/framework/context/ofbiz-component.xml Wed Aug 12 20:09:32 2009
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<ofbiz-component name="context"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/ofbiz-component.xsd">
+    <resource-loader name="main" type="component"/>
+    <classpath type="jar" location="build/lib/*"/>
+    <classpath type="dir" location="config"/>
+    <classpath type="jar" location="lib/*"/>
+</ofbiz-component>

Propchange: ofbiz/branches/executioncontext20090812/framework/context/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/context/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/context/ofbiz-component.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java (added)
+++ ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java Wed Aug 12 20:09:32 2009
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.context;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.security.Security;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ExecutionContext;
+
+/** ExecutionContext implementation. */
+public class ExecutionContextImpl extends org.ofbiz.api.context.ExecutionContextImpl implements ExecutionContext {
+
+    protected GenericDelegator delegator = null;
+    protected LocalDispatcher dispatcher = null;
+    protected Security security = null;
+    protected GenericValue userLogin = null;
+
+	public GenericDelegator getDelegator() {
+		return this.delegator;
+	}
+
+	public LocalDispatcher getDispatcher() {
+		return this.dispatcher;
+	}
+
+	public Security getSecurity() {
+		return this.security;
+	}
+
+	public GenericValue getUserLogin() {
+		return this.userLogin;
+	}
+
+	public void initializeContext(Map<String, ? extends Object> params) {
+		this.setLocale((Locale) params.get("locale")); 
+		this.setTimeZone((TimeZone) params.get("timeZone"));
+		this.setUserLogin((GenericValue) params.get("userLogin"));
+	}
+
+	public void setDelegator(GenericDelegator delegator) {
+		if (delegator != null) {
+			delegator.setExecutionContext(this);
+			this.delegator = delegator;
+		}
+	}
+
+	public void setDispatcher(LocalDispatcher dispatcher) {
+		if (dispatcher != null) {
+			this.dispatcher = dispatcher;
+		}
+	}
+
+	public void setSecurity(Security security) {
+		if (security != null) {
+			this.security = security;
+		}
+	}
+
+	public void setUserLogin(GenericValue userLogin) {
+		if (userLogin != null) {
+			this.userLogin = userLogin;
+		}
+	}
+}

Propchange: ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/branches/executioncontext20090812/framework/context/src/org/ofbiz/context/ExecutionContextImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/branches/executioncontext20090812/framework/entity/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/build.xml?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/entity/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/framework/entity/build.xml Wed Aug 12 20:09:32 2009
@@ -32,6 +32,7 @@
     <path id="local.class.path">
         <fileset dir="${lib.dir}" includes="*.jar"/>
         <fileset dir="${lib.dir}/jdbc" includes="*.jar"/>
+        <fileset dir="../api/build/lib" includes="*.jar"/>
         <fileset dir="../base/lib" includes="*.jar"/>
         <fileset dir="../base/lib/commons" includes="*.jar"/>
         <fileset dir="../base/lib/j2eespecs" includes="*.jar"/>

Modified: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java (original)
+++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorFactory.java Wed Aug 12 20:09:32 2009
@@ -18,6 +18,7 @@
  */
 package org.ofbiz.entity;
 
+import org.ofbiz.api.context.ExecutionContextFactory;
 import org.ofbiz.base.util.Debug;
 
 /** GenericDelegator Factory Class. */
@@ -26,6 +27,15 @@
     public static final String module = DelegatorFactory.class.getName();
 
     public static GenericDelegator getGenericDelegator(String delegatorName) {
+    	try {
+			return getGenericDelegator(delegatorName, (ExecutionContext) ExecutionContextFactory.getInstance());
+		} catch (Exception e) {
+            Debug.logError(e, "Could not get ExecutionContext instance: ", module);
+		}
+		return null;
+    }
+
+    public static GenericDelegator getGenericDelegator(String delegatorName, ExecutionContext executionContext) {
         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);
@@ -37,7 +47,7 @@
             Debug.logError(e, "Could not create delegator with name \"" + delegatorName + "\": ", module);
         }
         if (delegatorData != null) {
-            return new DelegatorImpl(delegatorData);
+            return new DelegatorImpl(delegatorData, executionContext);
         }
         return null;
     }

Modified: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java?rev=803693&r1=803692&r2=803693&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java (original)
+++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/DelegatorImpl.java Wed Aug 12 20:09:32 2009
@@ -36,6 +36,7 @@
 import javolution.util.FastList;
 import javolution.util.FastMap;
 
+import org.ofbiz.api.context.GenericExecutionArtifact;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralRuntimeException;
 import org.ofbiz.base.util.UtilDateTime;
@@ -145,7 +146,7 @@
 
     protected final DelegatorData delegatorData;
 
-    protected Locale locale = Locale.getDefault();
+    protected ExecutionContext executionContext;
 
     private boolean testMode = false;
 
@@ -157,99 +158,11 @@
 
     protected String userIdentifier = "";
 
-    protected DelegatorImpl(DelegatorData delegatorData) {
+    protected DelegatorImpl(DelegatorData delegatorData, ExecutionContext executionContext) {
+    	this.executionContext = executionContext;
         this.delegatorData = delegatorData;
         if (!delegatorData.initialized) {
-            synchronized (delegatorData) {
-                if (delegatorData.initialized) {
-                    return;
-                }
-                // do the entity model check
-                List<String> warningList = FastList.newInstance();
-                Debug.logImportant("Doing entity definition check...", module);
-                try {
-                    ModelEntityChecker.checkEntities(this, warningList);
-                } catch (GenericEntityException e) {
-                    Debug.logError(e, "Error while checking entities: ", module);
-                }
-                if (warningList.size() > 0) {
-                    Debug.logWarning("=-=-=-=-= Found " + warningList.size() + " warnings when checking the entity definitions:", module);
-                    for (String warning : warningList) {
-                        Debug.logWarning(warning, module);
-                    }
-                }
-
-                // initialize helpers by group
-                Set<String> groupNames = getModelGroupReader().getGroupNames(this.delegatorData.delegatorName);
-                Iterator<String> groups = UtilMisc.toIterator(groupNames);
-                while (groups != null && groups.hasNext()) {
-                    String groupName = groups.next();
-                    String helperName = this.getGroupHelperName(groupName);
-
-                    if (Debug.infoOn())
-                        Debug.logInfo("Delegator \"" + this.delegatorData.delegatorName + "\" initializing helper \"" + helperName + "\" for entity group \"" + groupName + "\".", module);
-                    TreeSet<String> helpersDone = new TreeSet<String>();
-                    if (helperName != null && helperName.length() > 0) {
-                        // make sure each helper is only loaded once
-                        if (helpersDone.contains(helperName)) {
-                            if (Debug.infoOn())
-                                Debug.logInfo("Helper \"" + helperName + "\" already initialized, not re-initializing.", module);
-                            continue;
-                        }
-                        helpersDone.add(helperName);
-                        // pre-load field type defs, the return value is ignored
-                        ModelFieldTypeReader.getModelFieldTypeReader(helperName);
-                        // get the helper and if configured, do the datasource check
-                        GenericHelper helper = GenericHelperFactory.getHelper(helperName);
-
-                        DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName);
-                        if (datasourceInfo.checkOnStart) {
-                            if (Debug.infoOn())
-                                Debug.logInfo("Doing database check as requested in entityengine.xml with addMissing=" + datasourceInfo.addMissingOnStart, module);
-                            try {
-                                helper.checkDataSource(this.getModelEntityMapByGroup(groupName), null, datasourceInfo.addMissingOnStart);
-                            } catch (GenericEntityException e) {
-                                Debug.logWarning(e, e.getMessage(), module);
-                            }
-                        }
-                    }
-                }
-                // Let other instances know the shared data is ready to use
-                this.delegatorData.initialized = true;
-                // setup the crypto class
-                this.delegatorData.crypto = new EntityCrypto(this);
-
-                // time to do some tricks with manual class loading that resolves
-                // circular dependencies, like calling services...
-                ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
-                // if useDistributedCacheClear is false do nothing since the
-                // distributedCacheClear member field with a null value will cause the
-                // dcc code to do nothing
-                if (this.delegatorData.delegatorInfo.useDistributedCacheClear) {
-                    // initialize the distributedCacheClear mechanism
-                    String distributedCacheClearClassName = this.delegatorData.delegatorInfo.distributedCacheClearClassName;
-
-                    try {
-                        Class<?> dccClass = loader.loadClass(distributedCacheClearClassName);
-                        this.delegatorData.distributedCacheClear = (DistributedCacheClear) dccClass.newInstance();
-                        this.delegatorData.distributedCacheClear.setDelegator(this, this.delegatorData.delegatorInfo.distributedCacheClearUserLoginId);
-                    } catch (ClassNotFoundException e) {
-                        Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " was not found, distributed cache clearing will be disabled", module);
-                    } catch (InstantiationException e) {
-                        Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " could not be instantiated, distributed cache clearing will be disabled", module);
-                    } catch (IllegalAccessException e) {
-                        Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " could not be accessed (illegal), distributed cache clearing will be disabled", module);
-                    } catch (ClassCastException e) {
-                        Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " does not implement the DistributedCacheClear interface, distributed cache clearing will be disabled", module);
-                    }
-                } else {
-                    Debug.logInfo("Distributed Cache Clear System disabled for delegator [" + this.delegatorData.delegatorName + "]", module);
-                }
-
-                // setup the Entity ECA Handler
-                initEntityEcaHandler();
-            }
+        	initDelegatorData();
         }
     }
 
@@ -426,7 +339,7 @@
         // creates an exact clone of the delegator; except for the sequencer
         // note that this will not be cached and should be used only when
         // needed to change something for single instance (use).
-        DelegatorImpl newDelegator = new DelegatorImpl((DelegatorData) this.delegatorData.clone());
+        DelegatorImpl newDelegator = new DelegatorImpl((DelegatorData) this.delegatorData.clone(), this.executionContext);
         newDelegator.delegatorData.delegatorName = delegatorName;
         // In case this delegator is in testMode give it a reference to
         // the rollback list
@@ -453,6 +366,7 @@
     }
 
     public GenericValue create(GenericValue value, boolean doCacheClear) throws GenericEntityException {
+    	this.executionContext.pushExecutionArtifact(value);
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -510,6 +424,7 @@
             // after rolling back, rethrow the exception
             throw e;
         } finally {
+        	this.executionContext.popExecutionArtifact();
             // only commit the transaction if we started one... this will throw
             // an exception if it fails
             TransactionUtil.commit(beganTransaction);
@@ -603,6 +518,7 @@
     }
 
     public GenericValue createOrStore(GenericValue value, boolean doCacheClear) throws GenericEntityException {
+    	this.executionContext.pushExecutionArtifact(value);
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -632,6 +548,7 @@
             // after rolling back, rethrow the exception
             throw e;
         } finally {
+        	this.executionContext.popExecutionArtifact();
             // only commit the transaction if we started one... this will throw
             // an exception if it fails
             TransactionUtil.commit(beganTransaction);
@@ -1536,7 +1453,7 @@
     }
 
     public Locale getLocale() {
-        return this.locale;
+        return this.executionContext.getLocale();
     }
 
     public ModelEntity getModelEntity(String entityName) {
@@ -1837,6 +1754,99 @@
         return this.getRelated(relationName, null, orderBy, value);
     }
 
+    protected void initDelegatorData() {
+        synchronized (this.delegatorData) {
+            if (this.delegatorData.initialized) {
+                return;
+            }
+            // do the entity model check
+            List<String> warningList = FastList.newInstance();
+            Debug.logImportant("Doing entity definition check...", module);
+            try {
+                ModelEntityChecker.checkEntities(this, warningList);
+            } catch (GenericEntityException e) {
+                Debug.logError(e, "Error while checking entities: ", module);
+            }
+            if (warningList.size() > 0) {
+                Debug.logWarning("=-=-=-=-= Found " + warningList.size() + " warnings when checking the entity definitions:", module);
+                for (String warning : warningList) {
+                    Debug.logWarning(warning, module);
+                }
+            }
+
+            // initialize helpers by group
+            Set<String> groupNames = getModelGroupReader().getGroupNames(this.delegatorData.delegatorName);
+            Iterator<String> groups = UtilMisc.toIterator(groupNames);
+            while (groups != null && groups.hasNext()) {
+                String groupName = groups.next();
+                String helperName = this.getGroupHelperName(groupName);
+
+                if (Debug.infoOn())
+                    Debug.logInfo("Delegator \"" + this.delegatorData.delegatorName + "\" initializing helper \"" + helperName + "\" for entity group \"" + groupName + "\".", module);
+                TreeSet<String> helpersDone = new TreeSet<String>();
+                if (helperName != null && helperName.length() > 0) {
+                    // make sure each helper is only loaded once
+                    if (helpersDone.contains(helperName)) {
+                        if (Debug.infoOn())
+                            Debug.logInfo("Helper \"" + helperName + "\" already initialized, not re-initializing.", module);
+                        continue;
+                    }
+                    helpersDone.add(helperName);
+                    // pre-load field type defs, the return value is ignored
+                    ModelFieldTypeReader.getModelFieldTypeReader(helperName);
+                    // get the helper and if configured, do the datasource check
+                    GenericHelper helper = GenericHelperFactory.getHelper(helperName);
+
+                    DatasourceInfo datasourceInfo = EntityConfigUtil.getDatasourceInfo(helperName);
+                    if (datasourceInfo.checkOnStart) {
+                        if (Debug.infoOn())
+                            Debug.logInfo("Doing database check as requested in entityengine.xml with addMissing=" + datasourceInfo.addMissingOnStart, module);
+                        try {
+                            helper.checkDataSource(this.getModelEntityMapByGroup(groupName), null, datasourceInfo.addMissingOnStart);
+                        } catch (GenericEntityException e) {
+                            Debug.logWarning(e, e.getMessage(), module);
+                        }
+                    }
+                }
+            }
+            // Let other instances know the shared data is ready to use
+            this.delegatorData.initialized = true;
+        }
+        // setup the crypto class
+        this.delegatorData.crypto = new EntityCrypto(this);
+
+        // time to do some tricks with manual class loading that resolves
+        // circular dependencies, like calling services...
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+        // if useDistributedCacheClear is false do nothing since the
+        // distributedCacheClear member field with a null value will cause the
+        // dcc code to do nothing
+        if (this.delegatorData.delegatorInfo.useDistributedCacheClear) {
+        	// initialize the distributedCacheClear mechanism
+        	String distributedCacheClearClassName = this.delegatorData.delegatorInfo.distributedCacheClearClassName;
+
+        	try {
+        		Class<?> dccClass = loader.loadClass(distributedCacheClearClassName);
+        		this.delegatorData.distributedCacheClear = (DistributedCacheClear) dccClass.newInstance();
+        		this.delegatorData.distributedCacheClear.setDelegator(this, this.delegatorData.delegatorInfo.distributedCacheClearUserLoginId);
+        	} catch (ClassNotFoundException e) {
+        		Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " was not found, distributed cache clearing will be disabled", module);
+        	} catch (InstantiationException e) {
+        		Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " could not be instantiated, distributed cache clearing will be disabled", module);
+        	} catch (IllegalAccessException e) {
+        		Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " could not be accessed (illegal), distributed cache clearing will be disabled", module);
+        	} catch (ClassCastException e) {
+        		Debug.logWarning(e, "DistributedCacheClear class with name " + distributedCacheClearClassName + " does not implement the DistributedCacheClear interface, distributed cache clearing will be disabled", module);
+        	}
+        } else {
+        	Debug.logInfo("Distributed Cache Clear System disabled for delegator [" + this.delegatorData.delegatorName + "]", module);
+        }
+
+        // setup the Entity ECA Handler
+        initEntityEcaHandler();
+    }
+
     protected void initEntityEcaHandler() {
         if (this.delegatorData.delegatorInfo.useEntityEca) {
             ClassLoader loader = Thread.currentThread().getContextClassLoader();
@@ -2088,11 +2098,13 @@
 
         try {
             for (GenericEntity value : dummyPKs) {
+            	this.executionContext.pushExecutionArtifact(value);
                 if (value.containsPrimaryKey()) {
                     numRemoved += this.removeByPrimaryKey(value.getPrimaryKey(), doCacheClear);
                 } else {
                     numRemoved += this.removeByAnd(value.getEntityName(), value.getAllFields(), doCacheClear);
                 }
+                this.executionContext.popExecutionArtifact();
             }
 
             return numRemoved;
@@ -2108,10 +2120,8 @@
             // after rolling back, rethrow the exception
             throw e;
         } finally {
-            // only commit the
-                                                    // transaction if we started
-                                                    // one... this will throw an
-                                                    // exception if it fails
+            // only commit the transaction if we started one... this will throw an
+            // exception if it fails
             TransactionUtil.commit(beganTransaction);
         }
     }
@@ -2142,6 +2152,7 @@
     }
 
     public int removeByCondition(String entityName, EntityCondition condition, boolean doCacheClear) throws GenericEntityException {
+    	this.executionContext.pushExecutionArtifact(new GenericExecutionArtifact("GenericDelegator.removeByCondition", entityName));
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -2181,14 +2192,9 @@
             // after rolling back, rethrow the exception
             throw e;
         } finally {
-            // only commit
-                                                                // the
-                                                                // transaction
-                                                                // if we started
-                                                                // one... this
-                                                                // will throw an
-                                                                // exception if
-                                                                // it fails
+        	this.executionContext.popExecutionArtifact();
+            // only commit the transaction if we started one... this will throw
+            // an exception if it fails
             TransactionUtil.commit(beganTransaction);
         }
     }
@@ -2199,6 +2205,7 @@
     }
 
     public int removeByPrimaryKey(GenericPK primaryKey, boolean doCacheClear) throws GenericEntityException {
+    	this.executionContext.pushExecutionArtifact(new GenericExecutionArtifact("GenericDelegator.removeByPrimaryKey", primaryKey.getEntityName()));
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -2211,12 +2218,7 @@
             GenericHelper helper = getEntityHelper(primaryKey.getEntityName());
 
             if (doCacheClear) {
-                // always
-                                                                    // clear
-                                                                    // cache
-                                                                    // before
-                                                                    // the
-                                                                    // operation
+                // always clear cache before the operation
                 ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_REMOVE, primaryKey, false);
                 this.clearCacheLine(primaryKey);
             }
@@ -2255,8 +2257,9 @@
             // after rolling back, rethrow the exception
             throw e;
         } finally {
+        	this.executionContext.popExecutionArtifact();
             // only commit the transaction if we started one... this will throw an
-    // exception if it fails
+            // exception if it fails
             TransactionUtil.commit(beganTransaction);
         }
     }
@@ -2287,6 +2290,7 @@
     }
 
     public int removeValue(GenericValue value, boolean doCacheClear) throws GenericEntityException {
+    	this.executionContext.pushExecutionArtifact(value);
         // NOTE: this does not call the GenericDelegator.removeByPrimaryKey
         // method because it has more information to pass to the ECA rule hander
         boolean beganTransaction = false;
@@ -2341,6 +2345,7 @@
             // after rolling back, rethrow the exception
             throw e;
         } finally {
+        	this.executionContext.popExecutionArtifact();
             // only commit the transaction if we started one... this will throw
             // an exception if it fails
             TransactionUtil.commit(beganTransaction);
@@ -2482,7 +2487,7 @@
     }
 
     public void setLocale(Locale locale) {
-        this.locale = locale;
+        this.executionContext.setLocale(locale);
     }
 
     public void setSessionIdentifier(String identifier) {
@@ -2511,6 +2516,7 @@
     }
 
     public int store(GenericValue value, boolean doCacheClear) throws GenericEntityException {
+    	this.executionContext.pushExecutionArtifact(value);
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -2567,6 +2573,7 @@
             // after rolling back, rethrow the exception
             throw e;
         } finally {
+        	this.executionContext.popExecutionArtifact();
             // only commit the transaction if we started one... this will throw
             // an exception if it fails
             TransactionUtil.commit(beganTransaction);
@@ -2671,6 +2678,7 @@
     }
 
     public int storeByCondition(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition, boolean doCacheClear) throws GenericEntityException {
+    	this.executionContext.pushExecutionArtifact(new GenericExecutionArtifact("GenericDelegator.storeByCondition", entityName));
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -2723,4 +2731,10 @@
         this.testOperations.add(testOperation);
     }
 
+	public void setExecutionContext(ExecutionContext executionContext) {
+		if (executionContext != null) {
+			this.executionContext = executionContext;
+		}
+	}
+
 }

Added: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/ExecutionContext.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/ExecutionContext.java?rev=803693&view=auto
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/ExecutionContext.java (added)
+++ ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/ExecutionContext.java Wed Aug 12 20:09:32 2009
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+/**
+ * ExecutionContext Interface. This interface extends the ExecutionContext
+ * interface defined in the <code>base</code> component.
+ */
+public interface ExecutionContext extends org.ofbiz.api.context.ExecutionContext {
+
+	/** Returns the current <code>GenericDelegator</code> instance.
+	 * 
+	 * @return The current <code>GenericDelegator</code> instance
+	 */
+	public GenericDelegator getDelegator();
+
+	/** Returns the current userLogin <code>GenericValue</code>.
+	 * 
+	 * @return The current userLogin <code>GenericValue</code>
+	 */
+	public GenericValue getUserLogin();
+
+	/** Sets the current <code>GenericDelegator</code> instance.
+	 * 
+	 * @param delegator The new <code>GenericDelegator</code> instance
+	 */
+	public void setDelegator(GenericDelegator delegator);
+
+    /** Sets the current userLogin <code>GenericValue</code>.
+     * 
+     * @param userLogin The new userLogin <code>GenericValue</code>.
+     */
+	public void setUserLogin(GenericValue userLogin);
+}

Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/ExecutionContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Propchange: ofbiz/branches/executioncontext20090812/framework/entity/src/org/ofbiz/entity/ExecutionContext.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain