Author: mriou
Date: Tue Sep 26 11:57:05 2006
New Revision: 450146

URL: http://svn.apache.org/viewvc?view=rev&rev=450146
Log:
A process is active by default.

Modified:
    
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessDDInitializer.java

Modified: 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessDDInitializer.java
URL: 
http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessDDInitializer.java?view=diff&rev=450146&r1=450145&r2=450146
==============================================================================
--- 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessDDInitializer.java
 (original)
+++ 
incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessDDInitializer.java
 Tue Sep 26 11:57:05 2006
@@ -39,87 +39,87 @@
  */
 class ProcessDDInitializer {
 
-  private static final Messages __msgs = MessageBundle
-      .getMessages(Messages.class);
+    private static final Messages __msgs = MessageBundle
+            .getMessages(Messages.class);
 
-  private static final Log __log = 
LogFactory.getLog(ProcessDDInitializer.class);
+    private static final Log __log = 
LogFactory.getLog(ProcessDDInitializer.class);
 
-  private OProcess _oprocess;
-  private TDeployment.Process _dd;
+    private OProcess _oprocess;
+    private TDeployment.Process _dd;
 
-  public ProcessDDInitializer(OProcess oprocess, TDeployment.Process dd) {
-    _oprocess = oprocess;
-    _dd = dd;
-  }
-
-  public void update(ProcessDAO processDAO) {
-    handleEndpoints(processDAO);
-    handleProperties(processDAO);
-  }
-
-  private void handleEndpoints(ProcessDAO processDAO) {
-      for (TProvide provide : _dd.getProvideList()) {
-        OPartnerLink pLink = 
_oprocess.getPartnerLink(provide.getPartnerLink());
-        if (pLink == null) {
-          String msg = 
ProcessDDInitializer.__msgs.msgDDPartnerLinkNotFound(provide.getPartnerLink());
-          ProcessDDInitializer.__log.error(msg);
-          throw new BpelEngineException(msg);
-        }
-        if (!pLink.hasMyRole()) {
-          String msg = 
ProcessDDInitializer.__msgs.msgDDMyRoleNotFound(provide.getPartnerLink());
-          ProcessDDInitializer.__log.error(msg);
-          throw new BpelEngineException(msg);
-        }
-      }
-      for (TInvoke invoke : _dd.getInvokeList()) {
-        OPartnerLink pLink = _oprocess.getPartnerLink(invoke.getPartnerLink());
-        if (pLink == null) {
-          String msg = 
ProcessDDInitializer.__msgs.msgDDPartnerLinkNotFound(invoke.getPartnerLink());
-          ProcessDDInitializer.__log.error(msg);
-          throw new BpelEngineException(msg);
-        }
-        if (!pLink.hasPartnerRole()) {
-          String msg = 
ProcessDDInitializer.__msgs.msgDDPartnerRoleNotFound(invoke.getPartnerLink());
-          ProcessDDInitializer.__log.error(msg);
-          throw new BpelEngineException(msg);
-        }
-        // TODO Handle non initialize partner roles that just provide a binding
-        if (!pLink.initializePartnerRole && 
_oprocess.version.equals(Namespaces.WS_BPEL_20_NS)) {
-          String msg = 
ProcessDDInitializer.__msgs.msgDDNoInitiliazePartnerRole(invoke.getPartnerLink());
-          ProcessDDInitializer.__log.error(msg);
-          throw new BpelEngineException(msg);
+    public ProcessDDInitializer(OProcess oprocess, TDeployment.Process dd) {
+        _oprocess = oprocess;
+        _dd = dd;
+    }
+
+    public void update(ProcessDAO processDAO) {
+        handleEndpoints(processDAO);
+        handleProperties(processDAO);
+    }
+
+    private void handleEndpoints(ProcessDAO processDAO) {
+        for (TProvide provide : _dd.getProvideList()) {
+            OPartnerLink pLink = 
_oprocess.getPartnerLink(provide.getPartnerLink());
+            if (pLink == null) {
+                String msg = 
ProcessDDInitializer.__msgs.msgDDPartnerLinkNotFound(provide.getPartnerLink());
+                ProcessDDInitializer.__log.error(msg);
+                throw new BpelEngineException(msg);
+            }
+            if (!pLink.hasMyRole()) {
+                String msg = 
ProcessDDInitializer.__msgs.msgDDMyRoleNotFound(provide.getPartnerLink());
+                ProcessDDInitializer.__log.error(msg);
+                throw new BpelEngineException(msg);
+            }
+        }
+        for (TInvoke invoke : _dd.getInvokeList()) {
+            OPartnerLink pLink = 
_oprocess.getPartnerLink(invoke.getPartnerLink());
+            if (pLink == null) {
+                String msg = 
ProcessDDInitializer.__msgs.msgDDPartnerLinkNotFound(invoke.getPartnerLink());
+                ProcessDDInitializer.__log.error(msg);
+                throw new BpelEngineException(msg);
+            }
+            if (!pLink.hasPartnerRole()) {
+                String msg = 
ProcessDDInitializer.__msgs.msgDDPartnerRoleNotFound(invoke.getPartnerLink());
+                ProcessDDInitializer.__log.error(msg);
+                throw new BpelEngineException(msg);
+            }
+            // TODO Handle non initialize partner roles that just provide a 
binding
+            if (!pLink.initializePartnerRole && 
_oprocess.version.equals(Namespaces.WS_BPEL_20_NS)) {
+                String msg = 
ProcessDDInitializer.__msgs.msgDDNoInitiliazePartnerRole(invoke.getPartnerLink());
+                ProcessDDInitializer.__log.error(msg);
+                throw new BpelEngineException(msg);
+            }
         }
-      }
-  }
+    }
 
-  private void handleProperties(ProcessDAO processDAO) {
-    if (_dd.getPropertyList().size() > 0) {
-      for (TDeployment.Process.Property property : _dd.getPropertyList()) {
-        String textContent = DOMUtils.getTextContent(property.getDomNode());
-        if (textContent != null) {
-          processDAO.setProperty(property.getName().getLocalPart(), 
property.getName().getNamespaceURI(),
-              textContent);
-        } else {
-          Element elmtContent = DOMUtils.getElementContent(property
-              .getDomNode());
-          processDAO.setProperty(property.getName().getLocalPart(), 
property.getName().getNamespaceURI(),
-              elmtContent);
+    private void handleProperties(ProcessDAO processDAO) {
+        if (_dd.getPropertyList().size() > 0) {
+            for (TDeployment.Process.Property property : 
_dd.getPropertyList()) {
+                String textContent = 
DOMUtils.getTextContent(property.getDomNode());
+                if (textContent != null) {
+                    processDAO.setProperty(property.getName().getLocalPart(), 
property.getName().getNamespaceURI(),
+                            textContent);
+                } else {
+                    Element elmtContent = DOMUtils.getElementContent(property
+                            .getDomNode());
+                    processDAO.setProperty(property.getName().getLocalPart(), 
property.getName().getNamespaceURI(),
+                            elmtContent);
+                }
+            }
         }
-      }
     }
-  }
 
 
-  public boolean exists() {
-    return _dd != null;
-  }
+    public boolean exists() {
+        return _dd != null;
+    }
 
-  public void init(ProcessDAO newDao) {
-    newDao.setRetired(_dd.getRetired());
-    newDao.setActive(_dd.getActive());
-    for (String correlator : _oprocess.getCorrelators()) {
-      newDao.addCorrelator(correlator);
+    public void init(ProcessDAO newDao) {
+        newDao.setRetired(_dd.getRetired());
+        newDao.setActive(_dd.getActive() || !_dd.isSetActive());
+        for (String correlator : _oprocess.getCorrelators()) {
+            newDao.addCorrelator(correlator);
+        }
     }
-  }
 
 }


Reply via email to