|
Author: adrianc
Date: Fri Jan 15 14:33:03 2010 New Revision: 899646 URL: http://svn.apache.org/viewvc?rev=899646&view=rev Log: Implemented Adam Heath's encapsulation idea. Modified: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/AbstractExecutionContext.java ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContext.java ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java Modified: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/AbstractExecutionContext.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/AbstractExecutionContext.java?rev=899646&r1=899645&r2=899646&view=diff ============================================================================== --- ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/AbstractExecutionContext.java (original) +++ ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/AbstractExecutionContext.java Fri Jan 15 14:33:03 2010 @@ -147,6 +147,17 @@ this.timeZone = TimeZone.getDefault(); } + public void runExecutionArtifact(ExecutionArtifact artifact) { + pushExecutionArtifact(artifact); + try { + artifact.run(); + } catch (Throwable t) { + Debug.logError(t, module); + } finally { + popExecutionArtifact(); + } + } + public void setCurrencyUom(String currencyUom) { if (currencyUom != null) { this.currencyUom = currencyUom; Modified: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java?rev=899646&r1=899645&r2=899646&view=diff ============================================================================== --- ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java (original) +++ ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionArtifact.java Fri Jan 15 14:33:03 2010 @@ -37,4 +37,9 @@ * @return Name of this artifact */ String getName(); + + /** + * Run this artifact's protected code. + */ + void run(); } Modified: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContext.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContext.java?rev=899646&r1=899645&r2=899646&view=diff ============================================================================== --- ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContext.java (original) +++ ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/ExecutionContext.java Fri Jan 15 14:33:03 2010 @@ -140,9 +140,18 @@ */ void reset(); - /** + /** Run an <code>ExecutionArtifact</code>'s protected code. + * + * + * @param artifact + */ + void runExecutionArtifact(ExecutionArtifact artifact); + + /** * Replaces the current <code>AuthorizationManager</code> instance * with one that allows unrestricted use of all artifacts. + * + * @param artifact */ void runUnprotected(); Modified: ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java?rev=899646&r1=899645&r2=899646&view=diff ============================================================================== --- ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java (original) +++ ofbiz/branches/executioncontext20091231/framework/api/src/org/ofbiz/api/context/GenericExecutionArtifact.java Fri Jan 15 14:33:03 2010 @@ -29,15 +29,20 @@ this.name = name; } + @Override public String getLocation() { return this.location; } + @Override public String getName() { return this.name; } @Override + public void run() {} + + @Override public String toString() { return "GenericExecutionArtifact: location = " + this.location + ", name = " + this.name; } |
| Free forum by Nabble | Edit this page |
