Author: mszefler
Date: Tue Oct 30 19:40:51 2007
New Revision: 590543

URL: http://svn.apache.org/viewvc?rev=590543&view=rev
Log:
experimental: external variables

Added:
    ode/branches/extvar/bpel-api/src/main/java/org/apche/
    ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/
    ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/
    ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/
    
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModule.java
   (with props)
    
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModuleException.java
   (with props)

Added: 
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModule.java
URL: 
http://svn.apache.org/viewvc/ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModule.java?rev=590543&view=auto
==============================================================================
--- 
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModule.java
 (added)
+++ 
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModule.java
 Tue Oct 30 19:40:51 2007
@@ -0,0 +1,142 @@
+package org.apche.ode.bpel.evar;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Representation of an external source for variable data.
+ * 
+ * @author Maciej Szefler <mszefler at gmail dot com>
+ *
+ */
+public interface ExternalVariableModule {
+
+    /**
+     * Get the QName of this external variable engine; this method must always 
return a valid non-null value. 
+     * The name of the external variable engine is used to identify it in the 
external variable declaration.
+     * @return
+     */
+    public QName getName();
+
+    
+    /** 
+     * Start the external variable subsystem. This method is called before the 
engine is started. 
+     *
+     */
+    public void start();
+    
+    /**
+     * Stop the external variable subsystem. This method is called right after 
the engine is stopped.
+     *
+     */
+    public void stop();
+    
+    /**
+     * Shutdown the external variable subsystem. This method is called right 
after the engine is shutdown. 
+     *
+     */
+    public void shutdown();
+    
+    
+    /**
+     * Report whether this engine is transactional, i.e. do the update/fetch 
methods use the JTA TX?  
+     * @return <code>true</code> if transactional, <code>false</code> 
otherwsie.
+     */
+    public boolean isTransactional();
+    
+ 
+    /**
+     * Configure an external variable. 
+     * @param pid process 
+     * @param extVarId external variable identifier
+     * @param config configuration element
+     * @throws ExternalVariableModuleException 
+     */
+    public void configure(QName pid, String extVarId, Element config) throws 
ExternalVariableModuleException;
+
+    
+    /**
+     * The the value of an external variable. 
+     * @param locator variable locator
+     * @param initialize indicates if this is the first time the value is 
being read
+     * @return value of the variable
+     */
+    public Value readValue(Locator locator) throws 
ExternalVariableModuleException;
+    
+    /**
+     * Update the value of the external variable.
+     * @param newval new variable value 
+     * @param initialize indicates if this is a variable initialization
+     */
+    public Value writeValue(Value newval) throws 
ExternalVariableModuleException;
+    
+    
+    /**
+     * Structure used to identify an external variable to the external 
variable subsystem.
+     * 
+     * @author Maciej Szefler <mszefler at gmail dot com>
+     *
+     */
+    public class Locator extends HashMap<String, String>{
+        
+        private static final long serialVersionUID = 1L;
+
+        public final String varId;
+        
+        /** Instance identifier. */
+        public final Long iid;
+        
+        /** Process identifier. */
+        public final QName pid;
+                
+        public Locator(String varId, QName pid, Long iid) {
+            this.varId = varId;
+            this.pid = pid;
+            this.iid = iid;
+        }
+
+        public Locator(String varId, QName pid, Long iid, Map<String,String> 
keys) {
+            this(varId,pid,iid);
+            putAll(keys);
+        }
+        
+    }
+
+    /**
+     * Data structure used to report the value of the variable to the BPEL 
engine from the external
+     * sub system.
+     * 
+     * @author Maciej Szefler <mszefler at gmail dot com>
+     *
+     */
+    public class Value {
+        /** Variable locator. See [EMAIL PROTECTED] Locator}. */
+        public final Locator locator; 
+        
+        /** Value of the variable. */
+        public final Node value;
+        
+        /** Advisory indicating when the variable becomes stale (or null if 
non-perishable). */
+        public final Date useByDate;
+        
+        public Value(Locator locator, Node value) {
+            this(locator,value, null);
+        }
+        
+        public Value(Locator locator, Node value, Date useByDate) {
+            this.locator = locator;
+            this.value = value;
+            this.useByDate = useByDate;
+        }
+    }
+
+
+    
+
+}

Propchange: 
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModuleException.java
URL: 
http://svn.apache.org/viewvc/ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModuleException.java?rev=590543&view=auto
==============================================================================
--- 
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModuleException.java
 (added)
+++ 
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModuleException.java
 Tue Oct 30 19:40:51 2007
@@ -0,0 +1,20 @@
+package org.apche.ode.bpel.evar;
+
+/**
+ * Exception thrown by external variable engines.
+ *  
+ * @author Maciej Szefler <mszefler at gmail dot com>
+ */
+public class ExternalVariableModuleException extends Exception {
+
+    private static final long serialVersionUID = 1L;
+
+    
+    public ExternalVariableModuleException(String msg, Throwable cause) {
+        super(msg, cause);
+    }
+    
+    public ExternalVariableModuleException(String msg) {
+        super(msg);
+    }
+}

Propchange: 
ode/branches/extvar/bpel-api/src/main/java/org/apche/ode/bpel/evar/ExternalVariableModuleException.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to