You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ad...@apache.org on 2006/02/28 17:35:26 UTC

svn commit: r381694 [12/38] - in /incubator/ode/scratch: bpe/ ode/ ode/bpelTests/ ode/bpelTests/probeService/ ode/bpelTests/test1/ ode/bpelTests/test10/ ode/bpelTests/test12/ ode/bpelTests/test13/ ode/bpelTests/test14/ ode/bpelTests/test15/ ode/bpelTes...

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorUtil.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorUtil.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorUtil.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorUtil.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,192 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.bped;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.correlation.CorrelationService;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.definition.service.DefinitionService;
+import org.apache.ode.engine.ProcessDefinitionKey;
+import org.apache.ode.engine.ProcessInstance;
+import org.apache.ode.engine.ProcessService;
+import org.apache.ode.engine.StateEnum;
+import org.apache.ode.event.ITimerEvent;
+import org.apache.ode.event.LoadDefinitionEvent;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.instance.IPMIProcess;
+import org.apache.ode.instance.service.InstanceService;
+import org.apache.ode.scope.service.IFCScopeInstance;
+import org.apache.ode.scope.service.IScopeService;
+import org.apache.ode.timerservice.IBPETimer;
+import org.apache.ode.util.BPException;
+
+/**
+ * Utilities for EventDirectors
+ */
+public class EventDirectorUtil{
+	
+	private static Logger logger = 
+		Logger.getLogger(EventDirectorUtil.class.getName());
+		
+	
+	/**
+	 * Activate a given process.
+	 * @param ed The Event Director to use.
+	 * @param procKey The process to activate.
+	 * @return An EventResult.
+	 * @throws EventDirectorException if Exception occurs while sending 
+	 * an activate event.
+	 */
+	public static void activate(IInternalEventDirector ed, String rootKey, String procKey) 
+		throws BPException {
+		StateEvent se = new StateEvent(rootKey, procKey,StateEnum.STARTED);
+		ed.sendEvent(se,true);
+		
+	}
+
+	/**
+	 *  Terminate a process.
+	 * @param ed
+	 * @param procKey
+	 * @return
+	 * @throws EventDirectorException
+	 */
+	public static void terminate(IInternalEventDirector ed, String rootKey, String procKey)
+		throws BPException {
+			StateEvent se = new StateEvent(rootKey, procKey,
+				StateEnum.TERMINATED);
+			ed.sendEvent(se,true);
+	}
+
+	/**
+	 * Pause a process.
+	 * @param ed
+	 * @param procKey
+	 * @return
+	 * @throws EventDirectorException
+	 */
+	public static void pause(IInternalEventDirector ed, String rootKey, String procKey) 
+		throws BPException {
+		StateEvent se = new StateEvent(rootKey, procKey,
+			StateEnum.PAUSED);
+		ed.sendEvent(se,true);
+	}
+	
+
+	/**
+	 * Handle a state event in a EventDirector non implementation specific
+	 * way.
+	 * @param ed
+	 * @param ps
+	 * @param se
+	 * @return An Event Result.
+	 * @throws EventDirectorException
+	 */
+	public static void handleStateEvent ( IInternalEventDirector ed, 
+		ProcessService ps, StateEvent se ) 
+		throws BPException {
+			
+				ProcessInstance pi = 
+					ps.lookupProcess(se.getRootProcessInstanceKey(),
+						se.getProcessInstanceKey());
+				pi.processEvent(se,ed, ed);
+				
+				InstanceService is = ps.getInstanceService();
+				
+				IPMIProcess ipmip =
+					is.getInstance(
+							se.getRootProcessInstanceKey(),
+							se.getRootProcessInstanceKey());
+				
+				// update the instance service
+				if (logger.isLoggable(Level.FINE)) {
+					logger.fine(
+						"updatting instance service and removing lock for:"
+							+ ipmip.getRootKey());
+				}
+				ed.getProcessService().update(ipmip.getRootKey(), ed, ed);
+
+	}
+	
+	
+	public static void handleLoadDefintionEvent(IInternalEventDirector ed, 
+		LoadDefinitionEvent lde) throws BPException{
+			
+			DefinitionService ds = 
+				ed.getProcessService().getInstanceService().getDefinitionService();
+//			CorrelationService cs = 
+//				ed.getCorrelationService();
+			ds.loadDefintion(new ProcessDefinitionKey(lde.getDefinitionName()),ed);
+		
+	}
+	
+	public static void handleTimerEvent(IInternalEventDirector ed, 
+		IBPETimer timer) throws EventDirectorException{
+			
+		try {
+			ITimerEvent te = timer.getTimerEvent();
+			CorrelationService cs = ed.getCorrelationService();
+			ProcessService ps = ed.getProcessService();
+			InstanceService is = ps.getInstanceService();
+			DefinitionService ds = is.getDefinitionService();
+			// get the process instance
+			ProcessInstance pi; 
+			
+			// routing to wait
+			if ( te.getDefId() == null ) {
+				pi = ed.getProcessService().lookupProcess(
+					te.getRootId(),	te.getProcId());
+			// routing to onAlarm
+			} else {
+				ProcessDefinitionKey rpdk = new ProcessDefinitionKey(te.getRootDefId());
+				ProcessDefinitionKey pdk = new ProcessDefinitionKey(te.getDefId());
+				IPMDProcess ipmd = ds.getProcessDefintion(pdk,rpdk);
+				IPMIProcess ipmi = is.getInstance(te.getRootId(),te.getRootId());
+				// create the process
+				pi = ps.createSubProcess(ipmi,ipmd);		
+				pi.setState(StateEnum.STARTED);
+				// since we are creating  the proc off the root 
+				// we have to set the scope path to the scope path
+				// of the process that made the registration
+				ProcessInstance regProc = ed.getProcessService().
+					lookupProcess( te.getRootId(),	te.getProcId());
+				pi.setScopePath(regProc.getScopePath());
+			}
+					
+			String  rootKey = pi.getRootKey();
+			
+			// init the process service
+			ps.init();
+			
+			cs.lock(ed, rootKey);
+			
+			// remove the timer from the scope
+			IScopeService ss = pi.getScopeService();
+			IFCScopeInstance scope = ss.getScope(pi.getScopePath());
+			scope.removeTimer(timer);
+			
+			pi.processEvent(te, ed, ed);
+			ps.update(rootKey,ed,ed);
+			
+		} catch (Exception e) {
+			logger.log(Level.SEVERE,"",e);
+		}
+		
+	}
+	
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/ExternalEventDirectorBase.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/ExternalEventDirectorBase.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/ExternalEventDirectorBase.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/ExternalEventDirectorBase.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.ode.bped;
+
+import org.apache.ode.client.impl.IInternalMessage;
+import org.apache.ode.client.impl.IInternalResult;
+import org.apache.ode.client.impl.MessageConverter;
+import org.apache.ode.client.impl.def.InternalResult;
+import org.apache.ode.engine.InactiveDefinitionException;
+import org.apache.ode.engine.ProcessInstancePausedException;
+import org.apache.ode.event.IRequestMessageEvent;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.IStaticKey;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.scope.service.BPRuntimeException;
+import org.apache.ode.util.BPException;
+
+/**
+ * Serves as an implementation base class for 
+ * all external event director implementations.
+ */
+public abstract class ExternalEventDirectorBase
+		implements 
+			EventDirector
+{
+	/**
+	 * @ejb:interface-method
+	 */
+	public IInternalResult sendRequest(IStaticKey key,
+			IInternalMessage internalRequest)
+	{
+		MessageConverter mc = new MessageConverter();
+		IRequestMessageEvent rme = mc.createRequest(key, internalRequest);
+		IResponseMessage response;
+		IInternalResult iresult;
+		try
+		{
+			response = sendEvent(rme, true);
+			iresult = mc.createResult(response);
+		} 
+		catch (BPRuntimeException bpre )
+		{
+			InternalResult internalResult = new InternalResult();
+			MessageConverter.PopulateBusinessProcessFaultResult( internalResult, bpre);
+			iresult = internalResult;
+		}
+		catch( ProcessInstancePausedException pipe )
+		{
+		    InternalResult internalResult = new InternalResult();
+		    MessageConverter.PopulatePausedInstanceException(
+		            internalResult, pipe);
+		    iresult = internalResult;
+		}
+		catch( InactiveDefinitionException iade )
+		{
+		    InternalResult internalResult = new InternalResult();
+		    MessageConverter.PopulateInactiveDefinitionException(
+		            internalResult, iade );
+		    iresult = internalResult;
+		}
+		catch (Exception e)
+		{
+			InternalResult internalResult = new InternalResult();
+			MessageConverter.PopulateSystemExceptionResult(internalResult, e);
+			iresult = internalResult;
+		}
+		return iresult;
+	}
+
+	public IDeployer getDeployer(DeployTypeEnum type)
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	public IResponseMessage sendEvent(IRequestMessageEvent msg, boolean sync) throws BPException
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.ISendEvent#sendEvent(org.apache.ode.event.StateEvent, boolean)
+	 */
+	public void sendEvent(StateEvent me, boolean sync) throws BPException {
+		// TODO Auto-generated method stub
+		
+	}
+	
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/IDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/IDeployer.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/IDeployer.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/IDeployer.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 13, 2003
+ *
+ */
+package org.apache.ode.bped;
+
+import java.io.InputStream;
+import java.util.Collection;
+
+import org.apache.ode.util.BPException;
+
+/**
+ * Interface to definition services.
+ * @author charper
+ *
+ */
+public interface IDeployer {
+
+	/**
+	 * Deploy a definition into the engine.
+	 * @param is input stream for the defintion; a zip file that holds the BPEL definiton and supporting documents
+	 * @param validating if the defintion is to be validated
+	 * @return a Collection of DefinitionKeys
+	 * @see org.apache.ode.deployment.DefinitionKey
+	 */
+	public Collection loadDefinition(InputStream is, boolean validating) throws BPException;
+	
+	/**
+	 * Deploy a definition into the engine from a resource.
+	 * @param resource resrouce path the the bpel deploy file
+	 * @param validating if the defintion is to be validated
+	 * @return a Collection of DefinitionKeys
+	 * @see org.apache.ode.deployment.DefinitionKey
+	 */
+	public Collection loadDefinition(String resource, boolean validating) throws BPException;
+	
+	/**
+	 * Remove a deployed definition.
+	 * @param defID the identifier of the definiton to remove.
+	 */
+	public void removeDefinition(String defID) throws BPException;
+	
+	/**
+	 * Set the given process to statless.
+	 * @param defID
+	 * @throws BPException
+	 */
+	public void setStateless(String defID) throws BPException;
+	
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/IInternalEventDirector.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/IInternalEventDirector.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/IInternalEventDirector.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/IInternalEventDirector.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.bped;
+
+import org.apache.ode.engine.IEvaluationContext;
+import org.apache.ode.engine.IProcessCallBack;
+import org.apache.ode.event.Fault;
+import org.apache.ode.event.LoadDefinitionEvent;
+import org.apache.ode.timerservice.IBPETimer;
+import org.apache.ode.util.BPException;
+
+/**
+ * Event director methods called by the BPE internally.
+ * These methods are not consumable by clients running
+ * outside the BPE.
+ */
+public interface IInternalEventDirector 
+extends IEvaluationContext, IProcessCallBack
+{
+	public void sendEvent(LoadDefinitionEvent me, boolean sync) throws BPException;
+	public Fault sendEvent(IBPETimer me, boolean sync) throws BPException;
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/ISendEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/ISendEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/ISendEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/ISendEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 13, 2003
+ *
+ */
+package org.apache.ode.bped;
+
+import org.apache.ode.event.IRequestMessageEvent;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.util.BPException;
+
+/**
+ * Interface to send messages to the message router.
+ * @author charper
+ *
+ */
+public interface ISendEvent {
+	
+	/** 
+	 * Send an Event.  The event can be sent syncronously or
+	 * asyncronously.  
+	 * @param msg 	The event meassage to send to the engine.
+	 * @param sync	True for a syncronous call.
+	 * @return	The event result.
+	 * @throws	EventDirectorException If and error occurs while
+	 * processing the Event.  Note that the method can complete with out 
+	 * error, but the returned EventResult can contain fault messages.
+	  */
+	IResponseMessage sendEvent(IRequestMessageEvent msg, boolean sync)
+	 throws BPException;
+	
+	public void sendEvent(StateEvent me, boolean sync) throws BPException;
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPELDeployerRemote.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPELDeployerRemote.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPELDeployerRemote.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPELDeployerRemote.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 16, 2003
+ *
+ */
+package org.apache.ode.bped.managed;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.rmi.RemoteException;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.bped.IDeployer;
+import org.apache.ode.definition.service.managed.ProcessDefinition;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author charper
+ *
+ */
+public class BPELDeployerRemote implements IDeployer {
+
+	private static Logger logger = 
+		Logger.getLogger(BPELDeployerRemote.class.getName());
+	
+	private ProcessDefinition pd;
+	
+	/**
+	 * @param bped
+	 * @param pd
+	 */
+	public BPELDeployerRemote(ProcessDefinition pd) {
+		this.pd = pd;	
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IDeployer#loadDefintion(java.io.InputStream, boolean)
+	 */
+	public Collection loadDefinition(InputStream is, boolean validating) throws BPException{
+		
+		Collection keys = null;
+		try {
+			ByteArrayOutputStream bos = new ByteArrayOutputStream();
+			byte[] buf = new byte[1024];
+			int len;
+			while ((len = is.read(buf)) >= 0) {
+				bos.write(buf,0,len);
+			}
+			keys = pd.deploy(bos.toByteArray(),validating,null);
+			
+
+		} catch (RemoteException e) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"RemoteException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		} catch (IOException e) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"IOException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		}
+		return keys;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IDeployer#removeDefinition(java.lang.String)
+	 */
+	public void removeDefinition(String defID) throws BPException {
+		try {
+			pd.removeDefinition(defID);
+		} catch (RemoteException e) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"RemoteException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		}
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IDeployer#setStateless(java.lang.String)
+	 */
+	public void setStateless(String defID) throws BPException {
+		try {
+			pd.setStateless(defID);
+		} catch (RemoteException e) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"RemoteException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IDeployer#loadDefinition(java.lang.String, boolean)
+	 */
+	public Collection loadDefinition(String resource, boolean validating) throws BPException {
+		Collection keys = null;
+		try {
+			keys = pd.deploy(resource,validating,null);
+			
+
+		} catch (RemoteException e) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"RemoteException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		} 
+		return keys;
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPETimerBean.java.j2ee14
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPETimerBean.java.j2ee14?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPETimerBean.java.j2ee14 (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPETimerBean.java.j2ee14 Tue Feb 28 08:31:48 2006
@@ -0,0 +1,317 @@
+package com.sybase.bpe.bped.ejbimpl;
+
+import java.rmi.RemoteException;
+import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.ejb.TimedObject;
+import javax.ejb.Timer;
+import javax.ejb.TimerService;
+import javax.naming.InitialContext;
+
+import com.sybase.bpe.bped.EventDirectorFactory;
+import com.sybase.bpe.bped.IInternalEventDirector;
+import com.sybase.bpe.event.ITimerEvent;
+import com.sybase.bpe.timerservice.ejbTimerImpl.BPETimerEjbTimerImpl;
+import com.sybase.bpe.util.BPEProperties;
+
+/**
+ * This bean can start definitions.
+ * @ejb:bean 
+ *    type="Stateless"
+ *    name="BPETimer"
+ * 	  local-jndi-name="BPE/BPETimerLocal"
+ *    view-type="local"
+ *
+ * @ejb.transaction type="Required"
+ * 
+ * @ejb.resource-ref
+ * 	res-name="BPEDThreadConnectionFactory"
+ * 	res-type="javax.jms.QueueConnectionFactory"
+ *  res-auth="Container"
+ * 
+ * @ejb.resource-env-ref
+ * 	name="BPEDThreadQueue"
+ * 	type="javax.jms.Queue"
+ * 
+ * @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.beanimpl.DefinitionService_BeanImpl"
+ * @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.InstanceService_BeanImpl"
+ * @ejb.env-entry
+ * 	name="INST_PERSISTENT_KEY"
+ * 	value="TRUE"
+ * @ejb.env-entry
+ * 	name="ED_CLASS_KEY"
+ * 	value="com.sybase.bpe.bped.ejbimpl.EventDirectorEjbImpl"
+ * @ejb.env-entry
+ * 	name="CORL_CLASS_KEY"
+ * 	--value="com.sybase.bpe.correlation.enginestateimpl.CorrelationServiceEngineStateImpl"
+ * 	value="com.sybase.bpe.correlation.ejbimpl.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.env-entry
+ *  name="BPETIMER_CLASS_KEY"
+ *  value="com.sybase.bpe.timerservice.ejbTimerImpl.BPETimerServiceEjbTimerImpl"
+ *  --value="com.sybase.bpe.timerservice.quartzimpl.BPETimerServiceQuartzImpl"
+ * 
+ * @ejb.ejb-ref
+ *      ejb-name="PackageInfo"
+ *    view-type="local"
+ *    ref-name="thePackageInfo"
+ * @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="BPEventDirector"
+ *  	view-type="local"
+ *  	ref-name="BPEventDirectorLocal"
+ * -- EAS is not j2ee 1.4 compatible
+ * --@ejb.ejb-ref
+ * --    ejb-name="BPETimer"
+ * -- 	view-type="local"
+ * -- 	ref-name="BPETimerLocal"
+ * 
+ * 
+ * @jboss.resource-ref
+ *      res-ref-name="BPEDThreadConnectionFactory"
+ *      jndi-name="java:/XAConnectionFactory"
+ * @jboss.resource-env-ref
+ *      resource-env-ref-name="BPEDThreadQueue"
+ *  	jndi-name="queue/BPED_IN"
+ * 
+ * @weblogic.resource-description
+ *      res-ref-name="BPEDThreadConnectionFactory"
+ *      jndi-name="XAConnectionFactory"
+ * @weblogic.resource-env-description
+ *      res-env-ref-name="BPEDThreadQueue"
+ *  	jndi-name="jms/BPED_THREAD"
+ * 
+ * @ejb.resource-ref
+ *  res-ref-name="theUUIDService"
+ *  res-type="javax.resource.cci.ConnectionFactory"
+ *  res-auth="Container"
+ *  res-sharing-scope="Unshareable"
+ * @jboss.resource-ref
+ *      res-ref-name="theUUIDService"
+ *      jndi-name="java:/UUIDService"
+ * @weblogic.resource-description
+ *      res-ref-name="theUUIDService"
+ *      jndi-name="UUIDService"
+ * 
+ * @ejb.resource-ref
+ *  res-ref-name="theXMLDocBuilderService"
+ *  res-type="javax.resource.cci.ConnectionFactory"
+ *  res-auth="Container"
+ *  res-sharing-scope="Unshareable"
+ *  
+ * @jboss.resource-ref
+ *      res-ref-name="theXMLDocBuilderService"
+ *      jndi-name="java:/XMLDocBuilderService"
+ * @weblogic.resource-description
+ *      res-ref-name="theXMLDocBuilderService"
+ *      jndi-name="XMLDocBuilderService"
+ * 
+ * @ejb.resource-ref
+ *  res-ref-name="theFormatterService"
+ *  res-type="javax.resource.cci.ConnectionFactory"
+ *  res-auth="Container"
+ *  res-sharing-scope="Unshareable"
+ * @jboss.resource-ref
+ *      res-ref-name="theFormatterService"
+ *      jndi-name="java:/FormatterService"
+ * @weblogic.resource-description
+ *      res-ref-name="theFormatterService"
+ *      jndi-name="FormatterService"
+ * 
+ * @ejb.resource-ref
+ *  res-ref-name="theBNRuleEngineRAService"
+ *  res-type="javax.resource.cci.ConnectionFactory"
+ *  res-auth="Container"
+ * 	res-sharing-scope="Unshareable"
+ * @jboss.resource-ref
+ *      res-ref-name="theBNRuleEngineRAService"
+ *      jndi-name="java:/BNRuleEngineService"
+ * @weblogic.resource-description
+ *      res-ref-name="theBNRuleEngineRAService"
+ *      jndi-name="BNRuleEngineService"
+ * 
+ * @ejb.resource-ref
+ *  res-ref-name="SybaseBPETimerService"
+ *  res-type="javax.resource.cci.ConnectionFactory"
+ *  res-auth="Container"
+ *  res-sharing-scope="Unshareable"
+ * @jboss.resource-ref
+ *      res-ref-name="SybaseBPETimerService"
+ *      jndi-name="java:/SybaseBPETimerService"
+ * @weblogic.resource-description
+ *      res-ref-name="SybaseBPETimerService"
+ *      jndi-name="SybaseBPETimerService"
+ * 
+ * @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 BPETimerBean implements SessionBean, TimedObject {
+	
+	private static Logger logger =
+		Logger.getLogger(BPEventDirectorBean.class.getName());
+	private SessionContext context;
+	private IInternalEventDirector ed;
+
+	/* (non-Javadoc)
+	 * @see javax.ejb.SessionBean#ejbActivate()
+	 */
+	public void ejbActivate() throws EJBException, RemoteException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.ejb.SessionBean#ejbPassivate()
+	 */
+	public void ejbPassivate() throws EJBException, RemoteException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.ejb.SessionBean#ejbRemove()
+	 */
+	public void ejbRemove() throws EJBException, RemoteException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
+	 */
+	public void setSessionContext(SessionContext arg0) throws EJBException,
+			RemoteException {
+		this.context = arg0; 
+
+	}
+	
+	public void ejbCreate(){
+
+		   try {
+					 
+		   	InitialContext ic = new InitialContext();
+			BPEProperties p = new BPEProperties(true,ic);
+			ed = (IInternalEventDirector)EventDirectorFactory.createEventDirector(p);
+
+		   } catch (Exception ex) {
+			   logger.log(Level.SEVERE,"",ex);
+		   }
+
+		}
+		
+	
+	/* (non-Javadoc)
+	 * @see javax.ejb.TimedObject#ejbTimeout(javax.ejb.Timer)
+	 */
+	public void ejbTimeout(Timer arg0) {
+		try {
+			if ( logger.isLoggable(Level.FINE)){
+				logger.fine("timeout for timer: " + arg0.toString());
+			}
+			ed.sendEvent(new BPETimerEjbTimerImpl(arg0.getHandle()), true);
+		} catch (Exception ex) {
+			// this may happen if a timer expires and 
+			// blocks on a proccess that is finishing
+			logger.log(Level.WARNING, "", ex);
+		}
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public Timer createTimer(long duration, ITimerEvent event) {
+		try {
+			TimerService ts = context.getTimerService();
+			Timer t = ts.createTimer(duration,event);
+			if ( logger.isLoggable(Level.FINE)){
+				logger.fine("registered timer: " + t.toString());
+			}
+
+			return t;
+		} catch (Exception ex) {
+			throw new EJBException(ex.getLocalizedMessage(), ex);
+		}
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public Timer createTimer(Date experation, ITimerEvent event) {
+		try {
+			TimerService ts = context.getTimerService();
+			Timer t = ts.createTimer(experation,event);
+			if ( logger.isLoggable(Level.FINE)){
+				logger.fine("registered timer: " + t.toString());
+			}
+
+			return t;
+		} catch (Exception ex) {
+			throw new EJBException(ex.getLocalizedMessage(), ex);
+		}
+	}
+
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPEventDirectorBean.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPEventDirectorBean.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPEventDirectorBean.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/BPEventDirectorBean.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,281 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.bped.managed;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.naming.InitialContext;
+
+import org.apache.ode.bped.EventDirectorFactory;
+import org.apache.ode.bped.ExternalEventDirectorBase;
+import org.apache.ode.bped.IInternalEventDirector;
+import org.apache.ode.client.impl.IInternalRequestConsumer;
+import org.apache.ode.context.IContainer;
+import org.apache.ode.context.IContextService;
+import org.apache.ode.engine.ProcessDefinitionKey;
+import org.apache.ode.engine.ProcessInstance;
+import org.apache.ode.engine.ProcessService;
+import org.apache.ode.engine.StateEnum;
+import org.apache.ode.event.Fault;
+import org.apache.ode.event.IRequestMessageEvent;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.LoadDefinitionEvent;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.timerservice.IBPETimer;
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.util.BPException;
+
+/**
+ * This bean can start definitions.
+ * @ejb:bean 
+ *    type="Stateless"
+ *    name="BPEventDirector"
+ *    jndi-name="BPE/BPEventDirector"
+ * 	  local-jndi-name="BPE/BPEventDirectorLocal"
+ *    view-type="both"
+ *
+ * @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="org.apache.ode.uuid.EMFUUIDService"
+ * @ejb.env-entry
+ *  name="UUID_SIZE_KEY"
+ *  value="200"
+ *  type="java.lang.Integer"
+ * @ejb.env-entry
+ * 	name="DEF_CLASS_KEY"
+ * 	--value="org.apache.ode.definition.enginestateimpl.DefintionServiceEngineStateImpl"
+ * 	value="org.apache.ode.definition.serialimpl.DefinitionService_SerImpl"
+ * @ejb.env-entry
+ * 	name="DEF_PERSISTENT_KEY"
+ * 	value="TRUE"
+ * @ejb.env-entry
+ * 	name="INST_CLASS_KEY"
+ * 	--value="org.apache.ode.instance.service.enginestateimpl.InstanceServiceEngineStateImpl"
+ * 	value="org.apache.ode.instance.beanimpl.InstanceServicePersistentImpl"
+ * @ejb.env-entry
+ * 	name="INST_PERSISTENT_KEY"
+ * 	value="TRUE"
+ * @ejb.env-entry
+ * 	name="ED_CLASS_KEY"
+ * 	value="org.apache.ode.bped.managed.EventDirectorEjbImpl"
+ * @ejb.env-entry
+ * 	name="CORL_CLASS_KEY"
+ * 	--value="org.apache.ode.correlation.enginestateimpl.CorrelationServiceEngineStateImpl"
+ * 	value="org.apache.ode.correlation.managed.CorrelationServiceEjbImpl"
+ * @ejb.env-entry
+ * 	name="LOCK_CLASS_KEY"
+ * 	value="org.apache.ode.locking.DBLockingService"
+ * @ejb.env-entry
+ * 	name="LOCK_HASH_BUCKETS_KEY"
+ * 	value="1000"
+ * @ejb.env-entry
+ * 	name="CTX_CLASS_KEY"
+ * 	value="org.apache.ode.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="org.apache.ode.scope.service.impl.ScopeServiceImpl"
+ * @ejb.env-entry
+ *  name="BPETIMER_CLASS_KEY"
+ *  --value="org.apache.ode.timerservice.ejbTimerImpl.BPETimerServiceEjbTimerImpl"
+ *  value="org.apache.ode.timerservice.quartzimpl.BPETimerServiceQuartzImpl"
+ *  --value="org.apache.ode.timerservice.noop.NoopTimerService"
+ * 
+ * @ejb.ejb-ref
+ *      ejb-name="PackageInfo"
+ *    view-type="remote"
+ *    ref-name="thePackageInfo"
+ * @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="BPEventDirector"
+ *  	view-type="local"
+ *  	ref-name="theLocalBPEDBean"
+ * -- EAS is not j2ee 1.4 compatible
+ * --@ejb.ejb-ref
+ *  --    ejb-name="BPETimer"
+ *  --	view-type="local"
+ *  --	ref-name="BPETimerLocal"
+ * 
+ * @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 BPEventDirectorBean extends ExternalEventDirectorBase implements SessionBean, 
+	IInternalRequestConsumer {
+	
+	static final long serialVersionUID = 8909646742595626256L;
+
+	private static Logger logger =
+		Logger.getLogger(BPEventDirectorBean.class.getName());
+	private InitialContext ic;
+//	private SessionContext context;
+
+	private ProcessService ps;
+	private IInternalEventDirector ed;
+
+	/**
+	 * @ejb:interface-method
+	 */
+	public void startProcess(String id) {
+	   try {
+		// create the process
+		ProcessInstance pi = ps.createProcess(
+			new ProcessDefinitionKey(id));
+		// creat the processes root container
+		IContextService ctxs = pi.getContextService();
+		IContainer cont = ctxs.getRoot();
+		cont.createContainer(pi.getRootKey());
+		// send a start event
+		pi.processEvent(new StateEvent(pi.getRootKey(),
+			pi.getKey(),StateEnum.STARTED),
+			ed, ed);
+	   } catch (BPException ex) {
+		   // TODO: Cory - should the exception be rethrown?
+		   // logger.log(Level.SEVERE,"",ex);
+	   }
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public IResponseMessage sendEvent(IRequestMessageEvent event, boolean sync) {
+	
+	   try {
+	   	IResponseMessage rsp = ed.sendEvent(event,sync);
+		return rsp;
+	   } catch (Exception ex) {
+	   		logger.log(Level.FINE,"",ex);
+	   		try {
+				IResponseMessage resp = event.createResponseMessage();
+				Fault fault = new Fault();
+				fault.setFaultString(ex.getLocalizedMessage());
+				fault.setFaultException(ex);
+				resp.setFault(fault);
+				return resp;
+			} catch (BPException e) {
+				logger.log(Level.SEVERE,"",e);
+			}
+	   }
+	   return null;
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public void sendEvent(StateEvent event, boolean sync) {
+	   try {
+			ed.sendEvent(event,sync);
+	   } catch (Exception ex) {
+		// TODO: Cory - should the exception be rethrown?
+		//   logger.log(Level.SEVERE,"",ex);
+	   }
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public void sendEvent(LoadDefinitionEvent event, boolean sync) {
+	   try {
+		 ed.sendEvent(event,sync);
+	   } catch (Exception ex) {
+		// TODO: Cory - should the exception be rethrown?
+		//   logger.log(Level.SEVERE,"",ex);
+	   }
+	}
+	
+	/**
+	 * @ejb:interface-method
+	 */
+	public Fault sendEvent(IBPETimer event, boolean sync) {
+		Fault fault = null;
+	   try {
+		fault = ed.sendEvent(event,sync);
+	   } catch (Exception ex) {
+		   //logger.log(Level.SEVERE,"",ex);
+		   fault = new Fault();
+		   fault.setFaultString(ex.getLocalizedMessage());
+	   }
+	   return fault;
+	}
+
+
+	public void ejbCreate(){
+
+	   try {
+				 
+		ic = new InitialContext();
+		BPEProperties p = new BPEProperties(true,ic);
+		ed = (IInternalEventDirector)EventDirectorFactory.createEventDirector(p);
+		ps = ed.getProcessService();
+
+	   } catch (Exception ex) {
+		   logger.log(Level.SEVERE,"",ex);
+	   }
+
+	}
+	
+	public void setSessionContext(SessionContext ctx) { 
+//		this.context = ctx; 
+	}
+	public void ejbRemove() {ed.release();}
+	public void ejbActivate() {}
+	public void ejbPassivate() {}
+	public void ejbLoad() {}
+	public void ejbStore() {}
+
+
+	/**
+	 * @ejb:interface-method
+	 *    view-type="local"
+	 */
+	public IInternalEventDirector getIInternalEventDirector() {
+		return ed;
+	}
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorEjbImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorEjbImpl.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorEjbImpl.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorEjbImpl.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,369 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.bped.managed;
+
+import java.util.Stack;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.ode.bped.DeployTypeEnum;
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.bped.EventDirectorException;
+import org.apache.ode.bped.EventDirectorUtil;
+import org.apache.ode.bped.IDeployer;
+import org.apache.ode.bped.IInternalEventDirector;
+import org.apache.ode.client.impl.IInternalMessage;
+import org.apache.ode.client.impl.IInternalResult;
+import org.apache.ode.correlation.CorrelationService;
+import org.apache.ode.correlation.managed.CorrelationServiceEjbImpl;
+import org.apache.ode.definition.service.DefinitionService;
+import org.apache.ode.engine.ProcessInstance;
+import org.apache.ode.engine.ProcessService;
+import org.apache.ode.engine.ReturnMessageLocatorHolder;
+import org.apache.ode.event.Fault;
+import org.apache.ode.event.IRequestMessageEvent;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.IStaticKey;
+import org.apache.ode.event.LoadDefinitionEvent;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.locking.LockingService;
+import org.apache.ode.timerservice.IBPETimer;
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.util.BPException;
+import org.apache.ode.uuid.UUIDService;
+
+/**
+ * An EJB implementation of EventDirector.
+ * 
+ */
+public class EventDirectorEjbImpl implements IInternalEventDirector, EventDirector {
+	
+	private static Logger logger = 
+		Logger.getLogger(EventDirectorEjbImpl.class.getName());
+		
+	private ReturnMessageLocatorHolder rmlh;
+	private IRequestMessageEvent me;
+	private UUIDService us;
+	private ProcessService processService;
+	// correlation service
+	private CorrelationService correlationService;
+	private LockingService lockingService;
+	private DefinitionService definitionService;
+
+	
+	// The event director will use a stack to push and pop ProcessInstance
+	// on the evaluation context. This will cause the engine to use depth
+	// first evaluation of the process tree.
+	private Stack processInstanceStack = new Stack();
+	
+	// mark for dead current process 
+	private boolean dead;
+
+	
+	
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#init(BPEProperties, CorrelationService)
+	 */
+	public void init(BPEProperties props, ProcessService ps, CorrelationService cs,  UUIDService us, LockingService ls) 
+		throws BPException {
+
+		try {
+
+			InitialContext context = new InitialContext();
+			
+			// get process service
+			props = new BPEProperties(true,context);
+			this.us = us;
+			processService = ps;
+			correlationService = cs;
+			lockingService = ls;
+
+			
+		} catch ( NamingException e) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"NamingException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		}
+	}
+	
+	/**
+	 *  @see org.apache.ode.bped.IInternalEventDirector#getCorrelationService()
+	 */
+	public CorrelationService getCorrelationService() {
+		return correlationService;
+	}
+	
+	/**
+	 *  @see org.apache.ode.bped.IInternalEventDirector#getLockingService()
+	 */
+	public LockingService getLockingService() {
+		return lockingService;
+	}
+	
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#getProcessService()
+	 */
+	public ProcessService getProcessService() {
+
+		return processService;
+	
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#getReturnMessageMetadata()
+	 */
+	public ReturnMessageLocatorHolder getReturnMessageMetadata() {
+
+		return this.rmlh;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#setReturnMessageMetadata(java.util.Collection)
+	 */
+	public void setReturnMessageMetadata(ReturnMessageLocatorHolder rmlh) {
+		this.rmlh = rmlh;
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#getMessageEvent()
+	 */
+	public IRequestMessageEvent getMessageEvent() {
+
+		return this.me;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#setMessageEvent(org.apache.ode.event.MessageEvent)
+	 */
+	public void setMessageEvent(IRequestMessageEvent me) {
+		this.me =me;
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.engine.IEvaluationContext#release()
+	 */
+	public void release() {
+		try { 
+			us.close();
+		} catch ( Exception e ) {
+			// log a warning if the uuid service doesn't close properly
+			logger.log(Level.WARNING,"",e);	
+		}
+		processService.getInstanceService().getDefinitionService().releaseExternalActions();	
+	}
+	
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#sendEvent(IRequestMessageEvent, boolean)
+	 * @ejb:interface-method
+	 */
+	public IResponseMessage sendEvent(IRequestMessageEvent msg, boolean sync)
+            throws BPException
+    {
+
+        IResponseMessage er = null;
+        logger.fine("Received message event.");
+        if (correlationService instanceof CorrelationServiceEjbImpl)
+        {
+            CorrelationServiceEjbImpl csei = ( CorrelationServiceEjbImpl )
+              ( correlationService );
+            // The component may have some cached registration updates
+            // which were never cleared because of a previous transaction rollback.
+            // Clear them now just in case.
+            csei.clearState();
+        }
+        
+        //Let the definition service know that the definition load
+        //phase has completed and we are now sending service requests.
+        //This is needed for the definitionService optimization caching.
+        getDefinitionService().prepare();
+        er = correlationService.correlateEvent((IRequestMessageEvent) msg,
+                sync, this);
+        
+        if (correlationService instanceof CorrelationServiceEjbImpl)
+        {
+            CorrelationServiceEjbImpl csei = ( CorrelationServiceEjbImpl )
+              ( correlationService );
+            csei.persistRegistrationChanges();
+        }
+        return er;
+	}
+	
+	private DefinitionService getDefinitionService() throws BPException
+	{
+	    if ( definitionService == null )
+	    {
+	        definitionService = this.correlationService.
+	          getProcessService().getInstanceService().getDefinitionService();
+	    }
+	    return definitionService;
+	}
+
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#activate(String)
+	 */
+	public void activate(String rootKey, String procKey) throws BPException {
+		
+		try {
+			EventDirectorUtil.activate(this,rootKey,procKey);
+		} catch ( EventDirectorException ede ) {
+			logger.log(Level.SEVERE,"",ede);
+			throw ede;
+		}
+	}
+
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#terminate(String)
+	 */
+	
+	public void terminate(String rootKey,String procKey) throws BPException {
+		
+		try 
+		{
+			EventDirectorUtil.terminate(this,rootKey,procKey);     
+		} catch ( EventDirectorException ede ) {
+			logger.log(Level.SEVERE,"",ede);
+			throw ede;
+		}
+
+	}
+	
+
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#pause(String)
+	 */
+	public void pause(String rootKey, String procKey) throws BPException {
+			EventDirectorUtil.pause(this,rootKey,procKey);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IEventDirector#getDeployer(org.apache.ode.bped.DeployTypeEnum)
+	 */
+	public IDeployer getDeployer(DeployTypeEnum type) {
+	   return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#sendEvent(org.apache.ode.event.StateEvent, boolean)
+	 */
+	public void sendEvent(StateEvent me, boolean sync) throws BPException
+    {
+        if (correlationService instanceof CorrelationServiceEjbImpl)
+        {
+            CorrelationServiceEjbImpl csei = (CorrelationServiceEjbImpl) (correlationService);
+            csei.clearState();
+        }
+
+        EventDirectorUtil.handleStateEvent(this, processService, me);
+
+        if (correlationService instanceof CorrelationServiceEjbImpl)
+        {
+            CorrelationServiceEjbImpl csei = (CorrelationServiceEjbImpl) (correlationService);
+            csei.persistRegistrationChanges();
+        }
+    }
+
+	/*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.ode.bped.EventDirector#sendEvent(org.apache.ode.event.LoadDefinitionEvent,
+     *      boolean)
+     */
+	public void sendEvent(LoadDefinitionEvent me, boolean sync) throws BPException {
+
+			EventDirectorUtil.handleLoadDefintionEvent(this,me);
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#sendEvent(org.apache.ode.timerservice.IBPETimer, boolean)
+	 */
+	public Fault sendEvent(IBPETimer me, boolean sync) throws BPException {
+        if (correlationService instanceof CorrelationServiceEjbImpl)
+        {
+            CorrelationServiceEjbImpl csei = (CorrelationServiceEjbImpl) (correlationService);
+            csei.clearState();
+        }
+		EventDirectorUtil.handleTimerEvent(this,me);
+		if (correlationService instanceof CorrelationServiceEjbImpl)
+		{
+			CorrelationServiceEjbImpl csei = (CorrelationServiceEjbImpl) (correlationService);
+			csei.persistRegistrationChanges();
+		}
+		return null;
+	}
+
+	/**
+	 * @see org.apache.ode.engine.IEvaluationContext#addProcessInstance(org.apache.ode.engine.ProcessInstance)
+	 */
+	public void addProcessInstance(ProcessInstance pi) {
+		processInstanceStack.push(pi);
+
+	}
+
+	/**
+	 * @see org.apache.ode.engine.IEvaluationContext#getNextProcessInstance()
+	 */
+	public ProcessInstance getNextProcessInstance() {
+		return ( processInstanceStack.size() > 0 ) ? (ProcessInstance)processInstanceStack.pop() : null;
+	}
+
+	/**
+	 * @see org.apache.ode.engine.IEvaluationContext#initProcessInstanceCollection()
+	 */
+	public void initProcessInstanceCollection() {
+		processInstanceStack.clear();
+	}				
+	/**
+	 * @see org.apache.ode.engine.IEvaluationContext#hasMoreProcessInstances()
+	 */
+	public boolean processInstanceCollectionIsEmpty() {
+		return processInstanceStack.isEmpty();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.engine.IEvaluationContext#setDeadProcess()
+	 */
+	public void setDeadProcess(boolean mark) {
+		dead = mark;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.engine.IEvaluationContext#isDeadProcess()
+	 */
+	public boolean isDeadProcess() {
+		return dead;
+	}
+
+	public IInternalResult sendRequest(IStaticKey staticKey, IInternalMessage internalRequest)
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#getIInternalEventDirector()
+	 */
+	public IInternalEventDirector getIInternalEventDirector() {
+		return this;
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorLocal.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorLocal.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorLocal.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorLocal.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 16, 2003
+ *
+ */
+package org.apache.ode.bped.managed;
+
+//import java.util.logging.Logger;
+
+import org.apache.ode.bped.DeployTypeEnum;
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.bped.IDeployer;
+import org.apache.ode.bped.IInternalEventDirector;
+import org.apache.ode.bped.managed.BPEventDirectorLocal;
+import org.apache.ode.client.impl.IInternalMessage;
+import org.apache.ode.client.impl.IInternalResult;
+import org.apache.ode.definition.service.managed.ProcessDefinition;
+import org.apache.ode.event.IRequestMessageEvent;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.IStaticKey;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author charper
+ *
+ */
+public class EventDirectorLocal implements EventDirector {
+
+//	private static Logger logger = 
+//		Logger.getLogger(EventDirectorLocal.class.getName());
+
+	private BPEventDirectorLocal bped;
+	private ProcessDefinition pd;
+	/**
+	 * @param bped
+	 * @param pd
+	 */
+	public EventDirectorLocal(BPEventDirectorLocal bped, ProcessDefinition pd) {
+		this.bped = bped;
+		this.pd = pd;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IEventDirector#getDeployer(org.apache.ode.bped.DeployTypeEnum)
+	 */
+	public IDeployer getDeployer(DeployTypeEnum type) {
+		if ( type.equals(DeployTypeEnum.BPEL)) {
+			return new BPELDeployerRemote(pd);
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.ISendEvent#sendEvent(org.apache.ode.event.Event, boolean)
+	 */
+	public IResponseMessage sendEvent(IRequestMessageEvent msg, boolean sync) throws BPException {
+		return bped.sendEvent(msg,sync);
+	}
+
+	public IInternalResult sendRequest(IStaticKey staticKey, 
+			IInternalMessage internalRequest)
+	{
+		return bped.sendRequest(staticKey, internalRequest );
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.ISendEvent#sendEvent(org.apache.ode.event.StateEvent, boolean)
+	 */
+	public void sendEvent(StateEvent me, boolean sync) throws BPException {
+		bped.sendEvent(me,sync);
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#getIInternalEventDirector()
+	 */
+	public IInternalEventDirector getIInternalEventDirector() {
+		return bped.getIInternalEventDirector();
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorRemote.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorRemote.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorRemote.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/managed/EventDirectorRemote.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 16, 2003
+ *
+ */
+package org.apache.ode.bped.managed;
+
+import java.rmi.RemoteException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.bped.DeployTypeEnum;
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.bped.IDeployer;
+import org.apache.ode.bped.IInternalEventDirector;
+import org.apache.ode.bped.managed.BPEventDirector;
+import org.apache.ode.client.impl.IInternalMessage;
+import org.apache.ode.client.impl.IInternalResult;
+import org.apache.ode.definition.service.managed.ProcessDefinition;
+import org.apache.ode.event.IRequestMessageEvent;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.IStaticKey;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author charper
+ *
+ */
+public class EventDirectorRemote implements EventDirector {
+
+	private static Logger logger = 
+		Logger.getLogger(EventDirectorRemote.class.getName());
+
+	private BPEventDirector bped;
+	private ProcessDefinition pd;
+	/**
+	 * @param bped
+	 * @param pd
+	 */
+	public EventDirectorRemote(BPEventDirector bped, ProcessDefinition pd) {
+		this.bped = bped;
+		this.pd = pd;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IEventDirector#getDeployer(org.apache.ode.bped.DeployTypeEnum)
+	 */
+	public IDeployer getDeployer(DeployTypeEnum type) {
+		if ( type.equals(DeployTypeEnum.BPEL)) {
+			return new BPELDeployerRemote(pd);
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.ISendEvent#sendEvent(org.apache.ode.event.Event, boolean)
+	 */
+	public IResponseMessage sendEvent(IRequestMessageEvent msg, boolean sync) throws BPException {
+		try {
+			return bped.sendEvent(msg,sync);
+		} catch (RemoteException e) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"RemoteException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+
+		}
+	}
+
+	public IInternalResult sendRequest(IStaticKey staticKey, 
+			IInternalMessage internalRequest)
+	{
+		IInternalResult result = null;
+		try
+		{
+			result = 
+				bped.sendRequest(staticKey, internalRequest );
+		} catch (RemoteException e)
+		{
+			throw new RuntimeException(e);
+		}
+		
+		return result;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.ISendEvent#sendEvent(org.apache.ode.event.StateEvent, boolean)
+	 */
+	public void sendEvent(StateEvent me, boolean sync) throws BPException {
+		try {
+			bped.sendEvent(me,sync);
+		} catch (RemoteException e) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"RemoteException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+
+		}
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#getIInternalEventDirector()
+	 */
+	public IInternalEventDirector getIInternalEventDirector() {
+		throw new UnsupportedOperationException();
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/unmanaged/BPELDeployerSLImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/unmanaged/BPELDeployerSLImpl.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/unmanaged/BPELDeployerSLImpl.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/unmanaged/BPELDeployerSLImpl.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 13, 2003
+ *
+ */
+package org.apache.ode.bped.unmanaged;
+
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.bped.IDeployer;
+import org.apache.ode.bped.IInternalEventDirector;
+import org.apache.ode.definition.IPMDRoot;
+import org.apache.ode.definition.service.DefinitionService;
+import org.apache.ode.definition.service.DefinitionServiceException;
+import org.apache.ode.deployment.DefinitionKey;
+import org.apache.ode.deployment.ResourceDeployer;
+import org.apache.ode.deployment.bpel.BPELDeploy;
+import org.apache.ode.deployment.bpel.DeploymentException;
+import org.apache.ode.engine.ProcessDefinitionKey;
+import org.apache.ode.event.LoadDefinitionEvent;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author charper
+ *
+ */
+public class BPELDeployerSLImpl implements IDeployer {
+	
+	private static Logger logger =
+		Logger.getLogger(BPELDeployerSLImpl.class.getName());
+
+	private DefinitionService ds;
+	private IInternalEventDirector ed;
+	
+	protected BPELDeployerSLImpl(IInternalEventDirector ed){
+		this.ed = ed;
+		this.ds = ed.getProcessService().getInstanceService().getDefinitionService();		
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IDeployer#loadDefinition(java.lang.String, boolean)
+	 */
+	public Collection loadDefinition(String resource, boolean validating) throws BPException {
+		
+		ResourceDeployer rd = new ResourceDeployer(new BPELDeploy(ds));
+		Collection keys = null ;
+		keys = rd.deployResource(resource, validating, null);
+		loadKeys(keys);
+		return keys;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IDeployer#loadDefintion(java.io.InputStream, java.lang.String, boolean)
+	 */
+	public Collection loadDefinition(InputStream is, boolean validating) throws BPException {
+		
+		Collection keys = null ;
+		BPELDeploy deployer = new BPELDeploy(ds);
+		keys = deployer.deployJar(is, validating, null);
+		loadKeys(keys);
+		return keys;
+	}
+	
+	private void loadKeys(Collection keys) {
+		try {
+			// 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);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IDeployer#removeDefinition(java.lang.String)
+	 */
+	public void removeDefinition(String defID) {
+		try {
+			ds.deleteDefinition(new ProcessDefinitionKey(defID));
+		} catch (BPException e) {
+			logger.log(Level.SEVERE,"",e);
+		}		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IDeployer#setStateless(java.lang.String)
+	 */
+	public void setStateless(String defID) throws BPException {
+		IPMDRoot root = ds.getRootDefinition(new ProcessDefinitionKey(defID));
+		root.setIsStateless(true);		
+	}
+
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/unmanaged/EventDirectorSLImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/unmanaged/EventDirectorSLImpl.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/unmanaged/EventDirectorSLImpl.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/unmanaged/EventDirectorSLImpl.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,283 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.bped.unmanaged;
+
+
+import java.util.Stack;
+import java.util.logging.Logger;
+
+import org.apache.ode.bped.DeployTypeEnum;
+import org.apache.ode.bped.EventContext;
+import org.apache.ode.bped.EventDirectorUtil;
+import org.apache.ode.bped.ExternalEventDirectorBase;
+import org.apache.ode.bped.IDeployer;
+import org.apache.ode.bped.IInternalEventDirector;
+import org.apache.ode.correlation.CorrelationService;
+import org.apache.ode.engine.ProcessInstance;
+import org.apache.ode.engine.ProcessService;
+import org.apache.ode.engine.ReturnMessageLocatorHolder;
+import org.apache.ode.event.Fault;
+import org.apache.ode.event.IRequestMessageEvent;
+import org.apache.ode.event.IResponseMessage;
+import org.apache.ode.event.LoadDefinitionEvent;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.lang.ResourceGetter;
+import org.apache.ode.locking.LockingService;
+import org.apache.ode.timerservice.IBPETimer;
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.util.BPException;
+import org.apache.ode.uuid.UUIDService;
+
+/**
+ * A stateless implementation of EventDirector.
+ */
+public class EventDirectorSLImpl extends ExternalEventDirectorBase
+  implements IInternalEventDirector {
+	
+	private static Logger logger = 
+		Logger.getLogger(EventDirectorSLImpl.class.getName());
+		
+	private ProcessService processService;
+	// correlation service
+	private CorrelationService correlationService;
+	private LockingService lockingService;
+	private EventContext currentEventContext;
+	
+	private UUIDService us;
+	
+	// The event director will use a stack to push and pop ProcessInstance
+	// on the evaluation context. This will cause the engine to use depth
+	// first evaluation of the process tree.
+	private Stack processInstanceStack = new Stack();
+	
+	// mark for dead current process 
+	private boolean dead;
+	
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#init(BPEProperties, CorrelationService)
+	 */
+	public void init(BPEProperties props, ProcessService ps, CorrelationService cs,  UUIDService us, LockingService ls) 
+		throws BPException {
+		correlationService = cs;
+		this.us = us;
+		processService = ps;
+		lockingService = ls;
+	}
+	
+	/**
+	 *  @see org.apache.ode.bped.IInternalEventDirector#getCorrelationService()
+	 */
+	public CorrelationService getCorrelationService() {
+		return correlationService;
+	}
+	
+	/**
+	 *  @see org.apache.ode.bped.IInternalEventDirector#getLockingService()
+	 */
+	public LockingService getLockingService() {
+		return lockingService;
+	}
+	
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#getProcessService()
+	 */
+	public ProcessService getProcessService() {
+		return processService;
+	}
+	
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#sendEvent(IRequestMessageEvent, boolean)
+	 */
+	public IResponseMessage sendEvent(IRequestMessageEvent msg, boolean sync)
+		throws BPException {
+	
+			logger.fine("Received message event.");
+			
+			
+			// Create stack-like behaviour for the eventContext
+			// member variable.  A better solution would be to
+			// pass the event context as a parameter through the
+			// call chain.
+			EventContext previousEventContext = currentEventContext;
+			currentEventContext = new EventContext();
+			IResponseMessage responseMessage = this.getCorrelationService().correlateEvent(msg, sync, this);
+			currentEventContext = previousEventContext;
+			
+			return responseMessage;
+	}
+
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#activate(String)
+	 */
+	public void activate(String rootKey, String procKey) throws BPException {
+		
+		EventDirectorUtil.activate(this,rootKey,procKey);
+	}
+
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#terminate(String)
+	 */
+	public void terminate(String rootKey,String procKey)
+		throws BPException {
+			EventDirectorUtil.terminate(this,rootKey,procKey);
+	}
+
+	/**
+	 * @see org.apache.ode.bped.IInternalEventDirector#pause(String)
+	 */
+	public void pause(String rootKey,String procKey) throws BPException {
+		EventDirectorUtil.pause(this,rootKey,procKey);
+	}
+	
+	/**
+	 * Handle status events.
+	 * @param	ae	The admin event.
+	 * @return	A WorkFlowEventResult.
+	 */
+	private void handleStateEvent ( StateEvent se, boolean sync ) 
+		throws BPException {
+			if ( ! sync ) {
+				// if this StateEvent is sent syncronously log and error
+				// since this EventDirector implementation does not start
+				// new threads
+				logger.severe(ResourceGetter.getString("ED_ED_SMT"));
+			}
+			EventDirectorUtil.handleStateEvent(this,
+				processService,se);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#getReturnMessageMetadata()
+	 */
+	public ReturnMessageLocatorHolder getReturnMessageMetadata() {
+		return currentEventContext.getReturnMessageMetadata();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#getMessageEvent()
+	 */
+	public IRequestMessageEvent getMessageEvent() {
+		return currentEventContext.getMessageEvent();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#setReturnMessageMetadata(java.util.Collection)
+	 */
+	public void setReturnMessageMetadata(ReturnMessageLocatorHolder rmlh) {
+		currentEventContext.setReturnMessageMetadata(rmlh);	
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#setMessageEvent(org.apache.ode.event.MessageEvent)
+	 */
+	public void setMessageEvent(IRequestMessageEvent me) {
+		currentEventContext.setMessageEvent(me);
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.engine.IEvaluationContext#release()
+	 */
+	public void release() {
+		us.close();
+		processService.getInstanceService().getDefinitionService().releaseExternalActions();	
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.IEventDirector#getDeployer(org.apache.ode.bped.DeployTypeEnum)
+	 */
+	public IDeployer getDeployer(DeployTypeEnum type) {
+		if ( type.equals(DeployTypeEnum.BPEL)) {
+			return new BPELDeployerSLImpl(this);
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#sendEvent(org.apache.ode.event.StateEvent)
+	 */
+	public void sendEvent(StateEvent me, boolean sync) throws BPException {
+		logger.fine("Recieved state event.");
+		currentEventContext = new EventContext();
+		this.handleStateEvent(me, sync);
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#sendEvent(org.apache.ode.event.LoadDefinitionEvent)
+	 */
+	public void sendEvent(LoadDefinitionEvent me, boolean sync)  throws BPException {
+		EventDirectorUtil.handleLoadDefintionEvent(this,me);
+		
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#sendEvent(org.apache.ode.timerservice.IBPETimer)
+	 */
+	public Fault sendEvent(IBPETimer me, boolean sync) throws BPException {
+		EventDirectorUtil.handleTimerEvent(this,me);
+		return null;
+	}
+			
+	/**
+	 * @see org.apache.ode.engine.IEvaluationContext#addProcessInstance(org.apache.ode.engine.ProcessInstance)
+	 */
+	public void addProcessInstance(ProcessInstance pi) {
+		processInstanceStack.push(pi);
+
+	}
+
+	/**
+	 * @see org.apache.ode.engine.IEvaluationContext#getNextProcessInstance()
+	 */
+	public ProcessInstance getNextProcessInstance() {
+		return ( processInstanceStack.size() > 0 ) ? (ProcessInstance)processInstanceStack.pop() : null;
+	}
+
+	/**
+	 * @see org.apache.ode.engine.IEvaluationContext#initProcessInstanceCollection()
+	 */
+	public void initProcessInstanceCollection() {
+		processInstanceStack.clear();
+	}
+	/**
+	 * @see org.apache.ode.engine.IEvaluationContext#hasMoreProcessInstances()
+	 */
+	public boolean processInstanceCollectionIsEmpty() {
+		return processInstanceStack.isEmpty();
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.apache.ode.engine.IEvaluationContext#setDeadProcess()
+	 */
+	public void setDeadProcess(boolean mark) {
+		dead = mark;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.engine.IEvaluationContext#isDeadProcess()
+	 */
+	public boolean isDeadProcess() {
+		return dead;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.bped.EventDirector#getIInternalEventDirector()
+	 */
+	public IInternalEventDirector getIInternalEventDirector() {
+		return this;
+	}
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/base/CCServiceBase.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/base/CCServiceBase.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/base/CCServiceBase.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/cc/base/CCServiceBase.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,499 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.ode.cc.base;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.bped.EventDirector;
+import org.apache.ode.bped.EventDirectorFactory;
+import org.apache.ode.bped.IInternalEventDirector;
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IBundle;
+import org.apache.ode.cc.data.DefinitionData;
+import org.apache.ode.cc.data.EngineData;
+import org.apache.ode.cc.data.InstanceData;
+import org.apache.ode.cc.data.PartData;
+import org.apache.ode.cc.data.ScopeData;
+import org.apache.ode.cc.data.VariableData;
+import org.apache.ode.cc.service.ICCService;
+import org.apache.ode.definition.IPMDRoot;
+import org.apache.ode.definition.service.DefinitionService;
+import org.apache.ode.engine.StateEnum;
+import org.apache.ode.enginestate.service.EngineStateFactory;
+import org.apache.ode.enginestate.service.IEngineState;
+import org.apache.ode.event.StateEvent;
+import org.apache.ode.instance.IPMIProcess;
+import org.apache.ode.instance.service.InstanceService;
+import org.apache.ode.util.BPException;
+
+
+public class CCServiceBase implements ICCService
+{
+	
+	private static Logger logger = 
+		Logger.getLogger(CCServiceBase.class.getName());
+	
+	private transient IEngineState m_engineStateService = null;
+	//private transient String m_engineName = EngineStateFactory.ENGINE_NAME;
+	public transient EventDirector eventDirector;
+	public transient IInternalEventDirector m_intED;
+	
+	public CCServiceBase () {
+	}
+	
+	public CCServiceBase(Properties props) {
+		eventDirector = (EventDirector)props.get(EventDirector.class.getName());
+		if ( eventDirector == null ) {
+			try {
+				eventDirector = EventDirectorFactory.createEventDirector();
+			} catch (BPException e) {
+				logger.log(Level.SEVERE,"",e);
+			}
+		}
+		m_intED = eventDirector.getIInternalEventDirector();
+	}
+	
+	protected DefinitionService getDefinitionService()
+	{
+	    DefinitionService definitionService =
+	        m_intED.getProcessService().
+	        getInstanceService().
+	        getDefinitionService();
+	    
+	    return definitionService;
+	}
+	
+	protected InstanceService getInstanceService()
+	{
+		InstanceService instanceService = 
+		    m_intED.
+		    getProcessService().
+		    getInstanceService();
+		
+		return instanceService;
+	}
+	
+	
+	protected IEngineState getSS() throws CCException
+	{
+		if ( m_engineStateService == null)
+		{
+			try
+			{
+					m_engineStateService = 
+						EngineStateFactory.getEngineState("BPE_ENGINE_"+ eventDirector.hashCode() );
+			} catch (BPException e)
+			{
+				throw new CCException(e);
+			}
+		}
+		
+		return m_engineStateService;
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Collection getDefinitionData() throws CCException
+	{
+		Collection defs;
+		Collection defData;
+		try
+		{
+			defs =
+				getDefinitionService().
+				getRootDefinitions();
+		
+			defData = 
+			DataExtractor.getDefinitionData(defs);
+		}
+		catch( BPException e)
+		{
+			throw new CCException( e );
+		}
+		return defData;
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Collection getInstancesData(String iBPDefinitionID)
+			throws CCException
+	{
+		Collection returnCollection;
+		try
+		{
+			Collection instances = 
+			    getInstanceService().
+			    getRootInstances(iBPDefinitionID);
+			
+			returnCollection = 
+				DataExtractor.getInstanceData( instances );
+		} catch (BPException e)
+		{
+			throw new CCException( e );
+		}
+		if ( returnCollection == null )
+		{
+			return new LinkedList();
+		}
+		else
+		{
+			return returnCollection;
+		}
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void cleanupNow() throws CCException
+	{
+		// TODO Auto-generated method stub
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void cleanCompletedSince(Date iDate) throws CCException
+	{
+		// TODO Auto-generated method stub
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void pauseEngine() throws CCException
+	{
+		// TODO Auto-generated method stub
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void resumeEngine() throws CCException
+	{
+		// TODO Auto-generated method stub
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Collection deployBundle(IBundle source)
+			throws CCException
+	{
+		return null;
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public InstanceData getInstanceData(String instanceID) throws CCException
+	{
+		try
+        {
+            IPMIProcess instance =
+                getInstanceService().getRootInstance(instanceID);
+            
+            InstanceData instanceData = 
+                DataExtractor.getInstanceData( instance );
+            
+            return instanceData;
+
+        } catch (BPException e)
+        {
+            throw new CCException(e);
+        }    
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public DefinitionData getDefinitionData(String definitionID)
+			throws CCException
+	{
+		return null;
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void deactivateDefinition(DefinitionData data) throws CCException
+	{
+		try
+        {
+            getDefinitionService().
+              deactivateDefinition( data.getID() );
+        
+        } catch (BPException e)
+        {
+            throw new RuntimeException(e);
+        }
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void activateDefinition(DefinitionData data) throws CCException
+	{
+	    try
+        {
+            getDefinitionService().
+              activateDefinition( data.getID() );
+        
+        } catch (BPException e)
+        {
+            throw new RuntimeException(e);
+        }
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void removeDefinition(DefinitionData data) throws CCException
+	{
+		  try
+        {
+            getDefinitionService().deleteDefinition( data.getID() );
+        } catch (BPException e)
+        {
+            throw new CCException(e);
+        }
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	
+	public EngineData getEngineData() throws CCException
+	{
+		try {
+			return DataExtractor.getEngineData(getSS());
+		} catch (BPException e) {
+			throw new CCException(e);
+		}
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public DefinitionData getDefinitionForInstance(String instanceID)
+			throws CCException
+	{
+		// TODO Auto-generated method stub
+		return null;
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void pauseInstance(InstanceData data) throws CCException
+	{
+		try
+        {
+            getInstanceService().pauseRootInstance( data.getID());
+        } catch (BPException e)
+        {
+            throw new CCException( e );
+        }
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void terminateInstance(InstanceData data) throws CCException
+	{
+		
+		if ( logger.isLoggable(Level.FINE)) {
+			logger.fine("Terminating process:"+data.getID());
+		}
+		StateEvent se = new StateEvent(data.getID(),data.getID(),StateEnum.TERMINATED);
+		try {
+			eventDirector.sendEvent(se,true);
+		} catch (BPException e) {
+			throw new CCException( e );
+		}
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void resumeInstance(InstanceData data) throws CCException
+	{
+		try
+        {
+            getInstanceService().resumeRootInstance(data.getID());
+        } catch (BPException e)
+        {
+            throw new CCException(e);
+        }
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void removeInstance(InstanceData data) throws CCException
+	{
+		// TODO Auto-generated method stub
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public ScopeData getContextScopeData(InstanceData data) throws CCException
+	{
+		return null;
+
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Collection getChildScopes(ScopeData data) throws CCException
+	{
+		
+		return new LinkedList();
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Collection getVariables(ScopeData data) throws CCException
+	{
+		return new LinkedList();
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Collection getRegistrations(InstanceData data) throws CCException
+	{	
+	    return new LinkedList();
+	    /*
+		try
+		{
+			LinkedList returnRegistrations = new LinkedList();
+			IPMIProcess pi = m_intED.getProcessService().getInstanceService().getRootInstance(data.getID());
+			Collection pendingRegistrations = m_intED.getCorrelationService().getRegistrations(pi);
+			
+			Iterator iter = pendingRegistrations.iterator();
+			while( iter.hasNext() )
+			{
+				IRegistration reg =
+					( IRegistration ) ( iter.next() );
+				
+				String opid = reg.getOpId();
+				//String defid = reg.getDefId();
+				String defid = data.getDefinitionID();
+				
+				IPMDRoot pmdRoot = m_intED.getProcessService().getInstanceService().getDefinitionService().getRootDefinition(defid);
+
+				IPMDOperation pmdOperation = pmdRoot.getOperation(opid);
+				IStaticKey staticKey = pmdOperation.getKey();
+				
+				String registrationName = null;
+				String opName = null;
+				String pType = null;
+				String namespace = null;
+				String dynamicKey = reg.getKeyValue();
+				
+				if ( staticKey instanceof BPELStaticKey )
+				{
+					BPELStaticKey bpelStaticKey = ( BPELStaticKey ) ( staticKey );
+					opName = bpelStaticKey.getOperation();
+					registrationName = opName;
+					pType = bpelStaticKey.getPortType();
+					namespace = bpelStaticKey.getTargetNamespace();			
+				}
+				
+				RegistrationData rd = new RegistrationData( data, registrationName, 
+						opName, pType, namespace, dynamicKey );
+				returnRegistrations.add( rd );
+			}
+			return returnRegistrations;
+
+		} catch (BPException e)
+		{
+			throw new CCException( e );
+		} 
+		*/
+
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Collection getPartData(VariableData data) throws CCException
+	{
+		return new LinkedList();
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void cleanup(Date completionDate) throws CCException
+	{
+		// TODO Auto-generated method stub
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Object getPartValue(PartData data) throws CCException
+	{
+		return null;
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public void setAutomaticCleanup(boolean automaticCleanup) throws CCException
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+
+	/**
+	 * @ejb:interface-method
+	 */
+	public Map getDefinitionStatistics(DefinitionData data) throws CCException
+	{
+		return new HashMap();
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Map getEngineStatistics(EngineData data) throws CCException
+	{
+		return new HashMap();
+	}
+	/**
+	 * @ejb:interface-method
+	 */
+	public Map getInstanceStatistics(InstanceData data) throws CCException
+	{
+		return new HashMap();
+	}
+
+	/**
+	 * @ejb:interface-method
+	 */
+    public Collection getProcessCreatingOperations(DefinitionData data) 
+      throws CCException
+    {
+        Collection operationData = null;
+        try
+        {
+            IPMDRoot root = getDefinitionService().getRootDefinition( data.getID());
+            if ( root != null )
+            {
+                Collection operations = root.getInstanceCreatingOperations();
+                operationData = DataExtractor.createOperationData(operations); 
+            }
+        } catch (BPException e)
+        {
+            throw new CCException(e);
+        }
+        
+        if ( operationData == null )
+        {
+            operationData = new LinkedList();
+        }
+        return operationData;
+    }
+}