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 [23/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/definition/serialimpl/PMDLocator_SerialImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDLocator_SerialImpl.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDLocator_SerialImpl.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDLocator_SerialImpl.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,199 @@
+/*
+* 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.definition.serialimpl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Properties;
+//import java.util.logging.Logger;
+
+import com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.interaction.IInvocation;
+import com.sybase.bpe.interaction.builders.IInteractionBuilder;
+
+/**
+ * @author waterman
+ *
+ * The in-memory implementation of IPMDContainer
+ * 
+ */
+public class PMDLocator_SerialImpl implements IPMDLocator, Serializable{
+	
+    static final long serialVersionUID = 1645636091619324193L;
+    
+//	private static Logger logger = 
+//		Logger.getLogger(PMDLocator_SerialImpl.class.getName());
+	
+	private String path;
+	private IInvocation query;
+	private IInteractionBuilder intBuilder;
+	private int type;
+	private boolean contentious;
+	private boolean forOutput;
+	private boolean forInput;
+	private String name;
+	private Properties props;
+	private boolean isAbsolute;
+	private ArrayList ALpath;
+
+   PMDLocator_SerialImpl(String name, String path,IInvocation query, IInteractionBuilder builder, int type,
+	boolean forOutput, boolean contentious ) throws DefinitionServiceException {
+
+	this.name = name;
+	//this.path = path;
+	setPath(path);
+	this.query = query;
+	this.type = type;
+	this.forOutput = forOutput;
+	this.forInput = !forOutput;
+	this.contentious = contentious;
+	this.intBuilder = builder;
+	props = new Properties();
+  	
+   }
+   
+   public PMDLocator_SerialImpl() {
+		
+   }
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDContainer_Mutate#addProperty(String, String)
+	 */
+	public void addProperty(String name, String value)
+		throws DefinitionServiceException {
+			props.setProperty(name,value);
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDContainer#getContainerName()
+	 */
+	public String getPath() {
+		return path;
+	}
+	public void setPath(String path){
+		this.path = path;
+		int startIndx = 0;
+		
+		ALpath = new ArrayList();
+		String [] pathArray = path.split("/");
+		
+		if ( path.startsWith("/") ) {
+			isAbsolute = true;
+			startIndx = 1;
+		} else {
+			isAbsolute = false;
+		}
+		
+		for ( int i = startIndx; i < pathArray.length ; i++ ){
+			ALpath.add(pathArray[i]);
+		}
+	}
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDContainer#getPartName()
+	 */
+	public IInvocation getQuery() {
+		return query;
+	}
+	public void setQuery(IInvocation query) {
+		this.query = query;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDContainer#getProperties()
+	 */
+	public Properties getProperties() {
+		
+		return props;
+	}
+	public void setProperties (Properties p){
+		props = p;
+	}
+	
+	public int getType() {
+		return type;
+	}
+	public void setType(int type) {
+		this.type = type;
+	}
+	
+	public boolean getContentious() {
+		return contentious;
+	}
+	
+	public void setContentious(boolean contentious) {
+		this.contentious = contentious;
+	}
+	
+	public String getName(){
+		return this.name;
+	}
+	
+	public void setName(String name){
+		this.name = name;
+	}
+	
+	public boolean getForOutput(){
+		return this.forOutput;
+	}
+	
+	public boolean getForInput() {
+		return this.forInput;
+	}
+	
+	public void setForOutput(boolean forOutput){
+		this.forOutput = forOutput;
+		if ( !forInput ) {
+			forInput = !forOutput;
+		}
+	}
+	
+	public void setForInput(boolean forInput) {
+		this.forInput = forInput;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDLocator#getInteractionBuilder()
+	 */
+	public IInteractionBuilder getInteractionBuilder() {
+		return intBuilder;
+	}
+	public void setInteractionBuilder(IInteractionBuilder builder) {
+		intBuilder = builder;
+	}
+	
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDLocator#isAbsolute()
+	 */
+	public boolean isAbsolute() {
+		return isAbsolute;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDLocator#getArrayListPath()
+	 */
+	public ArrayList getArrayListPath() {
+		return ALpath;
+	}
+	
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDOperation_SerialImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDOperation_SerialImpl.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDOperation_SerialImpl.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDOperation_SerialImpl.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,163 @@
+/*
+* 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 22, 2003
+ *
+ */
+package com.sybase.bpe.definition.serialimpl;
+
+import java.io.Serializable;
+
+import com.sybase.bpe.definition.IPMDCorrelation;
+import com.sybase.bpe.definition.IPMDOperation;
+import com.sybase.bpe.event.IStaticKey;
+
+/**
+ * @author charper
+ *
+ */
+public class PMDOperation_SerialImpl implements IPMDOperation, Serializable {
+	
+    static final long serialVersionUID = 3842424938795408906L;
+	
+	private IStaticKey key;
+	private IPMDCorrelation correlation;
+	private boolean instanceCreating;
+	private String rootDefId;
+	private String operationId;
+	private String defId;
+	
+	public PMDOperation_SerialImpl(){}
+	
+	public PMDOperation_SerialImpl(IStaticKey key, IPMDCorrelation correlation,
+		boolean instanceCreating, String rootDefId, String defId, String operationId){
+		this.correlation = correlation;
+		this.key = key;
+		this.instanceCreating = instanceCreating;
+		this.rootDefId = rootDefId;
+		this.operationId = operationId;
+		this.defId = defId;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDOperation#getCorrelation()
+	 */
+	public IPMDCorrelation getCorrelation() {
+		return correlation;
+	}
+
+	/**
+	 * @return
+	 */
+	public IStaticKey getKey() {
+		return key;
+	}
+
+	/**
+	 * @param correlation
+	 */
+	public void setCorrelation(IPMDCorrelation correlation) {
+		this.correlation = correlation;
+	}
+
+	/**
+	 * @param key
+	 */
+	public void setKey(IStaticKey key) {
+		this.key = key;
+	}
+
+	/**
+	 * @return
+	 */
+	public boolean isInstanceCreating() {
+		return instanceCreating;
+	}
+
+	/**
+	 * @param b
+	 */
+	public void setInstanceCreating(boolean b) {
+		instanceCreating = b;
+	}
+
+	/**
+	 * @return
+	 */
+	public String getRootDefId() {
+		return rootDefId;
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setRootDefId(String string) {
+		rootDefId = string;
+	}
+
+	/**
+	 * @return
+	 */
+	public String getOperationId() {
+		return operationId;
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setOperationId(String string) {
+		operationId = string;
+	}
+
+	/**
+	 * @return
+	 */
+	public String getDefId() {
+		return defId;
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setDefId(String string) {
+		defId = string;
+	}
+	
+	
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	public boolean equals(Object arg0) {
+		if ( arg0 instanceof PMDOperation_SerialImpl ) {
+			PMDOperation_SerialImpl op = (PMDOperation_SerialImpl)arg0;
+			if ( op.getOperationId().equals(this.getOperationId())) {
+				return true;
+			} else {
+				return false;
+			}
+		} else {
+			return false;
+		}
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDProcess_SerialImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDProcess_SerialImpl.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDProcess_SerialImpl.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDProcess_SerialImpl.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,235 @@
+/*
+* 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.definition.serialimpl;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Vector;
+//import java.util.logging.Logger;
+
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.engine.ProcessDefinitionKey;
+import com.sybase.bpe.uuid.UUIDService;
+
+/**
+ * @author waterman
+ *
+ * The in-memory implementation of PMDProcess
+ * 
+ */
+public class PMDProcess_SerialImpl implements IPMDProcess, Serializable {
+	
+    static final long serialVersionUID = 5087682783809845033L;
+	
+//	private static Logger logger = 
+//		Logger.getLogger(PMDProcess_SerialImpl.class.getName());
+	
+	private ProcessDefinitionKey key;
+	private PMDRoot_SerialImpl root;
+	private String label;
+	private String description;
+	private Vector changeConditions;
+	private Vector observers;
+	private PMDChangeCondition_SerialImpl preCondition;
+	transient private UUIDService us;
+
+
+	public PMDProcess_SerialImpl(java.lang.String label, PMDRoot_SerialImpl root, UUIDService us) throws DefinitionServiceException
+   {
+	  key = new ProcessDefinitionKey(us);
+      
+	  this.root = root;
+	  this.label = label;
+	  this.us = us;
+	  changeConditions = new Vector();
+	  observers = new Vector();
+ 	  
+	  // Every time a process is created it needs to be added to the indexing map
+	  root.getProcessIndex().put(key,this);
+   }
+   
+   public PMDProcess_SerialImpl() {
+	 
+   }
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDProcess_Mutate#getKey()
+	 */
+	public ProcessDefinitionKey getKey() {
+		return key;
+	}
+	public void setKey (ProcessDefinitionKey key) {
+		this.key = key;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDProcess_Mutate#setDescription(String)
+	 */
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	/**
+	 * @see com.sybase.bpe.definition.IPMDProcess#getDescription()
+	 */
+	public String getDescription() {
+		return description;
+	}
+	
+
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDProcess_Mutate#createChangeCondition(String, String)
+	 */
+	public IPMDChangeCondition createChangeCondition(
+		String label,
+		String conditionalClass)
+		throws DefinitionServiceException {
+			
+		IPMDChangeCondition ret = new PMDChangeCondition_SerialImpl(label,conditionalClass,root);
+		changeConditions.add(ret);
+		
+		return ret;
+	}
+	
+	public void addChangeCondition(IPMDChangeCondition cc) {
+		changeConditions.add(cc);
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDProcess_Mutate#createPrecondition(String, String)
+	 */
+	public IPMDChangeCondition createPrecondition(
+		String label,
+		String conditionalClass)
+		throws DefinitionServiceException {
+			
+		preCondition = new PMDChangeCondition_SerialImpl(label,conditionalClass,root);
+		return preCondition;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDProcess_Mutate#addObserverProcessPC(IPMDProcess_Mutate)
+	 */
+	public void addObserverProcessPC(IPMDProcess process)
+		throws DefinitionServiceException {
+		
+		observers.add(process);
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDProcess_Mutate#createSubProcess(String, ProcessDefinitionKey)
+	 */
+	public IPMDProcess createSubProcess(String label)
+		throws DefinitionServiceException {
+			
+		IPMDProcess ret = new PMDProcess_SerialImpl(label,root,us);
+		observers.add(ret);
+		return ret;
+	}
+	
+	public IPMDProcess createUnLinkedProcess(String label)
+		throws DefinitionServiceException {
+			
+		return new PMDProcess_SerialImpl(label,root,us);
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDProcess_Mutate#getSubProcesses()
+	 */
+	public Collection getSubProcesses() throws DefinitionServiceException {
+		return observers;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDProcess#getLabel()
+	 */
+	public String getLabel() {
+		return label;
+	}
+	public void setLabel(String label) {
+		this.label = label;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDProcess#getVersion()
+	 */
+	public String getVersion() {
+		return null;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDProcess#getRootKey()
+	 */
+	public ProcessDefinitionKey getRootKey() {
+		return root.getProcess().getKey();
+	}
+	
+	public IPMDRoot getRoot() {
+		return root;
+	}
+	public void setRoot(IPMDRoot root) {
+		this.root = (PMDRoot_SerialImpl)root;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDProcess#getChangeConditions()
+	 */
+	public Iterator getChangeConditions() {
+		return changeConditions.iterator();
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDProcess#getPrecondition()
+	 */
+	public IPMDChangeCondition getPrecondition() {
+		return preCondition;
+	}
+	public void setPrecondition(IPMDChangeCondition preCond) {
+		preCondition = (PMDChangeCondition_SerialImpl)preCond;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDProcess#getObserverProcessPC()
+	 */
+	public Iterator getObserverProcessPC() {
+		return observers.iterator();
+	}
+	
+	public Vector getObserverCollection() {
+		return observers;
+	}
+	public void setObserverCollection(Vector v) {
+		observers = v;
+	}
+	
+	public Vector getCCCollection(){
+		return changeConditions;
+	}
+	public void setCCCollection(Vector v) {
+		changeConditions = v;
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDRoot_SerialImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDRoot_SerialImpl.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDRoot_SerialImpl.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/serialimpl/PMDRoot_SerialImpl.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,426 @@
+/*
+* 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.definition.serialimpl;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+//import java.util.logging.Logger;
+
+import com.sybase.bpe.action.external.IExternalAction;
+import com.sybase.bpe.definition.IPMDCorrelation;
+import com.sybase.bpe.definition.IPMDCorrelationSetDef;
+import com.sybase.bpe.definition.IPMDOperation;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.definition.service.unmanaged.DefinitionStateCache;
+import com.sybase.bpe.definition.service.unmanaged.DefinitionStateEnum;
+import com.sybase.bpe.engine.ProcessDefinitionKey;
+import com.sybase.bpe.event.IStaticKey;
+import com.sybase.bpe.uuid.UUIDService;
+
+/**
+ * @author waterman
+ *
+ * An in-memory implementation of IPMDRoot. 
+ * 
+ */
+public class PMDRoot_SerialImpl implements IPMDRoot, Serializable {
+
+    static final long serialVersionUID = -6876388314218052261L;
+    
+//	private static Logger logger = 
+//		Logger.getLogger(PMDRoot_SerialImpl.class.getName());
+
+	private ProcessDefinitionKey key;
+	private String label;
+	private String version;
+	private boolean state_type;
+	private boolean protectedInstantiation;
+	private String description;
+	protected PMDProcess_SerialImpl process;
+	transient protected UUIDService us;
+	private ArrayList instaceCreatingOperations;
+	private ArrayList metaNonInstanceCreatingOperations;
+	private ArrayList operations;
+	private HashMap operationHash;
+	private ArrayList correlationSetDefs;
+	private HashMap actionHash;
+	private DefinitionStateEnum state = DefinitionStateEnum.ACTIVE;
+	
+	private transient Hashtable definitions;
+	private transient Hashtable newDefinitions;
+	
+	private HashMap supportingDocs = new HashMap();
+	
+	// This hashmap is used as an index into the business process definition graph. 
+	private HashMap processIndex;
+
+	public PMDRoot_SerialImpl(
+		java.lang.String label,
+		java.lang.String version,
+		boolean stateless,
+		UUIDService us,
+		Hashtable definitions,
+		Hashtable newDefinitions)
+		throws DefinitionServiceException {
+
+		key = new ProcessDefinitionKey(us);
+
+		this.label = label;
+		this.version = version;
+		this.state_type = stateless;
+		this.us = us;
+		this.definitions = definitions;
+		this.newDefinitions = newDefinitions;
+		this.operations = new ArrayList();
+		processIndex = new HashMap();
+		this.operationHash = new HashMap();
+		this.correlationSetDefs = new ArrayList();
+		this.instaceCreatingOperations = new ArrayList();
+		this.metaNonInstanceCreatingOperations = new ArrayList();
+		this.actionHash = new HashMap();
+	}
+	
+	public PMDRoot_SerialImpl() {
+		this.operations = new ArrayList();
+		processIndex = new HashMap();
+		this.operationHash = new HashMap();
+		this.correlationSetDefs = new ArrayList();
+		this.instaceCreatingOperations = new ArrayList();
+		this.metaNonInstanceCreatingOperations = new ArrayList();
+		this.actionHash = new HashMap();
+	}
+
+
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDRoot_Mutate#getProcess()
+	 */
+	public IPMDProcess getProcess() {
+		return process;
+	}
+	public void setProcess(IPMDProcess process) {
+		this.process = (PMDProcess_SerialImpl)process;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDRoot_Mutate#createProcess(String, ProcessDefinitionKey)
+	 */
+	public IPMDProcess createProcess(String label)
+		throws DefinitionServiceException {
+			
+		process = new PMDProcess_SerialImpl(label,this,us);	
+		
+		// index the definitions via the root process key
+		definitions.put(process.getKey(),this);
+		newDefinitions.put(process.getKey(),this);
+		
+		return process;
+		
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDRoot#getKey()
+	 */
+	public ProcessDefinitionKey getKey() {
+
+		return key;
+
+	}
+	public void setKey (ProcessDefinitionKey key) {
+		this.key = key;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDRoot#getLabel()
+	 */
+	public String getLabel() {
+		return label;
+	}
+	public void setLabel(String label) {
+		this.label = label;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDRoot#getVersion()
+	 */
+	public String getVersion() {
+		return version;
+	}
+	public void setVersion(String version) {
+		this.version = version;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDRoot#getDescription()
+	 */
+	public String getDescription() {
+		return description;
+	}
+	/**
+	 * @see com.sybase.bpe.definition.service.IPMDRoot_Mutate#setDescription(String)
+	 */
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDRoot#getIsStateless()
+	 */
+	public boolean getIsStateless() {
+		return state_type;
+	}
+	public void setIsStateless(boolean state) {
+		state_type = state;
+	}
+	
+	/**
+	 * Get the process index collection. The process index collection allows searches for
+	 * PMDProcess instances based on DefinitionKeys.
+	 */
+	public HashMap getProcessIndex() {
+		return processIndex;
+	}
+	public void setProcessIndex(HashMap index) {
+		processIndex = index;
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDRoot#addSupportingDocument(java.lang.String, byte[])
+	 */
+	public void addSupportingDocument(String key, String supportDoc) {
+		supportingDocs.put(key,supportDoc);
+	}
+
+	/**
+	 * @see com.sybase.bpe.definition.IPMDRoot#getSupportingDocument(java.lang.String)
+	 */
+	public String getSupportingDocument(String key) {
+		return (String)supportingDocs.get(key);
+	}
+	
+	
+	public HashMap getSupportingDocuments() {
+		return supportingDocs;
+	}
+	
+
+	public void setSupportingDocuments(HashMap docs) {
+		supportingDocs = docs;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#addInstaceCreatingOperation(com.sybase.bpe.definition.service.IPMDOperation)
+	 */
+	public void addInstanceCreatingOperation(IPMDOperation op) {
+		this.instaceCreatingOperations.add(op);
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#createCorrelationSet(java.lang.String, java.util.ArrayList)
+	 */
+	public IPMDCorrelationSetDef createCorrelationSet(String name, ArrayList partQueries) {
+		PMDCorrelationSetDef_SerialImpl def = 
+			new PMDCorrelationSetDef_SerialImpl(name,partQueries);
+		this.correlationSetDefs.add(def);
+		return def;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#createCorrelation(java.lang.String)
+	 */
+	public IPMDCorrelation createCorrelation(String name) {
+		PMDCorrelation_SerialImpl cor = new PMDCorrelation_SerialImpl(name);
+		return cor;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#createOperation(com.sybase.bpe.event.IStaticKey, com.sybase.bpe.definition.service.IPMDCorrelation, boolean)
+	 */
+	public IPMDOperation createOperation(String operationId, IStaticKey key, 
+		IPMDCorrelation corrl, boolean instanceCreating, String defId) {
+		PMDOperation_SerialImpl op = 
+			new PMDOperation_SerialImpl(key,corrl,instanceCreating,this.getProcess().getKey().getValue(), defId,operationId);
+		this.operations.add(op);
+		this.operationHash.put(operationId,op);
+		return op;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#getInstaceCreatingOperations()
+	 */
+	public Collection getInstanceCreatingOperations() {
+		return this.instaceCreatingOperations;
+	}
+
+	/**
+	 * @return
+	 */
+	public ArrayList getCorrelationSetDefs() {
+		return correlationSetDefs;
+	}
+
+	/**
+	 * @return
+	 */
+	public ArrayList getOperations() {
+		return operations;
+	}
+
+	/**
+	 * @param list
+	 */
+	public void setCorrelationSetDefs(ArrayList list) {
+		correlationSetDefs = list;
+	}
+
+	/**
+	 * @param list
+	 */
+	public void setInstaceCreatingOperations(Collection list) {
+		instaceCreatingOperations = (ArrayList)list;
+	}
+
+	/**
+	 * @param list
+	 */
+	public void setOperations(ArrayList list) {
+		operations = list;
+		if ( list != null ) {
+			Iterator it = list.iterator();
+			while (it.hasNext()){
+				IPMDOperation op = (IPMDOperation)it.next();
+				this.operationHash.put(op.getOperationId(),op);
+			}
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#getOperation(java.lang.String)
+	 */
+	public IPMDOperation getOperation(String operationId) {
+		if ( operationHash.size() != operations.size() ) {
+			setOperations(operations);
+		}
+		return (IPMDOperation)operationHash.get(operationId);
+	}
+	
+	public IExternalAction getExternalAction(Object key) {
+		return (IExternalAction)actionHash.get(key);
+	}
+	public void putExternalAction(Object key, IExternalAction value) {
+		actionHash.put(key,value);
+	}
+	public void clearExternalAction() {
+		for ( Iterator itr = actionHash.values().iterator(); itr.hasNext();) {
+			IExternalAction iea = (IExternalAction)itr.next();
+			iea.release();
+		}
+		actionHash.clear();
+	}
+
+	private IPMDOperation createMetaNonInstOp(String operationId, IStaticKey key, IPMDCorrelation corrl, boolean instanceCreating, String defId) {
+		IPMDOperation op = createOperation(operationId, key, corrl, instanceCreating, defId);
+		metaNonInstanceCreatingOperations.add(op);
+		return op;
+	}
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#createOnMessageOperation(java.lang.String, com.sybase.bpe.event.IStaticKey, com.sybase.bpe.definition.service.IPMDCorrelation, boolean, java.lang.String)
+	 */
+	public IPMDOperation createOnMessageOperation(String operationId, IStaticKey key, IPMDCorrelation corrl, boolean instanceCreating, String defId) {
+		return createMetaNonInstOp(operationId, key, corrl, instanceCreating, defId);
+
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#createRecieveOperation(java.lang.String, com.sybase.bpe.event.IStaticKey, com.sybase.bpe.definition.service.IPMDCorrelation, boolean, java.lang.String)
+	 */
+	public IPMDOperation createRecieveOperation(String operationId, IStaticKey key, IPMDCorrelation corrl, boolean instanceCreating, String defId) {
+		return createMetaNonInstOp(operationId, key, corrl, instanceCreating, defId);
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#getMetaNonInstanceCreatingOperations()
+	 */
+	public Collection getMetaNonInstanceCreatingOperations() {
+		return this.metaNonInstanceCreatingOperations;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#setProtectedInstantiation(boolean)
+	 */
+	public void setProtectedInstantiation(boolean flag) {
+		protectedInstantiation = flag;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#getProtectedInstantiation()
+	 */
+	public boolean getProtectedInstantiation() {
+		return protectedInstantiation;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#getState()
+	 */
+	public int getState() 
+	{
+	    DefinitionStateEnum returnState = 
+	        DefinitionStateCache.getState(key);
+	    if ( returnState == null )
+	    {
+	        returnState = this.state;
+	        DefinitionStateCache.setState(key, returnState);
+	    }
+	    else
+	    {
+	        this.state = returnState;
+	    }
+		return returnState.intValue();
+	}
+	
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.IPMDRoot#setState(int)
+	 */
+	public void setState(int state) {
+		this.state = DefinitionStateEnum.getState(state);
+		DefinitionStateCache.setState(key, this.state);
+	}
+
+    public boolean isActive()
+    {
+        if ( getState() == DefinitionStateEnum.ACTIVE.intValue() )
+        {
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionNotFoundException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionNotFoundException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionNotFoundException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionNotFoundException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,41 @@
+/*
+* 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.definition.service;
+
+
+
+public class DefinitionNotFoundException extends DefinitionServiceException
+{
+	static final long serialVersionUID = 4768400437887752016L;
+    private String m_definitionID;
+    public DefinitionNotFoundException( String definitionID )
+    {
+        super(definitionID);
+        m_definitionID = definitionID;
+    }
+    
+    public String getRootDefinitionID( )
+    {
+        return m_definitionID;
+    }
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionService.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionService.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionService.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,132 @@
+/*
+* 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:  DefinitionService.java
+ * Author:  waterman
+ * Purpose: Defines the Interface DefinitionService
+ ***********************************************************************/
+
+package com.sybase.bpe.definition.service;
+
+import java.util.Collection;
+
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.engine.ProcessDefinitionKey;
+import com.sybase.bpe.event.IStaticKey;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.uuid.UUIDService;
+
+public interface DefinitionService
+{
+   /** Acquires a IPMDRoot implementation from the underlying metadata repository.
+     * 
+     * 
+     * @param definitionKey A unique identifier for a root process defintion. The identifier is unique within the underlying repository. */
+   IPMDRoot getRootDefinition(ProcessDefinitionKey definitionKey) throws BPException;
+   IPMDRoot getRootDefinition(String definitionKey) throws BPException;
+   /** Acquires a IPMDProcess implementation from the underlying metadata repository.
+     * 
+     * 
+     * @param processKey a unique identifier to a process definition. The identifier is unique to the underlying metadata repository. */
+   IPMDProcess getProcessDefintion(ProcessDefinitionKey processKey, ProcessDefinitionKey rootKey) throws BPException;
+   /** Generates a new definition identifier in the underlying metadata repository and returns a proxy to populate.
+     * <P>
+     * Is used by deployment tooling to populate the metadata repository. From the IPMDRoot_Mutate interface an entire business process definition graph can be populated.
+     * 
+     * @param label - the human readable tag is a required field within the metadata repository
+     * @param version - the root version is a required field in the metadata repository
+     * @param isStateless - the stateless identifier is a required field in the metadata repository
+     * @returns a IPMDRoot_Mutate implementation */
+   IPMDRoot createRootDefinition(java.lang.String label, java.lang.String version, boolean isStateless) throws BPException;
+
+	/** Initializes the definition service. The definition service requires a 
+	 * UUIDService to create business process definitions.
+	 * 
+	 * @param props - initialization properties
+	 * @param us - an implementation of the UUIDService
+	 */
+   void init(BPEProperties props, UUIDService us) throws BPException;
+   
+   /**
+    * This deletes the process definition tree under the rootkey.
+    * @param rootkey
+    */
+   void deleteDefinition(ProcessDefinitionKey rootkey) throws BPException ;
+   void deleteDefinition(String rootKey) throws BPException;
+   
+   /** Returns the collection of root definitions being managed by the definition
+	* service
+	*/
+   Collection getRootDefinitions() throws BPException;
+   
+   /**
+    * Loads a definition and creats it's registriations.  If the key in null all registrations are loaded.
+    * @param defname the defintion name
+    * @param cs the correlation service
+    */
+   public void loadDefintion(ProcessDefinitionKey procKey, IProcessCallBack pcb) throws BPException;
+   
+   /**
+    * Get the process instance creating correlation definitions.
+    * @param key
+    * @return
+    */
+   public Collection getCorrelations(IStaticKey key) throws BPException;
+   
+   /**
+    * Call to syncronize the defintion service with a persistent repository.
+    * @author charper
+    *
+    */
+   public void update() throws BPException;
+   
+   /**
+    * Return the BPEProperties object used at initialization
+    * 
+    * @return BPEProperties
+    */
+   public BPEProperties getBPEProperties();
+   
+   /**
+    * This will release all the external actions associated with this def service.
+    *
+    */
+   public void releaseExternalActions();
+   
+   /**
+    * Get a collection of all the non instance creating operations for
+    * a given static key.
+    * @param key
+    * @return
+    */
+   public Collection getNonInstanceCreatingOps(IStaticKey key)throws BPException;
+
+   public void deactivateDefinition(String id) throws BPException;
+   
+   public void activateDefinition(String id) throws BPException;
+   
+   public void prepare() throws BPException;
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionServiceException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionServiceException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionServiceException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionServiceException.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
+*/
+package com.sybase.bpe.definition.service;
+
+import com.sybase.bpe.util.BPException;
+
+/**
+ * @author waterman
+ *
+ * 
+ * 
+ */
+public class DefinitionServiceException extends BPException {
+	
+	static final long serialVersionUID = 7442610552746714334L;
+
+
+	/**
+	 * @param message_id
+	 * @param msgParams
+	 */
+	public DefinitionServiceException(String message_id, Object[] msgParams) {
+		super(message_id, msgParams);
+	}
+
+	/**
+	 * @param message_id
+	 * @param msgParams
+	 * @param cause
+	 */
+	public DefinitionServiceException(
+		String message_id,
+		Object[] msgParams,
+		Throwable cause) {
+		super(message_id, msgParams, cause);
+	}
+
+    public DefinitionServiceException(String message)
+    {
+        super(message);
+    }
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionServiceFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionServiceFactory.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionServiceFactory.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionServiceFactory.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,83 @@
+/*
+* 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.definition.service;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.uuid.UUIDService;
+import com.sybase.bpe.uuid.UUIDServiceException;
+
+/** Creates a DefinitionService implementation from a set of properties.
+  * <P>
+  * A DefinitionService is an abstraction over a metedata repository. A DefinitionService implementation may use EJB, JDO, OODMS technologies. The property list will contain repository specific connection paramaters. */
+public class DefinitionServiceFactory
+{
+	
+	private static Logger logger = 
+		Logger.getLogger(DefinitionServiceFactory.class.getName());
+	
+	public static final String TYPE = "TYPE";
+	public static final String TYPE_EJB = "EJB";	// Entity Bean Implementation
+	public static final String TYPE_IM = "IM";		// In Memory Implementation
+	public static final String TYPE_DEFAULT = TYPE_IM;
+
+	
+   /** Uses the input properties list to instantiate a DefinitionService implementation.
+	 * 
+	 * @param properties */
+   public static DefinitionService createDefinitionService(BPEProperties props, 
+	UUIDService us) throws DefinitionServiceException, UUIDServiceException
+   {
+	  
+	  DefinitionService ds = null;
+   
+		try {
+			// load the implementation
+			Class defClass = java.lang.Class.forName(props.getDefinitionServiceClass());
+			// try to instantiate the subclass
+			ds = (DefinitionService) defClass.newInstance();
+			ds.init(props,us);
+			
+		} catch (ClassNotFoundException e) {
+			DefinitionServiceException bpx = new DefinitionServiceException("CLASS_NOT_FOUND",new Object[] {props.getEventDirectorClass()});
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		} catch (InstantiationException e) {
+			DefinitionServiceException bpx = new DefinitionServiceException("NATIVE_EXCEPTION",new Object[] {"InstantiationException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		} catch (IllegalAccessException e) {
+			DefinitionServiceException bpx = new DefinitionServiceException("NATIVE_EXCEPTION",new Object[] {"IllegalAccessException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		} catch (BPException e) {
+			throw new DefinitionServiceException("BPE_EXCEPTION",new Object[]{},e);
+		}
+      
+	  return ds;
+	
+   }
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionURIResolver.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionURIResolver.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionURIResolver.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/DefinitionURIResolver.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,56 @@
+/*
+* 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:	Oct 31, 2003
+ * Project:		BPEELocal
+ * Package:		com.sybase.bpe.definition.service 
+ * Author:		waterman	
+ */
+package com.sybase.bpe.definition.service;
+
+import com.sybase.bpe.action.external.IURIResolver;
+import com.sybase.bpe.definition.IPMDRoot;
+
+/**
+ * 
+ * 
+ * @author waterman
+ */
+public class DefinitionURIResolver implements IURIResolver {
+
+	private IPMDRoot m_defRoot;
+
+	/**
+	 * 
+	 */
+	public DefinitionURIResolver(IPMDRoot defRoot) {
+		m_defRoot = defRoot;
+	}
+
+	/**
+	 * @see com.sybase.bpe.action.bpel.external.IURIResolver#getArtifact(java.lang.String)
+	 */
+	public Object getArtifact(String uri) {
+		return m_defRoot.getSupportingDocument(uri.toLowerCase());
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/managed/ProcessDefinitionBean.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/managed/ProcessDefinitionBean.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/managed/ProcessDefinitionBean.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/managed/ProcessDefinitionBean.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,362 @@
+/*
+* 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.definition.service.managed;
+
+import java.io.ByteArrayInputStream;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+import com.sybase.bpe.bped.EventDirectorFactory;
+import com.sybase.bpe.bped.IInternalEventDirector;
+import com.sybase.bpe.client.DescribedValue;
+import com.sybase.bpe.client.formats.INativeFormat;
+import com.sybase.bpe.client.spi.interaction.ISPIInteraction;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.service.DefinitionService;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.deployment.DefinitionKey;
+import com.sybase.bpe.deployment.ResourceDeployer;
+import com.sybase.bpe.deployment.bpel.BPELDeploy;
+import com.sybase.bpe.deployment.bpel.DeploymentException;
+import com.sybase.bpe.engine.ProcessDefinitionKey;
+import com.sybase.bpe.engine.ProcessService;
+import com.sybase.bpe.event.BPELStaticKey;
+import com.sybase.bpe.event.LoadDefinitionEvent;
+import com.sybase.bpe.event.SimpleRequestMessageEvent;
+import com.sybase.bpe.info.PackageInfo;
+import com.sybase.bpe.info.PackageInfoHome;
+import com.sybase.bpe.interaction.spiadapter.SPIAdapterInteraction;
+import com.sybase.bpe.interaction.spiimpl.MasterInteractionFactory;
+import com.sybase.bpe.lang.ResourceGetter;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.util.BPException;
+
+/**
+ * This bean can put and get definitions from the definition service.
+ * @ejb:bean 
+ *    type="Stateless"
+ *    name="ProcessDefinition"
+ *    jndi-name="BPE/ProcessDefinition"
+ *    view-type="both"
+ *    local-jndi-name="BPE/ProcessDefinitionLocal"
+ * @ejb.transaction type="Required"
+ * 
+ * @ejb.env-entry
+ * 	name="UUID_USE_CONNECTOR_KEY"
+ * 	value="false"
+ * 	type="java.lang.Boolean"
+ * @ejb.env-entry
+ * 	name="UUID_CLASS_KEY"
+ * 	value="com.sybase.bpe.uuid.EMFUUIDService"
+ * @ejb.env-entry
+ *  name="UUID_SIZE_KEY"
+ *  value="200"
+ *  type="java.lang.Integer"
+ * @ejb.env-entry
+ * 	name="DEF_CLASS_KEY"
+ * 	--value="com.sybase.bpe.definition.enginestateimpl.DefintionServiceEngineStateImpl"
+ * 	value="com.sybase.bpe.definition.serialimpl.DefinitionService_SerImpl"
+ * @ejb.env-entry
+ * 	name="DEF_PERSISTENT_KEY"
+ * 	value="TRUE"
+ * @ejb.env-entry
+ * 	name="INST_CLASS_KEY"
+ * 	--value="com.sybase.bpe.instance.service.enginestateimpl.InstanceServiceEngineStateImpl"
+ * 	value="com.sybase.bpe.instance.beanimpl.InstanceServicePersistentImpl"
+ * @ejb.env-entry
+ * 	name="INST_PERSISTENT_KEY"
+ * 	value="TRUE"
+ * @ejb.env-entry
+ * 	name="ED_CLASS_KEY"
+ * 	value="com.sybase.bpe.bped.managed.EventDirectorEjbImpl"
+ * @ejb.env-entry
+ * 	name="CORL_CLASS_KEY"
+ * 	--value="com.sybase.bpe.correlation.enginestateimpl.CorrelationServiceEngineStateImpl"
+ * 	value="com.sybase.bpe.correlation.managed.CorrelationServiceEjbImpl"
+ * @ejb.env-entry
+ * 	name="LOCK_CLASS_KEY"
+ * 	value="com.sybase.bpe.locking.DBLockingService"
+ * @ejb.env-entry
+ *    name="LOCK_HASH_BUCKETS_KEY"
+ *    value="1000"
+ * @ejb.env-entry
+ * 	name="CTX_CLASS_KEY"
+ * 	value="com.sybase.bpe.context.ejb.EJBContextService"
+ * @ejb.env-entry
+ * 	name="BPEL_COMPLIANT_KEY"
+ * 	value="TRUE"
+ * @ejb.env-entry
+ * 	name="DEF_SCHEMA_KEY"
+ * 	value="BPEL4WS.xsd"
+ * @ejb.env-entry
+ * 	name="SCOPE_CLASS_KEY"
+ * 	value="com.sybase.bpe.scope.service.impl.ScopeServiceImpl"
+ * 
+ * @ejb.ejb-ref
+ *      --ejb-name="EngineState"
+ *      ejb-name="EngineStateCoarse"
+ *  	view-type="local"
+ *  	ref-name="theEngineState"
+ * @ejb.ejb-ref
+ *      ejb-name="BPE_CMPBLOB"
+ *  	view-type="local"
+ *  	ref-name="theCMPObjectBean"
+ * @ejb.ejb-ref
+ *      ejb-name="RegistrationEntity"
+ *  	view-type="local"
+ *  	ref-name="registrationBean"
+ * @ejb.ejb-ref
+ *      ejb-name="PackageInfo"
+ *    view-type="remote"
+ *    ref-name="thePackageInfo"
+ * 
+ * @ejb.resource-ref
+ *  res-ref-name="jdbc/theDB"
+ *  res-type="javax.sql.DataSource"
+ *  res-auth="Container"
+ * @jboss.resource-ref
+ *      res-ref-name="jdbc/theDB"
+ *      jndi-name="java:/jdbc/JavaCache"
+ * @weblogic.resource-description
+ *      res-ref-name="jdbc/theDB"
+ *      jndi-name="jdbc/JavaCache"
+ * 
+ */
+public class ProcessDefinitionBean implements SessionBean {
+
+	static final long serialVersionUID = 8156751383598063747L;
+	
+	private static Logger logger =
+		Logger.getLogger(ProcessDefinitionBean.class.getName());
+//	private InitialContext context;
+
+	private DefinitionService ds;
+	private IInternalEventDirector ed;
+	
+	private static String[] BPETABLES= {"{0}_BPE_CMPBLOB",
+			"{0}_EngineStateCoarse","{0}_RegistrationEntity"}; 
+	private static String DROP_TABLE = "DROP TABLE ";
+	private static final String DATASOURCE = "java:comp/env/jdbc/theDB";
+	private static final String PKG_INFO = "java:comp/env/thePackageInfo";
+	private static final String TABLE_PREFIX = "TABLE_PREFIX";
+	
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public void undeploy() {
+		
+		Connection conn = null;
+		Statement stmt = null;
+		try {
+			
+			InitialContext context = new InitialContext();
+			
+			// get the table name
+			PackageInfoHome pih = 
+				(PackageInfoHome) context.lookup(PKG_INFO);
+			PackageInfo pi = pih.create();
+			String pkgName = pi.getProperties().getProperty(TABLE_PREFIX);
+			
+			
+			// get the data source, connectin and statement
+			DataSource datasource = (DataSource)context.lookup(DATASOURCE);
+			conn = datasource.getConnection();
+			stmt = conn.createStatement();
+			
+			// drop the BPE tables
+			for ( int i = 0; i < BPETABLES.length ; i++ ) {
+				String table = ResourceGetter.getFormatted(BPETABLES[i],
+					new Object[]{ pkgName });
+				stmt.execute(DROP_TABLE + table);
+			}	
+			
+		}catch ( Exception e ) {
+			throw new EJBException(e.getLocalizedMessage(),e);
+		} 			if (stmt != null) {
+			try {
+				stmt.close();
+			} catch (SQLException se) {
+			
+				// Don't really care if there is a problem closing
+			}
+			stmt = null;
+		}
+
+		if (conn != null) {
+			try {
+				conn.close();
+			} catch (SQLException se) {
+			
+				// Don't really care if there is a problem closing
+			}
+			conn = null;
+		}
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public void fireBootstrap() {
+		try {
+			BPELStaticKey bsk = new BPELStaticKey();
+			bsk.setTargetNamespace("urn:com:sybase:uo:deployService");
+			bsk.setPortType("deployServicePT");
+			bsk.setOperation("deploy");
+			// now create the message
+			SimpleRequestMessageEvent msgEvent = 
+				new SimpleRequestMessageEvent();
+			msgEvent.setStaticKey(bsk);
+			DescribedValue dv = new DescribedValue( "", INativeFormat.ATOMIC, new Properties() );
+			ISPIInteraction spi = MasterInteractionFactory.newInstance().createInteraction(dv);
+			SPIAdapterInteraction spiai = 
+			    new SPIAdapterInteraction( spi );
+	
+			msgEvent.setPart("location", spiai );
+
+			ed.sendEvent(msgEvent,true);
+		} catch ( Exception e ) {
+			throw new EJBException(e.getLocalizedMessage(),e);
+		}
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public Collection deploy(String resource, 
+			boolean validating, String schemaPath) {
+		try {
+			ResourceDeployer rd = new ResourceDeployer(new BPELDeploy(ds));
+			Collection keys = rd.deployResource(resource,validating,schemaPath);
+			// load all the defs			
+			Iterator it = keys.iterator();
+			while ( it.hasNext() ) {
+				
+				DefinitionKey defkey = (DefinitionKey)it.next();
+				IPMDRoot rootDef = ds.getRootDefinition(new ProcessDefinitionKey(defkey.getKey()));
+				// load the keys
+				ed.sendEvent(
+					new LoadDefinitionEvent(
+						rootDef.getProcess().getKey().getValue()),
+					true);
+			}
+			return keys;
+		} catch ( Exception e ) {
+			throw new EJBException(e.getLocalizedMessage(),e);
+		}
+	}
+
+	/**
+	 * @ejb:interface-method
+	 */
+	public Collection deploy(byte[] buff, boolean validating, String schemaPath) {
+		Collection keys = null ;
+		ByteArrayInputStream is = new ByteArrayInputStream(buff);
+		BPELDeploy deployer = new BPELDeploy(ds);
+		try {
+			// deploy
+			keys = deployer.deployJar(is, validating, null);
+
+			// load all the defs			
+			Iterator it = keys.iterator();
+			while ( it.hasNext() ) {
+				
+				DefinitionKey defkey = (DefinitionKey)it.next();
+				IPMDRoot rootDef = ds.getRootDefinition(new ProcessDefinitionKey(defkey.getKey()));
+				// load the keys
+				ed.sendEvent(
+					new LoadDefinitionEvent(
+						rootDef.getProcess().getKey().getValue()),
+					true);
+			}
+			
+
+		} catch (DeploymentException e) {
+			logger.log(Level.SEVERE,"",e);
+		} catch (DefinitionServiceException e) {
+			logger.log(Level.SEVERE,"",e);
+		} catch (BPException e) {
+			logger.log(Level.SEVERE,"",e);
+		}
+		return keys;
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public void removeDefinition(String id) {
+		try {
+			ds.deleteDefinition(new ProcessDefinitionKey(id));
+		} catch (BPException e) {
+			logger.log(Level.SEVERE,"",e);
+		}		
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public void setStateless(String id) {
+		try {
+			IPMDRoot root = ds.getRootDefinition(new ProcessDefinitionKey(id));
+			root.setIsStateless(true);	
+		} catch (BPException e) {
+			logger.log(Level.SEVERE,"",e);
+		}		
+	}
+	
+
+	public void ejbCreate(){
+
+	   try {
+	   	
+		InitialContext context = new InitialContext();
+		BPEProperties p = new BPEProperties(true,context);
+		ed = (IInternalEventDirector)EventDirectorFactory.createEventDirector(p);
+		ProcessService ps = ed.getProcessService();
+		ds = (DefinitionService)ps.getInstanceService().getDefinitionService();
+		
+
+	   } catch (Exception ex) {
+		   logger.log(Level.SEVERE,"",ex);
+	   }
+
+	}
+	public void setSessionContext(SessionContext 
+		  ctx) {}
+	public void ejbRemove() {ed.release();}
+	public void ejbActivate() {}
+	public void ejbPassivate() {}
+	public void ejbLoad() {}
+	public void ejbStore() {}
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionServiceBase.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionServiceBase.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionServiceBase.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionServiceBase.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,293 @@
+/*
+* 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.definition.service.unmanaged;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.definition.IPMDOperation;
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.serialimpl.PMDRoot_SerialImpl;
+import com.sybase.bpe.definition.service.DefinitionService;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.engine.ProcessDefinitionKey;
+import com.sybase.bpe.event.IStaticKey;
+import com.sybase.bpe.lang.ResourceGetter;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.uuid.UUIDService;
+
+
+
+public abstract class DefinitionServiceBase 
+  implements DefinitionService
+  
+{
+	private static Logger logger = 
+		Logger.getLogger(DefinitionServiceBase.class.getName());
+	private UUIDService uuidService;
+	private BPEProperties props;
+    protected HashMap defRegistrations = new HashMap();
+    protected HashMap metaNonInstanceCreatingOperations = new HashMap();
+    //  Holds PMDProcess_IMImpl instances where ProcessDefinitionKey is the hash key
+	private Hashtable definitions = new Hashtable();
+	private Hashtable newDefinitions = new Hashtable(); 
+	
+	public void init(BPEProperties props, UUIDService us)
+	{
+	    this.props = props;
+	    this.uuidService = us;
+	}
+	
+    // remove the instance creating operations and 
+    // meta non intance creating ops.
+    protected void deleteOperations(IPMDRoot root) throws BPException
+    {
+	   
+        Iterator it = root.getInstanceCreatingOperations().iterator();
+        while (it.hasNext())
+        {
+            IPMDOperation op = (IPMDOperation) it.next();
+            IStaticKey key = op.getKey();
+            ArrayList al = (ArrayList) defRegistrations.get(key.toString());
+            metaNonInstanceCreatingOperations.remove(key.toString());
+            al.remove(op);
+        }      
+    }
+    
+	public void deleteDefinition(ProcessDefinitionKey rootKey)
+            throws BPException
+    {
+        IPMDRoot root = getRootDefinition(rootKey);
+        deleteOperations(root);
+        root.clearExternalAction();
+        definitions.remove(rootKey);
+    }
+	
+	public void loadDefintion(ProcessDefinitionKey procKey, IProcessCallBack pcb)
+            throws BPException
+    {
+        IPMDRoot root = getRootDefinition(procKey);
+        Iterator it = root.getInstanceCreatingOperations().iterator();
+        while (it.hasNext())
+        {
+            IPMDOperation op = (IPMDOperation) it.next();
+            IStaticKey key = op.getKey();
+            ArrayList al = (ArrayList) defRegistrations.get(key.toString());
+            if (al == null)
+            {
+                al = new ArrayList();
+                defRegistrations.put(key.toString(), al);
+            }
+            al.add(op);
+        }
+        it = root.getMetaNonInstanceCreatingOperations().iterator();
+        while (it.hasNext())
+        {
+            IPMDOperation op = (IPMDOperation) it.next();
+            IStaticKey key = op.getKey();
+            ArrayList al = (ArrayList) metaNonInstanceCreatingOperations
+                    .get(key.toString());
+            if (al == null)
+            {
+                al = new ArrayList();
+                metaNonInstanceCreatingOperations.put(key.toString(), al);
+            }
+            al.add(op);
+        }
+    }
+	
+	/**
+     * @see com.sybase.bpe.definition.service.DefinitionService#getRootDefinition(java.lang.String)
+     */
+    public IPMDRoot getRootDefinition(String definitionKey) throws BPException
+    {
+        return getRootDefinition(new ProcessDefinitionKey(definitionKey));
+    }
+    
+	public IPMDRoot getRootDefinition(ProcessDefinitionKey definitionKey)
+            throws BPException
+    {
+        IPMDRoot root = (IPMDRoot) definitions.get(definitionKey);
+        return root;
+    }
+	
+	/**
+	 * @see com.sybase.bpe.definition.service.DefinitionService#getProcessDefintion(ProcessDefinitionKey)
+	 */
+	public IPMDProcess getProcessDefintion(ProcessDefinitionKey processKey, 
+	ProcessDefinitionKey rootKey)
+		throws BPException {
+			
+			IPMDProcess ret = null;
+			
+			// First find the definition root
+			PMDRoot_SerialImpl root = (PMDRoot_SerialImpl)getRootDefinition(rootKey);
+		
+			if ( root != null ) {
+				// get the process index from the root
+				HashMap hm = root.getProcessIndex();
+			
+				ret = (IPMDProcess)hm.get(processKey);
+			} 
+
+			
+			return ret;
+	}
+	
+	/**
+	 * @see com.sybase.bpe.definition.service.DefinitionService#createRootDefinition(String, String, Boolean)
+	 */
+	public IPMDRoot createRootDefinition(
+		String label,
+		String version,
+		boolean isStateless)
+		throws BPException {
+			
+		// check to see if this label and version exists
+		Iterator it = getRootDefinitions().iterator();
+		ArrayList defsToDelete = new ArrayList();
+		while ( it.hasNext()){
+			PMDRoot_SerialImpl root = (PMDRoot_SerialImpl)it.next();
+			if ( root.getLabel().equals(label) && root.getVersion().equals(version)) {
+				defsToDelete.add(root);
+			}
+		}
+		// delete the defs
+		it = defsToDelete.iterator();
+		while ( it.hasNext()){
+			PMDRoot_SerialImpl root = (PMDRoot_SerialImpl)it.next();
+			logger.log(Level.WARNING,ResourceGetter.getFormatted("DEF_REPLACE",
+				new Object [] {label,version} ));
+			deleteDefinition(root.getProcess().getKey());
+		}
+		
+			
+		IPMDRoot ret = new PMDRoot_SerialImpl(label,version,isStateless,uuidService,definitions,newDefinitions);
+		
+		// this has been moved into the createProcess of PMDRoot_SerialImpl
+		// because we have to index via the root processes id
+		//definitions.put(ret.getKey(),ret);
+		//newDefinitions.put(ret.getKey(),ret);
+		
+		return ret;
+	}
+	
+	public Collection getRootDefinitions() 
+	  throws BPException 
+	{
+	    return definitions.values();    
+	}
+	
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.DefinitionService#getCorrelations(com.sybase.bpe.event.IStaticKey)
+	 */
+	public Collection getCorrelations(IStaticKey key) throws BPException {
+	
+		Collection corrls = (Collection)defRegistrations.get(key.toString());
+		
+		if ( corrls == null ) {
+			return new ArrayList();
+		} else {
+			return corrls;
+		}
+	}
+	
+	/**
+	 * Return the BPEProperties object used at initialization
+	 * 
+	 * @return BPEProperties
+	 */
+	public BPEProperties getBPEProperties() {
+		return props;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.DefinitionService#releaseExternalActions()
+	 */
+	public void releaseExternalActions() {
+		Iterator it = definitions.values().iterator();
+		while ( it.hasNext() ) {
+			((IPMDRoot)it.next()).clearExternalAction();
+		}
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bpe.definition.service.DefinitionService#getNonInstanceCreatingOps(com.sybase.bpe.event.IStaticKey)
+	 */
+	public Collection getNonInstanceCreatingOps(IStaticKey key) throws BPException{
+		getRootDefinitions();
+		
+		Collection ops = (Collection)metaNonInstanceCreatingOperations.get(key.toString());
+		
+		if ( ops == null ) {
+			return new ArrayList();
+		} else {
+			return ops;
+		}
+	}
+	
+    public void deleteDefinition(String rootKey) throws BPException
+    {
+        deleteDefinition( new ProcessDefinitionKey(rootKey));
+    }
+    
+    protected void removeCachedDefinition( String id )
+    {
+        definitions.remove(id);
+    }
+    
+    protected void addDefinitionToCache(ProcessDefinitionKey key, 
+            IPMDRoot root)
+    {
+        definitions.put(key,root);
+    }
+    
+    protected void clearDefinitionCache()
+    {
+        definitions.clear();
+    }
+    
+    protected Enumeration getNewDefinitionsCache()
+    {
+        return newDefinitions.elements();
+    }
+    
+    protected void clearNewDefinitionsCache()
+    {
+        newDefinitions.clear();
+    }
+    
+    protected IPMDRoot getDefinitionFromCache(ProcessDefinitionKey 
+            definitionKey )
+    {
+        return (IPMDRoot)definitions.get(definitionKey);
+    }
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionServiceProxy.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionServiceProxy.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionServiceProxy.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionServiceProxy.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,219 @@
+/*
+* 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.definition.service.unmanaged;
+
+import java.util.Collection;
+//import java.util.logging.Logger;
+
+import com.sybase.bpe.definition.IPMDProcess;
+import com.sybase.bpe.definition.IPMDRoot;
+import com.sybase.bpe.definition.service.DefinitionService;
+import com.sybase.bpe.definition.service.DefinitionServiceException;
+import com.sybase.bpe.engine.IProcessCallBack;
+import com.sybase.bpe.engine.ProcessDefinitionKey;
+import com.sybase.bpe.event.IStaticKey;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.uuid.UUIDService;
+
+public class DefinitionServiceProxy implements DefinitionService
+{
+
+//    private static Logger logger = Logger
+//            .getLogger(DefinitionService_SerImpl.class.getName());
+
+    private DefinitionService delegate = null;
+
+    public DefinitionServiceProxy()
+    {
+
+    }
+
+    private void createDelegate(BPEProperties props, UUIDService us)
+            throws BPException
+    {
+        if (props.getDefinitionServicePersistence().equals("FALSE"))
+        {
+            delegate = new TransientDefinitionService();
+        } else
+        {
+            delegate = new PersistentDefinitionService();
+        }
+        delegate.init(props, us);
+    }
+
+    public void init(BPEProperties props, UUIDService us) throws BPException
+    {
+        createDelegate(props, us);
+    }
+
+    /**
+     * @see com.sybase.bpe.definition.service.DefinitionService#deleteDefinition(ProcessDefinitionKey)
+     */
+    public void deleteDefinition(ProcessDefinitionKey rootKey)
+            throws BPException
+    {
+        delegate.deleteDefinition(rootKey);
+    }
+
+    /**
+     * @see com.sybase.bpe.definition.service.DefinitionService#getRootDefinition(java.lang.String)
+     */
+    public IPMDRoot getRootDefinition(String definitionKey) throws BPException
+    {
+        return delegate.getRootDefinition(definitionKey);
+    }
+
+    /**
+     * @see com.sybase.bpe.definition.service.DefinitionService#getRootDefinition(ProcessDefinitionKey)
+     */
+    public IPMDRoot getRootDefinition(ProcessDefinitionKey definitionKey)
+            throws BPException
+    {
+        return delegate.getRootDefinition(definitionKey);
+    }
+
+    /**
+     * @see com.sybase.bpe.definition.service.DefinitionService#getProcessDefintion(ProcessDefinitionKey)
+     */
+    public IPMDProcess getProcessDefintion(ProcessDefinitionKey processKey,
+            ProcessDefinitionKey rootKey) throws BPException
+    {
+        return delegate.getProcessDefintion(processKey, rootKey);
+    }
+
+    /**
+     * @see com.sybase.bpe.definition.service.DefinitionService#createRootDefinition(String,
+     *      String, Boolean)
+     */
+    public IPMDRoot createRootDefinition(String label, String version,
+            boolean isStateless) throws BPException
+    {
+
+        return delegate.createRootDefinition(label, version, isStateless);
+    }
+
+    public void update() throws DefinitionServiceException
+    {
+        try
+        {
+            delegate.update();
+        } catch (BPException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.sybase.bpe.definition.service.DefinitionService#getRootDefinitions()
+     */
+    public Collection getRootDefinitions() throws BPException
+    {
+
+        return delegate.getRootDefinitions();
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.sybase.bpe.definition.service.DefinitionService#loadDefintion(java.lang.String,
+     *      com.sybase.bpe.correlation.CorrelationService)
+     */
+    public void loadDefintion(ProcessDefinitionKey procKey, IProcessCallBack pcb)
+            throws BPException
+    {
+        delegate.loadDefintion(procKey, pcb);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.sybase.bpe.definition.service.DefinitionService#getCorrelations(com.sybase.bpe.event.IStaticKey)
+     */
+    public Collection getCorrelations(IStaticKey key) throws BPException
+    {
+
+        return delegate.getCorrelations(key);
+    }
+
+    /**
+     * Return the BPEProperties object used at initialization
+     * 
+     * @return BPEProperties
+     */
+    public BPEProperties getBPEProperties()
+    {
+        return delegate.getBPEProperties();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.sybase.bpe.definition.service.DefinitionService#releaseExternalActions()
+     */
+    public void releaseExternalActions()
+    {
+        delegate.releaseExternalActions();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.sybase.bpe.definition.service.DefinitionService#getNonInstanceCreatingOps(com.sybase.bpe.event.IStaticKey)
+     */
+    public Collection getNonInstanceCreatingOps(IStaticKey key)
+            throws BPException
+    {
+        return delegate.getNonInstanceCreatingOps(key);
+    }
+
+    public void deactivateDefinition(String id) throws BPException
+    {
+        delegate.deactivateDefinition(id);
+    }
+
+    public void activateDefinition(String id) throws BPException
+    {
+        delegate.activateDefinition(id);
+    }
+
+    public void deleteDefinition(String rootKey) throws BPException
+    {
+        delegate.deleteDefinition(rootKey);
+    }
+
+    public void prepare() 
+    {
+        try
+        {
+            delegate.prepare();
+        } catch (BPException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionStateCache.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionStateCache.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionStateCache.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionStateCache.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,73 @@
+/*
+* 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.definition.service.unmanaged;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.sybase.bpe.engine.ProcessDefinitionKey;
+
+/**
+ *  This cache was added to improve performance on EAServer.
+ *  Without this cache a call to the cmp layer was required
+ *  for each service request.  Even though the cmp caches
+ *  the database data when possible, the component invocation
+ *  is expensive nonetheless.
+ * 
+ * 	This cache synchronizes the definition state for a single
+ *  JVM. In a multiple JVM scenario ( e.g. cluster ), the 
+ *  clusterred nodes will not see the same cache and the caches
+ *  may consequently become out of sync.  
+ *  
+ *  TODO:  Document the procedure for changing definition state
+ *  in a cluster.  Possibly introduce a clusterred caching mode
+ *  which hits the cmp layer for each transaction when
+ *  the application is running in a cluster.
+ * 
+ */
+public class DefinitionStateCache
+{
+    //TODO: move this to an application-local storage location
+    // for performance reasons.  Even though several applications
+    // share this cache there is no chance of conflict since
+    // the cache is indexed by a guid.
+    private static Map definitionStateCache = 
+        Collections.synchronizedMap(new HashMap());
+    
+    public static DefinitionStateEnum getState(
+            ProcessDefinitionKey key)
+    {
+        DefinitionStateEnum definitionState = 
+            ( DefinitionStateEnum )
+              definitionStateCache.get(key);
+        
+        return definitionState;
+    }
+    
+    public static void setState(ProcessDefinitionKey key,
+            DefinitionStateEnum state)
+    {
+        definitionStateCache.put(key, state);
+    }
+            
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionStateEnum.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionStateEnum.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionStateEnum.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DefinitionStateEnum.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,60 @@
+/*
+* 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.definition.service.unmanaged;
+
+import java.io.Serializable;
+
+public class DefinitionStateEnum implements Serializable
+{
+	
+    static final long serialVersionUID = 7736643918829506957L;
+    
+    private DefinitionStateEnum(int state)
+    {
+        mState = state;
+    }
+
+    public int intValue()
+    {
+        return mState;
+    }
+
+    public static DefinitionStateEnum getState(int state)
+    {
+        return states[state];
+    }
+
+    private final int mState;
+    private static final int ACTIVE_CONST = 0;
+    private static final int INACTIVE_CONST = 1;
+    private static final int UNKNOWN_CONST = 2;
+    public static final DefinitionStateEnum ACTIVE = new DefinitionStateEnum(
+            ACTIVE_CONST);
+    public static final DefinitionStateEnum INACTIVE = new DefinitionStateEnum(
+            INACTIVE_CONST);
+    public static final DefinitionStateEnum UNKNOWN = new DefinitionStateEnum(
+            UNKNOWN_CONST);
+    public static final DefinitionStateEnum states[] =
+    		{ ACTIVE, INACTIVE, UNKNOWN };
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DropTables.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DropTables.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DropTables.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/definition/service/unmanaged/DropTables.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 Apr 12, 2005
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sybase.bpe.definition.service.unmanaged;
+
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import com.sybase.bpe.definition.service.managed.ProcessDefinition;
+import com.sybase.bpe.definition.service.managed.ProcessDefinitionHome;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class DropTables {
+
+	public static void main(String[] args) throws Exception {
+		
+		if ( args.length != 1 ) {
+			System.out.println("Usage: DropTables [bpe pkg name]");
+			return;
+		}
+        // get the interface
+        InitialContext ic = new InitialContext();
+
+        Object o = ic.lookup(args[0]+"/ProcessDefinition");
+        ProcessDefinitionHome pdHome = (ProcessDefinitionHome) PortableRemoteObject
+                .narrow(o, ProcessDefinitionHome.class);
+        // get a bean
+        ProcessDefinition pd = pdHome.create();
+        
+        pd.undeploy();
+
+	}
+}