ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r789315 - in /ode/trunk: bpel-api/src/main/java/org/apache/ode/bpel/iapi/ bpel-store/src/main/java/org/apache/ode/store/ dao-hibernate-db/src/main/sql/ dao-jpa-db/src/main/scripts/ engine/src/main/java/org/apache/ode/bpel/engine/ engine/src...
Date Mon, 29 Jun 2009 13:06:42 GMT
Author: rr
Date: Mon Jun 29 13:06:40 2009
New Revision: 789315

URL: http://svn.apache.org/viewvc?rev=789315&view=rev
Log:
ODE-626: Unpack details blob from ODE_JOB table

Added:
    ode/trunk/scheduler-simple/src/test/resources/log4j.properties   (with props)
    ode/trunk/scheduler-simple/src/test/resources/simplesched-hsql.sql   (with props)
Modified:
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
    ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java
    ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
    ode/trunk/dao-hibernate-db/src/main/sql/simplesched-derby.sql
    ode/trunk/dao-hibernate-db/src/main/sql/simplesched-firebird.sql
    ode/trunk/dao-hibernate-db/src/main/sql/simplesched-hsql.sql
    ode/trunk/dao-hibernate-db/src/main/sql/simplesched-mysql.sql
    ode/trunk/dao-hibernate-db/src/main/sql/simplesched-oracle.sql
    ode/trunk/dao-hibernate-db/src/main/sql/simplesched-postgres.sql
    ode/trunk/dao-hibernate-db/src/main/sql/simplesched-sqlserver.sql
    ode/trunk/dao-jpa-db/src/main/scripts/simplesched-derby.sql
    ode/trunk/dao-jpa-db/src/main/scripts/simplesched-mysql.sql
    ode/trunk/dao-jpa-db/src/main/scripts/simplesched-oracle.sql
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODERESTProcess.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessCleanUpRunnable.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ReliablePartnerRoleMessageExchangeImpl.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/WorkEvent.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/CronScheduler.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/RuntimeDataCleanupRunnable.java
    ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/SystemSchedulesConfig.java
    ode/trunk/il-common/src/main/java/org/apache/ode/il/MockScheduler.java
    ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java
    ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java
    ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
    ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/DelegateSupport.java
    ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/JdbcDelegateTest.java
    ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/RetriesTest.java
    ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/SimpleSchedulerTest.java

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessConf.java Mon Jun 29 13:06:40 2009
@@ -32,6 +32,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.ode.bpel.evt.BpelEvent;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
 import org.apache.ode.bpel.rapi.ProcessModel;
 import org.apache.ode.utils.CronExpression;
 import org.w3c.dom.Element;
@@ -190,7 +191,7 @@
     public class CronJob {
         private CronExpression _cronExpression;
         
-        private final List<Map<String,Object>> runnableDetailList = new ArrayList<Map<String,Object>>();
+        private final List<JobDetails> runnableDetailList = new ArrayList<JobDetails>();
         
         public void setCronExpression(CronExpression _cronExpression) {
             this._cronExpression = _cronExpression;
@@ -200,7 +201,7 @@
             return _cronExpression;
         }
         
-        public List<Map<String,Object>> getRunnableDetailList() {
+        public List<JobDetails> getRunnableDetailList() {
             return runnableDetailList;
         }
         
@@ -216,7 +217,7 @@
         }
     }
     
-    public class CleanupInfo {
+    public class CleanupInfo implements java.io.Serializable {
         private List<String> _filters = new ArrayList<String>();
         
         private final Set<CLEANUP_CATEGORY> _categories = EnumSet.noneOf(CLEANUP_CATEGORY.class);

Modified: ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java (original)
+++ ode/trunk/bpel-api/src/main/java/org/apache/ode/bpel/iapi/Scheduler.java Mon Jun 29 13:06:40 2009
@@ -24,6 +24,10 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.xml.namespace.QName;
+
+import org.apache.ode.bpel.common.CorrelationKey;
+
 /**
  * The BPEL scheduler.
  */
@@ -40,7 +44,7 @@
      * @param when when the job should run (<code>null</code> means now)
      * @return unique job identifier
      */
-    String schedulePersistedJob(Map<String,Object>jobDetail,Date when)
+    String schedulePersistedJob(JobDetails jobDetail,Date when)
             throws ContextException ;
 
     /**
@@ -75,6 +79,137 @@
         void onScheduledJob(JobInfo jobInfo) throws JobProcessorException;
     }
 
+    public enum JobType {
+        TIMER, 
+        
+        RESUME, 
+        
+        /** Response from partner (i.e. the result of a partner-role invoke) has been received. */
+        PARTNER_RESPONSE, 
+        
+        MATCHER, 
+        
+        /** Invoke a "my role" operation (i.e. implemented by the process). */
+        MYROLE_INVOKE, 
+        
+        MYROLE_INVOKE_ASYNC_RESPONSE,
+
+        INVOKE_CHECK
+    }
+    
+    public interface JobDetails {
+        public Long getInstanceId();
+        public void setInstanceId(Long iid);
+        public String getMexId();
+        public void setMexId(String mexId);
+        public QName getProcessId();
+        public void setProcessId(QName processId);
+        public JobType getType();
+        public void setType(JobType type);
+        public String getChannel();
+        public void setChannel(String channel);
+        public String getCorrelatorId();
+        public void setCorrelatorId(String correlatorId);
+        public CorrelationKey getCorrelationKey();
+        public void setCorrelationKey(CorrelationKey correlationKey);
+        public Integer getRetryCount();
+        public void setRetryCount(Integer retryCount);
+        public Boolean getInMem();
+        public void setInMem(Boolean inMem);
+        public Map<String, Object> getDetailsExt();
+        public void setDetailsExt(Map<String, Object> detailsExt);
+    }
+
+    public static class JobDetailsImpl implements Scheduler.JobDetails {
+        public Long instanceId;
+        public String mexId;
+        public String processId;
+        public String type;
+        public String channel;
+        public String correlatorId;
+        public String correlationKey;
+        public Integer retryCount;
+        public Boolean inMem;
+        public Map<String, Object> detailsExt = new HashMap<String, Object>();
+        
+        public Boolean getInMem() {
+            return inMem == null ? false : inMem;
+        }
+        public void setInMem(Boolean inMem) {
+            this.inMem = inMem;
+        }
+        public String getMexId() {
+            return mexId;
+        }
+        public void setMexId(String mexId) {
+            this.mexId = mexId;
+        }
+        public QName getProcessId() {
+            return processId == null ? null : QName.valueOf(processId);
+        }
+        public void setProcessId(QName processId) {
+            this.processId = "" + processId;
+        }
+        public JobType getType() {
+            return JobType.valueOf(type);
+        }
+        public void setType(JobType type) {
+            this.type = type.toString();
+        }
+        public String getChannel() {
+            return channel;
+        }
+        public void setChannel(String channel) {
+            this.channel = channel;
+        }
+        public String getCorrelatorId() {
+            return correlatorId;
+        }
+        public void setCorrelatorId(String correlatorId) {
+            this.correlatorId = correlatorId;
+        }
+        public CorrelationKey getCorrelationKey() {
+            return new CorrelationKey(correlationKey);
+        }
+        public void setCorrelationKey(CorrelationKey correlationKey) {
+            this.correlationKey = correlationKey == null ? null : correlationKey.toCanonicalString();
+        }
+        public Integer getRetryCount() {
+            return retryCount == null ? 0 : retryCount;
+        }
+        public void setRetryCount(Integer retryCount) {
+            this.retryCount = retryCount;
+        }
+        public Long getInstanceId() {
+            return instanceId;
+        }
+        public void setInstanceId(Long instanceId) {
+            this.instanceId = instanceId;
+        }
+        public Map<String, Object> getDetailsExt() {
+            return detailsExt;
+        }
+        public void setDetailsExt(Map<String, Object> detailsExt) {
+            this.detailsExt = detailsExt;
+        }
+        
+        @Override
+        public String toString() {
+            return "JobDetailsImpl("
+            + " instanceId: " + instanceId
+            + " mexId: " + mexId
+            + " processId: " + processId
+            + " type: " + type
+            + " channel: " + channel
+            + " correlatorId: " + correlatorId
+            + " correlationKey: " + correlationKey
+            + " retryCount: " + retryCount
+            + " inMem: " + inMem
+            + " detailsExt: " + detailsExt
+            + ")";
+        }
+    }
+    
     /**
      * Wrapper containing information about a scheduled job.
      * @author mszefler
@@ -83,17 +218,16 @@
         private static final long serialVersionUID = 1L;
         public final String jobName;
         public final int retryCount;
-        public final Map<String,Object> jobDetail;
+        public final JobDetails jobDetail;
 
-        public JobInfo(String jobName, Map<String,Object>jobDetail, int retryCount) {
+        public JobInfo(String jobName, JobDetails jobDetail, int retryCount) {
             this.jobName = jobName;
             this.jobDetail = jobDetail;
             this.retryCount = retryCount;
         }
 
         public String toString() {
-            // Wrap in hashmap in case the underlying object has no toString method.
-            return jobName + "["+retryCount +"]: " + new HashMap<Object, Object>(jobDetail);
+            return jobName + "["+retryCount +"]: " + jobDetail;
         }
     }
 
@@ -118,7 +252,7 @@
     }
 
     public interface MapSerializableRunnable extends Runnable, Serializable {
-        void storeToDetailsMap(Map<String, Object> details);
-        void restoreFromDetailsMap(Map<String, Object> details);
+        void storeToDetails(JobDetails details);
+        void restoreFromDetails(JobDetails details);
     }
 }

Modified: ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java (original)
+++ ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessConfImpl.java Mon Jun 29 13:06:40 2009
@@ -49,6 +49,8 @@
 import org.apache.ode.bpel.iapi.ProcessState;
 import org.apache.ode.bpel.iapi.EndpointReferenceContext;
 import org.apache.ode.bpel.iapi.EndpointReference;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetailsImpl;
 import org.apache.ode.bpel.rapi.ProcessModel;
 import org.apache.ode.store.DeploymentUnitDir.CBPInfo;
 import org.apache.ode.utils.CronExpression;
@@ -277,7 +279,7 @@
     }
     
     public boolean isSharedService(QName serviceName) {
-    	return _sharedServices.contains(serviceName);
+        return _sharedServices.contains(serviceName);
     }
 
     DeploymentUnitDir getDeploymentUnit() {
@@ -466,10 +468,10 @@
                     cleanupInfo.setFilters(aCleanup.getFilterList());
                     ProcessCleanupConfImpl.processACleanup(cleanupInfo.getCategories(), aCleanup.getCategoryList());
                     
-                    Map<String, Object> runnableDetails = new HashMap<String, Object>();
-                    runnableDetails.put("cleanupInfo", cleanupInfo);
-                    runnableDetails.put("pid", _pid);
-                    runnableDetails.put("transactionSize", 10);
+                    JobDetails runnableDetails = new JobDetailsImpl();
+                    runnableDetails.getDetailsExt().put("cleanupInfo", cleanupInfo);
+                    runnableDetails.getDetailsExt().put("pid", _pid);
+                    runnableDetails.getDetailsExt().put("transactionSize", 10);
                     job.getRunnableDetailList().add(runnableDetails);
                 }
                 jobs.add(job);

Modified: ode/trunk/dao-hibernate-db/src/main/sql/simplesched-derby.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate-db/src/main/sql/simplesched-derby.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-hibernate-db/src/main/sql/simplesched-derby.sql (original)
+++ ode/trunk/dao-hibernate-db/src/main/sql/simplesched-derby.sql Mon Jun 29 13:06:40 2009
@@ -10,7 +10,18 @@
   nodeid char(64),
   scheduled int  NOT NULL DEFAULT 0,
   transacted int  NOT NULL DEFAULT 0,
-  details blob(4096),
+
+  instanceId BIGINT,
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt blob(4096),
+
   PRIMARY KEY(jobid));
 
 CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);

Modified: ode/trunk/dao-hibernate-db/src/main/sql/simplesched-firebird.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate-db/src/main/sql/simplesched-firebird.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-hibernate-db/src/main/sql/simplesched-firebird.sql (original)
+++ ode/trunk/dao-hibernate-db/src/main/sql/simplesched-firebird.sql Mon Jun 29 13:06:40 2009
@@ -10,7 +10,18 @@
   nodeid char(64),
   scheduled int  NOT NULL DEFAULT 0,
   transacted int  NOT NULL DEFAULT 0,
-  details blob(4096),
+
+  instanceId BIGINT,
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt blob(4096),
+
   PRIMARY KEY(jobid));
 
 CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);

Modified: ode/trunk/dao-hibernate-db/src/main/sql/simplesched-hsql.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate-db/src/main/sql/simplesched-hsql.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-hibernate-db/src/main/sql/simplesched-hsql.sql (original)
+++ ode/trunk/dao-hibernate-db/src/main/sql/simplesched-hsql.sql Mon Jun 29 13:06:40 2009
@@ -10,7 +10,18 @@
   nodeid char(64),
   scheduled int  NOT NULL DEFAULT 0,
   transacted int  NOT NULL DEFAULT 0,
-  details blob(4096),
+
+  instanceId BIGINT,
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt binary(4096),
+
   PRIMARY KEY(jobid));
 
 CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);

Modified: ode/trunk/dao-hibernate-db/src/main/sql/simplesched-mysql.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate-db/src/main/sql/simplesched-mysql.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-hibernate-db/src/main/sql/simplesched-mysql.sql (original)
+++ ode/trunk/dao-hibernate-db/src/main/sql/simplesched-mysql.sql Mon Jun 29 13:06:40 2009
@@ -11,7 +11,18 @@
   nodeid char(64)  NULL,
   scheduled int  NOT NULL DEFAULT 0,
   transacted int  NOT NULL DEFAULT 0,
-  details blob(4096)  NULL,
+
+  instanceId BIGINT,
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt blob(4096),
+
   PRIMARY KEY(jobid),
   INDEX IDX_ODE_JOB_TS(ts),
   INDEX IDX_ODE_JOB_NODEID(nodeid)

Modified: ode/trunk/dao-hibernate-db/src/main/sql/simplesched-oracle.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate-db/src/main/sql/simplesched-oracle.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-hibernate-db/src/main/sql/simplesched-oracle.sql (original)
+++ ode/trunk/dao-hibernate-db/src/main/sql/simplesched-oracle.sql Mon Jun 29 13:06:40 2009
@@ -4,13 +4,26 @@
 -- 
 -- 
 
+DROP TABLE ode_job;
+
 CREATE TABLE ode_job (
-  jobid CHAR(64)  NOT NULL DEFAULT '',
-  ts BIGINT  NOT NULL DEFAULT 0,
-  nodeid char(64),
-  scheduled int  NOT NULL DEFAULT 0,
-  transacted int  NOT NULL DEFAULT 0,
-  details blob(4096),
+  jobid VARCHAR(64)  NOT NULL,
+  ts number(37)  NOT NULL,
+  nodeid varchar(64),
+  scheduled int  NOT NULL,
+  transacted int  NOT NULL,
+  
+  instanceId number(37),
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt blob,
+
   PRIMARY KEY(jobid));
 
 CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);

Modified: ode/trunk/dao-hibernate-db/src/main/sql/simplesched-postgres.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate-db/src/main/sql/simplesched-postgres.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-hibernate-db/src/main/sql/simplesched-postgres.sql (original)
+++ ode/trunk/dao-hibernate-db/src/main/sql/simplesched-postgres.sql Mon Jun 29 13:06:40 2009
@@ -10,7 +10,18 @@
   nodeid char(64),
   scheduled int  NOT NULL DEFAULT 0,
   transacted int  NOT NULL DEFAULT 0,
-  details blob(4096),
+
+  instanceId BIGINT,
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt blob(4096),
+
   PRIMARY KEY(jobid));
 
 CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);

Modified: ode/trunk/dao-hibernate-db/src/main/sql/simplesched-sqlserver.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-hibernate-db/src/main/sql/simplesched-sqlserver.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-hibernate-db/src/main/sql/simplesched-sqlserver.sql (original)
+++ ode/trunk/dao-hibernate-db/src/main/sql/simplesched-sqlserver.sql Mon Jun 29 13:06:40 2009
@@ -10,7 +10,18 @@
   nodeid char(64),
   scheduled int  NOT NULL DEFAULT 0,
   transacted int  NOT NULL DEFAULT 0,
-  details blob(4096),
+
+  instanceId BIGINT,
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt blob(4096),
+
   PRIMARY KEY(jobid));
 
 CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);

Modified: ode/trunk/dao-jpa-db/src/main/scripts/simplesched-derby.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/src/main/scripts/simplesched-derby.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-jpa-db/src/main/scripts/simplesched-derby.sql (original)
+++ ode/trunk/dao-jpa-db/src/main/scripts/simplesched-derby.sql Mon Jun 29 13:06:40 2009
@@ -10,7 +10,18 @@
   nodeid char(64),
   scheduled int  NOT NULL DEFAULT 0,
   transacted int  NOT NULL DEFAULT 0,
-  details blob(4096),
+
+  instanceId BIGINT,
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt blob(4096),
+
   PRIMARY KEY(jobid));
 
 CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);

Modified: ode/trunk/dao-jpa-db/src/main/scripts/simplesched-mysql.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/src/main/scripts/simplesched-mysql.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-jpa-db/src/main/scripts/simplesched-mysql.sql (original)
+++ ode/trunk/dao-jpa-db/src/main/scripts/simplesched-mysql.sql Mon Jun 29 13:06:40 2009
@@ -11,7 +11,18 @@
   nodeid char(64)  NULL,
   scheduled int  NOT NULL DEFAULT 0,
   transacted int  NOT NULL DEFAULT 0,
-  details blob(4096)  NULL,
+
+  instanceId BIGINT,
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt blob(4096),
+
   PRIMARY KEY(jobid),
   INDEX IDX_ODE_JOB_TS(ts),
   INDEX IDX_ODE_JOB_NODEID(nodeid)

Modified: ode/trunk/dao-jpa-db/src/main/scripts/simplesched-oracle.sql
URL: http://svn.apache.org/viewvc/ode/trunk/dao-jpa-db/src/main/scripts/simplesched-oracle.sql?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/dao-jpa-db/src/main/scripts/simplesched-oracle.sql (original)
+++ ode/trunk/dao-jpa-db/src/main/scripts/simplesched-oracle.sql Mon Jun 29 13:06:40 2009
@@ -1,4 +1,30 @@
-CREATE TABLE ODE_JOB (jobid varchar2(64 char) DEFAULT '' NOT NULL, ts number(19,0) DEFAULT 0 NOT NULL, nodeid varchar2(64 char) NULL, scheduled number(12,0) DEFAULT 0 NOT NULL, transacted number(12,0) DEFAULT 0 NOT NULL, details BLOB, PRIMARY KEY(jobid));
+-- Apache ODE - SimpleScheduler Database Schema
+-- 
+-- Apache Derby scripts by Maciej Szefler.
+-- 
+-- 
+
+DROP TABLE ode_job;
+
+CREATE TABLE ode_job (
+  jobid VARCHAR(64)  NOT NULL,
+  ts number(37)  NOT NULL,
+  nodeid varchar(64),
+  scheduled int  NOT NULL,
+  transacted int  NOT NULL,
+  
+  instanceId number(37),
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt blob,
+
+  PRIMARY KEY(jobid));
 
 CREATE INDEX IDX_ODE_JOB_TS ON ode_job(ts);
 CREATE INDEX IDX_ODE_JOB_NODEID ON ode_job(nodeid);

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java Mon Jun 29 13:06:40 2009
@@ -55,6 +55,7 @@
 import org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern;
 import org.apache.ode.bpel.iapi.MessageExchange.Status;
 import org.apache.ode.bpel.iapi.ProcessConf.CLEANUP_CATEGORY;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
 import org.apache.ode.bpel.memdao.ProcessInstanceDaoImpl;
 import org.apache.ode.bpel.rapi.CorrelationSet;
 import org.apache.ode.bpel.rapi.FaultInfo;
@@ -556,7 +557,7 @@
                 __log.debug("Not creating a new instance for process " + processDAO.getProcessId() + "; unique correlation constraint would be violated!");
                 throw new FaultException(cset.getOwner().getConstantsModel().getDuplicateInstance());
             }
-        }        	
+        }           
         
         ScopeDAO scopeDAO = _dao.getScope(cset.getScopeId());
         CorrelationSetDAO cs = scopeDAO.getCorrelationSet(cset.getName());
@@ -581,18 +582,18 @@
 
     public void registerTimer(String timerChannelId, Date timeToFire) {
         WorkEvent we = new WorkEvent();
-        we.setIID(_dao.getInstanceId());
+        we.setInstanceId(_dao.getInstanceId());
         we.setProcessId(_bpelProcess.getPID());
         we.setChannel(timerChannelId);
-        we.setType(WorkEvent.Type.TIMER);
+        we.setType(Scheduler.JobType.TIMER);
         _bpelProcess.scheduleWorkEvent(we, timeToFire);
     }
 
     private void scheduleCorrelatorMatcher(String correlatorId, CorrelationKey key) {
         WorkEvent we = new WorkEvent();
-        we.setIID(_dao.getInstanceId());
+        we.setInstanceId(_dao.getInstanceId());
         we.setProcessId(_bpelProcess.getPID());
-        we.setType(WorkEvent.Type.MATCHER);
+        we.setType(Scheduler.JobType.MATCHER);
         we.setCorrelatorId(correlatorId);
         we.setCorrelationKey(key);
         _bpelProcess.scheduleWorkEvent(we, null);
@@ -774,11 +775,11 @@
 
                 try {
                     WorkEvent we = new WorkEvent();
-                    we.setIID(_iid);
+                    we.setInstanceId(_iid);
                     we.setRetryCount(_retryCount);
                     we.setProcessId(_bpelProcess.getPID());
-                    we.setType(WorkEvent.Type.RESUME);
-                    _contexts.scheduler.schedulePersistedJob(we.getDetail(), new Date());
+                    we.setType(Scheduler.JobType.RESUME);
+                    _contexts.scheduler.schedulePersistedJob(we.getDetails(), new Date());
                 } catch (ContextException e) {
                     __log.error("Failed to schedule resume task.", e);
                     throw new BpelEngineException(e);
@@ -811,7 +812,7 @@
     }
     
     private void rollbackState() {
-        _contexts.setRollbackOnly();    		
+        _contexts.setRollbackOnly();            
         int newcount = _dao.getExecutionStateCounter();
         _dao.setExecutionStateCounter(newcount);
         _instanceWorker.setCachedState(newcount, null);
@@ -1170,7 +1171,7 @@
 
     public Node getProcessProperty(QName propertyName) {
         return _bpelProcess.getProcessProperty(propertyName);
-    }	
+    }   
 
     private MessageExchangeDAO getExistingMex(String mexId) {
         MessageExchangeDAO dao = _dao.getConnection().getMessageExchange(mexId);

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/BpelServerImpl.java Mon Jun 29 13:06:40 2009
@@ -533,7 +533,7 @@
                         _contexts.scheduler.jobCompleted(jobInfo.jobName);
                         Date future = new Date(System.currentTimeMillis() + (60 * 1000));
                         __log.debug(__msgs.msgReschedulingJobForInactiveProcess(we.getProcessId(), jobInfo.jobName, future));
-                        _contexts.scheduler.schedulePersistedJob(we.getDetail(), future);            
+                        _contexts.scheduler.schedulePersistedJob(we.getDetails(), future);            
                         return null;
                     }
                     
@@ -541,7 +541,7 @@
                 return;
             }
             
-            if (we.getType().equals(WorkEvent.Type.INVOKE_CHECK)) {
+            if (we.getType().equals(Scheduler.JobType.INVOKE_CHECK)) {
                 if (__log.isDebugEnabled()) __log.debug("handleWorkEvent: InvokeCheck event for mexid " + we.getMexId());
 
                 PartnerRoleMessageExchange mex = (PartnerRoleMessageExchange) getMessageExchange(we.getMexId());
@@ -555,7 +555,7 @@
 
             process.handleWorkEvent(jobInfo);
         } catch (Exception ex) {
-            throw new JobProcessorException(ex, jobInfo.jobDetail.get("inmem") == null);
+            throw new JobProcessorException(ex, jobInfo.jobDetail.getInMem() == false);
         } finally {
             _mngmtLock.readLock().unlock();
         }
@@ -637,7 +637,7 @@
                 for (ODEProcess target : targets) {
                     meps.add(createNewMyRoleMex(target, istyle, targetService, operation, clientKey));
                 }
-                return createNewMyRoleMex(targets.get(0), meps, istyle);	
+                return createNewMyRoleMex(targets.get(0), meps, istyle);    
             }
         } finally {
             _mngmtLock.readLock().unlock();
@@ -691,7 +691,7 @@
         else
             assertNoTransaction();
     
-	    return ((ODEWSProcess)process).createNewMyRoleMex(istyle, targetService, operation);
+        return ((ODEWSProcess)process).createNewMyRoleMex(istyle, targetService, operation);
     }
     
     /**
@@ -1086,7 +1086,7 @@
                 }
                 if( statusOfPriorTry == JOB_STATUS.COMPLETED ) {
                     resultsByJobId.remove(jobInfo.jobName);
-                    jobInfo.jobDetail.put("runnable_status", JOB_STATUS.COMPLETED);
+                    jobInfo.jobDetail.getDetailsExt().put("runnable_status", JOB_STATUS.COMPLETED);
                     return;
                 }
                 if( statusOfPriorTry == JOB_STATUS.PENDING || statusOfPriorTry == JOB_STATUS.FAILED ) {
@@ -1100,8 +1100,8 @@
                 _polledRunnableExec.submit(new Runnable() {
                     public void run() {
                         try {
-                            MapSerializableRunnable runnable = (MapSerializableRunnable)jobInfo.jobDetail.get("runnable");
-                            runnable.restoreFromDetailsMap(jobInfo.jobDetail);
+                            MapSerializableRunnable runnable = (MapSerializableRunnable)jobInfo.jobDetail.getDetailsExt().get("runnable");
+                            runnable.restoreFromDetails(jobInfo.jobDetail);
                             if( runnable instanceof ContextsAware ) {
                                 ((ContextsAware)runnable).setContexts(_contexts);
                             }
@@ -1120,7 +1120,7 @@
                 });
             }
             
-            jobInfo.jobDetail.put("runnable_status", JOB_STATUS.IN_PROGRESS);
+            jobInfo.jobDetail.getDetailsExt().put("runnable_status", JOB_STATUS.IN_PROGRESS);
             if( exceptionThrownOnPriorTry != null ) {
                 throw new Scheduler.JobProcessorException(exceptionThrownOnPriorTry, true);
             }

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/DebuggerSupport.java Mon Jun 29 13:06:40 2009
@@ -32,6 +32,9 @@
 import org.apache.ode.bpel.evt.ProcessInstanceStateChangeEvent;
 import org.apache.ode.bpel.evt.ProcessTerminationEvent;
 import org.apache.ode.bpel.evt.ScopeCompletionEvent;
+import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
+import org.apache.ode.bpel.iapi.Scheduler.JobType;
 import org.apache.ode.bpel.pmapi.BpelManagementFacade;
 import org.apache.ode.bpel.pmapi.InstanceNotFoundException;
 import org.apache.ode.bpel.pmapi.ManagementException;
@@ -170,10 +173,10 @@
                         _step.add(iid);
 
                         WorkEvent we = new WorkEvent();
-                        we.setIID(iid);
+                        we.setInstanceId(iid);
                         we.setProcessId(_process.getPID());
-                        we.setType(WorkEvent.Type.RESUME);
-                        _process._contexts.scheduler.schedulePersistedJob(we.getDetail(), null);
+                        we.setType(Scheduler.JobType.RESUME);
+                        _process._contexts.scheduler.schedulePersistedJob(we.getDetails(), null);
 
                         return true;
                     }
@@ -294,10 +297,10 @@
                         onEvent(evt);
 
                         WorkEvent we = new WorkEvent();
-                        we.setType(WorkEvent.Type.RESUME);
+                        we.setType(JobType.RESUME);
                         we.setProcessId(_process.getPID());
-                        we.setIID(iid);
-                        _process._contexts.scheduler.schedulePersistedJob(we.getDetail(), null);
+                        we.setInstanceId(iid);
+                        _process._contexts.scheduler.schedulePersistedJob(we.getDetails(), null);
 
                         return true;
                     }

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEProcess.java Mon Jun 29 13:06:40 2009
@@ -355,7 +355,7 @@
             __log.debug(ObjectPrinter.stringifyMethodEnter("handleWorkEvent", new Object[] { "jobInfo", jobInfo }));
         }
 
-        enqueueInstanceTransaction(we.getIID(), new Runnable() {
+        enqueueInstanceTransaction(we.getInstanceId(), new Runnable() {
             public void run() {
                 _contexts.scheduler.jobCompleted(jobInfo.jobName);
                 execInstanceEvent(we);
@@ -402,21 +402,21 @@
     }
 
     private void execInstanceEvent(WorkEvent we) {
-        BpelInstanceWorker worker = _instanceWorkerCache.get(we.getIID());
+        BpelInstanceWorker worker = _instanceWorkerCache.get(we.getInstanceId());
         assert worker.isWorkerThread();
 
-        ProcessInstanceDAO instanceDAO = getProcessDAO().getInstance(we.getIID());
+        ProcessInstanceDAO instanceDAO = getProcessDAO().getInstance(we.getInstanceId());
         MessageExchangeDAO mexDao = we.getMexId() == null ? null : loadMexDao(we.getMexId());
 
         if (instanceDAO == null) {
             if (__log.isDebugEnabled()) {
-                __log.debug("handleWorkEvent: no ProcessInstance found with iid " + we.getIID() + "; ignoring.");
+                __log.debug("handleWorkEvent: no ProcessInstance found with iid " + we.getInstanceId() + "; ignoring.");
             }
             return;
         }
 
         if (__log.isDebugEnabled()) {
-            __log.debug("handleWorkEvent: " + we.getType() + " event for process instance " + we.getIID());
+            __log.debug("handleWorkEvent: " + we.getType() + " event for process instance " + we.getInstanceId());
         }
 
         switch (we.getType()) {
@@ -470,7 +470,7 @@
     protected boolean isShareable(Endpoint endpoint) {
         if (!_pconf.isSharedService(endpoint.serviceName)) return false;
 
-//    	PartnerLinkMyRoleImpl partnerLink = _endpointToMyRoleMap.get(endpoint);
+//      PartnerLinkMyRoleImpl partnerLink = _endpointToMyRoleMap.get(endpoint);
 //        return partnerLink != null && partnerLink.isOneWayOnly();
         return false;
     }
@@ -765,7 +765,7 @@
         // if (isInMemory())
         // throw new InvalidProcessException("In-mem process execution resulted in event scheduling.");
 
-        return _contexts.scheduler.schedulePersistedJob(we.getDetail(), timeToFire);
+        return _contexts.scheduler.schedulePersistedJob(we.getDetails(), timeToFire);
     }
 
     protected OdeRuntime buildRuntime(int modelVersion) {

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODERESTProcess.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODERESTProcess.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODERESTProcess.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODERESTProcess.java Mon Jun 29 13:06:40 2009
@@ -136,8 +136,8 @@
                     });
                 } else /* non-transacted style */ {
                     WorkEvent we = new WorkEvent();
-                    we.setType(WorkEvent.Type.MYROLE_INVOKE);
-                    we.setIID(mexdao.getInstance().getInstanceId());
+                    we.setType(Scheduler.JobType.MYROLE_INVOKE);
+                    we.setInstanceId(mexdao.getInstance().getInstanceId());
                     we.setMexId(mexdao.getMessageExchangeId());
                     // Could be different to this pid when routing to an older version
                     we.setProcessId(mexdao.getInstance().getProcess().getProcessId());

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ODEWSProcess.java Mon Jun 29 13:06:40 2009
@@ -5,6 +5,7 @@
 import org.apache.ode.bpel.rapi.ConstantsModel;
 import org.apache.ode.bpel.rapi.InvalidProcessException;
 import org.apache.ode.bpel.iapi.*;
+import org.apache.ode.bpel.iapi.Scheduler.JobType;
 import org.apache.ode.bpel.dao.MessageExchangeDAO;
 import org.apache.ode.bpel.dao.MessageDAO;
 import org.apache.ode.bpel.intercept.InterceptorInvoker;
@@ -230,10 +231,10 @@
             }
 
             if (pl.hasPartnerRole()) {
-            	Endpoint endpoint = _pconf.getInvokeEndpoints().get(pl.getName());
+                Endpoint endpoint = _pconf.getInvokeEndpoints().get(pl.getName());
                 if (endpoint == null)
                     throw new IllegalArgumentException(pl.getName() + " must be bound to an endpoint in deloy.xml");
-            	PartnerLinkPartnerRoleImpl partnerRole = new PartnerLinkPartnerRoleImpl(this, pl, endpoint);
+                PartnerLinkPartnerRoleImpl partnerRole = new PartnerLinkPartnerRoleImpl(this, pl, endpoint);
                 _partnerRoles.put(pl, partnerRole);
             }
         }
@@ -408,8 +409,8 @@
                     executeContinueInstanceMyRoleRequestReceived(mexdao);
                 } else /* non-transacted style */{
                     WorkEvent we = new WorkEvent();
-                    we.setType(WorkEvent.Type.MYROLE_INVOKE);
-                    we.setIID(mexdao.getInstance().getInstanceId());
+                    we.setType(JobType.MYROLE_INVOKE);
+                    we.setInstanceId(mexdao.getInstance().getInstanceId());
                     we.setMexId(mexdao.getMessageExchangeId());
                     // Could be different to this pid when routing to an older version
                     we.setProcessId(mexdao.getInstance().getProcess().getProcessId());
@@ -673,7 +674,7 @@
             WorkEvent event = new WorkEvent();
             event.setMexId(mex.getMessageExchangeId());
             event.setProcessId(getPID());
-            event.setType(WorkEvent.Type.INVOKE_CHECK);
+            event.setType(JobType.INVOKE_CHECK);
             // use a greater timeout to make sure the check job does not get executed while the service invocation is still waiting for a response
             PartnerLinkModel model = _processModel.getPartnerLink(mex.getPartnerLinkModelId());
             long timeout = (long) (getTimeout(model)*1.5);

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessCleanUpRunnable.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessCleanUpRunnable.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessCleanUpRunnable.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ProcessCleanUpRunnable.java Mon Jun 29 13:06:40 2009
@@ -4,11 +4,14 @@
 import java.util.Map;
 import java.util.concurrent.Callable;
 
+import javax.xml.namespace.QName;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ode.bpel.dao.DeferredProcessInstanceCleanable;
 import org.apache.ode.bpel.dao.ProcessDAO;
 import org.apache.ode.bpel.engine.BpelServerImpl.ContextsAware;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
 import org.apache.ode.bpel.iapi.Scheduler.MapSerializableRunnable;
 
 public class ProcessCleanUpRunnable implements MapSerializableRunnable, ContextsAware {
@@ -28,12 +31,12 @@
         _pid = pid;
     }
 
-    public void storeToDetailsMap(Map<String, Object> details) {
-        details.put("pid", _pid);
+    public void storeToDetails(JobDetails details) {
+        details.getDetailsExt().put("pid", _pid);
     }
     
-    public void restoreFromDetailsMap(Map<String, Object> details) {
-        _pid = (Serializable)details.get("pid");
+    public void restoreFromDetails(JobDetails details) {
+        _pid = (Serializable) details.getDetailsExt().get("pid");
     }
 
     public void setContexts(Contexts contexts) {
@@ -65,4 +68,4 @@
         }
         if(__log.isInfoEnabled()) __log.info("Deleted runtime data for old process: " + _pid + ".");
     }
-}
\ No newline at end of file
+}

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ReliablePartnerRoleMessageExchangeImpl.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ReliablePartnerRoleMessageExchangeImpl.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ReliablePartnerRoleMessageExchangeImpl.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/ReliablePartnerRoleMessageExchangeImpl.java Mon Jun 29 13:06:40 2009
@@ -7,6 +7,7 @@
 import org.apache.ode.bpel.iapi.EndpointReference;
 import org.apache.ode.bpel.iapi.InvocationStyle;
 import org.apache.ode.bpel.iapi.PartnerRoleChannel;
+import org.apache.ode.bpel.iapi.Scheduler.JobType;
 import org.apache.ode.bpel.rapi.PartnerLinkModel;
 
 public class ReliablePartnerRoleMessageExchangeImpl extends PartnerRoleMessageExchangeImpl {
@@ -49,7 +50,7 @@
         MessageExchangeDAO mexdao = getDAO();
         final WorkEvent we = generatePartnerResponseWorkEvent(mexdao);
         save(mexdao);
-        _contexts.scheduler.schedulePersistedJob(we.getDetail(), null);
+        _contexts.scheduler.schedulePersistedJob(we.getDetails(), null);
     }
 
 
@@ -62,9 +63,9 @@
         WorkEvent we = new WorkEvent();
         we.setProcessId(_process.getPID());
         we.setChannel(mexdao.getChannel());
-        we.setIID(_iid);
+        we.setInstanceId(_iid);
         we.setMexId(_mexId);
-        we.setType(WorkEvent.Type.PARTNER_RESPONSE);
+        we.setType(JobType.PARTNER_RESPONSE);
         return we;
     }
 

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/WorkEvent.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/WorkEvent.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/WorkEvent.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/WorkEvent.java Mon Jun 29 13:06:40 2009
@@ -20,6 +20,9 @@
 package org.apache.ode.bpel.engine;
 
 import org.apache.ode.bpel.common.CorrelationKey;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetailsImpl;
+import org.apache.ode.bpel.iapi.Scheduler.JobType;
 
 import javax.xml.namespace.QName;
 import java.util.HashMap;
@@ -31,108 +34,104 @@
  */
 public class WorkEvent {
 
-    private Map<String, Object> _jobDetail;
+    private JobDetails _jobDetail;
 
-    WorkEvent(Map<String, Object> jobDetail) {
+    WorkEvent(JobDetails jobDetail) {
         _jobDetail = jobDetail;
     }
 
     WorkEvent() {
-        _jobDetail = new HashMap<String, Object>();
+        _jobDetail = new JobDetailsImpl();
     }
 
-    Long getIID() {
-        return (Long) _jobDetail.get("iid");
+    JobDetails getDetails() {
+        return _jobDetail;
     }
 
-    Type getType() {
-        return Type.valueOf((String) _jobDetail.get("type"));
+    public String toString() {
+        return "WorkEvent" + _jobDetail;
     }
 
-    void setType(Type timer) {
+    public String getChannel() {
+        return _jobDetail.getChannel();
+    }
 
-        _jobDetail.put("type", timer.toString());
+    public CorrelationKey getCorrelationKey() {
+        return _jobDetail.getCorrelationKey();
+    }
 
+    public String getCorrelatorId() {
+        return _jobDetail.getCorrelatorId();
     }
 
-    Map<String, Object> getDetail() {
-        return _jobDetail;
+    public Map<String, Object> getDetailsExt() {
+        return _jobDetail.getDetailsExt();
     }
 
-    public String toString() {
-        return "WorkEvent" + _jobDetail;
+    public Boolean getInMem() {
+        return _jobDetail.getInMem();
     }
-    
-    public enum Type {
-        TIMER, 
-        
-        RESUME, 
-        
-        /** Response from partner (i.e. the result of a partner-role invoke) has been received. */
-        PARTNER_RESPONSE, 
-        
-        MATCHER, 
-        
-        /** Invoke a "my role" operation (i.e. implemented by the process). */
-        MYROLE_INVOKE, 
-        
-        MYROLE_INVOKE_ASYNC_RESPONSE,
 
-        INVOKE_CHECK
+    public Long getInstanceId() {
+        return _jobDetail.getInstanceId();
     }
 
-    public String getChannel() {
-        return (String) _jobDetail.get("channel");
+    public String getMexId() {
+        return _jobDetail.getMexId();
     }
 
-    public void setIID(Long instanceId) {
-        _jobDetail.put("iid", instanceId);
+    public QName getProcessId() {
+        return _jobDetail.getProcessId();
     }
 
-    public void setChannel(String channel) {
+    public Integer getRetryCount() {
+        return _jobDetail.getRetryCount();
+    }
 
-        _jobDetail.put("channel", channel);
+    public JobType getType() {
+        return _jobDetail.getType();
+    }
 
+    public void setChannel(String channel) {
+        _jobDetail.setChannel(channel);
     }
 
-    public String getMexId() {
-        return (String) _jobDetail.get("mexid");
+    public void setCorrelationKey(CorrelationKey correlationKey) {
+        _jobDetail.setCorrelationKey(correlationKey);
     }
 
-    public void setMexId(String mexId) {
-        _jobDetail.put("mexid", mexId);
+    public void setCorrelatorId(String correlatorId) {
+        _jobDetail.setCorrelatorId(correlatorId);
     }
 
-    public String getCorrelatorId() {
-        return (String)_jobDetail.get("correlatorId");
+    public void setDetailsExt(Map<String, Object> detailsExt) {
+        _jobDetail.setDetailsExt(detailsExt);
     }
 
-    public void setCorrelatorId(String correlatorId) {
-        _jobDetail.put("correlatorId", correlatorId);
+    public void setInMem(Boolean inMem) {
+        _jobDetail.setInMem(inMem);
     }
-    
-    public CorrelationKey getCorrelationKey() {
-        return new CorrelationKey((String) _jobDetail.get("ckey"));
+
+    public void setInstanceId(Long iid) {
+        _jobDetail.setInstanceId(iid);
     }
-    
-    public void setCorrelationKey(CorrelationKey ckey) {
-        _jobDetail.put("ckey", ckey == null ? null : ckey.toCanonicalString());
+
+    public void setMexId(String mexId) {
+        _jobDetail.setMexId(mexId);
     }
 
-    public void setProcessId(QName pid) {
-        _jobDetail.put("pid", pid.toString());
+    public void setProcessId(QName processId) {
+        _jobDetail.setProcessId(processId);
     }
 
-    public QName getProcessId() {
-        return _jobDetail.get("pid") != null? QName.valueOf((String) _jobDetail.get("pid")) : null;
+    public void setRetryCount(Integer retryCount) {
+        _jobDetail.setRetryCount(retryCount);
     }
-    
-    public void setRetryCount(int retryCount) {
-        _jobDetail.put("retryCount", String.valueOf(retryCount));
+
+    public void setType(JobType type) {
+        _jobDetail.setType(type);
     }
     
-    public int getRetryCount() {
-        return _jobDetail.get("retryCount") != null ? Integer.parseInt((String) _jobDetail.get("retryCount")) : 0;
-    }
+    
 }
 

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/CronScheduler.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/CronScheduler.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/CronScheduler.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/CronScheduler.java Mon Jun 29 13:06:40 2009
@@ -20,6 +20,7 @@
 import org.apache.ode.bpel.iapi.ClusterAware;
 import org.apache.ode.bpel.iapi.ProcessConf;
 import org.apache.ode.bpel.iapi.ProcessConf.CronJob;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
 import org.apache.ode.bpel.iapi.Scheduler.MapSerializableRunnable;
 import org.apache.ode.utils.CronExpression;
 
@@ -99,11 +100,11 @@
                 Runnable runnable = new Runnable() {
                     public void run() {
                         if( __log.isDebugEnabled() ) __log.debug("Running cron cleanup with details list size: " + job.getRunnableDetailList().size());
-                        for( Map<String, Object> details : job.getRunnableDetailList() ) {
+                        for( JobDetails details : job.getRunnableDetailList() ) {
                             try {
                                 // for each clean up for the scheduled time
                                 RuntimeDataCleanupRunnable cleanup = new RuntimeDataCleanupRunnable();
-                                cleanup.restoreFromDetailsMap(details);
+                                cleanup.restoreFromDetails(details);
                                 cleanup.setContexts(_contexts);
                                 cleanup.run();
                                 if( __log.isDebugEnabled() ) __log.debug("Finished running runtime data cleanup from a PROCESS CRON job: " + cleanup);
@@ -155,17 +156,17 @@
                     // for each different scheduled time
                     Runnable runnable = new Runnable() {
                         public void run() {
-                            for( Map<String, Object> details : job.getRunnableDetailList() ) {
+                            for( JobDetails details : job.getRunnableDetailList() ) {
                                 try {
                                     // for now, we have only runtime data cleanup cron job defined
                                     // for each clean up for the scheduled time
                                     RuntimeDataCleanupRunnable cleanup = new RuntimeDataCleanupRunnable();
                                     synchronized( _terminationListenersByPid ) {
                                         if( !_terminationListenersByPid.isEmpty() ) {
-                                            details.put("pidsToExclude", _terminationListenersByPid.keySet());
+                                            details.getDetailsExt().put("pidsToExclude", _terminationListenersByPid.keySet());
                                         }
                                     }
-                                    cleanup.restoreFromDetailsMap(details);
+                                    cleanup.restoreFromDetails(details);
                                     cleanup.setContexts(_contexts);
                                     cleanup.run();
                                     if( __log.isDebugEnabled() ) __log.debug("Finished running runtime data cleanup from a SYSTEM CRON job:" + cleanup);
@@ -184,7 +185,7 @@
     }
 
     public TerminationListener schedule(final CronExpression cronExpression, 
-            final Runnable runnable, final Map<String, Object> runnableDetails, 
+            final Runnable runnable, final JobDetails runnableDetails, 
             TerminationListener terminationListener) {
         if( _shuttingDown ) {
             __log.info("CRON Scheduler is being shut down. This new scheduling request is ignored.");
@@ -237,12 +238,12 @@
         private volatile boolean terminated = false;
         private Date nextScheduleTime;
         private Runnable runnable;
-        private Map<String, Object> runnableDetails;
+        private JobDetails runnableDetails;
         private CronExpression cronExpression;
         private TerminationListener terminationListener;
         
         public CronScheduledJob(Date nextScheduleTime,
-                Runnable runnable, Map<String, Object> runnableDetails,
+                Runnable runnable, JobDetails runnableDetails,
                 CronExpression cronExpression, TerminationListener terminationListener) {
             this.nextScheduleTime = nextScheduleTime;
             this.runnable = runnable;
@@ -264,7 +265,7 @@
                     nextScheduleTime.getTime() < System.currentTimeMillis() + TOLERABLE_SCHEDULE_DELAY) {
                     if( runnableDetails != null && 
                             runnable instanceof MapSerializableRunnable ) {
-                        ((MapSerializableRunnable)runnable).restoreFromDetailsMap(runnableDetails);
+                        ((MapSerializableRunnable)runnable).restoreFromDetails(runnableDetails);
                     }
                     if (runnable instanceof ContextsAware) {
                         ((ContextsAware) runnable).setContexts(_contexts);
@@ -293,4 +294,4 @@
             return terminationListener;
         }
     }
-}
\ No newline at end of file
+}

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/RuntimeDataCleanupRunnable.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/RuntimeDataCleanupRunnable.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/RuntimeDataCleanupRunnable.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/RuntimeDataCleanupRunnable.java Mon Jun 29 13:06:40 2009
@@ -1,5 +1,6 @@
 package org.apache.ode.bpel.engine.cron;
 
+import java.io.Serializable;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.Callable;
@@ -15,6 +16,7 @@
 import org.apache.ode.bpel.engine.BpelServerImpl.ContextsAware;
 import org.apache.ode.bpel.iapi.ProcessConf.CLEANUP_CATEGORY;
 import org.apache.ode.bpel.iapi.ProcessConf.CleanupInfo;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
 import org.apache.ode.bpel.iapi.Scheduler.MapSerializableRunnable;
 
 public class RuntimeDataCleanupRunnable implements MapSerializableRunnable, ContextsAware {
@@ -33,14 +35,14 @@
     }
     
     @SuppressWarnings("unchecked")
-    public void restoreFromDetailsMap(Map<String, Object> details) {
-        _cleanupInfo = (CleanupInfo)details.get("cleanupInfo");
-        _transactionSize = (Integer)details.get("transactionSize");
-        _pid = (QName)details.get("pid");
-        _pidsToExclude = (Set<QName>)details.get("pidsToExclude");
+    public void restoreFromDetails(JobDetails details) {
+        _cleanupInfo = (CleanupInfo)details.getDetailsExt().get("cleanupInfo");
+        _transactionSize = (Integer)details.getDetailsExt().get("transactionSize");
+        _pid = (QName) details.getDetailsExt().get("pid");
+        _pidsToExclude = (Set<QName>)details.getDetailsExt().get("pidsToExclude");
     }
 
-    public void storeToDetailsMap(Map<String, Object> details) {
+    public void storeToDetails(JobDetails details) {
         // we don't serialize
     }
 
@@ -105,4 +107,4 @@
             throw new RuntimeException("Exception while listing instances: ",  e);
         }
     }
-}
\ No newline at end of file
+}

Modified: ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/SystemSchedulesConfig.java
URL: http://svn.apache.org/viewvc/ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/SystemSchedulesConfig.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/SystemSchedulesConfig.java (original)
+++ ode/trunk/engine/src/main/java/org/apache/ode/bpel/engine/cron/SystemSchedulesConfig.java Mon Jun 29 13:06:40 2009
@@ -15,6 +15,8 @@
 import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.iapi.ProcessConf.CleanupInfo;
 import org.apache.ode.bpel.iapi.ProcessConf.CronJob;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetailsImpl;
 import org.apache.ode.store.ProcessCleanupConfImpl;
 import org.apache.ode.utils.CronExpression;
 import org.apache.xmlbeans.XmlOptions;
@@ -64,9 +66,10 @@
                         cleanupInfo.setFilters(aCleanup.getFilterList());
                         ProcessCleanupConfImpl.processACleanup(cleanupInfo.getCategories(), aCleanup.getCategoryList());
                         
-                        Map<String, Object> runnableDetails = new HashMap<String, Object>();
-                        runnableDetails.put("cleanupInfo", cleanupInfo);
-                        runnableDetails.put("transactionSize", 10);
+                        JobDetails runnableDetails = new JobDetailsImpl();
+                        
+                        runnableDetails.getDetailsExt().put("cleanupInfo", cleanupInfo);
+                        runnableDetails.getDetailsExt().put("transactionSize", 10);
                         job.getRunnableDetailList().add(runnableDetails);
                         __log.info("SYSTEM CRON configuration added a runtime data cleanup: " + runnableDetails);
                     }
@@ -100,4 +103,4 @@
     
         return sd;
     }
-}
\ No newline at end of file
+}

Modified: ode/trunk/il-common/src/main/java/org/apache/ode/il/MockScheduler.java
URL: http://svn.apache.org/viewvc/ode/trunk/il-common/src/main/java/org/apache/ode/il/MockScheduler.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/il-common/src/main/java/org/apache/ode/il/MockScheduler.java (original)
+++ ode/trunk/il-common/src/main/java/org/apache/ode/il/MockScheduler.java Mon Jun 29 13:06:40 2009
@@ -69,7 +69,7 @@
         }
     };
 
-    public String schedulePersistedJob(final Map<String, Object> detail, Date dt) throws ContextException {
+    public String schedulePersistedJob(final JobDetails detail, Date dt) throws ContextException {
         final Date date = dt == null ? new Date() : dt;
         registerSynchronizer(new Synchronization() {
             public void afterCompletion(int status) {

Modified: ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java (original)
+++ ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/JdbcDelegate.java Mon Jun 29 13:06:40 2009
@@ -27,12 +27,16 @@
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.sql.Types;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 import javax.sql.DataSource;
 
+import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.iapi.Scheduler.JobDetailsImpl;
 import org.apache.ode.utils.DbIsolation;                                                                                                                                 
 
 import org.apache.commons.logging.Log;
@@ -60,13 +64,57 @@
         + "and (ts % ?) = ? and ts < ?";
 
     private static final String SAVE_JOB = "insert into ODE_JOB "
-            + " (jobid, nodeid, ts, scheduled, transacted, details) values(?, ?, ?, ?, ?, ?)";
+            + " (jobid, nodeid, ts, scheduled, transacted, "
+            + "instanceId,"
+            + "mexId,"
+            + "processId,"
+            + "type,"
+            + "channel,"
+            + "correlatorId,"
+            + "correlationKey,"
+            + "retryCount,"
+            + "inMem,"
+            + "detailsExt"
+            + ") values(?, ?, ?, ?, ?,"
+            + "?,"
+            + "?,"
+            + "?,"
+            + "?,"
+            + "?,"
+            + "?,"
+            + "?,"
+            + "?,"
+            + "?,"
+            + "?"
+            + ")";
 
     private static final String GET_NODEIDS = "select distinct nodeid from ODE_JOB";
 
-    private static final String SCHEDULE_IMMEDIATE = "select jobid, ts, transacted, scheduled, details from ODE_JOB "
+    private static final String SCHEDULE_IMMEDIATE = "select jobid, ts, transacted, scheduled, "
+        + "instanceId,"
+        + "mexId,"
+        + "processId,"
+        + "type,"
+        + "channel,"
+        + "correlatorId,"
+        + "correlationKey,"
+        + "retryCount,"
+        + "inMem,"
+        + "detailsExt"
+        + " from ODE_JOB "
             + "where nodeid = ? and scheduled = 0 and ts < ? order by ts";
 
+//  public Long instanceId;
+//  public String mexId;
+//  public String processId;
+//  public String type;
+//  public String channel;
+//  public String correlatorId;
+//  public String correlationKey;
+//  public Integer retryCount;
+//  public Boolean inMem;
+//  public Map<String, Object> detailsExt = new HashMap<String, Object>();    
+    
     private static final String UPDATE_SCHEDULED = "update ODE_JOB set scheduled = 1 where jobid in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
 
     private static final int UPDATE_SCHEDULED_SLOTS = 10;
@@ -131,21 +179,39 @@
         Connection con = null;
         PreparedStatement ps = null;
         try {
+            int i = 1;
             con = getConnection();
             ps = con.prepareStatement(SAVE_JOB);
-            ps.setString(1, job.jobId);
-            ps.setString(2, nodeId);
-            ps.setLong(3, job.schedDate);
-            ps.setInt(4, asInteger(loaded));
-            ps.setInt(5, asInteger(job.transacted));
-            ByteArrayOutputStream bos = new ByteArrayOutputStream();
-            try {
-                StreamUtils.write(bos, (Serializable) job.detail);
-            } catch (Exception ex) {
-                __log.error("Error serializing job detail: " + job.detail);
-                throw new DatabaseException(ex);
+            ps.setString(i++, job.jobId);
+            ps.setString(i++, nodeId);
+            ps.setLong(i++, job.schedDate);
+            ps.setInt(i++, asInteger(loaded));
+            ps.setInt(i++, asInteger(job.transacted));
+            
+            JobDetailsImpl details = (JobDetailsImpl) job.detail;
+            ps.setObject(i++, details.instanceId, Types.BIGINT);
+            ps.setObject(i++, details.mexId, Types.VARCHAR);
+            ps.setObject(i++, details.processId, Types.VARCHAR);
+            ps.setObject(i++, details.type, Types.VARCHAR);
+            ps.setObject(i++, details.channel, Types.VARCHAR);
+            ps.setObject(i++, details.correlatorId, Types.VARCHAR);
+            ps.setObject(i++, details.correlationKey, Types.VARCHAR);
+            ps.setObject(i++, details.retryCount, Types.INTEGER);
+            ps.setObject(i++, details.inMem, Types.INTEGER);
+            
+            if (details.detailsExt == null || details.detailsExt.size() == 0) {
+                ps.setObject(i++, null, Types.BLOB);
+            } else {
+                ByteArrayOutputStream bos = new ByteArrayOutputStream();
+                try {
+                    StreamUtils.write(bos, (Serializable) details.detailsExt);
+                } catch (Exception ex) {
+                    __log.error("Error serializing job detail: " + job.detail);
+                    throw new DatabaseException(ex);
+                }
+                ps.setBytes(i++, bos.toByteArray());
             }
-            ps.setBytes(6, bos.toByteArray());
+            
             return ps.executeUpdate() == 1;
         } catch (SQLException se) {
             throw new DatabaseException(se);
@@ -166,16 +232,29 @@
             ps.setString(1, nodeId);
             ps.setLong(2, maxtime);
             ps.setMaxRows(maxjobs);
+            
             ResultSet rs = ps.executeQuery();
             while (rs.next()) {
-                Map<String, Object> details;
-                try {
-                    ObjectInputStream is = new ObjectInputStream(rs.getBinaryStream(5));
-                    details = (Map<String, Object>) is.readObject();
-                    is.close();
-                } catch (Exception e) {
-                    throw new DatabaseException("Error deserializing job details", e);
+                Scheduler.JobDetailsImpl details = new Scheduler.JobDetailsImpl();
+                details.instanceId = (Long) rs.getObject("instanceId");
+                details.mexId = (String) rs.getObject("mexId");
+                details.processId = (String) rs.getObject("processId");
+                details.type = (String) rs.getObject("type");
+                details.channel = (String) rs.getObject("channel");
+                details.correlatorId = (String) rs.getObject("correlatorId");
+                details.correlationKey = (String) rs.getObject("correlationKey");
+                details.retryCount = (Integer) rs.getObject("retryCount");
+                details.inMem = (Boolean) rs.getObject("inMem");
+                if (rs.getObject("detailsExt") != null) {
+                    try {
+                        ObjectInputStream is = new ObjectInputStream(rs.getBinaryStream("detailsExt"));
+                        details.detailsExt = (Map<String, Object>) is.readObject();
+                        is.close();
+                    } catch (Exception e) {
+                        throw new DatabaseException("Error deserializing job detailsExt", e);
+                    }
                 }
+                
                 Job job = new Job(rs.getLong(2), rs.getString(1), asBoolean(rs.getInt(3)), details);
                 ret.add(job);
             }

Modified: ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java (original)
+++ ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/Job.java Mon Jun 29 13:06:40 2009
@@ -21,6 +21,7 @@
 
 import java.util.Map;
 
+import org.apache.ode.bpel.iapi.Scheduler.JobDetails;
 import org.apache.ode.utils.GUID;
 
 /**
@@ -31,14 +32,14 @@
 class Job extends Task {
     String jobId;
     boolean transacted;
-    Map<String,Object> detail;
+    JobDetails detail;
     boolean persisted = true;
 
-    public Job(long when, boolean transacted, Map<String, Object> jobDetail) {
+    public Job(long when, boolean transacted, JobDetails jobDetail) {
         this(when, new GUID().toString(),transacted,jobDetail);
     }
 
-    public Job(long when, String jobId, boolean transacted,Map<String, Object> jobDetail) {
+    public Job(long when, String jobId, boolean transacted, JobDetails jobDetail) {
         super(when);
         this.jobId = jobId;
         this.detail = jobDetail;

Modified: ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java (original)
+++ ode/trunk/scheduler-simple/src/main/java/org/apache/ode/scheduler/simple/SimpleScheduler.java Mon Jun 29 13:06:40 2009
@@ -29,11 +29,14 @@
 import javax.transaction.Synchronization;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
+import javax.xml.namespace.QName;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.ode.bpel.common.CorrelationKey;
 import org.apache.ode.bpel.iapi.ContextException;
 import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.ode.bpel.iapi.Scheduler.JobType;
 
 /**
  * A reliable and relatively simple scheduler that uses a database to persist information about scheduled tasks.
@@ -173,7 +176,7 @@
         }
     }
 
-    public String schedulePersistedJob(final Map<String, Object> jobDetail, Date when) throws ContextException {
+    public String schedulePersistedJob(final JobDetails jobDetail, Date when) throws ContextException {
         long ctime = System.currentTimeMillis();
         if (when == null)
             when = new Date(ctime);
@@ -189,9 +192,9 @@
         if (when == null)
             when = new Date(ctime);
 
-        Map<String, Object> jobDetails = new HashMap<String, Object>();
-        jobDetails.put("runnable", runnable);
-        runnable.storeToDetailsMap(jobDetails);
+        JobDetails jobDetails = new JobDetailsImpl();
+        jobDetails.getDetailsExt().put("runnable", runnable);
+        runnable.storeToDetails(jobDetails);
         
         if (__log.isDebugEnabled())
             __log.debug("scheduling " + jobDetails + " for " + when);
@@ -235,7 +238,7 @@
 
     }
 
-    public String scheduleVolatileJob(boolean transacted, Map<String, Object> jobDetail) throws ContextException {
+    public String scheduleVolatileJob(boolean transacted, JobDetails jobDetail) throws ContextException {
         Job job = new Job(System.currentTimeMillis(), transacted, jobDetail);
         job.persisted = false;
         addTodoOnCommit(job);
@@ -334,8 +337,7 @@
      *            job to run.
      */
     protected void runJob(final Job job) {
-        final Scheduler.JobInfo jobInfo = new Scheduler.JobInfo(job.jobId, job.detail,
-                (Integer)(job.detail.get("retry") != null ? job.detail.get("retry") : 0));
+        final Scheduler.JobInfo jobInfo = new Scheduler.JobInfo(job.jobId, job.detail, job.detail.getRetryCount());
 
         try {
             try {
@@ -501,9 +503,9 @@
     }
 
     private long doRetry(Job job) throws DatabaseException {
-        int retry = job.detail.get("retry") != null ? (((Integer)job.detail.get("retry")) + 1) : 0;
-        job.detail.put("retry", retry);
-        long delay = (long)(Math.pow(5, retry));
+        int retry = job.detail.getRetryCount() + 1;
+        job.detail.setRetryCount(retry);
+        long delay = (long)(Math.pow(5, retry - 1));
         Job jobRetry = new Job(System.currentTimeMillis() + delay*1000, true, job.detail);
         _db.insertJob(jobRetry, _nodeId, false);
         return delay;

Modified: ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/DelegateSupport.java
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/DelegateSupport.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/DelegateSupport.java (original)
+++ ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/DelegateSupport.java Mon Jun 29 13:06:40 2009
@@ -19,6 +19,7 @@
 
 package org.apache.ode.scheduler.simple;
 
+import java.io.InputStream;
 import java.sql.Connection;
 
 import org.apache.ode.utils.GUID;
@@ -52,9 +53,18 @@
     public void setup() throws Exception {
         Connection c = _ds.getConnection();
         try {
+            StringBuffer sql = new StringBuffer();
+
+            {
+                InputStream in = getClass().getResourceAsStream("/simplesched-hsql.sql");
+                int v;
+                while ((v = in.read()) != -1) {
+                    sql.append((char) v);
+                }
+            }
+            
             c.createStatement().executeUpdate("CREATE ALIAS MOD FOR \"org.apache.ode.scheduler.simple.DelegateSupport.mod\";");
-            String sql = "CREATE TABLE \"ODE_JOB\" (\"JOBID\" CHAR(64) NOT NULL, \"TS\" NUMERIC  NOT NULL, \"NODEID\" char(64)  NULL, \"SCHEDULED\" int  NOT NULL, \"TRANSACTED\" int  NOT NULL, \"DETAILS\" BINARY(4096)  NULL, PRIMARY KEY(\"JOBID\"));";
-            c.createStatement().executeUpdate(sql);
+            c.createStatement().executeUpdate(sql.toString());
         } finally {
             c.close();
         }

Modified: ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/JdbcDelegateTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/JdbcDelegateTest.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/JdbcDelegateTest.java (original)
+++ ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/JdbcDelegateTest.java Mon Jun 29 13:06:40 2009
@@ -22,6 +22,7 @@
 import java.util.HashMap;
 import java.util.List;
 
+import org.apache.ode.bpel.iapi.Scheduler;
 import org.apache.ode.scheduler.simple.DatabaseDelegate;
 import org.apache.ode.scheduler.simple.Job;
 
@@ -52,19 +53,19 @@
         assertEquals(0, nids.size());
         
         // try for one nodeid
-        _del.insertJob(new Job(0L,true,new HashMap<String, Object>()), "abc", true);
+        _del.insertJob(new Job(0L,true,new Scheduler.JobDetailsImpl()), "abc", true);
         nids = _del.getNodeIds();
         assertEquals(1, nids.size());
         assertTrue(nids.contains("abc"));
         
         // check that dups are ignored. 
-        _del.insertJob(new Job(0L,true,new HashMap<String, Object>()), "abc", true);    
+        _del.insertJob(new Job(0L,true,new Scheduler.JobDetailsImpl()), "abc", true);    
         nids = _del.getNodeIds();
         assertEquals(1, nids.size());
         assertTrue(nids.contains("abc"));
         
         // add another nodeid, 
-        _del.insertJob(new Job(0L,true,new HashMap<String, Object>()), "123", true);    
+        _del.insertJob(new Job(0L,true,new Scheduler.JobDetailsImpl()), "123", true);    
         nids = _del.getNodeIds();
         assertEquals(2, nids.size());
         assertTrue(nids.contains("abc"));        
@@ -72,8 +73,8 @@
     }
 
     public void testReassign() throws Exception {
-        _del.insertJob(new Job(100L,"j1",true,new HashMap<String, Object>()), "n1", false);
-        _del.insertJob(new Job(200L,"j2",true,new HashMap<String, Object>()), "n2", false);
+        _del.insertJob(new Job(100L,"j1",true,new Scheduler.JobDetailsImpl()), "n1", false);
+        _del.insertJob(new Job(200L,"j2",true,new Scheduler.JobDetailsImpl()), "n2", false);
         
         assertEquals(1,_del.updateReassign("n1","n2"));
         List<Job> jobs = _del.dequeueImmediate("n2", 400L, 1000);
@@ -81,8 +82,8 @@
     }
 
     public void testScheduleImmediateTimeFilter() throws Exception {
-        _del.insertJob(new Job(100L,"j1",true,new HashMap<String, Object>()), "n1", false);
-        _del.insertJob(new Job(200L,"j2",true,new HashMap<String, Object>()), "n1", false);
+        _del.insertJob(new Job(100L,"j1",true,new Scheduler.JobDetailsImpl()), "n1", false);
+        _del.insertJob(new Job(200L,"j2",true,new Scheduler.JobDetailsImpl()), "n1", false);
 
 
         List<Job> jobs = _del.dequeueImmediate("n1", 150L, 1000);
@@ -96,8 +97,8 @@
     }
     
     public void testScheduleImmediateMaxRows() throws Exception {
-        _del.insertJob(new Job(100L,"j1",true,new HashMap<String, Object>()), "n1", false);
-        _del.insertJob(new Job(200L,"j2",true,new HashMap<String, Object>()), "n1", false);
+        _del.insertJob(new Job(100L,"j1",true,new Scheduler.JobDetailsImpl()), "n1", false);
+        _del.insertJob(new Job(200L,"j2",true,new Scheduler.JobDetailsImpl()), "n1", false);
 
         List<Job> jobs = _del.dequeueImmediate("n1", 201L, 1);
         assertNotNull(jobs);
@@ -110,8 +111,8 @@
     }
 
     public void testScheduleImmediateNodeFilter() throws Exception {
-        _del.insertJob(new Job(100L,"j1",true,new HashMap<String, Object>()), "n1", false);
-        _del.insertJob(new Job(200L,"j2",true,new HashMap<String, Object>()), "n2", false);
+        _del.insertJob(new Job(100L,"j1",true,new Scheduler.JobDetailsImpl()), "n1", false);
+        _del.insertJob(new Job(200L,"j2",true,new Scheduler.JobDetailsImpl()), "n2", false);
 
         List<Job> jobs = _del.dequeueImmediate("n2", 300L, 1000);
         assertNotNull(jobs);
@@ -120,8 +121,8 @@
     }
 
     public void testDeleteJob() throws Exception {
-        _del.insertJob(new Job(100L,"j1",true,new HashMap<String, Object>()), "n1", false);
-        _del.insertJob(new Job(200L,"j2",true,new HashMap<String, Object>()), "n2", false);
+        _del.insertJob(new Job(100L,"j1",true,new Scheduler.JobDetailsImpl()), "n1", false);
+        _del.insertJob(new Job(200L,"j2",true,new Scheduler.JobDetailsImpl()), "n2", false);
         
         // try deleting, wrong jobid -- del should fail
         assertFalse(_del.deleteJob("j1x", "n1"));
@@ -138,7 +139,7 @@
     
     public void testUpgrade() throws Exception {
         for (int i = 0; i < 200; ++i)
-            _del.insertJob(new Job(i ,"j" +i,true,new HashMap<String, Object>()), null, false);
+            _del.insertJob(new Job(i ,"j" +i,true,new Scheduler.JobDetailsImpl()), null, false);
         
         int n1 = _del.updateAssignToNode("n1", 0, 3, 100);
         int n2 = _del.updateAssignToNode("n2", 1, 3, 100);

Modified: ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/RetriesTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/RetriesTest.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/RetriesTest.java (original)
+++ ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/RetriesTest.java Mon Jun 29 13:06:40 2009
@@ -1,6 +1,8 @@
 package org.apache.ode.scheduler.simple;
 
 import org.apache.ode.bpel.iapi.Scheduler;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 
 import javax.transaction.TransactionManager;
@@ -12,6 +14,8 @@
  * @author Matthieu Riou <mriou@apache.org>
  */
 public class RetriesTest extends TestCase implements Scheduler.JobProcessor {
+    private static final Log __log = LogFactory.getLog(RetriesTest.class);
+    
     DelegateSupport _ds;
     SimpleScheduler _scheduler;
     ArrayList<Scheduler.JobInfo> _jobs;
@@ -51,13 +55,19 @@
 
     public void onScheduledJob(Scheduler.JobInfo jobInfo) throws Scheduler.JobProcessorException {
         _tried++;
-        throw new Scheduler.JobProcessorException(jobInfo.retryCount < 2);
+        
+        if (jobInfo.retryCount < 2) {
+            __log.debug("retrying " + _tried);
+            throw new Scheduler.JobProcessorException(true);
+        } else {
+            __log.debug("completing " + _tried);
+        }
     }
 
-    Map<String, Object> newDetail(String x) {
-        HashMap<String, Object> det = new HashMap<String, Object>();
-        det.put("foo", x);
-        return det;
+    Scheduler.JobDetails newDetail(String x) {
+        Scheduler.JobDetails jd = new Scheduler.JobDetailsImpl();
+        jd.getDetailsExt().put("foo", x);
+        return jd;
     }
 
     private SimpleScheduler newScheduler(String nodeId) {

Modified: ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/SimpleSchedulerTest.java
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/SimpleSchedulerTest.java?rev=789315&r1=789314&r2=789315&view=diff
==============================================================================
--- ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/SimpleSchedulerTest.java (original)
+++ ode/trunk/scheduler-simple/src/test/java/org/apache/ode/scheduler/simple/SimpleSchedulerTest.java Mon Jun 29 13:06:40 2009
@@ -26,6 +26,7 @@
 import junit.framework.TestCase;
 
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
+import org.apache.ode.bpel.iapi.Scheduler;
 import org.apache.ode.bpel.iapi.Scheduler.JobInfo;
 import org.apache.ode.bpel.iapi.Scheduler.JobProcessor;
 import org.apache.ode.bpel.iapi.Scheduler.JobProcessorException;
@@ -196,7 +197,7 @@
 
         assertTrue(_jobs.size() <= 1);
         if (_jobs.size() == 1)
-            assertEquals("far", _jobs.get(0).jobDetail.get("foo"));
+            assertEquals("far", _jobs.get(0).jobDetail.getDetailsExt().get("foo"));
     }
 
     public void onScheduledJob(final JobInfo jobInfo) throws JobProcessorException {
@@ -205,10 +206,10 @@
         }
     }
 
-    Map<String, Object> newDetail(String x) {
-        HashMap<String, Object> det = new HashMap<String, Object>();
-        det.put("foo", x);
-        return det;
+    Scheduler.JobDetails newDetail(String x) {
+        Scheduler.JobDetails jd = new Scheduler.JobDetailsImpl();
+        jd.getDetailsExt().put("foo", x);
+        return jd;
     }
 
     private SimpleScheduler newScheduler(String nodeId) {
@@ -218,4 +219,4 @@
         return scheduler;
     }
     
-}
\ No newline at end of file
+}

Added: ode/trunk/scheduler-simple/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/test/resources/log4j.properties?rev=789315&view=auto
==============================================================================
--- ode/trunk/scheduler-simple/src/test/resources/log4j.properties (added)
+++ ode/trunk/scheduler-simple/src/test/resources/log4j.properties Mon Jun 29 13:06:40 2009
@@ -0,0 +1,28 @@
+#
+#    Licensed to the Apache Software Foundation (ASF) under one or more
+#    contributor license agreements.  See the NOTICE file distributed with
+#    this work for additional information regarding copyright ownership.
+#    The ASF licenses this file to You 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.
+#
+
+# Set root logger level to WARN and its only appender to CONSOLE
+log4j.rootLogger=WARN, CONSOLE
+
+# log4j properties to work with commandline tools.
+log4j.category.org.apache.ode.scheduler.simple.RetriesTest=DEBUG
+log4j.category.org.apache.ode.bpel.engine=INFO
+
+# Console appender
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n

Propchange: ode/trunk/scheduler-simple/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ode/trunk/scheduler-simple/src/test/resources/simplesched-hsql.sql
URL: http://svn.apache.org/viewvc/ode/trunk/scheduler-simple/src/test/resources/simplesched-hsql.sql?rev=789315&view=auto
==============================================================================
--- ode/trunk/scheduler-simple/src/test/resources/simplesched-hsql.sql (added)
+++ ode/trunk/scheduler-simple/src/test/resources/simplesched-hsql.sql Mon Jun 29 13:06:40 2009
@@ -0,0 +1,20 @@
+CREATE TABLE ode_job (
+  jobid CHAR(64)  NOT NULL,
+  ts BIGINT  NOT NULL,
+  nodeid char(64),
+  scheduled int  NOT NULL,
+  transacted int  NOT NULL,
+
+  instanceId BIGINT,
+  mexId varchar(255),
+  processId varchar(255),
+  type varchar(255),
+  channel varchar(255),
+  correlatorId varchar(255),
+  correlationKey varchar(255),
+  retryCount int,
+  inMem int,
+  detailsExt binary(4096),
+
+  PRIMARY KEY(jobid));
+

Propchange: ode/trunk/scheduler-simple/src/test/resources/simplesched-hsql.sql
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message