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 [16/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/client/impl/def/InternalResult.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/InternalResult.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/InternalResult.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/InternalResult.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,179 @@
+/*
+ * 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.client.impl.def;
+
+import java.util.Properties;
+
+import org.apache.ode.client.impl.IInternalMessage;
+import org.apache.ode.client.impl.IInternalResult;
+
+
+public class InternalResult implements IInternalResult
+{
+	
+    static final long serialVersionUID = 6504944946244358937L;
+    
+	private int resultType;
+	private IInternalMessage successfulResponse;
+	private IInternalMessage faultMessage;
+	private String faultName;
+	private String faultNamespace;
+	private String exceptionString;
+	private StackTraceElement[] exceptionStackTrace;
+	private String exceptionName;
+	private String m_id;
+	private String m_definitionName;
+	private Properties m_exceptionProps;
+	
+	
+	public int getResultType()
+	{
+		return resultType;
+	}
+
+	public IInternalMessage getSuccessfulResponse()
+	{
+		return successfulResponse;
+	}
+
+	public IInternalMessage getFaultMessage()
+	{
+		return faultMessage;
+	}
+	
+	public String getFaultName()
+	{
+		return faultName;
+	}
+	
+	public String getFaultNamespace()
+	{
+		return faultNamespace;
+	}
+	
+	public void setFaultName( String faultName )
+	{
+		this.faultName = faultName;
+	}
+	
+	public void setFaultNamespace( String faultNamespace )
+	{
+		this.faultNamespace = faultNamespace;
+	}
+
+	public void setSuccessfulResponse(IInternalMessage successfulresult)
+	{
+		successfulResponse = successfulresult;
+		
+	}
+	
+	public void setFaultMessage( IInternalMessage faultMessage )
+	{
+		this.faultMessage = faultMessage;
+	}
+
+	public void setResultType(int i)
+	{
+		resultType=i;
+		
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setExceptionName(String systemExceptionName)
+	{
+		this.exceptionName = systemExceptionName;
+		
+	}
+
+	/**
+	 * @param elements
+	 */
+	public void setExceptionStackTrace(StackTraceElement[] elements)
+	{
+		this.exceptionStackTrace = elements;
+		
+	}
+
+	/**
+	 * @param string
+	 */
+	public void setExceptionString(String exceptionString)
+	{
+		this.exceptionString = exceptionString;
+		
+	}
+
+
+
+
+	/**
+	 * @return Returns the systemExceptionName.
+	 */
+	public String getExceptionName()
+	{
+		return exceptionName;
+	}
+	/**
+	 * @return Returns the systemExceptionStackTrace.
+	 */
+	public StackTraceElement[] getExceptionStackTrace()
+	{
+		return exceptionStackTrace;
+	}
+	/**
+	 * @return Returns the systemExceptionString.
+	 */
+	public String getExceptionString()
+	{
+		return exceptionString;
+	}
+
+    public String getID()
+    {
+        return m_id;
+    }
+
+    public void setID(String id)
+    {
+        m_id = id;
+    }
+
+    public String getDefinitionName()
+    {
+        return m_definitionName;
+    }
+
+    public void setDefinitionName(String definitionName)
+    {
+        m_definitionName = definitionName;
+        
+    }
+    
+    public Properties getExceptionProperties()
+    {
+    	return m_exceptionProps;
+    }
+    
+    public void setExceptionProperties(Properties props)
+    {
+    	m_exceptionProps = props;
+    }
+    
+    
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Message.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Message.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Message.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Message.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.
+*/
+
+package org.apache.ode.client.impl.def;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.ode.cc.util.SerializationContext;
+import org.apache.ode.client.IBPEClient;
+import org.apache.ode.client.IBPEMessage;
+import org.apache.ode.client.IBPEMessagePart;
+
+
+public class Message extends ClientObject implements IBPEMessage, Serializable
+{
+    static final long serialVersionUID = -7249857989518908491L;
+    
+	public Message(IBPEClient client)
+	{
+		super(client);
+		
+	}
+	HashMap m_parts = new HashMap();
+	
+	public Collection getParts()
+	{
+		return m_parts.values();
+	}
+	public IBPEMessagePart getPart(String name)
+	{
+		IBPEMessagePart returnValue =  ( IBPEMessagePart )( m_parts.get( name ));
+		return returnValue;
+	}
+	public void removePart( String iName )
+	{
+		m_parts.remove(iName);
+	}
+
+	public void addPart(IBPEMessagePart part)
+	{
+		m_parts.put( part.getName(), part );
+		
+	}
+	/**
+	 * @param sc
+	 */
+	public void dump(SerializationContext sc)
+	{
+		
+		IBPEMessage rmessage = this;
+		Iterator it = rmessage.getParts().iterator();
+		if (it.hasNext())
+		{
+			sc.startTag("Message");
+			while (it.hasNext())
+			{
+				Part part = (Part) (it.next());
+				part.dump(sc);
+			}
+			sc.endTag("Message");
+		}
+	}
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Operation.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Operation.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Operation.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Operation.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,167 @@
+/*
+ * 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.client.impl.def;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Map.Entry;
+
+import org.apache.ode.client.IBPEClient;
+import org.apache.ode.client.IBPEMessage;
+import org.apache.ode.client.IBPEMessagePart;
+import org.apache.ode.client.IFormattableValue;
+import org.apache.ode.client.IOperation;
+import org.apache.ode.client.exceptions.BPEUserException;
+import org.apache.ode.client.exceptions.SystemException;
+import org.apache.ode.client.exceptions.TargetDefinitionPausedException;
+import org.apache.ode.client.exceptions.TargetInstancePausedException;
+import org.apache.ode.client.impl.IInternalMessage;
+import org.apache.ode.client.impl.IInternalRequestConsumer;
+import org.apache.ode.client.impl.IInternalResult;
+import org.apache.ode.client.result.IResult;
+import org.apache.ode.event.BPELStaticKey;
+
+public class Operation  extends ClientObject implements IOperation
+{
+	private IInternalRequestConsumer requestConsumer;
+	private Properties spec;
+	
+	
+	public Operation(IBPEClient client, 
+			IInternalRequestConsumer requestConsumer, 
+			Properties spec)
+	{
+		super( client );
+		this.requestConsumer = requestConsumer;
+		this.spec = spec;
+	}
+
+	public IResult invoke(IBPEMessage request) throws BPEUserException
+	{
+		String operationName = 
+			spec.getProperty( IOperation.OPERATION );
+		String portType = 
+			spec.getProperty( IOperation.PORT_TYPE );
+		String portTypeNamespace =
+			spec.getProperty( IOperation.PORT_TYPE_NAMESPACE);
+		
+		BPELStaticKey bpsk = new BPELStaticKey();
+		bpsk.setOperation( operationName );
+		bpsk.setPortType(portType);
+		bpsk.setTargetNamespace(portTypeNamespace);
+		
+		IInternalMessage internalRequest = createInternalRequest(request);
+		IInternalResult result = requestConsumer.sendRequest(bpsk,
+				internalRequest);
+		
+		IResult clientResult = createClientResult(result);
+		return clientResult;
+	}
+
+	protected IInternalMessage createInternalRequest(IBPEMessage request)
+	{
+		InternalMessage im = new InternalMessage();
+		HashMap internalParts = new HashMap();
+		Iterator iter = request.getParts().iterator();
+		while( iter.hasNext())
+		{
+			Part part = ( Part ) ( iter.next() );
+			internalParts.put( part.getName(), part.
+					getDescribedValue());
+		}
+		im.setParts(internalParts);
+		return im;
+			
+	}
+	
+	protected IResult createClientResult(IInternalResult internalResult)
+	  throws BPEUserException
+	{
+		IResult returnValue = null;
+		switch( internalResult.getResultType() )
+		{
+			case( IInternalResult.SUCCESS_WITH_RESPONSE_RESULT ):
+			{
+				returnValue = new SucessWithResponse( 
+						createResponseMessage(
+								internalResult.getSuccessfulResponse()));
+				break;
+			}
+			case( IInternalResult.FAULT_RESULT):
+			{
+				IBPEMessage faultMessage = 
+					createResponseMessage( internalResult.getFaultMessage());
+				
+				returnValue = new FaultResult( internalResult.getFaultName(),
+						internalResult.getFaultNamespace(), faultMessage);
+				
+				break;
+			}
+			case( IInternalResult.SYSTEM_EXCEPTION ):
+			{
+				SystemException e = new SystemException(
+						internalResult.getExceptionString());
+				
+				e.setStackTrace( internalResult.getExceptionStackTrace());
+				e.setProperties( internalResult.getExceptionProperties() );
+				
+				throw e;
+				
+			}
+			case( IInternalResult.DEACTIVATED_TARGET_DEFINITION_EXCEPTION):
+			{
+			    TargetDefinitionPausedException tdpe = 
+			        new TargetDefinitionPausedException(
+			                internalResult.getID(),
+			                internalResult.getDefinitionName());
+			    tdpe.setStackTrace( internalResult.getExceptionStackTrace());
+			    throw tdpe;
+			}
+			case( IInternalResult.PAUSED_TARGET_INSTANCE_EXCEPTION):
+			{
+			    TargetInstancePausedException tipe = 
+			        new TargetInstancePausedException(
+			                internalResult.getID() );
+			    tipe.setStackTrace( internalResult.getExceptionStackTrace());
+			    throw tipe;
+			}
+			//TODO: code up the rest of the cases
+		}
+		return returnValue;
+	}
+
+	private IBPEMessage createResponseMessage(IInternalMessage message)
+	{
+		Message returnValue = ( Message )getClient().createMessage();
+		Iterator iter = message.getParts().entrySet().iterator();
+		while( iter.hasNext() )
+		{
+			Entry entry = ( Entry ) ( iter.next() );
+			IFormattableValue fv = ( IFormattableValue )
+			  ( entry.getValue () );
+			String name = (String) entry.getKey();
+			IBPEMessagePart part =
+				(( BPEClientDefaultImpl)getClient()).createPart(name, fv );
+			returnValue.addPart(part);
+		}
+		
+		return returnValue;
+	}
+	
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Part.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Part.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Part.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/Part.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,87 @@
+/*
+ * 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.client.impl.def;
+
+import java.util.HashMap;
+
+import org.apache.ode.cc.util.SerializationContext;
+import org.apache.ode.client.IBPEClient;
+import org.apache.ode.client.IBPEMessagePart;
+import org.apache.ode.client.IDescribedValue;
+import org.apache.ode.client.IFormattableValue;
+import org.apache.ode.interaction.spiimpl.CannedFormattableValue;
+
+
+public class Part extends ClientObject implements IBPEMessagePart 
+{
+	public String m_name;
+	private IDescribedValue m_describedValue;
+	private IFormattableValue m_formattableValue;
+
+	public Part(IBPEClient client, 
+			IDescribedValue describedValue)
+	{
+		super( client);
+		m_describedValue = describedValue;
+	}
+
+	public Part(IBPEClient client, String name, IDescribedValue value)
+	{
+		super(client);
+		m_name=name;
+		m_describedValue = value;
+	}
+
+	public Part(IBPEClient client, String name, IFormattableValue value)
+	{
+		super(client);
+		m_name=name;
+		m_formattableValue = value;
+	}
+
+	public String getName()
+	{
+		return m_name;
+	}
+
+	public IFormattableValue getFormattableValue()
+	{
+		if ( m_formattableValue == null )
+		{
+			m_formattableValue = 
+				new CannedFormattableValue( m_describedValue );
+		}
+		return m_formattableValue;
+	}
+
+	public IDescribedValue getDescribedValue()
+	{
+		return m_describedValue;
+	}
+
+	/**
+	 * @param sc
+	 */
+	public void dump(SerializationContext sc)
+	{
+		HashMap props = new HashMap();
+		props.put( "name", getName());
+		
+		sc.startEndTag( "Part", props, getFormattableValue().toString());
+			
+	}
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/SucessWithResponse.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/SucessWithResponse.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/SucessWithResponse.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/impl/def/SucessWithResponse.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on May 26, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.client.impl.def;
+
+import java.util.Iterator;
+
+import org.apache.ode.client.IBPEMessage;
+import org.apache.ode.client.IBPEMessagePart;
+import org.apache.ode.client.result.IResult;
+import org.apache.ode.client.result.ISuccessWithResponse;
+
+/**
+ * @author blorenz
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class SucessWithResponse implements IResult, ISuccessWithResponse
+{
+	IBPEMessage message;
+
+	public SucessWithResponse(IBPEMessage message)
+	{
+		this.message = message;
+	}
+
+	public IBPEMessage getResponse()
+	{
+		return message;
+	}
+	
+	public String toString()
+	{
+		ISuccessWithResponse swrresult = this;
+		IBPEMessage rmessage = swrresult.getResponse();
+		StringBuffer buf = new StringBuffer("Fault Message:" + null + "\n");
+		Iterator it = rmessage.getParts().iterator();
+		while (it.hasNext())
+		{
+			IBPEMessagePart part = (IBPEMessagePart) (it.next());
+			String name = part.getName();
+			try
+			{
+				buf.append("Part \""
+						+ name
+						+ "\" value: "
+						+ rmessage.getPart(name).getFormattableValue()
+								.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/client/result/IFaultResult.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/IFaultResult.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/IFaultResult.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/IFaultResult.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.client.result;
+
+import org.apache.ode.client.IBPEMessage;
+
+
+/**
+ * The request was successfully routed, but the business process
+ * which consumed the request produced a fault.  The fault
+ * contains a fault name and a fault message.
+ */
+public interface IFaultResult extends IResult
+{
+	public IBPEMessage getFaultMessage();
+	public String getFaultName();
+	public String getFaultNamespace();
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/IResult.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/IResult.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/IResult.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/IResult.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.client.result;
+
+
+/**
+ * Base interface for all results returned from sendEvent().
+  */
+public interface IResult
+{
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ISuccessResult.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ISuccessResult.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ISuccessResult.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ISuccessResult.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.client.result;
+
+
+/**
+ * Results of this type indicate that the request
+ * was processed successfully.  
+ */
+public interface ISuccessResult extends IResult
+{
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ISuccessWithResponse.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ISuccessWithResponse.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ISuccessWithResponse.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ISuccessWithResponse.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,29 @@
+/*
+ * 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.client.result;
+
+import org.apache.ode.client.IBPEMessage;
+
+
+/**
+ * Results of this type indicate that the request was processed
+ * correctly and that a response was generated.  The response
+ * is attached to the result.
+ */
+public interface ISuccessWithResponse extends ISuccessResult
+{
+	public IBPEMessage getResponse();
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ITargetNotReady.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ITargetNotReady.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ITargetNotReady.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/result/ITargetNotReady.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.client.result;
+
+import java.util.Collection;
+
+
+
+/**
+ * A result of this type indicates that the target process instance
+ * may exist but it is not yet ready to consume the request. The
+ * result contains a collection of possible dynamic keys.  These
+ * keys can be used by a holding mechanism to index held events.
+*/
+public interface ITargetNotReady extends IResult
+{
+	Collection getPossibleDynamicKeys();
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/IBPEClientFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/IBPEClientFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/IBPEClientFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/IBPEClientFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.ode.client.spi;
+
+import java.util.Properties;
+
+import org.apache.ode.client.IBPEClient;
+import org.apache.ode.client.exceptions.BPEUserException;
+
+
+/**
+ * It may be useful to provide different client
+ * implementations depending on the mode of interaction
+ * with the BPE engine.  This factory provides
+ * a means of supplying new factory implementions.
+ * 
+ * The BPEClient will construct its implementation
+ * from a factory which implements the following interface.
+ */
+public interface IBPEClientFactory
+{
+	
+	public IBPEClient createBPEClient( Properties spec )
+	  throws BPEUserException;
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIFormattableValue.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIFormattableValue.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIFormattableValue.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIFormattableValue.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,66 @@
+/*
+ * 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.client.spi.interaction;
+
+import org.apache.ode.client.IDescribedValue;
+import org.apache.ode.client.IFormat;
+import org.apache.ode.client.exceptions.BPEUserException;
+
+
+public interface ISPIFormattableValue
+{
+	/**
+	 * Get the value in the requested representation.  
+	 * The format provides further specificity if the supplied
+	 * class parameter leaves ambiguity.  For example a
+	 * byte[] specifier for the class type leaves many possiblities
+	 * for the contents of the byte array.
+	 * @return
+	 * @throws BPEUserException
+	 */
+	public Object getValueAs( Class clazz, IFormat format );
+	
+	public Object getValueAs( Class clazz );
+	  
+	/**
+	 * Inquire if the specified representation is supported.
+	 * @return
+	 */
+	public boolean supportsGetValueAs( 
+			Class clazz, IFormat format );
+	
+	public boolean supportsGetValueAs( 
+			Class clazz);
+	
+	/**
+	 * Get the contained value in it's current format.
+	 */
+	public IDescribedValue getDescribedValue();
+	
+	/**
+	 * Convert the wrapped content into a string representation.
+	 * 
+	 * If the wrapped object is a simple type the string returned
+	 * should be the format returned from
+	 * Double.toString(), Integer.toString(), Boolean.toString(),
+	 * Short.toString(), Byte.toString()
+	 * 
+	 * If the wrapped content is a complex datatype the string
+	 * returned should be an xml document.
+	 */
+	public String toString();
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIInteraction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIInteraction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIInteraction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIInteraction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,210 @@
+/*
+ * 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.client.spi.interaction;
+
+import java.io.Serializable;
+
+import org.apache.ode.client.IFormattableValue;
+
+
+
+/**
+ * This interface will be implemented by SPIInteraction providers.
+ * Users may wish to implement their own interaction objects if
+ * the native interaction objects supplied by the BPE are insufficient.
+ * 
+ * This interface is essentially an abstraction for a data tree. 
+ * The basic set of behaviours include the following:
+ * 
+ * setSimpleValue() -> set the value of a tree node
+ * getSimpleValue() -> get the value of a tree node
+ * setComplexValue() -> graft nodes a supplied subtree into the target tree
+ * getComplexValue() -> select a subtree
+ * removeValue() -> remove a node and its children from the tree
+ *
+ * The interface presumes that all information may be represented as a tree
+ * and so this abstraction is a sufficient interface for all information
+ * accessed by the BPE.
+ * 
+ */
+public interface ISPIInteraction extends Serializable
+{
+	static final long serialVersionUID = -112299417678982997L;
+	
+	/**
+	 * Query the value of a simple data element.
+	 * If the interaction wraps a dom, this method
+	 * returns a node value.
+	 * 
+	 * 
+	 * @param query
+	 * @return
+	 * 
+	 */
+	public IFormattableValue getSimpleValue( ISPIQuery query ) 
+	  ;
+	
+	/**
+	 * Set the value of a simple data element.
+	 * 
+	 * If the interaction wraps a dom, this
+	 * method sets a node value.  
+	 * If the node does not exist, create it.  
+	 * If the subtree does not exist, create it.
+	 * 
+	 * @param query
+	 * @param value
+	 */
+	public void setSimpleValue( ISPIQuery query, 
+			IFormattableValue iValue );
+	
+	/**
+	 * Returns true if the operation is supported.
+	 * @param query
+	 * @param iValue
+	 * @return
+	 */
+	public boolean supportsSetSimpleValue( ISPIQuery query,
+			IFormattableValue iValue );
+	
+	/**
+	 * Select a complex value.  
+	 * 
+	 * If the interaction wraps a dom, this method
+	 * returns a an object that represents a subtree.
+	 * 
+	 * The Object returned from this method will not be
+	 * inspected or modified directly by the engine.  The engine
+	 * will delegate inspection and modification operations
+	 * back to the interaction layer.  
+	 * 
+	 * The interface has a contract with itself that says any
+	 * object dispensed from getComplexValue() may
+	 * later be provided as an input to the the setObject(),
+	 * setComplexValue(), and copySubElements() methods.
+	 * 
+	 * @param query
+	 * @return
+	 * An object representing a complex value.
+	 * @throws SPIInteractionException
+	 */
+	public IFormattableValue getComplexValue( ISPIQuery query );
+	
+	/**
+	 * Returns true if the operation is supported.
+	 * @param query
+	 * @return
+	 */
+	public boolean supportsGetComplexValue( ISPIQuery query );
+	
+	/**
+	 * Graft a complex value into the target location 
+	 * specified by the query.  If the target location,
+	 * does not exist, create it. 
+	 * 
+	 * If the interaction wraps a dom this method graphs
+	 * a subtree.
+	 * @param query
+	 * @param value
+	 * 
+	 * @throws SPIInteractionException
+	 */
+	public void setComplexValue( ISPIQuery query, 
+			IFormattableValue iValue );
+	
+	/**
+	 * Returns true if the operation is supported.
+	 * @param query
+	 * @param iValue
+	 * @return
+	 */
+	public boolean supportsSetComplexValue( ISPIQuery query,
+			IFormattableValue iValue );
+	  
+	
+	/**
+	 * Remove a complex value from the specified location. If the interaction wraps a dom this method
+	 * prunes a subtree.
+	 * @param query
+	 * @throws SPIInteractionException
+	 */
+	public void removeValue( ISPIQuery query );
+	
+	
+	/**
+	 * Returns true if the operation is supported.
+	 * @param query
+	 * @return
+	 */
+	public boolean supportsRemoveValue( ISPIQuery query );
+	
+	/**
+	 * Copy the children of the source element to the specified location 
+	 * in the target tree.  If children of the same name exist in 
+	 * the target subtree overwrite them.
+	 * @param query
+	 * @param source
+	 */
+	public void copySubElements( ISPIQuery query, IFormattableValue source);
+	
+	/**
+	 * Returns true if the operation is supported.
+	 * @param query
+	 * @param source
+	 * @return
+	 */
+	public boolean supportsCopySubElements( 
+			ISPIQuery query, IFormattableValue source );
+	
+	/**
+	 * Create a clone of the interaction.
+	 * @return
+	 * @throws SPIInteractinoException
+	 */
+	public ISPIInteraction cloneSPIInteraction();
+	
+	/**
+	 * Return true if the operation is supported.
+	 * @return
+	 */
+	public boolean supportsCloneSPIInteraction();
+	
+	/**
+	 * Return true if the operation is supported.
+	 * @return
+	 */
+	public boolean supportsGetSimpleValue( ISPIQuery query ); 
+	
+	/**
+	 * Called by the BPE when the object is no longer
+	 * needed so that it can released resources
+	 * without waiting for garbage collection.
+	 */
+	public void releaseHeldResources();
+	
+
+	
+    /**
+     * Get the content wrapped by the interaction as a
+     * formattable value.
+     * @return
+     */
+    public IFormattableValue getValue();
+}
+
+
+
+

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIInteractionFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIInteractionFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIInteractionFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIInteractionFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,107 @@
+/*
+ * 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.client.spi.interaction;
+
+import java.io.Serializable;
+
+import org.apache.ode.client.IDescribedValue;
+
+
+/**
+ * SPIInteraction providers must implement this interface.  The BPE
+ * will invoke this interface to construct an interaction object
+ * from specification info.
+ * 
+ * The BPE configuration may allow for several interaction factories.
+ * When the BPE is asked to interpret a described value it can
+ * iterate through the list of interaction factories until
+ * it finds one which can handle the described value.
+ */
+public interface ISPIInteractionFactory extends Serializable
+{
+	
+	static final long serialVersionUID = -2814202278986485351L;
+	
+	/**
+	 * Create an empty interaction object. Since no 
+	 * type information is provide the "any" type
+	 * must be assumed.  
+	 * 
+	 * We may provide a content type at some point
+	 * in the future which allows for more intelligence
+	 * in the interaction layer.
+	 * 
+	 * The BPE uses this type of interaction to construct
+	 * new content from scratch.
+	 */
+	public ISPIInteraction createAnyTypeInteraction( );
+	
+	/**
+	 * Returns true if the interaction factory supports
+	 * the creation of flexible data trees which do not
+	 * conform to a particular content type.
+	 * 
+	 * The BPE uses this type of interaction to construct
+	 * new content from scratch.  
+	 * 
+	 * @return
+	 */
+	public boolean supportsAnyType();
+	
+	/**
+	 * Create an interaction object from a raw
+	 * object and format/type metadata. The implementor
+	 * should assume that the user called the isSupported
+	 * method with the described value prior to calling
+	 * this method.  Failure to do so could result
+	 * in a runtime exception being thrown from this method.
+	 * 
+	 * @param describedValue
+	 * @return
+	 */
+	public ISPIInteraction createInteraction( 
+			IDescribedValue describedValue );
+	
+	/**
+	 * Ask the factory if it supports the creation of
+	 * an interaction object from the supplied
+	 * object and format/type metadata.
+	 * 
+	 * If the described value indicates a specific
+	 * format and/or content type, the interaction factory 
+	 * must explicitly provide full support for that format
+	 * and content type.  If the described value does
+	 * not contain format or type information, the BPE
+	 * determines support based on the type of the raw object
+	 * alone.
+	 * 
+	 * If the described value does not indicate a particular
+	 * format or content type, the interaction factory can
+	 * determine support based on the identity of the raw
+	 * data object alone.   When interaction factories are 
+	 * listed in the engine configuration, they should
+	 * be listed in order of decreasing specificity.
+	 * For example, an interaction factory which accepts raw objects
+	 * that implement the FOO2 interface should precede factories
+	 * which accept a FOO1 interface if FOO2 extends FOO1.
+	 * 
+	 * @param value
+	 * @return
+	 */
+	public boolean supportsInteraction( IDescribedValue value );
+	
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIJaxenXPathQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIJaxenXPathQuery.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIJaxenXPathQuery.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIJaxenXPathQuery.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.client.spi.interaction;
+
+import org.jaxen.dom.DOMXPath;
+import org.jaxen.NamespaceContext;
+
+public interface ISPIJaxenXPathQuery extends ISPIXPathQuery
+{
+	public DOMXPath getDOMXPath();
+
+	public NamespaceContext getNamespaceContext();
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIQuery.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIQuery.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIQuery.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.client.spi.interaction;
+
+/**
+ * Queries against ISPIInteraction objects must implement this interface.
+ */
+public interface ISPIQuery
+{
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIXPathQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIXPathQuery.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIXPathQuery.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/spi/interaction/ISPIXPathQuery.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,29 @@
+/*
+ * 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.client.spi.interaction;
+
+import java.util.HashMap;
+
+
+
+
+public interface ISPIXPathQuery extends ISPIQuery
+{
+	public String getXPathExpressionAsString();
+	
+	public HashMap getNamespaceMap();
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/BPEInvoker.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/BPEInvoker.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/BPEInvoker.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/BPEInvoker.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,149 @@
+/*
+ * 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.client.util;
+
+import java.io.ByteArrayInputStream;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Properties;
+
+import org.xml.sax.InputSource;
+
+import org.apache.ode.client.BPEClient;
+import org.apache.ode.client.DescribedValue;
+import org.apache.ode.client.IBPEClient;
+import org.apache.ode.client.IBPEMessage;
+import org.apache.ode.client.IBPEMessagePart;
+import org.apache.ode.client.IFormat;
+import org.apache.ode.client.IOperation;
+import org.apache.ode.client.exceptions.BPEUserException;
+import org.apache.ode.client.formats.INativeFormat;
+import org.apache.ode.client.result.IResult;
+import org.apache.ode.util.XMLDocBuilderByThread;
+
+
+public class BPEInvoker implements IBPEInvoker
+{
+	protected IBPEClient client;
+	protected Properties operationSpec;
+	protected IOperation operation;
+	protected IBPEMessage message;
+	protected LinkedList parts = new LinkedList();
+ 
+    public BPEInvoker() throws BPEUserException
+    {
+    }
+
+    public void setInvocationSpec(Properties invocationSpec ) throws BPEUserException
+    {
+        this.operationSpec = invocationSpec;
+		client = new BPEClient(invocationSpec);
+		operation = createOperation(invocationSpec);
+	}
+	
+	public BPEInvoker(Properties operationSpec) throws BPEUserException
+	{
+		client = new BPEClient(operationSpec);
+		this.operationSpec = operationSpec;
+		operation = createOperation( operationSpec );
+		
+	}
+	
+	private IOperation createOperation(Properties operationSpec) throws BPEUserException
+	{
+		if ( operation == null )
+		{
+			operation = getClient().createOperation(operationSpec);
+		}
+		return operation;
+	}
+
+	public IResult invoke() 
+	  throws BPEUserException
+	{
+		IResult result = operation.invoke( getMessage() );
+		return result;
+	}
+	
+	private IBPEMessage getMessage() throws BPEUserException
+	{
+		if ( message == null )
+		{
+			message =  
+				getClient().createMessage();
+		
+			Iterator iter = getParts().iterator();
+			while( iter.hasNext() )
+			{
+				IBPEMessagePart part = 
+					(IBPEMessagePart)( iter.next() );
+				message.addPart(part);
+			}
+		}
+		
+		return message;
+	}
+	
+	private LinkedList getParts()
+	{
+		return parts;
+	}
+	
+	protected IBPEClient getClient() 
+	{
+		return client;
+	}
+
+	public void clear()
+	{
+		message = null;
+		parts.clear();
+	}
+
+	public void addPart(
+			String partName, Object data, Properties partSpec)
+
+	{
+		String formatName = partSpec.getProperty( "formatName" );
+		
+		IFormat format = null;
+		if ( formatName.equals( "xml" ) )
+		{
+			format = INativeFormat.XML;
+			ByteArrayInputStream bai = 
+				new ByteArrayInputStream( ((String)(data)).getBytes());
+			InputSource in = new InputSource(bai);
+			try
+			{
+				data = 
+					XMLDocBuilderByThread.getDocBuilder().parse(in);
+			} catch (Exception e)
+			{
+
+				e.printStackTrace();
+			}
+		} else if ( formatName.equals("atomic")) {
+			format = INativeFormat.ATOMIC;
+		}
+			
+		// TODO: handle wire format
+		
+		DescribedValue dv = new DescribedValue( data, format );
+		IBPEMessagePart part = getClient().createPart( partName, dv);
+		parts.add( part );
+	}
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/EngineUtil.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/EngineUtil.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/EngineUtil.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/EngineUtil.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,165 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 13, 2003
+ *
+ */
+package org.apache.ode.client.util;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Properties;
+//import java.util.logging.Logger;
+
+import org.apache.ode.cc.client.BPELBundle;
+import org.apache.ode.cc.client.CCClient;
+import org.apache.ode.cc.client.CCException;
+import org.apache.ode.cc.client.IEngine;
+import org.apache.ode.client.exceptions.SystemException;
+import org.apache.ode.client.result.IResult;
+import org.apache.ode.util.BPException;
+public class EngineUtil
+{
+	//private static Logger logger = Logger.getLogger(EngineUtil.class.getName());
+	private File defJar;
+	private ArrayList invocations = new ArrayList();
+	private String[] args;
+	private IResult result = null;
+	private String packageName = "BPE";
+	
+	public static void main(String[] args)
+	{
+		EngineUtil eu = new EngineUtil(args);
+		eu.run();
+	}
+	public EngineUtil(String args[])
+	{
+		this.args = args;
+	}
+	private void setup() throws BPException
+	{
+		// parse the comand line
+		parseCmdLine(args);
+	}
+	private void deploy() throws FileNotFoundException, BPException,
+			CCException
+	{
+		if (defJar != null)
+		{
+			InputStream jarDefStream = new FileInputStream(defJar);
+			BPELBundle bpelBundle = new BPELBundle(defJar.getName(),
+					jarDefStream);
+			HashMap hm = new HashMap();
+			hm.put(IEngine.ENGINE_NAME,packageName);
+			CCClient ccClient = new CCClient();
+			IEngine engine = ccClient.getEngine(hm);
+			engine.deployBundle(bpelBundle);
+		}
+	}
+	private void sendMessages() throws Exception
+	{
+		// if any messages were specified send them to the engine
+		Iterator it = invocations.iterator();
+		InvokerBuilder ib = new InvokerBuilder(packageName);
+		while (it.hasNext())
+		{
+			// Each invocation is represented as a properties file.
+			Properties invocation = new Properties();
+			invocation.load(new FileInputStream((File) it.next()));
+			IBPEInvoker bpi = ib.buildInvoker(invocation);
+			result = bpi.invoke();
+			dumpResult();
+		}
+	}
+	
+	private void dumpResult()
+	{
+		System.out.println("Return message:");
+		System.out.println( result.toString());
+	}
+	
+	public void run()
+	{
+		try
+		{
+			setup();
+			deploy();
+			sendMessages();
+		} catch (Exception e)
+		{
+			if ( e instanceof SystemException )
+			{
+				System.out.println("A system exception has occurred:");
+			}
+			
+			e.printStackTrace();
+			
+		}
+	}
+	private void parseCmdLine(String[] args)
+	{
+		try
+		{
+			for (int i = 0; i < args.length; i++)
+			{
+				if (args[i].equals("-h"))
+				{
+					help();
+				} else if ( args[i].equals("-p") )
+				{	
+					packageName  = args[++i];
+					
+				} else if (args[i].equals("-d"))
+				{
+					defJar = new File(args[++i]);
+					if (!(defJar.isFile() && defJar.canRead()))
+					{
+						help();
+					}
+				} else
+				{
+					// the rest have to be message files
+					for (; i < args.length; i++)
+					{
+						File f = new File(args[i]);
+						if (f.isFile() && f.canRead())
+						{
+							invocations.add(f);
+						} else
+						{
+							help();
+						}
+					}
+				}
+			}
+		} catch (RuntimeException e)
+		{
+			help();
+		}
+	}
+	private void help()
+	{
+		System.out.println("EnginUtil [-p packageName] [-d deployFile] [msgFile]...");
+		System.out.println("-p the engines package name, default is BPE");
+		System.out.println("-d deployFile - the definition deploy zip file ");
+		System.out.println("Specifiy 0..n message to send");
+		System.exit(0);
+	}
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/IBPEInvoker.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/IBPEInvoker.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/IBPEInvoker.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/IBPEInvoker.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.ode.client.util;
+
+import java.util.Properties;
+
+import org.apache.ode.client.exceptions.BPEUserException;
+import org.apache.ode.client.result.IResult;
+
+
+public interface IBPEInvoker
+{
+    public static final String INVOKER_IMPL = "invoker.impl";
+
+	public IResult invoke() 
+	  throws BPEUserException;
+
+	public void setInvocationSpec( Properties operationSpec ) throws BPEUserException;
+	
+	public void clear();
+
+	public void addPart( String format, Object Part, 
+			Properties partSpec);
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/IInvokerBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/IInvokerBuilder.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/IInvokerBuilder.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/IInvokerBuilder.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,31 @@
+/*
+ * 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.client.util;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.ode.client.exceptions.BPEUserException;
+
+public interface IInvokerBuilder
+{
+	public IBPEInvoker[] buildInvokers(String[] msgFiles)
+	  throws FileNotFoundException, IOException, BPEUserException;
+	
+	public IBPEInvoker buildInvoker(Properties invocation) 
+	  throws BPEUserException;
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/InvokerBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/InvokerBuilder.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/InvokerBuilder.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/client/util/InvokerBuilder.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on May 27, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.client.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.ode.client.IBPEClient;
+import org.apache.ode.client.exceptions.BPEUserException;
+
+/**
+ * @author blorenz
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class InvokerBuilder implements IInvokerBuilder
+{
+	private String packageName;
+	
+	public InvokerBuilder( ) {
+		packageName = "BPE";
+	}
+	
+	public InvokerBuilder( String packageName ) {
+		this.packageName = packageName;
+		//if ( System.getSecurityManager() == null ) {
+		//	System.setSecurityManager(new RMISecurityManager());
+		//}
+	}
+
+	public IBPEInvoker[] buildInvokers(String[] msgFiles)
+			throws FileNotFoundException, IOException, BPEUserException
+	{
+		// create the messages
+		IBPEInvoker[] invokers = new IBPEInvoker[msgFiles.length];
+		for (int j = 0; j < msgFiles.length; j++)
+		{
+			// each message is passed in a properties file for this utility
+			Properties msg = new Properties();
+			msg.load(new FileInputStream(new File(msgFiles[j])));
+			invokers[j] = buildInvoker(msg);
+		}
+		return invokers;
+	}
+
+	private IBPEInvoker createExternalInvoker(Properties invocation) throws
+     BPEUserException
+	{
+		String invokerImplClass = 
+		  invocation.getProperty( IBPEInvoker.INVOKER_IMPL );
+        if ( invokerImplClass != null )
+		{
+			try
+			{
+				Class invokerClass = Class.forName( invokerImplClass );
+				IBPEInvoker invokerInstance = (IBPEInvoker) invokerClass.newInstance();
+				invokerInstance.setInvocationSpec( invocation );
+				return invokerInstance;
+			}
+			catch (Exception e)
+			{
+				throw new RuntimeException(e);
+			}
+		}
+		return null;
+	}
+	
+	public IBPEInvoker buildInvoker(Properties invocation) throws BPEUserException
+	{
+		// Construct the invoker and pass in the
+		// operation data. Data unrelated to the operation
+		// will be ignored.
+		invocation.setProperty(IBPEClient.PACKAGE_NAME,packageName);
+		
+        IBPEInvoker bpi = createExternalInvoker(invocation);
+		if ( bpi == null )
+		{
+			bpi = new BPEInvoker(invocation);
+		}
+
+		// Each invocation is represented as a properties file.
+//		Properties operationDescriptor = invocation;
+		Properties partDescriptor = invocation;
+
+		//now set the parts of the message, specified as part1, part2, ...
+		// in the file
+		int i = 1;
+		while (true)
+		{
+			String partName = invocation.getProperty("part"
+					+ String.valueOf(i++));
+			if (partName == null)
+				break;
+			String[] partSplit = partName.split("\\.");
+			if (partSplit.length < 2)
+			{
+				System.out.println("part name requires a type prefix");
+				break;
+			}
+			String formatName = partSplit[0];
+			String simplePartName = partSplit[1];
+			Object partValue = invocation.get(partName);
+			partDescriptor.setProperty("formatName", formatName);
+			bpi.addPart(simplePartName, partValue, partDescriptor);
+		}
+		return bpi;
+	}
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/ConditionException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/ConditionException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/ConditionException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/ConditionException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.condition;
+
+import org.apache.ode.util.BPException;
+
+/**
+ * @author waterman
+ *
+ * 
+ * 
+ */
+public class ConditionException extends BPException {
+	
+	static final long serialVersionUID = 8108051051482664675L;
+
+	/**
+	 * @param message_id
+	 * @param msgParams
+	 */
+	public ConditionException(String message_id, Object[] msgParams) {
+		super(message_id, msgParams);
+	}
+
+	/**
+	 * @param message_id
+	 * @param msgParams
+	 * @param cause
+	 */
+	public ConditionException(
+		String message_id,
+		Object[] msgParams,
+		Throwable cause) {
+		super(message_id, msgParams, cause);
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/Conditional.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/Conditional.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/Conditional.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/Conditional.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,54 @@
+/*
+ * 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:  Conditional.java
+ * Author:  waterman
+ * Purpose: Defines the Interface Conditional
+ ***********************************************************************/
+
+package org.apache.ode.condition;
+
+import org.apache.ode.context.resolver.ContextResolver;
+import org.apache.ode.util.BPException;
+
+/** The condition interface defines a conditional evaluation interface. The business process algorithm will invoke conditional evaluation code through this interface. 
+  * <P>
+  * There can be any number of implementations ( i.e. XPATH, Rule Engine - JSR94, etc ... )
+  * <P>
+  * Some business process pattern functions will utilize implementations. */
+public interface Conditional
+{
+   /** This method enables configuration data to be passed to the implementation..
+     * <P>
+     * An implementation may be looking for very specfic name/value pairs within the properties input param.
+     * <P> 
+     * The implementation may also take this opportunity to acquire system resources.
+     * 
+     * @param properties Configuration data required by the Condition implementation.
+     * @exception ConditionException */
+   void init(java.util.Properties properties) throws BPException;
+   /** Returns a list of Subscriptions. Subscriptions are used to map positive evaluation results to actions.
+     * <P>
+     * If the object has not been initialized an execute call should through an un-initialized exception.
+     * 
+     * @param inputContainers a collection of immutable DataContainers
+     * @param outputContainers a collection of mutable DataContainers
+     * @exception ConditionException */
+   boolean evaluate(ContextResolver resolver) throws BPException;
+   /** Releases any resources the Condition implementation may have acquired at initialization. After release the object must be initialized before execute can be called. */
+   void release();
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/ConditionalFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/ConditionalFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/ConditionalFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/ConditionalFactory.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.condition;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.definition.IPMDChangeCondition;
+import org.apache.ode.util.BPException;
+
+/** The factory will instantiate Condition implementations.
+  * <P>
+  * The data used to create a Contion instance is obtained from the process definition classes.
+  * 
+  * 
+  * @see IPMDChangeCondition */
+public class ConditionalFactory
+{
+	
+	private static Logger logger = 
+		Logger.getLogger(ConditionalFactory.class.getName());
+		
+   /** instantiate a Condition implementation
+	 * 
+	 * @param className The fully qualified name of a Java class that implements the Condition interface.
+	 * @param properties Properties needed by the Condition implementation so that it will properly initialize.
+	 * @exception ConditionException */
+   public static Conditional createConditional(java.lang.String className, java.util.Properties props) throws BPException
+   {
+		Conditional ret = null;
+		
+		try {
+			// load the Conditional implementation
+			Class instClass = java.lang.Class.forName(className);
+			// try to instantiate the subclass
+			ret = (Conditional) instClass.newInstance();
+			ret.init(props);
+			
+		} catch (ClassNotFoundException e) {
+			ConditionException bpx = new ConditionException("CLASS_NOT_FOUND",new Object[] {className});
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		} catch (InstantiationException e) {
+			ConditionException bpx = new ConditionException("NATIVE_EXCEPTION",new Object[] {"InstantiationException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		} catch (IllegalAccessException e) {
+			ConditionException bpx = new ConditionException("NATIVE_EXCEPTION",new Object[] {"IllegalAccessException"},e);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		}	
+		
+		return ret;
+   }
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/DefaultConditional.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/DefaultConditional.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/DefaultConditional.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/DefaultConditional.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.condition;
+
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.context.resolver.ContextResolver;
+
+/**
+ * @author waterman
+ *
+ * The default implementations does nothing
+ * 
+ */
+public class DefaultConditional implements Conditional {
+	
+	private static Logger logger = 
+		Logger.getLogger(DefaultConditional.class.getName());
+	
+	private Properties attributes;
+	
+	public DefaultConditional() {
+	}
+
+	/**
+	 * @see org.apache.ode.condition.Conditional#init(Properties)
+	 */
+	public void init(Properties properties) throws ConditionException {
+		attributes = properties;
+	}
+
+	/**
+	 * @see org.apache.ode.condition.Conditional#evaluate(Collection, Collection)
+	 */
+	public boolean evaluate(ContextResolver resolver)
+		throws ConditionException {
+			
+		Enumeration e = attributes.elements();
+		while ( e.hasMoreElements() ) {
+			logger.log(Level.FINE,(String)e.nextElement());			
+		}
+		
+		return true;
+	}
+
+	/**
+	 * @see org.apache.ode.condition.Conditional#release()
+	 */
+	public void release() {
+		attributes = null;
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/XPathJoinConditional.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/XPathJoinConditional.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/XPathJoinConditional.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/XPathJoinConditional.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,91 @@
+/*
+ * 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 Jun 25, 2003
+ *
+ */
+package org.apache.ode.condition;
+
+import java.util.Properties;
+//import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.JaxenUtil;
+import org.apache.ode.action.bpel.UnInitVariableMetaData;
+import org.apache.ode.action.bpel.XPathJaxenExpression;
+import org.apache.ode.context.resolver.ContextResolver;
+import org.apache.ode.util.BPException;
+
+/**
+ * @author waterman
+ *
+ */
+public class XPathJoinConditional implements Conditional {
+
+//	private static Logger logger = 
+//		Logger.getLogger(XPathJoinConditional.class.getName());
+
+	public static final String JOIN_EXPRESSION_KEY="JoinExpression";
+	public static final String SUPPRESS_KEY = "SuppressJoinFault";
+	public static final String UNINITVAR_KEY = "UNINITVAR";
+
+	protected XPathJaxenExpression m_joinExpression;
+	protected Boolean m_suppressJoinFault;
+	protected UnInitVariableMetaData varExcept;
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.condition.Conditional#init(java.util.Properties)
+	 */
+	public void init(Properties properties) throws BPException {
+		if ( properties != null && properties.get(JOIN_EXPRESSION_KEY) != null ) {
+			m_joinExpression = (XPathJaxenExpression)(properties.get(JOIN_EXPRESSION_KEY));
+			m_suppressJoinFault = (Boolean)properties.get(SUPPRESS_KEY);
+			m_joinExpression.getExpressionTree();
+		}
+		
+		if ( properties.get(UNINITVAR_KEY) == null ) {
+			throw new ConditionException("NULL_PROP",new Object[] {UNINITVAR_KEY,XPathJoinConditional.class.getName()},null);
+		} else {
+			varExcept = (UnInitVariableMetaData)properties.get(UNINITVAR_KEY);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.condition.Conditional#evaluate(org.apache.ode.context.resolver.ContextResolver)
+	 */
+	public boolean evaluate(ContextResolver resolver) throws BPException {
+		boolean ret = true;
+			
+			// evaluate the joinCondition, if non exists the default is true
+			if ( m_joinExpression != null ) {
+				ret = JaxenUtil.evalBool(resolver,m_joinExpression,varExcept);
+			}
+			
+			if ( !ret && !m_suppressJoinFault.booleanValue() ) {
+				// join faults have not been suppressed
+				// TODO: Lance - throw bpws:joinFailure exception
+			}
+		
+
+		return ret;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.condition.Conditional#release()
+	 */
+	public void release() {
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/XPathTransitionConditional.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/XPathTransitionConditional.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/XPathTransitionConditional.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/condition/XPathTransitionConditional.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,113 @@
+/*
+ * 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 Jun 25, 2003
+ *
+ */
+package org.apache.ode.condition;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.JaxenUtil;
+import org.apache.ode.action.bpel.XPathJaxenExpression;
+import org.apache.ode.context.resolver.ContextResolvedObject;
+import org.apache.ode.context.resolver.ContextResolver;
+import org.apache.ode.util.BPException;
+import org.apache.ode.util.xpath.XPathBoolean;
+
+/**
+ * @author waterman
+ * 
+ * This Conditional implementation is specific to BPEL. It handles the 
+ * joinCondition and transitionCondition evaluations. It also sets the 
+ * outgoing link status variable within the process context.
+ *
+ */
+public class XPathTransitionConditional extends XPathJoinConditional {
+
+	protected static Logger logger = 
+		Logger.getLogger(XPathTransitionConditional.class.getName());
+
+	public static final String TRAN_EXPRESSION_KEY="TransitionExpression";
+	public static final String DEFAULT_CONDITION = "default_condition";
+
+	private HashMap m_jaxenExpression;
+
+	/**
+	 * @see org.apache.ode.condition.Conditional#init(java.util.Properties)
+	 */
+	public void init(Properties properties) throws BPException {
+		super.init(properties);
+		
+		if ( properties != null ) {
+			HashMap m_tranExpression = (HashMap)properties.get(TRAN_EXPRESSION_KEY);
+			
+			if ( m_tranExpression != null ) {
+				
+				m_jaxenExpression = new HashMap(m_tranExpression.size());
+	
+				// Iterate over links
+				for ( Iterator linkItr = m_tranExpression.entrySet().iterator(); linkItr.hasNext(); ) {
+					Map.Entry link = (Map.Entry)linkItr.next();
+					if ( link.getValue().equals(DEFAULT_CONDITION) ) {
+						m_jaxenExpression.put(link.getKey(),link.getValue());
+					}else {
+						XPathJaxenExpression xpe = (XPathJaxenExpression)link.getValue();
+						xpe.getExpressionTree();
+						m_jaxenExpression.put(link.getKey(),xpe);
+					}
+				}
+			}
+		}
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.ode.condition.Conditional#evaluate(org.apache.ode.context.resolver.ContextResolver)
+	 */
+	public boolean evaluate(ContextResolver resolver) throws BPException {
+		
+		
+		boolean join = true;
+		boolean tran = true;
+			
+			join = super.evaluate(resolver);
+			
+			// Iterate over links
+			for ( Iterator linkItr = m_jaxenExpression.entrySet().iterator(); linkItr.hasNext(); ) {
+				Map.Entry link = (Map.Entry)linkItr.next();
+
+				tran = join;
+
+				// Evaluate the transition Condition for the link
+				if ( join && !link.getValue().equals(DEFAULT_CONDITION) ) tran = JaxenUtil.evalBool(resolver,(XPathJaxenExpression)link.getValue(),varExcept);
+				 
+				// Set the outgoing LinkStatus variable. If there is no transitionCondition 
+				// the outgoing link status assumes the value of the joinCondition
+				((ContextResolvedObject)resolver.resolveBPContext((String)link.getKey())).setObject(new XPathBoolean(tran));
+				
+			}
+			
+
+		return join;
+	
+	}
+
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/IAccessControl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/IAccessControl.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/IAccessControl.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/IAccessControl.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,22 @@
+/*
+ * 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.context;
+
+public interface IAccessControl
+{
+	public void setReadOnly(boolean iReadOnly);
+	public boolean getReadOnly();
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/ICloneable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/ICloneable.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/ICloneable.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/ICloneable.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,23 @@
+/*
+ * 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.context;
+
+import org.apache.ode.context.base.ContextServiceException;
+
+public interface ICloneable
+{
+	public Object cloneObject() throws ContextServiceException;
+}

Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/IContainer.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/IContainer.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/IContainer.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/context/IContainer.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,92 @@
+/*
+ * 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.context;
+
+import java.util.Collection;
+
+import org.apache.ode.context.base.ContextServiceException;
+
+/**
+ * IContainer defines a node within a process context tree. An implementation of
+ * IContainer holds the datastructure of the process context tree. A process 
+ * context tree is used to scope business process data variables.
+ * <P>
+ * Client applications (i.e. BPED,BPEE ) use the IContainer to insert data 
+ * variables into a searchable tree.
+ * <P>
+ * IContainer implementations can be either transient or persistent. A transient
+ * IContainer would be used for stateless business processes.
+ * 
+ * @author lorenz/waterman
+ */
+public interface IContainer extends INode
+{
+	/**
+	 * Create a child node with the current container node as its parent. The method first 
+	 * checks to see if a node currently exists for the locator. If a node is
+	 * found it is returned else a new IContainer node is created.
+	 * 
+	 * @param iContainerLocator the unique name of the container node. The name must be unique within its parent scope.
+	 * @return the requested container node
+	 * @throws ContextServiceException
+	 */
+	public IContainer createContainer( String iContainerLocator ) throws ContextServiceException;
+	/**
+	 * Create a part node with the current container node as its parent. The method first
+	 * checks to see if a node currently exists for the locator. If a node is found
+	 * it is returned else a new IContainer node is created.
+	 * 
+	 * @param iPartLocator the unique name of the part node. The name must be unique within its parent scope.
+	 * @return the requested part node
+	 * @throws ContextServiceException
+	 */
+	public IPart createPart( String iPartLocator ) throws ContextServiceException;
+	/**
+	 * Search for a child node within the scope of the current IContainer. If not 
+	 * found return null.
+	 * 
+	 * @param iChildLocator the unique name of the child node
+	 * @return the requested {@link IPart IPart} or {@link IContainer IContainer} node
+	 * @throws ContextServiceException
+	 */
+	public INode findChild( String iChildLocator ) throws ContextServiceException ;
+	/**
+	 * Removes the node from the current IContainer children. If the requested 
+	 * node is not found the method successfully finishes without warning.
+	 * 
+	 * @param iChildLocator the unique name of the child node to delete
+	 * @throws ContextServiceException
+	 */
+	public void removeChild( String iChildLocator ) throws ContextServiceException;
+	/**
+	 * Moves an INode from its parent to the current IContainer. 
+	 * 
+	 * @param iSourceNode the node to be moved
+	 * @param iTargetName a new name to assign to the node after the move
+	 * @throws ContextServiceException
+	 */
+	public void moveNode( INode iSourceNode, String iTargetName ) throws ContextServiceException;
+	/**
+	 * Returns an immutable collection of all child nodes.
+	 * 
+	 * @return an immutable collection
+	 * @throws ContextServiceException
+	 * @throws UnsupportedOperationException
+	 */
+	public void copyNode( INode iSourceNode, String iTargetName ) throws ContextServiceException;
+	
+	public Collection getChildren() throws ContextServiceException;
+}