[jbpm-commits] JBoss JBPM SVN: r3172 - in projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration: jbpm3 and 1 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Dec 3 03:43:31 EST 2008
Author: thomas.diesler at jboss.com
Date: 2008-12-03 03:43:30 -0500 (Wed, 03 Dec 2008)
New Revision: 3172
Added:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3InvocationProxy.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/InvocationProxy.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessEngineFactory.java
Removed:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementFactory.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/TaskManagementImpl.java
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/UserManagementImpl.java
Log:
Restore jBPM3 integration
Deleted: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java 2008-12-03 08:42:45 UTC (rev 3171)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/InvocationProxy.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.bpm.console.server.integration;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.console.server.util.ServiceLocator;
-
-import javax.transaction.SystemException;
-import javax.transaction.UserTransaction;
-import java.lang.reflect.Method;
-
-/**
- * Decorates management invocations with common system aspects,
- * i.e. transaction demarcation.
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class InvocationProxy implements java.lang.reflect.InvocationHandler
-{
- private static final Log log = LogFactory.getLog(InvocationProxy.class);
-
- private Object obj;
-
- public static Object newInstance(Object obj) {
- return java.lang.reflect.Proxy.newProxyInstance(
- obj.getClass().getClassLoader(),
- obj.getClass().getInterfaces(),
- new InvocationProxy(obj));
- }
-
- private InvocationProxy(Object obj) {
- this.obj = obj;
- }
-
- public Object invoke(Object proxy, Method m, Object[] args)
- throws Throwable
- {
- Object result;
-
- UserTransaction tx = ServiceLocator.getUserTransaction();
-
- try
- {
- // before method invocation
- tx.begin();
-
- // field target invocation
- result = m.invoke(obj, args);
-
- tx.commit();
-
- }
- catch (Throwable e)
- {
- if(tx!=null)
- {
- try
- {
- tx.rollback();
- }
- catch (SystemException e1) {
- log.error("Failed to rollback on " + obj + " -> " + m.getName());
- }
- }
-
- throw new RuntimeException("Unexpected invocation exception: " + e.getMessage(), e);
-
- }
- finally
- {
- // after method invocation
-
- }
-
- return result;
- }
-}
\ No newline at end of file
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java 2008-12-03 08:42:45 UTC (rev 3171)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/ManagementFactory.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -36,7 +36,6 @@
public static ManagementFactory newInstance()
{
return new ManagementFactoryImpl();
- //return new JBPM3ManagementFactory();
}
public abstract ProcessManagement createProcessManagement();
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3InvocationProxy.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3InvocationProxy.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3InvocationProxy.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -0,0 +1,98 @@
+/*
+ * 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.integration.jbpm3;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.bpm.console.server.util.ServiceLocator;
+
+/**
+ * Decorates management invocations with common system aspects, i.e. transaction demarcation.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class JBPM3InvocationProxy implements InvocationHandler
+{
+ private static final Log log = LogFactory.getLog(JBPM3InvocationProxy.class);
+
+ private Object obj;
+
+ public static Object newInstance(Object obj)
+ {
+ return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new JBPM3InvocationProxy(obj));
+ }
+
+ private JBPM3InvocationProxy(Object obj)
+ {
+ this.obj = obj;
+ }
+
+ public Object invoke(Object proxy, Method m, Object[] args) throws Throwable
+ {
+ Object result;
+
+ UserTransaction tx = ServiceLocator.getUserTransaction();
+
+ try
+ {
+ // before method invocation
+ tx.begin();
+
+ // field target invocation
+ result = m.invoke(obj, args);
+
+ tx.commit();
+
+ }
+ catch (Throwable e)
+ {
+ if (tx != null)
+ {
+ try
+ {
+ tx.rollback();
+ }
+ catch (SystemException e1)
+ {
+ log.error("Failed to rollback on " + obj + " -> " + m.getName());
+ }
+ }
+
+ throw new RuntimeException("Unexpected invocation exception: " + e.getMessage(), e);
+
+ }
+ finally
+ {
+ // after method invocation
+
+ }
+
+ return result;
+ }
+}
\ No newline at end of file
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3InvocationProxy.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementFactory.java 2008-12-03 08:42:45 UTC (rev 3171)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/jbpm3/JBPM3ManagementFactory.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -24,7 +24,7 @@
import org.jboss.bpm.console.server.integration.*;
/**
- * Wraps management instances in {@link org.jboss.bpm.console.server.integration.InvocationProxy}
+ * Wraps management instances in {@link org.jboss.bpm.console.server.integration.jbpm3.JBPM3InvocationProxy}
* @author Heiko.Braun <heiko.braun at jboss.com>
*/
public class JBPM3ManagementFactory extends ManagementFactory
@@ -32,23 +32,23 @@
public ProcessManagement createProcessManagement()
{
- return (ProcessManagement) InvocationProxy.newInstance(new JBPM3ProcessManagement());
+ return (ProcessManagement) JBPM3InvocationProxy.newInstance(new JBPM3ProcessManagement());
}
public ExtensionManagement createExtensionManagement()
{
- return (ExtensionManagement) InvocationProxy.newInstance( new JBPM3ManagementExtension() );
+ return (ExtensionManagement) JBPM3InvocationProxy.newInstance( new JBPM3ManagementExtension() );
}
public TaskManagement createTaskManagement()
{
- return (TaskManagement) InvocationProxy.newInstance( new JBPM3TaskManagement() );
+ return (TaskManagement) JBPM3InvocationProxy.newInstance( new JBPM3TaskManagement() );
}
public UserManagement createUserManagement()
{
- return (UserManagement) InvocationProxy.newInstance( new JBPM3UserManagement() );
+ return (UserManagement) JBPM3InvocationProxy.newInstance( new JBPM3UserManagement() );
}
}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/InvocationProxy.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/InvocationProxy.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/InvocationProxy.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -0,0 +1,69 @@
+/*
+ * 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.integration.spec;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.jboss.bpm.api.runtime.ExecutionContext;
+import org.jboss.bpm.api.service.ExecutionContextService;
+
+/**
+ * Decorates management invocations with common system aspects.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ * @author Thomas.Diesler at jboss.com
+ */
+public class InvocationProxy implements InvocationHandler
+{
+ private Object obj;
+
+ public static Object newInstance(Object obj)
+ {
+ return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new InvocationProxy(obj));
+ }
+
+ private InvocationProxy(Object obj)
+ {
+ this.obj = obj;
+ }
+
+ public Object invoke(Object proxy, Method m, Object[] args) throws Throwable
+ {
+ ExecutionContextService ctxService = ProcessEngineFactory.getProcessEngine().getService(ExecutionContextService.class);
+ ExecutionContext bpmContext = ctxService.getExecutionContext(true);
+ try
+ {
+ return m.invoke(obj, args);
+ }
+ catch (InvocationTargetException ex)
+ {
+ throw ex.getTargetException();
+ }
+ finally
+ {
+ bpmContext.close();
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/InvocationProxy.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java 2008-12-03 08:42:45 UTC (rev 3171)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ManagementFactoryImpl.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -22,12 +22,13 @@
package org.jboss.bpm.console.server.integration.spec;
import org.jboss.bpm.console.server.integration.ExtensionManagement;
-import org.jboss.bpm.console.server.integration.InvocationProxy;
import org.jboss.bpm.console.server.integration.ManagementFactory;
import org.jboss.bpm.console.server.integration.ProcessManagement;
import org.jboss.bpm.console.server.integration.TaskManagement;
import org.jboss.bpm.console.server.integration.UserManagement;
+import org.jboss.bpm.console.server.integration.jbpm3.JBPM3InvocationProxy;
import org.jboss.bpm.console.server.integration.jbpm3.JBPM3ManagementExtension;
+import org.jboss.bpm.console.server.integration.jbpm3.JBPM3ProcessManagement;
import org.jboss.bpm.console.server.integration.jbpm3.JBPM3TaskManagement;
import org.jboss.bpm.console.server.integration.jbpm3.JBPM3UserManagement;
@@ -36,25 +37,46 @@
*/
public class ManagementFactoryImpl extends ManagementFactory
{
+ private boolean useSpecIntegration = false;
+
public ProcessManagement createProcessManagement()
{
- return new ProcessManagementImpl();
+ if (useSpecIntegration)
+ {
+ return (ProcessManagement)InvocationProxy.newInstance(new ProcessManagementImpl());
+ }
+ else
+ {
+ return (ProcessManagement)JBPM3InvocationProxy.newInstance(new JBPM3ProcessManagement());
+ }
}
public TaskManagement createTaskManagement()
{
- // return new TaskManagementImpl();
- return (TaskManagement)InvocationProxy.newInstance(new JBPM3TaskManagement());
+ if (useSpecIntegration)
+ {
+ return (TaskManagement)InvocationProxy.newInstance(new TaskManagementImpl());
+ }
+ else
+ {
+ return (TaskManagement)JBPM3InvocationProxy.newInstance(new JBPM3TaskManagement());
+ }
}
public UserManagement createUserManagement()
{
- // return new UserManagementImpl();
- return (UserManagement)InvocationProxy.newInstance(new JBPM3UserManagement());
+ if (useSpecIntegration)
+ {
+ return (UserManagement)InvocationProxy.newInstance(new UserManagementImpl());
+ }
+ else
+ {
+ return (UserManagement)JBPM3InvocationProxy.newInstance(new JBPM3UserManagement());
+ }
}
public ExtensionManagement createExtensionManagement()
{
- return (ExtensionManagement)InvocationProxy.newInstance(new JBPM3ManagementExtension());
+ return (ExtensionManagement)JBPM3InvocationProxy.newInstance(new JBPM3ManagementExtension());
}
}
Added: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessEngineFactory.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessEngineFactory.java (rev 0)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessEngineFactory.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -0,0 +1,37 @@
+/*
+ * 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.integration.spec;
+
+import org.jboss.bpm.api.client.Configuration;
+import org.jboss.bpm.api.client.ProcessEngine;
+
+/**
+ * @author Thomas.Diesler at jboss.com
+ */
+abstract class ProcessEngineFactory
+{
+ static ProcessEngine getProcessEngine()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ return engine;
+ }
+}
Property changes on: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessEngineFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-12-03 08:42:45 UTC (rev 3171)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -29,7 +29,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.api.client.Configuration;
import org.jboss.bpm.api.client.ProcessEngine;
import org.jboss.bpm.api.model.Gateway;
import org.jboss.bpm.api.model.Node;
@@ -204,7 +203,7 @@
private ProcessDefinitionService getProcessDefinitionService()
{
- ProcessEngine engine = Configuration.getProcessEngine();
+ ProcessEngine engine = ProcessEngineFactory.getProcessEngine();
ProcessDefinitionService pdService = engine.getService(ProcessDefinitionService.class);
return pdService;
}
@@ -235,7 +234,7 @@
private ProcessService getProcessService()
{
- ProcessEngine engine = Configuration.getProcessEngine();
+ ProcessEngine engine = ProcessEngineFactory.getProcessEngine();
ProcessService pService = engine.getService(ProcessService.class);
return pService;
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/TaskManagementImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/TaskManagementImpl.java 2008-12-03 08:42:45 UTC (rev 3171)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/TaskManagementImpl.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -28,7 +28,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.api.client.Configuration;
import org.jboss.bpm.api.client.ProcessEngine;
import org.jboss.bpm.api.model.Node;
import org.jboss.bpm.api.model.Process;
@@ -148,14 +147,14 @@
private TaskService getTaskService()
{
- ProcessEngine engine = Configuration.getProcessEngine();
+ ProcessEngine engine = ProcessEngineFactory.getProcessEngine();
TaskService taskService = engine.getService(TaskService.class);
return taskService;
}
private ExecutionService getExecutionService()
{
- ProcessEngine engine = Configuration.getProcessEngine();
+ ProcessEngine engine = ProcessEngineFactory.getProcessEngine();
ExecutionService exService = engine.getService(ExecutionService.class);
return exService;
}
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/UserManagementImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/UserManagementImpl.java 2008-12-03 08:42:45 UTC (rev 3171)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/UserManagementImpl.java 2008-12-03 08:43:30 UTC (rev 3172)
@@ -25,7 +25,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.bpm.api.client.Configuration;
import org.jboss.bpm.api.client.ProcessEngine;
import org.jboss.bpm.api.service.IdentityService;
import org.jboss.bpm.console.server.integration.UserManagement;
@@ -66,7 +65,7 @@
private IdentityService getIdentityService()
{
- ProcessEngine engine = Configuration.getProcessEngine();
+ ProcessEngine engine = ProcessEngineFactory.getProcessEngine();
IdentityService identService = engine.getService(IdentityService.class);
return identService;
}
More information about the jbpm-commits
mailing list