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:05:47 UTC
svn commit: r381686 [30/40] - in /incubator/ode/scratch/bpe: ./ bpelTests/
bpelTests/probeService/ bpelTests/test1/ bpelTests/test10/
bpelTests/test12/ bpelTests/test13/ bpelTests/test14/ bpelTests/test15/
bpelTests/test16/ bpelTests/test17/ bpelTests/...
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessService.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessService.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ProcessService.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,292 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/***********************************************************************
+ * Module: ProcessService.java
+ * Author: waterman
+ * Purpose: Defines the Class ProcessService
+ ***********************************************************************/
+
+package com.sybase.bpe.engine;
+
+import java.util.HashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.context.base.ContextServiceException;
+import com.sybase.bpe.context.base.ContextServiceFactory;
+import com.sybase.bpe.context.base.ContextTypeEnum;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.instance.service.InstanceService;
+import com.sybase.bpe.instance.service.InstanceServiceException;
+import com.sybase.bpe.instance.service.InstanceServiceFactory;
+import com.sybase.bpe.scope.service.IScopeService;
+import com.sybase.bpe.scope.service.ScopeServiceException;
+import com.sybase.bpe.scope.service.ScopeServiceFactory;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.uuid.UUIDService;
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/engine/ReturnMessageLocatorHolder.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ReturnMessageLocatorHolder.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ReturnMessageLocatorHolder.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ReturnMessageLocatorHolder.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,175 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jul 28, 2003
+ *
+ */
+package com.sybase.bpe.engine;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.IPMDLocatorHolder;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.interaction.IInvocation;
+import com.sybase.bpe.interaction.builders.IInteractionBuilder;
+import com.sybase.bpe.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 com.sybase.bpe.definition.service.IPMDLocatorHolder#getLocator(java.lang.String)
+ */
+ public IPMDLocator getLocator(String name) {
+ return (IPMDLocator)locators.get(name);
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.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 com.sybase.bpe.definition.service.IPMDLocatorHolder#addLocator(java.lang.String, com.sybase.bpe.definition.service.IPMDLocator)
+ */
+ public IPMDLocator addLocator(String name, IPMDLocator locatorObj) {
+ locators.put(name,locatorObj);
+ return locatorObj;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.definition.service.IPMDLocatorHolder#getLocators()
+ */
+ public Iterator getLocators() {
+ return locators.values().iterator();
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/engine/ScopeEnum.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ScopeEnum.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ScopeEnum.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/ScopeEnum.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,75 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/engine/StateEnum.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/StateEnum.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/StateEnum.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/engine/StateEnum.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,120 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/enginestate/service/EngineStateException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/EngineStateException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/EngineStateException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/EngineStateException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,62 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on May 4, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sybase.bpe.enginestate.service;
+
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/enginestate/service/EngineStateFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/EngineStateFactory.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/EngineStateFactory.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/EngineStateFactory.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,117 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on May 4, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sybase.bpe.enginestate.service;
+
+import java.util.HashMap;
+
+import javax.ejb.CreateException;
+import javax.ejb.FinderException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import com.sybase.bpe.bped.EventDirectorFactory;
+import com.sybase.bpe.engine.CleanUpEnum;
+import com.sybase.bpe.engine.StateEnum;
+import com.sybase.bpe.enginestate.service.managed.EngineStateLocal;
+import com.sybase.bpe.enginestate.service.managed.EngineStateLocalHome;
+import com.sybase.bpe.enginestate.service.unmanaged.EngineStateImImpl;
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/enginestate/service/IEngineState.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/IEngineState.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/IEngineState.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/IEngineState.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,74 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on May 5, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sybase.bpe.enginestate.service;
+
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/enginestate/service/managed/EngineStateCoarseBean.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/managed/EngineStateCoarseBean.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/managed/EngineStateCoarseBean.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/managed/EngineStateCoarseBean.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,171 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.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 com.sybase.bpe.enginestate.service.IEngineState;
+import com.sybase.bpe.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="com.sybase.bpe.enginestate.service.managed.EngineStateLocalHome"
+ * @ejb.interface
+ * local-class="com.sybase.bpe.enginestate.service.managed.EngineStateLocal"
+ * local-extends="javax.ejb.EJBLocalObject, com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/enginestate/service/unmanaged/EngineStateImImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/unmanaged/EngineStateImImpl.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/unmanaged/EngineStateImImpl.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/enginestate/service/unmanaged/EngineStateImImpl.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,89 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on May 6, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sybase.bpe.enginestate.service.unmanaged;
+
+import java.io.Serializable;
+
+import com.sybase.bpe.enginestate.service.IEngineState;
+import com.sybase.bpe.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 com.sybase.bpe.enginestate.service.IEngineState#getState()
+ */
+ public String getState() throws BPException {
+ return this.state;
+ }
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.enginestate.service.IEngineState#setState(java.lang.String)
+ */
+ public void setState(String state) throws BPException {
+ this.state = state;
+ }
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.enginestate.service.IEngineState#getCleanUp()
+ */
+ public String getCleanUp() throws BPException {
+ return this.cleanUp;
+ }
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.enginestate.service.IEngineState#setCleanUp(java.lang.String)
+ */
+ public void setCleanUp(String cleanUp) throws BPException {
+ this.cleanUp = cleanUp;
+ }
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.enginestate.service.IEngineState#getId()
+ */
+ public String getId() throws BPException {
+ return id;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.enginestate.service.IEngineState#setId(java.lang.String)
+ */
+ public void setId(String id) throws BPException {
+ this.id = id;
+
+ }
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/BPELStaticKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/BPELStaticKey.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/BPELStaticKey.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/BPELStaticKey.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,89 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/event/EventException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/EventException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/EventException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/EventException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,54 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/event/EventParseException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/EventParseException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/EventParseException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/EventParseException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,32 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+public class EventParseException extends EventException
+{
+
+ static final long serialVersionUID = -7960267305684690914L;
+
+ public EventParseException() {
+ super("EVENT_PARSE_EXCEPTION",null);
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/Fault.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/Fault.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/Fault.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/Fault.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,107 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import java.io.Serializable;
+import java.util.Iterator;
+
+import com.sybase.bpe.scope.service.BPRuntimeException;
+
+public class Fault implements Serializable
+{
+ static final long serialVersionUID = 1485346850018321499L;
+
+ private String m_faultActor;
+ private String m_faultCode;
+ private String m_faultString;
+ private Exception m_faultException;
+
+ public void setFaultActor( String iActor )
+ {
+ m_faultActor = iActor;
+ }
+
+ public void setFaultCode( String iFaultCode )
+ {
+ m_faultCode = iFaultCode;
+ }
+
+ public void setFaultString( String iFaultString )
+ {
+ m_faultString = iFaultString;
+ }
+
+ public String getFaultActor()
+ {
+ return m_faultActor;
+ }
+
+ public String getFaultCode()
+ {
+ return m_faultCode;
+ }
+
+ public String getFaultString()
+ {
+ return m_faultString;
+ }
+
+ public Exception getFaultException()
+ {
+ return m_faultException;
+ }
+
+ public void setFaultException( Exception e )
+ {
+ m_faultException = e;
+ }
+
+ public String toString(){
+ StringBuffer buf =
+ new StringBuffer("Fault Actor:" + m_faultActor + " " +
+ "Fault Code:" + m_faultCode + " " +
+ "Fault String:" + m_faultString + "\n");
+ if ( this.getFaultException() instanceof BPRuntimeException ) {
+ Iterator it = ((BPRuntimeException)this.getFaultException()).getMessageParts().keySet().iterator();
+ while (it.hasNext()) {
+ String name = it.next().toString();
+ try {
+ buf.append(
+ "FaultPart \""
+ + name
+ + "\" value: "
+ + ((BPRuntimeException)this.getFaultException()).getMessageParts().get(name).toString()
+ + "\n");
+ } catch (Exception e) {
+ buf.append(
+ "Part \"" + name + "\" value: " + e.getLocalizedMessage());
+ }
+ }
+
+ }
+ return buf.toString();
+
+// return "Fault Actor:" + m_faultActor + " " +
+// "Fault Code:" + m_faultCode + " " +
+// "Fault String:" + m_faultString;
+ }
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IEvent.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IEvent.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IEvent.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,39 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/***********************************************************************
+ * Module: Event.java
+ * Author: waterman
+ * Purpose: Defines the Interface Event
+ ***********************************************************************/
+
+package com.sybase.bpe.event;
+
+
+
+
+/**
+ * Identifies the Event type
+ */
+
+public interface IEvent
+{
+};
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IInternalEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IInternalEvent.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IInternalEvent.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IInternalEvent.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,49 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import java.util.Properties;
+
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.engine.ProcessInstance;
+import com.sybase.bpe.util.BPException;
+
+public interface IInternalEvent extends IEvent
+{
+ /** initialize the attributes of the event
+ *
+ * @param properties */
+ void init(java.util.Properties attributes) throws EventException;
+
+ /** apply the Event attributes to a process instance
+ *
+ * @param a process instance interface
+ */
+ void apply(ProcessInstance processInstance, IEvaluationContext ec, IProcessCallBack pcb) throws BPException;
+
+ /** Get Event attributes
+ *
+ */
+ Properties getAttributes();
+}
+
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IReadableMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IReadableMessage.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IReadableMessage.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IReadableMessage.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,38 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import java.util.Map;
+
+import com.sybase.bpe.interaction.IInteraction;
+import com.sybase.bpe.util.BPException;
+
+public interface IReadableMessage
+{
+ public IInteraction getPart( String iPartName )
+ throws BPException;
+
+ public IInteraction getHeaderElement( String iName )
+ throws BPException;
+
+ public Map getParts();
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IRequestMessageEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IRequestMessageEvent.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IRequestMessageEvent.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IRequestMessageEvent.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,33 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import com.sybase.bpe.util.BPException;
+
+public interface IRequestMessageEvent extends IReadableMessage, IEvent
+{
+ public IStaticKey getStaticKey() throws BPException;
+
+ public IResponseMessage createResponseMessage() throws BPException;
+
+}
+
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IResponseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IResponseMessage.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IResponseMessage.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IResponseMessage.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,34 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import com.sybase.bpe.util.BPException;
+
+public interface IResponseMessage extends IReadableMessage, IWriteableMessage
+{
+
+ public void setFault( Fault iFault )
+ throws BPException;
+
+ public Fault getFault()
+ throws BPException;
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IStaticKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IStaticKey.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IStaticKey.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IStaticKey.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,27 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+public interface IStaticKey
+{
+ public String toString();
+}
+
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ITimerEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ITimerEvent.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ITimerEvent.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ITimerEvent.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,61 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Aug 25, 2003
+ *
+ */
+package com.sybase.bpe.event;
+
+import java.io.Serializable;
+
+/**
+ * @author charper
+ *
+ */
+public interface ITimerEvent extends IEvent, Serializable {
+
+ static final long serialVersionUID = -561820493272137190L;
+
+ /**
+ * @return
+ */
+ public String getRootId();
+
+ /**
+ *
+ * @return
+ */
+ public String getProcId();
+
+ /**
+ *
+ * @return
+ */
+ public String getDefId();
+
+ /**
+ *
+ * @return
+ */
+ public String getRootDefId();
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IWriteableMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IWriteableMessage.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IWriteableMessage.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/IWriteableMessage.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,40 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import com.sybase.bpe.interaction.IInteraction;
+import com.sybase.bpe.util.BPException;
+
+public interface IWriteableMessage
+{
+ public void setPart(String iPartName,
+ IInteraction iInteraction) throws BPException;
+
+ public IInteraction removePart( String iPartName )
+ throws BPException;
+
+ public void setHeaderElement( String iName, IInteraction iHeaderInteraction )
+ throws BPException;
+
+ public IInteraction removeHeaderElement( String iName )
+ throws BPException;
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/LoadDefinitionEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/LoadDefinitionEvent.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/LoadDefinitionEvent.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/LoadDefinitionEvent.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,85 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jul 17, 2003
+ */
+package com.sybase.bpe.event;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+import com.sybase.bpe.engine.ProcessInstance;
+
+/**
+ * @author charper
+ */
+public class LoadDefinitionEvent implements IEvent, Serializable {
+
+ static final long serialVersionUID = 2176921731100421958L;
+
+ private String defname;
+
+ public LoadDefinitionEvent(){
+ }
+
+ public LoadDefinitionEvent(String defname){
+ this.defname = defname;
+ }
+
+ /**
+ * The defintion name to load.
+ * @param defname
+ */
+ public void setDefinitionName(String defname){
+ this.defname = defname;
+ }
+ /**
+ * The defintion name to load.
+ * @return
+ */
+ public String getDefinitionName(){
+ return defname;
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.event.Event#init(java.util.Properties)
+ */
+ public void init(Properties attributes) throws EventException {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.event.Event#apply(com.sybase.bpe.engine.ProcessInstance)
+ */
+ public void apply(ProcessInstance processInstance) throws EventException {
+
+ }
+
+ /* (non-Javadoc)
+ * @see com.sybase.bpe.event.Event#getAttributes()
+ */
+ public Properties getAttributes() {
+ return null;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/NoResponseAllowedException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/NoResponseAllowedException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/NoResponseAllowedException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/NoResponseAllowedException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,32 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+public class NoResponseAllowedException extends EventException
+{
+
+ static final long serialVersionUID = -6843790847686908236L;
+
+ public NoResponseAllowedException() {
+ super("NO_RESPONSE_EXCEPTION",null);
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/OperationMissingException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/OperationMissingException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/OperationMissingException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/OperationMissingException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,32 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+public class OperationMissingException extends EventException
+{
+
+ static final long serialVersionUID = 3790333343494608842L;
+
+ public OperationMissingException() {
+ super("NO_OPERATION_EXCEPTION",null);
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ProcessInstanceEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ProcessInstanceEvent.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ProcessInstanceEvent.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ProcessInstanceEvent.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,99 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+import com.sybase.bpe.engine.IEvaluationContext;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.engine.ProcessInstance;
+import com.sybase.bpe.util.BPException;
+
+
+/**
+ * @author waterman
+ *
+ */
+public class ProcessInstanceEvent implements IInternalEvent, Serializable {
+
+ static final long serialVersionUID = 6822192926494036924L;
+
+ public static String PROCESS_KEY_NAME = "ProcessKey";
+ private String pKey;
+ private String rootKey;
+
+ public ProcessInstanceEvent(String rootKey, String pKey) {
+ this.pKey = pKey;
+ this.rootKey = rootKey;
+ }
+
+ public ProcessInstanceEvent() {
+ pKey = null;
+ }
+
+ /**
+ * @see com.sybase.bpe.event.Event#init(Properties)
+ */
+ public void init(Properties attributes) throws EventException {
+ Object obj = attributes.get(PROCESS_KEY_NAME);
+
+ if ( obj instanceof String ) {
+ pKey = (String)obj;
+ } else {
+ throw new EventException("INVALID_PROCESS_ID",new Object[] {pKey});
+ }
+ }
+
+ /**
+ * @see com.sybase.bpe.event.Event#apply(IPMIProcess_Mutate)
+ */
+ public void apply(ProcessInstance processInstance, IEvaluationContext ec, IProcessCallBack pcb) throws BPException {
+
+ if ( pKey != null && !pKey.equals(processInstance.getKey()) ) {
+ throw new EventException("INVALID_PROCESS_ID",new Object[] {pKey});
+ }
+
+ }
+
+ /**
+ * @see com.sybase.bpe.event.Event#getAttributes()
+ */
+ public Properties getAttributes() {
+ Properties retVal = new Properties();
+ retVal.put(PROCESS_KEY_NAME,pKey);
+ return retVal;
+ }
+
+ /** get the instance key
+ */
+ public String getProcessInstanceKey() {
+ return pKey;
+ }
+
+ /** get the instance key
+ */
+ public String getRootProcessInstanceKey() {
+ return rootKey;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ReadOnlyEventException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ReadOnlyEventException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ReadOnlyEventException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/ReadOnlyEventException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,30 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+public class ReadOnlyEventException extends EventException
+{
+ static final long serialVersionUID = 6969059915601172358L;
+
+ public ReadOnlyEventException() {
+ super("READ_ONLY_EVENT",null);
+ }
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SOAPRequestMessageEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SOAPRequestMessageEvent.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SOAPRequestMessageEvent.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SOAPRequestMessageEvent.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,274 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.SOAPEnvelope;
+
+import com.sybase.bpe.interaction.IInteraction;
+import com.sybase.bpe.interaction.InteractionFactory;
+import com.sybase.bpe.util.BPException;
+
+public class SOAPRequestMessageEvent implements IRequestMessageEvent
+{
+
+ private SOAPEnvelope m_responseEnvelope;
+ private SOAPEnvelope m_requestEnvelope;
+
+ transient private InteractionFactory m_interactionFactory;
+ transient private IInteraction m_headerInteraction;
+
+// transient private SOAPResponseMessage m_soapResponseMessage;
+ transient private BPELStaticKey m_staticKey;
+ transient private IResponseMessage m_responseMessage;
+ transient private boolean m_envelopeParsed;
+
+ transient private HashMap m_messagePartInteractionMap;
+ transient private String m_portType;
+ transient private String m_operation;
+// transient private String m_targetNamespace;
+ transient private HashMap m_headerElementInteractionMap;
+
+ public SOAPRequestMessageEvent(
+ SOAPEnvelope iRequestEnvelope,
+ SOAPEnvelope iResponseEnvelope)
+ {
+ m_requestEnvelope = iRequestEnvelope;
+ m_responseEnvelope = iResponseEnvelope;
+ }
+
+ public Map getParts()
+ {
+ return m_messagePartInteractionMap;
+ }
+
+ private void setMessagePartInteraction(
+ String iPartName,
+ IInteraction iMessagePartInteraction)
+ {
+ if (m_messagePartInteractionMap == null)
+ {
+ m_messagePartInteractionMap = new HashMap();
+ }
+
+ m_messagePartInteractionMap.put(iPartName,
+ iMessagePartInteraction);
+ }
+
+ private void setHeaderElementInteraction( String iHeaderElementName,
+ IInteraction iHeaderElementInteraction )
+ {
+ if ( m_headerElementInteractionMap == null )
+ {
+ m_headerElementInteractionMap = new HashMap();
+ }
+
+ m_headerElementInteractionMap.put(iHeaderElementName,
+ iHeaderElementInteraction);
+ }
+
+ private IInteraction getMessagePartInteraction(String iPartName)
+ {
+ return (IInteraction) m_messagePartInteractionMap.get(iPartName);
+ }
+
+ private String getPortType() throws BPException
+ {
+ if (m_portType == null)
+ {
+ marshalFromSOAPEnvelope();
+ }
+ return m_portType;
+ }
+
+ private void setPortType(String iPortType)
+ {
+ m_portType = iPortType;
+ }
+
+ private String getOperation() throws BPException
+ {
+ if (m_operation == null)
+ {
+ marshalFromSOAPEnvelope();
+ }
+ return m_operation;
+ }
+
+ private void setOperation(String iOperation)
+ {
+ m_operation = iOperation;
+ }
+
+ private void marshalFromSOAPEnvelope() throws BPException
+ {
+ try
+ {
+ if (m_envelopeParsed == false)
+ {
+ marshalFromSOAPBody(m_requestEnvelope.getBody());
+ marshalFromSOAPHeader(m_requestEnvelope.getHeader());
+ m_envelopeParsed = true;
+ }
+ } catch (SOAPException soapException)
+ {
+ throw new EventException("NATIVE_EXCEPTION",new Object[] {"SOAPException"},soapException);
+ }
+ }
+
+ private void marshalFromSOAPBody(SOAPBody iBody) throws BPException
+ {
+ Iterator iterator = iBody.getChildElements();
+ SOAPElement operationElement = null;
+
+ if (iterator.hasNext())
+ {
+ operationElement = (SOAPElement) (iterator.next());
+ setOperation(operationElement.getElementName().getLocalName());
+ } else
+ {
+ throw new OperationMissingException();
+ }
+
+ iterator = operationElement.getChildElements();
+ SOAPElement partElement = null;
+
+ while (iterator.hasNext())
+ {
+ partElement = (SOAPElement) iterator.next();
+ marshalFromMessagePart(partElement);
+ }
+ }
+
+ private void marshalFromSOAPHeader(SOAPHeader iHeader) throws BPException
+ {
+ Iterator iterator = iHeader.getChildElements();
+ while( iterator.hasNext() )
+ {
+ SOAPElement headerElement =
+ (SOAPElement)iterator.next();
+ String localName =
+ headerElement.getElementName().getLocalName();
+ if ( localName.equals("To"))
+ {
+ setPortType( headerElement.getValue() );
+ }
+
+ IInteraction headerElementInteraction =
+ this.createInteraction(headerElement);
+ setHeaderElementInteraction(localName,
+ headerElementInteraction);
+
+ }
+ m_headerInteraction = createInteraction(iHeader);
+ }
+
+ private void marshalFromMessagePart(SOAPElement iMessagePart)
+ throws BPException
+ {
+ String partName = iMessagePart.getElementName().getLocalName();
+ IInteraction interaction = createInteraction(iMessagePart);
+ setMessagePartInteraction(partName, interaction);
+ }
+
+ private IInteraction createInteraction(SOAPElement iElement)
+ throws BPException
+ {
+ MessageElement messageElement = (MessageElement) (iElement);
+ String elementString = messageElement.toString();
+ IInteraction interactionObject =
+ getInteractionFactory().createXMLInteraction(
+ elementString.getBytes());
+
+ return interactionObject;
+
+ }
+
+ private InteractionFactory getInteractionFactory()
+ {
+ if (m_interactionFactory == null)
+ {
+ m_interactionFactory = InteractionFactory.newInstance();
+ }
+
+ return m_interactionFactory;
+ }
+
+ public IStaticKey getStaticKey() throws BPException
+ {
+ m_staticKey = new BPELStaticKey();
+ m_staticKey.setOperation(getOperation());
+ m_staticKey.setPortType(getPortType());
+
+ return m_staticKey;
+ }
+
+ public SOAPEnvelope getSOAPRequestEnvelope()
+ {
+ return m_requestEnvelope;
+ }
+
+ public IInteraction getPart(String iPartName) throws BPException
+ {
+ return getMessagePartInteraction( iPartName );
+ }
+
+ public IInteraction getHeader()
+ {
+ return m_headerInteraction;
+ }
+
+ public IInteraction getHeaderElement( String iHeaderElementName )
+ {
+ IInteraction returnInteraction = ( IInteraction )
+ ( m_headerElementInteractionMap.get( iHeaderElementName ) );
+
+ return returnInteraction;
+ }
+
+ public IResponseMessage createResponseMessage()
+ throws BPException
+ {
+ if (m_responseEnvelope == null)
+ {
+ throw new NoResponseAllowedException();
+ }
+
+ if (m_responseMessage == null)
+ {
+ m_responseMessage =
+ new SOAPResponseMessage(m_responseEnvelope);
+ }
+
+ return m_responseMessage;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SOAPResponseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SOAPResponseMessage.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SOAPResponseMessage.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SOAPResponseMessage.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,172 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import java.util.Iterator;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPHeader;
+
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.axis.message.SOAPHeaderElement;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.sybase.bpe.interaction.IInteraction;
+import com.sybase.bpe.interaction.XMLInteractionObject;
+import com.sybase.bpe.util.BPException;
+
+public class SOAPResponseMessage extends SimpleResponseMessage
+{
+
+ static final long serialVersionUID = 1417189686562681151L;
+
+// private IInteraction m_headerInteraction;
+ private SOAPEnvelope m_responseEnvelope;
+ private boolean m_isDirty;
+
+
+ public SOAPResponseMessage( SOAPEnvelope iResponseEnvelope )
+ {
+ m_responseEnvelope = iResponseEnvelope;
+ }
+
+ public SOAPEnvelope getResponseEnvelope() throws BPException
+ {
+ marshalToEnvelope();
+ return m_responseEnvelope;
+ }
+
+ private void scrubEnvelope() throws BPException
+ {
+ try
+ {
+ scrubBody( m_responseEnvelope.getBody());
+ scrubHeader( m_responseEnvelope.getHeader() );
+ }
+ catch( Exception e )
+ {
+ throw new EventException("NATIVE_EXCEPTION",new Object[] {"SOAPException"},e);
+ }
+ }
+
+ private void scrubBody(SOAPBody iBody) throws BPException
+ {
+ iBody.detachNode();
+ }
+
+ private void scrubHeader(SOAPHeader iHeader) throws BPException
+ {
+ iHeader.detachNode();
+ }
+
+ public void setHeaderElement(String iName,
+ IInteraction iHeaderInteraction)
+ throws BPException
+ {
+ m_isDirty = true;
+ if ( !( iHeaderInteraction instanceof XMLInteractionObject ) )
+ {
+ throw new UnsupportedInteractionTypeException();
+ }
+ super.setHeaderElement( iName, iHeaderInteraction );
+ }
+
+ public void setPart(String iPartName,
+ IInteraction iInteraction)
+ throws BPException
+ {
+ m_isDirty = true;
+ if ( !( iInteraction instanceof XMLInteractionObject ) )
+ {
+ throw new UnsupportedInteractionTypeException();
+ }
+
+ super.setPart( iPartName, iInteraction );
+ }
+
+ public void marshalToEnvelope() throws BPException
+ {
+ try
+ {
+ if (m_isDirty)
+ {
+ scrubEnvelope();
+ Iterator iterator = getPartMap().values().iterator();
+ SOAPBody body = m_responseEnvelope.addBody();
+
+ // Marshal the body parts into the envelope.
+ while (iterator.hasNext())
+ {
+ XMLInteractionObject interaction =
+ (XMLInteractionObject) (iterator.next());
+
+ Document document = interaction.getDocument();
+
+ SOAPBodyElement se = new SOAPBodyElement(
+ document.getDocumentElement() );
+
+ body.addChildElement( se );
+ }
+
+ // Marshal the header into the envelope.
+ if ( hasHeaders())
+ {
+ SOAPHeader header = m_responseEnvelope.addHeader();
+ iterator = getHeaderMap().values().iterator();
+ while( iterator.hasNext() )
+ {
+ XMLInteractionObject headerInteraction
+ = ( XMLInteractionObject )( iterator.next() );
+
+ Document headerDocument = headerInteraction.getDocument();
+ Element headerElement = headerDocument.getDocumentElement();
+
+ SOAPHeaderElement she = new SOAPHeaderElement(
+ headerElement);
+
+ header.addChildElement( she );
+ }
+ }
+
+ // Marshal the fault into the SOAP envelope
+ Fault fault = getFault();
+ if ( fault != null )
+ {
+ SOAPFault soapFault = body.addFault();
+ soapFault.setFaultActor( fault.getFaultActor() );
+ soapFault.setFaultCode( fault.getFaultCode() );
+ soapFault.setFaultString( fault.getFaultString() );
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new EventException("NATIVE_EXCEPTION",new Object[] {"Exception"},e);
+ }
+ }
+
+
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SimpleMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SimpleMessage.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SimpleMessage.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/event/SimpleMessage.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,103 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.event;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.sybase.bpe.interaction.IInteraction;
+import com.sybase.bpe.util.BPException;
+
+public abstract class SimpleMessage implements IReadableMessage, IWriteableMessage, Serializable
+{
+
+ static final long serialVersionUID = 8129807586314512296L;
+
+
+ private HashMap m_partMap;
+ private HashMap m_headerMap;
+
+ public void setPart(String iPartName,
+ IInteraction iInteraction)
+ throws BPException
+ {
+ getPartMap().put( iPartName, iInteraction );
+ }
+
+ public Map getParts()
+ {
+ return getPartMap();
+ }
+
+ protected HashMap getPartMap()
+ {
+ if ( m_partMap == null)
+ {
+ m_partMap = new HashMap();
+ }
+ return m_partMap;
+ }
+
+ protected HashMap getHeaderMap()
+ {
+ if ( m_headerMap == null )
+ {
+ m_headerMap = new HashMap();
+ }
+ return m_headerMap;
+ }
+
+ protected boolean hasHeaders()
+ {
+ return ( m_headerMap != null );
+ }
+
+ public void setHeaderElement(String iName,
+ IInteraction iHeaderInteraction)
+ throws BPException
+ {
+
+ getHeaderMap().put( iName, iHeaderInteraction );
+ }
+
+
+ public IInteraction getPart(String iPartName) throws BPException
+ {
+ return ( IInteraction ) ( getPartMap().get( iPartName ) );
+ }
+
+ public IInteraction getHeaderElement(String iName) throws BPException
+ {
+ return ( IInteraction ) ( getHeaderMap().get( iName ) );
+ }
+
+ public IInteraction removePart(String iPartName) throws BPException
+ {
+ return ( IInteraction ) ( getPartMap().remove( iPartName ));
+ }
+
+ public IInteraction removeHeaderElement(String iName) throws BPException
+ {
+ return ( IInteraction ) ( getHeaderMap().get( iName ) );
+ }
+}