You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by bo...@apache.org on 2007/05/18 20:39:37 UTC

svn commit: r539552 - in /incubator/ode/trunk: bpel-api/src/main/java/org/apache/ode/bpel/iapi/ bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ bpel-schemas/src/main/xsd/ bpel-store/src/main/java/org/apache/ode/store/

Author: boisvert
Date: Fri May 18 11:39:36 2007
New Revision: 539552

URL: http://svn.apache.org/viewvc?view=rev&rev=539552
Log:
Extend the PMAPI to provide the BPEL document path, useful for debugging and instrospection scenarios

Modified:
    incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
    incubator/ode/trunk/bpel-schemas/src/main/xsd/pmapi.xsd
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java

Modified: incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java?view=diff&rev=539552&r1=539551&r2=539552
==============================================================================
--- incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java (original)
+++ incubator/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java Fri May 18 11:39:36 2007
@@ -68,6 +68,12 @@
     InputStream getCBPInputStream();
    
     /**
+     * Get the path of the BPEL document, relative to its deployment unit 
+     * @return Relative path of BPEL document
+     */
+    String getBpelDocument();
+   
+    /**
      * Get the date of deployment.
      * @return
      */

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java?view=diff&rev=539552&r1=539551&r2=539552
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java (original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/ProcessAndInstanceManagementImpl.java Fri May 18 11:39:36 2007
@@ -146,12 +146,9 @@
 
     protected ProcessStore _store;
 
-    protected Calendar _calendar = Calendar.getInstance(); // Calendar can be
+    // Calendar can be expensive to initialize so we cache and clone it
+    protected Calendar _calendar = Calendar.getInstance(); 
 
-    // expensive to
-    // initialize so we
-    // cache and clone
-    // it
     protected BpelServerImpl _server;
 
     public ProcessAndInstanceManagementImpl(BpelServer server, ProcessStore store) {
@@ -717,6 +714,7 @@
 
         TDeploymentInfo depinfo = info.addNewDeploymentInfo();
         depinfo.setPackage(pconf.getPackage());
+        depinfo.setDocument(pconf.getBpelDocument());
         depinfo.setDeployDate(toCalendar(pconf.getDeployDate()));
         depinfo.setDeployer(pconf.getDeployer());
         if (custom.includeInstanceSummary()) {

Modified: incubator/ode/trunk/bpel-schemas/src/main/xsd/pmapi.xsd
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-schemas/src/main/xsd/pmapi.xsd?view=diff&rev=539552&r1=539551&r2=539552
==============================================================================
--- incubator/ode/trunk/bpel-schemas/src/main/xsd/pmapi.xsd (original)
+++ incubator/ode/trunk/bpel-schemas/src/main/xsd/pmapi.xsd Fri May 18 11:39:36 2007
@@ -228,6 +228,11 @@
                     <documentation>Deployment package the process was deployed into.</documentation>
                 </annotation>
             </element>
+            <element name="document" type="xs:string">
+              <annotation>
+                <documentation>File name of BPEL document.</documentation>
+              </annotation>
+            </element>
             <element name="deploy-date" type="xs:dateTime">
                 <annotation>
                     <documentation>Date the process was deployed.</documentation>

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java?view=diff&rev=539552&r1=539551&r2=539552
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Fri May 18 11:39:36 2007
@@ -18,9 +18,32 @@
  */
 package org.apache.ode.store;
 
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.dd.*;
+import org.apache.ode.bpel.dd.TDeployment;
+import org.apache.ode.bpel.dd.TInvoke;
+import org.apache.ode.bpel.dd.TMexInterceptor;
+import org.apache.ode.bpel.dd.TProcessEvents;
+import org.apache.ode.bpel.dd.TProvide;
+import org.apache.ode.bpel.dd.TScopeEvents;
+import org.apache.ode.bpel.dd.TService;
 import org.apache.ode.bpel.evt.BpelEvent;
 import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.iapi.Endpoint;
@@ -30,14 +53,6 @@
 import org.apache.ode.utils.msg.MessageBundle;
 import org.w3c.dom.Node;
 
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.*;
-
 /**
  * Implementation of the {@link org.apache.ode.bpel.iapi.ProcessConf} interface.
  * Provides configuration information for a process. Note that this class should
@@ -160,6 +175,22 @@
         }
     }
 
+    public String getBpelDocument() {
+        CBPInfo cbpInfo = _du.getCBPInfo(getType());
+        if (cbpInfo == null)
+            throw new ContextException("CBP record not found for type " + getType());
+        try {
+            String relative = getRelativePath(_du.getDeployDir(), cbpInfo.cbp);
+            if (!relative.endsWith(".cbp")) throw new ContextException("CBP file must end with .cbp suffix: " + cbpInfo.cbp);
+            relative = relative.replace(".cbp", ".bpel");
+            File bpelFile = new File(_du.getDeployDir(), relative);
+            if (!bpelFile.exists()) __log.warn("BPEL file does not exist: " + bpelFile);
+            return relative;
+        } catch (IOException e) {
+            throw new ContextException("IOException in getBpelRelativePath: " + cbpInfo.cbp, e);
+        }
+    }
+    
     public ProcessState getState() {
         return _state;
     }
@@ -291,4 +322,12 @@
         }
     }
 
+    private String getRelativePath(File base, File path) throws IOException {
+        String basePath = base.getCanonicalPath();
+        String cbpPath = path.getCanonicalPath();
+        if (!cbpPath.startsWith(basePath)) throw new IOException("Invalid relative path: base="+base+" path="+path);
+        String relative = cbpPath.substring(basePath.length());
+        if (relative.startsWith(File.separator)) relative = relative.substring(1);
+        return relative;
+    }
 }