JBoss JBPM SVN: r5076 - in jbpm4/trunk/modules/integration/console/src/main: resources/META-INF/services and 1 other directory.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-06-22 09:50:05 -0400 (Mon, 22 Jun 2009)
New Revision: 5076
Added:
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:
DeploymentPlugin for the console, first cut
Added: 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 (rev 0)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/DeploymentPluginImpl.java 2009-06-22 13:50:05 UTC (rev 5076)
@@ -0,0 +1,84 @@
+/*
+ * 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.Deployment;
+import org.jbpm.api.RepositoryService;
+import org.jbpm.api.DeploymentQuery;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.env.EnvironmentFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)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)
+ {
+ results.add( ModelAdaptor.adoptDeployment(dpl) );
+ }
+
+ return results;
+ }
+ finally
+ {
+ env.close();
+ }
+
+
+ }
+
+ public void deleteDeployment(String id)
+ {
+
+ }
+
+ public void setSuspended(String id, boolean isSuspended)
+ {
+
+ }
+}
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-22 13:40:41 UTC (rev 5075)
+++ jbpm4/trunk/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-06-22 13:50:05 UTC (rev 5076)
@@ -21,25 +21,21 @@
*/
package org.jbpm.integration.console;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
-import org.jboss.bpm.console.client.model.ParticipantRef;
-import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
-import org.jboss.bpm.console.client.model.ProcessInstanceRef;
-import org.jboss.bpm.console.client.model.TaskRef;
-import org.jboss.bpm.console.client.model.TokenReference;
-import org.jbpm.api.Execution;
+import org.jboss.bpm.console.client.model.*;
+import org.jbpm.api.Deployment;
import org.jbpm.api.ProcessDefinition;
-import org.jbpm.api.model.OpenExecution;
import org.jbpm.api.model.Transition;
import org.jbpm.api.task.Participation;
import org.jbpm.api.task.Task;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
*/
@@ -165,4 +161,14 @@
return task;
}
+
+ public static DeploymentRef adoptDeployment(Deployment dpl)
+ {
+ DeploymentImpl d0 = (DeploymentImpl)dpl;
+ DeploymentRef dRef = new DeploymentRef(
+ String.valueOf(dpl.getDbid()), d0.isSuspended()
+ );
+
+ return dRef;
+ }
}
Added: 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 (rev 0)
+++ jbpm4/trunk/modules/integration/console/src/main/resources/META-INF/services/org.jboss.bpm.console.server.plugin.DeploymentPlugin 2009-06-22 13:50:05 UTC (rev 5076)
@@ -0,0 +1 @@
+org.jbpm.integration.console.DeploymentPluginImpl
\ No newline at end of file
16 years, 10 months
JBoss JBPM SVN: r5075 - jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-06-22 09:40:41 -0400 (Mon, 22 Jun 2009)
New Revision: 5075
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java
Log:
Lookup jboss user tx and fallback to default JEE JNDI name
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java 2009-06-22 12:39:57 UTC (rev 5074)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransaction.java 2009-06-22 13:40:41 UTC (rev 5075)
@@ -37,6 +37,7 @@
*/
public class JtaTransaction implements Transaction {
+ protected String jbossUserTransactionJndiName = "UserTransaction";
protected String userTransactionJndiName = "java:comp/UserTransaction";
protected String transactionManagerJndiName = "java:/TransactionManager";
@@ -107,7 +108,20 @@
// lookups //////////////////////////////////////////////////////////////////
public UserTransaction lookupJeeUserTransaction() {
- return (UserTransaction) lookupFromJndi(userTransactionJndiName);
+ Object tx;
+
+ try
+ {
+ // non jee context, i.e. JBPMDeployer (jboss only)
+ tx = lookupFromJndi(jbossUserTransactionJndiName);
+ }
+ catch (JbpmException e)
+ {
+ // jee components
+ tx = lookupFromJndi(userTransactionJndiName);
+ }
+
+ return (UserTransaction) tx;
}
public javax.transaction.Transaction lookupJeeTransaction() {
16 years, 10 months
JBoss JBPM SVN: r5074 - in jbpm4/trunk/modules: pvm/src/main/java/org/jbpm/pvm/internal/ant and 6 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-22 08:39:57 -0400 (Mon, 22 Jun 2009)
New Revision: 5074
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/NewDeployment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateDeploymentQueryCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/DeploymentQueryImpl.java
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/DeploymentQueryTest.java
Removed:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/RepositoryService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/RepositorySession.java
Log:
JBPM-2342 added deployment querying
Deleted: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.api;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.zip.ZipInputStream;
-
-/**
- * @author Tom Baeyens
- */
-public interface Deployment {
-
- long getDbid();
-
- String getName();
- Deployment setName(String name);
-
- long getTimestamp();
- Deployment setTimestamp(long timestamp);
-
- Deployment addResourceFromString(String resourceName, String string);
- Deployment addResourceFromInputStream(String resourceName, InputStream inputStream);
- Deployment addResourceFromClasspath(String resourceName);
- Deployment addResourceFromUrl(URL url);
- Deployment addResourcesFromZipInputStream(ZipInputStream zipInputStream);
- Deployment addResourceFromFile(File file);
-
- /** @return deploymentId */
- long deploy();
-}
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.api;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface Deployment {
+
+ String STATE_ACTIVE = "active";
+ String STATE_SUSPENDED = "suspended";
+
+ long getDbid();
+
+ String getName();
+
+ long getTimestamp();
+
+ String getState();
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.api;
+
+import java.util.List;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface DeploymentQuery {
+
+ String PROPERTY_NAME = "name";
+ String PROPERTY_TIMESTAMP = "timestamp";
+ String PROPERTY_STATE = "state";
+
+ DeploymentQuery deploymentDbid(long dbid);
+ DeploymentQuery suspended();
+ DeploymentQuery active();
+
+ DeploymentQuery orderAsc(String property);
+ DeploymentQuery orderDesc(String property);
+
+ DeploymentQuery page(int firstResult, int maxResults);
+
+ List<Deployment> list();
+ Deployment uniqueResult();
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/DeploymentQuery.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/NewDeployment.java (from rev 5069, jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/Deployment.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/NewDeployment.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/NewDeployment.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.api;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.zip.ZipInputStream;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface NewDeployment extends Deployment {
+
+ NewDeployment setName(String name);
+ NewDeployment setTimestamp(long timestamp);
+ NewDeployment addResourceFromString(String resourceName, String string);
+ NewDeployment addResourceFromInputStream(String resourceName, InputStream inputStream);
+ NewDeployment addResourceFromClasspath(String resourceName);
+ NewDeployment addResourceFromUrl(URL url);
+ NewDeployment addResourcesFromZipInputStream(ZipInputStream zipInputStream);
+ NewDeployment addResourceFromFile(File file);
+
+ /** @return deploymentId */
+ long deploy();
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/NewDeployment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/RepositoryService.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/RepositoryService.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/RepositoryService.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -31,7 +31,7 @@
*/
public interface RepositoryService {
- Deployment createDeployment();
+ NewDeployment createDeployment();
void suspendDeployment(long deploymentDbid);
void resumeDeployment(long deploymentDbid);
@@ -48,6 +48,7 @@
InputStream getResourceAsStream(long deploymentDbid, String resourceName);
ProcessDefinitionQuery createProcessDefinitionQuery();
+ DeploymentQuery createDeploymentQuery();
ActivityCoordinates getActivityCoordinates(String processDefinitionId, String activityName);
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -33,7 +33,7 @@
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.FileSet;
-import org.jbpm.api.Deployment;
+import org.jbpm.api.NewDeployment;
import org.jbpm.api.ProcessEngine;
import org.jbpm.api.RepositoryService;
@@ -85,7 +85,7 @@
protected void deployFile(ProcessEngine processEngine, File processFile) {
RepositoryService repositoryService = processEngine.getRepositoryService();
- Deployment deployment = repositoryService.createDeployment();
+ NewDeployment deployment = repositoryService.createDeployment();
deployment.setName(processFile.getName());
deployment.setTimestamp(System.currentTimeMillis());
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateDeploymentQueryCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateDeploymentQueryCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateDeploymentQueryCmd.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.cmd;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
+import org.jbpm.pvm.internal.query.JobQueryImpl;
+import org.jbpm.pvm.internal.session.DbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CreateDeploymentQueryCmd implements Command<DeploymentQueryImpl> {
+
+ private static final long serialVersionUID = 1L;
+
+ public DeploymentQueryImpl execute(Environment environment) throws Exception {
+ return environment.get(DbSession.class).createDeploymentQuery();
+ }
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/CreateDeploymentQueryCmd.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/DbSessionImpl.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -41,13 +41,12 @@
import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
import org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl;
import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
import org.jbpm.pvm.internal.query.JobQueryImpl;
-import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
import org.jbpm.pvm.internal.query.ProcessInstanceQueryImpl;
import org.jbpm.pvm.internal.session.DbSession;
-import org.jbpm.pvm.internal.svc.DefaultCommandService;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.task.TaskQueryImpl;
import org.jbpm.pvm.internal.util.Clock;
@@ -436,4 +435,8 @@
public JobQueryImpl createJobQuery() {
return new JobQueryImpl();
}
+
+ public DeploymentQueryImpl createDeploymentQuery() {
+ return new DeploymentQueryImpl();
+ }
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/DeploymentQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/DeploymentQueryImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/DeploymentQueryImpl.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.query;
+
+import java.util.List;
+
+import org.hibernate.Query;
+import org.jbpm.api.Deployment;
+import org.jbpm.api.DeploymentQuery;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentQueryImpl extends AbstractQuery implements DeploymentQuery {
+
+ protected Long deploymentDbid = null;
+ protected String state = null;
+
+ public String hql() {
+ StringBuilder hql = new StringBuilder();
+ hql.append("select d ");
+ hql.append("from ");
+ hql.append(DeploymentImpl.class.getName());
+ hql.append(" as d ");
+
+ if (deploymentDbid!=null) {
+ appendWhereClause("d.dbid = "+deploymentDbid+" ", hql);
+ }
+
+ if (state!=null) {
+ appendWhereClause(" d.state = '"+state+"' ", hql);
+ }
+
+ return hql.toString();
+ }
+
+ protected void applyParameters(Query query) {
+ }
+
+ public DeploymentQuery deploymentDbid(long deploymentDbid) {
+ this.deploymentDbid = deploymentDbid;
+ return this;
+ }
+
+ public DeploymentQuery active() {
+ this.state = Deployment.STATE_ACTIVE;
+ return this;
+ }
+
+ public DeploymentQuery suspended() {
+ this.state = Deployment.STATE_SUSPENDED;
+ return this;
+ }
+
+ public DeploymentQuery orderAsc(String property) {
+ addOrderByClause("d."+property+" asc");
+ return this;
+ }
+
+ public DeploymentQuery orderDesc(String property) {
+ addOrderByClause("d."+property+" desc");
+ return this;
+ }
+
+ public DeploymentQuery page(int firstResult, int maxResults) {
+ this.page = new Page(firstResult, maxResults);
+ return this;
+ }
+
+ public List<Deployment> list() {
+ return untypedList();
+ }
+
+ public Deployment uniqueResult() {
+ return (Deployment) untypedUniqueResult();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/DeploymentQueryImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/JobQueryImpl.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -103,7 +103,7 @@
}
public JobQuery orderDesc(String property) {
- addOrderByClause("j."+property+" asc");
+ addOrderByClause("j."+property+" desc");
return this;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -27,6 +27,7 @@
import org.hibernate.Query;
import org.hibernate.Session;
+import org.jbpm.api.Deployment;
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.ProcessDefinitionQuery;
import org.jbpm.api.env.Environment;
@@ -90,9 +91,9 @@
hql.append(" as versionProperty ");
if (suspended) {
- appendWhereClause("deployment.state = '"+DeploymentImpl.STATE_SUSPENDED+"'", hql);
+ appendWhereClause("deployment.state = '"+Deployment.STATE_SUSPENDED+"'", hql);
} else {
- appendWhereClause("deployment.state != '"+DeploymentImpl.STATE_SUSPENDED+"'", hql);
+ appendWhereClause("deployment.state != '"+Deployment.STATE_SUSPENDED+"'", hql);
}
appendWhereClause("idProperty.key = '"+DeploymentImpl.KEY_PROCESS_DEFINITION_ID+"'", hql);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -36,6 +36,7 @@
import java.util.zip.ZipInputStream;
import org.jbpm.api.Deployment;
+import org.jbpm.api.NewDeployment;
import org.jbpm.api.JbpmException;
import org.jbpm.api.cmd.CommandService;
import org.jbpm.api.env.Environment;
@@ -55,13 +56,10 @@
/**
* @author Tom Baeyens
*/
-public class DeploymentImpl extends ProblemList implements Deployment, Serializable {
+public class DeploymentImpl extends ProblemList implements NewDeployment, Serializable {
private static final long serialVersionUID = 1L;
- public static final String STATE_ACTIVE = "active";
- public static final String STATE_SUSPENDED = "suspended";
-
public static final String KEY_PROCESS_DEFINITION_ID = "pdid";
public static final String KEY_PROCESS_DEFINITION_KEY = "pdkey";
public static final String KEY_PROCESS_DEFINITION_VERSION = "pdversion";
@@ -69,7 +67,7 @@
protected long dbid;
protected String name;
protected long timestamp;
- protected String state = STATE_ACTIVE;
+ protected String state = Deployment.STATE_ACTIVE;
protected Map<String, Lob> resources;
protected CommandService commandService;
@@ -91,17 +89,17 @@
return commandService.execute(new DeployCmd(this));
}
- public Deployment addResourceFromClasspath(String resourceName) {
+ public NewDeployment addResourceFromClasspath(String resourceName) {
addResourceFromStreamInput(resourceName, new ResourceStreamInput(resourceName));
return this;
}
- public Deployment addResourceFromString(String resourceName, String text) {
+ public NewDeployment addResourceFromString(String resourceName, String text) {
addResourceFromStreamInput(resourceName, new StringStreamInput(text));
return this;
}
- public Deployment addResourcesFromZipInputStream(ZipInputStream zipInputStream) {
+ public NewDeployment addResourcesFromZipInputStream(ZipInputStream zipInputStream) {
try {
ZipEntry zipEntry = zipInputStream.getNextEntry();
while(zipEntry!=null) {
@@ -118,22 +116,22 @@
return this;
}
- public Deployment addResourceFromInputStream(String resourceName, InputStream inputStream) {
+ public NewDeployment addResourceFromInputStream(String resourceName, InputStream inputStream) {
addResourceFromStreamInput(resourceName, new InputStreamInput(inputStream));
return this;
}
- public Deployment addResourceFromUrl(URL url) {
+ public NewDeployment addResourceFromUrl(URL url) {
addResourceFromStreamInput(url.toString(), new UrlStreamInput(url));
return this;
}
- public Deployment addResourceFromFile(File file) {
+ public NewDeployment addResourceFromFile(File file) {
addResourceFromStreamInput(file.getPath(), new FileStreamInput(file));
return this;
}
- public Deployment addResourceFromStreamInput(String name, StreamInput streamInput) {
+ public NewDeployment addResourceFromStreamInput(String name, StreamInput streamInput) {
if (resources==null) {
resources = new HashMap<String, Lob>();
}
@@ -254,7 +252,7 @@
if (repositorySession!=null) {
repositorySession.cascadeDeploymentSuspend(this);
}
- state = STATE_SUSPENDED;
+ state = Deployment.STATE_SUSPENDED;
}
public void resume() {
@@ -265,11 +263,11 @@
if (repositorySession!=null) {
repositorySession.cascadeDeploymentResume(this);
}
- state = STATE_ACTIVE;
+ state = Deployment.STATE_ACTIVE;
}
public boolean isSuspended() {
- return STATE_SUSPENDED.equals(state);
+ return Deployment.STATE_SUSPENDED.equals(state);
}
protected Object writeReplace() throws ObjectStreamException {
@@ -300,4 +298,7 @@
this.timestamp = timestamp;
return this;
}
+ public String getState() {
+ return state;
+ }
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -24,17 +24,20 @@
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import org.jbpm.api.Deployment;
+import org.jbpm.api.DeploymentQuery;
+import org.jbpm.api.NewDeployment;
import org.jbpm.api.ProcessDefinitionQuery;
import org.jbpm.api.RepositoryService;
import org.jbpm.api.cmd.CommandService;
import org.jbpm.api.model.ActivityCoordinates;
+import org.jbpm.pvm.internal.cmd.CreateDeploymentQueryCmd;
import org.jbpm.pvm.internal.cmd.CreateProcessDefinitionQueryCmd;
import org.jbpm.pvm.internal.cmd.DeleteDeploymentCmd;
import org.jbpm.pvm.internal.cmd.GetActivityCoordinates;
import org.jbpm.pvm.internal.cmd.GetResourceAsStreamCmd;
import org.jbpm.pvm.internal.cmd.ResumeDeploymentCmd;
import org.jbpm.pvm.internal.cmd.SuspendDeploymentCmd;
+import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
/**
@@ -44,7 +47,7 @@
CommandService commandService;
- public Deployment createDeployment() {
+ public NewDeployment createDeployment() {
return new DeploymentImpl(commandService);
}
@@ -78,6 +81,12 @@
return query;
}
+ public DeploymentQuery createDeploymentQuery() {
+ DeploymentQueryImpl query = commandService.execute(new CreateDeploymentQueryCmd());
+ query.setCommandService(commandService);
+ return query;
+ }
+
public ActivityCoordinates getActivityCoordinates(String processDefinitionId, String activityName) {
return commandService.execute(new GetActivityCoordinates(processDefinitionId, activityName));
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -28,7 +28,7 @@
import org.hibernate.Query;
import org.hibernate.Session;
-import org.jbpm.api.Deployment;
+import org.jbpm.api.NewDeployment;
import org.jbpm.api.JbpmException;
import org.jbpm.api.Problem;
import org.jbpm.api.ProcessDefinition;
@@ -50,7 +50,7 @@
protected RepositoryCache repositoryCache;
protected DeployerManager deployerManager;
- public long deploy(Deployment deployment) {
+ public long deploy(NewDeployment deployment) {
DeploymentImpl deploymentImpl = (DeploymentImpl) deployment;
session.save(deploymentImpl);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/DbSession.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -29,6 +29,7 @@
import org.jbpm.api.task.Task;
import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.query.DeploymentQueryImpl;
import org.jbpm.pvm.internal.query.HistoryActivityInstanceQueryImpl;
import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
import org.jbpm.pvm.internal.query.JobQueryImpl;
@@ -79,6 +80,9 @@
/** create a process instance query */
JobQueryImpl createJobQuery();
+
+ /** create a deployment query */
+ DeploymentQueryImpl createDeploymentQuery();
/** the execution uniquely identified by the given executionKey.
* this method doesn't 'see' suspended executions. */
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/RepositorySession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/RepositorySession.java 2009-06-22 11:36:16 UTC (rev 5073)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/session/RepositorySession.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.session;
-import org.jbpm.api.Deployment;
+import org.jbpm.api.NewDeployment;
import org.jbpm.api.client.ClientProcessDefinition;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
@@ -31,7 +31,7 @@
*/
public interface RepositorySession {
- long deploy(Deployment deployment);
+ long deploy(NewDeployment deployment);
Object getObject(long deploymentDbid, String objectName);
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/DeploymentQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/DeploymentQueryTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/DeploymentQueryTest.java 2009-06-22 12:39:57 UTC (rev 5074)
@@ -0,0 +1,132 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.deploy;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.Deployment;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentQueryTest extends JbpmTestCase {
+
+ public void testSuspendDeployment() {
+ long deploymentClaimDbid = repositoryService
+ .createDeployment()
+ .setName("Claim")
+ .addResourceFromString("process.jpdl.xml",
+ "<process name='claim'>" +
+ " <start>" +
+ " <transition to='c' />" +
+ " </start>" +
+ " <state name='c' />" +
+ "</process>"
+ )
+ .deploy();
+
+ long deploymentHireDbid = repositoryService
+ .createDeployment()
+ .setName("Hire")
+ .addResourceFromString("process.jpdl.xml",
+ "<process name='hire'>" +
+ " <start>" +
+ " <transition to='h' />" +
+ " </start>" +
+ " <state name='h' />" +
+ "</process>"
+ )
+ .deploy();
+
+ long deploymentFireDbid = repositoryService
+ .createDeployment()
+ .setName("Fire")
+ .addResourceFromString("process.jpdl.xml",
+ "<process name='fire'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <state name='f' />" +
+ "</process>"
+ )
+ .deploy();
+
+ repositoryService.suspendDeployment(deploymentHireDbid);
+
+
+ // find all deployments
+
+ List<Deployment> deployments = repositoryService
+ .createDeploymentQuery()
+ .list();
+
+ Set<String> expectedDeploymentNames = new HashSet<String>();
+ expectedDeploymentNames.add("Claim");
+ expectedDeploymentNames.add("Hire");
+ expectedDeploymentNames.add("Fire");
+
+ assertEquals(expectedDeploymentNames, getDeploymentNames(deployments));
+
+ // find suspended deployments
+
+ deployments = repositoryService
+ .createDeploymentQuery()
+ .suspended()
+ .list();
+
+ expectedDeploymentNames = new HashSet<String>();
+ expectedDeploymentNames.add("Hire");
+
+ assertEquals(expectedDeploymentNames, getDeploymentNames(deployments));
+
+ // find active deployments
+
+ deployments = repositoryService
+ .createDeploymentQuery()
+ .active()
+ .list();
+
+ expectedDeploymentNames = new HashSet<String>();
+ expectedDeploymentNames.add("Claim");
+ expectedDeploymentNames.add("Fire");
+
+ assertEquals(expectedDeploymentNames, getDeploymentNames(deployments));
+
+ repositoryService.deleteDeploymentCascade(deploymentClaimDbid);
+ repositoryService.deleteDeploymentCascade(deploymentHireDbid);
+ repositoryService.deleteDeploymentCascade(deploymentFireDbid);
+ }
+
+ Set<String> getDeploymentNames(List<Deployment> deployments) {
+ Set<String> deploymentNames = new HashSet<String>();
+ for (Deployment deployment: deployments) {
+ deploymentNames.add(deployment.getName());
+ }
+ return deploymentNames;
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/DeploymentQueryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
16 years, 10 months
JBoss JBPM SVN: r5073 - jbpm4/trunk.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-06-22 07:36:16 -0400 (Mon, 22 Jun 2009)
New Revision: 5073
Modified:
jbpm4/trunk/pom.xml
Log:
switch to console snapshot
Modified: jbpm4/trunk/pom.xml
===================================================================
--- jbpm4/trunk/pom.xml 2009-06-22 11:18:53 UTC (rev 5072)
+++ jbpm4/trunk/pom.xml 2009-06-22 11:36:16 UTC (rev 5073)
@@ -47,7 +47,7 @@
<apache.ant.version>1.7.0</apache.ant.version>
<cactus.version>13-1.7.1</cactus.version>
<freemarker.version>2.3.15</freemarker.version>
- <gwt.console.version>1.0.0.CR1</gwt.console.version>
+ <gwt.console.version>1.0.0-SNAPSHOT</gwt.console.version>
<jbpm.gpd.version>4.0.0-SNAPSHOT</jbpm.gpd.version>
<hibernate.version>3.3.1.GA</hibernate.version>
<slf4j.version>1.5.2</slf4j.version>
16 years, 10 months
JBoss JBPM SVN: r5072 - jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-06-22 07:18:53 -0400 (Mon, 22 Jun 2009)
New Revision: 5072
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java
Log:
JBPM-2339 JBPM-2322 added support for existing JTA transactions in jboss configuration
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java 2009-06-22 11:14:05 UTC (rev 5071)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/tx/jta/JtaTransactionInterceptor.java 2009-06-22 11:18:53 UTC (rev 5072)
@@ -53,6 +53,10 @@
}
log.debug("jta transaction status: "+JtaStatusHelper.toString(status));
+ if (status == Status.STATUS_ACTIVE) {
+ return executeInExistingTx(command);
+ }
+
if ( (status != Status.STATUS_NO_TRANSACTION)
&& (status != Status.STATUS_COMMITTED)
&& (status != Status.STATUS_ROLLEDBACK)
@@ -60,6 +64,14 @@
throw new JbpmException("invalid transaction state: "+JtaStatusHelper.toString(status));
}
+ return executeInNewTx(command, jtaTransaction, status);
+ }
+
+ protected <T> T executeInExistingTx(Command<T> command) {
+ return next.execute(command);
+ }
+
+ protected <T> T executeInNewTx(Command<T> command, JtaTransaction jtaTransaction, int status) {
Transaction suspendedTransaction = null;
if ((status == Status.STATUS_COMMITTED) || (status == Status.STATUS_ROLLEDBACK)) {
suspendedTransaction = jtaTransaction.suspend();
@@ -87,5 +99,5 @@
return (T) returnValue;
}
-
+
}
16 years, 10 months
JBoss JBPM SVN: r5071 - in projects/gwt-console/trunk: server/server-core/src/main/java/org/jboss/bpm/console/server and 2 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-06-22 07:14:05 -0400 (Mon, 22 Jun 2009)
New Revision: 5071
Added:
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java
projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRefWrapper.java
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/DeploymentPlugin.java
Modified:
projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java
Log:
Start work on deployment editor
Added: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRef.java 2009-06-22 11:14:05 UTC (rev 5071)
@@ -0,0 +1,72 @@
+/*
+ * 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.jboss.bpm.console.client.model;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class DeploymentRef
+{
+ private String id;
+
+ private boolean suspended;
+
+ private List<ProcessDefinitionRef> definitions = new ArrayList<ProcessDefinitionRef>();
+
+ public DeploymentRef()
+ {
+ }
+
+ public DeploymentRef(String id, boolean suspended)
+ {
+ this.id = id;
+ this.suspended = suspended;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(String id)
+ {
+ this.id = id;
+ }
+
+ public boolean isSuspended()
+ {
+ return suspended;
+ }
+
+ public void setSuspended(boolean suspended)
+ {
+ this.suspended = suspended;
+ }
+
+ public List<ProcessDefinitionRef> getDefinitions()
+ {
+ return definitions;
+ }
+}
Added: projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRefWrapper.java
===================================================================
--- projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRefWrapper.java (rev 0)
+++ projects/gwt-console/trunk/rpc/src/main/java/org/jboss/bpm/console/client/model/DeploymentRefWrapper.java 2009-06-22 11:14:05 UTC (rev 5071)
@@ -0,0 +1,60 @@
+/*
+ * 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.jboss.bpm.console.client.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@XmlRootElement(name = "wrapper")
+public class DeploymentRefWrapper
+{
+ List<DeploymentRef> deployments = new ArrayList<DeploymentRef>();
+
+
+ public DeploymentRefWrapper()
+ {
+ }
+
+ public DeploymentRefWrapper(List<DeploymentRef> deployments)
+ {
+ this.deployments = deployments;
+ }
+
+ public List<DeploymentRef> getDeployments()
+ {
+ return deployments;
+ }
+
+ public void setDeployments(List<DeploymentRef> deployments)
+ {
+ this.deployments = deployments;
+ }
+
+ public int getTotalCount()
+ {
+ return deployments.size();
+ }
+}
Modified: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2009-06-22 10:35:34 UTC (rev 5070)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/ConsoleServerApplication.java 2009-06-22 11:14:05 UTC (rev 5071)
@@ -44,6 +44,7 @@
singletons.add(new TaskMgmtFacade());
singletons.add(new UserMgmtFacade());
singletons.add(new TestFacade());
+ singletons.add(new DeploymentFacade());
singletons.add( new ReportFacade() );
}
Added: projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java
===================================================================
--- projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java (rev 0)
+++ projects/gwt-console/trunk/server/server-core/src/main/java/org/jboss/bpm/console/server/DeploymentFacade.java 2009-06-22 11:14:05 UTC (rev 5071)
@@ -0,0 +1,92 @@
+/*
+ * 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.jboss.bpm.console.server;
+
+import org.jboss.bpm.console.server.gson.GsonFactory;
+import org.jboss.bpm.console.server.plugin.DeploymentPlugin;
+import org.jboss.bpm.console.server.plugin.PluginMgr;
+import org.jboss.bpm.console.server.integration.ManagementFactory;
+import org.jboss.bpm.console.client.model.DeploymentRef;
+import org.jboss.bpm.console.client.model.DeploymentRefWrapper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.ws.rs.Path;
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import com.google.gson.Gson;
+
+import java.util.List;
+
+/**
+ * Manage process deployments
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+@Path("repository")
+public class DeploymentFacade
+{
+ private static final Log log = LogFactory.getLog(DeploymentFacade.class);
+
+ private DeploymentPlugin deploymentPlugin;
+
+ private DeploymentPlugin getDeploymentPlugin()
+ {
+ if(null==this.deploymentPlugin)
+ {
+ this.deploymentPlugin = PluginMgr.load(DeploymentPlugin.class);
+ }
+
+ return this.deploymentPlugin;
+ }
+
+ @GET
+ @Path("deployments")
+ @Produces("application/json")
+ public Response getDeployments()
+ {
+
+ DeploymentPlugin dplPlugin = getDeploymentPlugin();
+ if(deploymentPlugin!=null)
+ {
+ List<DeploymentRef> dpls = dplPlugin.getDeployments();
+ return createJsonResponse(
+ new DeploymentRefWrapper(dpls)
+ );
+ }
+ else
+ {
+ log.error("DeploymentPlugin not available");
+ return Response.serverError().build();
+ }
+
+ }
+
+ private Response createJsonResponse(Object wrapper)
+ {
+ Gson gson = GsonFactory.createInstance();
+ String json = gson.toJson(wrapper);
+ return Response.ok(json).type("application/json").build();
+ }
+}
Modified: projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java
===================================================================
--- projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java 2009-06-22 10:35:34 UTC (rev 5070)
+++ projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java 2009-06-22 11:14:05 UTC (rev 5071)
@@ -49,4 +49,5 @@
public abstract TaskManagement createTaskManagement();
public abstract UserManagement createUserManagement();
+
}
Added: projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/DeploymentPlugin.java
===================================================================
--- projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/DeploymentPlugin.java (rev 0)
+++ projects/gwt-console/trunk/server/server-integration/src/main/java/org/jboss/bpm/console/server/plugin/DeploymentPlugin.java 2009-06-22 11:14:05 UTC (rev 5071)
@@ -0,0 +1,38 @@
+/*
+ * 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.jboss.bpm.console.server.plugin;
+
+import org.jboss.bpm.console.client.model.DeploymentRef;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public interface DeploymentPlugin
+{
+ List<DeploymentRef> getDeployments();
+
+ void deleteDeployment(String id);
+
+ void setSuspended(String id, boolean isSuspended);
+}
16 years, 10 months
JBoss JBPM SVN: r5070 - in jbpm4/trunk/modules/test-db: src/test/java and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2009-06-22 06:35:34 -0400 (Mon, 22 Jun 2009)
New Revision: 5070
Added:
jbpm4/trunk/modules/test-db/src/test/java/reporting/
jbpm4/trunk/modules/test-db/src/test/java/reporting/DOMUtils.java
jbpm4/trunk/modules/test-db/src/test/java/reporting/SQLStmtTest.java
Modified:
jbpm4/trunk/modules/test-db/pom.xml
Log:
Add reporting SQL statement tests
Modified: jbpm4/trunk/modules/test-db/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-db/pom.xml 2009-06-19 17:26:38 UTC (rev 5069)
+++ jbpm4/trunk/modules/test-db/pom.xml 2009-06-22 10:35:34 UTC (rev 5070)
@@ -53,6 +53,12 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-console-reports</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
@@ -102,16 +108,16 @@
<configuration>
<tasks>
<copy file="../../qa/jdbc/${database}.properties"
- tofile="target/jdbc.properties" />
+ tofile="target/test-classes/jdbc.properties" />
<copy file="${user.home}/.jbpm4/jdbc/${database}.properties"
- tofile="target/jdbc.properties"
+ tofile="target/test-classes/jdbc.properties"
overwrite="true"
failonerror="true "/>
<copy file="../../modules/distro/src/main/files/db/hibernate.cfg/${database}.hibernate.cfg.xml"
tofile="target/test-classes/jbpm.hibernate.cfg.xml"
overwrite="true">
<filterset>
- <filtersfile file="target/jdbc.properties" />
+ <filtersfile file="target/test-classes/jdbc.properties" />
</filterset>
</copy>
<replace file="target/test-classes/jbpm.hibernate.cfg.xml">
Added: jbpm4/trunk/modules/test-db/src/test/java/reporting/DOMUtils.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/reporting/DOMUtils.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/reporting/DOMUtils.java 2009-06-22 10:35:34 UTC (rev 5070)
@@ -0,0 +1,706 @@
+/*
+ * 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 reporting;
+
+import org.w3c.dom.*;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import java.io.*;
+import java.util.*;
+
+/**
+ * DOM2 utilites
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @author alessio.soldano(a)jboss.com
+ */
+public final class DOMUtils
+{
+
+ // All elements created by the same thread are created by the same builder and belong to the same doc
+ private static ThreadLocal<Document> documentThreadLocal = new ThreadLocal<Document>();
+ private static ThreadLocal<DocumentBuilder> builderThreadLocal = new ThreadLocal<DocumentBuilder>()
+ {
+ protected DocumentBuilder initialValue()
+ {
+ try
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ setEntityResolver(builder);
+ return builder;
+ }
+ catch (ParserConfigurationException e)
+ {
+ throw new RuntimeException("Failed to create DocumentBuilder", e);
+ }
+ }
+
+ private void setEntityResolver(DocumentBuilder builder)
+ {
+ String[] resolvers = new String[] { "org.jboss.ws.core.utils.JBossWSEntityResolver", "org.jboss.util.xml.JBossEntityResolver" };
+
+ EntityResolver entityResolver = null;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ for (String resolver : resolvers)
+ {
+ try
+ {
+ Class<?> resolverClass = loader.loadClass(resolver);
+ entityResolver = (EntityResolver)resolverClass.newInstance();
+ }
+ catch (Exception ex)
+ {
+ //
+ }
+ }
+
+ if (entityResolver != null)
+ builder.setEntityResolver(entityResolver);
+ }
+ };
+
+ public static void clearThreadLocals()
+ {
+ documentThreadLocal.remove();
+ builderThreadLocal.remove();
+ }
+
+ // Hide the constructor
+ private DOMUtils()
+ {
+ }
+
+ /** Initialize the DocumentBuilder
+ */
+ public static DocumentBuilder getDocumentBuilder()
+ {
+ return builderThreadLocal.get();
+ }
+
+ /** Parse the given XML string and return the root Element
+ */
+ public static Element parse(String xmlString) throws IOException
+ {
+ try
+ {
+ return parse(new ByteArrayInputStream(xmlString.getBytes("UTF-8")));
+ }
+ catch (IOException e)
+ {
+ throw e;
+ }
+ }
+
+ /** Parse the given XML stream and return the root Element
+ */
+ public static Element parse(InputStream xmlStream) throws IOException
+ {
+ try
+ {
+ return getDocumentBuilder().parse(xmlStream).getDocumentElement();
+ }
+ catch (SAXException se)
+ {
+ throw new IOException(se.toString());
+ }
+ finally
+ {
+ xmlStream.close();
+ }
+ }
+
+ /** Parse the given input source and return the root Element
+ */
+ public static Element parse(InputSource source) throws IOException
+ {
+ try
+ {
+ return getDocumentBuilder().parse(source).getDocumentElement();
+ }
+ catch (SAXException se)
+ {
+ throw new IOException(se.toString());
+ }
+ finally
+ {
+ InputStream is = source.getByteStream();
+ if (is != null)
+ {
+ is.close();
+ }
+ Reader r = source.getCharacterStream();
+ if (r != null)
+ {
+ r.close();
+ }
+ }
+ }
+
+ /** Create an Element for a given name
+ */
+ public static Element createElement(String localPart)
+ {
+ Document doc = getOwnerDocument();
+ return doc.createElement(localPart);
+ }
+
+ /** Create an Element for a given name and prefix
+ */
+ public static Element createElement(String localPart, String prefix)
+ {
+ Document doc = getOwnerDocument();
+ return doc.createElement(prefix + ":" + localPart);
+ }
+
+ /** Create an Element for a given name, prefix and uri
+ */
+ public static Element createElement(String localPart, String prefix, String uri)
+ {
+ Document doc = getOwnerDocument();
+ if (prefix == null || prefix.length() == 0)
+ {
+ return doc.createElementNS(uri, localPart);
+ }
+ else
+ {
+ return doc.createElementNS(uri, prefix + ":" + localPart);
+ }
+ }
+
+ /** Create an Element for a given QName
+ */
+ public static Element createElement(QName qname)
+ {
+ return createElement(qname.getLocalPart(), qname.getPrefix(), qname.getNamespaceURI());
+ }
+
+ /** Create a org.w3c.dom.Text node
+ */
+ public static Text createTextNode(String value)
+ {
+ Document doc = getOwnerDocument();
+ return doc.createTextNode(value);
+ }
+
+ /** Get the qname of the given node.
+ */
+ public static QName getElementQName(Element el)
+ {
+ String qualifiedName = el.getNodeName();
+ return resolveQName(el, qualifiedName);
+ }
+
+ /** Transform the given qualified name into a QName
+ */
+ public static QName resolveQName(Element el, String qualifiedName)
+ {
+ QName qname;
+ String prefix = "";
+ String namespaceURI = "";
+ String localPart = qualifiedName;
+
+ int colIndex = qualifiedName.indexOf(":");
+ if (colIndex > 0)
+ {
+ prefix = qualifiedName.substring(0, colIndex);
+ localPart = qualifiedName.substring(colIndex + 1);
+
+ if ("xmlns".equals(prefix))
+ {
+ namespaceURI = "URI:XML_PREDEFINED_NAMESPACE";
+ }
+ else
+ {
+ Element nsElement = el;
+ while (namespaceURI.equals("") && nsElement != null)
+ {
+ namespaceURI = nsElement.getAttribute("xmlns:" + prefix);
+ if (namespaceURI.equals(""))
+ nsElement = getParentElement(nsElement);
+ }
+ }
+
+ if (namespaceURI.equals(""))
+ throw new IllegalArgumentException("Cannot find namespace uri for: " + qualifiedName);
+ }
+ else
+ {
+ Element nsElement = el;
+ while (namespaceURI.equals("") && nsElement != null)
+ {
+ namespaceURI = nsElement.getAttribute("xmlns");
+ if (namespaceURI.equals(""))
+ nsElement = getParentElement(nsElement);
+ }
+ }
+
+ qname = new QName(namespaceURI, localPart, prefix);
+ return qname;
+ }
+
+ /** Get the value from the given attribute
+ *
+ * @return null if the attribute value is empty or the attribute is not present
+ */
+ public static String getAttributeValue(Element el, String attrName)
+ {
+ return getAttributeValue(el, new QName(attrName));
+ }
+
+ /** Get the value from the given attribute
+ *
+ * @return null if the attribute value is empty or the attribute is not present
+ */
+ public static String getAttributeValue(Element el, QName attrName)
+ {
+ String attr = null;
+ if ("".equals(attrName.getNamespaceURI()))
+ attr = el.getAttribute(attrName.getLocalPart());
+ else attr = el.getAttributeNS(attrName.getNamespaceURI(), attrName.getLocalPart());
+
+ if ("".equals(attr))
+ attr = null;
+
+ return attr;
+ }
+
+ /** Get the qname value from the given attribute
+ */
+ public static QName getAttributeValueAsQName(Element el, String attrName)
+ {
+ return getAttributeValueAsQName(el, new QName(attrName));
+
+ }
+
+ /** Get the qname value from the given attribute
+ */
+ public static QName getAttributeValueAsQName(Element el, QName attrName)
+ {
+ QName qname = null;
+
+ String qualifiedName = getAttributeValue(el, attrName);
+ if (qualifiedName != null)
+ {
+ qname = resolveQName(el, qualifiedName);
+ }
+
+ return qname;
+ }
+
+ /** Get the boolean value from the given attribute
+ */
+ public static boolean getAttributeValueAsBoolean(Element el, String attrName)
+ {
+ return getAttributeValueAsBoolean(el, new QName(attrName));
+ }
+
+ /** Get the boolean value from the given attribute
+ */
+ public static boolean getAttributeValueAsBoolean(Element el, QName attrName)
+ {
+ String attrVal = getAttributeValue(el, attrName);
+ boolean ret = "true".equalsIgnoreCase(attrVal) || "1".equalsIgnoreCase(attrVal);
+ return ret;
+ }
+
+ /** Get the integer value from the given attribute
+ */
+ public static Integer getAttributeValueAsInteger(Element el, String attrName)
+ {
+ return getAttributeValueAsInteger(el, new QName(attrName));
+ }
+
+ /** Get the integer value from the given attribute
+ */
+ public static Integer getAttributeValueAsInteger(Element el, QName attrName)
+ {
+ String attrVal = getAttributeValue(el, attrName);
+ return (attrVal != null ? new Integer(attrVal) : null);
+ }
+
+ /** Get the attributes as Map<QName, String>
+ */
+ public static Map getAttributes(Element el)
+ {
+ Map attmap = new HashMap();
+ NamedNodeMap attribs = el.getAttributes();
+ for (int i = 0; i < attribs.getLength(); i++)
+ {
+ Attr attr = (Attr)attribs.item(i);
+ String name = attr.getName();
+ QName qname = resolveQName(el, name);
+ String value = attr.getNodeValue();
+ attmap.put(qname, value);
+ }
+ return attmap;
+ }
+
+ /** Copy attributes between elements
+ */
+ public static void copyAttributes(Element destElement, Element srcElement)
+ {
+ NamedNodeMap attribs = srcElement.getAttributes();
+ for (int i = 0; i < attribs.getLength(); i++)
+ {
+ Attr attr = (Attr)attribs.item(i);
+ String uri = attr.getNamespaceURI();
+ String qname = attr.getName();
+ String value = attr.getNodeValue();
+
+ // Prevent DOMException: NAMESPACE_ERR: An attempt is made to create or
+ // change an object in a way which is incorrect with regard to namespaces.
+ if (uri == null && qname.startsWith("xmlns"))
+ {
+ //
+ }
+ else
+ {
+ destElement.setAttributeNS(uri, qname, value);
+ }
+ }
+ }
+
+ /** True if the node has text child elements only
+ */
+ public static boolean hasTextChildNodesOnly(Node node)
+ {
+ NodeList nodeList = node.getChildNodes();
+ if (nodeList.getLength() == 0)
+ return false;
+
+ for (int i = 0; i < nodeList.getLength(); i++)
+ {
+ Node acksToChildNode = nodeList.item(i);
+ if (acksToChildNode.getNodeType() != Node.TEXT_NODE)
+ return false;
+ }
+
+ return true;
+ }
+
+ /** True if the node has child elements
+ */
+ public static boolean hasChildElements(Node node)
+ {
+ NodeList nlist = node.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node child = nlist.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE)
+ return true;
+ }
+ return false;
+ }
+
+ /** Gets child elements
+ */
+ public static Iterator<Element> getChildElements(Node node)
+ {
+ List<Element> list = new LinkedList<Element>();
+ NodeList nlist = node.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node child = nlist.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE)
+ list.add((Element)child);
+ }
+ return list.iterator();
+ }
+
+ /** Get the concatenated text content, or null.
+ */
+ public static String getTextContent(Node node)
+ {
+ boolean hasTextContent = false;
+ StringBuffer buffer = new StringBuffer();
+ NodeList nlist = node.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node child = nlist.item(i);
+ if (child.getNodeType() == Node.TEXT_NODE)
+ {
+ buffer.append(child.getNodeValue());
+ hasTextContent = true;
+ }
+ }
+ return (hasTextContent ? buffer.toString() : null);
+ }
+
+ /** Gets the first child element
+ */
+ public static Element getFirstChildElement(Node node)
+ {
+ return getFirstChildElement(node, false);
+ }
+
+ /** Gets the first child element
+ */
+ public static Element getFirstChildElement(Node node, boolean recursive)
+ {
+ return getFirstChildElementIntern(node, null, recursive);
+ }
+
+ /** Gets the first child element for a given local name without namespace
+ */
+ public static Element getFirstChildElement(Node node, String nodeName)
+ {
+ return getFirstChildElement(node, nodeName, false);
+ }
+
+ /** Gets the first child element for a given local name without namespace
+ */
+ public static Element getFirstChildElement(Node node, String nodeName, boolean recursive)
+ {
+ return getFirstChildElementIntern(node, new QName(nodeName), recursive);
+ }
+
+ /** Gets the first child element for a given qname
+ */
+ public static Element getFirstChildElement(Node node, QName nodeName)
+ {
+ return getFirstChildElement(node, nodeName, false);
+ }
+
+ /** Gets the first child element for a given qname
+ */
+ public static Element getFirstChildElement(Node node, QName nodeName, boolean recursive)
+ {
+ return getFirstChildElementIntern(node, nodeName, recursive);
+ }
+
+ private static Element getFirstChildElementIntern(Node node, QName nodeName, boolean recursive)
+ {
+ Element childElement = null;
+ Iterator it = getChildElementsIntern(node, nodeName, recursive);
+ if (it.hasNext())
+ {
+ childElement = (Element)it.next();
+ }
+ return childElement;
+ }
+
+ /** Gets the child elements for a given local name without namespace
+ */
+ public static Iterator getChildElements(Node node, String nodeName)
+ {
+ return getChildElements(node, nodeName, false);
+ }
+
+ /** Gets the child elements for a given local name without namespace
+ */
+ public static Iterator getChildElements(Node node, String nodeName, boolean recursive)
+ {
+ return getChildElementsIntern(node, new QName(nodeName), recursive);
+ }
+
+ /** Gets the child element for a given qname
+ */
+ public static Iterator getChildElements(Node node, QName nodeName)
+ {
+ return getChildElements(node, nodeName, false);
+ }
+
+ /** Gets the child element for a given qname
+ */
+ public static Iterator getChildElements(Node node, QName nodeName, boolean recursive)
+ {
+ return getChildElementsIntern(node, nodeName, recursive);
+ }
+
+ public static List<Element> getChildElementsAsList(Node node, String nodeName)
+ {
+ return getChildElementsAsList(node, nodeName, false);
+ }
+
+ public static List<Element> getChildElementsAsList(Node node, String nodeName, boolean recursive)
+ {
+ return getChildElementsAsListIntern(node, new QName(nodeName), recursive);
+ }
+
+ public static List<Element> getChildElementsAsList(Node node, QName nodeName)
+ {
+ return getChildElementsAsList(node, nodeName, false);
+ }
+
+ public static List<Element> getChildElementsAsList(Node node, QName nodeName, boolean recursive)
+ {
+ return getChildElementsAsListIntern(node, nodeName, recursive);
+ }
+
+ private static List<Element> getChildElementsAsListIntern(Node node, QName nodeName, boolean recursive)
+ {
+ List<Element> list = new LinkedList<Element>();
+ NodeList nlist = node.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node child = nlist.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE)
+ {
+ search(list, (Element)child, nodeName, recursive);
+ }
+ }
+ return list;
+ }
+
+ private static void search(List<Element> list, Element baseElement, QName nodeName, boolean recursive)
+ {
+ if (nodeName == null)
+ {
+ list.add(baseElement);
+ }
+ else
+ {
+ QName qname;
+ if (nodeName.getNamespaceURI().length() > 0)
+ {
+ qname = new QName(baseElement.getNamespaceURI(), baseElement.getLocalName());
+ }
+ else
+ {
+ qname = new QName(baseElement.getLocalName());
+ }
+ if (qname.equals(nodeName))
+ {
+ list.add(baseElement);
+ }
+ }
+ if (recursive)
+ {
+ NodeList nlist = baseElement.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node child = nlist.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE)
+ {
+ search(list, (Element)child, nodeName, recursive);
+ }
+ }
+ }
+ }
+
+ private static Iterator getChildElementsIntern(Node node, QName nodeName, boolean recursive)
+ {
+ return getChildElementsAsListIntern(node, nodeName, recursive).iterator();
+ }
+
+ /** Gets parent element or null if there is none
+ */
+ public static Element getParentElement(Node node)
+ {
+ Node parent = node.getParentNode();
+ return (parent instanceof Element ? (Element)parent : null);
+ }
+
+ /** Get the owner document that is associated with the current thread */
+ public static Document getOwnerDocument()
+ {
+ Document doc = documentThreadLocal.get();
+ if (doc == null)
+ {
+ doc = getDocumentBuilder().newDocument();
+ documentThreadLocal.set(doc);
+ }
+ return doc;
+ }
+
+ public static Element sourceToElement(Source source) throws IOException
+ {
+ Element retElement = null;
+
+ try
+ {
+ if (source instanceof StreamSource)
+ {
+ StreamSource streamSource = (StreamSource)source;
+
+ InputStream ins = streamSource.getInputStream();
+ if (ins != null)
+ {
+ retElement = parse(ins);
+ }
+ else
+ {
+ Reader reader = streamSource.getReader();
+ retElement = parse(new InputSource(reader));
+ }
+ }
+ else if (source instanceof DOMSource)
+ {
+ DOMSource domSource = (DOMSource)source;
+ Node node = domSource.getNode();
+ if (node instanceof Element)
+ {
+ retElement = (Element)node;
+ }
+ else if (node instanceof Document)
+ {
+ retElement = ((Document)node).getDocumentElement();
+ }
+ else
+ {
+ throw new RuntimeException("Unsupported Node type: " + node.getClass().getName());
+ }
+ }
+ else if (source instanceof SAXSource)
+ {
+ // The fact that JAXBSource derives from SAXSource is an implementation detail.
+ // Thus in general applications are strongly discouraged from accessing methods defined on SAXSource.
+ // The XMLReader object obtained by the getXMLReader method shall be used only for parsing the InputSource object returned by the getInputSource method.
+
+ TransformerFactory tf = TransformerFactory.newInstance();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ Transformer transformer = tf.newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ transformer.transform(source, new StreamResult(baos));
+ retElement = parse(new ByteArrayInputStream(baos.toByteArray()));
+ }
+ else
+ {
+ throw new RuntimeException("Source type not implemented: " + source.getClass().getName());
+ }
+
+ }
+ catch (TransformerException ex)
+ {
+ IOException ioex = new IOException();
+ ioex.initCause(ex);
+ throw ioex;
+ }
+
+ return retElement;
+ }
+}
\ No newline at end of file
Added: jbpm4/trunk/modules/test-db/src/test/java/reporting/SQLStmtTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/reporting/SQLStmtTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/reporting/SQLStmtTest.java 2009-06-22 10:35:34 UTC (rev 5070)
@@ -0,0 +1,232 @@
+package reporting;/*
+ * 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.
+ */
+
+import junit.framework.TestCase;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.sql.*;
+
+/**
+ * Parse the birt report templates, extract SQL statements and execute against database.
+ *
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class SQLStmtTest extends TestCase
+{
+ private static final String OVERALL_ACTIVITY_RPTDESIGN = "overall_activity.rptdesign";
+
+ private static final String PROCESS_SUMMARY_RPTDESIGN = "process_summary.rptdesign";
+
+ private Connection conn;
+
+ static boolean skipTests;
+
+ protected void setUp() throws Exception
+ {
+ InputStream in =
+ Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream("jbpm.hibernate.cfg.xml");
+
+ if(null==in)
+ fail("Failed to read jbpm.hibernate.cfg.xml");
+
+ Document hibnCfg = parseTemplate(in);
+ Properties jdbcProps = getConnectionSettings(hibnCfg);
+
+ // create connection
+ Class.forName(jdbcProps.getProperty("hibernate.connection.driver_class"));
+ this.conn = DriverManager.getConnection(
+ jdbcProps.getProperty("hibernate.connection.url"),
+ jdbcProps.getProperty("hibernate.connection.username"),
+ jdbcProps.getProperty("hibernate.connection.password")
+ );
+ }
+
+
+ protected void tearDown() throws Exception
+ {
+ if(this.conn!=null)
+ {
+ conn.close();
+ }
+ }
+
+ public void testOverallActivityReport_Statements() throws Exception
+ {
+ InputStream in =
+ Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(OVERALL_ACTIVITY_RPTDESIGN);
+ assertNotNull("Unable to find report:"+OVERALL_ACTIVITY_RPTDESIGN, in);
+
+ Document doc = parseTemplate(in);
+
+ List<Element> queryTextElements = getQueryTextElements(doc);
+ assertFalse("No query strings found in template", queryTextElements.isEmpty());
+
+ for(Element query : queryTextElements)
+ {
+ executeQuery(query.getTextContent());
+ }
+ }
+
+ public void testProcessSummaryReport_Statements() throws Exception
+ {
+ if(skipTests) return;
+
+ InputStream in =
+ Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(PROCESS_SUMMARY_RPTDESIGN);
+ assertNotNull("Unable to find report:"+PROCESS_SUMMARY_RPTDESIGN, in);
+
+ Document doc = parseTemplate(in);
+
+ List<Element> queryTextElements = getQueryTextElements(doc);
+ assertFalse("No query strings found in template", queryTextElements.isEmpty());
+
+ for(Element query : queryTextElements)
+ {
+ executeQuery(query.getTextContent());
+ }
+ }
+
+ private void executeQuery(String sql) throws SQLException
+ {
+
+ System.out.println("Execute:");
+ System.out.println(sql);
+
+ PreparedStatement stmt = conn.prepareStatement(sql);
+ ParameterMetaData metaData = stmt.getParameterMetaData();
+ for(int i=1; i<metaData.getParameterCount()+1; i++)
+ {
+ stmt.setString(i, "PLACEHOLDER_STRING");
+ }
+
+ // run it
+ ResultSet rs = stmt.executeQuery();
+ System.out.println("");
+ System.out.println("Result size:" +rs.getFetchSize());
+ System.out.println("--");
+ }
+
+ private List<Element> getQueryTextElements(Document doc)
+ {
+ List<Element> props = new ArrayList<Element>();
+ dfsElementSearch(props, doc.getDocumentElement(),
+ new Filter()
+ {
+ public boolean select(Element candidate)
+ {
+ return candidate.getNodeName().equals("property")
+ && DOMUtils.getAttributeValue(candidate, "name").equals("queryText");
+ }
+ });
+ return props;
+ }
+
+ private Properties getConnectionSettings(Document doc)
+ {
+ List<Element> props = new ArrayList<Element>();
+ dfsElementSearch(props, doc.getDocumentElement(),
+ new Filter()
+ {
+ public boolean select(Element candidate)
+ {
+ return candidate.getNodeName().equals("property")
+ && DOMUtils.getAttributeValue(candidate, "name").startsWith("hibernate.connection");
+ }
+ });
+
+ Properties connectionSettings = new Properties();
+ for(Element el : props)
+ {
+ connectionSettings.put(
+ DOMUtils.getAttributeValue(el, "name"),
+ el.getTextContent()
+ );
+ }
+
+ return connectionSettings;
+ }
+
+
+ private Document parseTemplate(InputStream in)
+ throws ParserConfigurationException, SAXException, IOException
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(false);
+ factory.setNamespaceAware(true);
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document doc = builder.parse(in);
+ return doc;
+ }
+
+ private static void dfsElementSearch(List<Element> resultBuffer, Element root, Filter filter)
+ {
+ if( filter.select(root) )
+ {
+ resultBuffer.add(root);
+ return;
+ }
+
+ List<Element> children = getChildElements(root);
+ for(Element child : children)
+ {
+ dfsElementSearch(resultBuffer, child, filter);
+ }
+ }
+
+ private static List<Element> getChildElements(Node node)
+ {
+ List<Element> list = new LinkedList<Element>();
+ NodeList nlist = node.getChildNodes();
+ for (int i = 0; i < nlist.getLength(); i++)
+ {
+ Node child = nlist.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE)
+ {
+ list.add((Element)child);
+ }
+ }
+ return list;
+ }
+
+ interface Filter
+ {
+ boolean select(Element candidate);
+ }
+
+
+}
16 years, 10 months
JBoss JBPM SVN: r5069 - in jbpm4/trunk/modules/test-concurrent/src: test/java/org/jbpm/test/concurrent and 1 other directories.
by do-not-reply@jboss.org
Author: jbarrez
Date: 2009-06-19 13:26:38 -0400 (Fri, 19 Jun 2009)
New Revision: 5069
Added:
jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/CommandExecutionSynchronization.java
jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/SynchronizableCommandExecutor.java
jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/AsyncForkTest.java
Removed:
jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulator.java
jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulatorPool.java
jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulatorSynchronization.java
Modified:
jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/ConcurrentJbpmTestCase.java
jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/OptimisticLockTestGround.java
jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/TimerVsSignalConcurrencyTest.java
jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.cfg.xml
Log:
Commit intermediate work on concurrent testing (work in progress - doesnt work yet)
Copied: jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/CommandExecutionSynchronization.java (from rev 5049, jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulatorSynchronization.java)
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/CommandExecutionSynchronization.java (rev 0)
+++ jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/CommandExecutionSynchronization.java 2009-06-19 17:26:38 UTC (rev 5069)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.concurrent;
+
+/**
+ * Implementations can extend this class to add logic to sync points of the
+ * {@link SynchronizableCommandExecutor}.
+ *
+ * @author Joram Barrez
+ */
+public abstract class CommandExecutionSynchronization {
+
+ public void beforeTransactionStarts() { }
+
+ public void afterTransactionStarted() { }
+
+ public void beforeExecution() { }
+
+ public void afterExecution() { }
+
+ public void beforeTransactionDone() { }
+
+ public void afterTransactionDone() { }
+
+}
Modified: jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/ConcurrentJbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/ConcurrentJbpmTestCase.java 2009-06-19 15:53:46 UTC (rev 5068)
+++ jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/ConcurrentJbpmTestCase.java 2009-06-19 17:26:38 UTC (rev 5069)
@@ -39,37 +39,7 @@
protected void setUp() throws Exception {
super.setUp();
- this.environmentFactory = (EnvironmentFactory) processEngine; // Is there a better way to do this?
+ this.environmentFactory = (EnvironmentFactory) processEngine;
}
-
- protected class OffloadThread extends Thread {
-
- private ThreadCallback threadCallback;
-
- private Exception exception;
-
- public OffloadThread(ThreadCallback threadCallback) {
- this.threadCallback = threadCallback;
- }
- public void run() {
- try {
- threadCallback.executeInThread();
- } catch (Exception e) {
- this.exception = e;
- }
- }
-
- public Exception getException() {
- return exception;
- }
-
- }
-
- protected interface ThreadCallback {
-
- void executeInThread();
-
- }
-
}
Deleted: jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulator.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulator.java 2009-06-19 15:53:46 UTC (rev 5068)
+++ jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulator.java 2009-06-19 17:26:38 UTC (rev 5069)
@@ -1,302 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.test.concurrent;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.BrokenBarrierException;
-import java.util.concurrent.CyclicBarrier;
-
-import org.jbpm.api.env.Environment;
-import org.jbpm.api.env.EnvironmentFactory;
-import org.jbpm.api.job.Job;
-import org.jbpm.pvm.internal.cmd.ExecuteJobCmd;
-import org.jbpm.pvm.internal.tx.StandardTransaction;
-
-/**
- * Emulates the JobExecutorThread by executing the ExecuteJobCmd in
- * a dedicated thread.
- *
- * Has several sync points available (see {@link JobExecutorEmulatorSynchronization}):
- * - before/after transaction is started
- * - before/after job execution
- * - before/after transaction is done (ie commit)
- *
- * TODO: implement transaction sync, now only sync on job execution is done - waiting until use case passes by
- *
- * @author Joram Barrez
- */
-public class JobExecutorEmulator extends Thread {
-
- /** Used to create environment blocks */
- private EnvironmentFactory environmentFactory;
-
- /** The database id of the job that is executed by this JobExecutorEmulator */
- private Long jobId;
-
- /**
- * If an exception occurs in a thread that is not the JUnit thread, then
- * the JUnit thread will never notice this. The solution is to catch the
- * exception and store it in this field, so the JUnit thread can check
- * if there were any exceptions when executing the job.
- */
- private Exception exception;
-
- /** Indicates if the thread must be blocked (ie this.wait() must be called) */
- private boolean threadBlocked;
-
- /**
- * List of synchronizations that will be called on specific point in the
- * execution of this thread.
- */
- private List<JobExecutorEmulatorSynchronization> synchronizations;
-
- /* SYNC PRIMITIVES */
-
- /** Sync point when the job is executed */
- private CyclicBarrier afterJobExecutionBarrier;
-
- private List<String> afterJobExecutionSyncThreads;
-
- /** Sync point before the job is executed */
- private CyclicBarrier beforeJobExecutionBarrier;
-
- private List<String> beforeJobExecutionSyncThreads;
-
- /**
- * Constructor.
- *
- * @param job The job that must be executred by this emulator.
- */
- public JobExecutorEmulator(EnvironmentFactory environmentFactory, Job job) {
- this.environmentFactory = environmentFactory;
- this.jobId = job.getDbid();
- this.threadBlocked = false;
-
- this.synchronizations = new ArrayList<JobExecutorEmulatorSynchronization>();
- synchronizations.add(new DefaultSynchronization());
- }
-
- public void run() {
-
- Environment environment = environmentFactory.openEnvironment();
- StandardTransaction standardTransaction = environment.get(StandardTransaction.class);
- standardTransaction.begin();
-
- try {
-
- handleBeforeJobExecutionSynchronizations();
- ExecuteJobCmd executeJobCmd = new ExecuteJobCmd(jobId);
- executeJobCmd.execute(environment);
- handleAfterJobExecutionSynchronizations(); // Sync point: after job execution
-
- } catch (Exception e) {
-
- standardTransaction.setRollbackOnly();
- this.exception = e;
-
- } finally {
-
- if (standardTransaction.isRollbackOnly()) {
- exception = new Exception("Transaction was rollbacked due to an exception");
- }
-
- try {
- standardTransaction.complete();
- } catch (Exception e) {
-
- }
-
- }
- environment.close();
- }
-
- /**
- * Executes all synchronizations that must be executed before the job is executed
- */
- private void handleBeforeJobExecutionSynchronizations() {
- for (JobExecutorEmulatorSynchronization synchronization : synchronizations) {
- synchronization.beforeJobExecution();
- }
- }
-
- /**
- * Executes all synchronizations that must be executed when the job is executed
- */
- private void handleAfterJobExecutionSynchronizations() {
- for (JobExecutorEmulatorSynchronization synchronization : synchronizations) {
- synchronization.afterJobExecution();
- }
- }
-
- /**
- * Unit tests that use this class can use this method to synchronize
- * when the job just has been executed.
- *
- * @param blockJobExecutor If true, the jobExecutor will be halted
- * when leaving the synchronisation point
- */
- public void waitUntilJobExecuted(boolean blockJobExecutor) {
- if (afterJobExecutionBarrier != null) {
- try {
- threadBlocked = blockJobExecutor;
- afterJobExecutionBarrier.await();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (BrokenBarrierException e) {
- e.printStackTrace();
- }
- }
- }
-
- public JobExecutorEmulator synchroniseAfterJobExecution(String threadName) {
- if (isAlive()) {
- throw new RuntimeException("Cannot set synchronization point once the JobExecutorEmulator has been started");
- }
-
- if (afterJobExecutionSyncThreads == null) {
- afterJobExecutionSyncThreads = new ArrayList<String>();
- }
-
- if (afterJobExecutionBarrier == null ) {
- afterJobExecutionBarrier = new CyclicBarrier(2);
- } else {
- afterJobExecutionBarrier = new CyclicBarrier(afterJobExecutionBarrier.getParties() + 1);
- }
-
- return this;
- }
-
- public JobExecutorEmulator synchroniseBeforeJobExecution(String threadName) {
- if (isAlive()) {
- throw new RuntimeException("Cannot set synchronization point once the JobExecutorEmulator has been started");
- }
-
- if (beforeJobExecutionBarrier == null) {
- beforeJobExecutionSyncThreads = new ArrayList<String>();
- }
-
- if (beforeJobExecutionBarrier == null ) {
- beforeJobExecutionBarrier = new CyclicBarrier(2);
- } else {
- beforeJobExecutionBarrier = new CyclicBarrier(beforeJobExecutionBarrier.getParties() + 1);
- }
-
- return this;
- }
-
- /**
- * Helper method: check if the flag 'threadBlocked' has been raised.
- * If so, this thread will block until it is notified again.
- */
- private void blockIfNeeded() {
- if (threadBlocked) {
- synchronized (this) {
- try {
- threadBlocked = false;
- wait();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- /**
- * Unit tests can use this method to proceed a halted JobExecutorEmulator.
- * (ie this means that the wait() was called on this thread in the past).
- */
- public void goOn() {
- synchronized (this) {
- notify();
- };
- }
-
- /**
- * Adds a custom synchronization to the JobExecutorEmulator.
- */
- public void addSynchronization(JobExecutorEmulatorSynchronization synchronization) {
- synchronizations.add(synchronization);
- }
-
- /* GETTERS AND SETTERS */
-
- public Exception getException() {
- return exception;
- }
-
- public boolean isBlockThread() {
- return threadBlocked;
- }
-
- public void setBlockThread(boolean blockThread) {
- this.threadBlocked = blockThread;
- }
-
- public void setAfterJobExecutionBarrier(CyclicBarrier afterJobExecutionBarrier) {
- this.afterJobExecutionBarrier = afterJobExecutionBarrier;
- }
-
- public void setBeforeJobExecutionBarrier(CyclicBarrier beforeJobExecutionBarrier) {
- this.beforeJobExecutionBarrier = beforeJobExecutionBarrier;
- }
-
- /**
- * Default synchronization, executed by all JobExecutorEmulators.
- * The default logic will synchronize at every sync point (ie barrier)
- * which is not null and will check if any external caller has raised
- * the 'threadBlocked' flag.
- */
- private class DefaultSynchronization extends JobExecutorEmulatorSynchronization {
-
- public void afterJobExecution() {;
- if (afterJobExecutionBarrier != null) {
- try {
- afterJobExecutionBarrier.await();
- blockIfNeeded();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (BrokenBarrierException e) {
- e.printStackTrace();
- }
- }
- }
-
- public void beforeJobExecution() {;
- if (beforeJobExecutionBarrier != null) {
- try {
- beforeJobExecutionBarrier.await();
- blockIfNeeded();
- } catch (InterruptedException e) {
- e.printStackTrace();
- } catch (BrokenBarrierException e) {
- e.printStackTrace();
- }
- }
- }
-
- }
-
-}
Deleted: jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulatorPool.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulatorPool.java 2009-06-19 15:53:46 UTC (rev 5068)
+++ jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulatorPool.java 2009-06-19 17:26:38 UTC (rev 5069)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.test.concurrent;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.jbpm.api.env.EnvironmentFactory;
-import org.jbpm.api.job.Job;
-
-
-/**
- * @author Joram Barrez
- */
-public class JobExecutorEmulatorPool {
-
- private EnvironmentFactory environmentFactory;
-
- private List<JobExecutorEmulator> jobExecutorEmulators;
-
- public JobExecutorEmulatorPool(EnvironmentFactory environmentFactory) {
- this.environmentFactory = environmentFactory;
- this.jobExecutorEmulators = new ArrayList<JobExecutorEmulator>();
- }
-
- public void emulateJobExecution(Collection<Job> jobs) {
-
- }
-
-}
Deleted: jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulatorSynchronization.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulatorSynchronization.java 2009-06-19 15:53:46 UTC (rev 5068)
+++ jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulatorSynchronization.java 2009-06-19 17:26:38 UTC (rev 5069)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.test.concurrent;
-
-/**
- * Implementations can extend this class to add logic to sync points of the
- * {@link JobExecutorEmulator}.
- *
- * @author Joram Barrez
- */
-public abstract class JobExecutorEmulatorSynchronization {
-
- public void beforeTransactionStarts() { }
-
- public void afterTransactionStarted() { }
-
- public void beforeJobExecution() { }
-
- public void afterJobExecution() { }
-
- public void beforeTransactionDone() { }
-
- public void afterTransactionDone() { }
-
-}
Copied: jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/SynchronizableCommandExecutor.java (from rev 5049, jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/JobExecutorEmulator.java)
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/SynchronizableCommandExecutor.java (rev 0)
+++ jbpm4/trunk/modules/test-concurrent/src/main/java/org/jbpm/test/concurrent/SynchronizableCommandExecutor.java 2009-06-19 17:26:38 UTC (rev 5069)
@@ -0,0 +1,330 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.concurrent;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.env.EnvironmentFactory;
+import org.jbpm.api.job.Job;
+import org.jbpm.pvm.internal.cmd.ExecuteJobCmd;
+import org.jbpm.pvm.internal.tx.StandardTransaction;
+
+/**
+ * Executes a given command in a separate thread.
+ *
+ * Has several sync points available (see {@link CommandExecutionSynchronization}):
+ * - before/after transaction is started
+ * - before/after job execution
+ * - before/after transaction is done (ie commit)
+ *
+ * TODO: implement transaction sync, now only sync on job execution is done - waiting until use case passes by
+ *
+ * @author Joram Barrez
+ */
+public class SynchronizableCommandExecutor extends Thread {
+
+ /** Used to create environment blocks */
+ private EnvironmentFactory environmentFactory;
+
+ /** The database id of the job that will be executed */
+ private Long jobId;
+
+ /** The command that will be executed */
+ private Command command;
+
+ /**
+ * If an exception occurs in a thread that is not the JUnit thread, then
+ * the JUnit thread will never notice this. The solution is to catch the
+ * exception and store it in this field, so the JUnit thread can check
+ * if there were any exceptions when executing the job.
+ */
+ private Exception exception;
+
+ /** Indicates if the thread must be blocked (ie this.wait() must be called) */
+ private boolean threadBlocked;
+
+ /**
+ * List of synchronizations that will be called on specific point in the
+ * execution of this thread.
+ */
+ private List<CommandExecutionSynchronization> synchronizations;
+
+ /* SYNC PRIMITIVES */
+
+ private CyclicBarrier afterExecutionBarrier;
+
+ private CyclicBarrier beforeExecutionBarrier;
+
+ /**
+ * Constructor to be used when the thread must execute a job
+ */
+ public SynchronizableCommandExecutor(EnvironmentFactory environmentFactory, Job job) {
+ this.environmentFactory = environmentFactory;
+ this.jobId = job.getDbid();
+ this.threadBlocked = false;
+
+ this.synchronizations = new ArrayList<CommandExecutionSynchronization>();
+ synchronizations.add(new DefaultSynchronization());
+ }
+
+ /**
+ * Constructor to be used when the thread must execute a command
+ */
+ public SynchronizableCommandExecutor(EnvironmentFactory environmentFactory, Command command) {
+ this.environmentFactory = environmentFactory;
+ this.command = command;
+ this.threadBlocked = false;
+
+ this.synchronizations = new ArrayList<CommandExecutionSynchronization>();
+ synchronizations.add(new DefaultSynchronization());
+ }
+
+ public void run() {
+
+ Environment environment = environmentFactory.openEnvironment();
+ StandardTransaction standardTransaction = environment.get(StandardTransaction.class);
+ standardTransaction.begin();
+
+ try {
+
+ handleBeforeExecutionSynchronizations();
+
+ if (jobId != null) {
+ ExecuteJobCmd executeJobCmd = new ExecuteJobCmd(jobId);
+ executeJobCmd.execute(environment);
+ }
+
+ if (command != null) {
+ command.execute(environment);
+ }
+
+ handleAfterExecutionSynchronizations();
+
+ } catch (Exception e) {
+ standardTransaction.setRollbackOnly();
+ this.exception = e;
+
+ } finally {
+
+ try {
+ standardTransaction.complete();
+ } catch (Exception e) {
+ this.exception = e;
+ }
+
+ }
+ environment.close();
+ }
+
+ /**
+ * Executes all synchronizations that must be executed before the job is executed
+ */
+ private void handleBeforeExecutionSynchronizations() {
+ for (CommandExecutionSynchronization synchronization : synchronizations) {
+ synchronization.beforeExecution();
+ }
+ }
+
+ /**
+ * Executes all synchronizations that must be executed when the job is executed
+ */
+ private void handleAfterExecutionSynchronizations() {
+ for (CommandExecutionSynchronization synchronization : synchronizations) {
+ synchronization.afterExecution();
+ }
+ }
+
+ /**
+ * Unit tests that use this class can use this method to synchronize
+ * when the job just has been executed.
+ *
+ * @param blockJobExecutor If true, the jobExecutor will be halted
+ * when leaving the synchronisation point
+ */
+ public void waitUntilExecutionFinished(boolean blockJobExecutor) {
+ if (afterExecutionBarrier != null) {
+ try {
+ threadBlocked = blockJobExecutor;
+ afterExecutionBarrier.await();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public SynchronizableCommandExecutor synchroniseAfterExecution() {
+ if (isAlive()) {
+ throw new RuntimeException("Cannot set synchronization point once the thread has been started");
+ }
+
+ if (afterExecutionBarrier == null ) {
+ afterExecutionBarrier = new CyclicBarrier(2);
+ } else {
+ afterExecutionBarrier = new CyclicBarrier(afterExecutionBarrier.getParties() + 1);
+ }
+
+ return this;
+ }
+
+ public SynchronizableCommandExecutor synchroniseAfterExecution(SynchronizableCommandExecutor otherExecutor) {
+ if (this.isAlive() || otherExecutor.isAlive()) {
+ throw new RuntimeException("Cannot set synchronization point once the thread has been started");
+ }
+
+ int threadsInvolved = 0;
+ if (afterExecutionBarrier != null) {
+ threadsInvolved += afterExecutionBarrier.getParties();
+ } else {
+ threadsInvolved++;
+ }
+
+ if (otherExecutor.afterExecutionBarrier != null) {
+ threadsInvolved += otherExecutor.afterExecutionBarrier.getParties();
+ } else {
+ threadsInvolved++;
+ }
+
+ this.afterExecutionBarrier = new CyclicBarrier(threadsInvolved);
+ otherExecutor.afterExecutionBarrier = this.afterExecutionBarrier;
+
+ return this;
+ }
+
+ public SynchronizableCommandExecutor synchroniseBeforeExecution() {
+ if (isAlive()) {
+ throw new RuntimeException("Cannot set synchronization point once the JobExecutorEmulator has been started");
+ }
+
+ if (beforeExecutionBarrier == null ) {
+ beforeExecutionBarrier = new CyclicBarrier(2);
+ } else {
+ beforeExecutionBarrier = new CyclicBarrier(beforeExecutionBarrier.getParties() + 1);
+ }
+
+ return this;
+ }
+
+ /**
+ * Helper method: check if the flag 'threadBlocked' has been raised.
+ * If so, this thread will block until it is notified again.
+ */
+ private void blockIfNeeded() {
+ if (threadBlocked) {
+ synchronized (this) {
+ try {
+ threadBlocked = false;
+ wait();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ /**
+ * Unit tests can use this method to proceed a halted JobExecutorEmulator.
+ * (ie this means that the wait() was called on this thread in the past).
+ */
+ public void goOn() {
+ synchronized (this) {
+ notify();
+ };
+ }
+
+ /**
+ * Adds a custom synchronization to the JobExecutorEmulator.
+ */
+ public void addSynchronization(CommandExecutionSynchronization synchronization) {
+ synchronizations.add(synchronization);
+ }
+
+ /* GETTERS AND SETTERS */
+
+ public Exception getException() {
+ return exception;
+ }
+
+ public boolean isBlockThread() {
+ return threadBlocked;
+ }
+
+ public void setBlockThread(boolean blockThread) {
+ this.threadBlocked = blockThread;
+ }
+
+ public void setAfterExecutionBarrier(CyclicBarrier afterExecutionBarrier) {
+ this.afterExecutionBarrier = afterExecutionBarrier;
+ }
+
+ public void setBeforeExecutionBarrier(CyclicBarrier beforeExecutionBarrier) {
+ this.beforeExecutionBarrier = beforeExecutionBarrier;
+ }
+
+ /**
+ * Default synchronization, executed by all threads.
+ * The default logic will synchronize at every sync point (ie barrier)
+ * which is not null and will check if any external caller has raised
+ * the 'threadBlocked' flag.
+ */
+ private class DefaultSynchronization extends CommandExecutionSynchronization {
+
+ public void afterExecution() {
+
+ if (afterExecutionBarrier != null) {
+ try {
+ afterExecutionBarrier.await();
+ blockIfNeeded();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void beforeExecution() {
+
+ if (beforeExecutionBarrier != null) {
+ try {
+ beforeExecutionBarrier.await();
+ blockIfNeeded();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ } catch (BrokenBarrierException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ }
+
+}
Added: jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/AsyncForkTest.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/AsyncForkTest.java (rev 0)
+++ jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/AsyncForkTest.java 2009-06-19 17:26:38 UTC (rev 5069)
@@ -0,0 +1,58 @@
+package org.jbpm.test.concurrent;
+
+import java.util.List;
+
+import org.hibernate.StaleStateException;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+
+
+public class AsyncForkTest extends ConcurrentJbpmTestCase {
+
+ public void testAsyncForkNoOptimisticLockingFailure() {
+ deployJpdlXmlString(
+ "<process name='asyncFork'>" +
+ " <start>" +
+ " <transition to='theFork' />" +
+ " </start>" +
+ " <fork name='theFork'>" +
+ " <on event='end' continue='async' />" +
+ " <transition to='pathA' />" +
+ " <transition to='pathB' />" +
+ " </fork>" +
+ " <custom name='pathA' class='org.jbpm.test.concurrent.PassThroughActivity' >" +
+ " <transition to='theJoin' />" +
+ " </custom>" +
+ " <custom name='pathB' class='org.jbpm.test.concurrent.PassThroughActivity' >" +
+ " <transition to='theJoin' />" +
+ " </custom>" +
+ " <join name='theJoin'>" +
+ " <transition to='test' />" +
+ " </join>" +
+ " <state name='test' >" +
+ " <transition to='end' /> " +
+ " </state>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey("asyncFork");
+ final List<Job> jobs = managementService.createJobQuery().processInstanceId(processInstance.getId()).list();
+ assertEquals(2, jobs.size());
+
+ SynchronizableCommandExecutor executor1 = new SynchronizableCommandExecutor(environmentFactory, jobs.get(0));
+ SynchronizableCommandExecutor executor2 = new SynchronizableCommandExecutor(environmentFactory, jobs.get(1));
+
+ executor1.synchroniseAfterExecution(executor2);
+ executor1.synchroniseAfterExecution();
+
+ executor1.start();
+ executor2.start();
+
+ if (executor1.getException() instanceof StaleStateException
+ || executor2.getException() instanceof StaleStateException) {
+ fail("A StaleStaeException was thrown, altough this shouldn't happen");
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/AsyncForkTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/OptimisticLockTestGround.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/OptimisticLockTestGround.java 2009-06-19 15:53:46 UTC (rev 5068)
+++ jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/OptimisticLockTestGround.java 2009-06-19 17:26:38 UTC (rev 5069)
@@ -41,8 +41,7 @@
* Class to test different approaches to the concurrency problem.
*
* Doesnt work anymore, but dont delete yet, I need some stuff in here for later!
- *
- * @author Joram Barrez
+ * * @author Joram Barrez
*/
public class OptimisticLockTestGround extends JbpmTestCase {
Modified: jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/TimerVsSignalConcurrencyTest.java
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/TimerVsSignalConcurrencyTest.java 2009-06-19 15:53:46 UTC (rev 5068)
+++ jbpm4/trunk/modules/test-concurrent/src/test/java/org/jbpm/test/concurrent/TimerVsSignalConcurrencyTest.java 2009-06-19 17:26:38 UTC (rev 5069)
@@ -25,13 +25,12 @@
package org.jbpm.test.concurrent;
import java.util.List;
-import java.util.concurrent.CyclicBarrier;
+import org.hibernate.StaleStateException;
import org.jbpm.api.Execution;
import org.jbpm.api.ProcessInstance;
-import org.jbpm.api.env.EnvironmentFactory;
import org.jbpm.api.job.Job;
-import org.jbpm.test.JbpmTestCase;
+import org.jbpm.pvm.internal.cmd.SignalCmd;
/**
@@ -60,56 +59,35 @@
final List<Job> jobs = managementService.createJobQuery().processInstanceId(processInstance.getId()).list();
assertEquals(1, jobs.size());
- JobExecutorEmulator jobExecutorEmulator = new JobExecutorEmulator(environmentFactory, jobs.get(0));
- jobExecutorEmulator.synchroniseAfterJobExecution(Thread.currentThread().getName());
+ //SynchronizableCommandExecutor jobExecutorEmulator = new SynchronizableCommandExecutor(environmentFactory, jobs.get(0));
+ SynchronizableCommandExecutor jobExecutorEmulator = new SynchronizableCommandExecutor(environmentFactory, jobs.get(0));
+ jobExecutorEmulator.synchroniseAfterExecution();
jobExecutorEmulator.start();
- jobExecutorEmulator.waitUntilJobExecuted(true); // transaction will be stalled
+ jobExecutorEmulator.waitUntilExecutionFinished(true); // transaction will be stalled until signal is done
// Cause conflicting transaction
final Execution executionAtState = processInstance.findActiveExecutionIn("wait");
assertNotNull(executionAtState);
- OffloadThread signalThread = new OffloadThread(new ThreadCallback() {
- public void executeInThread() {
- executionService.signalExecutionById(executionAtState.getId(), "go on");
- }
- });
+
+ SignalCmd signalCmd = new SignalCmd(executionAtState.getId(), "go on", null);
+ SynchronizableCommandExecutor signalThread = new SynchronizableCommandExecutor(environmentFactory, signalCmd);
signalThread.start();
- /*
- // Checking current stacktrace of thread
- int i = 1;
- while (i == 1) {
- System.out.println("-----------> STATE = " + temp.getState());
- StackTraceElement[] stack = temp.getStackTrace();
- for (StackTraceElement e : stack) {
- System.out.println("-----------> " + e);
- }
-
- synchronized (this) {
- try {
- wait(1000L);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- */
-
// Best effort: wait 1 sec and see if the staleObjectException has been caused
synchronized (this) {
wait(1000L);
}
jobExecutorEmulator.goOn();
+
jobExecutorEmulator.join();
+ signalThread.join();
- if (jobExecutorEmulator.getException() != null) {
- fail("Error while executing job: " + jobExecutorEmulator.getException().getMessage());
- } if (signalThread.getException() != null) {
- fail("Error while executing signal " + signalThread.getException().getMessage());
+ if (!(jobExecutorEmulator.getException() instanceof StaleStateException
+ || signalThread.getException() instanceof StaleStateException)) {
+ fail("None of the threads threw a StaleStateException");
}
}
Modified: jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.cfg.xml 2009-06-19 15:53:46 UTC (rev 5068)
+++ jbpm4/trunk/modules/test-concurrent/src/test/resources/jbpm.cfg.xml 2009-06-19 17:26:38 UTC (rev 5069)
@@ -4,8 +4,24 @@
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
+
+ <!-- we need to remove the retry interceptor, so we cant use the default
<import resource="jbpm.tx.hibernate.cfg.xml" />
+ -->
+
+ <process-engine-context>
+ <command-service>
+ <environment-interceptor />
+ <standard-transaction-interceptor />
+ </command-service>
+ </process-engine-context>
+ <transaction-context>
+ <transaction />
+ <hibernate-session />
+ </transaction-context>
+
+
<!--
In the concurrency tests, we'll emulate the job executor to have full
control on when syncing occurs
16 years, 10 months
JBoss JBPM SVN: r5068 - in jbpm4/trunk/modules: jpdl/src/main/java/org/jbpm/jpdl/internal/xml and 5 other directories.
by do-not-reply@jboss.org
Author: koen.aers(a)jboss.com
Date: 2009-06-19 11:53:46 -0400 (Fri, 19 Jun 2009)
New Revision: 5068
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BasicTypeBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ByteBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CharBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ClassBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DoubleBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FieldBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FloatBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/HibernateConfigurationBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IntBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/InvokeBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JndiBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/LongBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MapBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertyBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RefBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RetryInterceptorBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ShortBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TypesBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/BindingParser.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
Log:
replace addProblem(String) by replace addProblem(String, Element) where possible in order to be able to retrieve the line number in case of problems (GPD-288)
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -106,7 +106,7 @@
if (hasConditions) {
return new DecisionConditionActivity();
} else {
- parse.addProblem("decision '"+element.getAttribute("name")+"' must have one of: expr attribute, handler attribute, handler element or condition expressions");
+ parse.addProblem("decision '"+element.getAttribute("name")+"' must have one of: expr attribute, handler attribute, handler element or condition expressions", element);
}
return null;
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -54,9 +54,9 @@
if (name!=null) {
// basic name validation
if ("".equals(name)) {
- parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"));
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"), element);
} else if (name.indexOf('/')!=-1) {
- parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"));
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"), element);
}
activity.setName(name);
}
@@ -78,7 +78,7 @@
TimerDefinitionImpl timerDefinitionImpl = jpdlParser.parseTimerDefinition(timerElement, parse, activity);
timerDefinitionImpl.setSignalName(transitionName);
} else {
- parse.addProblem("a transition name is required when a timer is placed on a transition");
+ parse.addProblem("a transition name is required when a timer is placed on a transition", element);
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -49,7 +49,7 @@
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
language = scriptManager.getDefaultExpressionLanguage();
if (textElement!=null) {
- parse.addProblem("in <script ...> attribute expr can't be combined with a nexted text element");
+ parse.addProblem("in <script ...> attribute expr can't be combined with a nexted text element", element);
}
} else {
language = XmlUtil.attribute(element, "lang");
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -45,7 +45,7 @@
processDefinition.setInitial(startActivity);
} else if (startActivity.getParentActivity()==null) {
- parse.addProblem("multiple start events not yet supported");
+ parse.addProblem("multiple start events not yet supported", element);
}
return new StartActivity();
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -221,7 +221,7 @@
}
if (processDefinition.getInitial()==null) {
- parse.addProblem("no start activity in process");
+ parse.addProblem("no start activity in process", documentElement);
}
return processDefinition;
@@ -317,7 +317,7 @@
parse.addProblem("couldn't parse duedatetime "+duedatetime, e);
}
} else {
- parse.addProblem("either duedate or duedatetime is required in timer");
+ parse.addProblem("either duedate or duedatetime is required in timer", timerElement);
}
String repeat = XmlUtil.attribute(timerElement, "repeat");
@@ -461,7 +461,7 @@
ProcessDefinitionImpl processDefinition = parse.findObject(ProcessDefinitionImpl.class);
if (processDefinition.getTaskDefinition(taskName)!=null) {
- parse.addProblem("duplicate task name "+taskName);
+ parse.addProblem("duplicate task name "+taskName, element);
} else {
processDefinition.addTaskDefinitionImpl(taskDefinition);
}
@@ -473,7 +473,7 @@
if (swimlaneDefinition!=null) {
taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
} else {
- parse.addProblem("swimlane "+swimlaneName+" not declared");
+ parse.addProblem("swimlane "+swimlaneName+" not declared", element);
}
}
Modified: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -42,7 +42,7 @@
if (destination!=null) {
destination.addIncomingTransition(transition);
} else {
- parse.addProblem(XmlUtil.errorMessageAttribute(transitionElement, "to", to, "doesn't reference an existing activity name"));
+ parse.addProblem(XmlUtil.errorMessageAttribute(transitionElement, "to", to, "doesn't reference an existing activity name"), transitionElement);
}
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -55,7 +55,7 @@
if (initial!=null) {
lifeCycleProcess.setInitial(initial);
} else {
- parse.addProblem("initial "+initialStateName+" doesn't exist");
+ parse.addProblem("initial "+initialStateName+" doesn't exist", element);
}
}
@@ -64,7 +64,7 @@
public void parseTransitions(Element element, ProcessDefinitionImpl lifeCycleProcess, Parse parse) {
if (! element.hasAttribute("name")) {
- parse.addProblem("state doesn't have a name: "+XmlUtil.toString(element));
+ parse.addProblem("state doesn't have a name: "+XmlUtil.toString(element), element);
return;
}
String stateName = element.getAttribute("name");
@@ -78,12 +78,12 @@
public void parseTransition(Element element, ActivityImpl state, Parse parse) {
if (! element.hasAttribute("name")) {
- parse.addProblem("transition doesn't have a name: "+XmlUtil.toString(element));
+ parse.addProblem("transition doesn't have a name: "+XmlUtil.toString(element), element);
return;
}
String transitionName = element.getAttribute("name");
if (! element.hasAttribute("to")) {
- parse.addProblem("transition "+transitionName+" doesn't have a to attribute indicating the destination state: "+XmlUtil.toString(element));
+ parse.addProblem("transition "+transitionName+" doesn't have a to attribute indicating the destination state: "+XmlUtil.toString(element), element);
return;
}
String destinationName = element.getAttribute("to");
@@ -93,13 +93,13 @@
transition.setDestination(destination);
transition.setName(transitionName);
} else {
- parse.addProblem("destination "+destinationName+" of "+transitionName+" is unknown");
+ parse.addProblem("destination "+destinationName+" of "+transitionName+" is unknown", element);
}
}
public void parseState(Element element, ProcessDefinitionImpl lifeCycleProcess, Parse parse) {
if (! element.hasAttribute("name")) {
- parse.addProblem("state doesn't have an id: "+XmlUtil.toString(element));
+ parse.addProblem("state doesn't have an id: "+XmlUtil.toString(element), element);
return;
}
String stateName = element.getAttribute("name");
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -128,7 +128,7 @@
}
if (required && (parse!=null)) {
- parse.addProblem("nested element <"+XmlUtil.getTagLocalName(element)+"><"+tagName+" ... />... is required");
+ parse.addProblem("nested element <"+XmlUtil.getTagLocalName(element)+"><"+tagName+" ... />... is required", element);
}
return null;
}
@@ -311,13 +311,13 @@
if (element.hasAttribute(attributeName)) {
String value = element.getAttribute(attributeName);
if (required && "".equals(value)) {
- parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+" "+attributeName+"=\"\" is empty");
+ parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+" "+attributeName+"=\"\" is empty", element);
}
return value;
}
if (required) {
- parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+" "+attributeName+"=\"...\" is required");
+ parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+" "+attributeName+"=\"...\" is required", element);
}
return defaultValue;
@@ -332,7 +332,7 @@
try {
return Integer.parseInt(valueText);
} catch (NumberFormatException e) {
- parse.addProblem(errorMessageAttribute(element, attributeName, valueText, "value not parsable as integer"));
+ parse.addProblem(errorMessageAttribute(element, attributeName, valueText, "value not parsable as integer"), element);
}
}
@@ -350,7 +350,7 @@
if (valueText!=null) {
Boolean value = parseBooleanValue(valueText);
if (value==null) {
- parse.addProblem(errorMessageAttribute(element, attributeName, valueText, "value not in {true, enabled, on, false, disabled, off}"));
+ parse.addProblem(errorMessageAttribute(element, attributeName, valueText, "value not in {true, enabled, on, false, disabled, off}"), element);
}
return value;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BasicTypeBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BasicTypeBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BasicTypeBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -20,7 +20,7 @@
String value = element.getAttribute("value");
descriptor = createDescriptor(value, element, parse);
} else {
- parse.addProblem("attribute 'value' is required in element '"+XmlUtil.getTagLocalName(element)+"': "+XmlUtil.toString(element));
+ parse.addProblem("attribute 'value' is required in element '"+XmlUtil.getTagLocalName(element)+"': "+XmlUtil.toString(element), element);
}
return descriptor;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -142,14 +142,14 @@
dayParts.add(dayPart);
} catch(Exception e) {
- parse.addProblem(dayText+" has invalid hours part '"+part+"': "+e.getMessage());
+ parse.addProblem(dayText+" has invalid hours part '"+part+"': "+e.getMessage(), dayElement);
}
dayPartIndex++;
}
} else {
- parse.addProblem(dayText+" must have attribute 'hours'");
+ parse.addProblem(dayText+" must have attribute 'hours'", dayElement);
}
DayPart[] dayPartArray = new DayPart[dayParts.size()];
@@ -186,7 +186,7 @@
holiday.setToDay(toDate);
} else {
- parse.addProblem("attribute 'period' in element business-calendar is required");
+ parse.addProblem("attribute 'period' in element business-calendar is required", holidayElement);
}
// now we are going to set the toDay to the end of the day, rather then the beginning.
@@ -198,7 +198,7 @@
holiday.setToDay(toDay);
} catch (Exception e) {
- parse.addProblem("couldn't parse holiday: "+XmlUtil.toString(holidayElement));
+ parse.addProblem("couldn't parse holiday: "+XmlUtil.toString(holidayElement), holidayElement);
}
return holiday;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ByteBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ByteBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ByteBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -48,7 +48,7 @@
return byteDescriptor;
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a byte", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a byte", element), element);
}
return null;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CharBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CharBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CharBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -42,7 +42,7 @@
protected AbstractDescriptor createDescriptor(String value, Element element, Parse parse) {
CharacterDescriptor characterDescriptor = new CharacterDescriptor();
if (value.length()!=1) {
- parse.addProblem(createValueExceptionMessage("length of value must be 1", element));
+ parse.addProblem(createValueExceptionMessage("length of value must be 1", element), element);
return null;
}
char c = value.charAt(0);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ClassBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ClassBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ClassBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -26,7 +26,7 @@
classDescriptor = new ClassDescriptor();
classDescriptor.setClassName(className);
} else {
- parse.addProblem("class must have classname attribute: "+XmlUtil.toString(element));
+ parse.addProblem("class must have classname attribute: "+XmlUtil.toString(element), element);
}
return classDescriptor;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DoubleBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DoubleBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DoubleBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -45,7 +45,7 @@
try {
doubleValue = new Double(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a double", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a double", element), element);
return null;
}
doubleDescriptor.setValue(doubleValue);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FieldBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FieldBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FieldBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -47,7 +47,7 @@
if (element.hasAttribute("name")) {
fieldOperation.setFieldName(element.getAttribute("name"));
} else {
- parse.addProblem("field must have name : "+XmlUtil.toString(element));
+ parse.addProblem("field must have name : "+XmlUtil.toString(element), element);
}
Element descriptorElement = XmlUtil.element(element);
if (descriptorElement!=null) {
@@ -55,10 +55,10 @@
if (descriptor!=null) {
fieldOperation.setDescriptor(descriptor);
} else {
- parse.addProblem("unknown descriptor element "+descriptorElement.getTagName()+" inside field operation: "+XmlUtil.toString(element));
+ parse.addProblem("unknown descriptor element "+descriptorElement.getTagName()+" inside field operation: "+XmlUtil.toString(element), element);
}
} else {
- parse.addProblem("field must have 1 descriptor element out of "+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content: "+XmlUtil.toString(element));
+ parse.addProblem("field must have 1 descriptor element out of "+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content: "+XmlUtil.toString(element), element);
}
return fieldOperation;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FloatBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FloatBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FloatBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -45,7 +45,7 @@
try {
floatValue = new Float(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a float", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a float", element), element);
return null;
}
floatDescriptor.setValue(floatValue);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/HibernateConfigurationBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/HibernateConfigurationBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/HibernateConfigurationBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -105,7 +105,7 @@
descriptor.addCfgUrl(urlText);
} else {
- parse.addProblem("exactly 1 attribute in {resource, file, url} was expected in cfg: "+XmlUtil.toString(configElement));
+ parse.addProblem("exactly 1 attribute in {resource, file, url} was expected in cfg: "+XmlUtil.toString(configElement), element);
}
} else if ("mapping".equals(XmlUtil.getTagLocalName(configElement))) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IntBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IntBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IntBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -45,7 +45,7 @@
try {
integerValue = new Integer(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to an int", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to an int", element), element);
return null;
}
integerDescriptor.setValue(integerValue);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/InvokeBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/InvokeBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/InvokeBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -48,7 +48,7 @@
if (element.hasAttribute("method")) {
invokeOperation.setMethodName(element.getAttribute("method"));
} else {
- parse.addProblem("invoke must have method : "+XmlUtil.toString(element));
+ parse.addProblem("invoke must have method : "+XmlUtil.toString(element), element);
}
List<Element> argElements = XmlUtil.elements(element, "arg");
Parser wireParser = (Parser) parser;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JndiBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JndiBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JndiBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -45,7 +45,7 @@
return new JndiDescriptor(jndiName);
} else {
- parse.addProblem("jndi requires attribute 'jndi-name'");
+ parse.addProblem("jndi requires attribute 'jndi-name'", element);
}
return null;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/LongBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/LongBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/LongBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -45,7 +45,7 @@
try {
longValue = new Long(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a long", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a long", element), element);
return null;
}
longDescriptor.setValue(longValue);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -94,7 +94,7 @@
serverDescriptor.addInjection("sessionProperties", propertiesDescriptor);
}
else {
- parse.addProblem("missing mail session properties");
+ parse.addProblem("missing mail session properties", element);
}
// authenticator
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MapBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MapBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MapBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -78,7 +78,7 @@
keyDescriptors.add(keyDescriptor);
valueDescriptors.add(valueDescriptor);
} else {
- parse.addProblem("entry must have key and value element with a single descriptor as contents: "+XmlUtil.toString(entryElement));
+ parse.addProblem("entry must have key and value element with a single descriptor as contents: "+XmlUtil.toString(entryElement), element);
}
} else {
parse.addProblem("map can only contain entry elements: "+XmlUtil.toString(entryElement));
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -59,7 +59,7 @@
JndiDescriptor jndiDescriptor = new JndiDescriptor(jmsSessionJndiName);
objectDescriptor.addInjection("jmsSession", jndiDescriptor);
} else {
- parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+" session-jndi=\"...\" is required when target=\"jms\"");
+ parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+" session-jndi=\"...\" is required when target=\"jms\"", element);
}
if (element.hasAttribute("destination-jndi")) {
@@ -67,7 +67,7 @@
JndiDescriptor jndiDescriptor = new JndiDescriptor(jmsDestinationJndiName);
objectDescriptor.addInjection("jmsDestination", jndiDescriptor);
} else {
- parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+" destination-jndi=\"...\" is required when target=\"jms\"");
+ parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+" destination-jndi=\"...\" is required when target=\"jms\"", element);
}
} else {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -77,10 +77,10 @@
if (className!=null) {
descriptor.setClassName(className);
if (factoryObjectName!=null) {
- parse.addProblem("attribute 'factory' is specified together with attribute 'class' in element 'object': "+XmlUtil.toString(element));
+ parse.addProblem("attribute 'factory' is specified together with attribute 'class' in element 'object': "+XmlUtil.toString(element), element);
}
if (factoryElement!=null) {
- parse.addProblem("element 'factory' is specified together with attribute 'class' in element 'object': "+XmlUtil.toString(element));
+ parse.addProblem("element 'factory' is specified together with attribute 'class' in element 'object': "+XmlUtil.toString(element), element);
}
Element constructorElement = XmlUtil.element(element, "constructor");
@@ -90,14 +90,14 @@
descriptor.setArgDescriptors(argDescriptors);
if (element.hasAttribute("method")) {
- parse.addProblem("attributes 'class' and 'method' indicate static method and also a 'constructor' element is specified for element 'object': "+XmlUtil.toString(element));
+ parse.addProblem("attributes 'class' and 'method' indicate static method and also a 'constructor' element is specified for element 'object': "+XmlUtil.toString(element), element);
}
}
} else if (factoryObjectName!=null) {
descriptor.setFactoryObjectName(factoryObjectName);
if (factoryElement!=null) {
- parse.addProblem("element 'factory' is specified together with attribute 'factory' in element 'object': "+XmlUtil.toString(element));
+ parse.addProblem("element 'factory' is specified together with attribute 'factory' in element 'object': "+XmlUtil.toString(element), element);
}
} else if (factoryElement!=null) {
@@ -111,7 +111,7 @@
descriptor.setLang(lang);
} else {
- parse.addProblem("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}: "+XmlUtil.toString(element));
+ parse.addProblem("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}: "+XmlUtil.toString(element), element);
}
// method
@@ -124,13 +124,13 @@
} else if ( (factoryObjectName!=null)
|| (factoryElement!=null)
) {
- parse.addProblem("element 'object' with a element 'factory' or a attribute 'factory' must have a attribute 'method': "+XmlUtil.toString(element));
+ parse.addProblem("element 'object' with a element 'factory' or a attribute 'factory' must have a attribute 'method': "+XmlUtil.toString(element), element);
}
if( (className == null)
&& (XmlUtil.element(element, "constructor") != null)
) {
- parse.addProblem("element 'object' with a 'constructor' element must have 'class' attribute: "+XmlUtil.toString(element));
+ parse.addProblem("element 'object' with a 'constructor' element must have 'class' attribute: "+XmlUtil.toString(element), element);
}
// read the operations elements
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -81,10 +81,10 @@
keyDescriptors.add(new StringDescriptor(name));
valueDescriptors.add(new StringDescriptor(value));
} else {
- parse.addProblem("property must have name and value attributes: "+XmlUtil.toString(propertyElement));
+ parse.addProblem("property must have name and value attributes: "+XmlUtil.toString(propertyElement), element);
}
} else {
- parse.addProblem("properties can only contain property elements: "+XmlUtil.toString(propertyElement));
+ parse.addProblem("properties can only contain property elements: "+XmlUtil.toString(propertyElement), element);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertyBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertyBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertyBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -86,7 +86,7 @@
} else if (element.hasAttribute("name")) {
propertyOperation.setPropertyName(element.getAttribute("name"));
} else {
- parse.addProblem("property must have name or setter attribute: "+XmlUtil.toString(element));
+ parse.addProblem("property must have name or setter attribute: "+XmlUtil.toString(element), element);
}
Element descriptorElement = XmlUtil.element(element);
if (descriptorElement!=null) {
@@ -94,10 +94,10 @@
if (descriptor!=null) {
propertyOperation.setDescriptor(descriptor);
} else {
- parse.addProblem("couldn't parse property content element as a value descriptor: "+XmlUtil.toString(element));
+ parse.addProblem("couldn't parse property content element as a value descriptor: "+XmlUtil.toString(element), element);
}
} else {
- parse.addProblem("property must have 1 descriptor element out of "+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content: "+XmlUtil.toString(element));
+ parse.addProblem("property must have 1 descriptor element out of "+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content: "+XmlUtil.toString(element), element);
}
return propertyOperation;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RefBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RefBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RefBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -45,7 +45,7 @@
if (element.hasAttribute("object")) {
descriptor.setValue(element.getAttribute("object"));
} else {
- parse.addProblem("ref must have object attribute: "+XmlUtil.toString(element));
+ parse.addProblem("ref must have object attribute: "+XmlUtil.toString(element), element);
}
return descriptor;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RetryInterceptorBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RetryInterceptorBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RetryInterceptorBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -48,7 +48,7 @@
int retries = Integer.parseInt(retriesText);
retryInterceptorDescriptor.setRetries(retries);
} catch (NumberFormatException e) {
- parse.addProblem("couldn't parse retries "+retriesText);
+ parse.addProblem("couldn't parse retries "+retriesText, element);
}
}
@@ -58,7 +58,7 @@
long delay = Long.parseLong(delayText);
retryInterceptorDescriptor.setDelay(delay);
} catch (NumberFormatException e) {
- parse.addProblem("couldn't parse delay "+delayText);
+ parse.addProblem("couldn't parse delay "+delayText, element);
}
}
@@ -68,7 +68,7 @@
long delayFactor = Long.parseLong(delayFactorText);
retryInterceptorDescriptor.setDelayFactor(delayFactor);
} catch (NumberFormatException e) {
- parse.addProblem("couldn't parse delay-factor "+delayFactorText);
+ parse.addProblem("couldn't parse delay-factor "+delayFactorText, element);
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -66,7 +66,7 @@
descriptor.addInjection("readContextNames", new ProvidedObjectDescriptor(readContextNames));
} else {
- parse.addProblem("'read-contexts' is a required attribute in element <script-manager />");
+ parse.addProblem("'read-contexts' is a required attribute in element <script-manager />", element);
}
if (element.hasAttribute("write-context")) {
@@ -74,7 +74,7 @@
descriptor.addInjection("writeContextName", new StringDescriptor(writeContextName));
} else {
- parse.addProblem("'write-context' is a required attribute in element <script-manager />");
+ parse.addProblem("'write-context' is a required attribute in element <script-manager />", element);
}
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
@@ -84,13 +84,13 @@
if (scriptElement.hasAttribute("name")) {
languageName = scriptElement.getAttribute("name");
} else {
- parse.addProblem("'name' is a required attribute in element <script-language />");
+ parse.addProblem("'name' is a required attribute in element <script-language />", element);
}
String factoryClassName = null;
if (scriptElement.hasAttribute("factory")) {
factoryClassName = scriptElement.getAttribute("factory");
} else {
- parse.addProblem("'name' is a required attribute in element <script-language />");
+ parse.addProblem("'name' is a required attribute in element <script-language />", element);
}
if ( (languageName!=null)
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ShortBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ShortBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ShortBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -45,7 +45,7 @@
try {
shortValue = new Short(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a short", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"' cannot be parsed to a short", element), element);
return null;
}
shortDescriptor.setValue(shortValue);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -54,7 +54,7 @@
} else if ("jta".equals(type)){
transactionDescriptor = new ObjectDescriptor(JtaTransaction.class);
} else {
- parse.addProblem("unsupported transaction type: "+type);
+ parse.addProblem("unsupported transaction type: "+type, element);
}
return transactionDescriptor;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TypesBinding.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TypesBinding.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TypesBinding.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -65,7 +65,7 @@
streamSource = new FileStreamInput(file);
parser.importStream(streamSource, element, parse);
} else {
- parse.addProblem("file "+fileName+" isn't a file");
+ parse.addProblem("file "+fileName+" isn't a file", element);
}
}
@@ -126,10 +126,10 @@
} else if ("string".equalsIgnoreCase(idType)) {
matcher = new HibernateStringIdMatcher(hibernateSessionFactoryName);
} else {
- parse.addProblem("id-type was not 'long' or 'string': "+idType);
+ parse.addProblem("id-type was not 'long' or 'string': "+idType, element);
}
} else {
- parse.addProblem("id-type is required in a persistable type");
+ parse.addProblem("id-type is required in a persistable type", element);
}
// otherwise, we expect type="some.java.ClassName"
@@ -145,10 +145,10 @@
try {
matcher = (Matcher) parser.parseElement(matcherObjectElement, parse);
} catch (ClassCastException e) {
- parse.addProblem("matcher is not a "+Matcher.class.getName()+": "+(matcher!=null ? matcher.getClass().getName() : "null"));
+ parse.addProblem("matcher is not a "+Matcher.class.getName()+": "+(matcher!=null ? matcher.getClass().getName() : "null"), element);
}
} else {
- parse.addProblem("no matcher specified in "+XmlUtil.toString(element));
+ parse.addProblem("no matcher specified in "+XmlUtil.toString(element), element);
}
}
@@ -163,7 +163,7 @@
Class<?> converterClass = ReflectUtil.loadClass(classLoader, converterClassName);
converter = (Converter) converterClass.newInstance();
} catch (Exception e) {
- parse.addProblem("couldn't instantiate converter "+converterClassName);
+ parse.addProblem("couldn't instantiate converter "+converterClassName, element);
}
} else {
// look for the matcher element
@@ -173,7 +173,7 @@
try {
converter = (Converter) parser.parseElement(converterObjectElement, parse);
} catch (ClassCastException e) {
- parse.addProblem("converter is not a "+Converter.class.getName()+": "+(converter!=null ? converter.getClass().getName() : "null"));
+ parse.addProblem("converter is not a "+Converter.class.getName()+": "+(converter!=null ? converter.getClass().getName() : "null"), element);
}
}
}
@@ -192,7 +192,7 @@
parse.addProblem("couldn't instantiate variable-class "+variableClassName, e);
}
} else {
- parse.addProblem("variable-class is required on a type: "+XmlUtil.toString(element));
+ parse.addProblem("variable-class is required on a type: "+XmlUtil.toString(element), element);
}
type.setVariableClass(variableClass);
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/BindingParser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/BindingParser.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/BindingParser.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -52,7 +52,7 @@
log.trace("couldn't instantiate binding "+bindingClassName);
}
} else {
- parse.addProblem("class is a required attribute in a binding "+XmlUtil.toString(bindingElement));
+ parse.addProblem("class is a required attribute in a binding "+XmlUtil.toString(bindingElement), documentElement);
}
if (binding!=null) {
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2009-06-19 14:04:27 UTC (rev 5067)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2009-06-19 15:53:46 UTC (rev 5068)
@@ -511,7 +511,7 @@
if (binding!=null) {
object = binding.parse(element, parse, this);
} else {
- parse.addProblem("no element parser for tag "+tagName+(category!=null ? " in category "+category : " in the default category"));
+ parse.addProblem("no element parser for tag "+tagName+(category!=null ? " in category "+category : " in the default category"), element);
}
return object;
@@ -532,7 +532,7 @@
argDescriptor.setTypeName(XmlUtil.attribute(argElement, "type"));
Element descriptorElement = XmlUtil.element(argElement);
if (descriptorElement==null) {
- parse.addProblem("arg must contain exactly one descriptor element out of "+bindings.getTagNames(category)+" as contents:"+XmlUtil.toString((Element) argElement.getParentNode()));
+ parse.addProblem("arg must contain exactly one descriptor element out of "+bindings.getTagNames(category)+" as contents:"+XmlUtil.toString((Element) argElement.getParentNode()), argElement);
} else {
Descriptor descriptor = (Descriptor) parseElement(descriptorElement, parse, category);
argDescriptor.setDescriptor(descriptor);
16 years, 10 months
JBoss JBPM SVN: r5067 - jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi.
by do-not-reply@jboss.org
Author: camunda
Date: 2009-06-19 10:04:27 -0400 (Fri, 19 Jun 2009)
New Revision: 5067
Modified:
jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java
Log:
added link to JBPM-2242 in code
Modified: jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java
===================================================================
--- jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java 2009-06-19 11:51:05 UTC (rev 5066)
+++ jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/DeploymentAdaptor.java 2009-06-19 14:04:27 UTC (rev 5067)
@@ -113,6 +113,7 @@
// just suspend the process instance (not delete it), see
// http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4238250
+ // see https://jira.jboss.org/jira/browse/JBPM-2242 as well
repositoryService.suspendDeployment(deploymentRef.getDeploymentDbid());
}
else
16 years, 10 months