[jbpm-commits] JBoss JBPM SVN: r5147 - in jbpm4/trunk/modules/integration/console/src/main: resources/META-INF/services and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Mon Jun 29 07:00:18 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-06-29 07:00:18 -0400 (Mon, 29 Jun 2009)
New Revision: 5147
Added:
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessEnginePluginImpl.java
jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.ProcessEnginePlugin
Removed:
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/DeploymentPluginImpl.java
jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.DeploymentPlugin
Modified:
jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
Log:
Rename deployment plugin to process engine plugin. Changes to the model adaptor for managing jobs
Deleted: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/DeploymentPluginImpl.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/DeploymentPluginImpl.java 2009-06-29 10:20:29 UTC (rev 5146)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/DeploymentPluginImpl.java 2009-06-29 11:00:18 UTC (rev 5147)
@@ -1,128 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.integration.console;
-
-import org.jboss.bpm.console.client.model.DeploymentRef;
-import org.jboss.bpm.console.server.plugin.DeploymentPlugin;
-import org.jbpm.api.*;
-import org.jbpm.pvm.internal.env.EnvironmentFactory;
-import org.jbpm.pvm.internal.env.Environment;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class DeploymentPluginImpl extends JBPMIntegration
- implements DeploymentPlugin
-{
-
- public DeploymentPluginImpl()
- {
- initializeProcessEngine();
- }
-
- public List<DeploymentRef> getDeployments()
- {
- List<DeploymentRef> results = new ArrayList<DeploymentRef>();
-
- Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
-
- try
- {
- RepositoryService repositoryService = this.processEngine.getRepositoryService();
- DeploymentQuery dquery = repositoryService.createDeploymentQuery();
-
- List<Deployment> dpls = dquery.list();
-
- for(Deployment dpl : dpls)
- {
- DeploymentRef ref = ModelAdaptor.adoptDeployment(dpl);
-
- // active processes
- ProcessDefinitionQuery pdQuery = repositoryService.createProcessDefinitionQuery();
- pdQuery.deploymentId(dpl.getId());
- List<ProcessDefinition> activePds = pdQuery.list();
-
- for(ProcessDefinition p : activePds)
- {
- ref.getDefinitions().add(p.getId());
- }
-
- // suspended processes
- ProcessDefinitionQuery pdQuery2 = repositoryService.createProcessDefinitionQuery();
- pdQuery2.deploymentId(dpl.getId());
- pdQuery2.suspended();
- List<ProcessDefinition> suspendedPds = pdQuery2.list();
-
- for(ProcessDefinition p : suspendedPds)
- {
- ref.getDefinitions().add(p.getId());
- }
-
- results.add(ref);
- }
-
- return results;
- }
- finally
- {
- env.close();
- }
- }
-
- public void deleteDeployment(String id)
- {
- Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
-
- try
- {
- RepositoryService repositoryService = this.processEngine.getRepositoryService();
- repositoryService.deleteDeploymentCascade(id);
- }
- finally
- {
- env.close();
- }
-
- }
-
- public void setSuspended(String id, boolean isSuspended)
- {
- Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
-
- try
- {
- RepositoryService repositoryService = this.processEngine.getRepositoryService();
- if(isSuspended)
- repositoryService.suspendDeployment(id);
- else
- repositoryService.resumeDeployment(id);
- }
- finally
- {
- env.close();
- }
-
- }
-}
Modified: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-06-29 10:20:29 UTC (rev 5146)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-06-29 11:00:18 UTC (rev 5147)
@@ -24,6 +24,7 @@
import org.jboss.bpm.console.client.model.*;
import org.jbpm.api.Deployment;
import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.job.Job;
import org.jbpm.api.task.Participation;
import org.jbpm.api.task.Task;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -188,4 +189,20 @@
return dRef;
}
+
+ public static JobRef adoptJob(Job j)
+ {
+ JobRef job = new JobRef();
+ job.setId(String.valueOf(j.getId()));
+ if(j.getDueDate()!=null)
+ {
+ job.setTimestamp(j.getDueDate().getTime());
+ }
+ if(j.getException()!=null)
+ {
+ job.setErrMsg(j.getException());
+ }
+
+ return job;
+ }
}
Copied: jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessEnginePluginImpl.java (from rev 5124, jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/DeploymentPluginImpl.java)
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessEnginePluginImpl.java (rev 0)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ProcessEnginePluginImpl.java 2009-06-29 11:00:18 UTC (rev 5147)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.integration.console;
+
+import org.jboss.bpm.console.client.model.DeploymentRef;
+import org.jboss.bpm.console.client.model.JobRef;
+import org.jboss.bpm.console.server.plugin.ProcessEnginePlugin;
+import org.jbpm.api.*;
+import org.jbpm.api.job.Job;
+import org.jbpm.pvm.internal.env.EnvironmentFactory;
+import org.jbpm.pvm.internal.env.Environment;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class ProcessEnginePluginImpl extends JBPMIntegration
+ implements ProcessEnginePlugin
+{
+
+ public ProcessEnginePluginImpl()
+ {
+ initializeProcessEngine();
+ }
+
+ public List<DeploymentRef> getDeployments()
+ {
+ List<DeploymentRef> results = new ArrayList<DeploymentRef>();
+
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ DeploymentQuery dquery = repositoryService.createDeploymentQuery();
+
+ List<Deployment> dpls = dquery.list();
+
+ for(Deployment dpl : dpls)
+ {
+ DeploymentRef ref = ModelAdaptor.adoptDeployment(dpl);
+
+ // active processes
+ ProcessDefinitionQuery pdQuery = repositoryService.createProcessDefinitionQuery();
+ pdQuery.deploymentId(dpl.getId());
+ List<ProcessDefinition> activePds = pdQuery.list();
+
+ for(ProcessDefinition p : activePds)
+ {
+ ref.getDefinitions().add(p.getId());
+ }
+
+ // suspended processes
+ ProcessDefinitionQuery pdQuery2 = repositoryService.createProcessDefinitionQuery();
+ pdQuery2.deploymentId(dpl.getId());
+ pdQuery2.suspended();
+ List<ProcessDefinition> suspendedPds = pdQuery2.list();
+
+ for(ProcessDefinition p : suspendedPds)
+ {
+ ref.getDefinitions().add(p.getId());
+ }
+
+ results.add(ref);
+ }
+
+ return results;
+ }
+ finally
+ {
+ env.close();
+ }
+ }
+
+ public void deleteDeployment(String id)
+ {
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ repositoryService.deleteDeploymentCascade(id);
+ }
+ finally
+ {
+ env.close();
+ }
+
+ }
+
+ public void suspendDeployment(String id, boolean isSuspended)
+ {
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+ RepositoryService repositoryService = this.processEngine.getRepositoryService();
+ if(isSuspended)
+ repositoryService.suspendDeployment(id);
+ else
+ repositoryService.resumeDeployment(id);
+ }
+ finally
+ {
+ env.close();
+ }
+
+ }
+
+ public List<JobRef> getJobs()
+ {
+ List<JobRef> results = new ArrayList<JobRef>();
+
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+ ManagementService mgmtService = this.processEngine.getManagementService();
+
+ // jobs
+ JobQuery timerQuery = mgmtService.createJobQuery();
+ timerQuery.timers();
+ List<Job> timers = timerQuery.list();
+ for(Job t : timers)
+ {
+ JobRef ref = ModelAdaptor.adoptJob(t);
+ ref.setType("timer");
+ results.add(ref);
+ }
+
+ // messages
+ JobQuery msgQuery= mgmtService.createJobQuery();
+ msgQuery.messages();
+ List<Job> msgs = msgQuery.list();
+ for(Job t : msgs)
+ {
+ JobRef ref = ModelAdaptor.adoptJob(t);
+ ref.setType("message");
+ results.add(ref);
+ }
+ }
+ finally
+ {
+ env.close();
+ }
+
+ return results;
+ }
+
+
+ public void executeJob(String jobId)
+ {
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
+
+ try
+ {
+ ManagementService mgmtService = this.processEngine.getManagementService();
+ mgmtService.executeJob(jobId);
+ }
+ finally
+ {
+ env.close();
+ }
+ }
+}
Deleted: jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.DeploymentPlugin
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.DeploymentPlugin 2009-06-29 10:20:29 UTC (rev 5146)
+++ jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.DeploymentPlugin 2009-06-29 11:00:18 UTC (rev 5147)
@@ -1 +0,0 @@
-org.jbpm.integration.console.DeploymentPluginImpl
\ No newline at end of file
Copied: jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.ProcessEnginePlugin (from rev 5124, jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.DeploymentPlugin)
===================================================================
--- jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.ProcessEnginePlugin (rev 0)
+++ jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.ProcessEnginePlugin 2009-06-29 11:00:18 UTC (rev 5147)
@@ -0,0 +1 @@
+org.jbpm.integration.console.ProcessEnginePluginImpl
\ No newline at end of file
More information about the jbpm-commits
mailing list