[jbpm-commits] JBoss JBPM SVN: r2111 - in jbpm4/pvm/trunk: modules/core and 12 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Sep 4 11:33:24 EDT 2008
Author: tom.baeyens at jboss.com
Date: 2008-09-04 11:33:24 -0400 (Thu, 04 Sep 2008)
New Revision: 2111
Modified:
jbpm4/pvm/trunk/modules/core/pom.xml
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ManagementService.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/GetMessagesCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/GetTimersCmd.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandManagementService.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/job/Job.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/job/JobTestHelper.java
jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/session/PvmDbSession.java
jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/HibernateJobDbSessionTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java
jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
jbpm4/pvm/trunk/pom.xml
jbpm4/pvm/trunk/readme.html
Log:
management service interface shaping
Modified: jbpm4/pvm/trunk/modules/core/pom.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/pom.xml 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/pom.xml 2008-09-04 15:33:24 UTC (rev 2111)
@@ -188,8 +188,8 @@
</configuration>
</execution>
</executions>
- </plugin>
- <plugin>
+ </plugin>
+ <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ManagementService.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ManagementService.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/ManagementService.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -23,11 +23,12 @@
import java.util.List;
+import org.jbpm.pvm.job.Job;
import org.jbpm.pvm.job.Message;
import org.jbpm.pvm.job.Timer;
-/** operations targetted to system operators that need to keep
+/** operations targeted to system operators that need to keep
* the process engine up and running. This functionality is typically
* exposed through a management web console.
*
@@ -35,6 +36,22 @@
*/
public interface ManagementService {
- List<Timer> getTimers();
- List<Message> getMessages();
+ /** all the messages which are waiting to be executed.
+ * Messages that are already acquired will not show up in the list. */
+ List<Message> getMessages(int firstResult, int maxResults);
+
+ /** all the timers which are waiting for their due date.
+ * Timers that are already acquired will not show up in the list. */
+ List<Timer> getTimers(int firstResult, int maxResults);
+
+ /** all jobs for which all the retry attempts have failed and
+ * which are parked, waiting for operator intervention */
+ List<Job> getJobsWithException(int firstResult, int maxResults);
+
+ /** resets the retry count, clears the exception and executes the job.
+ * An exception is thrown out of this method in case the execution
+ * of the job fails. In case the async command executor is configured
+ * for this service, failing job execution will not result into an
+ * exception coming out of this method. */
+ void executeJob(String jobId);
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/GetMessagesCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/GetMessagesCmd.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/GetMessagesCmd.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -31,12 +31,17 @@
/**
* @author Tom Baeyens
*/
-public class GetMessagesCmd implements Command<List<Message>> {
+public class GetMessagesCmd extends QueryCommand<List<Message>> {
private static final long serialVersionUID = 1L;
+ public GetMessagesCmd(int firstResult, int maxResults) {
+ super(firstResult, maxResults);
+ }
+
public List<Message> execute(Environment environment) throws Exception {
- return environment.get(PvmDbSession.class).findMessages();
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ return pvmDbSession.findMessages(firstResult, maxResults);
}
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/GetTimersCmd.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/GetTimersCmd.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/cmd/GetTimersCmd.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -30,12 +30,16 @@
/**
* @author Tom Baeyens
*/
-public class GetTimersCmd implements Command<List<Timer>> {
+public class GetTimersCmd extends QueryCommand<List<Timer>> {
private static final long serialVersionUID = 1L;
+ public GetTimersCmd(int firstResult, int maxResults) {
+ super(firstResult, maxResults);
+ }
+
public List<Timer> execute(Environment environment) throws Exception {
- return environment.get(PvmDbSession.class).findTimers();
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ return pvmDbSession.findTimers(firstResult, maxResults);
}
-
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -96,18 +96,27 @@
return (ClientExecution) query.uniqueResult();
}
- public List<Timer> findTimers() {
+ public List<Timer> findTimers(int firstResult, int maxResults) {
// query definition can be found at the bottom of resource org/jbpm/pvm/hibernate.job.hbm.xml
- return session.getNamedQuery("findTimers").list();
+ Query query = session.getNamedQuery("findTimers");
+ query.setFirstResult(firstResult);
+ query.setMaxResults(maxResults);
+ return query.list();
}
- public List<Message> findMessages() {
+ public List<Message> findMessages(int firstResult, int maxResults) {
// query definition can be found at the bottom of resource org/jbpm/pvm/hibernate.job.hbm.xml
- return session.getNamedQuery("findMessages").list();
+ Query query = session.getNamedQuery("findMessages");
+ query.setFirstResult(firstResult);
+ query.setMaxResults(maxResults);
+ return query.list();
}
- public List<Job> findDeadJobs() {
+ public List<Job> findJobsWithException(int firstResult, int maxResults) {
// query definition can be found at the bottom of resource org/jbpm/pvm/hibernate.job.hbm.xml
- return session.getNamedQuery("findDeadJobs").list();
+ Query query = session.getNamedQuery("findJobsWithException");
+ query.setFirstResult(firstResult);
+ query.setMaxResults(maxResults);
+ return query.list();
}
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/spring/SpringEnvironment.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -21,11 +21,6 @@
*/
package org.jbpm.pvm.internal.spring;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jbpm.pvm.env.Context;
import org.jbpm.pvm.env.EnvironmentFactory;
import org.jbpm.pvm.env.SpringEnvironmentFactory;
import org.jbpm.pvm.internal.env.BasicEnvironment;
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandManagementService.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandManagementService.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/svc/CommandManagementService.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -27,6 +27,7 @@
import org.jbpm.pvm.internal.cmd.CommandService;
import org.jbpm.pvm.internal.cmd.GetMessagesCmd;
import org.jbpm.pvm.internal.cmd.GetTimersCmd;
+import org.jbpm.pvm.job.Job;
import org.jbpm.pvm.job.Message;
import org.jbpm.pvm.job.Timer;
@@ -38,12 +39,21 @@
protected CommandService commandService;
- public List<Message> getMessages() {
- return commandService.execute(new GetMessagesCmd());
+ public void executeJob(String jobId) {
+ // TODO
}
- public List<Timer> getTimers() {
- return commandService.execute(new GetTimersCmd());
+ public List<Job> getJobsWithException(int firstResult, int maxResults) {
+ // TODO
+ return null;
}
+ public List<Message> getMessages(int firstResult, int maxResults) {
+ return commandService.execute(new GetMessagesCmd(firstResult, maxResults));
+ }
+
+ public List<Timer> getTimers(int firstResult, int maxResults) {
+ return commandService.execute(new GetTimersCmd(firstResult, maxResults));
+ }
+
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/job/Job.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/job/Job.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/job/Job.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -23,7 +23,7 @@
import java.util.Date;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.Execution;
/** base class for timers and messages.
*
@@ -45,9 +45,9 @@
boolean isExclusive();
- ExecutionImpl getExecution();
+ Execution getExecution();
- ExecutionImpl getProcessInstance();
+ Execution getProcessInstance();
Date getLockExpirationTime();
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/job/JobTestHelper.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/job/JobTestHelper.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/job/JobTestHelper.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -57,7 +57,6 @@
Long messageDbid = (Long) query.uniqueResult();
ExecuteJobCmd executeJobCommand = new ExecuteJobCmd(messageDbid);
Job job = executeJobCommand.execute(environment);
- job.getExecution().getNode().getName();
return job.getExecution();
}
});
Modified: jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/session/PvmDbSession.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/session/PvmDbSession.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/session/PvmDbSession.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -59,12 +59,12 @@
Execution findExecutionByKey(String processDefinitionName, String executionKey);
/** timers */
- List<Timer> findTimers();
+ List<Timer> findTimers(int firstResult, int maxResults);
/** timers */
- List<Message> findMessages();
+ List<Message> findMessages(int firstResult, int maxResults);
/** the jobs for which all the retries have failed and which will not be
* picked up any more by the jobImpl executor */
- public List<Job> findDeadJobs();
+ public List<Job> findJobsWithException(int firstResult, int maxResults);
}
Modified: jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/main/resources/org/jbpm/pvm/hibernate.job.hbm.xml 2008-09-04 15:33:24 UTC (rev 2111)
@@ -22,11 +22,13 @@
<property name="retries" column="RETRIES_" />
<many-to-one name="processInstance"
+ class="org.jbpm.pvm.internal.model.ExecutionImpl"
column="PROCESSINSTANCE_"
cascade="none"
foreign-key="FK_JOB_PRINST"
index="IDX_JOB_PRINST"/>
- <many-to-one name="execution"
+ <many-to-one name="execution"
+ class="org.jbpm.pvm.internal.model.ExecutionImpl"
column="EXECUTION_"
cascade="none"
foreign-key="FK_JOB_EXE"
@@ -77,7 +79,7 @@
]]>
</query>
- <query name="findDeadJobs">
+ <query name="findJobsWithException">
<![CDATA[
select job
from org.jbpm.pvm.internal.job.JobImpl as job
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/db/svc/ManagementServiceTest.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -33,8 +33,8 @@
public void testGetJobs() {
ManagementService managementService = getEnvironmentFactory().get(ManagementService.class);
- assertEquals(0, managementService.getTimers().size());
- assertEquals(0, managementService.getMessages().size());
+ assertEquals(0, managementService.getTimers(0, 10).size());
+ assertEquals(0, managementService.getMessages(0, 10).size());
}
}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/api/timer/TimerIntegrationTest.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -151,7 +151,7 @@
assertNull(child);
// check that timers have been deleted
- List<Timer> timers = Environment.getCurrent().get(PvmDbSession.class).findTimers();
+ List<Timer> timers = Environment.getCurrent().get(PvmDbSession.class).findTimers(0, 10);
assertNotNull(timers);
assertTrue(timers.isEmpty());
@@ -185,7 +185,7 @@
assertNull(child);
// check that timers have been deleted
- List<Timer> timers = Environment.getCurrent().get(PvmDbSession.class).findTimers();
+ List<Timer> timers = Environment.getCurrent().get(PvmDbSession.class).findTimers(0, 10);
assertNotNull(timers);
assertTrue(timers.isEmpty());
@@ -294,7 +294,7 @@
assertNull(child);
// check that timers have been deleted
- List<Timer> timers = Environment.getCurrent().get(PvmDbSession.class).findTimers();
+ List<Timer> timers = Environment.getCurrent().get(PvmDbSession.class).findTimers(0, 10);
assertNotNull(timers);
assertTrue(timers.isEmpty());
@@ -331,7 +331,7 @@
assertNull(child);
// check that timers have been deleted
- List<Timer> timers = Environment.getCurrent().get(PvmDbSession.class).findTimers();
+ List<Timer> timers = Environment.getCurrent().get(PvmDbSession.class).findTimers(0, 10);
assertNotNull(timers);
assertTrue(timers.isEmpty());
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/HibernateJobDbSessionTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/HibernateJobDbSessionTest.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/db/model/HibernateJobDbSessionTest.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -53,8 +53,11 @@
private void cleanTimers() {
ManagementService pvmService = Environment.getCurrent().get(ManagementService.class);
JobDbSession jobDbSession = Environment.getCurrent().get(JobDbSession.class);
- for (Timer jobImpl : pvmService.getTimers()) {
- jobDbSession.delete(jobImpl);
+ List<Timer> timers = pvmService.getTimers(0, 10);
+ while (! timers.isEmpty()) {
+ for (Timer timer : timers) {
+ jobDbSession.delete(timer);
+ }
}
}
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorIsolationDbTest.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -61,11 +61,11 @@
MessageSession messageSession = environment.get(MessageSession.class);
CommandMessage commandMessage = new CommandMessage(new ObjectDescriptor(SimpleTestCommand.class));
messageSession.send(commandMessage);
- List<Message> messages = environment.get(PvmDbSession.class).findMessages();
+ List<Message> messages = environment.get(PvmDbSession.class).findMessages(0, 10);
assertNotNull(messages);
assertEquals(1, messages.size());
Thread.sleep(jobExecutorTimeoutMillis * 2);
- messages = environment.get(PvmDbSession.class).findMessages();
+ messages = environment.get(PvmDbSession.class).findMessages(0, 10);
assertNotNull(messages);
assertEquals("Job has been executed before the transaction is committed !!", 1, messages.size());
return null;
Modified: jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java
===================================================================
--- jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/modules/core/src/test/java/org/jbpm/pvm/internal/jobexecutor/JobExecutorTest.java 2008-09-04 15:33:24 UTC (rev 2111)
@@ -197,8 +197,8 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) throws Exception {
PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- List<Job> deadJobs = pvmDbSession.findDeadJobs();
- assertEquals("there should be one dead jobImpl", 1, deadJobs.size());
+ List<Job> deadJobs = pvmDbSession.findJobsWithException(0, 10);
+ assertEquals("there should be one dead job", 1, deadJobs.size());
Session session = environment.get(Session.class);
List commands = session.createQuery("from org.jbpm.pvm.internal.model.CommentImpl").list();
@@ -235,7 +235,7 @@
commandService.execute(new Command<Object>() {
public Object execute(Environment environment) throws Exception {
PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- List<Job> deadJobs = pvmDbSession.findDeadJobs();
+ List<Job> deadJobs = pvmDbSession.findJobsWithException(0, 10);
assertEquals("there should be one dead jobImpl", 1, deadJobs.size());
return null;
}
Modified: jbpm4/pvm/trunk/pom.xml
===================================================================
--- jbpm4/pvm/trunk/pom.xml 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/pom.xml 2008-09-04 15:33:24 UTC (rev 2111)
@@ -313,6 +313,7 @@
<quiet>true</quiet>
<source>1.5</source>
<verbose>false</verbose>
+ <noqualifier>all</noqualifier>
<excludePackageNames>*.internal:*.test</excludePackageNames>
</configuration>
</plugin>
Modified: jbpm4/pvm/trunk/readme.html
===================================================================
--- jbpm4/pvm/trunk/readme.html 2008-09-04 15:07:29 UTC (rev 2110)
+++ jbpm4/pvm/trunk/readme.html 2008-09-04 15:33:24 UTC (rev 2111)
@@ -5,6 +5,14 @@
need <a href="http://maven.apache.org/download.html">maven 2.0.9</a>
</p>
+<h2>Eclipse</h2>
+<p>File <code>eclipse/jbpmprofile.xml</code> contains the code formatting
+profile for this codebase. To add to your list of profiles in your eclipse
+installation, go to <b>Window</b> --> <b>Preferences</b> --> <b>Java</b> -->
+<b>Code Style</b> --> <b>Formatter</b>. Then click the "Import" button and
+point to the file <code>eclipse/jbpmprofile.xml</code>.
+</p>
+
<h2>Build the jar</h2>
<code>mvn -DskipTests clean package</code>
More information about the jbpm-commits
mailing list