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 [29/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/event/Fault.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/Fault.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/Fault.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/Fault.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import java.io.Serializable;
+import java.util.Iterator;
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+public class Fault implements Serializable
+{
+ static final long serialVersionUID = 1485346850018321499L;
+
+ private String m_faultActor;
+ private String m_faultCode;
+ private String m_faultString;
+ private Exception m_faultException;
+
+ public void setFaultActor( String iActor )
+ {
+ m_faultActor = iActor;
+ }
+
+ public void setFaultCode( String iFaultCode )
+ {
+ m_faultCode = iFaultCode;
+ }
+
+ public void setFaultString( String iFaultString )
+ {
+ m_faultString = iFaultString;
+ }
+
+ public String getFaultActor()
+ {
+ return m_faultActor;
+ }
+
+ public String getFaultCode()
+ {
+ return m_faultCode;
+ }
+
+ public String getFaultString()
+ {
+ return m_faultString;
+ }
+
+ public Exception getFaultException()
+ {
+ return m_faultException;
+ }
+
+ public void setFaultException( Exception e )
+ {
+ m_faultException = e;
+ }
+
+ public String toString(){
+ StringBuffer buf =
+ new StringBuffer("Fault Actor:" + m_faultActor + " " +
+ "Fault Code:" + m_faultCode + " " +
+ "Fault String:" + m_faultString + "\n");
+ if ( this.getFaultException() instanceof BPRuntimeException ) {
+ Iterator it = ((BPRuntimeException)this.getFaultException()).getMessageParts().keySet().iterator();
+ while (it.hasNext()) {
+ String name = it.next().toString();
+ try {
+ buf.append(
+ "FaultPart \""
+ + name
+ + "\" value: "
+ + ((BPRuntimeException)this.getFaultException()).getMessageParts().get(name).toString()
+ + "\n");
+ } catch (Exception e) {
+ buf.append(
+ "Part \"" + name + "\" value: " + e.getLocalizedMessage());
+ }
+ }
+
+ }
+ return buf.toString();
+
+// return "Fault Actor:" + m_faultActor + " " +
+// "Fault Code:" + m_faultCode + " " +
+// "Fault String:" + m_faultString;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/***********************************************************************
+ * Module: Event.java
+ * Author: waterman
+ * Purpose: Defines the Interface Event
+ ***********************************************************************/
+
+package org.apache.ode.event;
+
+
+
+
+/**
+ * Identifies the Event type
+ */
+
+public interface IEvent
+{
+};
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IInternalEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IInternalEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IInternalEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IInternalEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import java.util.Properties;
+
+import org.apache.ode.engine.IEvaluationContext;
+import org.apache.ode.engine.IProcessCallBack;
+import org.apache.ode.engine.ProcessInstance;
+import org.apache.ode.util.BPException;
+
+public interface IInternalEvent extends IEvent
+{
+ /** initialize the attributes of the event
+ *
+ * @param properties */
+ void init(java.util.Properties attributes) throws EventException;
+
+ /** apply the Event attributes to a process instance
+ *
+ * @param a process instance interface
+ */
+ void apply(ProcessInstance processInstance, IEvaluationContext ec, IProcessCallBack pcb) throws BPException;
+
+ /** Get Event attributes
+ *
+ */
+ Properties getAttributes();
+}
+
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IReadableMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IReadableMessage.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IReadableMessage.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IReadableMessage.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import java.util.Map;
+
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.util.BPException;
+
+public interface IReadableMessage
+{
+ public IInteraction getPart( String iPartName )
+ throws BPException;
+
+ public IInteraction getHeaderElement( String iName )
+ throws BPException;
+
+ public Map getParts();
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IRequestMessageEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IRequestMessageEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IRequestMessageEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IRequestMessageEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import org.apache.ode.util.BPException;
+
+public interface IRequestMessageEvent extends IReadableMessage, IEvent
+{
+ public IStaticKey getStaticKey() throws BPException;
+
+ public IResponseMessage createResponseMessage() throws BPException;
+
+}
+
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IResponseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IResponseMessage.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IResponseMessage.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IResponseMessage.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import org.apache.ode.util.BPException;
+
+public interface IResponseMessage extends IReadableMessage, IWriteableMessage
+{
+
+ public void setFault( Fault iFault )
+ throws BPException;
+
+ public Fault getFault()
+ throws BPException;
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IStaticKey.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IStaticKey.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IStaticKey.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IStaticKey.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+public interface IStaticKey
+{
+ public String toString();
+}
+
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ITimerEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ITimerEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ITimerEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ITimerEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,55 @@
+/*
+ * 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 25, 2003
+ *
+ */
+package org.apache.ode.event;
+
+import java.io.Serializable;
+
+/**
+ * @author charper
+ *
+ */
+public interface ITimerEvent extends IEvent, Serializable {
+
+ static final long serialVersionUID = -561820493272137190L;
+
+ /**
+ * @return
+ */
+ public String getRootId();
+
+ /**
+ *
+ * @return
+ */
+ public String getProcId();
+
+ /**
+ *
+ * @return
+ */
+ public String getDefId();
+
+ /**
+ *
+ * @return
+ */
+ public String getRootDefId();
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IWriteableMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IWriteableMessage.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IWriteableMessage.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/IWriteableMessage.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.util.BPException;
+
+public interface IWriteableMessage
+{
+ public void setPart(String iPartName,
+ IInteraction iInteraction) throws BPException;
+
+ public IInteraction removePart( String iPartName )
+ throws BPException;
+
+ public void setHeaderElement( String iName, IInteraction iHeaderInteraction )
+ throws BPException;
+
+ public IInteraction removeHeaderElement( String iName )
+ throws BPException;
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/LoadDefinitionEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/LoadDefinitionEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/LoadDefinitionEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/LoadDefinitionEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jul 17, 2003
+ */
+package org.apache.ode.event;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+import org.apache.ode.engine.ProcessInstance;
+
+/**
+ * @author charper
+ */
+public class LoadDefinitionEvent implements IEvent, Serializable {
+
+ static final long serialVersionUID = 2176921731100421958L;
+
+ private String defname;
+
+ public LoadDefinitionEvent(){
+ }
+
+ public LoadDefinitionEvent(String defname){
+ this.defname = defname;
+ }
+
+ /**
+ * The defintion name to load.
+ * @param defname
+ */
+ public void setDefinitionName(String defname){
+ this.defname = defname;
+ }
+ /**
+ * The defintion name to load.
+ * @return
+ */
+ public String getDefinitionName(){
+ return defname;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.event.Event#init(java.util.Properties)
+ */
+ public void init(Properties attributes) throws EventException {
+
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.event.Event#apply(org.apache.ode.engine.ProcessInstance)
+ */
+ public void apply(ProcessInstance processInstance) throws EventException {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.event.Event#getAttributes()
+ */
+ public Properties getAttributes() {
+ return null;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/NoResponseAllowedException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/NoResponseAllowedException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/NoResponseAllowedException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/NoResponseAllowedException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+public class NoResponseAllowedException extends EventException
+{
+
+ static final long serialVersionUID = -6843790847686908236L;
+
+ public NoResponseAllowedException() {
+ super("NO_RESPONSE_EXCEPTION",null);
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/OperationMissingException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/OperationMissingException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/OperationMissingException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/OperationMissingException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+public class OperationMissingException extends EventException
+{
+
+ static final long serialVersionUID = 3790333343494608842L;
+
+ public OperationMissingException() {
+ super("NO_OPERATION_EXCEPTION",null);
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ProcessInstanceEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ProcessInstanceEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ProcessInstanceEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ProcessInstanceEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+import org.apache.ode.engine.IEvaluationContext;
+import org.apache.ode.engine.IProcessCallBack;
+import org.apache.ode.engine.ProcessInstance;
+import org.apache.ode.util.BPException;
+
+
+/**
+ * @author waterman
+ *
+ */
+public class ProcessInstanceEvent implements IInternalEvent, Serializable {
+
+ static final long serialVersionUID = 6822192926494036924L;
+
+ public static String PROCESS_KEY_NAME = "ProcessKey";
+ private String pKey;
+ private String rootKey;
+
+ public ProcessInstanceEvent(String rootKey, String pKey) {
+ this.pKey = pKey;
+ this.rootKey = rootKey;
+ }
+
+ public ProcessInstanceEvent() {
+ pKey = null;
+ }
+
+ /**
+ * @see org.apache.ode.event.Event#init(Properties)
+ */
+ public void init(Properties attributes) throws EventException {
+ Object obj = attributes.get(PROCESS_KEY_NAME);
+
+ if ( obj instanceof String ) {
+ pKey = (String)obj;
+ } else {
+ throw new EventException("INVALID_PROCESS_ID",new Object[] {pKey});
+ }
+ }
+
+ /**
+ * @see org.apache.ode.event.Event#apply(IPMIProcess_Mutate)
+ */
+ public void apply(ProcessInstance processInstance, IEvaluationContext ec, IProcessCallBack pcb) throws BPException {
+
+ if ( pKey != null && !pKey.equals(processInstance.getKey()) ) {
+ throw new EventException("INVALID_PROCESS_ID",new Object[] {pKey});
+ }
+
+ }
+
+ /**
+ * @see org.apache.ode.event.Event#getAttributes()
+ */
+ public Properties getAttributes() {
+ Properties retVal = new Properties();
+ retVal.put(PROCESS_KEY_NAME,pKey);
+ return retVal;
+ }
+
+ /** get the instance key
+ */
+ public String getProcessInstanceKey() {
+ return pKey;
+ }
+
+ /** get the instance key
+ */
+ public String getRootProcessInstanceKey() {
+ return rootKey;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ReadOnlyEventException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ReadOnlyEventException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ReadOnlyEventException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/ReadOnlyEventException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+public class ReadOnlyEventException extends EventException
+{
+ static final long serialVersionUID = 6969059915601172358L;
+
+ public ReadOnlyEventException() {
+ super("READ_ONLY_EVENT",null);
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SOAPRequestMessageEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SOAPRequestMessageEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SOAPRequestMessageEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SOAPRequestMessageEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,268 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.message.SOAPEnvelope;
+
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.interaction.InteractionFactory;
+import org.apache.ode.util.BPException;
+
+public class SOAPRequestMessageEvent implements IRequestMessageEvent
+{
+
+ private SOAPEnvelope m_responseEnvelope;
+ private SOAPEnvelope m_requestEnvelope;
+
+ transient private InteractionFactory m_interactionFactory;
+ transient private IInteraction m_headerInteraction;
+
+// transient private SOAPResponseMessage m_soapResponseMessage;
+ transient private BPELStaticKey m_staticKey;
+ transient private IResponseMessage m_responseMessage;
+ transient private boolean m_envelopeParsed;
+
+ transient private HashMap m_messagePartInteractionMap;
+ transient private String m_portType;
+ transient private String m_operation;
+// transient private String m_targetNamespace;
+ transient private HashMap m_headerElementInteractionMap;
+
+ public SOAPRequestMessageEvent(
+ SOAPEnvelope iRequestEnvelope,
+ SOAPEnvelope iResponseEnvelope)
+ {
+ m_requestEnvelope = iRequestEnvelope;
+ m_responseEnvelope = iResponseEnvelope;
+ }
+
+ public Map getParts()
+ {
+ return m_messagePartInteractionMap;
+ }
+
+ private void setMessagePartInteraction(
+ String iPartName,
+ IInteraction iMessagePartInteraction)
+ {
+ if (m_messagePartInteractionMap == null)
+ {
+ m_messagePartInteractionMap = new HashMap();
+ }
+
+ m_messagePartInteractionMap.put(iPartName,
+ iMessagePartInteraction);
+ }
+
+ private void setHeaderElementInteraction( String iHeaderElementName,
+ IInteraction iHeaderElementInteraction )
+ {
+ if ( m_headerElementInteractionMap == null )
+ {
+ m_headerElementInteractionMap = new HashMap();
+ }
+
+ m_headerElementInteractionMap.put(iHeaderElementName,
+ iHeaderElementInteraction);
+ }
+
+ private IInteraction getMessagePartInteraction(String iPartName)
+ {
+ return (IInteraction) m_messagePartInteractionMap.get(iPartName);
+ }
+
+ private String getPortType() throws BPException
+ {
+ if (m_portType == null)
+ {
+ marshalFromSOAPEnvelope();
+ }
+ return m_portType;
+ }
+
+ private void setPortType(String iPortType)
+ {
+ m_portType = iPortType;
+ }
+
+ private String getOperation() throws BPException
+ {
+ if (m_operation == null)
+ {
+ marshalFromSOAPEnvelope();
+ }
+ return m_operation;
+ }
+
+ private void setOperation(String iOperation)
+ {
+ m_operation = iOperation;
+ }
+
+ private void marshalFromSOAPEnvelope() throws BPException
+ {
+ try
+ {
+ if (m_envelopeParsed == false)
+ {
+ marshalFromSOAPBody(m_requestEnvelope.getBody());
+ marshalFromSOAPHeader(m_requestEnvelope.getHeader());
+ m_envelopeParsed = true;
+ }
+ } catch (SOAPException soapException)
+ {
+ throw new EventException("NATIVE_EXCEPTION",new Object[] {"SOAPException"},soapException);
+ }
+ }
+
+ private void marshalFromSOAPBody(SOAPBody iBody) throws BPException
+ {
+ Iterator iterator = iBody.getChildElements();
+ SOAPElement operationElement = null;
+
+ if (iterator.hasNext())
+ {
+ operationElement = (SOAPElement) (iterator.next());
+ setOperation(operationElement.getElementName().getLocalName());
+ } else
+ {
+ throw new OperationMissingException();
+ }
+
+ iterator = operationElement.getChildElements();
+ SOAPElement partElement = null;
+
+ while (iterator.hasNext())
+ {
+ partElement = (SOAPElement) iterator.next();
+ marshalFromMessagePart(partElement);
+ }
+ }
+
+ private void marshalFromSOAPHeader(SOAPHeader iHeader) throws BPException
+ {
+ Iterator iterator = iHeader.getChildElements();
+ while( iterator.hasNext() )
+ {
+ SOAPElement headerElement =
+ (SOAPElement)iterator.next();
+ String localName =
+ headerElement.getElementName().getLocalName();
+ if ( localName.equals("To"))
+ {
+ setPortType( headerElement.getValue() );
+ }
+
+ IInteraction headerElementInteraction =
+ this.createInteraction(headerElement);
+ setHeaderElementInteraction(localName,
+ headerElementInteraction);
+
+ }
+ m_headerInteraction = createInteraction(iHeader);
+ }
+
+ private void marshalFromMessagePart(SOAPElement iMessagePart)
+ throws BPException
+ {
+ String partName = iMessagePart.getElementName().getLocalName();
+ IInteraction interaction = createInteraction(iMessagePart);
+ setMessagePartInteraction(partName, interaction);
+ }
+
+ private IInteraction createInteraction(SOAPElement iElement)
+ throws BPException
+ {
+ MessageElement messageElement = (MessageElement) (iElement);
+ String elementString = messageElement.toString();
+ IInteraction interactionObject =
+ getInteractionFactory().createXMLInteraction(
+ elementString.getBytes());
+
+ return interactionObject;
+
+ }
+
+ private InteractionFactory getInteractionFactory()
+ {
+ if (m_interactionFactory == null)
+ {
+ m_interactionFactory = InteractionFactory.newInstance();
+ }
+
+ return m_interactionFactory;
+ }
+
+ public IStaticKey getStaticKey() throws BPException
+ {
+ m_staticKey = new BPELStaticKey();
+ m_staticKey.setOperation(getOperation());
+ m_staticKey.setPortType(getPortType());
+
+ return m_staticKey;
+ }
+
+ public SOAPEnvelope getSOAPRequestEnvelope()
+ {
+ return m_requestEnvelope;
+ }
+
+ public IInteraction getPart(String iPartName) throws BPException
+ {
+ return getMessagePartInteraction( iPartName );
+ }
+
+ public IInteraction getHeader()
+ {
+ return m_headerInteraction;
+ }
+
+ public IInteraction getHeaderElement( String iHeaderElementName )
+ {
+ IInteraction returnInteraction = ( IInteraction )
+ ( m_headerElementInteractionMap.get( iHeaderElementName ) );
+
+ return returnInteraction;
+ }
+
+ public IResponseMessage createResponseMessage()
+ throws BPException
+ {
+ if (m_responseEnvelope == null)
+ {
+ throw new NoResponseAllowedException();
+ }
+
+ if (m_responseMessage == null)
+ {
+ m_responseMessage =
+ new SOAPResponseMessage(m_responseEnvelope);
+ }
+
+ return m_responseMessage;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SOAPResponseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SOAPResponseMessage.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SOAPResponseMessage.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SOAPResponseMessage.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import java.util.Iterator;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPHeader;
+
+import org.apache.axis.message.SOAPBodyElement;
+import org.apache.axis.message.SOAPHeaderElement;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.interaction.XMLInteractionObject;
+import org.apache.ode.util.BPException;
+
+public class SOAPResponseMessage extends SimpleResponseMessage
+{
+
+ static final long serialVersionUID = 1417189686562681151L;
+
+// private IInteraction m_headerInteraction;
+ private SOAPEnvelope m_responseEnvelope;
+ private boolean m_isDirty;
+
+
+ public SOAPResponseMessage( SOAPEnvelope iResponseEnvelope )
+ {
+ m_responseEnvelope = iResponseEnvelope;
+ }
+
+ public SOAPEnvelope getResponseEnvelope() throws BPException
+ {
+ marshalToEnvelope();
+ return m_responseEnvelope;
+ }
+
+ private void scrubEnvelope() throws BPException
+ {
+ try
+ {
+ scrubBody( m_responseEnvelope.getBody());
+ scrubHeader( m_responseEnvelope.getHeader() );
+ }
+ catch( Exception e )
+ {
+ throw new EventException("NATIVE_EXCEPTION",new Object[] {"SOAPException"},e);
+ }
+ }
+
+ private void scrubBody(SOAPBody iBody) throws BPException
+ {
+ iBody.detachNode();
+ }
+
+ private void scrubHeader(SOAPHeader iHeader) throws BPException
+ {
+ iHeader.detachNode();
+ }
+
+ public void setHeaderElement(String iName,
+ IInteraction iHeaderInteraction)
+ throws BPException
+ {
+ m_isDirty = true;
+ if ( !( iHeaderInteraction instanceof XMLInteractionObject ) )
+ {
+ throw new UnsupportedInteractionTypeException();
+ }
+ super.setHeaderElement( iName, iHeaderInteraction );
+ }
+
+ public void setPart(String iPartName,
+ IInteraction iInteraction)
+ throws BPException
+ {
+ m_isDirty = true;
+ if ( !( iInteraction instanceof XMLInteractionObject ) )
+ {
+ throw new UnsupportedInteractionTypeException();
+ }
+
+ super.setPart( iPartName, iInteraction );
+ }
+
+ public void marshalToEnvelope() throws BPException
+ {
+ try
+ {
+ if (m_isDirty)
+ {
+ scrubEnvelope();
+ Iterator iterator = getPartMap().values().iterator();
+ SOAPBody body = m_responseEnvelope.addBody();
+
+ // Marshal the body parts into the envelope.
+ while (iterator.hasNext())
+ {
+ XMLInteractionObject interaction =
+ (XMLInteractionObject) (iterator.next());
+
+ Document document = interaction.getDocument();
+
+ SOAPBodyElement se = new SOAPBodyElement(
+ document.getDocumentElement() );
+
+ body.addChildElement( se );
+ }
+
+ // Marshal the header into the envelope.
+ if ( hasHeaders())
+ {
+ SOAPHeader header = m_responseEnvelope.addHeader();
+ iterator = getHeaderMap().values().iterator();
+ while( iterator.hasNext() )
+ {
+ XMLInteractionObject headerInteraction
+ = ( XMLInteractionObject )( iterator.next() );
+
+ Document headerDocument = headerInteraction.getDocument();
+ Element headerElement = headerDocument.getDocumentElement();
+
+ SOAPHeaderElement she = new SOAPHeaderElement(
+ headerElement);
+
+ header.addChildElement( she );
+ }
+ }
+
+ // Marshal the fault into the SOAP envelope
+ Fault fault = getFault();
+ if ( fault != null )
+ {
+ SOAPFault soapFault = body.addFault();
+ soapFault.setFaultActor( fault.getFaultActor() );
+ soapFault.setFaultCode( fault.getFaultCode() );
+ soapFault.setFaultString( fault.getFaultString() );
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new EventException("NATIVE_EXCEPTION",new Object[] {"Exception"},e);
+ }
+ }
+
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleMessage.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleMessage.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleMessage.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.util.BPException;
+
+public abstract class SimpleMessage implements IReadableMessage, IWriteableMessage, Serializable
+{
+
+ static final long serialVersionUID = 8129807586314512296L;
+
+
+ private HashMap m_partMap;
+ private HashMap m_headerMap;
+
+ public void setPart(String iPartName,
+ IInteraction iInteraction)
+ throws BPException
+ {
+ getPartMap().put( iPartName, iInteraction );
+ }
+
+ public Map getParts()
+ {
+ return getPartMap();
+ }
+
+ protected HashMap getPartMap()
+ {
+ if ( m_partMap == null)
+ {
+ m_partMap = new HashMap();
+ }
+ return m_partMap;
+ }
+
+ protected HashMap getHeaderMap()
+ {
+ if ( m_headerMap == null )
+ {
+ m_headerMap = new HashMap();
+ }
+ return m_headerMap;
+ }
+
+ protected boolean hasHeaders()
+ {
+ return ( m_headerMap != null );
+ }
+
+ public void setHeaderElement(String iName,
+ IInteraction iHeaderInteraction)
+ throws BPException
+ {
+
+ getHeaderMap().put( iName, iHeaderInteraction );
+ }
+
+
+ public IInteraction getPart(String iPartName) throws BPException
+ {
+ return ( IInteraction ) ( getPartMap().get( iPartName ) );
+ }
+
+ public IInteraction getHeaderElement(String iName) throws BPException
+ {
+ return ( IInteraction ) ( getHeaderMap().get( iName ) );
+ }
+
+ public IInteraction removePart(String iPartName) throws BPException
+ {
+ return ( IInteraction ) ( getPartMap().remove( iPartName ));
+ }
+
+ public IInteraction removeHeaderElement(String iName) throws BPException
+ {
+ return ( IInteraction ) ( getHeaderMap().get( iName ) );
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleRequestMessageEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleRequestMessageEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleRequestMessageEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleRequestMessageEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import org.apache.ode.util.BPException;
+
+public class SimpleRequestMessageEvent
+ extends SimpleMessage
+ implements IRequestMessageEvent
+{
+
+ static final long serialVersionUID = -1669122486254031924L;
+
+
+ private IStaticKey m_staticKey = null;
+
+ public void setStaticKey( IStaticKey iKey )
+ {
+ m_staticKey = iKey;
+ }
+
+ public IStaticKey getStaticKey() throws BPException
+ {
+ return m_staticKey;
+ }
+
+ public IResponseMessage createResponseMessage() throws BPException
+ {
+ return new SimpleResponseMessage();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleResponseMessage.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleResponseMessage.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleResponseMessage.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/SimpleResponseMessage.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import java.util.Iterator;
+
+
+public class SimpleResponseMessage extends SimpleMessage implements IResponseMessage
+{
+
+ static final long serialVersionUID = 8801756730504584727L;
+
+ private Fault m_fault;
+
+ public boolean hasFault()
+ {
+ if ( getFault() == null )
+ {
+ return false;
+ }
+ return true;
+ }
+
+ public Fault getFault()
+ {
+ return m_fault;
+ }
+
+ public void setFault( Fault iFault )
+ {
+ m_fault = iFault;
+ }
+
+ public String toString() {
+ StringBuffer buf =
+ new StringBuffer("Fault Message:" + this.getFault() + "\n");
+ Iterator it = this.getPartMap().keySet().iterator();
+ while (it.hasNext()) {
+ String name = it.next().toString();
+ try {
+ buf.append(
+ "Part \""
+ + name
+ + "\" value: "
+ + this.getPart(name).toString()
+ + "\n");
+ } catch (Exception e) {
+ buf.append(
+ "Part \"" + name + "\" value: " + e.getLocalizedMessage());
+ }
+
+ }
+ return buf.toString();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/StateEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/StateEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/StateEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/StateEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+
+import java.io.Serializable;
+import java.util.Properties;
+
+import org.apache.ode.engine.IEvaluationContext;
+import org.apache.ode.engine.IProcessCallBack;
+import org.apache.ode.engine.ProcessInstance;
+import org.apache.ode.engine.StateEnum;
+import org.apache.ode.util.BPException;
+
+
+/**
+ * @author waterman
+ *
+ * The StateEvent changes the state of a business process. This is an internal
+ * event and will not be exposed to external clients.
+ *
+ * It is used by the BPEE to start a parallel thread of execution. The
+ * BPEE passes a StateEvent on the BPED callback interface when it needs to
+ * start a process.
+ *
+ */
+public class StateEvent extends ProcessInstanceEvent implements Serializable {
+
+ static final long serialVersionUID = -538982297121415925L;
+
+ public static String PROCESS_STATE_NAME = "ProcessState";
+ private StateEnum state;
+
+ /**
+ * Constructor for StateEvent.
+ *
+ * @param pKey - the process instance on which a state change is being
+ * requested
+ * @param state - the state being applied to the pKey
+ */
+ public StateEvent(String rootKey, String pKey, StateEnum state) {
+ super(rootKey, pKey);
+ this.state = state;
+ }
+
+ public StateEvent() {
+ super();
+ state = null;
+ }
+
+ /** @param properties */
+ public void init(java.util.Properties attributes) throws EventException {
+ super.init(attributes);
+
+ Object obj = attributes.get(PROCESS_STATE_NAME);
+
+ if ( obj instanceof StateEnum ) {
+ state = (StateEnum)obj;
+ } else {
+ throw new EventException("INVALID_PROCESS_STATE",new Object[] {obj});
+ }
+
+ }
+
+ public void apply(ProcessInstance processInstance, IEvaluationContext ec, IProcessCallBack pcb) throws BPException {
+ // make sure the process matches it's intended target
+ super.apply(processInstance,ec, pcb);
+
+ processInstance.setState(state);
+
+ if ( state.equals(StateEnum.TERMINATED)) {
+ processInstance.terminate(ec,pcb);
+// mark the process for clean up
+ ec.getProcessService().getInstanceService().
+ getInstance(
+ processInstance.getRootKey(),
+ processInstance.getRootKey()).setMarkedForCleanUp(true);
+ }
+
+ }
+
+ /**
+ * @see org.apache.ode.event.Event#getAttributes()
+ */
+ public Properties getAttributes() {
+ Properties retVal = super.getAttributes();
+ retVal.put(PROCESS_STATE_NAME,state);
+ return retVal;
+ }
+
+ /**
+ * Returns the state.
+ * @return StateEnum
+ */
+ public StateEnum getState() {
+ return state;
+ }
+
+ /**
+ * Set the state
+ */
+ public void setState(StateEnum state) {
+ this.state = state;
+ }
+
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/TimerEvent.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/TimerEvent.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/TimerEvent.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/TimerEvent.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,94 @@
+/*
+ * 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 25, 2003
+ *
+ */
+package org.apache.ode.event;
+
+/**
+ * @author charper
+ *
+ */
+public class TimerEvent implements ITimerEvent {
+
+ static final long serialVersionUID = -4310489553355459222L;
+
+ String rootId;
+ String procId;
+ String defId;
+ String rootDefId;
+
+ /**
+ * @return Returns the rootDefId.
+ */
+ public String getRootDefId() {
+ return rootDefId;
+ }
+ /**
+ * @param rootDefId The rootDefId to set.
+ */
+ public void setRootDefId(String rootDefId) {
+ this.rootDefId = rootDefId;
+ }
+ /**
+ * @return Returns the defId.
+ */
+ public String getDefId() {
+ return defId;
+ }
+ /**
+ * @param defId The defId to set.
+ */
+ public void setDefId(String defId) {
+ this.defId = defId;
+ }
+ public TimerEvent ( String rootId, String procId, String rootDefId, String defId ) {
+ this.rootId = rootId;
+ this.procId = procId;
+ this.rootDefId = rootDefId;
+ this.defId = defId;
+ }
+
+ /**
+ * @return
+ */
+ public String getProcId() {
+ return procId;
+ }
+
+ /**
+ * @return
+ */
+ public String getRootId() {
+ return rootId;
+ }
+
+ /**
+ * @param string
+ */
+ public void setProcId(String string) {
+ procId = string;
+ }
+
+ /**
+ * @param string
+ */
+ public void setRootId(String string) {
+ rootId = string;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/UnsupportedInteractionTypeException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/UnsupportedInteractionTypeException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/UnsupportedInteractionTypeException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/event/UnsupportedInteractionTypeException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.event;
+public class UnsupportedInteractionTypeException extends EventException
+{
+ static final long serialVersionUID = 2282121520764580017L;
+
+
+ public UnsupportedInteractionTypeException() {
+ super("UNSUPPORTED_INTERACTION_TYPE",null);
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/info/PackageInfoBean.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/info/PackageInfoBean.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/info/PackageInfoBean.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/info/PackageInfoBean.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,90 @@
+/*
+ * 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.info;
+
+import java.util.Properties;
+//import java.util.logging.Logger;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.naming.Binding;
+import javax.naming.InitialContext;
+import javax.naming.NamingEnumeration;
+
+/**
+ * This bean holds properties about the package.
+ * @ejb:bean
+ * type="Stateless"
+ * name="PackageInfo"
+ * jndi-name="BPE/PackageInfo"
+ * view-type="both"
+ * local-jndi-name="BPE/PackageInfoLocal"
+ *
+ * @ejb.transaction type="Supports"
+ *
+ * @ejb.env-entry
+ * name="PACKAGE_NAME"
+ * value="BPE"
+ * @ejb.env-entry
+ * name="PACKAGE_EAR_NAME"
+ * value="BPE.ear"
+ * @ejb.env-entry
+ * name="TABLE_PREFIX"
+ * value="BPE"
+ *
+ *
+ *
+ */
+public class PackageInfoBean implements SessionBean {
+
+ static final long serialVersionUID = -2575868371338788524L;
+
+// private static Logger logger = Logger.getLogger(PackageInfoBean.class
+// .getName());
+ /**
+ * @ejb:interface-method
+ */
+ public Properties getProperties() {
+ Properties props = new Properties();
+ try {
+ InitialContext ic = new InitialContext();
+ NamingEnumeration e = ic.listBindings("java:comp/env");
+ while (e.hasMore()) {
+ Binding b = (Binding) e.next();
+ props.put(b.getName(), b.getObject().toString());
+ }
+
+ } catch (Exception ex) {
+ throw new EJBException(ex.getLocalizedMessage(), ex);
+ }
+ return props;
+ }
+ public void ejbCreate() {
+ }
+ public void setSessionContext(SessionContext ctx) {
+ }
+ public void ejbRemove() {
+ }
+ public void ejbActivate() {
+ }
+ public void ejbPassivate() {
+ }
+ public void ejbLoad() {
+ }
+ public void ejbStore() {
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/IMContext.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/IMContext.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/IMContext.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/IMContext.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,465 @@
+/*
+ * 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 Sep 23, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.inmemory.jndi;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.text.DateFormat;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.zip.DataFormatException;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NameParser;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.OperationNotSupportedException;
+import javax.naming.directory.InvalidAttributesException;
+import javax.resource.spi.ManagedConnectionFactory;
+
+/**
+ * @author jjin
+ *
+ * This class is used to overload the initialContext call, and right now
+ * it is only overload the initialContext call for RAs
+ */
+public class IMContext implements Context {
+
+ private static final String PROPERTY_FILE_NAME_PART = ".properties";
+ private static final String RA_MANAGED_CONNECTION_FACTORY_NAME = "RAManagedConnectionFactoryName";
+ private static final String RA_PROPERTY_SET_METHOD_PART = "set";
+ private static final String RA_CREATE_CONNECTION_FACTORY_METHOD_NAME = "createConnectionFactory";
+ private static final String FILE_SEPERATER1 = "\\";
+ private static final String FILE_SEPERATER2 = "/";
+ private static final String PROPERTY_VALUE_TYPE_PART = "_PROPERTY_VALUE_TYPE";
+
+ private static Logger logger =
+ Logger.getLogger(IMContext.class.getName());
+
+ private static Map managedConnectionFactoryCache = Collections.synchronizedMap(new HashMap());
+
+ public IMContext() {
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookup(javax.naming.Name)
+ */
+ public Object lookup(Name name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookup(java.lang.String)
+ */
+ public Object lookup(String name) throws NamingException {
+
+ // charper 11-03-03
+ // cache the managed connection factories
+ Object retValue = managedConnectionFactoryCache.get(name);
+ if ( retValue != null ) {
+ if ( logger.isLoggable(Level.FINE)) {
+ logger.fine("Got cached object for ->" + name);
+ }
+ return retValue;
+ }
+
+ if ( logger.isLoggable(Level.FINE)) {
+ logger.fine("Calling IMContext for look up->" + name);
+ }
+
+
+
+ // get file seperator
+ String fileSeperator = System.getProperty("file.separator");
+ // find file seperator
+ int pos = name.lastIndexOf(fileSeperator);
+ // get ra info file name part
+ // for all ra look up in format java:comp/env/...., only the
+ // last part after last "/" will be used as property file
+ // name part
+ String raInfoFileName = name;
+ if (pos != -1) {
+ // found "/" or "\"
+ if (pos + fileSeperator.length() < name.length()) {
+ // has valid part after file seperator
+ // get the part after file seperator
+ raInfoFileName = name.substring(pos + fileSeperator.length());
+ }
+ } else {
+ // not find "/" or "\"
+ if (fileSeperator.equals(FILE_SEPERATER1) == true) {
+ // not find "\", try to find "/"
+ pos = name.lastIndexOf(FILE_SEPERATER2);
+ if (pos != -1) {
+ // found "/"
+ if (pos + FILE_SEPERATER2.length() < name.length()) {
+ raInfoFileName = name.substring(pos + FILE_SEPERATER2.length());
+ }
+ }
+ } else {
+ // not find "/", try to find "\"
+ pos = name.lastIndexOf(FILE_SEPERATER1);
+ if (pos != -1) {
+ if (pos + FILE_SEPERATER1.length() < name.length()) {
+ raInfoFileName = name.substring(pos + FILE_SEPERATER1.length());
+ }
+ }
+ }
+ }
+ // append name with ".properties"
+ raInfoFileName += PROPERTY_FILE_NAME_PART;
+
+ try {
+ // load ra property file
+
+ Properties props = new Properties();
+ getProperties(props,raInfoFileName);
+
+ // get managed connection factory name
+ String managedConnectionFactoryName = props.getProperty(RA_MANAGED_CONNECTION_FACTORY_NAME);
+ if (managedConnectionFactoryName == null) {
+ // managed connection factory name is required for overload
+ // initialContext for RAs, since right now we only overload
+ // initialContext for RAs, so we throw exception here. If
+ // later on we decide to overload initialContext for EJBs too,
+ // we will need to change this part of code
+ throw new InvalidAttributesException();
+ }
+ // remove processed property
+ props.remove(RA_MANAGED_CONNECTION_FACTORY_NAME);
+ try {
+ // get class for managed connection factory
+ Class managedConnectionFactoryClass = Class.forName(managedConnectionFactoryName);
+ // get an instance of managed connection factory
+ ManagedConnectionFactory managedConnectionFactory = (ManagedConnectionFactory)(managedConnectionFactoryClass.newInstance());
+
+ // get properties
+ while (props.size() > 0) {
+ Set keys = props.keySet();
+ Iterator iter = keys.iterator();
+
+ while (iter.hasNext()) {
+ // get property key
+ String key = (String)(iter.next());
+ int propertyValueTypePartIndex = key.indexOf(PROPERTY_VALUE_TYPE_PART);
+ if (propertyValueTypePartIndex != -1
+ && propertyValueTypePartIndex + PROPERTY_VALUE_TYPE_PART.length() == key.length()) {
+ continue;
+ }
+ // get property value
+ String value = (String)(props.getProperty(key));
+ // remove processed property
+ props.remove(key);
+
+ // check for property key type, if not find, using
+ // string
+ String typeKey = key + PROPERTY_VALUE_TYPE_PART;
+ String typeValue = "java.lang.String";
+ if (props.containsKey(typeKey) == true) {
+ typeValue = props.getProperty(typeKey);
+ props.remove(typeKey);
+ }
+
+ // construct method name, it should be "set" +
+ // key
+ String methodName = RA_PROPERTY_SET_METHOD_PART + key;
+
+ // method parameters' class
+ Class[] paramsCls = new Class[1];
+ paramsCls[0] = Class.forName(typeValue);
+ // parameters
+ Object[] params = new Object[1];
+
+ // handling property type
+ if (typeValue.equals("java.lang.String")) {
+ params[0] = value;
+ } else if (typeValue.equals("java.lang.Boolean")) {
+ params[0] = new Boolean(value);
+ } else if (typeValue.equals("java.lang.Byte")) {
+ params[0] = new Byte(Byte.parseByte(value));
+ } else if (typeValue.equals("java.lang.Character")) {
+ if (value.length() != 0) {
+ params[0] = new Character(value.charAt(0));
+ } else {
+ params[0] = null;
+ }
+ } else if (typeValue.equals("java.lang.Short")) {
+ params[0] = new Short(Short.parseShort(value));
+ } else if (typeValue.equals("java.lang.Integer")) {
+ params[0] = new Integer(Integer.parseInt(value));
+ } else if (typeValue.equals("java.lang.Long")) {
+ params[0] = new Long(Long.parseLong(value));
+ } else if (typeValue.equals("java.lang.Float")) {
+ params[0] = new Float(Float.parseFloat(value));
+ } else if (typeValue.equals("java.lang.Double")) {
+ params[0] = new Double(Double.parseDouble(value));
+ } else if (typeValue.equals("java.util.Calendar")) {
+ DateFormat df = DateFormat.getTimeInstance();
+ params[0] = df.parse(value);
+ } else {
+ throw new DataFormatException(String.class.getName() + "->" + typeValue);
+ }
+
+ // get the method
+ Method method = managedConnectionFactoryClass.getMethod(methodName, paramsCls);
+ // call the method to the RA managed connection factory instance
+ method.invoke(managedConnectionFactory, params);
+ break;
+ }
+ }
+ // call createConnectionFactory
+ Class[] paramsCls = new Class[0];
+ Method method = managedConnectionFactoryClass.getMethod(RA_CREATE_CONNECTION_FACTORY_METHOD_NAME, paramsCls);
+ Object[] params = new Object[0];
+ retValue = method.invoke(managedConnectionFactory, params);
+ } catch (Exception e) {
+ throw new NamingException(e.getClass().getName() + "->" + e.getLocalizedMessage());
+ }
+
+ } catch (IOException e) {
+ throw new NamingException(e.getClass().getName() + "->" + e.getLocalizedMessage());
+ }
+
+ // charper 11-03-03
+ // stick this in the cache
+ managedConnectionFactoryCache.put(name,retValue);
+
+ return retValue;
+ }
+
+ public static void getProperties(Properties props, String fileName) throws IOException {
+
+ String path = System.getProperty("java.naming.provider.url");
+ String resource;
+ if (path == null ) {
+ resource = fileName;
+ } else {
+ resource = path+"/"+fileName;
+ }
+ InputStream strm =
+ Thread.currentThread().getContextClassLoader().
+ getResourceAsStream(resource);
+ if ( strm == null ) {
+ strm = new FileInputStream(fileName);
+ }
+ props.load(strm);
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#bind(javax.naming.Name, java.lang.Object)
+ */
+ public void bind(Name name, Object obj) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#bind(java.lang.String, java.lang.Object)
+ */
+ public void bind(String name, Object obj) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rebind(javax.naming.Name, java.lang.Object)
+ */
+ public void rebind(Name name, Object obj) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rebind(java.lang.String, java.lang.Object)
+ */
+ public void rebind(String name, Object obj) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#unbind(javax.naming.Name)
+ */
+ public void unbind(Name name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#unbind(java.lang.String)
+ */
+ public void unbind(String name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rename(javax.naming.Name, javax.naming.Name)
+ */
+ public void rename(Name oldName, Name newName) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#rename(java.lang.String, java.lang.String)
+ */
+ public void rename(String oldName, String newName) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#list(javax.naming.Name)
+ */
+ public NamingEnumeration list(Name name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#list(java.lang.String)
+ */
+ public NamingEnumeration list(String name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#listBindings(javax.naming.Name)
+ */
+ public NamingEnumeration listBindings(Name name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#listBindings(java.lang.String)
+ */
+ public NamingEnumeration listBindings(String name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#destroySubcontext(javax.naming.Name)
+ */
+ public void destroySubcontext(Name name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#destroySubcontext(java.lang.String)
+ */
+ public void destroySubcontext(String name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#createSubcontext(javax.naming.Name)
+ */
+ public Context createSubcontext(Name name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#createSubcontext(java.lang.String)
+ */
+ public Context createSubcontext(String name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookupLink(javax.naming.Name)
+ */
+ public Object lookupLink(Name name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#lookupLink(java.lang.String)
+ */
+ public Object lookupLink(String name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getNameParser(javax.naming.Name)
+ */
+ public NameParser getNameParser(Name name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getNameParser(java.lang.String)
+ */
+ public NameParser getNameParser(String name) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#composeName(javax.naming.Name, javax.naming.Name)
+ */
+ public Name composeName(Name name, Name prefix) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#composeName(java.lang.String, java.lang.String)
+ */
+ public String composeName(String name, String prefix) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#addToEnvironment(java.lang.String, java.lang.Object)
+ */
+ public Object addToEnvironment(String propName, Object propVal) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#removeFromEnvironment(java.lang.String)
+ */
+ public Object removeFromEnvironment(String propName) throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getEnvironment()
+ */
+ public Hashtable getEnvironment() throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#close()
+ */
+ public void close() throws NamingException {
+ }
+
+ /* (non-Javadoc)
+ * @see javax.naming.Context#getNameInNamespace()
+ */
+ public String getNameInNamespace() throws NamingException {
+ throw new OperationNotSupportedException();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/IMContextFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/IMContextFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/IMContextFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/IMContextFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,46 @@
+/*
+ * 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 Sep 23, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.inmemory.jndi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.spi.InitialContextFactory;
+
+/**
+ * @author jjin
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class IMContextFactory implements InitialContextFactory {
+
+ public IMContextFactory() {
+ }
+ /* (non-Javadoc)
+ * @see javax.naming.spi.InitialContextFactory#getInitialContext(java.util.Hashtable)
+ */
+ public Context getInitialContext(Hashtable environment) {
+ return new IMContext();
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/java/javaURLContextFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/java/javaURLContextFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/java/javaURLContextFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/inmemory/jndi/java/javaURLContextFactory.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 Sep 24, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package org.apache.ode.inmemory.jndi.java;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.spi.ObjectFactory;
+
+import org.apache.ode.inmemory.jndi.IMContext;
+
+/**
+ * @author jjin
+ *
+ * This class is needed because j2ee.jar has a jndi.properties which has
+ * "java.naming.factory.url.pkgs" defined. If we don't define this class,
+ * JNDI will go to j2ee's javaURLContextFactory to create a URL context
+ * for look up
+ */
+public class javaURLContextFactory implements ObjectFactory {
+ public javaURLContextFactory() {
+ }
+ public Object getObjectInstance(Object urlInfo,
+ Name name,
+ Context nameCtx,
+ Hashtable environment) {
+ return new IMContext();
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/instance/IPMIProcess.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/instance/IPMIProcess.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/instance/IPMIProcess.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/instance/IPMIProcess.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/***********************************************************************
+ * Module: IPMIProcess.java
+ * Author: waterman
+ * Purpose: Defines the Interface IPMIProcess
+ ***********************************************************************/
+
+package org.apache.ode.instance;
+
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.instance.service.InstanceService;
+import org.apache.ode.instance.service.InstanceServiceException;
+import org.apache.ode.scope.service.ScopePath;
+import org.apache.ode.util.BPException;
+
+/**
+ * The interface defines attributes of process instance state. Process instances
+ * are managed by the InstanceService.
+ *
+ * @see InstanceService
+ * @author waterman
+ */
+public interface IPMIProcess
+{
+ /**
+ * A unique reference key of the process instance
+ * @return a unique reference key of the process instance
+ */
+ String getKey();
+ /**
+ * A unique reference key of the root process instance. Each process instance
+ * executes under the context of a root process instance.
+ * @return a unique reference key of the root process instance
+ */
+ String getRootKey();
+ /** the current state of a process instance.
+ *
+ * @see StateEnum
+ * @return
+ */
+ int getState();
+ void setState(int state);
+
+ /**
+ * identifies process instances that can be garbage collected
+ * @return true idicates it is safe to garbage collect
+ */
+ public boolean isMarkedForCleanUp();
+ public void setMarkedForCleanUp(boolean mark);
+
+ /**
+ * identifies process instances that require persistence
+ * @return true indicates a process instance does not require persistence
+ */
+ public boolean isStateless();
+
+ /**
+ * Returns the process definition object which holds metadata describing
+ * the process instance.
+ *
+ * @return the process definition object
+ * @throws DefinitionServiceException
+ * @throws InstanceServiceException
+ */
+ IPMDProcess getDefinition() throws BPException;
+
+ /**
+ * Creates a child process instance
+ *
+ * @param definition the process definition metadata that describes the child process
+ * @return a new process instance
+ * @throws InstanceServiceException
+ */
+ IPMIProcess createSubProcess(IPMDProcess definition) throws BPException;
+
+ /**
+ * Delete this process instance. This is really an indirect call to the instance service.
+ * @throws InstanceServiceException
+ */
+ void remove() throws BPException;
+
+ public boolean isPaused();
+
+ ScopePath getScopePath();
+ void setScopePath(ScopePath scopePath);
+
+ String getContextContainerId();
+ void setContextContaionerId(String id);
+
+ // need to track the context of the process
+ // executing in fault handler, compensation handler
+ // process etc.
+ String getExecutionContext();
+ void setExecutionContext(String executionCtx);
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/instance/nonpersistent/PMIProcessTransientImpl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/instance/nonpersistent/PMIProcessTransientImpl.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/instance/nonpersistent/PMIProcessTransientImpl.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/instance/nonpersistent/PMIProcessTransientImpl.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,216 @@
+/*
+ * 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.instance.nonpersistent;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.definition.service.DefinitionService;
+import org.apache.ode.definition.service.DefinitionServiceException;
+import org.apache.ode.engine.ProcessDefinitionKey;
+import org.apache.ode.engine.StateEnum;
+import org.apache.ode.instance.IPMIProcess;
+import org.apache.ode.instance.service.InstanceServiceException;
+import org.apache.ode.instance.service.nonpersistent.InstanceServiceTransientImpl;
+import org.apache.ode.scope.service.IFCScopeInstance;
+import org.apache.ode.scope.service.ScopePath;
+import org.apache.ode.util.BPException;
+
+/**
+ * Implements a stateless process instance node.
+ *
+ * @author waterman
+ */
+public class PMIProcessTransientImpl implements IPMIProcess {
+
+ private static Logger logger =
+ Logger.getLogger(PMIProcessTransientImpl.class.getName());
+
+ private String root;
+ private String key;
+ private String contextContainerId;
+ private String executionCtx = IFCScopeInstance.PROCESS;
+ private int state = StateEnum.UNSTARTED.getIntValue();
+ private ScopePath scopePath = new ScopePath();
+ private boolean markedForCleanUp;
+ private boolean isStateless;
+
+ private IPMDProcess pDefinition;
+ private InstanceServiceTransientImpl service;
+
+
+ public PMIProcessTransientImpl(String defKey, DefinitionService ds, InstanceServiceTransientImpl is)
+ {
+ ProcessDefinitionKey pdk = new ProcessDefinitionKey(defKey);
+ try {
+ pDefinition = ds.getProcessDefintion(pdk,pdk);
+ isStateless = ds.getRootDefinition(pdk).getIsStateless();
+ } catch (BPException e) {
+ }
+ root = String.valueOf(this.hashCode());
+ this.key = root;
+ this.contextContainerId = root;
+
+ service = is;
+ }
+
+
+ private PMIProcessTransientImpl(IPMDProcess pDef, String root,
+ InstanceServiceTransientImpl is, ScopePath scopePath, String ctxtid,
+ String executionCtx) {
+ pDefinition = pDef;
+ this.root = root;
+ this.service = is;
+ this.key = String.valueOf(this.hashCode());
+ this.scopePath = scopePath;
+ this.contextContainerId = ctxtid;
+ this.executionCtx = executionCtx;
+ }
+
+
+
+ public IPMIProcess createSubProcess(IPMDProcess definition)
+ throws BPException {
+
+ PMIProcessTransientImpl ret;
+ try {
+ ret = new PMIProcessTransientImpl(definition,root,service,
+ (ScopePath)scopePath.clone(), contextContainerId,
+ executionCtx);
+ } catch (CloneNotSupportedException e) {
+ throw new BPException("NATIVE_EXCEPTION",
+ new Object[] {"CloneNotSupportedException"},e);
+ }
+ // running a stateful business process in a stateless manager is
+ // for testing only.
+ if ( !isStateless && service != null ) {
+ service.addInstance(root,ret);
+ }
+
+ if ( logger.isLoggable(Level.FINE)) {
+ logger.fine("New instance:"+ret.getKey()+"(Parent:"+this.key+")");
+ }
+
+ return ret;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.instance.service.IPMIProcess#remove()
+ */
+ public void remove() throws InstanceServiceException {
+ }
+
+ public boolean isMarkedForCleanUp() {
+ return markedForCleanUp;
+ }
+ public void setMarkedForCleanUp(boolean b) {
+ markedForCleanUp = b;
+ }
+
+ public String getRootKey() {
+ return root;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public void setState(int i) {
+ state = i;
+ }
+
+
+ /**
+ * @see org.apache.ode.instance.IPMIProcess#getDefinition()
+ */
+ public IPMDProcess getDefinition() throws InstanceServiceException,
+ DefinitionServiceException {
+ return pDefinition;
+ }
+
+ /**
+ * @return
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * @see org.apache.ode.instance.IPMIProcess#isStateless()
+ */
+ public boolean isStateless() {
+ return true;
+ }
+
+
+
+ public boolean isPaused()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.instance.service.IPMIProcess#getScopePath()
+ */
+ public ScopePath getScopePath(){
+ return scopePath;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.instance.service.IPMIProcess#setScopePath(java.lang.String)
+ */
+ public void setScopePath(ScopePath scopePath){
+ this.scopePath = scopePath;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.instance.service.IPMIProcess#getContextContainerId()
+ */
+ public String getContextContainerId() {
+ return contextContainerId;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.instance.service.IPMIProcess#setContextContaionerId()
+ */
+ public void setContextContaionerId(String id) {
+ contextContainerId = id;
+
+
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.instance.service.IPMIProcess#getExecutionContext()
+ */
+ public String getExecutionContext() {
+ return this.executionCtx;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.instance.service.IPMIProcess#setExecutionContext(java.lang.String)
+ */
+ public void setExecutionContext(String executionCtx) {
+ this.executionCtx = executionCtx;
+ }
+
+}