You are viewing a plain text version of this content. The canonical link for it is here.
Posted to agila-commits@incubator.apache.org by mr...@apache.org on 2005/04/27 20:28:07 UTC

svn commit: r165042 [22/30] - in /incubator/agila/trunk: ./ config/ modules/ modules/bpel/ modules/bpel/client/ modules/bpel/client/api/ modules/bpel/client/api/src/ modules/bpel/client/api/src/conf/ modules/bpel/client/api/src/java/ modules/bpel/client/api/src/java/org/ modules/bpel/client/api/src/java/org/apache/ modules/bpel/client/api/src/java/org/apache/agila/ modules/bpel/client/api/src/java/org/apache/agila/bpel/ modules/bpel/client/api/src/java/org/apache/agila/bpel/client/ modules/bpel/client/api/src/test/ modules/bpel/client/api/src/test/junit/ modules/bpel/client/api/src/test/junit/org/ modules/bpel/client/api/src/test/junit/org/apache/ modules/bpel/client/api/src/test/junit/org/apache/agila/ modules/bpel/client/api/src/test/junit/org/apache/agila/bpel/ modules/bpel/client/api/src/test/junit/org/apache/agila/bpel/client/ modules/bpel/client/web/ modules/bpel/client/web/src/ modules/bpel/client/web/src/conf/ modules/bpel/client/web/src/java/ modules/bpel/client/web/src/java/org/ modules/bpel/client/web/src/java/org/apache/ modules/bpel/client/web/src/java/org/apache/agila/ modules/bpel/client/web/src/java/org/apache/agila/bpel/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/common/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/deployer/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/deployer/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/deployer/form/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/engine/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/engine/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/engine/form/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/global/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/global/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/security/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/security/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/security/form/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/user/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/user/action/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/user/form/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/util/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/worklist/ modules/bpel/client/web/src/java/org/apache/agila/bpel/web/worklist/action/ modules/bpel/client/web/src/webapp/ modules/bpel/client/web/src/webapp/META-INF/ modules/bpel/client/web/src/webapp/WEB-INF/ modules/bpel/client/web/src/webapp/WEB-INF/classes/ modules/bpel/client/web/src/webapp/images/ modules/bpel/client/web/src/webapp/images/audit/ modules/bpel/client/web/src/webapp/style/ modules/bpel/common/ modules/bpel/common/src/ modules/bpel/common/src/aspect/ modules/bpel/common/src/conf/ modules/bpel/common/src/java/ modules/bpel/common/src/java/org/ modules/bpel/common/src/java/org/apache/ modules/bpel/common/src/java/org/apache/agila/ modules/bpel/common/src/java/org/apache/agila/bpel/ modules/bpel/common/src/java/org/apache/agila/bpel/common/ modules/bpel/common/src/java/org/apache/agila/bpel/common/aspect/ modules/bpel/common/src/java/org/apache/agila/bpel/common/configuration/ modules/bpel/common/src/java/org/apache/agila/bpel/common/util/ modules/bpel/common/src/java/org/apache/agila/bpel/common/util/logger/ modules/bpel/common/src/test/ modules/bpel/common/src/test/junit/ modules/bpel/common/src/test/junit/org/ modules/bpel/common/src/test/junit/org/apache/ modules/bpel/common/src/test/junit/org/apache/agila/ modules/bpel/common/src/test/junit/org/apache/agila/bpel/ modules/bpel/common/src/test/junit/org/apache/agila/bpel/common/ modules/bpel/common/src/test/junit/org/apache/agila/bpel/common/util/ modules/bpel/dist/ modules/bpel/dist/src/ modules/bpel/dist/src/java/ modules/bpel/dist/src/java/org/ modules/bpel/dist/src/java/org/apache/ modules/bpel/dist/src/java/org/apache/agila/ modules/bpel/dist/src/java/org/apache/agila/bpel/ modules/bpel/dist/src/java/org/apache/agila/bpel/util/ modules/bpel/dist/src/script/ modules/bpel/engine/ modules/bpel/engine/common/ modules/bpel/engine/common/src/ modules/bpel/engine/common/src/aspect/ modules/bpel/engine/common/src/hibernate/ modules/bpel/engine/common/src/hibernate/org/ modules/bpel/engine/common/src/hibernate/org/apache/ modules/bpel/engine/common/src/hibernate/org/apache/agila/ modules/bpel/engine/common/src/hibernate/org/apache/agila/bpel/ modules/bpel/engine/common/src/hibernate/org/apache/agila/bpel/engine/ modules/bpel/engine/common/src/hibernate/org/apache/agila/bpel/engine/common/ modules/bpel/engine/common/src/java/ modules/bpel/engine/common/src/java/org/ modules/bpel/engine/common/src/java/org/apache/ modules/bpel/engine/common/src/java/org/apache/agila/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/aspect/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/execution/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/execution/impl/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/lifecycle/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/event/lifecycle/dao/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/lifecycle/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/monitoring/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/persistence/ modules/bpel/engine/common/src/java/org/apache/agila/bpel/engine/common/transaction/ modules/bpel/engine/common/src/test/ modules/bpel/engine/common/src/test/junit/ modules/bpel/engine/common/src/test/junit/org/ modules/bpel/engine/common/src/test/junit/org/apache/ modules/bpel/engine/common/src/test/junit/org/apache/agila/ modules/bpel/engine/common/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/common/src/test/junit/org/apache/agila/bpel/engine/ modules/bpel/engine/common/src/test/junit/org/apache/agila/bpel/engine/common/ modules/bpel/engine/common/src/test/junit/org/apache/agila/bpel/engine/common/event/ modules/bpel/engine/common/src/test/resources/ modules/bpel/engine/core/ modules/bpel/engine/core/src/ modules/bpel/engine/core/src/aspect/ modules/bpel/engine/core/src/hibernate/ modules/bpel/engine/core/src/hibernate/org/ modules/bpel/engine/core/src/hibernate/org/apache/ modules/bpel/engine/core/src/hibernate/org/apache/agila/ modules/bpel/engine/core/src/hibernate/org/apache/agila/bpel/ modules/bpel/engine/core/src/hibernate/org/apache/agila/bpel/engine/ modules/bpel/engine/core/src/java/ modules/bpel/engine/core/src/java/org/ modules/bpel/engine/core/src/java/org/apache/ modules/bpel/engine/core/src/java/org/apache/agila/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/exception/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/definition/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/definition/impl/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/definition/impl/dao/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/dynamic/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/dynamic/impl/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/dynamic/impl/dao/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/core/dynamic/impl/xao/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/expression/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/expression/impl/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/messaging/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/messaging/impl/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/timer/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/timer/dao/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/timer/po/ modules/bpel/engine/core/src/java/org/apache/agila/bpel/engine/priv/util/ modules/bpel/engine/core/src/test/ modules/bpel/engine/core/src/test/junit/ modules/bpel/engine/core/src/test/junit/org/ modules/bpel/engine/core/src/test/junit/org/apache/ modules/bpel/engine/core/src/test/junit/org/apache/agila/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/core/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/core/definition/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/core/dynamic/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/engine/messaging/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/tools/ modules/bpel/engine/core/src/test/junit/org/apache/agila/bpel/util/ modules/bpel/engine/core/src/test/resources/ modules/bpel/engine/deployer/ modules/bpel/engine/deployer/src/ modules/bpel/engine/deployer/src/aspect/ modules/bpel/engine/deployer/src/java/ modules/bpel/engine/deployer/src/java/org/ modules/bpel/engine/deployer/src/java/org/apache/ modules/bpel/engine/deployer/src/java/org/apache/agila/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/exception/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/context/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/complex/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/exclusivity/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/reference/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/bpel/unicity/ modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/validate/wsdl/ modules/bpel/engine/deployer/src/test/ modules/bpel/engine/deployer/src/test/junit/ modules/bpel/engine/deployer/src/test/junit/org/ modules/bpel/engine/deployer/src/test/junit/org/apache/ modules/bpel/engine/deployer/src/test/junit/org/apache/agila/ modules/bpel/engine/deployer/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/deployer/src/test/junit/org/apache/agila/bpel/deployer/ modules/bpel/engine/deployer/src/test/resources/ modules/bpel/engine/user/ modules/bpel/engine/user/src/ modules/bpel/engine/user/src/aspect/ modules/bpel/engine/user/src/hibernate/ modules/bpel/engine/user/src/hibernate/org/ modules/bpel/engine/user/src/hibernate/org/apache/ modules/bpel/engine/user/src/hibernate/org/apache/agila/ modules/bpel/engine/user/src/hibernate/org/apache/agila/bpel/ modules/bpel/engine/user/src/hibernate/org/apache/agila/bpel/user/ modules/bpel/engine/user/src/java/ modules/bpel/engine/user/src/java/org/ modules/bpel/engine/user/src/java/org/apache/ modules/bpel/engine/user/src/java/org/apache/agila/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/exception/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/ modules/bpel/engine/user/src/java/org/apache/agila/bpel/user/priv/dao/ modules/bpel/engine/user/src/test/ modules/bpel/engine/user/src/test/junit/ modules/bpel/engine/user/src/test/junit/org/ modules/bpel/engine/user/src/test/junit/org/apache/ modules/bpel/engine/user/src/test/junit/org/apache/agila/ modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/user/src/test/junit/org/apache/agila/bpel/user/ modules/bpel/engine/user/src/test/resource/ modules/bpel/engine/worklist/ modules/bpel/engine/worklist/src/ modules/bpel/engine/worklist/src/aspect/ modules/bpel/engine/worklist/src/hibernate/ modules/bpel/engine/worklist/src/hibernate/org/ modules/bpel/engine/worklist/src/hibernate/org/apache/ modules/bpel/engine/worklist/src/hibernate/org/apache/agila/ modules/bpel/engine/worklist/src/hibernate/org/apache/agila/bpel/ modules/bpel/engine/worklist/src/hibernate/org/apache/agila/bpel/worklist/ modules/bpel/engine/worklist/src/java/ modules/bpel/engine/worklist/src/java/org/ modules/bpel/engine/worklist/src/java/org/apache/ modules/bpel/engine/worklist/src/java/org/apache/agila/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/exception/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/priv/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/priv/dao/ modules/bpel/engine/worklist/src/java/org/apache/agila/bpel/worklist/priv/po/ modules/bpel/engine/worklist/src/test/ modules/bpel/engine/worklist/src/test/junit/ modules/bpel/engine/worklist/src/test/junit/org/ modules/bpel/engine/worklist/src/test/junit/org/apache/ modules/bpel/engine/worklist/src/test/junit/org/apache/agila/ modules/bpel/engine/worklist/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/worklist/src/test/junit/org/apache/agila/bpel/worklist/ modules/bpel/engine/worklist/src/test/resource/ modules/bpel/engine/wsa/ modules/bpel/engine/wsa/src/ modules/bpel/engine/wsa/src/aspect/ modules/bpel/engine/wsa/src/conf/ modules/bpel/engine/wsa/src/hibernate/ modules/bpel/engine/wsa/src/java/ modules/bpel/engine/wsa/src/java/org/ modules/bpel/engine/wsa/src/java/org/apache/ modules/bpel/engine/wsa/src/java/org/apache/agila/ modules/bpel/engine/wsa/src/java/org/apache/agila/bpel/ modules/bpel/engine/wsa/src/java/org/apache/agila/bpel/wsa/ modules/bpel/engine/wsa/src/schema/ modules/bpel/engine/wsa/src/test/ modules/bpel/engine/wsa/src/test/junit/ modules/bpel/engine/wsa/src/test/junit/org/ modules/bpel/engine/wsa/src/test/junit/org/apache/ modules/bpel/engine/wsa/src/test/junit/org/apache/agila/ modules/bpel/engine/wsa/src/test/junit/org/apache/agila/bpel/ modules/bpel/engine/wsa/src/test/junit/org/apache/agila/bpel/worklist/ modules/bpel/engine/wsa/src/test/resources/ modules/bpel/engine/wsa/src/webapp/ modules/bpel/engine/wsa/src/webapp/META-INF/ modules/bpel/engine/wsa/src/webapp/WEB-INF/ modules/bpel/engine/wsa/src/webapp/WEB-INF/classes/ modules/bpel/samples/ modules/bpel/samples/src/ modules/bpel/samples/src/xml/ modules/bpel/samples/src/xml/example1/ modules/bpel/samples/src/xml/example1/messages/ modules/bpel/samples/src/xml/example2/ modules/bpel/samples/src/xml/example2/messages/ modules/bpel/samples/src/xml/example3/ modules/bpel/samples/src/xml/example3/messages/ modules/bpel/samples/src/xml/example4/ modules/bpel/samples/src/xml/example4/messages/ modules/bpm/ modules/bpm/config/ modules/bpm/src/ modules/bpm/src/java/ modules/bpm/src/resources/ modules/bpm/src/test/ modules/bpm/src/webapp/ src/

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/AgilaDeployerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/AgilaDeployerImpl.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/AgilaDeployerImpl.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/AgilaDeployerImpl.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,666 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import java.io.*;
+import java.net.URL;
+import java.net.MalformedURLException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import org.apache.axis.client.AdminClient;
+import org.apache.axis.utils.Options;
+
+import org.apache.log4j.Logger;
+
+import org.dom4j.*;
+import org.dom4j.io.SAXReader;
+
+import org.apache.agila.bpel.common.configuration.DeployerConfiguration;
+import org.apache.agila.bpel.common.util.NSUtil;
+
+import org.apache.agila.bpel.deployer.AgilaDeployer;
+import org.apache.agila.bpel.deployer.exception.AxisServiceCreationException;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.deployer.priv.validate.wsdl.WSDLValidator;
+import org.apache.agila.bpel.deployer.priv.validate.ValidationException;
+import org.apache.agila.bpel.deployer.priv.validate.bpel.BPELValidator;
+
+import org.apache.agila.bpel.engine.common.persistence.CreationException;
+import org.apache.agila.bpel.engine.common.persistence.DBSessionException;
+import org.apache.agila.bpel.engine.common.persistence.XMLDataAccess;
+import org.apache.agila.bpel.engine.common.transaction.TransactionException;
+import org.apache.agila.bpel.engine.common.transaction.TransactionManager;
+import org.apache.agila.bpel.engine.priv.core.definition.ProcessFactory;
+import org.apache.agila.bpel.engine.priv.core.definition.Property;
+import org.apache.agila.bpel.engine.priv.core.definition.AgilaProcess;
+import org.apache.agila.bpel.engine.priv.AgilaEngineAdminImpl;
+
+import org.xmldb.api.base.Collection;
+
+/**
+ * Implementation of the AgilaDeployer interface.
+ * <process name="ncname" targetNamespace="uri"
+ * queryLanguage="anyURI"?
+ * expressionLanguage="anyURI"?
+ * suppressJoinFailure="yes|no"?
+ * enableInstanceCompensation="yes|no"?
+ * abstractProcess="yes|no"?
+ * xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
+ * <partnerLinks>?
+ * <!-- Note: At least one role must be specified. -->
+ * <partnerLink name="ncname" partnerLinkType="qname"
+ * myRole="ncname"? partnerRole="ncname"?>+
+ * </partnerLink>
+ * </partnerLinks>
+ * <partners>?
+ * <partner name="ncname">+
+ * <partnerLink name="ncname"/>+
+ * </partner>
+ * </partners>
+ * <variables>?
+ * <variable name="ncname" messageType="qname"?
+ * type="qname"? element="qname"?/>+
+ * </variables>
+ * <correlationSets>?
+ * <correlationSet name="ncname" properties="qname-list"/>+
+ * </correlationSets>
+ * <faultHandlers>?
+ * <!-- Note: There must be at least one fault handler or default. -->
+ * <catch faultName="qname"? faultVariable="ncname"?>*
+ * activity
+ * </catch>
+ * <catchAll>?
+ * activity
+ * </catchAll>
+ * </faultHandlers>
+ * <compensationHandler>?
+ * activity
+ * </compensationHandler>
+ * <eventHandlers>?
+ * <!-- Note: There must be at least one onMessage or onAlarm handler. -->
+ * <onMessage partnerLink="ncname" portType="qname"
+ * operation="ncname" variable="ncname"?>
+ * <correlations>?
+ * <correlation set="ncname" initiate="yes|no"?>+
+ * </correlations>
+ * activity
+ * </onMessage>
+ * <onAlarm for="duration-expr"? until="deadline-expr"?>*
+ * activity
+ * </onAlarm>
+ * </eventHandlers>
+ * activity
+ * </process>
+ */
+public class AgilaDeployerImpl implements AgilaDeployer {
+
+    public static final String NS_SEPARATOR = ":";
+    public static final String SPACE = " ";
+    public static final String XMLNS = "xmlns";
+    public static final String DEFINITIONS = "definitions";
+
+    private Logger log = Logger.getLogger(AgilaDeployerImpl.class);
+    private static final String TILD = "~";
+    private static final String BPEL_NS = "http://schemas.xmlsoap.org/ws/2003/03/business-process/";
+
+    private WSDLValidator wsdlValidator = null;
+    private BPELValidator bpelValidator = null;
+
+    public void deployResource(String resourceContent) throws DeploymentException {
+        String filePath = DeployerConfiguration.getDeployDir() + extractFileName(resourceContent);
+        log.debug("Deploying resource as " + filePath);
+        deployFile(filePath, resourceContent);
+        Document doc;
+        try {
+            doc = getDocument(resourceContent);
+        } catch (DocumentException e) {
+            throw new DeploymentException("An error occured while parsing the deployed document.", e);
+        }
+        AgilaEngineAdminImpl.registerResourceNS(doc.getRootElement()
+                .attribute("targetNamespace").getValue(), filePath);
+        log.debug("Resource " + filePath + " as been deployed properly.");
+    }
+
+    public String[] deployWSDL(String resourceContent, boolean validate) throws DeploymentException {
+        String filePath = DeployerConfiguration.getDeployDir() + extractFileName(resourceContent);
+        log.debug("Deploying WSDL document as " + filePath);
+        deployFile(filePath, resourceContent);
+
+        boolean validationFailed = false;
+        String[] validationMessages = null;
+        if (validate) {
+            try {
+                validationMessages = getWSDLValidator().validate("file:///" + filePath);
+            } catch (ValidationException e) {
+                validationFailed = true;
+            }
+            if (validationMessages.length > 0) validationFailed = true;
+            if (validationFailed) {
+                new File(filePath).delete();
+                log.debug("Deployment of WSDL document " + filePath
+                              + " has failed, returned error have been provided.");
+                return validationMessages;
+            }
+        }
+
+        Document doc = null;
+        try {
+            doc = getDocument(resourceContent);
+        } catch (DocumentException e) {
+            throw new DeploymentException("An error occured while parsing the deployed document.", e);
+        }
+        AgilaEngineAdminImpl.registerWSDLNS(doc.getRootElement()
+                .attribute("targetNamespace").getValue(), filePath);
+        log.debug("WSDL document " + filePath + " as been deployed properly.");
+
+        return validationMessages;
+    }
+
+    public String[] deployBPEL(String resourceContent) throws DeploymentException {
+        // Loading all documents referenced in the process description and finding out
+        // which one is the WSDL definition.
+        Document bpelDoc = null;
+        try {
+            bpelDoc = getDocument(resourceContent);
+        } catch (DocumentException e) {
+            throw new DeploymentException("Could not parse document.");
+        }
+
+        log.debug("Looking for WSDL document for BPEL being deployed " + bpelDoc.getRootElement().attribute("targetNamespace"));
+        Document wsdlDoc = null;
+        List namespaces = bpelDoc.getRootElement().declaredNamespaces();
+        for (int m = 0; m < namespaces.size(); m++) {
+            Namespace ns = (Namespace) namespaces.get(m);
+            String referencedFilePath = NSUtil.extractFileNameFromNS(ns.getURI());
+            File referencedFile = new File(DeployerConfiguration.getDeployDir() + referencedFilePath);
+            if (referencedFile.exists()) {
+                Document referencedDoc = null;
+                try {
+                    referencedDoc = getDocument(referencedFile.toURL());
+                } catch (DocumentException e) {
+                    throw new DeploymentException("Could not parse a referenced document : "
+                            + ns.getURI() + " / " + referencedFilePath);
+                } catch (MalformedURLException e) {
+                    throw new DeploymentException("Could not locate a referenced document : "
+                            + ns.getURI() + " / " + referencedFilePath);
+                }
+                if (DEFINITIONS.equals(referencedDoc.getRootElement().getName())) {
+                    wsdlDoc = referencedDoc;
+                }
+            }
+        }
+
+        // Creating file locally to perform validation.
+        String filePath = checkVersion(DeployerConfiguration.getDeployDir() + extractFileName(resourceContent));
+        log.debug("Deploying BPEL document as " + filePath);
+        deployFile(filePath, resourceContent);
+
+        String[] validationMessages = getBPELValidator().validate("file:///" + filePath);
+        if (validationMessages.length > 0) {
+            new File(filePath).delete();
+            return validationMessages;
+        }
+
+        // Deploying if the WSDL document has been found.
+        if (wsdlDoc == null) {
+            throw new DeploymentException("Could not find the WSDL document referenced in the provided BPEL " +
+                    "process description, please make sure you deployed the referenced WSDL description.");
+        } else {
+            deploy(bpelDoc, wsdlDoc);
+            try {
+                AgilaEngineAdminImpl.registerBPELNS(bpelDoc.getRootElement()
+                        .attribute("targetNamespace").getValue(), filePath);
+            } catch (RuntimeException e) {
+                new File(filePath).delete();
+                throw new RuntimeException(e);
+            }
+            log.debug("WSDL document " + filePath + " as been deployed properly.");
+        }
+        return null;
+    }
+
+
+    /**
+     * Creates a file at the provided location and writes its content.
+     * @param filePath
+     * @param fileContent
+     * @throws DeploymentException
+     */
+    private void deployFile(String filePath, String fileContent) throws DeploymentException {
+        try {
+            File file = new File(filePath);
+            file.createNewFile();
+            // Writing file to disk
+            FileWriter writer = new FileWriter(file);
+            writer.write(fileContent);
+            writer.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new DeploymentException(e);
+        }
+    }
+
+    /**
+     * This method builds a file name from the targetNamespace declaration of the
+     * document. It basically removes the 'http://www.' from tu URL and transforms every
+     * '/' or ':' to a '.'
+     * @param resourceContent
+     * @return
+     * @throws DeploymentException
+     */
+    private String extractFileName(String resourceContent) throws DeploymentException {
+        // Extracting the namespace
+        Document document = null;
+        try {
+            document = getDocument(resourceContent);
+        } catch (DocumentException e) {
+            throw new DeploymentException("Could not parse document.");
+        }
+        Attribute targetNSAttr = document.getRootElement().attribute("targetNamespace");
+        if (targetNSAttr == null) {
+            throw new DeploymentException("Documents with no targetNamespace declaration are not authorized.");
+        }
+        String targetNS = targetNSAttr.getValue();
+        return NSUtil.extractFileNameFromNS(targetNS);
+    }
+
+    /**
+     * Appends a version number to the name of a file to deploy.
+     * @param fileName
+     */
+    private String checkVersion(String fileName) {
+        int version = 1;
+        boolean exists = true;
+        while (exists) {
+            if (new File(fileName + TILD + version).exists()) {
+                version++;
+            } else {
+                exists = false;
+            }
+        }
+        return fileName + TILD + version;
+    }
+
+    public void deploy(String xmlProcessDescription) throws DeploymentException {
+        deploy(xmlProcessDescription, null);
+    }
+
+    public void deploy(String xmlProcess, String xmlProcessDefinition) throws DeploymentException {
+        try {
+            deploy(getDocument(xmlProcess), getDocument(xmlProcessDefinition));
+        } catch (DocumentException e) {
+            log.error("Failed to deploy a XML description from a String.", e);
+            throw new DeploymentException("unable to deploy the document", e);
+        }
+    }
+
+    public void deploy(InputStream xmlProcessDescription) throws DeploymentException {
+        String methodName = "deploy";
+        try {
+            BufferedReader reader = new BufferedReader(new InputStreamReader(xmlProcessDescription));
+            StringBuffer buffer = new StringBuffer();
+            String str = null;
+            while ((str = reader.readLine()) != null) {
+                buffer.append(str);
+            }
+            deploy(getDocument(buffer.toString()), null);
+        } catch (DocumentException e) {
+            log.error("Failed to deploy a XML description from a stream.", e);
+            throw new DeploymentException("unable to deploy the document", e);
+        } catch (IOException e) {
+            log.error("Failed to deploy a XML description from a stream.", e);
+            throw new DeploymentException("unable to deploy the document", e);
+        }
+    }
+
+    public void deploy(URL xmlProcessDescription) throws DeploymentException {
+        String methodName = "deploy";
+        try {
+            deploy(getDocument(xmlProcessDescription), null);
+        } catch (Exception e) {
+            log.error("Failed to deploy a XML description from an URL.", e);
+            throw new DeploymentException("unable to deploy the document", e);
+        }
+    }
+
+    public void deploy(File xmlProcessDescription) throws DeploymentException {
+        String methodName = "deploy";
+        try {
+            deploy(getDocument(xmlProcessDescription.toURL()), null);
+        } catch (Exception e) {
+            log.error("Failed to deploy a XML description from a File.", e);
+            throw new DeploymentException("unable to deploy the document", e);
+        }
+    }
+
+    private void deploy(Document processDoc, Document definitionDoc) throws DeploymentException {
+        String methodName = "deploy";
+
+        try {
+            log.debug("begin transaction");
+            TransactionManager.beginTransaction();
+
+            Element processElement = processDoc.getRootElement();
+            log.debug("<process>");
+            AgilaProcess tp = deployProcessElement(processElement);
+            Document defDoc = definitionDoc;
+            if (definitionDoc == null) {
+                defDoc = getProcessDefDoc(processElement);
+            }
+            deployDefinitions(defDoc, tp);
+            deployVariables(processElement.element("variables"), tp);
+            deployCorrelationSets(processElement.element("correlationSets"), tp);
+
+            // todo implements 'partnerLinks' elements
+            // todo implements 'partners' elements
+            // todo implements 'faultHandlers' elements
+            // todo implements 'compensationHandlers' elements
+            // todo implements 'eventHandlers' elements
+
+            deployActivity(processElement, tp);
+            log.debug("</process> ");
+
+            saveProcess(processDoc, definitionDoc, tp.getNamespace()+tp.getName());
+
+            log.debug("commit transaction");
+            TransactionManager.commitTransaction();
+            
+            // Creating in Axis the web service corresponding to the deployed service.
+            createAxisService(tp.getName());
+
+        } catch (Throwable e) {
+            try {
+                TransactionManager.rollbackTransaction();
+            } catch (TransactionException e1) {
+                throw new DeploymentException("Could not rollback transaction.", e);
+            }
+            throw new DeploymentException(e);
+        }
+    }
+
+    private void saveProcess(Document processDoc, Document defDoc, String processName) throws DeploymentException {
+        try {
+            Collection processColl = XMLDataAccess.getCollection("/process");
+            Collection processDefColl = XMLDataAccess.getCollection("/process/def");
+            if (processColl == null) {
+                Collection rootColl = XMLDataAccess.getRootCollection();
+                processColl = XMLDataAccess.createCollection(rootColl, "process");
+            }
+            if (processDefColl == null) {
+                processDefColl = XMLDataAccess.createCollection(processColl, "def");
+            }
+            XMLDataAccess.insertDocument(processColl, "" + processName.hashCode(), processDoc);
+            XMLDataAccess.insertDocument(processDefColl, "" + processName.hashCode(), defDoc);
+        } catch (Exception e) {
+            throw new DeploymentException("Could not save the process description and web services " +
+                    "definitions in DB.", e);
+        }
+    }
+
+    private void createAxisService(String processName) {
+    	Document wsdd = DocumentHelper.createDocument();
+        Element deploymentElmt = wsdd.addElement("deployment", "http://xml.apache.org/axis/wsdd/");
+        deploymentElmt.addAttribute("name", "agila");
+        Element serviceElmt = deploymentElmt.addElement("service");
+        serviceElmt.addAttribute("name", processName);
+        serviceElmt.addAttribute("style", "message");
+        Element classNameParam = serviceElmt.addElement("parameter");
+        classNameParam.addAttribute("name", "className");
+        classNameParam.addAttribute("value", "org.apache.agila.bpel.wsa.EngineWSA");
+        Element methodsParam = serviceElmt.addElement("parameter");
+        methodsParam.addAttribute("name", "allowedMethods");
+        methodsParam.addAttribute("value", "*");
+ 
+        try {
+            AdminClient adminClient = new AdminClient();
+            Options opts = new Options(new String[] {});
+        	opts.setDefaultURL(DeployerConfiguration.getAxisUrl() + "/services/AdminService");
+            adminClient.process(opts, new ByteArrayInputStream(wsdd.asXML().getBytes()));               
+        } catch (Exception e) {
+        	throw new AxisServiceCreationException(e);
+        } 
+    }
+    
+    /**
+     * todo actualy, it processes only properties defined in one file.
+     * todo Deploy also if there are more than one definition file.
+     */
+    private Document getProcessDefDoc(Element processElement) throws DeploymentException {
+        List list = processElement.declaredNamespaces();
+        Document doc = null;
+        for (int i = 0; i < list.size(); i++) {
+            Namespace ns = (Namespace) list.get(i);
+            String nsURI = ns.getURI();
+            List uncheckedDefSchema = DeployerConfiguration.getUncheckedDefSchema();
+            if (!uncheckedDefSchema.contains(nsURI)) {
+                URL nsURL = null;
+                String urlLocalMapping = getUrlLocalMapping(nsURI);
+                nsURL = getClass().getClassLoader().getResource(urlLocalMapping);
+                try {
+                    doc = getDocument(nsURL);
+                } catch (Exception e) {
+                    throw new DeploymentException(e);
+                }
+            }
+        }
+        return doc;
+    }
+
+    private void deployDefinitions(Document doc, AgilaProcess tp) throws DeploymentException {
+        Element rootElement = doc.getRootElement();
+        Iterator propertyAlias = rootElement.elementIterator("propertyAlias");
+        Map addedProperty = new HashMap();
+        try {
+            while (propertyAlias.hasNext()) {
+                Element e = (Element) propertyAlias.next();
+                String propertyName = e.valueOf("@propertyName");
+
+                XPath xpathSelector = DocumentHelper.createXPath("//*/defaultNS:property[@name=\"" + propertyName + "\"]");
+                HashMap nsMap = new HashMap(1);
+                nsMap.put("defaultNS", BPEL_NS);
+                xpathSelector.setNamespaceURIs(nsMap);
+                Node propNode = xpathSelector.selectSingleNode(doc);
+
+                Property prop = (Property) addedProperty.get(propertyName);
+                if (propNode != null && prop == null) {
+                    prop = ProcessFactory.addProperty(tp,
+                            propertyName, propNode.valueOf("@type"));
+                    addedProperty.put(propertyName, prop);
+                }
+                if (prop != null) {
+                    ProcessFactory.addPropertyAlias(prop, e.valueOf("@messageType"),
+                            e.valueOf("@part"), e.valueOf("@query"));
+                } else {
+                    log.error("A propertyAlias is defined without property : " + propertyName);
+                    throw new DeploymentException("a propertyAlias is defined without property : " + propertyName);
+                }
+            }
+            Iterator properties = rootElement.elementIterator("property");
+            while (properties.hasNext()) {
+                Element e = (Element) properties.next();
+                String name = e.valueOf("@name");
+                if (addedProperty.containsKey(name) == false) {
+                    ProcessFactory.addProperty(tp, name, e.valueOf("@type"));
+                }
+            }
+        } catch (Exception e) {
+            throw new DeploymentException(e);
+        }
+    }
+
+    private String getUrlLocalMapping(String nsURI) {
+        String property = null;
+        property = (String) DeployerConfiguration.getProcessDefMapping().get(nsURI);
+        if (property == null) {
+            property = nsURI;
+        }
+        return property;
+    }
+
+    private void deployActivity(Element processElement, AgilaProcess tp) throws DeploymentException, TransactionException {
+        String methodName = "deployActivity";
+        Element activityElement = ActivityDeployer.getActivityElement(processElement);
+        if (activityElement != null) {
+            log.debug("<" + activityElement.getName() + ">");
+            ActivityDeployer ad = ActivityDeployerFactory.getActivityDeployer(activityElement.getName());
+            try {
+                ad.deploy(activityElement, tp, new DeployerContext());
+                log.debug("</" + activityElement.getName() + ">");
+            } catch (DeploymentException e) {
+                TransactionManager.rollbackTransaction();
+                log.error("Transation Rolled Back due to " + e.getMessage());
+                throw new DeploymentException(e);
+            }
+        }
+    }
+
+    /**
+     * Deploy the proces element.
+     * 
+     * @param processElement the process DOM element
+     * @return the AgilaProcess corresponding the given process
+     * @throws TransactionException 
+     * @throws DeploymentException  
+     */
+    private AgilaProcess deployProcessElement(Element processElement) throws TransactionException, DeploymentException {
+        String methodName = "deployProcessElement";
+        String name = processElement.valueOf("@name");
+        String targetNamespace = processElement.valueOf("@targetNamespace");
+//        String queryLanguage = processElement.valueOf("@queryLanguage");
+//        String expressionLanguage = processElement.valueOf("@expressionLanguage");
+//        String suppressJoinFailure = processElement.valueOf("@suppressJoinFailure");
+//        String enableInstanceCompensation = processElement.valueOf("@enableInstanceCompensation");
+//        String abstractProcess = processElement.valueOf("@abstractProcess");
+//        String xmlns = processElement.valueOf("@xmlns");
+        AgilaProcess tp = null;
+        try {
+            tp = ProcessFactory.createProcess(name, targetNamespace);
+        } catch (DBSessionException e) {
+            TransactionManager.rollbackTransaction();
+            throw new DeploymentException(e);
+        } catch (CreationException e) {
+            TransactionManager.rollbackTransaction();
+            throw new DeploymentException(e);
+        }
+        return tp;
+    }
+
+    /**
+     * Deployment of the Variables elements
+     * <p/>
+     * <variables>?
+     * <variable name="ncname" messageType="qname"?
+     * type="qname"? element="qname"?/>+
+     * </variables>
+     * 
+     * @param element the Variables DOM element.
+     * @param tp      the parent process
+     */
+    private void deployVariables(Element element, AgilaProcess tp) {
+        if (element != null) {
+            for (Iterator it = element.elementIterator("variable"); it.hasNext();) {
+                log.debug("<variable>");
+                Element variable = (Element) it.next();
+                String name = variable.valueOf("@name");
+                String messageType = variable.valueOf("@messageType");
+                String type = variable.valueOf("@type");
+                String elmt = variable.valueOf("@element");
+                log.debug("name = " + name);
+                log.debug("messageType = " + messageType);
+                log.debug("type = " + type);
+                log.debug("element = " + elmt);
+                log.debug("</variable>");
+            }
+        }
+    }
+
+    /**
+     * Deployment of the CorrelationSets element
+     * <p/>
+     * <correlationSets>?
+     * <correlationSet name="ncname" properties="qname-list"/>+
+     * </correlationSets>
+     * 
+     * @param element the CorrelationSets DOM element.
+     * @param tp      the parent process
+     * @throws DeploymentException 
+     */
+    private void deployCorrelationSets(Element element, AgilaProcess tp) throws DeploymentException {
+        if (element != null) {
+            for (Iterator it = element.elementIterator("correlationSet"); it.hasNext();) {
+                log.debug("<correlationSet>");
+                Element variable = (Element) it.next();
+                String name = variable.valueOf("@name");
+                String properties = variable.valueOf("@properties");
+                log.debug("name = " + name);
+                log.debug("messageType = " + properties);
+                log.debug("</correlationSet>");
+                try {
+                    ProcessFactory.addCorrelation(tp, name, truncNamespace(properties));
+                } catch (Exception e) {
+                    throw new DeploymentException(e);
+                }
+            }
+        }
+    }
+
+    private String truncNamespace(String nsProps) {
+        StringBuffer properties = new StringBuffer();
+        for (StringTokenizer nsTokenizer = new StringTokenizer(nsProps); nsTokenizer.hasMoreTokens();) {
+            String nsProp = nsTokenizer.nextToken();
+            int index = nsProp.lastIndexOf(NS_SEPARATOR);
+            properties.append(nsProp.substring(index + 1));
+            if (nsTokenizer.hasMoreTokens()) {
+                properties.append(SPACE);
+            }
+        }
+        return properties.toString();
+    }
+
+    private Document getDocument(String xmlProcessDescription) throws DocumentException {
+        if (xmlProcessDescription == null) {
+            return null;
+        }
+        return DocumentHelper.parseText(xmlProcessDescription);
+    }
+
+    private Document getDocument(URL xmlProcessDescription) throws DocumentException {
+        SAXReader reader = new SAXReader();
+        Document document = reader.read(xmlProcessDescription);
+
+        return document;
+    }
+
+    private WSDLValidator getWSDLValidator() {
+        if (wsdlValidator == null) {
+            wsdlValidator = new WSDLValidator();
+        }
+        return wsdlValidator;
+    }
+
+    private BPELValidator getBPELValidator() {
+        if (wsdlValidator == null) {
+            bpelValidator = new BPELValidator();
+        }
+        return bpelValidator;
+    }
+
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/AssignDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/AssignDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/AssignDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/AssignDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import java.util.Iterator;
+
+import org.dom4j.Attribute;
+import org.dom4j.Element;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.common.persistence.DBSessionException;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.ActivityFactory;
+import org.apache.agila.bpel.engine.priv.core.definition.Assign;
+import org.apache.agila.bpel.engine.priv.core.definition.Assignment;
+
+public class AssignDeployer extends ActivityDeployer {
+
+    protected Class getActivityClass() {
+        return Assign.class;
+    }
+
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Attributes
+    }
+
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        for (Iterator copy = element.elementIterator(); copy.hasNext();) {
+            Element copyElement = (Element) copy.next();
+//            log.debug("processing the copyElement : " + copyElement);
+
+            Element fromElement = copyElement.element("from");
+            Element toElement = copyElement.element("to");
+
+            if (fromElement == null || toElement == null) {
+                throw new DeploymentException("The copy tag in an assigment MUST contains BOTH the FROM and the TO attributes !");
+            }
+
+            // processing the FROM type
+            Attribute fromFirstAtt = null;
+            Attribute fromSecondAtt = null;
+            Attribute fromThirdAtt = null;
+
+            int fromType = 0;
+            String fromFirstValue = "";
+            String fromSecondValue = "";
+            String fromThirdValue = "";
+            /*
+                <from variable="ncname" part="ncname"? query="queryString"?/>
+            */
+            log.debug("<copy>");
+            fromFirstAtt = fromElement.attribute("variable");
+            fromSecondAtt = fromElement.attribute("part");
+            fromThirdAtt = fromElement.attribute("query");
+            if ((fromFirstAtt != null && fromElement.attributeCount() == 1)
+                    || (fromSecondAtt != null || fromThirdAtt != null)) {
+                fromType = Assignment.VARIABLE_PART;
+                fromFirstValue = fromFirstAtt != null ? fromFirstAtt.getValue() : "";
+                fromSecondValue = fromSecondAtt != null ? fromSecondAtt.getValue() : "";
+                fromThirdValue = fromThirdAtt != null ? fromThirdAtt.getValue() : "";
+                log.debug("     <from" +
+                        (fromFirstAtt != null ? " variable=" + fromFirstValue : "") +
+                        (fromSecondAtt != null ? " part=" + fromSecondValue : "") +
+                        (fromThirdAtt != null ? " query=" + fromThirdValue : "") +
+                        "/>");
+            } else
+            /*
+                <from expression="general-expr"/>
+            */ if ((fromFirstAtt = fromElement.attribute("expression")) != null) {
+                fromType = Assignment.EXPRESSION;
+                fromFirstValue = fromFirstAtt.getValue();
+                log.debug("     <from" +
+                        (fromFirstAtt != null ? " expression=" + fromFirstValue : "") +
+                        "/>");
+            } else
+            /* 
+                <from partnerLink="ncname" endpointReference="myRole|partnerRole"/>
+            */ if ((fromFirstAtt = fromElement.attribute("partnerLink")) != null &&
+                    (fromSecondAtt = fromElement.attribute("endpointReference")) != null) {
+                fromType = Assignment.PARTNER_REFERENCE;
+                fromFirstValue = fromFirstAtt.getValue();
+                fromSecondValue = fromSecondAtt.getValue();
+                log.debug("     <from" +
+                        (fromFirstAtt != null ? " partnerLink=" + fromFirstValue : "") +
+                        (fromSecondAtt != null ? " endpointReference=" + fromSecondValue : "") +
+                        "/>");
+            } else
+            /*
+                <from variable="ncname" property="qname"/>
+            */ if ((fromFirstAtt = fromElement.attribute("variable")) != null &&
+                    (fromSecondAtt = fromElement.attribute("property")) != null) {
+                fromType = Assignment.VARIABLE_PROPERTY;
+                fromFirstValue = fromFirstAtt != null ? fromFirstAtt.getValue() : "";
+                fromSecondValue = fromSecondAtt != null ? truncNamespace(fromSecondAtt.getValue()) : "";
+                log.debug("     <from" +
+                        (fromFirstAtt != null ? " variable=" + fromFirstValue : "") +
+                        (fromSecondAtt != null ? " property=" + fromSecondValue : "") +
+                        "/>");
+            } else
+            /*
+                <from> ... literal value ... </from>
+            */ if (fromElement.attributeCount() == 0) {
+                fromType = Assignment.LITERAL;
+                fromFirstValue = fromElement.getText();
+                log.debug("     <from>" + fromFirstValue + "</from>");
+            } else {
+                throw new DeploymentException("The FROM attribute is invalid !");
+            }
+
+            // processing the TO type
+            int toType = 0;
+            String toFirstValue = "";
+            String toSecondValue = "";
+            String toThirdValue = "";
+
+            Attribute toFirstAtt = null;
+            Attribute toSecondAtt = null;
+            Attribute toThirdAtt = null;
+
+            /*
+                <to variable="ncname" part="ncname"? query="queryString"?/>
+            */
+            toFirstAtt = toElement.attribute("variable");
+            toSecondAtt = toElement.attribute("part");
+            toThirdAtt = toElement.attribute("query");
+            if ((toFirstAtt != null && toElement.attributeCount() == 1)
+                    || (toSecondAtt != null || toThirdAtt != null)) {
+                toType = Assignment.VARIABLE_PART;
+                toFirstValue = toFirstAtt != null ? toFirstAtt.getValue() : "";
+                toSecondValue = toSecondAtt != null ? toSecondAtt.getValue() : "";
+                toThirdValue = toThirdAtt != null ? toThirdAtt.getValue() : "";
+                log.debug("     <to" +
+                        (toFirstAtt != null ? " variable=" + toFirstValue : "") +
+                        (toSecondAtt != null ? " part=" + toSecondValue : "") +
+                        (toThirdAtt != null ? " query=" + toThirdValue : "") +
+                        "/>");
+            } else
+            /*
+                <to partnerLink="ncname" endpointReference="myRole|partnerRole"/>
+            */ if ((toFirstAtt = toElement.attribute("partnerLink")) != null &&
+                    (toSecondAtt = toElement.attribute("endpointReference")) != null) {
+                toType = Assignment.PARTNER_REFERENCE;
+                toFirstValue = toFirstAtt.getValue();
+                toSecondValue = toSecondAtt.getValue();
+                log.debug("     <to" +
+                        (toFirstAtt != null ? " partnerLink=" + toFirstValue : "") +
+                        (toSecondAtt != null ? " endpointReference=" + toSecondValue : "") +
+                        "/>");
+            } else
+            /*
+                <to variable="ncname" property="qname"/>
+            */ if ((toFirstAtt = toElement.attribute("variable")) != null &&
+                    (toSecondAtt = toElement.attribute("property")) != null) {
+                toType = Assignment.VARIABLE_PROPERTY;
+                toFirstValue = toFirstAtt != null ? toFirstAtt.getValue() : "";
+                toSecondValue = toSecondAtt != null ? truncNamespace(toSecondAtt.getValue()): "";
+                log.debug("     <to" +
+                        (toFirstAtt != null ? " variable=" + toFirstValue : "") +
+                        (toSecondAtt != null ? " property=" + toSecondValue : "") +
+                        "/>");
+            } else {
+                throw new DeploymentException("The TO attribute is invalid !");
+            }
+
+            Assignment assignment = null;
+            try {
+                assignment = ActivityFactory.addAssignment((Assign) activity, fromType, toType);
+            } catch (DBSessionException e) {
+                throw new DeploymentException(e);
+            }
+
+            assignment.setFromFirstValue(fromFirstValue);
+            assignment.setFromSecondValue(fromSecondValue);
+            assignment.setFromQuery(fromThirdValue);
+            assignment.setToFirstValue(toFirstValue);
+            assignment.setToSecondValue(toSecondValue);
+            assignment.setToQuery(toThirdValue);
+            log.debug("</copy>");
+        }
+    }
+
+}
+    
\ No newline at end of file

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/EmptyDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/EmptyDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/EmptyDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/EmptyDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import org.dom4j.Element;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.Empty;
+
+public class EmptyDeployer extends ActivityDeployer {
+
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Elements
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Attributes
+    }
+
+    protected Class getActivityClass() {
+        return Empty.class;
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/FlowDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/FlowDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/FlowDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/FlowDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import org.dom4j.Element;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.Flow;
+
+public class FlowDeployer extends ActivityDeployer {
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Elements
+        // activities are procced in the AbstractDeployer
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Attributes
+    }
+
+    protected Class getActivityClass() {
+        return Flow.class;
+    }
+
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/InvokeDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/InvokeDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/InvokeDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/InvokeDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import java.util.Iterator;
+
+import org.dom4j.Attribute;
+import org.dom4j.Element;
+import org.dom4j.Namespace;
+import org.apache.agila.bpel.common.util.StringUtil;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.common.persistence.DBSessionException;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.ActivityFactory;
+import org.apache.agila.bpel.engine.priv.core.definition.CorrelationRef;
+import org.apache.agila.bpel.engine.priv.core.definition.Invoke;
+
+public class InvokeDeployer extends ActivityDeployer {
+
+    protected Class getActivityClass() {
+        return Invoke.class;
+    }
+
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        Element correlationsElement = element.element("correlations");
+        try {
+            if (correlationsElement != null) {
+                processCorrelations(correlationsElement, (Invoke) activity, context);
+            }
+        } catch (DBSessionException e) {
+            throw new DeploymentException(e);
+        }
+
+        Iterator catchElements = element.elementIterator("catch");
+        processCatchs(catchElements, (Invoke) activity, context);
+
+        Element catchAll = element.element("catchAll");
+        processCatchAll(catchAll, (Invoke) activity, context);
+
+        Element compensationHandler = element.element("compensationHandler");
+        processCompensationHandler(compensationHandler, (Invoke) activity, context);
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        Invoke invoke = (Invoke) activity;
+        Attribute partnerLink = element.attribute("partnerLink");
+        if (partnerLink != null) {
+            log.debug("partnerLink=" + partnerLink);
+            invoke.setPartner(partnerLink.getValue());
+        }
+
+        Attribute portType = element.attribute("portType");
+        if (portType != null) {
+        	String strNS = null;
+            String portTypeStr = portType.getValue();
+            int sepIndex = portTypeStr.indexOf(AgilaDeployerImpl.NS_SEPARATOR);
+            if (sepIndex > 0) {
+            	strNS = portTypeStr.substring(0,sepIndex);
+                portTypeStr = portTypeStr.substring(sepIndex + 1, portTypeStr.length());
+
+                Namespace foundNS = findNS(element,strNS); //strNS acts first as prefix
+                if(foundNS == null)
+                        throw new DeploymentException("Could not find Namespace for prefix " +  strNS);
+                strNS = foundNS.getURI();
+            }
+            else
+            {
+                Namespace foundNS = findTargetNS(element); //strNS acts first as prefix
+                if(foundNS == null)
+                        throw new DeploymentException("Could not find targetNamespace or default Namespace xmlns for prefix ");
+                strNS = foundNS.getURI();
+            }
+            
+            
+            log.debug("portType={" + strNS + "}" + portTypeStr);
+            invoke.setPortType(portTypeStr);
+            invoke.setNamespace(strNS);
+        }
+
+        Attribute operation = element.attribute("operation");
+        if (operation != null) {
+            log.debug("operation=" + operation);
+            invoke.setOperation(operation.getValue());
+        }
+
+        Attribute inputVariable = element.attribute("inputVariable");
+        if (inputVariable != null) {
+            log.debug("inputVariable=" + inputVariable);
+            invoke.setInputVariable(inputVariable.getValue());
+        }
+
+        Attribute outputVariable = element.attribute("outputVariable");
+        if (outputVariable != null) {
+            log.debug("outputVariable=" + outputVariable);
+            invoke.setOutputVariable(outputVariable.getValue());
+        }
+    }
+
+    /**
+     * looks for namespaces according to prefixes, it search recursively to the root element
+     * @param childElement element, from which we are looking for namespace
+     * @param prefix prefix, for which we want to find defined namespace
+     * @return namespace defined for prefix or null
+     */
+    
+    private Namespace findNS(Element childElement,String prefix)
+    {
+        Namespace retNS = childElement.getNamespaceForPrefix(prefix); 
+        if(retNS==null  && !childElement.isRootElement())
+        {
+            //Element parent = childElement.getParent();
+            retNS = findNS(childElement.getParent(),prefix);
+        }
+        return retNS;
+    }
+    
+    /**
+     * tries to find targetNamespace for element, or xmlns of root element, if no targetNamespace was found
+     * 
+     * @param childElement element, from which we are looking for namespace
+     * @return targetNamespace or xmlns or null
+     */
+    
+    private static Namespace findTargetNS(Element childElement)
+    {
+        String strNS = childElement.valueOf("@targetNamespace");
+        Namespace retNS; 
+        if(strNS.equals(""))
+        {
+            if(childElement.isRootElement())
+            {
+                retNS = childElement.getNamespace();
+            }
+            else
+            {
+                retNS = findTargetNS(childElement.getParent());
+            }
+        }
+        else
+            retNS = new Namespace("",strNS);
+        return retNS;
+    }
+    
+
+    private void processCorrelations(Element correlationsElement, Invoke invoke, 
+            DeployerContext context) throws DBSessionException {
+        
+        log.debug(correlationsElement);
+        Iterator correlations = correlationsElement.elementIterator("correlation");
+        while (correlations.hasNext()) {
+            Element correlation = (Element) correlations.next();
+            Attribute setAtt = correlation.attribute("set");
+            Attribute initiateAtt = correlation.attribute("initiate");
+            Attribute patternAtt = correlation.attribute("pattern");
+            String set = setAtt != null ? setAtt.getValue() : "";
+            boolean initiate = initiateAtt != null ? StringUtil.booleanValue(initiateAtt.getValue()) : false;
+            int pattern = patternAtt != null ? getCorrelationPattern(patternAtt.getValue()) : CorrelationRef.NONE;
+            CorrelationRef correlationRef = ActivityFactory.addCorrelationRef(invoke, set, initiate, pattern);
+            log.debug(correlationRef);
+        }
+    }
+
+    private void processCatchs(Iterator catchElements, Invoke invoke, DeployerContext context) {
+        while (catchElements.hasNext()) {
+            Element element = (Element) catchElements.next();
+            log.info("not yet managed element : " + element);
+        }
+    }
+
+    private void processCatchAll(Element catchAllElement, Invoke invoke, DeployerContext context) {
+        log.info("not yet managed element : " + catchAllElement);
+    }
+
+    private void processCompensationHandler(Element compensationHandlerElement, Invoke invoke, 
+            DeployerContext context) {
+        log.info("not yet managed element : " + compensationHandlerElement);
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/PickDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/PickDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/PickDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/PickDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.dom4j.Attribute;
+import org.dom4j.Element;
+import org.apache.agila.bpel.common.util.StringUtil;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.common.persistence.DBSessionException;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.ActivityFactory;
+import org.apache.agila.bpel.engine.priv.core.definition.AlarmEvent;
+import org.apache.agila.bpel.engine.priv.core.definition.CorrelationRef;
+import org.apache.agila.bpel.engine.priv.core.definition.Pick;
+
+public class PickDeployer extends ActivityDeployer {
+
+    protected void processSpecificElements(final Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        Pick pick = (Pick) activity;
+        for (Iterator i = element.elementIterator("onMessage"); i.hasNext();) {
+            Element onMessageElt = (Element) i.next();
+            String partnerLink = onMessageElt.valueOf("@partnerLink");
+            String portType = onMessageElt.valueOf("@portType");
+            String operation = onMessageElt.valueOf("@operation");
+            String namespace = onMessageElt.valueOf("@namespace");
+            String variable = onMessageElt.valueOf("@variable");
+            Element correlationsElt = onMessageElt.element("correlations");
+            Set correlationList = getCorrelationRefList(correlationsElt);
+            Element activityElement = getActivityElement(onMessageElt);
+            ActivityDeployer ad = ActivityDeployerFactory.getActivityDeployer(activityElement.getName());
+            Activity act = ad.deploy(activityElement, pick, context);
+            try {
+                ActivityFactory.addMessageEvent(pick, act, partnerLink, namespace, portType, operation, variable, correlationList);
+            } catch (DBSessionException e) {
+                throw new DeploymentException(e);
+            }
+        }
+        for (Iterator i = element.elementIterator("onAlarm"); i.hasNext();) {
+            Element onAlarmElt = (Element) i.next();
+            String forDurationExpression = onAlarmElt.valueOf("@for");
+            String untilDeadlineExpression = onAlarmElt.valueOf("@until");
+            String timeExpression = null;
+            int expressionType = 0;
+            if (forDurationExpression != null) {
+                timeExpression = forDurationExpression;
+                expressionType = AlarmEvent.DURATION_EXPR;
+            } else if (untilDeadlineExpression != null) {
+                timeExpression = untilDeadlineExpression;
+                expressionType = AlarmEvent.DEADLINE_EXPR;
+            }
+            Element activityElement = getActivityElement(onAlarmElt);
+            ActivityDeployer ad = ActivityDeployerFactory.getActivityDeployer(activityElement.getName());
+            Activity act = ad.deploy(activityElement, pick, context);
+            try {
+                ActivityFactory.addAlarmEvent(pick, act, timeExpression, expressionType);
+            } catch (DBSessionException e) {
+                throw new DeploymentException(e);
+            }
+        }
+        processChildren = false;
+    }
+
+    private Set getCorrelationRefList(Element correlationsElt) throws DeploymentException {
+        Set correlationList = new HashSet();
+        if (correlationsElt != null) {
+            Iterator correlations = correlationsElt.elementIterator("correlation");
+            while (correlations.hasNext()) {
+                Element correlation = (Element) correlations.next();
+                Attribute setAtt = correlation.attribute("set");
+                Attribute initiateAtt = correlation.attribute("initiate");
+                String set = setAtt != null ? setAtt.getValue() : "";
+                boolean initiate = initiateAtt != null ? StringUtil.booleanValue(initiateAtt.getValue()) : false;
+                CorrelationRef correlationRef = null;
+                try {
+                    correlationRef = ActivityFactory.createCorrelationRef(set, initiate, CorrelationRef.IN);
+                } catch (DBSessionException e) {
+                    throw new DeploymentException(e);
+                }
+                correlationList.add(correlationRef);
+            }
+        }
+        return correlationList;
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        Pick pick = (Pick) activity;
+        Attribute createInstance = element.attribute("createInstance");
+        if (createInstance != null) {
+            log.debug("createInstance=" + createInstance.getValue());
+            pick.setCreateInstance(StringUtil.booleanValue(createInstance.getValue()));
+        }
+    }
+
+    protected Class getActivityClass() {
+        return Pick.class;
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ReceiveDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ReceiveDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ReceiveDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ReceiveDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import java.util.Iterator;
+
+import org.dom4j.Attribute;
+import org.dom4j.Element;
+import org.apache.agila.bpel.common.util.StringUtil;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.common.persistence.DBSessionException;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.ActivityFactory;
+import org.apache.agila.bpel.engine.priv.core.definition.CorrelationRef;
+import org.apache.agila.bpel.engine.priv.core.definition.Receive;
+import org.dom4j.Namespace;
+
+public class ReceiveDeployer extends ActivityDeployer {
+
+    protected Class getActivityClass() {
+        return Receive.class;
+    }
+
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        Element correlationsElement = element.element("correlations");
+        try {
+            if (correlationsElement != null) {
+                processCorrelations(correlationsElement, (Receive) activity, context);
+            }
+        } catch (DBSessionException e) {
+            throw new DeploymentException(e);
+        }
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        Receive receive = (Receive) activity;
+        Attribute partnerLink = element.attribute("partnerLink");
+        if (partnerLink != null) {
+            log.debug("partnerLink=" + partnerLink.getValue());
+            receive.setPartner(partnerLink.getValue());
+        }
+
+        /*Attribute portType = element.attribute("portType");
+        if (portType != null) {
+            String portTypeStr = portType.getValue();
+            int sepIndex = portTypeStr.indexOf(AgilaDeployerImpl.NS_SEPARATOR);
+            if (sepIndex > 0) {
+                portTypeStr = portTypeStr.substring(sepIndex + 1, portTypeStr.length());
+            }
+            log.debug("portType=" + portTypeStr);
+            receive.setPortType(portTypeStr);
+        }*/
+        Attribute portType = element.attribute("portType");
+        if (portType != null) {
+            String strNS = null;
+            String portTypeStr = portType.getValue();
+            int sepIndex = portTypeStr.indexOf(AgilaDeployerImpl.NS_SEPARATOR);
+            if (sepIndex > 0) {
+                strNS = portTypeStr.substring(0,sepIndex);
+                portTypeStr = portTypeStr.substring(sepIndex + 1, portTypeStr.length());
+                Namespace foundNS = findNS(element,strNS); //strNS acts first as prefix
+                if(foundNS == null)
+                        throw new DeploymentException("Could not find Namespace for prefix " +  strNS);
+                strNS = foundNS.getURI();
+            }
+            else
+            {
+                Namespace foundNS = findTargetNS(element); //strNS acts first as prefix
+                if(foundNS == null)
+                        throw new DeploymentException("Could not find targetNamespace or default Namespace xmlns for prefix ");
+                strNS = foundNS.getURI();
+            }
+            
+            
+            log.debug("portType={" + strNS + "}" + portTypeStr);
+            receive.setPortType(portTypeStr);
+            receive.setNamespace(strNS);
+        }
+        
+
+        Attribute operation = element.attribute("operation");
+        if (operation != null) {
+            log.debug("operation=" + operation.getValue());
+            receive.setOperation(operation.getValue());
+        }
+
+        Attribute variable = element.attribute("variable");
+        if (variable != null) {
+            log.debug("variable=" + variable.getValue());
+            receive.setVariable(variable.getValue());
+        }
+
+        Attribute createInstance = element.attribute("createInstance");
+        if (createInstance != null) {
+            boolean bool = StringUtil.booleanValue(createInstance.getValue());
+            log.debug("createInstance=" + bool);
+            receive.setCreateInstance(bool);
+        }
+        context.addActivityEvent(activity, element, DeployerContext.RECEIVE_DEPLOYED_EVENT);
+    }
+
+    /**
+     * looks for namespaces according to prefixes, it search recursively to the root element
+     * @param childElement element, from which we are looking for namespace
+     * @param prefix prefix, for which we want to find defined namespace
+     * @return namespace defined for prefix or null
+     */
+    
+    private Namespace findNS(Element childElement,String prefix)
+    {
+        Namespace retNS = childElement.getNamespaceForPrefix(prefix); 
+        if(retNS==null  && !childElement.isRootElement())
+        {
+            //Element parent = childElement.getParent();
+            retNS = findNS(childElement.getParent(),prefix);
+        }
+        return retNS;
+    }
+    
+    /**
+     * tries to find targetNamespace for element, or xmlns of root element, if no targetNamespace was found
+     * 
+     * @param childElement element, from which we are looking for namespace
+     * @return targetNamespace or xmlns or null
+     */
+    
+    private static Namespace findTargetNS(Element childElement)
+    {
+        String strNS = childElement.valueOf("@targetNamespace");
+        Namespace retNS; 
+        if(strNS.equals(""))
+        {
+            if(childElement.isRootElement())
+            {
+                retNS = childElement.getNamespace();
+            }
+            else
+            {
+                retNS = findTargetNS(childElement.getParent());
+            }
+        }
+        else
+            retNS = new Namespace("",strNS);
+        return retNS;
+    }
+ 
+    
+
+    private void processCorrelations(Element correlationsElement, Receive receive, 
+            DeployerContext context) throws DBSessionException {
+        
+//        log.debug(correlationsElement);
+        Iterator correlations = correlationsElement.elementIterator("correlation");
+        while (correlations.hasNext()) {
+            Element correlation = (Element) correlations.next();
+            Attribute setAtt = correlation.attribute("set");
+            Attribute initiateAtt = correlation.attribute("initiate");
+            Attribute patternAtt = correlation.attribute("pattern");
+            String set = setAtt != null ? setAtt.getValue() : "";
+            boolean initiate = initiateAtt != null ? StringUtil.booleanValue(initiateAtt.getValue()) : false;
+            int pattern = patternAtt != null ? getCorrelationPattern(patternAtt.getValue()) : CorrelationRef.NONE;
+            CorrelationRef correlationRef = ActivityFactory.addCorrelationRef(receive, set, initiate, pattern);
+            log.debug(correlationRef);
+        }
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ReplyDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ReplyDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ReplyDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ReplyDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import java.util.Iterator;
+
+import org.dom4j.Attribute;
+import org.dom4j.Element;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.ActivityEvent;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.common.persistence.DBSessionException;
+import org.apache.agila.bpel.engine.exception.InvalidReplyException;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.CorrelationRef;
+import org.apache.agila.bpel.engine.priv.core.definition.Receive;
+import org.apache.agila.bpel.engine.priv.core.definition.Reply;
+import org.dom4j.Namespace;
+
+/**
+ * <reply partnerLink="ncname" portType="qname" operation="ncname"
+ * variable="ncname"? faultName="qname"?
+ * standard-attributes>
+ * standard-elements
+ * <correlations>?
+ * <correlation set="ncname" initiate="yes|no"?>+
+ * </correlations>
+ * </reply>
+ */
+
+public class ReplyDeployer extends ActivityDeployer {
+
+    protected Class getActivityClass() {
+        return Reply.class;
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        Reply reply = (Reply) activity;
+        Attribute partnerLink = element.attribute("partnerLink");
+        if (partnerLink != null) {
+            log.debug("partnerLink=" + partnerLink);
+            reply.setPartner(partnerLink.getValue());
+        }
+
+        /*Attribute portType = element.attribute("portType");
+        if (portType != null) {
+            String portTypeStr = portType.getValue();
+            int sepIndex = portTypeStr.indexOf(AgilaDeployerImpl.NS_SEPARATOR);
+            if (sepIndex > 0) {
+                portTypeStr = portTypeStr.substring(sepIndex + 1, portTypeStr.length());
+            }
+            log.debug("portType=" + portTypeStr);
+            reply.setPortType(portTypeStr);
+        }*/
+        Attribute portType = element.attribute("portType");
+        if (portType != null) {
+            String strNS = null;
+            String portTypeStr = portType.getValue();
+            int sepIndex = portTypeStr.indexOf(AgilaDeployerImpl.NS_SEPARATOR);
+            if (sepIndex > 0) {
+                strNS = portTypeStr.substring(0,sepIndex);
+                portTypeStr = portTypeStr.substring(sepIndex + 1, portTypeStr.length());
+                
+                Namespace foundNS = findNS(element,strNS); //strNS acts first as prefix
+                if(foundNS == null)
+                        throw new DeploymentException("Could not find Namespace for prefix " +  strNS);
+                strNS = foundNS.getURI();
+            }
+            else
+            {
+                Namespace foundNS = findTargetNS(element); //strNS acts first as prefix
+                if(foundNS == null)
+                        throw new DeploymentException("Could not find targetNamespace or default Namespace xmlns for prefix ");
+                strNS = foundNS.getURI();
+            }
+            
+            
+            log.debug("portType={" + strNS + "}" + portTypeStr);
+            reply.setPortType(portTypeStr);
+            reply.setNamespace(strNS);
+        }
+        
+        
+
+        Attribute operation = element.attribute("operation");
+        if (operation != null) {
+            log.debug("operation=" + operation);
+            reply.setOperation(operation.getValue());
+        }
+
+        Attribute variable = element.attribute("variable");
+        if (variable != null) {
+            log.debug("variable=" + variable);
+            reply.setVariable(variable.getValue());
+        }
+
+        Attribute faultName = element.attribute("faultName");
+        if (faultName != null) {
+            log.debug("faultName=" + faultName);
+            reply.setFaultName(faultName.getValue());
+        }
+        
+        ActivityEvent event = context.getReceiveDeployedEvent(reply.getPartner(), 
+                reply.getNamespace(),reply.getPortType(), reply.getOperation());
+        if (event != null) {
+            event.markProcessed();
+            ((Receive)event.getActivity()).setReply(true);
+        } else {
+            throw new InvalidReplyException("No Receive for this Reply !");
+        }
+
+    }
+    
+    
+    /**
+     * looks for namespaces according to prefixes, it search recursively to the root element
+     * @param childElement element, from which we are looking for namespace
+     * @param prefix prefix, for which we want to find defined namespace
+     * @return namespace defined for prefix or null
+     */
+    
+    private Namespace findNS(Element childElement,String prefix)
+    {
+        Namespace retNS = childElement.getNamespaceForPrefix(prefix); 
+        if(retNS==null  && !childElement.isRootElement())
+        {
+            //Element parent = childElement.getParent();
+            retNS = findNS(childElement.getParent(),prefix);
+        }
+        return retNS;
+    }
+    
+    /**
+     * tries to find targetNamespace for element, or xmlns of root element, if no targetNamespace was found
+     * 
+     * @param childElement element, from which we are looking for namespace
+     * @return targetNamespace or xmlns or null
+     */
+    
+    private static Namespace findTargetNS(Element childElement)
+    {
+        String strNS = childElement.valueOf("@targetNamespace");
+        Namespace retNS; 
+        if(strNS.equals(""))
+        {
+            if(childElement.isRootElement())
+            {
+                retNS = childElement.getNamespace();
+            }
+            else
+            {
+                retNS = findTargetNS(childElement.getParent());
+            }
+        }
+        else
+            retNS = new Namespace("",strNS);
+        return retNS;
+    }
+
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        Element correlationsElement = element.element("correlations");
+        try {
+            if (correlationsElement != null) {
+                processCorrelations(correlationsElement, (Reply) activity, context);
+            }
+        } catch (DBSessionException e) {
+            throw new DeploymentException(e);
+        }
+    }
+
+    private void processCorrelations(Element correlationsElement, Reply reply, 
+            DeployerContext context) throws DBSessionException {
+        log.debug(correlationsElement);
+        Iterator correlations = correlationsElement.elementIterator("correlation");
+        while (correlations.hasNext()) {
+            Element correlation = (Element) correlations.next();
+            Attribute setAtt = correlation.attribute("set");
+            String set = setAtt != null ? setAtt.getValue() : "";
+            Attribute initiateAtt = correlation.attribute("initiate");
+            boolean initiate = initiateAtt != null ? (initiateAtt.getValue().equals("yes") ? true : false) : false;
+            Attribute patternAtt = correlation.attribute("pattern");
+            int pattern = patternAtt != null ? getCorrelationPattern(patternAtt.getValue()) : CorrelationRef.NONE;
+            // todo
+//            CorrelationRef correlationRef = ActivityFactory.addCorrelationRef(receive, set, initiate, pattern);
+//            log.debug(correlationRef);
+        }
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ScopeDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ScopeDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ScopeDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/ScopeDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import org.dom4j.Element;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.Scope;
+
+public class ScopeDeployer extends ActivityDeployer {
+
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        log.info("Not Yet Implemented");
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        log.info("Not Yet Implemented");
+    }
+
+    protected Class getActivityClass() {
+        return Scope.class;
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/SequenceDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/SequenceDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/SequenceDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/SequenceDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import org.dom4j.Element;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.Sequence;
+
+public class SequenceDeployer extends ActivityDeployer {
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Elements
+        // activities are procced in the AbstractDeployer
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Attributes
+    }
+
+    protected Class getActivityClass() {
+        return Sequence.class;
+    }
+
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/SwitchDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/SwitchDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/SwitchDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/SwitchDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import java.util.Iterator;
+
+import org.dom4j.Element;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.Switch;
+
+public class SwitchDeployer extends ActivityDeployer {
+
+
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        Switch aSwitch = (Switch) activity;
+        for (Iterator i = element.elementIterator("case"); i.hasNext();) {
+            Element caseElement = (Element) i.next();
+            String s = caseElement.valueOf("@condition");
+            log.debug("<case " +s +">");
+            Element activityElement = getActivityElement(caseElement);
+            log.debug("<" + activityElement.getName() + ">");
+            ActivityDeployer ad = ActivityDeployerFactory.getActivityDeployer(activityElement.getName());
+            aSwitch.addCondition(s, ad.deploy(activityElement, aSwitch, context));
+            log.debug("</" + activityElement.getName() + ">");
+            log.debug("</case>");
+        }
+        log.debug("<otherwise>");
+        Element otherwiseElement = element.element("otherwise");
+        Element activityElement = getActivityElement(otherwiseElement);
+        log.debug("<" + activityElement.getName() + ">");
+        ActivityDeployer ad = ActivityDeployerFactory.getActivityDeployer(activityElement.getName());
+        aSwitch.setOtherwise(ad.deploy(activityElement, aSwitch, context));
+        log.debug("</" + activityElement.getName() + ">");
+        log.debug("</otherwise>");
+        processChildren = false;
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+
+    }
+
+    protected Class getActivityClass() {
+        return Switch.class;
+    }
+
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/TerminateDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/TerminateDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/TerminateDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/TerminateDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import org.dom4j.Element;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.Terminate;
+
+public class TerminateDeployer extends ActivityDeployer {
+
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Elements
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Attributes
+    }
+
+    protected Class getActivityClass() {
+        return Terminate.class;
+    }
+}

Added: incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/WaitDeployer.java
URL: http://svn.apache.org/viewcvs/incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/WaitDeployer.java?rev=165042&view=auto
==============================================================================
--- incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/WaitDeployer.java (added)
+++ incubator/agila/trunk/modules/bpel/engine/deployer/src/java/org/apache/agila/bpel/deployer/priv/WaitDeployer.java Wed Apr 27 13:27:43 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2004 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.agila.bpel.deployer.priv;
+
+import org.dom4j.Element;
+import org.apache.agila.bpel.deployer.exception.DeploymentException;
+import org.apache.agila.bpel.deployer.priv.context.DeployerContext;
+import org.apache.agila.bpel.engine.priv.core.definition.Activity;
+import org.apache.agila.bpel.engine.priv.core.definition.Wait;
+
+/**
+ * <wait (for="duration-expr" | until="deadline-expr") standard-attributes>
+ * standard-elements
+ * </wait>
+ */
+public class WaitDeployer extends ActivityDeployer {
+
+    protected void processSpecificElements(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        // No Specific Elements
+    }
+
+    protected void processSpecificAttributes(Element element, Activity activity, 
+            DeployerContext context) throws DeploymentException {
+        
+        String forDurationExpression = element.valueOf("@for");
+        String untilDeadlineExpression = element.valueOf("@until");
+        Wait wait = (Wait) activity;
+        if (forDurationExpression != null) {
+            wait.setDuration(true);
+            wait.setTime(forDurationExpression);
+        } else if (untilDeadlineExpression != null) {
+            wait.setDuration(false);
+            wait.setTime(untilDeadlineExpression);
+        }
+    }
+
+    protected Class getActivityClass() {
+        return Wait.class;
+    }
+}