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 [17/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/client/spi/interaction/ISPIInteraction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIInteraction.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIInteraction.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIInteraction.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,216 @@
+/*
+* 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.client.spi.interaction;
+
+import java.io.Serializable;
+
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIInteractionFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIInteractionFactory.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIInteractionFactory.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIInteractionFactory.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,113 @@
+/*
+* 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.client.spi.interaction;
+
+import java.io.Serializable;
+
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIJaxenXPathQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIJaxenXPathQuery.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIJaxenXPathQuery.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIJaxenXPathQuery.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,33 @@
+/*
+* 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.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/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIQuery.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIQuery.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIQuery.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.client.spi.interaction;
+
+/**
+ * Queries against ISPIInteraction objects must implement this interface.
+ */
+public interface ISPIQuery
+{
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIXPathQuery.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIXPathQuery.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIXPathQuery.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/spi/interaction/ISPIXPathQuery.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,35 @@
+/*
+* 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.client.spi.interaction;
+
+import java.util.HashMap;
+
+
+
+
+public interface ISPIXPathQuery extends ISPIQuery
+{
+ public String getXPathExpressionAsString();
+
+ public HashMap getNamespaceMap();
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/BPEInvoker.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/BPEInvoker.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/BPEInvoker.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/BPEInvoker.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,155 @@
+/*
+* 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.client.util;
+
+import java.io.ByteArrayInputStream;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Properties;
+
+import org.xml.sax.InputSource;
+
+import com.sybase.bpe.client.BPEClient;
+import com.sybase.bpe.client.DescribedValue;
+import com.sybase.bpe.client.IBPEClient;
+import com.sybase.bpe.client.IBPEMessage;
+import com.sybase.bpe.client.IBPEMessagePart;
+import com.sybase.bpe.client.IFormat;
+import com.sybase.bpe.client.IOperation;
+import com.sybase.bpe.client.exceptions.BPEUserException;
+import com.sybase.bpe.client.formats.INativeFormat;
+import com.sybase.bpe.client.result.IResult;
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/client/util/EngineUtil.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/EngineUtil.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/EngineUtil.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/EngineUtil.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,171 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Aug 13, 2003
+ *
+ */
+package com.sybase.bpe.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 com.sybase.bpe.cc.client.BPELBundle;
+import com.sybase.bpe.cc.client.CCClient;
+import com.sybase.bpe.cc.client.CCException;
+import com.sybase.bpe.cc.client.IEngine;
+import com.sybase.bpe.client.exceptions.SystemException;
+import com.sybase.bpe.client.result.IResult;
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/client/util/IBPEInvoker.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/IBPEInvoker.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/IBPEInvoker.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/IBPEInvoker.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,45 @@
+/*
+* 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.client.util;
+
+import java.util.Properties;
+
+import com.sybase.bpe.client.exceptions.BPEUserException;
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/client/util/IInvokerBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/IInvokerBuilder.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/IInvokerBuilder.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/IInvokerBuilder.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.client.util;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/client/util/InvokerBuilder.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/InvokerBuilder.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/InvokerBuilder.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/client/util/InvokerBuilder.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,137 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on May 27, 2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package com.sybase.bpe.client.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+
+import com.sybase.bpe.client.IBPEClient;
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/condition/ConditionException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/ConditionException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/ConditionException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/ConditionException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,56 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+package com.sybase.bpe.condition;
+
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/condition/Conditional.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/Conditional.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/Conditional.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/Conditional.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
+*/
+/***********************************************************************
+ * Module: Conditional.java
+ * Author: waterman
+ * Purpose: Defines the Interface Conditional
+ ***********************************************************************/
+
+package com.sybase.bpe.condition;
+
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/condition/ConditionalFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/ConditionalFactory.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/ConditionalFactory.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/ConditionalFactory.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,75 @@
+/*
+* 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.condition;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.definition.IPMDChangeCondition;
+import com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/condition/DefaultConditional.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/DefaultConditional.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/DefaultConditional.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/DefaultConditional.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,75 @@
+/*
+* 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.condition;
+
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.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 com.sybase.bpe.condition.Conditional#init(Properties)
+ */
+ public void init(Properties properties) throws ConditionException {
+ attributes = properties;
+ }
+
+ /**
+ * @see com.sybase.bpe.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 com.sybase.bpe.condition.Conditional#release()
+ */
+ public void release() {
+ attributes = null;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/XPathJoinConditional.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/XPathJoinConditional.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/XPathJoinConditional.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/XPathJoinConditional.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,97 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jun 25, 2003
+ *
+ */
+package com.sybase.bpe.condition;
+
+import java.util.Properties;
+//import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.JaxenUtil;
+import com.sybase.bpe.action.bpel.UnInitVariableMetaData;
+import com.sybase.bpe.action.bpel.XPathJaxenExpression;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.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 com.sybase.bpe.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 com.sybase.bpe.condition.Conditional#evaluate(com.sybase.bpe.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 com.sybase.bpe.condition.Conditional#release()
+ */
+ public void release() {
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/XPathTransitionConditional.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/XPathTransitionConditional.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/XPathTransitionConditional.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/condition/XPathTransitionConditional.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,119 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Jun 25, 2003
+ *
+ */
+package com.sybase.bpe.condition;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.action.bpel.JaxenUtil;
+import com.sybase.bpe.action.bpel.XPathJaxenExpression;
+import com.sybase.bpe.context.resolver.ContextResolvedObject;
+import com.sybase.bpe.context.resolver.ContextResolver;
+import com.sybase.bpe.util.BPException;
+import com.sybase.bpe.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 com.sybase.bpe.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 com.sybase.bpe.condition.Conditional#evaluate(com.sybase.bpe.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/bpe/src/main/java/com/sybase/bpe/context/IAccessControl.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IAccessControl.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IAccessControl.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IAccessControl.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,28 @@
+/*
+* 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;
+
+public interface IAccessControl
+{
+ public void setReadOnly(boolean iReadOnly);
+ public boolean getReadOnly();
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/ICloneable.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/ICloneable.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/ICloneable.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/ICloneable.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;
+
+import com.sybase.bpe.context.base.ContextServiceException;
+
+public interface ICloneable
+{
+ public Object cloneObject() throws ContextServiceException;
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IContainer.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IContainer.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IContainer.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IContainer.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,98 @@
+/*
+* 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;
+
+import java.util.Collection;
+
+import com.sybase.bpe.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;
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IContextService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IContextService.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IContextService.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IContextService.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,85 @@
+/*
+* 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;
+
+import com.sybase.bpe.context.base.ContextServiceException;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.uuid.UUIDService;
+
+/**
+ *
+ * The context service is the entry point for interacting with a process context.
+ * An implementation is created through the ContextServiceFactory. There may be
+ * N number of implementations however all implementations fall into two categories.
+ * <BR>
+ * 1) Transient <BR>
+ * 2) Transactional <BR>
+ * <P>
+ * A transient context service implementation will create an in memory context tree and
+ * exists for the life of the reference.
+ * <P>
+ * A transactional context service will create a persistent context tree that is
+ * transactional.
+ * <P>
+ * The root container name is used as the primary key of the context
+ * tree and used to re-acquire a context tree. A transactional context service will join the current transaction of
+ * the current thread.
+ * <BR>
+ * @author lorenz/waterman
+ *
+ * @see com.sybase.bpe.context.base.ContextServiceFactory
+ * @see com.sybase.bpe.context.IContainer
+ */
+
+public interface IContextService
+{
+
+ /**
+ *
+ * @see IPart#setObject(IHandle)
+ *
+ * @param iObject an object that is independant of the context tree
+ * @return a handle to the iObject
+ * @throws ContextServiceException
+ * @throws UnsupportedOperationException
+ */
+ IHandle createObjectHandle( Object iObject ) throws ContextServiceException;
+
+ /**
+ * This is the entry point to a process context tree. Once the root container
+ * has been acquired, specific subtrees can be queried by name.
+ *
+ * @see IContainer#findChild(String)
+ *
+ * @return the root container
+ * @throws ContextServiceException
+ */
+ IContainer getRoot() throws ContextServiceException;
+ /**
+ * Allows an implementation to initialize/acquire any resources.
+ *
+ * @param props - holds initialization properties
+ * @throws ContextServiceException
+ */
+ void init(BPEProperties props, UUIDService us)throws ContextServiceException;
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IHandle.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IHandle.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IHandle.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IHandle.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;
+
+import java.io.Serializable;
+
+public interface IHandle extends Serializable
+{
+ static final long serialVersionUID = -8452451531253548434L;
+
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/INode.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/INode.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/INode.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/INode.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,50 @@
+/*
+* 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;
+
+import com.sybase.bpe.context.base.ContextServiceException;
+
+/**
+ *
+ * The base class for all nodes within the context tree.
+ *
+* @author lorenz/waterman
+ */
+public interface INode
+{
+ /**
+ * Acquire a reference to the node's parent container. A node may only
+ * belong to one parent.
+ *
+ * @return a parent container
+ */
+ public IContainer getContainer() throws ContextServiceException;
+
+ /**
+ * The node name must be unique within the scope of it's parent.
+ *
+ * @return the name of the node
+ */
+ public String getName() throws ContextServiceException;
+
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IPart.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IPart.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IPart.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/IPart.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,79 @@
+/*
+* 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;
+
+import com.sybase.bpe.context.base.ContextServiceException;
+
+/**
+ * IPart holds a data object that will be scoped within the process context
+ * tree. IPart can hold either the data object itself or a reference to a data
+ * object ( {@link IHandle IHandle} ).
+ * <P>
+ * IParts are created by {@link IContainer#createPart(String) IContainer.createPart}
+ *
+ * @author lorenz/waterman
+ */
+public interface IPart extends INode
+{
+ /**
+ * Sets the object into the process context tree. The object becomes part
+ * of the tree. When the context tree is serialized the data object is serialized
+ * as part of the tree.
+ *
+ * @param iObject a {@link Serializable Serializable} Java Object
+ * @param iTreatAsReadOnly is only relevent if iObject supports the {@link IAccessControl IAccessControl} interface
+ */
+ public void setObject( Object iObject) throws ContextServiceException;
+ /**
+ * Sets an object reference into the process context tree. A reference to
+ * a data object becomes part of the tree. When the context tree is
+ * serialized a data object reference is serialized as part of the tree.
+ * <P>
+ * This is not a supported method for transient implementations. IHandle only
+ * makes sense for transactional persistance mechanisms.
+ *
+ * @param iObjectHandle as acquired from {@link IContextService#createObjectHandle(Object) IContextService.createObjectHandle}
+ *
+ */
+ public void setObjectHandle( IHandle iObjectHandle ) throws ContextServiceException;
+ /**
+ * A read only copy of the data object. Because Java does not support a const
+ * attribute the client application is responsible for enforcing the readonly
+ * property. If the client application mutates the returned object and the
+ * object is shared by other IPart nodes, the user is aware the data will
+ * change for all referencing IPart nodes.
+ *
+ * @return the data object as inserted into the context via {@link #setObject(IHandle) setObject(IHandle)} or {@link #setObject(Object, boolean) setObject(Object)}
+ * @throws ContextServiceException
+ */
+ public Object getObjectForRead() throws ContextServiceException;
+ /**
+ * A writeable data object. A deep copy of the object is returned. To support this
+ * feature the data object must implement the {@link IAccessControl IAccessControl} and {@link ICloneable ICloneable}
+ * interfaces. If the data object does not support the above interfaces an
+ * exception is thrown.
+ *
+ * @return the data object as inserted into the context via {@link #setObject(IHandle) setObject(IHandle)} or {@link #setObject(Object, boolean) setObject(Object)}
+ */
+ public Object getObjectForReadWrite() throws ContextServiceException;
+ public Object getObjectClone() throws ContextServiceException;
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextService.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextService.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextService.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextService.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.base;
+
+import com.sybase.bpe.context.IContextService;
+
+public abstract class ContextService implements IContextService
+{
+
+
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextServiceException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextServiceException.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextServiceException.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextServiceException.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,66 @@
+/*
+* Confidential property of Sybase, Inc.
+*
+* Copyright 1987 - 2006.
+*
+* Sybase, Inc. All rights reserved.
+*
+* Unpublished rights reserved under U.S. copyright laws.
+*
+* This software contains confidential and trade secret information
+* of Sybase, Inc. Use, duplication or disclosure of the software and
+* documentation by the U.S. Government is subject to restrictions
+* set forth in a license agreement between the Government and Sybase,
+* Inc. or other written agreement specifying the Government's rights
+* to use the software and any applicable FAR provisions, for example,
+* FAR 52.227-19.
+*
+* Sybase, Inc. One Sybase Drive, Dublin, CA 94568, USA
+*
+* http://www.sybase.com
+*/
+/*
+ * Created on Apr 9, 2003
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package com.sybase.bpe.context.base;
+
+
+import com.sybase.bpe.util.BPException;
+
+/**
+ * The default context service exception.
+ * <P>
+ * When the exception is instantiated it will log the message into the
+ * log file as SEVERE.
+ *
+ * @author waterman
+ */
+public class ContextServiceException extends BPException
+{
+
+ static final long serialVersionUID = -6779320869553670322L;
+
+ /**
+ * @param message_id
+ * @param msgParams
+ */
+ public ContextServiceException(String message_id, Object[] msgParams) {
+ super(message_id, msgParams);
+ }
+
+ /**
+ * @param message_id
+ * @param msgParams
+ * @param cause
+ */
+ public ContextServiceException(
+ String message_id,
+ Object[] msgParams,
+ Throwable cause) {
+ super(message_id, msgParams, cause);
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextServiceFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextServiceFactory.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextServiceFactory.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextServiceFactory.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,103 @@
+/*
+* 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.base;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.sybase.bpe.context.IContextService;
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.uuid.UUIDService;
+
+public class ContextServiceFactory {
+ private static Logger logger =
+ Logger.getLogger(ContextServiceFactory.class.getName());
+
+ public static IContextService createContextService(
+ BPEProperties props,
+ UUIDService us)
+ throws ContextServiceException {
+ String persistence =
+ props.getProperty(BPEProperties.CTX_PERSISTENCE_KEY);
+ if (persistence.equals(BPEProperties.CTX_TRANSIENT)) {
+ return createContextService(props, us, ContextTypeEnum.TRANSIENT);
+ } else {
+ return createContextService(props, us, ContextTypeEnum.PERSISTENT);
+
+ }
+
+ }
+
+ public static IContextService createContextService(
+ BPEProperties props,
+ UUIDService us,
+ ContextTypeEnum type)
+ throws ContextServiceException {
+ IContextService cs = null;
+ String className = null;
+
+ try {
+
+ if (type == ContextTypeEnum.TRANSIENT) {
+ className = props.getTransientContextServiceClass();
+ } else {
+ if (type == ContextTypeEnum.PERSISTENT) {
+ className = props.getPersistentContextServiceClass();
+ }
+ }
+
+ // load the implementation
+ Class instClass = java.lang.Class.forName(className);
+ // try to instantiate the subclass
+ cs = (IContextService) instClass.newInstance();
+ // initialize
+ cs.init(props, us);
+
+ } catch (ClassNotFoundException e) {
+ ContextServiceException bpx =
+ new ContextServiceException(
+ "CLASS_NOT_FOUND",
+ new Object[] { className });
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ } catch (InstantiationException e) {
+ ContextServiceException bpx =
+ new ContextServiceException(
+ "NATIVE_EXCEPTION",
+ new Object[] { "InstantiationException" },
+ e);
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ } catch (IllegalAccessException e) {
+ ContextServiceException bpx =
+ new ContextServiceException(
+ "NATIVE_EXCEPTION",
+ new Object[] { "IllegalAccessException" },
+ e);
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ }
+
+ return cs;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextTypeEnum.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextTypeEnum.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextTypeEnum.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextTypeEnum.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,77 @@
+/*
+* 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.base;
+
+
+/** An enumeration of the possible process states:
+ * <P>
+ * UNSTARTED,STARTED,PAUSED,FINISHED,TERMINATED */
+public class ContextTypeEnum
+{
+ private String value;
+ private static final String TRANSIENT_VALUE = "TRANSIENT";
+ private static final String PERSISTENT_VALUE = "PERSISTENT";
+
+ private ContextTypeEnum()
+ {
+ // Prevent non-class create
+ }
+
+ /** @param */
+ private ContextTypeEnum(String value)
+ {
+ this.value = value;
+ }
+
+ public static final ContextTypeEnum TRANSIENT = new ContextTypeEnum(TRANSIENT_VALUE);
+ public static final ContextTypeEnum PERSISTENT = new ContextTypeEnum(PERSISTENT_VALUE);
+
+ public java.lang.String getValue()
+ {
+ return value;
+ }
+
+
+ /** Because this object will be used over a remote interface the default implementation based on object reference will be over written. */
+ public int hashCode()
+ {
+ return value.hashCode();
+ }
+
+ /** Because this object will be used over a remote interface the default implementation based on object reference will be over written.
+ *
+ * @param obj */
+ public boolean equals(Object obj)
+ {
+ if ( obj instanceof ContextTypeEnum ) {
+ return value.equals(((ContextTypeEnum)obj).value);
+ }
+ return false;
+ }
+
+ public static ContextTypeEnum getType(String value) {
+ if ( value.equals(TRANSIENT_VALUE) ) return TRANSIENT;
+ if ( value.equals(PERSISTENT_VALUE) ) return PERSISTENT;
+ return null;
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextUtil.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextUtil.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextUtil.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/ContextUtil.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,54 @@
+/*
+* 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.base;
+
+import com.sybase.bpe.context.IAccessControl;
+import com.sybase.bpe.context.ICloneable;
+
+public class ContextUtil
+{
+ public static void setReadOnly( Object iObject, boolean iTreatAsReadOnly )
+ {
+ if ( iObject instanceof IAccessControl )
+ {
+ IAccessControl ac = ( IAccessControl ) ( iObject );
+ ac.setReadOnly( true );
+ }
+ }
+
+ public static Object cloneObject( Object iObject ) throws ContextServiceException
+ {
+ if ( iObject == null )
+ {
+ return null;
+ }
+
+ if ( iObject instanceof String )
+ {
+ return new String( (String) ( iObject ) );
+ }
+
+ ICloneable cloneable = ( ICloneable ) ( iObject );
+ return cloneable.cloneObject();
+ }
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/DataObject.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/DataObject.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/DataObject.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/DataObject.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.base;
+
+import com.sybase.bpe.context.IHandle;
+
+public abstract class DataObject implements IHandle, IDataObject
+{
+
+ static final long serialVersionUID = 6837703006545093065L;
+
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/IDataObject.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/IDataObject.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/IDataObject.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/IDataObject.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,32 @@
+/*
+* 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.base;
+
+public interface IDataObject
+{
+ public void decrementRefCount() throws ContextServiceException;
+ public void incrementRefCount() throws ContextServiceException;
+ public long getRefCount() throws ContextServiceException;
+ public void setObject(Object obj) throws ContextServiceException;
+ public Object getObjectForRead() throws ContextServiceException;
+ public Object getObjectForReadWrite() throws ContextServiceException;
+}
Added: incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/IDataObjectFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/IDataObjectFactory.java?rev=381686&view=auto
==============================================================================
--- incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/IDataObjectFactory.java (added)
+++ incubator/ode/scratch/bpe/src/main/java/com/sybase/bpe/context/base/IDataObjectFactory.java Tue Feb 28 08:02:48 2006
@@ -0,0 +1,35 @@
+/*
+* 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.base;
+
+import com.sybase.bpe.util.BPEProperties;
+import com.sybase.bpe.uuid.UUIDService;
+
+public interface IDataObjectFactory
+{
+ public void init( BPEProperties iProperties, UUIDService us ) throws ContextServiceException;
+ public IDataObject find(String iLocator ) throws ContextServiceException;
+ public IDataObject create(String iLocator, Object iData) throws ContextServiceException;
+ public IDataObject create(Object iData) throws ContextServiceException;
+ public void remove( String iLocator ) throws ContextServiceException;
+
+}