You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by ad...@apache.org on 2006/02/28 17:35:26 UTC
svn commit: r381694 [11/38] - in /incubator/ode/scratch: bpe/ ode/
ode/bpelTests/ ode/bpelTests/probeService/ ode/bpelTests/test1/
ode/bpelTests/test10/ ode/bpelTests/test12/ ode/bpelTests/test13/
ode/bpelTests/test14/ ode/bpelTests/test15/ ode/bpelTes...
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/DeadlockInvokeTestAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/DeadlockInvokeTestAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/DeadlockInvokeTestAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/DeadlockInvokeTestAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.ode.client.BPEClient;
+import org.apache.ode.client.DescribedValue;
+import org.apache.ode.client.IBPEClient;
+import org.apache.ode.client.IBPEMessage;
+import org.apache.ode.client.IBPEMessagePart;
+import org.apache.ode.client.IOperation;
+import org.apache.ode.client.exceptions.BPEUserException;
+import org.apache.ode.client.formats.INativeFormat;
+import org.apache.ode.client.result.IResult;
+import org.apache.ode.client.result.ISuccessWithResponse;
+import org.apache.ode.info.PackageInfo;
+import org.apache.ode.info.PackageInfoHome;
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ *
+ */
+public class DeadlockInvokeTestAction implements IExternalAction {
+
+ static final long serialVersionUID = -5783396281362462855L;
+
+ private static Logger logger =
+ Logger.getLogger(DeadlockInvokeTestAction.class.getName());
+
+ public static final String OPERATION_NAME="operationName";
+ private String operationName;
+
+ /**
+ *
+ */
+ public DeadlockInvokeTestAction() {
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException {
+ operationName = props.getProperty(OPERATION_NAME);
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException {
+
+ Properties clientProps = new Properties();
+ String pkgname = "BPE";
+ try {
+ InitialContext ic = new InitialContext();
+ Object o = ic.lookup("java:comp/env/thePackageInfo");
+ PackageInfoHome piHome = (PackageInfoHome) PortableRemoteObject
+ .narrow(o, PackageInfoHome.class);
+ // get a bean
+ PackageInfo pi = piHome.create();
+ pkgname = pi.getProperties().getProperty("PACKAGE_NAME");
+ } catch (Exception e1 ) {
+ // ignore, must be inmemroy
+ }
+ clientProps.setProperty(IBPEClient.PACKAGE_NAME,pkgname);
+ clientProps.setProperty(IBPEClient.BPED_LOCAL,"true");
+ Properties opProps = new Properties();
+ try {
+ IBPEClient client = new BPEClient(clientProps);
+ IBPEMessage msg = client.createMessage();
+ DescribedValue dv = new DescribedValue( input.get("newParameter1"), INativeFormat.ATOMIC );
+ IBPEMessagePart part = client.createPart( "newParameter1", dv);
+ msg.addPart(part);
+ opProps.setProperty(IOperation.PORT_TYPE, "BPService1");
+ opProps.setProperty( IOperation.PORT_TYPE_NAMESPACE, "urn:mycompany:/deadlock/BPService1");
+ opProps.setProperty( IOperation.OPERATION, operationName);
+ IOperation op = client.createOperation(opProps);
+ IResult rslt = op.invoke(msg);
+ IBPEMessage msg2 = ((ISuccessWithResponse)rslt).getResponse();
+ output.put("newParameter2",msg2.getPart("newParameter2").getFormattableValue().toString());
+ } catch (BPEUserException e) {
+ logger.log(Level.SEVERE,"",e);
+ }
+
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/FaultAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/FaultAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/FaultAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/FaultAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on: Feb 12, 2004
+ * Project: BPEELocal
+ * Package: org.apache.ode.action.bpel.external
+ * Author: waterman
+ */
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ *
+ *
+ * @author waterman
+ */
+public class FaultAction implements IExternalAction {
+
+ static final long serialVersionUID = -6092256321706866825L;
+
+ /**
+ *
+ */
+ public FaultAction() {
+ super();
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException {
+
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException {
+
+ String faultName = null, faultData = null;
+
+ for ( Iterator itr = input.entrySet().iterator(); itr.hasNext(); ) {
+ Map.Entry me = (Map.Entry)itr.next();
+ if ( me.getKey().equals("faultName")) faultName = (String)(me.getValue()).toString();
+ if ( me.getKey().equals("faultData")) faultData = (String)(me.getValue()).toString();
+ }
+
+ BPRuntimeException rte = new BPRuntimeException(faultName,null,null);
+ rte.addPartMessage("errorID","FA-1");
+ rte.addPartMessage("errorText",faultData);
+
+ throw rte;
+
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/IExternalAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/IExternalAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/IExternalAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/IExternalAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on: Oct 31, 2003
+ * Project: BPEELocal
+ * Package: org.apache.ode.action.bpel.external
+ * Author: waterman
+ */
+package org.apache.ode.action.external;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ * The interface is the plugin point for extending a business process with
+ * process specfic funtionality. The BPE requires a WSDL definition for all
+ * extention points.
+ *
+ * @author waterman
+ */
+public interface IExternalAction extends Serializable {
+
+ static final long serialVersionUID = 6731969752846556616L;
+
+ /**
+ * Initializes the action instance with property values. Will be called
+ * only once by the BPE. The BPE will pass any properties defined within
+ * the process definition deployment that are relevant to invocation of the
+ * external service. Typically this will be WSDL binding attributes.
+ *
+ * @param props - invocation properties
+ * @throws BPRuntimeException which can be caught by the execution language
+ * (i.e. BPEL <catch> )
+ * @throws ActionSystemException which is a system exception that can not
+ * be caught by a BPEL catch.
+ */
+ public void init(Properties props) throws BPRuntimeException, ActionSystemException;
+
+ /**
+ * Extention logic. The data types of the input/output params is driven by
+ * BPE extensibility elements found in the WSDL binding. The type attribute
+ * of the <bpe:input> and <bpe:output> will identify the data type.<br>
+ * Two types are currently supported:<br>
+ * 1) "obj" - the parsed object model of a WSDL message part. (i.e. a DOM Document)<br>
+ * 2) "buf" - a byte[] of a WSDL message part.<br>
+ * <br>
+ *
+ * @param input - the HashMap will hold the name of the data and the data object
+ * @param output - the return data to be pushed back into the BPE data context
+ * @param resolver - if required artifacts ( wsdl, xslt, ruleml, ... )
+ * have been deployed into the BPE metadata repository, the interface
+ * allows for access to the artifacts.
+ *
+ * @throws BPRuntimeException which can be caught by the execution language
+ * (i.e. BPEL <catch> )
+ *
+ * @throws ActionSystemException which is a system exception that can not
+ * be caught by a BPEL catch.
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException, ActionSystemException;
+
+
+ /**
+ * Resource clean up opportunity.
+ */
+ public void release();
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/IURIResolver.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/IURIResolver.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/IURIResolver.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/IURIResolver.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on: Oct 31, 2003
+ * Project: BPEELocal
+ * Package: org.apache.ode.action.bpel.external
+ * Author: waterman
+ */
+package org.apache.ode.action.external;
+
+/**
+ * Provides access to the BPE runtime repository through a URI naming
+ * interface.
+ *
+ * @author waterman
+ */
+public interface IURIResolver {
+
+ /**
+ * Return a deployment artifact from the BPE runtime repository.
+ * @param uri - the uri of the required artifact. The uri is the fully
+ * qualified name of the artifact as found within the BPE deployment JAR.
+ * @return - the deployment artifact ( will be null if URI could not be resolved )
+ */
+ public Object getArtifact(String uri);
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/JMSPutAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/JMSPutAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/JMSPutAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/JMSPutAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.action.external;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.jms.BytesMessage;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+public class JMSPutAction implements IExternalAction
+{
+
+ static final long serialVersionUID = 856846540609589525L;
+
+ private static Logger logger =
+ Logger.getLogger(JMSPutAction.class.getName());
+
+ private String m_initialContextFactoryName;
+ private String m_queueConnectionFactoryName;
+ private String m_queueName;
+ private String m_providerURL;
+ private String m_payload;
+
+ // Note: these keys match attributes found in the WSDL
+ // within the binding for bpe:action extensibility element
+ public static final String INITIAL_CONTEXT_FACTORY_KEY =
+ "initialContextFactory";
+ public static final String JMS_QUEUE_CONNECTION_FACTORY_KEY =
+ "jmsQueueConnectionFactory";
+ public static final String JMS_QUEUE_NAME_KEY = "jmsQueueName";
+ public static final String PROVIDER_URL_KEY = "providerURL";
+ public static final String PAYLOAD_KEY = "payload";
+
+ private QueueSender m_queueSender;
+ private QueueSession m_queueSession;
+ private QueueConnection m_queueConnection;
+
+ public void init(Properties props) throws BPRuntimeException
+ {
+ m_initialContextFactoryName =
+ props.getProperty(INITIAL_CONTEXT_FACTORY_KEY);
+ m_queueConnectionFactoryName =
+ props.getProperty(JMS_QUEUE_CONNECTION_FACTORY_KEY);
+ m_queueName = props.getProperty(JMS_QUEUE_NAME_KEY);
+ m_providerURL = props.getProperty(PROVIDER_URL_KEY);
+ m_payload = props.getProperty(PAYLOAD_KEY);
+
+ try
+ {
+
+ // get inital context
+ InitialContext context;
+ if (m_initialContextFactoryName == null)
+ {
+ context = new InitialContext();
+ }
+ else
+ {
+// Properties properties = new Properties();
+ props.put(
+ Context.INITIAL_CONTEXT_FACTORY,
+ m_initialContextFactoryName);
+ props.put(Context.PROVIDER_URL, m_providerURL);
+ context = new InitialContext(props);
+ }
+
+ // get queue artifacts
+ QueueConnectionFactory qcf =
+ (QueueConnectionFactory) context.lookup(
+ m_queueConnectionFactoryName);
+
+ m_queueConnection = qcf.createQueueConnection();
+ m_queueSession =
+ m_queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ Queue queue =
+ (Queue) context.lookup(
+ m_queueName);
+ m_queueSender = m_queueSession.createSender(queue);
+ }
+ catch (NamingException e)
+ {
+ BPRuntimeException bp = new BPRuntimeException(null,"NATIVE_EXCEPTION",new Object[] {"NamingException"},e);
+ bp.log(logger,Level.SEVERE);
+ throw bp;
+ }
+ catch (JMSException e)
+ {
+ BPRuntimeException bp = new BPRuntimeException(null,"NATIVE_EXCEPTION",new Object[] {"JMSException"},e);
+ bp.log(logger,Level.SEVERE);
+ throw bp;
+ }
+ }
+
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException
+ {
+ Object payload = input.get( m_payload );
+ try
+ {
+ Message message = null;
+ if ( payload instanceof byte[] )
+ {
+ BytesMessage bytesMessage = m_queueSession.createBytesMessage();
+ bytesMessage.writeBytes((byte[])payload);
+ message = bytesMessage;
+ }
+ else if ( payload instanceof String)
+ {
+ TextMessage textMessage = m_queueSession.createTextMessage();
+ textMessage.setText((String)payload);
+ message = textMessage;
+ }
+ else
+ {
+ ObjectMessage objectMessage = m_queueSession.createObjectMessage();
+ objectMessage.setObject((Serializable)(payload));
+ message = objectMessage;
+ }
+ m_queueSender.send(message);
+ }
+ catch (Exception e)
+ {
+ BPRuntimeException bp = new BPRuntimeException(null,"NATIVE_EXCEPTION",new Object[] {"Exception"},e);
+ bp.log(logger,Level.SEVERE);
+ throw bp;
+ }
+ }
+
+ public void release()
+ {
+ //TODO: close the queue resources
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/LocalInvokeTestAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/LocalInvokeTestAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/LocalInvokeTestAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/LocalInvokeTestAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.ode.client.BPEClient;
+import org.apache.ode.client.DescribedValue;
+import org.apache.ode.client.IBPEClient;
+import org.apache.ode.client.IBPEMessage;
+//import org.apache.ode.client.IBPEMessagePart;
+import org.apache.ode.client.IOperation;
+import org.apache.ode.client.exceptions.BPEUserException;
+import org.apache.ode.client.formats.INativeFormat;
+import org.apache.ode.client.result.IResult;
+import org.apache.ode.client.result.ISuccessWithResponse;
+import org.apache.ode.info.PackageInfo;
+import org.apache.ode.info.PackageInfoHome;
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ *
+ */
+public class LocalInvokeTestAction implements IExternalAction {
+
+ static final long serialVersionUID = -5783396281362462855L;
+
+ private static Logger logger =
+ Logger.getLogger(LocalInvokeTestAction.class.getName());
+
+ public static final String TARGET_PART_KEY="targetPart";
+ private String m_targetPart;
+
+ /**
+ *
+ */
+ public LocalInvokeTestAction() {
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException {
+ m_targetPart = props.getProperty(TARGET_PART_KEY);
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException {
+
+ Properties clientProps = new Properties();
+ String pkgname = "BPE";
+ try {
+ InitialContext ic = new InitialContext();
+ Object o = ic.lookup("java:comp/env/thePackageInfo");
+ PackageInfoHome piHome = (PackageInfoHome) PortableRemoteObject
+ .narrow(o, PackageInfoHome.class);
+ // get a bean
+ PackageInfo pi = piHome.create();
+ pkgname = pi.getProperties().getProperty("PACKAGE_NAME");
+ } catch (Exception e1 ) {
+ // ignore, must be inmemroy
+ }
+ clientProps.setProperty(IBPEClient.PACKAGE_NAME,pkgname);
+ clientProps.setProperty(IBPEClient.BPED_LOCAL,"true");
+ Properties opProps = new Properties();
+ try {
+ IBPEClient client = new BPEClient(clientProps);
+ IBPEMessage msg = client.createMessage();
+ DescribedValue dv = new DescribedValue( "test", INativeFormat.ATOMIC );
+ client.createPart( "test", dv);
+ opProps.setProperty(IOperation.PORT_TYPE, "simplePT");
+ opProps.setProperty( IOperation.PORT_TYPE_NAMESPACE, "urn:sybase:bpel:simpleProcessing");
+ opProps.setProperty( IOperation.OPERATION, "request");
+ IOperation op = client.createOperation(opProps);
+ IResult rslt = op.invoke(msg);
+ IBPEMessage msg2 = ((ISuccessWithResponse)rslt).getResponse();
+ output.put(m_targetPart,msg2.getPart("test").getFormattableValue().toString());
+ } catch (BPEUserException e) {
+ logger.log(Level.SEVERE,"",e);
+ }
+
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/NoOpAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/NoOpAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/NoOpAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/NoOpAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Oct 15, 2004
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class NoOpAction implements IExternalAction {
+
+ static final long serialVersionUID = 2399765581384302793L;
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException,
+ ActionSystemException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException, ActionSystemException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/OOBTestAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/OOBTestAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/OOBTestAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/OOBTestAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.ReceiveAction;
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ *
+ */
+public class OOBTestAction implements IExternalAction {
+
+
+ static final long serialVersionUID = 6347718017168580557L;
+
+ public static final String SOURCE_PART_KEY="rootSourcePart";
+ public static final String TARGET_PART_KEY="targetPart";
+// private String m_sourcePart;
+ private String m_targetPart;
+
+ private static Logger logger =
+ Logger.getLogger(OOBTestAction.class.getName());
+
+ /**
+ *
+ */
+ public OOBTestAction() {
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException {
+// m_sourcePart = props.getProperty(SOURCE_PART_KEY);
+ m_targetPart = props.getProperty(TARGET_PART_KEY);
+ logger.log(Level.FINE,"Invoke - ** INIT ** ");
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException {
+
+ // operation is coded here to facilitate testing
+ Object obj = input.get(ReceiveAction.OOB_DATA);
+
+ output.put(m_targetPart,obj.toString());
+
+
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ logger.log(Level.FINE,"Invoke - ** RELEASE ** ");
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/ProbeAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/ProbeAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/ProbeAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/ProbeAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on: Nov 3, 2003
+ * Project: BPEELocal
+ * Package: org.apache.ode.action.bpel.external
+ * Author: waterman
+ */
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ *
+ *
+ * @author waterman
+ */
+public class ProbeAction implements IExternalAction {
+
+ static final long serialVersionUID = 746014774602572069L;
+
+ public static final String SOURCE_PART_KEY="rootSourcePart";
+ public static final String TARGET_PART_KEY="targetPart";
+ private String m_sourcePart;
+ private String m_targetPart;
+
+ private static Logger logger =
+ Logger.getLogger(ProbeAction.class.getName());
+
+ /**
+ *
+ */
+ public ProbeAction() {
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException {
+ m_sourcePart = props.getProperty(SOURCE_PART_KEY);
+ m_targetPart = props.getProperty(TARGET_PART_KEY);
+ logger.log(Level.FINE,"Invoke - ** INIT ** ");
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException {
+
+ // operation is coded here to facilitate testing
+ Object name = input.get(m_sourcePart);
+ Object data = input.get(m_targetPart);
+
+ if ( name != null && data != null ) {
+ output.put("probeData",data+" -> "+name);
+ }
+
+ logger.log(Level.FINER,"Invoke - "+data+" -> "+name);
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ logger.log(Level.FINE,"Invoke - ** RELEASE ** ");
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/TestInvokeAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/TestInvokeAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/TestInvokeAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/TestInvokeAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jul 18, 2005
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class TestInvokeAction implements IExternalAction {
+
+ static final long serialVersionUID = 5213919696052037239L;
+
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException, ActionSystemException {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver) throws BPRuntimeException, ActionSystemException {
+ output.put("newParameter2","testinvoke");
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/ThrowStuffAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/ThrowStuffAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/ThrowStuffAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/ThrowStuffAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Sep 8, 2005
+ *
+ * To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.apache.ode.client.IFormattableValue;
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ * @author charper
+ *
+ * To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class ThrowStuffAction implements IExternalAction {
+
+ static final long serialVersionUID = 746014774602572069L;
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException, ActionSystemException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver) throws BPRuntimeException, ActionSystemException {
+ // TODO Auto-generated method stub
+ IFormattableValue val = (IFormattableValue)input.get("type");
+ String type = (String)val.getDescribedValue().getData();
+ if ( type.equals("err")) {
+ throw new Error();
+ } else if ( type.equals("rt")) {
+ throw new RuntimeException();
+ } else if ( type.equals("actex")) {
+ throw new ActionSystemException("test");
+ }
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/TransformerURIResolver.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/TransformerURIResolver.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/TransformerURIResolver.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/TransformerURIResolver.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on: Oct 31, 2003
+ * Project: BPEELocal
+ * Package: org.apache.ode.action.bpel.external
+ * Author: waterman
+ */
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.dom.DOMSource;
+
+import org.w3c.dom.Document;
+
+import org.apache.ode.action.internal.ActionException;
+
+
+/**
+ *
+ *
+ * @author waterman
+ */
+public class TransformerURIResolver implements URIResolver {
+
+ private HashMap dataDocs;
+// private IURIResolver bpeResolver;
+
+ /**
+ *
+ */
+ public TransformerURIResolver(IURIResolver bpeResolver) {
+ //this.bpeResolver = bpeResolver;
+ }
+
+ /**
+ * @see javax.xml.transform.URIResolver#resolve(java.lang.String, java.lang.String)
+ */
+ public Source resolve(String href, String base)
+ throws TransformerException {
+
+ // hmmm ... need to figure out how to map a WSDL part as found
+ // in the BPEL invoke and passed into dataRepos to an href.
+ // May need a part to href map in the WSDL binding.
+
+ return null;
+ }
+
+ public void setDataMap(HashMap data) {
+ dataDocs = data;
+ }
+
+ public DOMSource getData(String part) throws ActionException {
+ DOMSource ret = null;
+
+ // Since this is an XML operation we verify the data object is indeed
+ // an XML object.
+
+ Object data = dataDocs.get(part);
+ if ( data == null || !(data instanceof Document) ) {
+ throw new ActionException("INVALID_DATAOBJECT",new Object[] {part});
+ }
+
+ try {
+ ret = new DOMSource((Document)data);
+ } catch (Exception e) {
+ throw new ActionException("NATIVE_EXCEPTION",new Object[] {"Exception"},e);
+ }
+
+ return ret;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/WSHFStartAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/WSHFStartAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/WSHFStartAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/WSHFStartAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Jun 22, 2004
+ * Author waterman
+ *
+ */
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ * @author waterman
+ *
+ */
+public class WSHFStartAction implements IExternalAction {
+
+ static final long serialVersionUID = 4269994163030310022L;
+
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException {
+ }
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException {
+ }
+ /* (non-Javadoc)
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/WSIFAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/WSIFAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/WSIFAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/WSIFAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on: Feb 12, 2004
+ * Project: BPEELocal
+ * Package: org.apache.ode.action.bpel.external
+ * Author: waterman
+ */
+package org.apache.ode.action.external;
+
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+/**
+ *
+ *
+ * @author waterman
+ */
+public class WSIFAction implements IExternalAction {
+
+ static final long serialVersionUID = -4927712523473967625L;
+
+
+ /**
+ *
+ */
+ public WSIFAction() {
+ super();
+ // TODO: Auto-generated constructor stub
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties)
+ */
+ public void init(Properties props) throws BPRuntimeException {
+ // TODO: Auto-generated method stub
+
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap, java.util.HashMap, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver)
+ throws BPRuntimeException {
+ // TODO: Auto-generated method stub
+
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ // TODO: Auto-generated method stub
+
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/XSLTranslatorAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/XSLTranslatorAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/XSLTranslatorAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/external/XSLTranslatorAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on: Oct 31, 2003
+ * Project: BPEELocal
+ * Package: org.apache.ode.action.bpel.external
+ * Author: waterman
+ */
+package org.apache.ode.action.external;
+
+import java.io.ByteArrayOutputStream;
+import java.io.StringReader;
+import java.util.HashMap;
+import java.util.Properties;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.ode.scope.service.BPRuntimeException;
+
+
+/**
+ *
+ *
+ * @author waterman
+ */
+public class XSLTranslatorAction implements IExternalAction {
+
+ static final long serialVersionUID = -989300275891390371L;
+
+ // Note: these keys match attributes found in the WSDL
+ // within the binding for bpe:action extensibility element
+ public static final String FORMAT_KEY="instructions";
+ public static final String SOURCE_PART_KEY="rootSourcePart";
+ public static final String TARGET_PART_KEY="targetPart";
+ public static final String FAULT_NAME="xsltFault";
+
+ private Transformer m_transformer;
+ private String m_sourcePart;
+ private String m_targetPart;
+ private String m_xsltDoc;
+ private TransformerURIResolver m_transResolver;
+
+
+ /**
+ *
+ */
+ public XSLTranslatorAction() {
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#init(java.util.Properties, org.apache.ode.action.bpel.external.IURIResolver)
+ */
+ public void init(Properties props)
+ throws BPRuntimeException {
+
+ m_sourcePart = props.getProperty(SOURCE_PART_KEY);
+ m_targetPart = props.getProperty(TARGET_PART_KEY);
+ m_xsltDoc = props.getProperty(FORMAT_KEY);
+
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#execute(java.util.HashMap)
+ */
+ public void execute(HashMap input, HashMap output, IURIResolver resolver) throws BPRuntimeException {
+
+
+ try {
+
+ if ( m_transformer == null ) {
+ initTransformer(resolver);
+ }
+
+ // Create the XSLT result object
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ StreamResult result = new StreamResult(baos);
+
+ m_transResolver.setDataMap(input);
+
+ // transform
+ m_transformer.transform(m_transResolver.getData(m_sourcePart), result);
+
+ // push the appropriate object back into the BPE context
+ output.put(m_targetPart,baos.toByteArray());
+
+ } catch (TransformerException e) {
+ throw new BPRuntimeException(FAULT_NAME,"NATIVE_EXCEPTION",null,e);
+ } catch (Exception e) {
+ throw new BPRuntimeException(FAULT_NAME,"NATIVE_EXCEPTION",null,e);
+ }
+
+ }
+
+ public void initTransformer(IURIResolver resolver ) throws BPRuntimeException {
+ m_transResolver = new TransformerURIResolver(resolver);
+
+ try {
+ TransformerFactory tFactory = TransformerFactory.newInstance();
+ String instSet = (String)resolver.getArtifact(m_xsltDoc);
+ StreamSource stylesource = new StreamSource(new StringReader(instSet));
+ m_transformer = tFactory.newTransformer(stylesource);
+ m_transformer.setURIResolver(m_transResolver);
+ } catch (TransformerConfigurationException e) {
+ throw new BPRuntimeException(FAULT_NAME,"NATIVE_EXCEPTION",null,e);
+ } catch (TransformerFactoryConfigurationError e) {
+ throw new BPRuntimeException(FAULT_NAME,"NATIVE_EXCEPTION",null,e);
+ }
+
+ }
+
+ /**
+ * @see org.apache.ode.action.bpel.external.IExternalAction#release()
+ */
+ public void release() {
+ m_transformer = null;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/ActionException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/ActionException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/ActionException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/ActionException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.action.internal;
+
+import org.apache.ode.util.BPException;
+
+/**
+ * @author waterman
+ *
+ *
+ *
+ */
+public class ActionException extends BPException {
+
+ static final long serialVersionUID = -74513521794848483L;
+
+ /**
+ * @param message_id
+ * @param msgParams
+ */
+ public ActionException(String message_id, Object[] msgParams) {
+ super(message_id, msgParams);
+ }
+
+ /**
+ * @param message_id
+ * @param msgParams
+ * @param cause
+ */
+ public ActionException(
+ String message_id,
+ Object[] msgParams,
+ Throwable cause) {
+ super(message_id, msgParams, cause);
+ }
+
+ /**
+ * @param detailMessage
+ */
+ public ActionException(String detailMessage)
+ {
+ super( detailMessage );
+ }
+
+ /**
+ * @param cause
+ */
+ public ActionException(Throwable cause)
+ {
+ super( cause );
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/ActionFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/ActionFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/ActionFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/ActionFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/***********************************************************************
+ * Module: ActionFactory.java
+ * Author: waterman
+ * Purpose: Defines the Class ActionFactory
+ ***********************************************************************/
+
+package org.apache.ode.action.internal;
+
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ode.action.bpel.ExternalServiceAction;
+import org.apache.ode.definition.IPMDAction;
+import org.apache.ode.util.BPException;
+
+
+/** The factory will instantiate Action implementations.
+ * <P>
+ * The data used to create an Action instance is obtained from the process definition classes.
+ *
+ * @see IPMDAction */
+public class ActionFactory
+{
+ private static Logger logger =
+ Logger.getLogger(ActionFactory.class.getName());
+ /** instantiate an Action implemenation
+ *
+ * @param className The fully qualified name of a Java class that implements the Action interface.
+ * @param properties Properties needed by the Action implementation so that it will properly initialize. */
+ public static IInternalAction createAction(java.lang.String className, java.util.Properties props, IPMDAction defAction) throws BPException
+ {
+ IInternalAction ret = null;
+
+ try {
+ // load the Action implementation
+ Class instClass = java.lang.Class.forName(className);
+ // try to instantiate the subclass
+ ret = (IInternalAction) instClass.newInstance();
+
+ Properties actionProps = props;
+
+ if ( ret instanceof ExternalServiceAction ) {
+ actionProps = new Properties();
+ actionProps.putAll(props);
+ actionProps.put(IInternalAction.ACTION_DEF_KEY,defAction);
+ }
+
+ ret.init(actionProps);
+
+ } catch (ClassNotFoundException e) {
+ ActionException bpx = new ActionException("CLASS_NOT_FOUND",new Object[] {className});
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ } catch (InstantiationException e) {
+ ActionException bpx = new ActionException("NATIVE_EXCEPTION",new Object[] {"InstantiationException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ } catch (IllegalAccessException e) {
+ ActionException bpx = new ActionException("NATIVE_EXCEPTION",new Object[] {"IllegalAccessException"},e);
+ bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+
+ return ret;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/IInternalAction.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/IInternalAction.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/IInternalAction.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/internal/IInternalAction.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/***********************************************************************
+ * Module: Action.java
+ * Author: waterman
+ * Purpose: Defines the Interface Action
+ ***********************************************************************/
+
+package org.apache.ode.action.internal;
+
+import org.apache.ode.context.resolver.ContextResolver;
+import org.apache.ode.definition.IPMDProcess;
+import org.apache.ode.engine.IEvaluationContext;
+import org.apache.ode.engine.IProcessCallBack;
+import org.apache.ode.instance.IPMIProcess;
+import org.apache.ode.util.BPException;
+
+/** The action interface defines a method invocation interface. The business process algorithm will invoke executable code through this interface.
+ * <P>
+ * Action implemenations will be used to implement external actions as well as
+ * internal action.
+ * <P>
+ * External actions invoke services that are external to the core engine. They
+ * will typically include ( WSIF, Data Transformation, etc ... ). While they may
+ * supply data to a business process instance they do not direct the flow of a
+ * business process.
+ * <P>
+ * Internal actions provide implementations that control process execution flow. They are
+ * typically used to implement a specific business process pattern ( SPLIT,MERGE,LOOP, etc ...).
+ * Since they do affect process flow they will need access to engine components ( instance, definition ).
+ *
+ * @see ActionFactory */
+public interface IInternalAction {
+
+ public static final String INPUT_LOCATOR = "input_locator";
+ public static final String OUTPUT_LOCATOR = "output_locator";
+ public static final String ACTION_DEF_KEY = "action_def_key";
+
+
+ /** 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 Action implementation. */
+ void init(java.util.Properties properties) throws BPException;
+ /** Invokes a piece of executable code.
+ * <P>
+ * If the object has not been initialized an execute call should throw an un-initialized exception.
+ * <P>
+ * Note: action writers control the execution flow by the return value. Returning
+ * false halts the execution of a business process. Currently the only time an
+ * action should halt business process execution is when a piece of data is needed. In
+ * this case the action should always notify the event director that it is waiting for data
+ * by registering a container.
+ *
+ *
+ * @param inputContainers a collection of immutable aata containers
+ * @param outputContainers a collection of mutable data containers
+ * @param eventDirect a callback interface to the BPED. Allows a action implementation to leverage the BPED services.
+ * @param processInstance a process instance is used by internal actions to implement BP patterns.
+ * @param processDefinition a process definition is used by internal actions to implement BP patterns.
+ * @return false notifies the process engine to discontinue processing */
+ boolean execute(ContextResolver resolver, IEvaluationContext ec, IProcessCallBack pcb, IPMIProcess processInstance, IPMDProcess processDefinition) throws BPException;
+
+
+ /** Releases any resources the Action implemenation may have acquired at initialization. After release the object must be initialized before execute can be called. */
+ void release();
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/ActionParamFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/ActionParamFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/ActionParamFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/ActionParamFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on: Nov 5, 2003
+ * Project: BPEELocal
+ * Package: com.sybase.action.param
+ * Author: waterman
+ */
+package org.apache.ode.action.param;
+
+import org.apache.ode.context.resolver.ContextResolvedObject;
+
+/**
+ *
+ *
+ * @author waterman
+ */
+public class ActionParamFactory {
+
+ /**
+ *
+ */
+ private ActionParamFactory() {
+ }
+
+ public static IActionParam createActionParam(ContextResolvedObject object, String type) {
+
+ return new GenericActionParam(object, type);
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/GenericActionParam.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/GenericActionParam.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/GenericActionParam.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/GenericActionParam.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.action.param;
+
+import org.apache.ode.action.internal.ActionException;
+import org.apache.ode.context.resolver.ContextResolvedObject;
+import org.apache.ode.interaction.IInteraction;
+import org.apache.ode.interaction.IObjectAccessible;
+import org.apache.ode.interaction.IObjectMutable;
+
+public class GenericActionParam implements IActionParam
+{
+ ContextResolvedObject data;
+ String preferredType;
+
+ /**
+ *
+ */
+ public GenericActionParam(
+ ContextResolvedObject resolvedObject,
+ String iPreferredType)
+ {
+ data = resolvedObject;
+ preferredType = iPreferredType;
+ }
+
+ /**
+ * @see com.sybase.action.param.IActionParam#getParam()
+ */
+ public Object getParam() throws ActionException
+ {
+ Object ret = null;
+
+ ret = data.getValue();
+
+ try
+ {
+ if (data.getValue() instanceof IObjectAccessible)
+ {
+ ret =
+ ((IObjectAccessible) data.getValue()).getObject(
+ preferredType);
+ }
+ }
+ catch (Exception e)
+ {
+ ActionException bpx =
+ new ActionException("NATIVE_EXCEPTION", new Object[] {
+ }, e);
+ //bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+
+ return ret;
+ }
+
+ public void setParam(Object inputData, IInteraction iInteraction)
+ throws ActionException
+ {
+ try
+ {
+ if (iInteraction instanceof IObjectMutable)
+ {
+ ((IObjectMutable) iInteraction).setObject(inputData);
+ }
+ else
+ {
+ ActionException bpx =
+ new ActionException(
+ "INVALID_DATAOBJECT",
+ new Object[] { data.getName()});
+ //bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+ }
+ catch (Exception e)
+ {
+ ActionException bpx =
+ new ActionException("NATIVE_EXCEPTION", new Object[] {
+ }, e);
+ //bpx.log(logger,Level.SEVERE);
+ throw bpx;
+ }
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/IActionParam.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/IActionParam.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/IActionParam.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/action/param/IActionParam.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on: Nov 5, 2003
+ * Project: BPEELocal
+ * Package: com.sybase.action.param
+ * Author: waterman
+ */
+package org.apache.ode.action.param;
+
+import org.apache.ode.action.internal.ActionException;
+import org.apache.ode.interaction.IInteraction;
+
+/**
+ *
+ *
+ * @author waterman
+ */
+public interface IActionParam {
+
+ Object getParam() throws ActionException;
+ void setParam(Object inputData, IInteraction interacton) throws ActionException;
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/DeployTypeEnum.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/DeployTypeEnum.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/DeployTypeEnum.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/DeployTypeEnum.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.bped;
+
+/**
+ * Enumeration of deploy types.
+ * @author charper
+ *
+ */
+public class DeployTypeEnum {
+
+ private java.lang.String value;
+ private static final java.lang.String BPEL_VALUE = "BPEL";
+
+ private DeployTypeEnum() {
+ // Prevent non-class create
+ }
+
+ private DeployTypeEnum(java.lang.String value) {
+ this.value = value;
+ }
+
+ /**
+ * BPEL deploy type
+ */
+ public static final DeployTypeEnum BPEL = new DeployTypeEnum(BPEL_VALUE);
+
+ /**
+ * Get the value of the type.
+ * @return value of the type
+ */
+ public java.lang.String getValue() {
+ return value;
+ }
+
+
+ public int hashCode() {
+ return value.hashCode();
+ }
+
+
+ public boolean equals(Object obj) {
+ if (obj instanceof DeployTypeEnum) {
+ return value.equals(((DeployTypeEnum) obj).value);
+ }
+ return false;
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventContext.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventContext.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventContext.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventContext.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.bped;
+import org.apache.ode.engine.ReturnMessageLocatorHolder;
+import org.apache.ode.event.IRequestMessageEvent;
+
+/**
+ * @author blorenz
+ *
+ * Holds the state associated with the processing of a single request ( event ).
+ * This class was added to support recursive calls to the event director's
+ * sendEvent method.
+ *
+ */
+public class EventContext
+{
+ private ReturnMessageLocatorHolder rmlh;
+ private IRequestMessageEvent me;
+ public void setReturnMessageMetadata(ReturnMessageLocatorHolder rmlh)
+ {
+ this.rmlh = rmlh;
+ }
+ public void setMessageEvent(IRequestMessageEvent me)
+ {
+ this.me = me;
+ }
+ public ReturnMessageLocatorHolder getReturnMessageMetadata()
+ {
+ return this.rmlh;
+ }
+ public IRequestMessageEvent getMessageEvent()
+ {
+ return this.me;
+ }
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirector.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirector.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirector.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirector.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+/*
+ * Created on Aug 13, 2003
+ */
+package org.apache.ode.bped;
+
+import org.apache.ode.client.impl.IInternalRequestConsumer;
+
+/**
+ * Message router interface.
+ * @author charper
+ *
+ */
+public interface EventDirector extends ISendEvent,
+ IInternalRequestConsumer {
+
+ /**
+ * Get a handle to the internal event director interface. This method and all it's
+ * implementations should be removed once services can be accessed independent of a handle
+ * to the internal event director.
+ */
+ IInternalEventDirector getIInternalEventDirector();
+
+ /**
+ * Get a defintion deployer.
+ * @param type the type of deployer to get
+ * @return a deployer
+ * @see org.apache.ode.bped.IDeployer
+ * @see org.apache.ode.bped.DeployTypeEnum
+ */
+ IDeployer getDeployer(DeployTypeEnum type);
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorException.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorException.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorException.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorException.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.bped;
+
+import org.apache.ode.util.BPException;
+
+/**
+ * Exception class for the EventDirector.
+ */
+public class EventDirectorException extends BPException {
+
+ static final long serialVersionUID = -5403639885209731156L;
+
+
+ /**
+ * @param message_id
+ * @param msgParams
+ */
+ public EventDirectorException(String message_id, Object[] msgParams) {
+ super(message_id, msgParams);
+ }
+
+ /**
+ * @param message_id
+ * @param msgParams
+ * @param cause
+ */
+ public EventDirectorException(
+ String message_id,
+ Object[] msgParams,
+ Throwable cause) {
+ super(message_id, msgParams, cause);
+ }
+
+}
Added: incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorFactory.java
URL: http://svn.apache.org/viewcvs/incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorFactory.java?rev=381694&view=auto
==============================================================================
--- incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorFactory.java (added)
+++ incubator/ode/scratch/ode/src/main/java/org/apache/ode/bped/EventDirectorFactory.java Tue Feb 28 08:31:48 2006
@@ -0,0 +1,299 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+package org.apache.ode.bped;
+import java.io.IOException;
+import java.rmi.RemoteException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.ejb.CreateException;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.ode.bped.managed.BPEventDirectorLocal;
+import org.apache.ode.bped.managed.BPEventDirectorLocalHome;
+import org.apache.ode.bped.managed.BPEventDirector;
+import org.apache.ode.bped.managed.BPEventDirectorHome;
+import org.apache.ode.bped.managed.EventDirectorLocal;
+import org.apache.ode.bped.managed.EventDirectorRemote;
+import org.apache.ode.correlation.CorrelationService;
+import org.apache.ode.correlation.CorrelationServiceFactory;
+import org.apache.ode.definition.service.managed.ProcessDefinition;
+import org.apache.ode.definition.service.managed.ProcessDefinitionHome;
+import org.apache.ode.engine.ProcessService;
+import org.apache.ode.enginestate.service.EngineStateFactory;
+import org.apache.ode.inmemory.jndi.IMContext;
+import org.apache.ode.util.BPEProperties;
+import org.apache.ode.util.BPException;
+import org.apache.ode.uuid.UUIDService;
+import org.apache.ode.uuid.UUIDServiceFactory;
+import org.apache.ode.locking.LockingService;
+import org.apache.ode.locking.LockingServiceFactory;
+/**
+ * Factory for Event Director's
+ *
+ * @author charper
+ *
+ */
+public class EventDirectorFactory
+{
+ public static final String IM_ENGINE_PROPERTY_FILE_NAME = "odeEngine.properties";
+ public static final String JNFI = "java.naming.factory.initial";
+ public static final String IMJNFI =
+ "org.apache.ode.inmemory.jndi.IMContextFactory";
+ private static Logger logger = Logger.getLogger(EventDirectorFactory.class
+ .getName());
+ private static UUIDService us;
+ private static EventDirector cachedEventDirector;
+
+
+ /**
+ * Create an in memoroy event director for the BPE package.
+ * @return and EventDirector
+ * @throws BPException
+ */
+ public static EventDirector createEventDirector() throws BPException
+ {
+ return createEventDirector("BPE");
+ }
+
+ /**
+ * Create an in memoroy event director.
+ * @param pkgName the pakgName to create the EventDirector for.
+ * @return
+ * @throws BPException
+ */
+ public static EventDirector createEventDirector(String pkgName) throws BPException
+ {
+ boolean remote = true;
+
+ String val = System.getProperty(JNFI);
+ if (val != null && val.compareTo(IMJNFI) == 0) {
+ remote = false;
+ }
+
+ if (remote)
+ {
+ return createRemoteEventDirector(pkgName);
+ }
+ else
+ {
+ return createInMemoryEventDirector();
+ }
+ }
+
+ public synchronized static EventDirector createEventDirectorCached(String pkgName)
+ throws BPException
+{
+ if ( cachedEventDirector != null ) {
+ return cachedEventDirector;
+ }
+ return createEventDirector(pkgName);
+}
+
+ public synchronized static EventDirector createEventDirectorCached()
+ throws BPException
+ {
+ if ( cachedEventDirector != null ) {
+ return cachedEventDirector;
+ }
+ return createEventDirector();
+ }
+
+ private static EventDirector createInMemoryEventDirector()
+ throws BPException
+ {
+
+ us = UUIDServiceFactory.createUUIDService();
+ BPEProperties props = new BPEProperties();
+ try
+ {
+ IMContext.getProperties(props,IM_ENGINE_PROPERTY_FILE_NAME);
+/* File file = new File(IM_ENGINE_PROPERTY_FILE_NAME);
+ if (file.exists() == true)
+ {
+ FileInputStream ifstrm = new FileInputStream(
+ IM_ENGINE_PROPERTY_FILE_NAME);
+ props.load(ifstrm);
+ }*/
+ } catch (IOException e)
+ {
+ EventDirectorException bpx = new EventDirectorException(
+ "NATIVE_EXCEPTION", new Object[]
+ {"IOException"}, e);
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ }
+ cachedEventDirector = createEventDirector(props);
+ return cachedEventDirector;
+ }
+ /**
+ * Create an in memory event director
+ *
+ * @param props
+ * properites for event director
+ * @return an in memory event director
+ * @throws EventDirectorException
+ */
+ public static EventDirector createEventDirector(BPEProperties props)
+ throws BPException
+ {
+ CorrelationService cs;
+ ProcessService ps;
+ LockingService ls;
+ IInternalEventDirector ed = null;
+ try
+ {
+ // load the implementation
+ Class instClass = java.lang.Class.forName(props
+ .getEventDirectorClass());
+ // try to instantiate the subclass
+ ed = (IInternalEventDirector) instClass.newInstance();
+ // set engine state name
+ props.setProperty(EngineStateFactory.ENGINE_NAME,"BPE_ENGINE_"+
+ ed.hashCode());
+ // LLW: 10-22-03
+ // If the client has created a BPEProperties object - init UUID
+ // with the user specified props.
+ if (us == null)
+ us = UUIDServiceFactory.createUUIDService(props);
+ ps = new ProcessService(props, us);
+ cs = CorrelationServiceFactory.createCorrelationService(props, ps);
+ ls = LockingServiceFactory.createLockingService(props);
+ ed.init(props, ps, cs, us, ls);
+ } catch (ClassNotFoundException e)
+ {
+ EventDirectorException bpx = new EventDirectorException(
+ "CLASS_NOT_FOUND", new Object[]
+ {props.getEventDirectorClass()});
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ } catch (InstantiationException e)
+ {
+ EventDirectorException bpx = new EventDirectorException(
+ "NATIVE_EXCEPTION", new Object[]
+ {"InstantiationException"}, e);
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ } catch (IllegalAccessException e)
+ {
+ EventDirectorException bpx = new EventDirectorException(
+ "NATIVE_EXCEPTION", new Object[]
+ {"IllegalAccessException"}, e);
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ }
+ return (EventDirector) ed;
+ }
+
+ /**
+ * Create a remote event director for BPE package. This a remote event
+ * director will conect to a remote engine.
+ * @return
+ * @throws BPException
+ */
+ public static EventDirector createRemoteEventDirector() throws BPException {
+ return createRemoteEventDirector(false);
+ }
+
+ /**
+ * Create a remote event director for BPE package. This a remote event
+ * director will conect to a remote engine.
+ * @param localBPED
+ * @return
+ * @throws BPException
+ */
+ public static EventDirector createRemoteEventDirector(boolean localBPED) throws BPException
+ {
+ return createRemoteEventDirector("BPE", localBPED);
+ }
+ /**
+ * Create a remote event director. This a remote event director will conect
+ * to a remote engine.
+ *
+ * @return a remote event director
+ * @throws EventDirectorException
+ */
+ public static EventDirector createRemoteEventDirector(String pkgName) throws BPException
+ {
+ return createRemoteEventDirector(pkgName, false);
+ }
+
+ /**
+ * Create a remote event director. This a remote event director will conect
+ * to a remote engine.
+ *
+ * @return a remote event director
+ * @throws EventDirectorException
+ */
+ public static EventDirector createRemoteEventDirector(String pkgName, boolean localBPED) throws BPException
+ {
+ EventDirector ed = null;
+ try
+ {
+ // get the interface
+ InitialContext ic = new InitialContext();
+
+ Object o = ic.lookup(pkgName+"/ProcessDefinition");
+ ProcessDefinitionHome pdHome = (ProcessDefinitionHome) PortableRemoteObject
+ .narrow(o, ProcessDefinitionHome.class);
+ // get a bean
+ ProcessDefinition pd = pdHome.create();
+
+ // get a bean
+ if (localBPED) {
+ BPEventDirectorLocalHome bpedLocalHome = (BPEventDirectorLocalHome) ic.lookup("java:comp/env/theLocalBPEDBean");
+ BPEventDirectorLocal bpedLocal = bpedLocalHome.create();
+ ed = new EventDirectorLocal(bpedLocal, pd);
+ } else {
+ o = ic.lookup(pkgName+"/BPEventDirector");
+ BPEventDirectorHome bpedHome = (BPEventDirectorHome) PortableRemoteObject.narrow(o, BPEventDirectorHome.class);
+ BPEventDirector bped = bpedHome.create();
+ ed = new EventDirectorRemote(bped, pd);
+ }
+ } catch (ClassCastException e)
+ {
+ EventDirectorException bpx = new EventDirectorException(
+ "NATIVE_EXCEPTION", new Object[]
+ {"ClassCastException"}, e);
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ } catch (RemoteException e)
+ {
+ EventDirectorException bpx = new EventDirectorException(
+ "NATIVE_EXCEPTION", new Object[]
+ {"RemoteException"}, e);
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ } catch (NamingException e)
+ {
+ EventDirectorException bpx = new EventDirectorException(
+ "NATIVE_EXCEPTION", new Object[]
+ {"NamingException"}, e);
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ } catch (CreateException e)
+ {
+ EventDirectorException bpx = new EventDirectorException(
+ "NATIVE_EXCEPTION", new Object[]
+ {"CreateException"}, e);
+ bpx.log(logger, Level.SEVERE);
+ throw bpx;
+ }
+ return ed;
+ }
+}