You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ad...@apache.org on 2006/02/28 17:35:26 UTC
svn commit: r381694 [28/38] - in /incubator/ode/scratch: bpe/ ode/
ode/bpelTests/ ode/bpelTests/probeService/ ode/bpelTests/test1/
ode/bpelTests/test10/ ode/bpelTests/test12/ ode/bpelTests/test13/
ode/bpelTests/test14/ ode/bpelTests/test15/ ode/bpelTes...
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/IEvaluationContext.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/IEvaluationContext.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/IEvaluationContext.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/IEvaluationContext.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jul 31, 2003
+ */
+package org.apache.ode.engine;
+
+/**
+ * @author charper
+ * An implementation must provide access to engine services.
+ */
+public interface IEvaluationContext {
+
+ /**
+ * Get the ProcessService.
+ * @return ProcessService
+ */
+ public ProcessService getProcessService();
+
+ /**
+ * Add a Process Instance to the evaluation context.
+ *
+ * @param pi - a process instance
+ */
+ public void addProcessInstance(ProcessInstance pi);
+
+ /**
+ * Get next process Instance for evaluation. The engine will
+ * continue to ask the evaluation context for a process instance.
+ * When the evaluation context returns null the engine halts
+ * processing.
+ *
+ */
+ public ProcessInstance getNextProcessInstance();
+
+ /**
+ * The engine will notify the evaluation context when to
+ * initialize it's process instance collection
+ *
+ */
+ public void initProcessInstanceCollection();
+
+ /**
+ * If the process instance collection is empty return false
+ *
+ */
+ public boolean processInstanceCollectionIsEmpty();
+
+ /**
+ * Release the resources associated with this EvaluationContext.
+ *
+ */
+ public void release();
+
+ /**
+ * Mark this process as a dead process. These will
+ * get cleaned up when a process blocks and the registraion
+ * the process jumps back to is a defintion and not a
+ * live process thread.
+ *
+ */
+ public void setDeadProcess(boolean mark);
+ public boolean isDeadProcess();
+
+
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/IProcessCallBack.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/IProcessCallBack.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/IProcessCallBack.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/IProcessCallBack.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+import org.apache.ode.bped.ISendEvent;
+import org.apache.ode.correlation.CorrelationService;
+import org.apache.ode.locking.LockingService;
+import org.apache.ode.event.IRequestMessageEvent;
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.util.BPException;
+import org.apache.ode.uuid.UUIDService;
+
+/**
+ * The event director is responsible for routing web service event messages
+ * to a process that is registered to recievce the event. Events can be sent
+ * syncronously or asyncronoulsy to the process engine. If a syncronous
+ * message is sent an EventResult will be returned.
+ */
+public interface IProcessCallBack extends ISendEvent
+{
+
+ /**
+ * Activate a process.
+ * @param procKey The process key.
+ * @return An event result.
+ * @throws EventDirectorException If and error occurs while
+ * processing the Event. Note that the method can complete with out
+ * error, but the returned EventResult can contain fault messages.
+ */
+ public void activate(String rootKey, java.lang.String procKey) throws BPException;
+
+ /**
+ * Terminate a process.
+ * @param procKey The process key.
+ * @return An event result.
+ * @throws EventDirectorException If and error occurs while
+ * processing the Event. Note that the method can complete with out
+ * error, but the returned EventResult can contain fault messages.
+ */
+ public void terminate(String rootKey, java.lang.String procKey) throws BPException;
+
+ /**
+ * Pause a process.
+ * @param procKey The process key.
+ * @return An event result.
+ * @throws EventDirectorException If and error occurs while
+ * processing the Event. Note that the method can complete with out
+ * error, but the returned EventResult can contain fault messages.
+ */
+ public void pause(String rootKey, java.lang.String procKey) throws BPException;
+
+ /**
+ * Initialize the EventDirector.
+ * @param props Initialization properties.
+ * @param cs A correlation service for this EventDirector to use.
+ */
+ public void init ( BPEProperties props, ProcessService ps, CorrelationService cs, UUIDService us, LockingService ls) throws BPException;
+
+ /**
+ * Get the CorrelationService associated with this EventDirector.
+ * @return CorrelationService
+ */
+ public CorrelationService getCorrelationService();
+
+ /**
+ * Get the LockingService associated with this EventDirector.
+ * @return LockingService
+ */
+ public LockingService getLockingService();
+
+ /**
+ * Get the ProcessService associated with this EventDirector.
+ * @return ProcessService
+ */
+ public ProcessService getProcessService();
+
+ /**
+ * Get the return message metadata.
+ * @return
+ */
+ public ReturnMessageLocatorHolder getReturnMessageMetadata();
+
+ /**
+ * Set the return message metadata.
+ * @param c
+ */
+ public void setReturnMessageMetadata(ReturnMessageLocatorHolder rmlh);
+
+
+ /**
+ * Get the current message event.
+ * @return
+ */
+ public IRequestMessageEvent getMessageEvent();
+
+ /**
+ * Set the currentmessage event.
+ * @param me
+ */
+ public void setMessageEvent(IRequestMessageEvent rmlh);
+
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/InactiveDefinitionException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/InactiveDefinitionException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/InactiveDefinitionException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/InactiveDefinitionException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+import org.apache.ode.util.BPException;
+
+
+public class InactiveDefinitionException extends BPException
+{
+ static final long serialVersionUID = -9091131013904428583L;
+
+
+ private String m_businessProcessName;
+ private String m_rootID;
+
+ public InactiveDefinitionException(
+ String businessProcessName, String rootId )
+ {
+ super( businessProcessName );
+ m_businessProcessName = businessProcessName;
+ m_rootID = rootId;
+ }
+
+ public String getProcessName()
+ {
+ return m_businessProcessName;
+ }
+
+ public String getRootDefinitionID()
+ {
+ return m_rootID;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessDefinitionKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessDefinitionKey.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessDefinitionKey.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessDefinitionKey.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+//import java.util.logging.Logger;
+
+import org.apache.ode.uuid.UUIDService;
+
+/** A unique identifier for a process definition.
+ * <P>
+ * This is a type safe ProcessKey class. */
+public class ProcessDefinitionKey extends ProcessKey
+{
+
+ static final long serialVersionUID = -8053977175828292343L;
+
+// private static Logger logger =
+// Logger.getLogger(ProcessDefinitionKey.class.getName());
+
+ public ProcessDefinitionKey(){}
+
+ public ProcessDefinitionKey(UUIDService us)
+ {
+ super(us);
+ }
+
+ /** @param value */
+ public ProcessDefinitionKey(java.lang.String value)
+ { super(value); }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessDefinitionQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessDefinitionQuery.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessDefinitionQuery.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessDefinitionQuery.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+//import java.util.logging.Logger;
+
+/** The class is used to build params on which to query for process definitions.
+ * <P>
+ * This is a type safe ProcessQuery class. */
+public class ProcessDefinitionQuery extends ProcessQuery
+{
+
+// private static Logger logger =
+// Logger.getLogger(ProcessDefinitionQuery.class.getName());
+
+ private ProcessDefinitionQuery()
+ {
+ // Not a valid constructor
+ super();
+ }
+
+ public ProcessDefinitionKey getDefinitionKey()
+ {
+ return (ProcessDefinitionKey)getKey();
+ }
+
+ /** @param key */
+ public void setDefinitionKey(ProcessDefinitionKey key)
+ {
+ setKey(key);
+ }
+
+ /** @param processKey */
+ public ProcessDefinitionQuery(ProcessKey processKey)
+ { super(processKey); }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstance.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstance.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstance.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstance.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,577 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+//import java.util.Collection;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.internal.IInternalAction;
+import org.apache.ode.condition.Conditional;
+import org.apache.ode.context.IContextService;
+import org.apache.ode.context.resolver.ContextResolvedObject;
+import org.apache.ode.context.resolver.ContextResolver;
+import org.apache.ode.definition.IPMDAction;
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.definition.IPMDLocator;
+import org.apache.ode.definition.IPMDLocatorHolder;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.event.IEvent;
+import org.apache.ode.event.IInternalEvent;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.instance.IPMIProcess;
+import org.apache.ode.instance.service.InstanceService;
+import org.apache.ode.interaction.spiadapter.SPIAdapterInteraction;
+import org.apache.ode.lang.ResourceGetter;
+import org.apache.ode.scope.service.IFCScopeInstance;
+import org.apache.ode.scope.service.IScopeService;
+import org.apache.ode.scope.service.ScopePath;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author waterman
+ *
+ * This is <B>THE</B> interface used by clients of the business process engine. From
+ * this interface client code can introspect a running process or send events/messages
+ * to a running process.
+ *
+ * @see ProcessService
+ *
+ */
+public class ProcessInstance {
+
+ private static Logger logger =
+ Logger.getLogger(ProcessInstance.class.getName());
+
+ private IPMIProcess process;
+ private ProcessService ps;
+ // if user does not define the VARIABLE_LOGGING_SIZE_PROP in
+ // through LogManager, we will log full value of the variable
+ private int debugVariableLogSize = Integer.MAX_VALUE;
+
+ private final static String LINE_SEPERATOR = System.getProperty("line.separator");
+ private final static String VARIABLE_LOGGING_SIZE_PROP = "VARIABLE_LOGGING_SIZE";
+
+ protected ProcessInstance(IPMIProcess process, ProcessService ps) {
+ this.process = process;
+ this.ps = ps;
+ }
+
+ /** Returns the unique persistent identifier of the process intance. This
+ * identifier is suitable for re-acquiring a ProcessInstance through the
+ * ProcessService interface.
+ *
+ * @see ProcessService
+ *
+ * @return a unique process instance identifier
+ */
+ public String getKey() {
+ return process.getKey();
+ }
+
+ /**
+ *
+ * @return the process root key
+ */
+ public String getRootKey () {
+ return process.getRootKey();
+ }
+
+ public InstanceService getInstanceService () {
+ return ps.getInstanceService();
+ }
+
+ public IScopeService getScopeService() throws BPException{
+ return ps.getScopeService(process);
+ }
+
+ /** Returns the data ContextService for the process instance
+ *
+ * @see ContextSerivce
+ */
+ public IContextService getContextService() throws BPException {
+
+ return ps.getContextService(process);
+
+ }
+
+ /** Returns subprocesses of the process instance.
+ *
+ *
+ * @param scope - allows filtering of the sub-processes to return
+ * @return a collection of ProcessInstance */
+ public java.util.Collection getSubProcess(ScopeEnum scope) {
+ // WAIT: waiting fro IO process management requirements
+ return null;
+ }
+
+ /** Returns the state of the process instance */
+ public StateEnum getState() {
+ return StateEnum.getState(process.getState());
+ }
+ public void setState(StateEnum state) {
+ process.setState(state.getIntValue());
+ }
+
+ public ScopePath getScopePath() {
+ return process.getScopePath();
+ }
+
+ public void setScopePath(ScopePath scopePath) {
+ process.setScopePath(scopePath);
+ }
+
+ /** Returns the human readable label of the process instance */
+ public java.lang.String getLabel() throws BPException {
+ return process.getDefinition().getLabel();
+ }
+
+ /** Returns a verbose description of the process instance */
+ public java.lang.String getDescription()
+ throws BPException {
+ return process.getDefinition().getDescription();
+ }
+
+ /** Returns the process instance version */
+ public java.lang.String getVersion() throws BPException {
+ return process.getDefinition().getVersion();
+ }
+
+ /** Pause the process instance */
+ public void pause() {
+ // WAIT: waiting for IO process management requirements
+ }
+
+ /** Re-Activate a paused process instance */
+ public void activiate() {
+ // WAIT: waiting for IO process management requirements
+ }
+
+ /** Terminate the process instance
+ * @throws BPException*/
+ public void terminate(IEvaluationContext ec, IProcessCallBack pcb) throws BPException {
+
+ IScopeService ss = getScopeService();
+ ss.getRootScope().terminate(this.process,ec,pcb);
+
+ }
+
+ private boolean isRootProcessPaused() throws BPException
+ {
+ IPMIProcess rootInstance
+ = getInstanceService().getRootInstance( getRootKey() );
+
+ return rootInstance.isPaused();
+
+ }
+
+ /**
+ * Executes the process definition instruction set.
+ * @param ed The EventDirector.
+ * @param event The event to process.
+ * @return An EventResult indicating failure status.
+ * @throws BPException If an error occurs while processing.
+ */
+ public void processEvent(IEvent event, IEvaluationContext ec, IProcessCallBack pcb)
+ throws BPException {
+
+ if ( !( event instanceof IInternalEvent ))
+ {
+ if( isRootProcessPaused() )
+ {
+ throw new ProcessInstancePausedException( this.getRootKey());
+ }
+ }
+
+ ec.initProcessInstanceCollection();
+
+ processInternalEvent(event,ec,pcb);
+
+ while ( !ec.processInstanceCollectionIsEmpty() ) {
+ ProcessInstance pi = ec.getNextProcessInstance();
+
+ // Send a Start event to the process instance
+ pi.processInternalEvent(
+ new StateEvent(pi.getRootKey(),pi.getKey(), StateEnum.STARTED),
+ ec, pcb);
+ }
+
+
+ }
+
+ private void processInternalEvent(IEvent event, IEvaluationContext ec, IProcessCallBack pcb)
+ throws BPException {
+
+// Collection outputContainers = null;
+ ec.setDeadProcess(false);
+
+ logProcessStatus(" * Engine Begins Executing->");
+
+ if ( event instanceof IInternalEvent ) {
+ ((IInternalEvent)event).apply(this,ec,pcb);
+ }
+
+ // we need this to do clean up, this object may be overwritten by
+ // the reply object
+ ReturnMessageLocatorHolder rmlh = pcb.getReturnMessageMetadata();
+ if ( rmlh == null ) {
+ rmlh = new ReturnMessageLocatorHolder();
+ rmlh.setRootProcessID(getRootKey());
+ pcb.setReturnMessageMetadata(rmlh);
+ }
+
+ // If the process is not in a started state then log the fact and return
+ // a message as to such.
+ if (process.getState() != StateEnum.STARTED.getIntValue()) {
+ // WAIT: waiting for IO process management requirements
+ if ( process.getState() == StateEnum.TERMINATED.getIntValue() ) {
+ return;
+ }
+ String s = ResourceGetter.getFormatted("ENG_PI_PNS",
+ new Object[] {process.getKey(),
+ String.valueOf(process.getState())});
+ logger.severe(s);
+ }
+
+
+ try {
+ // process change conditions
+ if (evaluate(process.getDefinition().getChangeConditions(),
+ process.getDefinition(),
+ ec,pcb)) {
+
+ // if all change conditions successfully complete set state to finished
+ process.setState(StateEnum.FINISHED.getIntValue());
+
+ // process observing pre-conditions
+ Iterator iOPC = process.getDefinition().getObserverProcessPC();
+ while (iOPC.hasNext()) {
+ IPMDProcess pDef = (IPMDProcess) iOPC.next();
+ evaluate(
+ pDef.getPrecondition(),
+ pDef, ec,
+ pcb);
+ }
+
+ logProcessStatus(" * Engine Ends Executing->");
+
+ // remove this process now that it is finished
+ //
+ // dead processes are kept around to store the
+ // scope path for onMessages
+ if ( ! ec.isDeadProcess() ) {
+ process.remove();
+ }
+ }
+
+ // push all errors through the fault handling
+ } catch (Throwable t) {
+
+ IScopeService ss = getScopeService();
+ IFCScopeInstance scope = ss.getScope(getScopePath());
+ scope.handleFault(t,this.process,ec,pcb);
+ process.remove();
+ }
+ }
+
+ // An engine convenience method
+ private boolean evaluate( IPMDChangeCondition dCC,
+ IPMDProcess pDef, IEvaluationContext ec, IProcessCallBack pcb)
+ throws BPException {
+
+ boolean result = true;
+
+ if (dCC == null ) {
+ if ( logger.isLoggable(Level.FINE)) {
+ logger.fine(pDef.getLabel() +" has no conditions.");
+ }
+ return result;
+ }
+
+ // Acquire a Conditional implementation from the definition
+ Conditional cond = dCC.getConditionalImpl();
+
+ // create a context resolver to pass to the evaluate
+ ContextResolver resolver=new ContextResolver(process,
+ (IPMDLocatorHolder)dCC,this.getContextService(),this.getScopeService());
+
+ // Evaluate the ruleset
+ boolean bln = cond.evaluate(resolver);
+ if ( bln ) {
+
+ logConditionEvaluation( true, dCC, pDef );
+
+ // NOTE: the conditional evaluation returns true or false. This indicates
+ // where the action should fire. It does not indicate that the engine should
+ // terminate
+
+ Iterator iAction = dCC.getActions();
+
+ result = executeActions(iAction,pDef,ec,pcb);
+ }
+ else
+ {
+ logConditionEvaluation( false, dCC, pDef );
+
+ Iterator iAction = dCC.getFalseActions();
+
+ result = executeActions(iAction,pDef,ec,pcb);
+ }
+
+ return result;
+ }
+
+ private boolean executeActions(Iterator iAction, IPMDProcess pDef,
+ IEvaluationContext ec, IProcessCallBack pcb) throws BPException {
+ // NOTE: if any action implementation returns false the processing
+ // cycle is halted. It is assumed that an action that halts processing
+ // is waiting for a piece of data and has notified the event director
+ // of this fact.
+
+ boolean result = true;
+
+ while (iAction.hasNext() && result) {
+ IPMDAction actionMD = (IPMDAction) iAction.next();
+
+ // Acquire the Action implementation
+ IInternalAction action = actionMD.getActionImpl();
+
+ //create a context resolver to pass to the evaluate
+ ContextResolver resolver=new ContextResolver(process,(IPMDLocatorHolder)actionMD,
+ getContextService(),this.getScopeService());
+
+ // execute the action implementation
+ result =
+ action.execute(resolver,
+ ec,
+ pcb, process, pDef);
+
+ logActionExecution(result, action);
+ }
+
+ return result;
+ }
+
+
+
+
+ private void logActionExecution(boolean result,
+ IInternalAction action)
+ {
+ if (logger.isLoggable(Level.FINER))
+ {
+ logger.fine( "\n * Engine executed Action( class = "
+ + action.getClass().getName()
+ + ", retValue = " + result +" )");
+ }
+
+ }
+
+ private void logConditionEvaluation(boolean b,
+ IPMDChangeCondition dcc,
+ IPMDProcess def)
+ {
+ if (logger.isLoggable(Level.FINER))
+ {
+ logger.fine( "\n * Engine condition evaluated to " + b +
+ " for defintion( label = " + def.getLabel() +
+ ", key = " + def.getKey().getValue() + ")");
+
+ }
+
+ }
+
+ // An engine convenience method. Iterates over a collection of ChangeConditions
+ private boolean evaluate(
+ Iterator iCC,
+ IPMDProcess pDef, IEvaluationContext ec,
+ IProcessCallBack pcb)
+ throws BPException {
+ boolean result = true;
+
+ // NOTE: if any action implementation returns false the processing
+ // cycle is halted. It is assumed that an action that halts processing
+ // is waiting for a piece of data and has notified the event director
+ // of this fact.
+
+
+ while (iCC.hasNext() && result) {
+ result = evaluate((IPMDChangeCondition) iCC.next(),
+ pDef, ec, pcb);
+ }
+
+ return result;
+ }
+
+ private void logProcessStatus(String positionIdentifier) throws BPException {
+ if ( logger.isLoggable(Level.FINE)
+ || logger.isLoggable(Level.FINER)){
+ // we get the variable log size here so that runtimely user is able
+ // to change the variable log size
+ String variableLogSize = LogManager.getLogManager().getProperty(VARIABLE_LOGGING_SIZE_PROP);
+
+ if (variableLogSize != null) {
+ // debug log size property is defined
+ // convert the value to integer
+ this.debugVariableLogSize = (new Integer(variableLogSize)).intValue();
+
+ if (this.debugVariableLogSize < 0) {
+ // it is a negative value, treate it as log the full content
+ this.debugVariableLogSize = Integer.MAX_VALUE;
+ }
+ }
+
+ String loggerStr = "*********************************";
+ loggerStr += LINE_SEPERATOR;
+ //loggerStr += " * Engine Is Executing->" + getLabel();
+ loggerStr += positionIdentifier + getLabel();
+ loggerStr += LINE_SEPERATOR;
+ if (getDescription() != null) {
+ loggerStr += " * Detail Metadata Description->" + getDescription();
+ loggerStr += LINE_SEPERATOR;
+ }
+
+ if (logger.isLoggable(Level.FINER)) {
+ // need to log variables
+ loggerStr += " * Variable(s):";
+ loggerStr += LINE_SEPERATOR;
+
+ // get the initial iterator for the changed connections
+ Iterator changeConditionsIterator = process.getDefinition().getChangeConditions();
+ if (changeConditionsIterator != null) {
+ // has changed connections
+ // go through all changed conditions
+ while (changeConditionsIterator.hasNext()) {
+ // get the changed condition
+ IPMDChangeCondition changeCondition = (IPMDChangeCondition)(changeConditionsIterator.next());
+ // create a context resolver to pass to the evaluate
+ ContextResolver resolver = new ContextResolver(process,
+ (IPMDLocatorHolder)(changeCondition),this.getContextService(),this.getScopeService());
+ // log the variable for this changed condition
+ loggerStr = logVariables(loggerStr, resolver);
+ // get the initial iterator of the actions for this changed condition
+ Iterator iAction = changeCondition.getActions();
+ if (iAction != null) {
+ // has action
+ while (iAction.hasNext()) {
+ // go through the action
+ // get the action
+ IPMDAction actionMD = (IPMDAction) iAction.next();
+
+ // Acquire the Action implementation
+ actionMD.getActionImpl();
+
+ //create a context resolver to pass to the evaluate
+ ContextResolver actionResolver = new ContextResolver(process,
+ (IPMDLocatorHolder)actionMD,
+ getContextService(),
+ this.getScopeService());
+
+ // log variable for this action
+ loggerStr = logVariables(loggerStr, actionResolver);
+ }
+ }
+ }
+ }
+ }
+
+ loggerStr += " *********************************";
+ logger.fine(loggerStr);
+ }
+ }
+ private String logVariables(String loggerStr,
+ ContextResolver resolver) {
+ // get the locators
+ Iterator it = resolver.getLocatorHolder().getLocators();
+ if (it != null) {
+ // go through the locators
+ while (it.hasNext()) {
+ // get locator
+ IPMDLocator loc = (IPMDLocator) it.next();
+ // get locator name
+ String name = loc.getName();
+ try {
+ // get resolver for the name
+ ContextResolvedObject ro =
+ (ContextResolvedObject) resolver.resolveWithOutInvocation(name);
+ // In the case of experessions the variable name has been replaced with var1 or
+ // var2, etc. This is not very helpful to the user. Replace this name with a
+ // better variable name.
+ name = resolver.getResolvedVariableName(name);
+ if (ro != null) {
+ // resolver is not null
+ // get resulver value
+ Object resolvedValue = ro.getValue();
+ if (resolvedValue != null) {
+ // resolver value is valid
+ // check for size limitation
+ /*if (this.debugVariableLogSize == Integer.MAX_VALUE) {
+ // print full string
+ loggerStr += " * " + name + " = " + ro.getValue().toString();
+ } else {
+ // print string up to some size
+ // get the value string
+ String value = ro.getValue().toString();
+ if (value.length() > this.debugVariableLogSize) {
+ // value string's size is greater than the log size
+ // print out the string up to the log size
+ loggerStr += " * " + name + " = " + ro.getValue().toString().substring(0, this.debugVariableLogSize);
+ } else {
+ // value string's size is not greater than the log size
+ // print out the whole log string
+ loggerStr += " * " + name + " = " + ro.getValue().toString();
+ }
+ }*/
+ if (resolvedValue instanceof SPIAdapterInteraction)
+ {
+ SPIAdapterInteraction spi = (SPIAdapterInteraction) resolvedValue;
+ if (spi.getUserValue().supportsGetValueAs(byte[].class))
+ {
+ byte[] ba = (byte[]) spi.getUserValue().getValueAs(byte[].class);
+ String str = new String(ba);
+ if (str.length() > 500)
+ str = str.substring(0, 499);
+ loggerStr += " * " + name + " = " + str;
+ }
+ else if ( spi.getUserValue().supportsGetValueAs(String.class))
+ {
+ String str = (String) spi.getUserValue().getValueAs(String.class);
+ loggerStr += " * " + name + " = " + str;
+ } else {
+ loggerStr += " * " + name + " = " + spi.getUserValue().toString();
+ }
+ }
+ } else {
+ // resolver value is null
+ loggerStr += " * " + name + " = null";
+ }
+ } else {
+ // resolver is null
+ loggerStr += " * " + name + " = null";
+ }
+ } catch (Exception e) {
+ // log the exception with the variable name
+ loggerStr += " * " + name + "->" + e.getClass().getName() + ":" + e.getLocalizedMessage();
+ }
+ loggerStr += LINE_SEPERATOR;
+ }
+ }
+ return loggerStr;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstanceKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstanceKey.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstanceKey.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstanceKey.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+import java.io.Serializable;
+//import java.util.logging.Logger;
+
+import org.apache.ode.uuid.UUIDService;
+
+/** A unique identifier for a process instance.
+ * <P>
+ * This is a type safe ProcessKey class. */
+public class ProcessInstanceKey extends ProcessKey implements Serializable
+{
+ static final long serialVersionUID = 7060148401730358328L;
+
+// private static Logger logger =
+// Logger.getLogger(ProcessInstanceKey.class.getName());
+
+ public ProcessInstanceKey(UUIDService us)
+ {
+ super(us);
+ }
+
+ /** @param value */
+ public ProcessInstanceKey(java.lang.String value)
+ { super(value); }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstancePausedException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstancePausedException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstancePausedException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstancePausedException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+import org.apache.ode.util.BPException;
+
+public class ProcessInstancePausedException extends BPException
+{
+ static final long serialVersionUID = -27361981030381730L;
+
+
+ private String m_rootInstanceID;
+
+ public ProcessInstancePausedException( String rootInstanceID )
+ {
+ super( rootInstanceID);
+ m_rootInstanceID = rootInstanceID;
+ }
+
+ public String getRootInstanceID()
+ {
+ return m_rootInstanceID;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstanceQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstanceQuery.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstanceQuery.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessInstanceQuery.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+//import java.util.logging.Logger;
+
+/** The class is used to build params on which to query for process instances.
+ * <P>
+ * This is a type safe ProcessQuery class. */
+public class ProcessInstanceQuery extends ProcessQuery
+{
+
+// private static Logger logger =
+// Logger.getLogger(ProcessInstanceQuery.class.getName());
+ private ProcessInstanceQuery()
+ {
+ // Not a valid constructor
+ super();
+ }
+
+ public ProcessInstanceKey getInstanceKey()
+ {
+ return (ProcessInstanceKey)getKey();
+ }
+
+ /** @param key */
+ public void setInstanceKey(ProcessInstanceKey key)
+ {
+ setKey(key);
+ }
+
+ /** @param processKey */
+ public ProcessInstanceQuery(ProcessKey processKey)
+ { super(processKey); }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessKey.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessKey.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessKey.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+import java.io.Serializable;
+//import java.util.logging.Logger;
+
+import org.apache.ode.uuid.UUIDService;
+
+/** A unique identifier for a process definition or process instance. */
+public class ProcessKey implements Serializable
+{
+ static final long serialVersionUID = 3912287075455837427L;
+
+// private static Logger logger =
+// Logger.getLogger(ProcessKey.class.getName());
+ private java.lang.String value;
+
+ public ProcessKey() {}
+
+ public java.lang.String getValue()
+ {
+ return value;
+ }
+
+ /** @param newValue */
+ public void setValue(java.lang.String newValue)
+ {
+ value = newValue;
+ }
+
+ /** Generates a new UUID. */
+ public ProcessKey(UUIDService us)
+ {
+ value = us.getUUID();
+ }
+
+ /** @param value */
+ public ProcessKey(java.lang.String value)
+ {
+ this.value = value;
+ }
+
+ /** Object equality if based on it's unique ID value.
+ *
+ * @param obj */
+ public boolean equals(Object obj)
+ {
+ if ( obj instanceof ProcessKey ) {
+ return value.equals(((ProcessKey)obj).value);
+ }
+ return false;
+ }
+
+ /** Return the hashCode of it's unique iD value */
+ public int hashCode()
+ {
+ return value.hashCode();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessQuery.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessQuery.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessQuery.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+//import java.util.logging.Logger;
+
+public class ProcessQuery
+{
+
+// private static Logger logger =
+// Logger.getLogger(ProcessQuery.class.getName());
+ protected ProcessQuery()
+ {
+ // Not a valid constructor
+ }
+
+ public ProcessKey key;
+
+ public ProcessKey getKey()
+ {
+ return key;
+ }
+
+ /** @param newKey */
+ public void setKey(ProcessKey newKey)
+ {
+ key = newKey;
+ }
+
+ /** @param processKey */
+ public ProcessQuery(ProcessKey processKey)
+ {
+ key = processKey;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessService.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessService.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ProcessService.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,286 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/***********************************************************************
+ * Module: ProcessService.java
+ * Author: waterman
+ * Purpose: Defines the Class ProcessService
+ ***********************************************************************/
+
+package org.apache.ode.engine;
+
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.ode.context.IContextService;
+import org.apache.ode.context.base.ContextServiceException;
+import org.apache.ode.context.base.ContextServiceFactory;
+import org.apache.ode.context.base.ContextTypeEnum;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.definition.IPMDRoot;
+import org.apache.ode.definition.service.DefinitionServiceException;
+import org.apache.ode.instance.IPMIProcess;
+import org.apache.ode.instance.service.InstanceService;
+import org.apache.ode.instance.service.InstanceServiceException;
+import org.apache.ode.instance.service.InstanceServiceFactory;
+import org.apache.ode.scope.service.IScopeService;
+import org.apache.ode.scope.service.ScopeServiceException;
+import org.apache.ode.scope.service.ScopeServiceFactory;
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.util.BPException;
+import org.apache.ode.uuid.UUIDService;
+import org.apache.ode.uuid.UUIDServiceException;
+
+
+/**
+ * @author waterman
+ *
+ * This is the interface used by clients of the business process engine to obtain.
+ * a handle to a process instance.
+ *
+ * A ProcessService holds an instance service. An instance service holds process
+ * instances. A process service is configurable and may be implemented using any
+ * number of technologies. It may be stateless or stateful depending on the business
+ * process definition. It may be persistent or non-persistent. Note a stateless
+ * business process will always use a non-persistent services where a stateful
+ * business process may use persistent or non-persistent services. A stateful business
+ * process using non-persistent services is not recommended and should only be
+ * used for testing/simulation purposes.
+ *
+ * @see ProcessInstance
+ *
+ */
+
+public class ProcessService
+{
+
+ private static Logger logger =
+ Logger.getLogger(ProcessService.class.getName());
+
+ private InstanceService is;
+ private IContextService ctxPersistent;
+ private IContextService ctxNonPersistent;
+ private HashMap scopeServices;
+ private BPEProperties props;
+ private UUIDService us;
+
+ private boolean persistServicesAvailable;
+
+ /**
+ * The ProcessInstance creates a new InstanceService from a list of BPE propertis.
+ */
+ public ProcessService(BPEProperties props,UUIDService us) throws DefinitionServiceException, InstanceServiceException, UUIDServiceException {
+ // Check properties to see if the implementation is configured to use
+ // persistent properties ( this implies an application server platform )
+ persistServicesAvailable = props.getInstanceServicePersistence();
+
+ is = InstanceServiceFactory.createInstanceService(props,us,this);
+ this.us = us;
+ this.props = props;
+ this.scopeServices = new HashMap();
+
+ }
+
+
+ /**
+ * Creates a ProcessInstance from a RootDefinition key.
+ *
+ * @param key - the unique identifier of a root definition */
+ public ProcessInstance createProcess(ProcessDefinitionKey key) throws BPException
+ {
+ IPMDRoot rootDefinition = is.getDefinitionService().getRootDefinition(key);
+ if ( ! rootDefinition.isActive() )
+ {
+ throw new InactiveDefinitionException(
+ rootDefinition.getLabel(),
+ key.getValue());
+ }
+ return new ProcessInstance(is.createRootInstance(
+ is.getDefinitionService().getRootDefinition(key)),this);
+ }
+
+ public ProcessInstance createSubProcess(IPMIProcess ipmi, IPMDProcess ipmd) throws BPException
+ {
+ return new ProcessInstance(ipmi.createSubProcess(ipmd),this);
+ }
+
+ /**
+ * Locates an existing process ( within the InstanceSerivce ) and returns
+ * a ProcessInstance handle
+ *
+ * @param key
+ *
+ */
+ public ProcessInstance lookupProcess(String rootkey, String key) throws BPException
+ {
+ return new ProcessInstance(is.getInstance(rootkey, key),this);
+ }
+
+ /**
+ * Get the InstanceService associated with this ProcessService.
+ * @return InstanceService
+ */
+ public InstanceService getInstanceService() {
+ return is;
+ }
+
+ public IContextService getContextService(IPMIProcess rootkey) throws BPException {
+ return getContextService(rootkey.isStateless());
+ }
+
+ /**
+ * Get a context service
+ * @param root the root key to get a contex service for
+ * @return a context service
+ * @throws BPException
+ */
+ public IContextService getContextService(String rootkey)
+ throws BPException {
+
+ IPMIProcess proc = is.getInstanceForContext(rootkey,rootkey);
+ if ( proc == null ) {
+ return getContextService(false);
+ }
+ IPMDRoot rootDef = is.getDefinitionService().getRootDefinition(
+ proc.getDefinition().getRootKey());
+ return getContextService(rootDef.getIsStateless());
+ }
+
+ private IContextService getContextService(boolean isStateless) throws BPException {
+
+ IContextService ret = null;
+
+ if ( !persistServicesAvailable ) {
+ return getTransientContextService();
+ }
+
+ if ( !isStateless ) {
+
+ if ( ctxPersistent == null ) {
+
+ if ( logger.isLoggable(Level.FINE)) {
+ logger.fine("Creating persistent context.");
+ }
+
+ InitialContext ic;
+ try {
+ ic = new InitialContext();
+ } catch (NamingException e) {
+ BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"NamingException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+ BPEProperties props = new BPEProperties(true,ic);
+
+ props.setProperty(BPEProperties.CTX_CLASS_PERSISTENT_KEY,
+ BPEProperties.CTX_CLASS_PERSISTENT_DEFAULT);
+ props.setProperty(BPEProperties.CTX_PERSISTENCE_KEY,
+ BPEProperties.CTX_PERSISTENT);
+ props.setProperty(BPEProperties.DOF_CLASS_PERSISTENT_KEY,
+ BPEProperties.DOF_CLASS_PERSISTENT_DEFAULT);
+ props.setProperty(BPEProperties.DOF_EJB_HOME_KEY,
+ BPEProperties.DOF_CMP_HOME);
+
+
+ ctxPersistent = ContextServiceFactory.createContextService(props,us,
+ ContextTypeEnum.PERSISTENT);
+ ret = ctxPersistent;
+ } else {
+ ret = ctxPersistent;
+ }
+ } else {
+ ret = getTransientContextService();
+ }
+
+ return ret;
+
+ }
+
+ /**
+ * Get a scope service.
+ * @param root the root key to get a scope service for
+ * @return a scope service
+ * @throws ScopeServiceException
+ * @throws BPException
+ */
+ public IScopeService getScopeService(IPMIProcess rootkey)
+ throws ScopeServiceException, BPException{
+ IScopeService ss = (IScopeService)scopeServices.get(rootkey.getRootKey());
+ if ( ss == null ) {
+
+ ss = ScopeServiceFactory.createScopeService(getContextService(rootkey),rootkey.getRootKey(),props);
+ scopeServices.put(rootkey.getRootKey(),ss);
+ }
+ return ss;
+ }
+
+ /**
+ * Get a scope service.
+ * @param root the root key to get a scope service for
+ * @return a scope service
+ * @throws ScopeServiceException
+ * @throws BPException
+ */
+ public IScopeService getScopeService(String rootkey)
+ throws ScopeServiceException, BPException{
+ IScopeService ss = (IScopeService)scopeServices.get(rootkey);
+ if ( ss == null ) {
+
+ ss = ScopeServiceFactory.createScopeService(getContextService(rootkey),rootkey,props);
+ scopeServices.put(rootkey,ss);
+ }
+ return ss;
+ }
+
+ /**
+ * Update process service resources
+ * @param rootkey the root process key to update for
+ * @param ec the evaluation context
+ * @param pcb the process call back interface
+ * @throws BPException
+ */
+ public void update(String rootkey, IEvaluationContext ec,
+ IProcessCallBack pcb)throws BPException{
+
+ scopeServices.remove(rootkey);
+ is.update(rootkey,ec,pcb);
+
+ }
+
+ /**
+ * Init the process service.
+ *
+ */
+ public void init(){
+ ctxPersistent = null;
+ is.init();
+ }
+
+ // this is for the in memory case only
+ public IContextService getTransientContextService() throws ContextServiceException {
+ if ( ctxNonPersistent == null ) {
+ BPEProperties props = new BPEProperties();
+ ctxNonPersistent = ContextServiceFactory.createContextService(props,us,
+ ContextTypeEnum.TRANSIENT);
+ }
+
+ return ctxNonPersistent;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ReturnMessageLocatorHolder.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ReturnMessageLocatorHolder.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ReturnMessageLocatorHolder.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ReturnMessageLocatorHolder.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,169 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on Jul 28, 2003
+ *
+ */
+package org.apache.ode.engine;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.ode.definition.IPMDLocator;
+import org.apache.ode.definition.IPMDLocatorHolder;
+import org.apache.ode.definition.service.DefinitionServiceException;
+import org.apache.ode.interaction.IInvocation;
+import org.apache.ode.interaction.builders.IInteractionBuilder;
+import org.apache.ode.scope.service.ScopePath;
+
+/**
+ * @author charper
+ * A locator holder to build a return message from.
+ */
+public class ReturnMessageLocatorHolder implements IPMDLocatorHolder {
+
+ private HashMap locators = new HashMap();
+ private String processID;
+ private String rootProcessID;
+ private ScopePath scopePath;
+ private String faultName;
+ private String faultNS;
+ private Collection corrlSets;
+
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.definition.service.IPMDLocatorHolder#getLocator(java.lang.String)
+ */
+ public IPMDLocator getLocator(String name) {
+ return (IPMDLocator)locators.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.definition.service.IPMDLocatorHolder#createLocator(java.lang.String, java.lang.String, java.lang.String, int, boolean, boolean)
+ */
+ public IPMDLocator createLocator(
+ String name,
+ String path,
+ IInvocation query,
+ IInteractionBuilder builder,
+ int type,
+ boolean forOutput,
+ boolean contentious)
+ throws DefinitionServiceException {
+ // we don't want to create locators in this case
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.definition.service.IPMDLocatorHolder#addLocator(java.lang.String, org.apache.ode.definition.service.IPMDLocator)
+ */
+ public IPMDLocator addLocator(String name, IPMDLocator locatorObj) {
+ locators.put(name,locatorObj);
+ return locatorObj;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.definition.service.IPMDLocatorHolder#getLocators()
+ */
+ public Iterator getLocators() {
+ return locators.values().iterator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.definition.service.IPMDLocatorHolder#getLocatorSize()
+ */
+ public int getLocatorSize() {
+ return locators.size();
+ }
+
+ /**
+ * @return
+ */
+ public String getProcessID() {
+ return processID;
+ }
+
+ /**
+ * @param string
+ */
+ public void setProcessID(String string) {
+ processID = string;
+ }
+
+ /**
+ * @return
+ */
+ public String getRootProcessID() {
+ return rootProcessID;
+ }
+
+ /**
+ * @param string
+ */
+ public void setRootProcessID(String string) {
+ rootProcessID = string;
+ }
+
+ /**
+ * @return Returns the scopePath.
+ */
+ public ScopePath getScopePath() {
+ return scopePath;
+ }
+ /**
+ * @param scopePath The scopePath to set.
+ */
+ public void setScopePath(ScopePath scopePath) {
+ this.scopePath = scopePath;
+ }
+ /**
+ * @return Returns the faultName.
+ */
+ public String getFaultName() {
+ return faultName;
+ }
+ /**
+ * @param faultName The faultName to set.
+ */
+ public void setFaultName(String faultName) {
+ this.faultName = faultName;
+ }
+ /**
+ * @return Returns the faultNS.
+ */
+ public String getFaultNS() {
+ return faultNS;
+ }
+ /**
+ * @param faultNS The faultNS to set.
+ */
+ public void setFaultNS(String faultNS) {
+ this.faultNS = faultNS;
+ }
+ /**
+ * @return Returns the corrlSets.
+ */
+ public Collection getCorrlSets() {
+ return corrlSets;
+ }
+ /**
+ * @param corrlSets The corrlSets to set.
+ */
+ public void setCorrlSets(Collection corrlSets) {
+ this.corrlSets = corrlSets;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ScopeEnum.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ScopeEnum.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ScopeEnum.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/ScopeEnum.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+//import java.util.logging.Logger;
+
+/** An enumeration of possible process scope.
+ * <P>
+ * INSTANCE,ALLSTARTEDINSTANCES */
+public class ScopeEnum
+{
+// private static Logger logger =
+// Logger.getLogger(ScopeEnum.class.getName());
+ private java.lang.String value;
+ private static final java.lang.String INSTANCE_VALUE = "INSTANCE";
+ private static final java.lang.String ALL_STARTED_VALUE = "ALL_STARTED";
+ private static final java.lang.String ALL_PAUSED_VALUE = "ALL_PAUSED";
+
+ private ScopeEnum()
+ {
+ // Prevent non-class create
+ }
+
+ /** @param value */
+ private ScopeEnum(java.lang.String value)
+ {
+ this.value = value;
+ }
+
+ public static final ScopeEnum INSTANCE = new ScopeEnum(INSTANCE_VALUE);
+ public static final ScopeEnum ALL_STARTED = new ScopeEnum(ALL_STARTED_VALUE);
+ public static final ScopeEnum ALL_PAUSED = new ScopeEnum(ALL_PAUSED_VALUE);
+
+ public java.lang.String getValue()
+ {
+ return value;
+ }
+
+ /** Because this object will be used over a remote interface the default implementation based on object reference will be over written. */
+ public int hashCode()
+ {
+ return value.hashCode();
+ }
+
+ /** Because this object will be used over a remote interface the default implementation based on object reference will be over written.
+ *
+ * @param obj */
+ public boolean equals(Object obj)
+ {
+ if ( obj instanceof ScopeEnum ) {
+ return value.equals(((ScopeEnum)obj).value);
+ }
+ return false;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/StateEnum.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/StateEnum.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/StateEnum.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/engine/StateEnum.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.engine;
+
+import java.io.Serializable;
+//import java.util.logging.Logger;
+
+/** An enumeration of the possible process states:
+ * <P>
+ * UNSTARTED,STARTED,PAUSED,FINISHED,TERMINATED */
+public class StateEnum implements Serializable
+{
+ static final long serialVersionUID = -4611739077212611477L;
+
+// private static Logger logger =
+// Logger.getLogger(StateEnum.class.getName());
+ private java.lang.String stringValue;
+ private int intValue;
+ private static final java.lang.String STARTED_VALUE = "STARTED";
+ private static final java.lang.String UNSTARTED_VALUE = "UNSTARTED";
+ private static final java.lang.String PAUSED_VALUE = "PAUSED";
+ private static final java.lang.String FINISHED_VALUE = "FINISHED";
+ private static final java.lang.String TERMINATED_VALUE = "TERMINATED";
+ private static final java.lang.String RUNNING_VALUE = "RUNNING";
+
+ private static final int STARTED_INT = 1;
+ private static final int UNSTARTED_INT = 2;
+ private static final int PAUSED_INT = 3;
+ private static final int FINISHED_INT = 4;
+ private static final int TERMINATED_INT = 5;
+ private static final int RUNNING_INT = 6;
+
+ private StateEnum()
+ {
+ // Prevent non-class create
+ }
+
+ /** @param oldStateEnum */
+ private StateEnum(java.lang.String stateString, int stateInt)
+ {
+ this.stringValue = stateString;
+ this.intValue = stateInt;
+ }
+
+ public static final StateEnum STARTED = new StateEnum(STARTED_VALUE,STARTED_INT);
+ public static final StateEnum UNSTARTED = new StateEnum(UNSTARTED_VALUE,UNSTARTED_INT);
+ public static final StateEnum PAUSED = new StateEnum(PAUSED_VALUE,PAUSED_INT);
+ public static final StateEnum FINISHED = new StateEnum(FINISHED_VALUE,FINISHED_INT);
+ public static final StateEnum TERMINATED = new StateEnum(TERMINATED_VALUE,TERMINATED_INT);
+ public static final StateEnum RUNNING = new StateEnum(RUNNING_VALUE,RUNNING_INT);
+
+ public java.lang.String getStringValue()
+ {
+ return stringValue;
+ }
+
+ public int getIntValue()
+ {
+ return intValue;
+ }
+
+ /** Because this object will be used over a remote interface the default implementation based on object reference will be over written. */
+ public int hashCode()
+ {
+ return intValue;
+ }
+
+ /** Because this object will be used over a remote interface the default implementation based on object reference will be over written.
+ *
+ * @param obj */
+ public boolean equals(Object obj)
+ {
+ if ( obj instanceof StateEnum ) {
+ return intValue == ((StateEnum)obj).intValue;
+ }
+ return false;
+ }
+
+ public static StateEnum getState(String state) {
+ if ( state.equals(STARTED_VALUE) ) return STARTED;
+ if ( state.equals(UNSTARTED_VALUE) ) return UNSTARTED;
+ if ( state.equals(PAUSED_VALUE) ) return PAUSED;
+ if ( state.equals(FINISHED_VALUE) ) return FINISHED;
+ if ( state.equals(TERMINATED_VALUE) ) return TERMINATED;
+ if ( state.equals(RUNNING_VALUE) ) return RUNNING;
+ return null;
+ }
+
+ public static StateEnum getState(int state) {
+ switch ( state ) {
+ case STARTED_INT: return STARTED;
+ case UNSTARTED_INT: return UNSTARTED;
+ case PAUSED_INT: return PAUSED;
+ case FINISHED_INT: return FINISHED;
+ case TERMINATED_INT: return TERMINATED;
+ case RUNNING_INT: return RUNNING;
+ default: return null;
+ }
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/EngineStateException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/EngineStateException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/EngineStateException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/EngineStateException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on May 4, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.enginestate.service;
+
+import org.apache.ode.util.BPException;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class EngineStateException extends BPException {
+
+ static final long serialVersionUID = -7769143508689559451L;
+
+
+ /**
+ * @param message_id
+ * @param msgParams
+ */
+ public EngineStateException(String message_id, Object[] msgParams) {
+ super(message_id, msgParams);
+ }
+
+ /**
+ * @param message_id
+ * @param msgParams
+ * @param cause
+ */
+ public EngineStateException(
+ String message_id,
+ Object[] msgParams,
+ Throwable cause) {
+ super(message_id, msgParams, cause);
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/EngineStateFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/EngineStateFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/EngineStateFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/EngineStateFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on May 4, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.enginestate.service;
+
+import java.util.HashMap;
+
+import javax.ejb.CreateException;
+import javax.ejb.FinderException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.ode.bped.EventDirectorFactory;
+import org.apache.ode.engine.CleanUpEnum;
+import org.apache.ode.engine.StateEnum;
+import org.apache.ode.enginestate.service.managed.EngineStateLocal;
+import org.apache.ode.enginestate.service.managed.EngineStateLocalHome;
+import org.apache.ode.enginestate.service.unmanaged.EngineStateImImpl;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class EngineStateFactory {
+
+ private static HashMap engineStates;
+ public static String ENGINE_NAME= "BPE_ENGINE";
+
+ public static IEngineState getEngineState(String engienName) throws BPException
+ {
+ boolean remote = true;
+
+ String val = System.getProperty(EventDirectorFactory.JNFI);
+ if (val != null && val.compareTo(EventDirectorFactory.IMJNFI) == 0) {
+ remote = false;
+ }
+
+ if (remote)
+ {
+ // the ejb engine name is hard coded
+ return getEjbEngineState(ENGINE_NAME);
+ }
+ else
+ {
+ return getInMemoryEngineState(engienName);
+ }
+ }
+
+ private static IEngineState getEjbEngineState(String engienName) throws BPException {
+
+ try {
+ InitialContext init = new InitialContext();
+ EngineStateLocalHome eslh = (EngineStateLocalHome)init
+ .lookup("java:comp/env/theEngineState");
+
+ EngineStateLocal esl = null;
+ try {
+ esl = eslh.findByPrimaryKey(engienName);
+ } catch ( FinderException fe ) {
+ try {
+ // TODO get the correct state and cleanup
+ esl = eslh.create(engienName,
+ StateEnum.STARTED.getStringValue(),
+ CleanUpEnum.CLEANUP.getStringValue());
+ } catch (CreateException e) {
+ throw new EngineStateException("NATIVE_EXCEPTION",new Object[] {"CreateException"},e);
+ }
+ }
+ return esl;
+ } catch (NamingException e) {
+ throw new EngineStateException("NATIVE_EXCEPTION",new Object[] {"NamingException"},e);
+ }
+
+ }
+
+ private static IEngineState getInMemoryEngineState(String engienName) {
+ if ( engineStates == null ) {
+ engineStates = new HashMap();
+ }
+ EngineStateImImpl es = (EngineStateImImpl)engineStates.get(engienName);
+ if ( es == null ) {
+ // TODO get the corect state and cleanup
+ es = new EngineStateImImpl(engienName,
+ StateEnum.STARTED.getStringValue(),
+ CleanUpEnum.CLEANUP.getStringValue());
+ engineStates.put(engienName,es);
+ }
+ return es;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/IEngineState.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/IEngineState.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/IEngineState.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/IEngineState.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on May 5, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.enginestate.service;
+
+import org.apache.ode.util.BPException;
+
+/**
+ * This is the root node of the data model for the engine.
+ */
+public interface IEngineState {
+
+ /**
+ * ID of the engine.
+ * @return id
+ * @throws BPException
+ */
+ public String getId()throws BPException;
+ /**
+ * ID of the engine.
+ * @param id
+ * @throws BPException
+ */
+ public void setId(String id)throws BPException;
+ /**
+ * State of the engine.
+ * @return state
+ * @throws BPException
+ */
+ public String getState()throws BPException;
+ /**
+ * State of the engine.
+ * @param state
+ * @throws BPException
+ */
+ public void setState(String state)throws BPException;
+ /**
+ * Process clean up instructions for the engine.
+ * @return
+ * @throws BPException
+ */
+ public String getCleanUp()throws BPException;
+ /**
+ * Process clean up instructions for the engine.
+ * @param cleanUp
+ * @throws BPException
+ */
+ public void setCleanUp(String cleanUp)throws BPException;
+
+ }
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/managed/EngineStateCoarseBean.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/managed/EngineStateCoarseBean.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/managed/EngineStateCoarseBean.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/managed/EngineStateCoarseBean.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.enginestate.service.managed;
+import java.rmi.RemoteException;
+//import java.util.logging.Logger;
+
+import javax.ejb.CreateException;
+import javax.ejb.EntityBean;
+import javax.ejb.EntityContext;
+
+import org.apache.ode.enginestate.service.IEngineState;
+import org.apache.ode.util.BPException;
+
+/**
+ * This bean stores engine state.
+ * @ejb.bean
+ * type="CMP"
+ * name="EngineStateCoarse"
+ * jndi-name="BPE/EngineStateCoarse"
+ * local-jndi-name="BPE/EngineStateCoarse"
+ * view-type="local"
+ * cmp-version="2.x"
+ * schema="EngineState"
+ * primkey-field="id"
+ * @ejb.persistence
+ * table-name="BPE_EngineStateCoarse"
+ * @jboss.persistence
+ * create-table="true"
+ * @ejb.pk
+ * class="java.lang.String"
+ * @ejb.home
+ * local-class="org.apache.ode.enginestate.service.managed.EngineStateLocalHome"
+ * @ejb.interface
+ * local-class="org.apache.ode.enginestate.service.managed.EngineStateLocal"
+ * local-extends="javax.ejb.EJBLocalObject, org.apache.ode.enginestate.service.IEngineState"
+ * @ejb.transaction type="Mandatory"
+ *
+*/
+
+public abstract class EngineStateCoarseBean implements EntityBean, IEngineState {
+
+ static final long serialVersionUID = 8252569185918394346L;
+
+// private static Logger logger =
+// Logger.getLogger(EngineStateCoarseBean.class.getName());
+
+ /**
+ * @return
+ * @ejb.interface-method
+ * @ejb.pk-field
+ * @ejb.persistence column-name="id"
+ */
+ public abstract String getId();
+
+
+ /**
+ * @param string
+ * @ejb.interface-method
+ */
+ public abstract void setId(String id);
+
+ /**
+ * @return
+ * @ejb.interface-method
+ * @ejb.persistence column-name="state"
+ */
+ public abstract String getState() throws BPException;
+
+
+ /**
+ * @param string
+ * @ejb.interface-method
+ */
+ public abstract void setState(String state) throws BPException;
+
+ /**
+ * @return
+ * @ejb.interface-method
+ * @ejb.persistence column-name="cleanup"
+ */
+ public abstract String getCleanUp() throws BPException;
+
+
+ /**
+ * @param string
+ * @ejb.interface-method
+ */
+ public abstract void setCleanUp(String cleanUp) throws BPException;
+
+ /**
+ * @ejb.create-method
+ */
+ public String ejbCreate(
+ String id,
+ String state,
+ String cleanUp)
+ throws CreateException {
+
+ //Called by container after setEntityContext
+ // Use the abstract methods to set parameters
+ setId(id);
+ try {
+ setState(state);
+ setCleanUp(cleanUp);
+ } catch (BPException e) {
+ throw new CreateException(e.getMessage());
+ }
+
+ return id;
+ }
+
+ public void ejbActivate() {
+ //Called by container before bean
+ //swapped into memory
+ }
+
+ public void ejbPostCreate(
+ String id,
+ String state,
+ String cleanUp) {
+ //Called by container after ejbCreate
+ }
+
+ public void ejbPassivate() {
+ //Called by container before
+ //bean swapped into storage
+ }
+
+ public void ejbRemove() throws RemoteException {
+ //Called by container before
+ //data removed from database
+ }
+
+ public void ejbLoad() {
+ //Called by container to
+ //refresh entity bean's state
+ }
+
+ public void ejbStore() {
+ //Called by container to save
+ //bean's state to database
+ }
+
+ public void setEntityContext(EntityContext ctx) {
+ //Called by container to set bean context
+ }
+
+ public void unsetEntityContext() {
+ //Called by container to unset bean context
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/unmanaged/EngineStateImImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/unmanaged/EngineStateImImpl.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/unmanaged/EngineStateImImpl.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/enginestate/service/unmanaged/EngineStateImImpl.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+/*
+ * Created on May 6, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.enginestate.service.unmanaged;
+
+import java.io.Serializable;
+
+import org.apache.ode.enginestate.service.IEngineState;
+import org.apache.ode.util.BPException;
+
+/**
+ *
+ */
+public class EngineStateImImpl implements IEngineState, Serializable {
+
+ static final long serialVersionUID = -8772462229106834324L;
+
+ private String state;
+ private String id;
+ private String cleanUp;
+
+ public EngineStateImImpl(String name, String state, String cleanUp) {
+ this.state = state;
+ this.cleanUp = cleanUp;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.enginestate.service.IEngineState#getState()
+ */
+ public String getState() throws BPException {
+ return this.state;
+ }
+ /* (non-Javadoc)
+ * @see org.apache.ode.enginestate.service.IEngineState#setState(java.lang.String)
+ */
+ public void setState(String state) throws BPException {
+ this.state = state;
+ }
+ /* (non-Javadoc)
+ * @see org.apache.ode.enginestate.service.IEngineState#getCleanUp()
+ */
+ public String getCleanUp() throws BPException {
+ return this.cleanUp;
+ }
+ /* (non-Javadoc)
+ * @see org.apache.ode.enginestate.service.IEngineState#setCleanUp(java.lang.String)
+ */
+ public void setCleanUp(String cleanUp) throws BPException {
+ this.cleanUp = cleanUp;
+ }
+ /* (non-Javadoc)
+ * @see org.apache.ode.enginestate.service.IEngineState#getId()
+ */
+ public String getId() throws BPException {
+ return id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.enginestate.service.IEngineState#setId(java.lang.String)
+ */
+ public void setId(String id) throws BPException {
+ this.id = id;
+
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/BPELStaticKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/BPELStaticKey.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/BPELStaticKey.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/BPELStaticKey.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.event;
+
+import java.io.Serializable;
+
+public class BPELStaticKey implements IStaticKey, Serializable
+{
+
+ static final long serialVersionUID = 973479868700222517L;
+
+ private String m_targetNamespace = null;
+ private String m_portType = null;
+ private String m_operation = null;
+
+ public void setTargetNamespace( String iTargetNamespace )
+ {
+ m_targetNamespace = iTargetNamespace;
+ }
+
+ public String getTargetNamespace()
+ {
+ return m_targetNamespace;
+ }
+
+ public void setPortType( String iPortType )
+ {
+ m_portType = iPortType;
+ }
+
+ public String getPortType()
+ {
+ return m_portType;
+ }
+
+ public void setOperation( String iOperation )
+ {
+ m_operation = iOperation;
+ }
+
+ public String getOperation()
+ {
+ return m_operation;
+ }
+
+ public String toString()
+ {
+ if ( m_targetNamespace != null )
+ {
+ return m_targetNamespace + m_portType + m_operation;
+ }
+ else
+ {
+ return m_portType + m_operation;
+ }
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if ( obj == this ) return true;
+ if ( obj instanceof BPELStaticKey )
+ if ( m_targetNamespace.equals(((BPELStaticKey)obj).m_targetNamespace) &&
+ m_portType.equals(((BPELStaticKey)obj).m_portType) &&
+ m_operation.equals(((BPELStaticKey)obj).m_operation)) return true;
+ return false;
+ }
+
+}
+
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/EventException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/EventException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/EventException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/EventException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.event;
+
+import org.apache.ode.util.BPException;
+
+/**
+ * @author waterman
+ *
+ */
+public class EventException extends BPException {
+
+ static final long serialVersionUID = -626106133464986849L;
+
+ /**
+ * @param message_id
+ * @param msgParams
+ */
+ public EventException(String message_id, Object[] msgParams) {
+ super(message_id, msgParams);
+ }
+
+ /**
+ * @param message_id
+ * @param msgParams
+ * @param cause
+ */
+ public EventException(
+ String message_id,
+ Object[] msgParams,
+ Throwable cause) {
+ super(message_id, msgParams, cause);
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/EventParseException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/EventParseException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/EventParseException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/EventParseException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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.apache.ode.event;
+public class EventParseException extends EventException
+{
+
+ static final long serialVersionUID = -7960267305684690914L;
+
+ public EventParseException() {
+ super("EVENT_PARSE_EXCEPTION",null);
+ }
+
+}