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

svn commit: r381686 [20/40] - in /incubator/ode/scratch/bpe: ./ bpelTests/ bpelTests/probeService/ bpelTests/test1/ bpelTests/test10/ bpelTests/test12/ bpelTests/test13/ bpelTests/test14/ bpelTests/test15/ bpelTests/test16/ bpelTests/test17/ bpelTests/...

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ContextResolver.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ContextResolver.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ContextResolver.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ContextResolver.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,484 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.resolver;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.ArrayList;
+
+
+import com.sybase.bpe.context.IContainer;
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.context.IPart;
+import com.sybase.bpe.context.base.ContextServiceException;
+import com.sybase.bpe.context.test.SerializationContext;
+import com.sybase.bpe.definition.IPMDLocator;
+import com.sybase.bpe.definition.IPMDLocatorHolder;
+import com.sybase.bpe.instance.IPMIProcess;
+import com.sybase.bpe.interaction.IInteraction;
+import com.sybase.bpe.interaction.IInvocation;
+import com.sybase.bpe.interaction.InteractionException;
+import com.sybase.bpe.interaction.InteractionFactory;
+import com.sybase.bpe.scope.service.IScopeService;
+import com.sybase.bpe.scope.service.ScopePath;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.interaction.query.IQuery;
+import com.sybase.bpe.interaction.query.JaxenXPathSingleNodeQuery;
+
+/**
+ * @author charper
+ */
+public class ContextResolver implements IResolver {
+	
+	private static Logger logger = 
+		Logger.getLogger(ContextResolver.class.getName());
+	
+	private IPMIProcess process;
+	private IContextService cs;
+	private IPMDLocatorHolder lc;
+	private IScopeService ss;
+	private IContainer rootCont ;
+	private IContainer globalCont;
+	
+	/**
+	 * 
+	 * @param process
+	 * @param cs
+	 */
+	public ContextResolver(IPMIProcess process, 
+		IPMDLocatorHolder lc , IContextService cs, IScopeService ss){
+		this.process = process;
+		this.lc = lc;
+		this.cs = cs;
+		this.ss = ss;
+	}
+	
+
+
+	// handle the case where the scope was not absolute
+	private IPart scopeIt(int depth, String scope, String path) 
+		throws ContextServiceException {
+		
+		String[] scope_path = scope.split(ScopePath.DELIMITER);
+		String[] relpath = path.split(ScopePath.DELIMITER);
+
+		IPart foundPart = null;
+		
+		// navigate the context service
+		// if we reach a null stop 
+		IContainer containerPointer = globalCont;
+		for ( int i = depth; i < scope_path.length ; i++ ) {
+			IContainer foundContainer = (IContainer) containerPointer.findChild(scope_path[i]);
+			if (foundContainer == null ) {
+				break;
+			} else {
+				containerPointer = foundContainer;
+			}
+		}
+		for ( int i = 0; i < relpath.length-1 ; i++ ) {
+			IContainer foundContainer = (IContainer) containerPointer.findChild(relpath[i]);
+			if (foundContainer == null ) {
+				break;
+			} else {
+				containerPointer = foundContainer;
+			}
+		}
+
+		// get the part 
+			try {
+				foundPart = (IPart)containerPointer.findChild(relpath[relpath.length-1]);
+			// if we find a container of the same name as the part we are looking for
+			} catch ( ClassCastException cce ) {
+				foundPart = null;
+			}
+		
+		// if we didn't find the part try the next scope
+		if ( foundPart == null ) {
+			if ( depth < scope_path.length ) {
+				foundPart = scopeIt(depth+1,scope,path);
+			} else {
+				return null;
+			}
+		} 		
+		return foundPart;
+		
+	}
+	
+	// handle the case where the scope was absolute
+	private IPart getIt(String path) throws ContextServiceException {
+		String[] pathing = path.split(ScopePath.DELIMITER);
+		// navigate the context service
+		// create the path as we go if it is not created
+		IContainer containerPointer = globalCont;
+		for ( int i = 1; i < pathing.length-1 ; i++ ) {
+			IContainer foundContainer = (IContainer) containerPointer.findChild(pathing[i]);
+			if (foundContainer == null ) {
+				if ( logger.isLoggable(Level.FINE) ) {
+					logger.fine("Creating container("
+							+process.getContextContainerId()+"):" + pathing[i]);
+				}
+				containerPointer = containerPointer.createContainer(pathing[i]);
+			} else {
+				containerPointer = foundContainer;
+			}
+		}
+		
+		// now we should have the container for the part
+		// the part name is the last string in the pathing
+		IPart part = (IPart)containerPointer.findChild(pathing[pathing.length-1]);
+		if ( part == null ) {
+			if ( logger.isLoggable(Level.FINE) ) {
+				logger.fine("Creating part:("
+							+process.getContextContainerId()+")" + pathing[pathing.length-1]);
+			}
+			part = containerPointer.createPart(pathing[pathing.length-1]);
+		}
+		return part;
+	}
+
+	public IResolvedObject resolveBPContext(String locator) throws BPException {
+		
+		IResolvedObject retVal = null;
+		try {
+			retVal = resolve(locator);
+		} catch ( ResolverException re ) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"ResolverException"},re);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		}
+		return retVal;
+	}
+	
+	// resolve a object and don't apply the invocation if there is one
+	public IResolvedObject resolveWithOutInvocation(String locator) throws BPException {
+		IResolvedObject retVal = null;
+		try {
+			retVal = resolve(locator,false);
+		} catch ( ResolverException re ) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"ResolverException"},re);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		}
+		return retVal;
+	}
+	
+	public IResolvedObject resolveWithOutInvocation(IPMDLocator locator) throws BPException {
+		IResolvedObject retVal = null;
+		try {
+			retVal = resolve(locator,false);
+		} catch ( ResolverException re ) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"ResolverException"},re);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		}
+		return retVal;
+	}
+	
+	public IResolvedObject resolve(String locator) throws ResolverException {
+		return resolve(locator,true);
+	}
+
+	/* (non-Javadoc)
+	 * @see com.sybase.bnrule.resolver.IResolver#resolve(java.lang.String)
+	 */
+	public IResolvedObject resolve(String locator,boolean invocation) throws ResolverException {
+
+		// get the locator
+		IPMDLocator  locatorObj = lc.getLocator(locator);
+		return resolve(locatorObj,invocation);
+	}
+		
+		
+	public IResolvedObject resolve(IPMDLocator locatorObj, boolean invocation) throws ResolverException {
+		
+		IPart part = getPart(locatorObj);
+		Object resolvedObj = getResolvedObject(locatorObj,part);
+		Object returnObj = null;
+		
+			try {
+				// query the object if we need to
+				IInvocation query = locatorObj.getQuery();
+				if ( query != null && invocation ){
+					
+					IInteraction interaction = null;
+					if ( resolvedObj instanceof String ) {
+						// create a new interaction
+						resolvedObj =
+							InteractionFactory.newInstance().createXMLInteraction(
+								((String)resolvedObj).getBytes());
+					}
+				
+					interaction = (IInteraction)resolvedObj;
+								
+					// invoke the interaction
+					////////////////////////////////
+					// JJ 12-16-03: this line is throw null pointer exception
+					//              because interaction is null for some cases
+					// TO DO:
+					//   CORY WILL REVIEW THIS CHANGE
+					if (interaction != null) {
+					// 
+					////////////////////////////////
+						// This query could have one or more variables inside of it.  To handle this
+						// case we need to set a VariableContext into the query so that the included
+						// variables can be resolved.
+						IQuery iq = query.getQuery();
+						if (iq instanceof JaxenXPathSingleNodeQuery)
+						{
+							JaxenXPathSingleNodeQuery jxp =
+								(JaxenXPathSingleNodeQuery) iq;
+							try{
+								jxp.createLocator().setVariableContext(new ResolverVariableContext(this));
+
+							}
+							catch(Exception e)
+							{
+								throw new ResolverException(e);
+							}
+						}
+						returnObj = interaction.invoke(query);
+					}
+					
+				}
+				//  else {
+				//	if ( resolvedObj instanceof IInteraction ) {
+				//		returnObj = ((IInteraction)resolvedObj).toString();
+					 else {
+						returnObj = resolvedObj;
+					}
+				//}
+				
+			} catch (InteractionException e) {
+				throw new ResolverException(e);
+			}
+
+			// now we should have the part and we can return the object
+			return new ContextResolvedObject(locatorObj.getName(),returnObj,resolvedObj,
+				locatorObj.getType(),part,locatorObj.getQuery(),locatorObj.getInteractionBuilder());
+		
+	}
+	
+
+    public IResolvedObject resolveForUpdateBPContext(String locator) throws BPException {
+
+		IResolvedObject retVal = null;
+		
+		try {
+			retVal = resolveForUpdate(locator);
+		} catch (ResolverException re) {
+			BPException bpx = new BPException("NATIVE_EXCEPTION",new Object[] {"ResolverException"},re);
+			bpx.log(logger,Level.SEVERE);
+			throw bpx;
+		}
+		
+		return retVal;
+		
+
+    }
+	
+	public IResolvedObject resolveForUpdate(String locator) throws ResolverException {
+
+		// get the locator
+		IPMDLocator  locatorObj = lc.getLocator(locator);
+		IPart part = getPart(locatorObj);
+		Object resolvedObj = getResolvedObject(locatorObj,part);
+
+		if (locatorObj.getQuery() != null)
+		{
+			IQuery iq = locatorObj.getQuery().getQuery();
+			if ((iq != null)&& (iq instanceof JaxenXPathSingleNodeQuery))
+			{
+				JaxenXPathSingleNodeQuery jxp = (JaxenXPathSingleNodeQuery) iq;
+				try
+				{
+					jxp.createLocator().setVariableContext( new ResolverVariableContext(this) );
+				}
+				catch(Exception e)
+				{
+					throw new ResolverException(e);
+				}
+			}
+		}
+		
+		// now we should have the part and we can return the object
+		return new ContextResolvedObject(locator,null,resolvedObj,
+			locatorObj.getType(),part,locatorObj.getQuery(),locatorObj.getInteractionBuilder());
+			
+
+	}
+	
+	private IPart getPart(IPMDLocator  locatorObj) throws ResolverException	{
+
+			IPart part = null;
+			try {
+				// now that we have a locator get the object out of the context service			
+				//	get the root container
+				rootCont = cs.getRoot();
+				 // get the global container for the process
+				globalCont = (IContainer)rootCont.findChild(process.getContextContainerId());
+
+				// apply the current scope path
+				String path = process.getScopePath().applyPathIdsToPath(
+						locatorObj.getPath());
+				
+				//ArrayList path = locatorObj.getArrayListPath();
+				
+				// we need to scope it if it was not absolute
+				if ( ! locatorObj.isAbsolute() ) {
+					if ( logger.isLoggable(Level.FINE )) {
+						logger.fine("Trying to reslove relative path:" +
+								path + " in context conainer:" + process.getContextContainerId());
+					}
+					part = scopeIt(1,process.getScopePath().toString(),path);
+					// if we didn't find anything create it
+					if ( part == null ) {
+						String fullPath = process.getScopePath().getScopeNamePath()+
+							ScopePath.DELIMITER+path;
+						part = getIt(fullPath);
+					}
+				} else {
+					part = getIt(path);
+					if ( logger.isLoggable(Level.FINE )) {
+						logger.fine("Resloved path:" +
+								path + " in context conainer:" + 
+								process.getContextContainerId() +
+								"  to " + part);
+					}
+				}
+			} catch (ContextServiceException e) {
+				throw new ResolverException(e);
+			}
+			return part;		
+	}
+	
+	private Object getResolvedObject(IPMDLocator  locatorObj, IPart part) throws ResolverException {
+
+		// get the object to return
+		Object resolvedObj=null;
+			
+		try {
+			// if the object is for output and is contentious get it for read write with lock
+			if ( locatorObj.getForOutput() && locatorObj.getContentious() ) {
+				// TODO: Brian - resolvedObj = part.getObjectForReadWriteWithLock();
+				resolvedObj = part.getObjectForReadWrite();
+			// if the object is for output only get it for read write
+			} else if ( locatorObj.getForOutput() ) {
+				resolvedObj = part.getObjectForReadWrite();
+			// if the object is input only get it for read
+			} else {
+				resolvedObj = part.getObjectForRead();
+			}
+			
+			// dump the context serives at finest logging level
+			if ( logger.isLoggable(Level.FINEST)){
+				SerializationContext sc = new SerializationContext(System.out);
+				sc.serialize(cs);
+			}
+		} catch (ContextServiceException e) {
+			throw new ResolverException(e);
+		} catch (Exception e) {
+			throw new ResolverException(e);
+		}
+		
+		return resolvedObj;
+		
+	}
+	
+	/**
+	 * Get the scope service.
+	 * @return the scope service
+	 */
+	public IScopeService getScopeService(){
+		return this.ss;
+	}
+	
+	/**
+	 * Get the Context Service
+	 * @return the context service
+	 * @author charper
+	 */
+	public IContextService getContextService(){
+		return this.cs;
+	}
+	
+	/**
+	 * Get the locator holder that this resolver is associated with
+	 * @return locator holder
+	 */
+	public IPMDLocatorHolder getLocatorHolder() {
+		return this.lc;
+	}
+	
+	public IPMIProcess getProcess() {
+		return process;
+	}
+	
+	public String getLoggingString(String locator)throws ResolverException
+	{
+		IPMDLocator  locatorObj = lc.getLocator(locator);
+		String rtnStr = "Variable: ";
+		//rtnStr += locatorObj.getPath();
+		ArrayList al = locatorObj.getArrayListPath();
+		int size = al.size();
+		int index = size - 2;
+		rtnStr += (String) al.get(index);
+		rtnStr += ":";
+		index++;
+		rtnStr += (String) al.get(index);
+		
+		if (locatorObj.getQuery() != null)
+		{
+			rtnStr += " query: ";
+			IQuery iq =  locatorObj.getQuery().getQuery();
+			if (iq instanceof JaxenXPathSingleNodeQuery)
+			{
+				JaxenXPathSingleNodeQuery jsnq = (JaxenXPathSingleNodeQuery) iq;
+				try{
+					rtnStr += jsnq.getXPathExpression();
+				}
+				catch(Exception e)
+				{
+					throw new ResolverException(e);
+				}
+				
+			}
+		}
+		
+		return rtnStr;
+		
+	}
+	
+	public String getResolvedVariableName(String locator)
+	{
+		String rtnStr;
+		IPMDLocator  locatorObj = lc.getLocator(locator);
+		ArrayList al = locatorObj.getArrayListPath();
+		int size = al.size();
+		int index = size - 2;
+		rtnStr = (String) al.get(index);
+		rtnStr += ":";
+		index++;
+		rtnStr += (String) al.get(index);
+		return rtnStr;
+	}
+	
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/IResolvedObject.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/IResolvedObject.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/IResolvedObject.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/IResolvedObject.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,46 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.resolver;
+
+/**
+ * @author jjin
+ *
+ */
+public interface IResolvedObject {
+	public String getName();
+	public Object getValue();
+	public int getType();
+	// type definitions in BNRuleConstant.java:
+	// public static final int TYPE_UNDEFINED = 0;
+	// public static final int TYPE_BOOLEAN = 1;
+	// public static final int TYPE_BYTE = 2;
+	// public static final int TYPE_CHAR = 3;
+	// public static final int TYPE_SHORT = 4;
+	// public static final int TYPE_INTEGER = 5;
+	// public static final int TYPE_LONG = 6;
+	// public static final int TYPE_FLOAT = 7;
+	// public static final int TYPE_DOUBLE = 8;
+	// public static final int TYPE_CALENDAR = 9;
+	// public static final int TYPE_STRING = 10;
+	// public static final int TYPE_DOM = 11;
+	// public static final int TYPE_ARRAY = 12;
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/IResolver.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/IResolver.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/IResolver.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/IResolver.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,31 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.resolver;
+
+
+/**
+ * @author jjin
+ *
+ */
+public interface IResolver {
+	public IResolvedObject resolve(String locator) throws ResolverException;
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ResolverException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ResolverException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ResolverException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ResolverException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,43 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.resolver;
+
+/**
+ * @author jjin
+ *
+ */
+public class ResolverException extends Exception {
+	static final long serialVersionUID = -7164649110411348308L;
+
+	public ResolverException() {
+		super();
+	}
+	public ResolverException(String message) {
+		super(message);
+	}
+	public ResolverException(String message, Throwable cause) {
+		super(message,cause);
+	}
+	public ResolverException(Throwable cause)  {
+		super(cause);
+	}
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ResolverVariableContext.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ResolverVariableContext.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ResolverVariableContext.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/resolver/ResolverVariableContext.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,93 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+
+package com.sybase.bpe.context.resolver;
+
+import org.jaxen.UnresolvableException;
+import org.jaxen.VariableContext;
+
+import com.sybase.bpe.util.xpath.XPathBoolean;
+
+/**
+ * @author charper
+ *
+ */
+public class ResolverVariableContext implements VariableContext {
+
+	private ContextResolver resolver;
+	public static final String NULLVALUE_EXCEPTION="NULLVALUE_EXCEPTION";
+	
+	public ResolverVariableContext (ContextResolver resolver){
+		this.resolver = resolver;
+	}
+	/* (non-Javadoc)
+	 * @see org.jaxen.VariableContext#getVariableValue(java.lang.String, java.lang.String, java.lang.String)
+	 */
+	public Object getVariableValue(String namespaceUri, String prefix,
+			String location) throws UnresolvableException
+	{
+		try
+		{
+			Object o = resolver.resolve(location).getValue();
+			if (o != null)
+			{
+				if (o instanceof XPathBoolean)
+				{
+					// The Jaxen evaluator uses static object references within
+					// logical operators - covert context boolean to static
+					// boolean
+					o = (((XPathBoolean) o).booleanValue())
+							? Boolean.TRUE
+							: Boolean.FALSE;
+				} else
+				{
+					o = o.toString();
+					// See if we can turn this into Integer.  We unfortunately do not have any
+					// type information.  The following xpath will not work if you do not
+					// return an integer.  So it seems we are stuck with the following solution.
+					try{
+						Integer i = new Integer((String)o);
+						// if we got to here, it didn't throw
+						o = i;
+					}
+					catch(java.lang.NumberFormatException e)
+					{
+						//It threw an exception.  The contents of o are not an integer.
+						//Don't need to do anything.
+					}
+				}
+			}
+			else
+			{
+				//throw new UnresolvableException(NULLVALUE_EXCEPTION + ":"
+				//		+ location);
+				throw new UnresolvableException(NULLVALUE_EXCEPTION + ": An error occurred accessing the following: " + 
+						resolver.getLoggingString(location) + " The variable value is null.");
+			}
+			return o;
+		} catch (ResolverException e)
+		{
+			throw new UnresolvableException(e.getMessage());
+		}
+	}
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/AssortedContextOperationsUnitTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/AssortedContextOperationsUnitTest.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/AssortedContextOperationsUnitTest.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/AssortedContextOperationsUnitTest.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,86 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.context.ejb.test.performance.AssortedContextOperationsBase;
+import com.sybase.bpe.interaction.IInteraction;
+
+public class AssortedContextOperationsUnitTest
+	extends AssortedContextOperationsBase
+{
+	public AssortedContextOperationsUnitTest()
+	{
+	}
+	
+	public void setServiceFactory( IServiceFactory iFactory )
+	{
+		m_serviceFactory = iFactory;
+	}
+	
+	public void setInteractionFactory( IInteractionObjectFactory iFactory)
+	
+	{
+		m_interactionFactory = iFactory;
+	}
+	
+
+	protected IContextService createContextService() throws Exception
+	{
+		if ( m_contextService != null  && m_useCache )
+		{
+			return m_contextService;
+		}
+		else
+		{
+			m_contextService = m_serviceFactory.createContextService();
+			return m_contextService;
+		}
+	
+	}
+	
+	protected IInteraction createInteractionObject() throws Exception
+	{
+		if ( m_interaction == null )
+		{
+			m_interaction = m_interactionFactory.createInteractionObject();
+		}
+		
+		return m_interaction;
+	}
+	
+	protected void runIteration() throws Exception
+	{
+		m_userTransaction.begin();
+		super.runIteration();
+		m_userTransaction.commit();
+	}
+	
+
+	
+	private IContextService m_contextService = null;
+	private IServiceFactory m_serviceFactory = null;
+	private IInteractionObjectFactory m_interactionFactory = null;
+	private IInteraction m_interaction = null;
+	private boolean m_useCache = false;
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/BMPContextServiceTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/BMPContextServiceTest.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/BMPContextServiceTest.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/BMPContextServiceTest.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,37 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import com.sybase.bpe.util.BPEProperties;
+
+public class BMPContextServiceTest extends J2EEContextServiceTest
+{
+
+	public BMPContextServiceTest()
+	{
+
+		super();
+		setProperty( BPEProperties.DOF_EJB_HOME_KEY, BPEProperties.DOF_BMP_HOME );
+	}
+
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/CMPContextServiceTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/CMPContextServiceTest.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/CMPContextServiceTest.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/CMPContextServiceTest.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,37 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import com.sybase.bpe.util.BPEProperties;
+
+public class CMPContextServiceTest extends J2EEContextServiceTest
+{
+	public CMPContextServiceTest()
+	{
+
+		super();
+		setProperty( BPEProperties.DOF_EJB_HOME_KEY, BPEProperties.DOF_CMP_HOME );
+	}
+	
+	
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/ContextServiceTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/ContextServiceTest.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/ContextServiceTest.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/ContextServiceTest.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,530 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.StringTokenizer;
+
+import com.sybase.bpe.context.IContainer;
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.context.IHandle;
+import com.sybase.bpe.context.INode;
+import com.sybase.bpe.context.IPart;
+import com.sybase.bpe.context.base.ContextServiceException;
+import com.sybase.bpe.context.base.ContextServiceFactory;
+import com.sybase.bpe.context.base.TestUtil;
+import com.sybase.bpe.interaction.IInteraction;
+import com.sybase.bpe.interaction.InteractionFactory;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.uuid.UUIDServiceException;
+import com.sybase.bpe.uuid.UUIDServiceFactory;
+
+public abstract class ContextServiceTest implements IServiceFactory, IInteractionObjectFactory
+{
+
+	public void assertTrue(boolean iCheckThis) throws Exception
+	{
+		if (!iCheckThis)
+		{
+			throw new Exception("Assertion failed.");
+		}
+	}
+	
+	protected void scrub() throws Exception 
+	{
+		getContextService().getRoot().removeChild(PROCESS_ROOT);
+	}
+
+	public ContextServiceTest()
+	{
+		setOutputStream(System.out);
+		if ( System.getProperty("os.name").equals("Linux") ){
+			m_properties.setUUIDServiceClass("com.sybase.bpe.uuid.connector.service.LinUUIDService");
+		}
+	}
+
+	public void setOutputStream(OutputStream iOutputStream)
+	{
+		m_outputStream = iOutputStream;
+		m_serializationContext = new SerializationContext(iOutputStream);
+	}
+
+	public void buildBaseStructure() throws Exception
+	{
+		
+		setDataObject(PART1_PATH, STRING_DATA_1);
+		setDataObjectByHandle(PART2_PATH, STRING_DATA_2);
+		setDataObjectByHandle(PART3_PATH, STRING_DATA_3);
+		setDataObjectByHandle(INTERACTION_PATH, createInteractionObject() );
+		checkSerialization();
+	}
+	
+	private void checkSerialization() throws Exception
+	{
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		ObjectOutputStream oos = new ObjectOutputStream( baos);
+		m_serializationContext.printComment("Checking Serialzation:");
+		INode node = lookupNode(PROCESS_ROOT);
+		oos.writeObject( node );
+		m_serializationContext.printComment("Serialized size = " + baos.toByteArray().length );
+		m_serializationContext.printComment("Serialized tree:");
+		m_serializationContext.printBytes( baos.toByteArray());
+		oos.close();
+		baos.close();
+		m_serializationContext.println("");
+		
+	}
+	
+	protected OutputStream getOutputStream()
+	{
+		return m_outputStream;
+	}
+	
+
+	private void setDataObject(String iPartLocator, Object iObject)
+		throws Exception
+	{
+		IPart part = createPart(iPartLocator);
+		part.setObject(iObject);
+
+	}
+
+	private void setDataObjectByHandle(String iPartLocator, Object iObject)
+		throws Exception
+	{
+		IHandle handle = getContextService().createObjectHandle(iObject);
+		IPart part = createPart(iPartLocator);
+
+		part.setObjectHandle(handle);
+	}
+
+	private IPart createPart(String iPartLocator) throws Exception
+	{
+		
+		IContextService iService = getContextService();
+		StringTokenizer tokenizer = new StringTokenizer(iPartLocator, "/");
+		INode currentNode = iService.getRoot();
+		while (tokenizer.hasMoreTokens())
+		{
+			String currentToken = tokenizer.nextToken();
+			IContainer currentContainer = (IContainer) (currentNode);
+			if (tokenizer.hasMoreTokens())
+			{
+				currentNode = currentContainer.createContainer(currentToken);
+			}
+			else
+			{
+				currentNode = currentContainer.createPart(currentToken);
+			}
+		}
+		return (IPart) (currentNode);
+	}
+
+	private IPart lookupPart(String iLocator) throws Exception
+	{
+		INode node = lookupNode(iLocator);
+		assertTrue(node != null);
+		assertTrue(node instanceof IPart);
+		IPart part = (IPart) (node);
+		return part;
+	}
+
+	private Object getObjectForRead(String iLocator) throws Exception
+	{
+		IPart part = lookupPart(iLocator);
+		Object obj = part.getObjectForRead();
+		return obj;
+	}
+	
+	private Object getClonedObject (String iLocator ) throws Exception
+	{
+		IPart part = lookupPart(iLocator);
+		Object obj = part.getObjectClone();
+		return obj;
+	}
+
+	private Object getObjectForReadWrite(String iLocator) throws Exception
+	{
+		IPart part = lookupPart(iLocator);
+		Object obj = part.getObjectForReadWrite();
+		return obj;
+	}
+
+	private INode lookupNode(String iLocator) throws Exception
+	{
+		IContextService iService = getContextService();
+		StringTokenizer tokenizer = new StringTokenizer(iLocator, "/");
+		INode currentNode = iService.getRoot();
+		while (tokenizer.hasMoreTokens())
+		{
+			String currentToken = tokenizer.nextToken();
+			IContainer currentContainer = (IContainer) (currentNode);
+			currentNode = currentContainer.findChild(currentToken);
+			if (currentNode == null)
+			{
+				return null;
+			}
+		}
+		return currentNode;
+
+	}
+
+	private void copy(String iSource, String iTarget) throws Exception
+	{
+		IContextService iService = getContextService();
+		m_serializationContext.printComment(
+			"Copying " + iSource + " to " + iTarget + ".");
+
+		IContainer targetContainer = (IContainer) lookupNode(iTarget);
+		INode sourceNode = lookupNode(iSource);
+		targetContainer.copyNode(sourceNode, sourceNode.getName());
+
+		m_serializationContext.serialize(iService);
+
+	}
+
+	protected void verifyCopyOnWrite() throws Exception
+	{
+		String s1 = (String) getObjectForReadWrite(PART2_PATH);
+		assertTrue((s1 != STRING_DATA_2) && s1.equals(STRING_DATA_2));
+		String s2 = (String) getObjectForReadWrite(PART3_PATH);
+		assertTrue((s2 != STRING_DATA_3) && s2.equals(STRING_DATA_3));
+	}
+	
+	protected void verifyGetObjectForRead() throws Exception
+	{
+		String s2 = (String ) getObjectForRead( PART2_PATH );
+		assertTrue( (s2.equals(STRING_DATA_2) ));
+	}
+	
+		protected void verifyGetObjectForReadWrite() throws Exception
+	{
+		String s2 = (String ) getObjectForReadWrite( PART1_PATH );
+		assertTrue( (s2.equals(STRING_DATA_1) ));
+	}
+	
+	
+	protected void verifyCloneObject() throws Exception
+	{
+		String s2 = (String) getClonedObject( PART2_PATH);
+		assertTrue( (s2.equals(STRING_DATA_2)));
+	}
+
+	private void verifyDataObject(String iPartLocator, Object iObject)
+		throws Exception
+	{
+		verifyStringDataObject(iPartLocator, iObject);
+	}
+
+	private void verifyStringDataObject(String iPartLocator, Object iObject)
+		throws Exception
+	{
+		String obj1 = (String) (getObjectForRead(iPartLocator));
+		String obj2 = (String) (iObject);
+		assertTrue(obj1.equals(obj2));
+	}
+
+	private void internalVerifyBaseStructure() throws Exception
+	{
+		verifyDataObject(PART1_PATH, STRING_DATA_1);
+		verifyDataObject(PART2_PATH, STRING_DATA_2);
+		verifyDataObject(PART3_PATH, STRING_DATA_3);
+	}
+
+	protected void verifyBaseStructure() throws Exception
+	{
+		internalVerifyBaseStructure();
+	}
+
+	protected void verifyCopy() throws Exception
+	{
+		copy(COPY_SOURCE, COPY_TARGET);
+		internalVerifyBaseStructure();
+		verifyStringDataObject(COPIED_PART1_PATH, STRING_DATA_1);
+		verifyStringDataObject(COPIED_PART2_PATH, STRING_DATA_2);
+	}
+
+	protected void verifyModifyDataObject() throws Exception
+	{
+		//internalDumpContext( "Before verifyModifyDataObject.");
+		// Verify that an object can be modifed by reference.
+		setDataObject(MODIFIED_PART_PATH, new StringBuffer("1"));
+		StringBuffer buffer =
+			(StringBuffer) (getObjectForReadWrite(MODIFIED_PART_PATH));
+		buffer.append("2");
+		buffer = (StringBuffer) (getObjectForReadWrite(MODIFIED_PART_PATH));
+		String bufferString = buffer.toString();
+		assertTrue(bufferString.equals("12"));
+		
+	}
+
+	protected void verifyMove() throws Exception
+	{
+		INode node = lookupNode(MOVE_TARGET);
+		assertTrue(node != null);
+		assertTrue(node instanceof IContainer);
+		IContainer container = (IContainer) (node);
+
+		node = lookupNode(MOVE_SOURCE);
+		IContainer parent = container.getContainer();
+		assertTrue(node != null);
+		String nodeName = node.getName();
+		container.moveNode(node, nodeName);
+
+		// Make sure the moved node is no longer where it was.
+		node = lookupNode(MOVE_SOURCE);
+		assertTrue(node == null);
+
+		// Make sure the node moved.
+		node = lookupNode(MOVE_TARGET + "/" + nodeName);
+		assertTrue(node != null);
+
+		internalDumpContext("After move:");
+
+		// Move the node back where it came from
+		parent.moveNode(node, nodeName);
+		internalVerifyBaseStructure();
+
+	}
+
+	protected void verifyRemove() throws Exception
+	{
+		INode node = lookupNode(PART3_ROOT);
+		assertTrue(node != null);
+		assertTrue(node instanceof IContainer);
+		IContainer container = (IContainer) (node);
+
+		// Remove the node.
+		container.removeChild(MODIFIED_PART_NAME);
+
+		// Verify that the node is no longer there.
+		node = lookupNode(MODIFIED_PART_PATH);
+		assertTrue(node == null);
+	}
+
+	private void checkRefCount(String iLocator, long iExpectedValue)
+		throws Exception
+	{
+
+		INode node = lookupNode(iLocator);
+		long refCount = TestUtil.getRefCount(node);
+		assertTrue(refCount == iExpectedValue);
+
+	}
+
+	protected void verifyReferenceCounts() throws Exception
+	{
+		internalDumpContext("Before verifyRefCount:");
+		checkRefCount(COPIED_PART1_PATH, 2);
+		checkRefCount(COPIED_PART2_PATH, 1);
+		checkRefCount(PART3_PATH, 1);
+		checkRefCount(PART1_PATH, 2);
+		checkRefCount(PART2_PATH, 1);
+
+		// Remove a container and make sure that the part
+		// reference count is decremented.
+		
+		INode node = lookupNode(PART3_ROOT);
+		IContainer container = (IContainer) (node);
+		container.removeChild("C0");
+		
+		internalDumpContext("Just removed " + PART3_ROOT + "/C0:");
+		checkRefCount(PART1_PATH, 1);
+	
+
+	}
+
+
+
+	private IContextService getContextService() throws Exception
+	{
+		if (m_contextService == null)
+		{
+			m_contextService = createContextService();
+		}
+
+		return m_contextService;
+	}
+
+	protected void setContextService(IContextService iService)
+	{
+		m_contextService = iService;
+	}
+
+	protected void internalDumpContext(String iComment) throws Exception
+	{
+		lookupNode(PART3_ROOT);
+		lookupNode(PART2_ROOT);
+		lookupNode(PART1_ROOT);
+		m_serializationContext.printComment(iComment);
+		m_serializationContext.serialize(getContextService());
+	}
+	
+	protected void dumpContext( String iComment ) throws Exception
+	{
+		internalDumpContext(iComment);
+	}
+
+	public void go() throws Exception
+	{
+		scrub();
+		dumpContext("Initial Context Tree:");
+
+		buildBaseStructure();
+		dumpContext("Base Context Structure:");
+		verifyBaseStructure();
+		
+		verifyGetObjectForRead();
+		verifyCloneObject();
+		verifyGetObjectForReadWrite();
+
+		verifyModifyDataObject();
+		dumpContext("Modified Data Object:");
+
+		verifyCopy();
+		dumpContext("Copied Tree:");
+
+		verifyMove();
+		dumpContext("Moved and Moved Back:");
+
+		verifyRemove();
+		dumpContext("Removed Node:");
+
+		verifyCopyOnWrite();
+		dumpContext("Did Copy on Write.");
+
+		verifyReferenceCounts();
+		dumpContext("After verifyRefCount:");
+		
+		runPerformanceTest();
+
+	}
+	
+	protected void setProperty( String iName, String iValue )
+	{
+		m_properties.setProperty( iName, iValue );
+	}
+	
+	public String getProperty( String iName )
+	{
+		return m_properties.getProperty(iName);
+	}
+	
+	public IContextService createContextService()
+		throws ContextServiceException
+	{
+
+		IContextService tService=null;
+		try {
+			tService =
+				ContextServiceFactory.createContextService(
+					getProperties(),
+					UUIDServiceFactory.createUUIDService(getProperties()));
+		} catch (ContextServiceException e) {
+			e.printStackTrace();
+		} catch (UUIDServiceException e) {
+			e.printStackTrace();
+		}
+				
+		return tService;
+	}
+	
+	public IInteraction createInteractionObject() throws Exception
+	{
+		String fileName = getProperty( "XML_TEST_FILE" );
+		FileInputStream fis = new FileInputStream( fileName );
+		byte chunk[] = new byte[100];
+		ByteArrayOutputStream baos = new ByteArrayOutputStream();
+		while( true )
+		{
+			int bytesRead = fis.read(chunk);
+			if ( bytesRead <= 0 )
+			{
+				break;
+			}
+			else
+			{
+				baos.write(chunk, 0, bytesRead);
+			}
+		}
+		
+		InteractionFactory factory = InteractionFactory.newInstance();
+		IInteraction interaction = factory.createXMLInteraction( baos.toByteArray());
+		baos.close();
+		fis.close();
+	
+		return interaction;
+	}
+		
+	
+	//D:\eclipse\workspace\xalantests\foo.xml
+	//}
+	
+	private BPEProperties getProperties()
+	{
+		return m_properties;
+	}
+	
+	protected abstract void runPerformanceTest() throws Exception;
+
+
+
+	private SerializationContext m_serializationContext = null;
+	protected OutputStream m_outputStream = null;
+//	private byte[] m_serializedContainer = null;
+	private IContextService m_contextService = null;
+	private static final String PROCESS_ROOT = "BP1";
+	private static final String STRING_DATA_1 = "String1.";
+	private static final String STRING_DATA_2 = "String2.";
+	private static final String STRING_DATA_3 = "String3.";
+//	private static final String STRING_DATA_2_MODIFIED = "Modified String2";
+	private static final String PART1_ROOT = PROCESS_ROOT+"/Sub1";
+	private static final String PART2_ROOT = PROCESS_ROOT+"/Sub1";
+	private static final String PART3_ROOT = PROCESS_ROOT+"/Sub2";
+	private static final String PART1_RELATIVE_PATH = "/C0/C2/Part1";
+	private static final String PART2_RELATIVE_PATH = "/C0/C3/Part2";
+	private static final String PART3_RELATIVE_PATH = "/Part3";
+	private static final String PART1_PATH = PART1_ROOT + PART1_RELATIVE_PATH;
+	private static final String PART2_PATH = PART2_ROOT + PART2_RELATIVE_PATH;
+	private static final String PART3_PATH = PART3_ROOT + PART3_RELATIVE_PATH;
+	private static final String MODIFIED_PART_NAME = "ModifiedPart";
+	private static final String MODIFIED_PART_PATH =
+		PART3_ROOT + "/" + MODIFIED_PART_NAME;
+	private static final String COPY_SOURCE = PART1_ROOT + "/C0";
+	private static final String COPY_TARGET = PART3_ROOT;
+	private static final String COPIED_PART1_PATH =
+		COPY_TARGET + PART1_RELATIVE_PATH;
+	private static final String COPIED_PART2_PATH =
+		COPY_TARGET + PART2_RELATIVE_PATH;
+		
+	private static final String MOVE_SOURCE = PART1_ROOT + "/C0/C2";
+	private static final String MOVE_TARGET = PART1_ROOT + "/C0/C3";
+	private static final String INTERACTION_PATH = PART1_ROOT + "/C0/CX/InteractionPart";
+	
+	
+	
+	private BPEProperties m_properties = new BPEProperties();
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/ContextServiceTestSuite.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/ContextServiceTestSuite.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/ContextServiceTestSuite.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/ContextServiceTestSuite.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,164 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+
+import javax.transaction.UserTransaction;
+
+import com.sybase.bpe.util.BPEProperties;
+
+public class ContextServiceTestSuite
+{
+	public ContextServiceTestSuite( UserTransaction iTransaction )
+	{
+		m_userTransaction = iTransaction;
+	}
+	
+	public void testCMPMonolithic() throws Exception
+	{
+		CMPContextServiceTest tst = newCMP();
+		setMonolithic(tst);
+		setOutputStream(tst, "CMP_MONOLITHIC" );
+		run( tst );
+	}
+	
+	public void testCMPFine() throws Exception
+	{
+		CMPContextServiceTest tst = newCMP();
+		setFine(tst);
+		setOutputStream(tst, "CMP_FINE" );
+		run( tst );
+	}
+	
+	public void testCMPIntermediate() throws Exception
+	{
+		CMPContextServiceTest tst = newCMP();
+		setIntermediate(tst);
+		setOutputStream(tst, "CMP_INTERMEDIATE" );
+		run( tst );
+	}
+	
+	public void testBMPMonolithic() throws Exception
+	{
+		BMPContextServiceTest tst = newBMP();
+		setMonolithic(tst);
+		setOutputStream(tst, "BMP_MONOLITHIC" );
+		run( tst );
+		
+	}
+	
+	public void testBMPFine() throws Exception
+	{
+		BMPContextServiceTest tst = newBMP();
+		setFine(tst);
+		setOutputStream(tst, "BMP_FINE" );
+		run( tst );
+	}
+	
+	public void testBMPIntermediate() throws Exception
+	{
+			BMPContextServiceTest tst = newBMP();
+		setIntermediate(tst);
+		setOutputStream(tst, "BMP_INTERMEDIATE" );
+		run( tst );
+	}
+	
+	public void testTransient() throws Exception
+	{
+		TransientContextServiceTest tst = newTransient();
+		setOutputStream(tst, "TRANSIENT");
+		run( tst );
+	}
+	
+	private void setMonolithic( ContextServiceTest iTest )
+	{
+		iTest.setProperty( BPEProperties.CTX_PERSISTENCE_GRANULARITY_KEY,
+		 BPEProperties.CTX_MONOLITHIC );	
+	}
+	
+	private void setFine( ContextServiceTest iTest )
+	{
+		iTest.setProperty( BPEProperties.CTX_PERSISTENCE_GRANULARITY_KEY,
+		 BPEProperties.CTX_FINE);
+	}
+	
+	private void setIntermediate( ContextServiceTest iTest )
+	{		
+		iTest.setProperty( BPEProperties.CTX_PERSISTENCE_GRANULARITY_KEY,
+		 BPEProperties.CTX_INTERMEDIATE);
+	}
+	
+	private CMPContextServiceTest newCMP()
+	{
+		CMPContextServiceTest tst = new CMPContextServiceTest();
+		setTransaction( tst );
+		return tst;
+	}
+	
+	private BMPContextServiceTest newBMP()
+	{
+		BMPContextServiceTest tst = new BMPContextServiceTest();
+		setTransaction( tst );
+		return tst;
+	}
+	
+	private void setTransaction( J2EEContextServiceTest iTest )
+	{
+		iTest.init( m_userTransaction );
+	}
+	
+	private TransientContextServiceTest newTransient()
+	{
+		return new TransientContextServiceTest();
+	}
+	
+	private void setOutputStream( ContextServiceTest iTest, String iFileName ) throws FileNotFoundException
+	{
+		FileOutputStream fos = new FileOutputStream( OUTPUT_DIR + "/" + iFileName );
+		iTest.setOutputStream(fos);
+	}
+	
+	private void run( ContextServiceTest iTest ) throws Exception
+	{
+		iTest.setProperty( "XML_TEST_FILE", "/home/charper/xalan-j_2_4_1/samples/SimpleTransform/birds.xml");
+		iTest.go();
+		iTest.getOutputStream().close();
+	}
+	
+	
+	public void go() throws Exception
+	{
+		testCMPMonolithic();
+		testCMPFine();
+		testCMPIntermediate();
+		testBMPMonolithic();
+		testBMPFine();
+		testBMPIntermediate();
+		testTransient();
+	}
+	
+	public static final String OUTPUT_DIR = "/home/charper/tmp";
+	private UserTransaction m_userTransaction = null;
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/IInteractionObjectFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/IInteractionObjectFactory.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/IInteractionObjectFactory.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/IInteractionObjectFactory.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,29 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import com.sybase.bpe.interaction.IInteraction;
+
+public interface IInteractionObjectFactory
+{
+	public IInteraction createInteractionObject() throws Exception;
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/IServiceFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/IServiceFactory.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/IServiceFactory.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/IServiceFactory.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,30 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.context.base.ContextServiceException;
+
+public interface IServiceFactory
+{
+	IContextService createContextService() throws ContextServiceException;
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/J2EEContextServiceTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/J2EEContextServiceTest.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/J2EEContextServiceTest.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/J2EEContextServiceTest.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,60 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import java.io.PrintStream;
+
+import javax.transaction.UserTransaction;
+
+public abstract class J2EEContextServiceTest extends TransactionalContextServiceTest
+{
+	public void init( UserTransaction iUserTransaction )
+	{
+		m_userTransaction = iUserTransaction;
+	}
+	
+	protected void begin() throws Exception
+	{
+		m_userTransaction.begin();
+	}
+
+	protected void commit() throws Exception
+	{
+		m_userTransaction.commit();
+	}
+
+	protected void runPerformanceTest() throws Exception
+	{
+		AssortedContextOperationsUnitTest tst = new AssortedContextOperationsUnitTest();
+		tst.setServiceFactory(this);
+		tst.setInteractionFactory(this);
+		tst.setTransaction(m_userTransaction);
+		tst.setName("AssortedContextOperations");
+		tst.setIterations(200);	
+		tst.run();
+		tst.printResults(new PrintStream(m_outputStream));
+		
+	}
+	
+	private UserTransaction m_userTransaction = null;
+
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/SerializationContext.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/SerializationContext.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/SerializationContext.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/SerializationContext.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,190 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.logging.LogManager;
+//import java.util.logging.Logger;
+
+import com.sybase.bpe.context.IContainer;
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.context.INode;
+import com.sybase.bpe.context.IPart;
+import com.sybase.bpe.context.base.TestUtil;
+
+public class SerializationContext
+{
+	
+//	private static Logger logger = 
+//		Logger.getLogger(SerializationContext.class.getName());
+	
+	public SerializationContext(OutputStream oOutputStream)
+	{
+		m_printStream = new PrintStream(oOutputStream);
+	}
+	
+	public void printBytes( byte[] iBytes )
+	{
+		if ( !enabled )
+		{
+			return;
+		}
+		int position = 0;
+		char[] line = new char[80];
+		while( position < iBytes.length )
+		{
+			byte currentByte = iBytes[position];
+			char currentChar = (char)(currentByte);
+			
+			if ( !(Character.isLetterOrDigit( currentChar )) )
+			{
+				currentChar = '.';
+			}
+			line[position % 80] = currentChar;
+			position++;
+			if ( (position % 80 ) == 0 )
+			{
+				m_printStream.println(line);
+			}
+			
+		}
+		m_printStream.println(line);
+	}
+
+	public void serialize(IContextService iService) throws Exception
+	{
+		if ( !enabled )
+		{
+			return;
+		}
+		println( "Context Service hashcode: "+ iService.hashCode());
+		writeContainer(iService.getRoot());
+	}
+
+	private void writePart(IPart iPart) throws Exception
+	{
+		println("<" + iPart.getName() + ">");
+		incrementIndent();
+		Object obj = iPart.getObjectForRead();
+		
+		println("" + iPart.getObjectForRead());
+		if ( obj != null)
+		{
+		println( "RawObject hash code = " + obj.hashCode());
+		println("RawObject type = " + obj.getClass().getName());
+		}
+		println("RefCount = " + TestUtil.getRefCount(iPart));
+		
+		println("DataObjectImpl = " + TestUtil.getDataObjectImp( iPart ));
+		println("DataObjectID = " + TestUtil.getDataObjectID( iPart ));
+		decrementIndent();
+		println("</" + iPart.getName() + ">");
+	}
+
+	private void writeContainer(IContainer iContainer) throws Exception
+	{
+
+		println("<" + iContainer.getName() + ">");
+		incrementIndent();
+		println("Container hash code = " + iContainer.hashCode());
+
+		Collection children = iContainer.getChildren();
+		if (children != null)
+		{
+			Iterator iter = children.iterator();
+			while (iter.hasNext())
+			{
+				INode node = (INode) (iter.next());
+				if (node instanceof IContainer)
+				{
+					writeContainer((IContainer) (node));
+				}
+				else
+				{
+					writePart((IPart) (node));
+				}
+			}
+		}
+
+		decrementIndent();
+		println("</" + iContainer.getName() + ">");
+	}
+
+	public void printComment(String iValue)
+	{
+		if ( !enabled )
+		{
+			return;
+		}
+		doIndent();
+		m_printStream.println("\n" + iValue + "\n");
+	}
+
+	public void println(String iValue)
+	{
+		if ( !enabled )
+		{
+			return;
+		}
+		doIndent();
+		m_printStream.println(iValue);
+	}
+	public void print(String iValue)
+	{
+		if( !enabled )
+		{
+			return;
+		}
+		m_printStream.print(iValue);
+	}
+
+	private void incrementIndent()
+	{
+		m_indent++;
+	}
+
+	private void decrementIndent()
+	{
+		m_indent--;
+	}
+
+	private void doIndent()
+	{
+		for (int i = 0; i < (m_indent); i++)
+		{
+			m_printStream.print("     ");
+		}
+	}
+
+	private long m_indent = 0;
+	private PrintStream m_printStream = null;
+	//private boolean enabled = logger.isLoggable(Level.FINEST);
+	private static String BPE_SERIALIZATION_CONTEXT = "bpe.serialization.context";
+	private boolean enabled = 
+		Boolean.valueOf(
+				LogManager.getLogManager().getProperty(
+						BPE_SERIALIZATION_CONTEXT)).booleanValue();
+	
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/TransactionalContextServiceTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/TransactionalContextServiceTest.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/TransactionalContextServiceTest.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/TransactionalContextServiceTest.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,167 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.util.BPEProperties;
+
+public abstract class TransactionalContextServiceTest extends ContextServiceTest
+{
+	protected TransactionalContextServiceTest()
+	{
+		super();
+		setProperty( BPEProperties.CTX_PERSISTENCE_KEY, BPEProperties.CTX_PERSISTENT );
+	}
+	
+	protected abstract void begin() throws Exception;
+	protected abstract void commit() throws Exception;
+	private void setContextService() throws Exception
+	{
+		IContextService newService = this.createContextService();
+		this.setContextService( newService );
+	}
+	
+	public void buildBaseStructure() throws Exception
+	{
+		begin();
+		setContextService();
+		super.buildBaseStructure();
+		commit();
+
+	}
+	
+	
+	protected void verifyCopy() throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyCopy();
+		commit();
+
+	}
+	
+	protected void verifyCopyOnWrite() throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyCopyOnWrite();
+		commit();
+	}
+	
+
+
+	
+	protected void verifyBaseStructure() throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyBaseStructure();
+		commit();
+
+	}
+	
+	protected void verifyMove() throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyMove();
+		commit();
+
+	}
+	
+	protected void verifyReferenceCounts() throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyReferenceCounts();
+		commit();
+
+	}
+	
+	protected void verifyRemove() throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyRemove();
+		commit();
+
+	}
+	
+	protected void dumpContext( String iValue) throws Exception
+	{
+		begin();
+		setContextService();
+		super.dumpContext( iValue );
+		commit();
+	}
+	
+	protected void verifyModifyDataObject( ) throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyModifyDataObject();
+		commit();
+	}
+	
+	protected void scrub() throws Exception
+	{
+		begin();
+		setContextService();
+		super.scrub();
+		commit();
+	}
+	
+	// The following method may cause an update to the
+	// context tree depending on the configuration
+	// parameters.  If the context service is configured
+	// to use fused local nodes, then this operation
+	// will cause an update to the context tree.
+	// If the context service is configured to use 
+	// entity bean local nodes, this method will cause
+	// the entity bean to be updated, but not the
+	// context tree.
+	protected void verifyGetObjectForReadWrite() throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyGetObjectForReadWrite();
+		commit();
+	}
+	
+	// The following methods should not cause an update
+	// to the context tree.
+		protected void verifyGetObjectForRead() throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyGetObjectForRead();
+		commit();
+	}
+	
+	protected void verifyCloneObject() throws Exception
+	{
+		begin();
+		setContextService();
+		super.verifyCloneObject();
+		commit();
+	}
+}

Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/TransientContextServiceTest.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/TransientContextServiceTest.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/TransientContextServiceTest.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/test/TransientContextServiceTest.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,53 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.context.test;
+
+import com.sybase.bpe.util.BPEProperties;
+
+public class TransientContextServiceTest extends ContextServiceTest
+{
+	public TransientContextServiceTest()
+	{
+		super();
+		setProperty( BPEProperties.CTX_PERSISTENCE_KEY, BPEProperties.CTX_TRANSIENT );
+	}
+	
+	public static void main(String iArgs[]) throws Exception
+	{
+
+		TransientContextServiceTest csTest = new TransientContextServiceTest();
+		csTest.go();
+	}
+	
+	protected void runPerformanceTest() throws Exception
+	{
+		/*
+		TransientAssortedContextOperations tst = new TransientAssortedContextOperations();
+		tst.setIterations(200);
+		tst.setName("TransientAssortedContextOperations");
+		tst.run();
+		tst.printResults(new PrintStream( m_outputStream));
+		*/
+	}
+
+
+}