JBoss JBPM SVN: r2580 - jbpm3/trunk/modules/enterprise/ear.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-10-22 09:08:30 -0400 (Wed, 22 Oct 2008)
New Revision: 2580
Modified:
jbpm3/trunk/modules/enterprise/ear/pom.xml
Log:
JBPM-1779: Remove gwt console from enterprise package. Will ship as an optional component with it's own lifecycle
Modified: jbpm3/trunk/modules/enterprise/ear/pom.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/ear/pom.xml 2008-10-22 13:07:30 UTC (rev 2579)
+++ jbpm3/trunk/modules/enterprise/ear/pom.xml 2008-10-22 13:08:30 UTC (rev 2580)
@@ -47,18 +47,6 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-war</artifactId>
- <version>${version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-server-war</artifactId>
- <version>${version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm-core</artifactId>
<version>${version}</version>
<exclusions>
@@ -133,21 +121,7 @@
<bundleFileName>jbpm-console.war</bundleFileName>
<contextRoot>/jbpm-console</contextRoot>
<unpack>true</unpack>
- </webModule>
- <webModule>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-war</artifactId>
- <bundleFileName>gwt-console.war</bundleFileName>
- <contextRoot>/gwt-console</contextRoot>
- <unpack>true</unpack>
- </webModule>
- <webModule>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-server-war</artifactId>
- <bundleFileName>gwt-console-server.war</bundleFileName>
- <contextRoot>/gwt-console-server</contextRoot>
- <unpack>true</unpack>
- </webModule>
+ </webModule>
</modules>
</configuration>
</plugin>
17 years, 6 months
JBoss JBPM SVN: r2579 - in jbpm3/trunk/modules/gwt-console/war: src and 10 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-10-22 09:07:30 -0400 (Wed, 22 Oct 2008)
New Revision: 2579
Added:
jbpm3/trunk/modules/gwt-console/war/GWT_TEST_README.txt
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Authentication.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
jbpm3/trunk/modules/gwt-console/war/src/test/
jbpm3/trunk/modules/gwt-console/war/src/test/java/
jbpm3/trunk/modules/gwt-console/war/src/test/java/BlankTest.java
jbpm3/trunk/modules/gwt-console/war/src/test/java/org/
jbpm3/trunk/modules/gwt-console/war/src/test/java/org/jboss/
jbpm3/trunk/modules/gwt-console/war/src/test/java/org/jboss/bpm/
jbpm3/trunk/modules/gwt-console/war/src/test/java/org/jboss/bpm/console/
jbpm3/trunk/modules/gwt-console/war/src/test/java/org/jboss/bpm/console/client/
jbpm3/trunk/modules/gwt-console/war/src/test/java/org/jboss/bpm/console/client/GwtTestApplication.java
jbpm3/trunk/modules/gwt-console/war/src/test/resources/
Removed:
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/RestURL.java
Modified:
jbpm3/trunk/modules/gwt-console/war/pom.xml
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Application.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
Log:
GwtTest sample, first cut. begin refactoring towards better testability
Added: jbpm3/trunk/modules/gwt-console/war/GWT_TEST_README.txt
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/GWT_TEST_README.txt (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/GWT_TEST_README.txt 2008-10-22 13:07:30 UTC (rev 2579)
@@ -0,0 +1,12 @@
+Special node for executing GWT tests under linux:
+The GWT-maven plugin executes any test prefixed "GwtTest"
+(See http://gwt-maven.googlecode.com/svn/docs/maven-googlewebtoolkit2-plugin/t...)
+It reads stderr in order to figure wether or not the test has been successful.
+On fedora (or any other linux) it happens that that mozilla components issue the following
+INFO message to stderr, which causes the test to fail:
+
+> Gtk-WARNING **: Unable to locate theme engine in module_path: "nodoka"
+
+This is caused by missing nodoka (theme) package; please install it as follow:
+yum install gtk-nodoka-engine (on fedora)
+
Property changes on: jbpm3/trunk/modules/gwt-console/war/GWT_TEST_README.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/trunk/modules/gwt-console/war/pom.xml
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/pom.xml 2008-10-22 03:19:19 UTC (rev 2578)
+++ jbpm3/trunk/modules/gwt-console/war/pom.xml 2008-10-22 13:07:30 UTC (rev 2579)
@@ -98,7 +98,7 @@
<goal>mergewebxml</goal>
<goal>compile</goal>
<goal>gwt</goal>
- <!--goal>test</goal-->
+ <goal>test</goal>
</goals>
</execution>
</executions>
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Application.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Application.java 2008-10-22 03:19:19 UTC (rev 2578)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Application.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -7,12 +7,18 @@
*/
public class Application implements EntryPoint
{
+ private ConsoleView consoleView;
+
/**
* This is the entry point method.
*/
public void onModuleLoad()
{
- ConsoleView consoleView = new ConsoleView();
+ consoleView = new ConsoleView();
}
+ public ConsoleView getConsoleView()
+ {
+ return consoleView;
+ }
}
Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Authentication.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Authentication.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Authentication.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -0,0 +1,122 @@
+/*
+ * 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;
+
+import com.google.gwt.http.client.*;
+import org.jboss.bpm.console.client.model.DTOParser;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class Authentication
+{
+ private String loginUrl;
+ private AuthCallback callback;
+ private List<String> rolesAssigned = new ArrayList<String>();
+
+
+ public Authentication(String loginUrl)
+ {
+ this.loginUrl = loginUrl;
+ }
+
+ public Authentication(String loginUrl, AuthCallback callback)
+ {
+ this.loginUrl = loginUrl;
+ this.callback = callback;
+ }
+
+ /**
+ * Login, but leave credentials to GWT.
+ * This will pop up a username/password dialog netive to the browser.
+ */
+ public void doLogin()
+ {
+ doLogin(null,null);
+ }
+
+ /**
+ * Login using specific credentials.
+ * This delegates to {@link com.google.gwt.http.client.RequestBuilder#setUser(String)}
+ * and {@link com.google.gwt.http.client.RequestBuilder#setPassword(String)}
+ */
+ public void doLogin(String user, String pass)
+ {
+
+ RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, loginUrl);
+
+ if(user!=null&&pass!=null)
+ {
+ rb.setUser(user);
+ rb.setPassword(pass);
+ }
+
+ try
+ {
+ rb.sendRequest(null,
+ new RequestCallback() {
+
+ public void onResponseReceived(Request request, Response response)
+ {
+ // parse roles
+ rolesAssigned = DTOParser.parseRolesAssigned(response.getText());
+ if(callback!=null) callback.onLoginSuccess(request, response);
+ }
+
+ public void onError(Request request, Throwable t)
+ {
+ // auth failed
+ if(callback!=null)
+ callback.onLoginFailed(request, t);
+ else
+ throw new RuntimeException("Login failed", t);
+ }
+ });
+ }
+
+ catch (RequestException e1)
+ {
+ throw new RuntimeException("Unknown error upon login attempt", e1);
+ }
+ }
+
+
+ public void setCallback(AuthCallback callback)
+ {
+ this.callback = callback;
+ }
+
+ public interface AuthCallback
+ {
+ void onLoginSuccess(Request request, Response response);
+ void onLoginFailed(Request request, Throwable t);
+ }
+
+
+ public List<String> getRolesAssigned()
+ {
+ return rolesAssigned;
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/Authentication.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java 2008-10-22 03:19:19 UTC (rev 2578)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/ConsoleView.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -22,11 +22,8 @@
package org.jboss.bpm.console.client;
import com.google.gwt.core.client.GWT;
-import com.google.gwt.http.client.*;
-import com.google.gwt.json.client.JSONArray;
-import com.google.gwt.json.client.JSONObject;
-import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.http.client.Request;
+import com.google.gwt.http.client.Response;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.gwtext.client.core.EventObject;
@@ -43,9 +40,6 @@
import org.jboss.bpm.console.client.widgets.EditorView;
import org.jboss.bpm.console.client.widgets.UIConstants;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* The main composite that assembles the gwt console application.
*
@@ -57,16 +51,16 @@
private HeaderPanel header;
private MainMenu mainMenu;
private EditorPanel editorPanel;
- private RestURL restURL = new RestURL( "http://localhost:8080", "gwt-console-server");
+ private URLBuilder URLBuilder = new URLBuilder( "http://localhost:8080", "gwt-console-server");
private String[] rolesAssigned = new String[] {};
- private final static String[] POSSIBLE_ROLES = {"admin", "user"};
-
+ public final static String[] KNOWN_ROLES = {"admin", "user"};
+
private static final int WIDTH = 1024;
private static final int HEIGHT = 768;
private Viewport viewport;
-
+
public ConsoleView()
{
Panel mainPanel = createMainPanel();
@@ -131,13 +125,13 @@
panel.setStyleName("login-panel-content");
panel.setLayout(new VerticalLayout(10));
panel.add( new HTML("Welcome, please login.") );
-
+
final Window window = new Window();
window.setTitle("GWT-Console");
window.setClosable(false);
- window.setResizable(false);
+ window.setResizable(false);
window.setWidth(300);
- window.setHeight(180);
+ window.setHeight(180);
window.setLayout(new BorderLayout());
window.setCloseAction(Window.CLOSE);
@@ -149,62 +143,39 @@
if(GWT.isScript())
{
- String url = getRestURL().getUserInRoleURL(POSSIBLE_ROLES);
- RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url);
+ String url = getRestURL().getUserInRoleURL(KNOWN_ROLES);
+ final Authentication authentication = new Authentication(url);
+ authentication.setCallback(
+ new Authentication.AuthCallback()
+ {
- try
- {
- rb.sendRequest(null,
- new RequestCallback() {
+ public void onLoginSuccess(Request request, Response response)
+ {
+ // parse roles
+ rolesAssigned = authentication.getRolesAssigned().toArray(new String[] {});
- public void onResponseReceived(Request request, Response response)
- {
- // parse roles
- List<String> tmp = new ArrayList<String>();
+ // display main console
+ window.close();
+ mainPanel.show();
+ mainPanel.doLayout();
+ }
- JSONValue result = JSONParser.parse(response.getText());
- JSONValue jsonValue = result.isObject().get("roles");
- JSONArray array = jsonValue.isArray();
- for (int i = 0; i < array.size(); ++i)
- {
- JSONObject item = array.get(i).isObject();
- String assigned = item.get("assigned").toString();
- String roleName = item.get("role").toString();
+ public void onLoginFailed(Request request, Throwable t)
+ {
+ // auth failed
+ setError("Authentication failed.");
+ t.printStackTrace(System.out);
+ }
+ }
+ );
-
- if(assigned.equals("true"))
- {
- tmp.add(roleName);
- }
-
- }
-
- rolesAssigned = tmp.toArray(new String[] {});
-
- window.close();
- mainPanel.show();
- mainPanel.doLayout();
- }
-
- public void onError(Request request, Throwable t)
- {
- // auth failed
- setError("Authentication failed.");
- t.printStackTrace(System.out);
- }
- });
- }
- catch (RequestException e1)
- {
- setError(e1.getMessage());
- e1.printStackTrace();
- }
+ authentication.doLogin();
}
else
{
// hosted mode roles grant any role
// will popup BASIC Auth windows when required
- rolesAssigned = POSSIBLE_ROLES;
+ rolesAssigned = KNOWN_ROLES;
window.close();
mainPanel.show();
@@ -235,9 +206,9 @@
return editorPanel.hasEditor(id);
}
- public RestURL getRestURL()
+ public URLBuilder getRestURL()
{
- return restURL;
+ return URLBuilder;
}
public void showEditor(String id)
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java 2008-10-22 03:19:19 UTC (rev 2578)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/EditorPanel.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -83,7 +83,7 @@
}
return b;
- }
+ }
public void showTab(String id)
{
Deleted: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/RestURL.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/RestURL.java 2008-10-22 03:19:19 UTC (rev 2578)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/RestURL.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -1,112 +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.client;
-
-import org.jboss.bpm.console.client.model.ProcessInstance;
-
-/**
- * @author Heiko.Braun <heiko.braun(a)jboss.com>
- */
-public class RestURL
-{
- private final String consoleServerUrl;
- private final String webContext;
-
- public RestURL(String consoleServerUrl, String webContext)
- {
- this.consoleServerUrl = consoleServerUrl;
- this.webContext = webContext;
- }
-
- public String getConsoleServerUrl()
- {
- return consoleServerUrl;
- }
-
- public String getWebContext()
- {
- return webContext;
- }
-
- private String getBaseUrl()
- {
- return consoleServerUrl + "/" + webContext;
- }
-
- public String getProcessDefinitionURL()
- {
- return getBaseUrl() + "/rs/process/definitions";
- }
-
- public String getProcessInstanceURL(long processId)
- {
- return getBaseUrl() + "/rs/process/definitions/"+processId+"/instances";
- }
-
- public String getUserInRoleURL(String[] possibleRoles)
- {
- StringBuffer sb = new StringBuffer();
- for(int i=0; i<possibleRoles.length; i++)
- {
- sb.append(possibleRoles[i]);
- if(i<possibleRoles.length-1)
- sb.append(",");
- }
- return getBaseUrl() + "/rs/user/roles?roleCheck="+sb.toString();
- }
-
- @Deprecated
- public String getRemoveDefinitionURL(long processId)
- {
- return getBaseUrl() + "/rs/process/definitions/" + processId + "/remove";
- }
-
- public String getProcessImageURL(long processId)
- {
- return getBaseUrl() + "/rs/jbpm3/definitions/" + processId + "/image";
- }
-
- public String getDiagramInfoURL(long processId)
- {
- return getBaseUrl() + "/rs/jbpm3/definitions/" + processId + "/diagramInfo";
- }
-
- public String getActiveNodeInfoURL(long instanceId)
- {
- return getBaseUrl() + "/rs/jbpm3/instances/" + instanceId + "/activeNodeInfo";
- }
-
- public String getStateChangeURL(long instanceId, ProcessInstance.STATE state)
- {
- return getBaseUrl() + "/rs/process/instances/" + instanceId + "/state/"+state;
- }
-
- public String getStartNewInstanceURL(long processId)
- {
- return getBaseUrl() + "/rs/process/definitions/"+processId+"/instances/new";
- }
-
- public String getUploadDefinitionURL()
- {
- return getBaseUrl() + "/rs/jbpm3/definitions/new";
- }
-}
Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -0,0 +1,112 @@
+/*
+ * 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;
+
+import org.jboss.bpm.console.client.model.ProcessInstance;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class URLBuilder
+{
+ private final String consoleServerUrl;
+ private final String webContext;
+
+ public URLBuilder(String consoleServerUrl, String webContext)
+ {
+ this.consoleServerUrl = consoleServerUrl;
+ this.webContext = webContext;
+ }
+
+ public String getConsoleServerUrl()
+ {
+ return consoleServerUrl;
+ }
+
+ public String getWebContext()
+ {
+ return webContext;
+ }
+
+ private String getBaseUrl()
+ {
+ return consoleServerUrl + "/" + webContext;
+ }
+
+ public String getProcessDefinitionURL()
+ {
+ return getBaseUrl() + "/rs/process/definitions";
+ }
+
+ public String getProcessInstanceURL(long processId)
+ {
+ return getBaseUrl() + "/rs/process/definitions/"+processId+"/instances";
+ }
+
+ public String getUserInRoleURL(String[] possibleRoles)
+ {
+ StringBuffer sb = new StringBuffer();
+ for(int i=0; i<possibleRoles.length; i++)
+ {
+ sb.append(possibleRoles[i]);
+ if(i<possibleRoles.length-1)
+ sb.append(",");
+ }
+ return getBaseUrl() + "/rs/user/roles?roleCheck="+sb.toString();
+ }
+
+ @Deprecated
+ public String getRemoveDefinitionURL(long processId)
+ {
+ return getBaseUrl() + "/rs/process/definitions/" + processId + "/remove";
+ }
+
+ public String getProcessImageURL(long processId)
+ {
+ return getBaseUrl() + "/rs/jbpm3/definitions/" + processId + "/image";
+ }
+
+ public String getDiagramInfoURL(long processId)
+ {
+ return getBaseUrl() + "/rs/jbpm3/definitions/" + processId + "/diagramInfo";
+ }
+
+ public String getActiveNodeInfoURL(long instanceId)
+ {
+ return getBaseUrl() + "/rs/jbpm3/instances/" + instanceId + "/activeNodeInfo";
+ }
+
+ public String getStateChangeURL(long instanceId, ProcessInstance.STATE state)
+ {
+ return getBaseUrl() + "/rs/process/instances/" + instanceId + "/state/"+state;
+ }
+
+ public String getStartNewInstanceURL(long processId)
+ {
+ return getBaseUrl() + "/rs/process/definitions/"+processId+"/instances/new";
+ }
+
+ public String getUploadDefinitionURL()
+ {
+ return getBaseUrl() + "/rs/jbpm3/definitions/new";
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/URLBuilder.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -0,0 +1,61 @@
+/*
+ * 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 com.google.gwt.json.client.JSONValue;
+import com.google.gwt.json.client.JSONParser;
+import com.google.gwt.json.client.JSONArray;
+import com.google.gwt.json.client.JSONObject;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class DTOParser
+{
+ public static List<String> parseRolesAssigned(String json)
+ {
+ // parse roles
+ List<String> roles = new ArrayList<String>();
+
+ JSONValue result = JSONParser.parse(json);
+ JSONValue jsonValue = result.isObject().get("roles");
+ JSONArray array = jsonValue.isArray();
+ for (int i = 0; i < array.size(); ++i)
+ {
+ JSONObject item = array.get(i).isObject();
+ String assigned = item.get("assigned").toString();
+ String roleName = item.get("role").toString();
+
+
+ if(assigned.equals("true"))
+ {
+ roles.add(roleName);
+ }
+
+ }
+
+ return roles;
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/model/DTOParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-10-22 03:19:19 UTC (rev 2578)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -31,8 +31,7 @@
import org.jboss.bpm.console.client.model.ProcessDefinition;
import org.jboss.bpm.console.client.widgets.RemoteListView;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
/**
* @author Heiko.Braun <heiko.braun(a)jboss.com>
@@ -163,5 +162,17 @@
System.out.println("Loaded " + row2ProcessMap.size() + " records");
}
+
+ public List<ProcessDefinition> getAvailableProcessDefinitions()
+ {
+ List<ProcessDefinition> results = new ArrayList<ProcessDefinition>();
+ Iterator<Integer> keys = row2ProcessMap.keySet().iterator();
+ while(keys.hasNext())
+ {
+ results.add(row2ProcessMap.get(keys.next()));
+ }
+
+ return results;
+ }
}
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java 2008-10-22 03:19:19 UTC (rev 2578)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionListEditor.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -49,7 +49,7 @@
{
public final static String ID = "org.jboss.bpm.process.ProcessList";
- private ProcessDefinitionList processDefinitions;
+ private ProcessDefinitionList processDefinitionList;
private ConsoleView view;
@@ -72,7 +72,7 @@
leftHand.setHeader(false);
leftHand.setBorder(false);
- processDefinitions = new ProcessDefinitionList("Process Definitions", view);
+ processDefinitionList = new ProcessDefinitionList("Process Definitions", view);
// ----------------------------------
@@ -120,7 +120,7 @@
public void onActionComplete(Form form, int i, String string)
{
- processDefinitions.reloadStore();
+ processDefinitionList.reloadStore();
leftHand.doLayout();
form.reset();
}
@@ -201,7 +201,7 @@
// ----------------------------------
- leftHand.add(processDefinitions);
+ leftHand.add(processDefinitionList);
leftHand.add(outerFormPanel);
this.add(leftHand, new ColumnLayoutData(0.7) );
@@ -227,4 +227,9 @@
{
return "bpm-process-icon";
}
+
+ public ProcessDefinitionList getProcessDefinitionList()
+ {
+ return processDefinitionList;
+ }
}
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-10-22 03:19:19 UTC (rev 2578)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -217,7 +217,7 @@
public void onResponseReceived(Request request, Response response)
{
- // success
+ // testSuccess
instanceList.reloadStore();
selectedInstance = null;
}
Added: jbpm3/trunk/modules/gwt-console/war/src/test/java/BlankTest.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/test/java/BlankTest.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/test/java/BlankTest.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -0,0 +1,35 @@
+/*
+ * 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 junit.framework.Assert;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class BlankTest extends TestCase
+{
+ public void testSuccess()
+ {
+ Assert.assertTrue(true);
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/test/java/BlankTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm3/trunk/modules/gwt-console/war/src/test/java/org/jboss/bpm/console/client/GwtTestApplication.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/test/java/org/jboss/bpm/console/client/GwtTestApplication.java (rev 0)
+++ jbpm3/trunk/modules/gwt-console/war/src/test/java/org/jboss/bpm/console/client/GwtTestApplication.java 2008-10-22 13:07:30 UTC (rev 2579)
@@ -0,0 +1,83 @@
+/*
+ * 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;
+
+import com.google.gwt.junit.client.GWTTestCase;
+import com.gwtext.client.widgets.ComponentMgr;
+import org.jboss.bpm.console.client.process.ProcessDefinitionListEditor;
+import org.jboss.bpm.console.client.process.ProcessDefinitionList;
+import org.jboss.bpm.console.client.model.ProcessDefinition;
+
+import java.util.List;
+
+/**
+ * @author Heiko.Braun <heiko.braun(a)jboss.com>
+ */
+public class GwtTestApplication extends GWTTestCase
+{
+
+ private static Application application = null;
+
+ public String getModuleName()
+ {
+ return "org.jboss.bpm.console.Application";
+ }
+
+
+ protected void gwtSetUp() throws Exception
+ {
+ super.gwtSetUp();
+ if(null==application)
+ {
+ application = new Application();
+ application.onModuleLoad();
+
+ /*URLBuilder urlBuilder = new URLBuilder("localhost:8080", "gwt-console-server");
+ Authentication auth = new Authentication(urlBuilder.getUserInRoleURL(ConsoleView.KNOWN_ROLES));
+ auth.doLogin("admin", "admin");
+ System.out.println("Assigned roles: " + auth.getRolesAssigned() );*/
+ }
+
+ }
+
+ public void testInitialisation()
+ {
+ ConsoleView view = application.getConsoleView();
+ assertNotNull("View not initialized", view);
+
+ /*ProcessDefinitionListEditor procListEditor =
+ (ProcessDefinitionListEditor)ComponentMgr.getComponent(ProcessDefinitionListEditor.ID);
+ assertNotNull("ProcessDefinitionListEditor not initialized", procListEditor);
+
+ // load process definitions
+ ProcessDefinitionList procDefList = procListEditor.getProcessDefinitionList();
+ procDefList.reloadStore();
+
+ List<ProcessDefinition> available = procDefList.getAvailableProcessDefinitions();
+ assertFalse("No process definitions available", available.isEmpty());
+
+ for(ProcessDefinition def : available)
+ {
+ System.out.println(def);
+ } */
+ }
+}
Property changes on: jbpm3/trunk/modules/gwt-console/war/src/test/java/org/jboss/bpm/console/client/GwtTestApplication.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
17 years, 6 months
JBoss JBPM SVN: r2578 - in jbpm3/trunk/modules: distribution/src/main/resources/database/hypersonic and 1 other directory.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-10-21 23:19:19 -0400 (Tue, 21 Oct 2008)
New Revision: 2578
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Join.java
jbpm3/trunk/modules/distribution/src/main/resources/database/hypersonic/jbpmDB.script
Log:
[JBPM-1755] added PARENTLOCKMODE_ column to JBPM_NODE table in distro hsql script
made some cleanup in Join
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Join.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Join.java 2008-10-22 03:08:09 UTC (rev 2577)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/node/Join.java 2008-10-22 03:19:19 UTC (rev 2578)
@@ -41,7 +41,10 @@
private static final long serialVersionUID = 1L;
- /** specifies wether what type of hibernate lock should be acquired. null value defaults to LockMode.Force */
+ /**
+ * specifies wether what type of hibernate lock should be acquired.
+ * null value defaults to LockMode.FORCE
+ */
String parentLockMode;
/**
@@ -111,13 +114,10 @@
JbpmContext jbpmContext = executionContext.getJbpmContext();
Session session = (jbpmContext!=null ? jbpmContext.getSession() : null);
if (session!=null) {
- LockMode lockMode = LockMode.FORCE;
- if (parentLockMode!=null) {
- lockMode = LockMode.parse(parentLockMode);
- }
- log.debug("forcing version increment on parent token "+parentToken);
- // TODO why is a flush needed?!
- // session.flush();
+ // force version increment by default (LockMode.FORCE)
+ LockMode lockMode = parentLockMode != null ? LockMode.parse(parentLockMode) : LockMode.FORCE;
+ log.debug("acquiring " + lockMode + " lock on " + parentToken);
+ // lock updates as appropriate, no need to flush here
session.lock(parentToken, lockMode);
}
@@ -125,10 +125,9 @@
// if this is a discriminator
if ( isDiscriminator ) {
- // reactivate the parent when the first token arrives in the
- // join. this must be the first token arriving because otherwise
- // the isAbleToReactivateParent() of this token should have been false
- // above.
+ // reactivate the parent when the first token arrives in the join.
+ // this must be the first token arriving, otherwise isAbleToReactivateParent()
+ // should have been false above.
reactivateParent = true;
// if a fixed set of tokenNames is specified at design time...
Modified: jbpm3/trunk/modules/distribution/src/main/resources/database/hypersonic/jbpmDB.script
===================================================================
--- jbpm3/trunk/modules/distribution/src/main/resources/database/hypersonic/jbpmDB.script 2008-10-22 03:08:09 UTC (rev 2577)
+++ jbpm3/trunk/modules/distribution/src/main/resources/database/hypersonic/jbpmDB.script 2008-10-22 03:19:19 UTC (rev 2578)
@@ -26,7 +26,7 @@
CREATE INDEX IDX_MODDEF_PROCDF ON JBPM_MODULEDEFINITION(PROCESSDEFINITION_)
CREATE MEMORY TABLE JBPM_MODULEINSTANCE(ID_ BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,CLASS_ CHAR(1) NOT NULL,VERSION_ INTEGER NOT NULL,PROCESSINSTANCE_ BIGINT,TASKMGMTDEFINITION_ BIGINT,NAME_ VARCHAR(255),CONSTRAINT FK_TASKMGTINST_TMD FOREIGN KEY(TASKMGMTDEFINITION_) REFERENCES JBPM_MODULEDEFINITION(ID_))
CREATE INDEX IDX_MODINST_PRINST ON JBPM_MODULEINSTANCE(PROCESSINSTANCE_)
-CREATE MEMORY TABLE JBPM_NODE(ID_ BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,CLASS_ CHAR(1) NOT NULL,NAME_ VARCHAR(255),DESCRIPTION_ VARCHAR(4000),PROCESSDEFINITION_ BIGINT,ISASYNC_ BOOLEAN,ISASYNCEXCL_ BOOLEAN,ACTION_ BIGINT,SUPERSTATE_ BIGINT,SUBPROCNAME_ VARCHAR(255),SUBPROCESSDEFINITION_ BIGINT,DECISIONEXPRESSION_ VARCHAR(255),DECISIONDELEGATION BIGINT,SCRIPT_ BIGINT,SIGNAL_ INTEGER,CREATETASKS_ BOOLEAN,ENDTASKS_ BOOLEAN,NODECOLLECTIONINDEX_ INTEGER,CONSTRAINT FK_DECISION_DELEG FOREIGN KEY(DECISIONDELEGATION) REFERENCES JBPM_DELEGATION(ID_),CONSTRAINT FK_NODE_ACTION FOREIGN KEY(ACTION_) REFERENCES JBPM_ACTION(ID_),CONSTRAINT FK_NODE_SCRIPT FOREIGN KEY(SCRIPT_) REFERENCES JBPM_ACTION(ID_),CONSTRAINT FK_NODE_SUPERSTATE FOREIGN KEY(SUPERSTATE_) REFERENCES JBPM_NODE(ID_))
+CREATE MEMORY TABLE JBPM_NODE(ID_ BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,CLASS_ CHAR(1) NOT NULL,NAME_ VARCHAR(255),DESCRIPTION_ VARCHAR(4000),PROCESSDEFINITION_ BIGINT,ISASYNC_ BOOLEAN,ISASYNCEXCL_ BOOLEAN,ACTION_ BIGINT,SUPERSTATE_ BIGINT,SUBPROCNAME_ VARCHAR(255),SUBPROCESSDEFINITION_ BIGINT,DECISIONEXPRESSION_ VARCHAR(255),DECISIONDELEGATION BIGINT,SCRIPT_ BIGINT,SIGNAL_ INTEGER,CREATETASKS_ BOOLEAN,ENDTASKS_ BOOLEAN,NODECOLLECTIONINDEX_ INTEGER,PARENTLOCKMODE_ VARCHAR(255),CONSTRAINT FK_DECISION_DELEG FOREIGN KEY(DECISIONDELEGATION) REFERENCES JBPM_DELEGATION(ID_),CONSTRAINT FK_NODE_ACTION FOREIGN KEY(ACTION_) REFERENCES JBPM_ACTION(ID_),CONSTRAINT FK_NODE_SCRIPT FOREIGN KEY(SCRIPT_) REFERENCES JBPM_ACTION(ID_),CONSTRAINT FK_NODE_SUPERSTATE FOREIGN KEY(SUPERSTATE_) REFERENCES JBPM_NODE(ID_))
CREATE INDEX IDX_PSTATE_SBPRCDEF ON JBPM_NODE(SUBPROCESSDEFINITION_)
CREATE INDEX IDX_NODE_PROCDEF ON JBPM_NODE(PROCESSDEFINITION_)
CREATE INDEX IDX_NODE_ACTION ON JBPM_NODE(ACTION_)
17 years, 6 months
JBoss JBPM SVN: r2577 - jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-10-21 23:08:09 -0400 (Tue, 21 Oct 2008)
New Revision: 2577
Modified:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072/JBPM1072Test.java
Log:
[JBPM-1072] removed redundant member class
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072/JBPM1072Test.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072/JBPM1072Test.java 2008-10-22 02:54:47 UTC (rev 2576)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072/JBPM1072Test.java 2008-10-22 03:08:09 UTC (rev 2577)
@@ -41,7 +41,7 @@
*/
public class JBPM1072Test extends AbstractDbTestCase {
- private static final int JOB_EXECUTOR_COUNT = 20;
+ private static final int JOB_EXECUTOR_COUNT = 8;
private JobExecutor[] jobExecutors = new JobExecutor[JOB_EXECUTOR_COUNT];
private ProcessDefinition processDefinition;
@@ -56,15 +56,15 @@
+ "<start-state name='start-state1'>"
+ "<transition to='Service 1'></transition>"
+ "</start-state>"
- + "<node name='Service 1'>"
+ + "<node name='Service 1' async='true'>"
+ "<action class='"
- + SimpleAction.class.getName()
+ + Counter.class.getName()
+ "' />"
+ "<transition to='Service 2' />"
+ "</node>"
+ "<node name='Service 2' async='true'>"
+ "<action class='"
- + SimpleAction2.class.getName()
+ + Counter.class.getName()
+ "' />"
+ "<transition to='end-state1' />"
+ "</node>"
@@ -112,21 +112,11 @@
}
beginSessionTransaction();
- assertEquals(1, SimpleAction2.getExecutionCount());
+ assertEquals(2, Counter.getExecutionCount());
}
- public static class SimpleAction implements ActionHandler {
+ public static class Counter implements ActionHandler {
- private static final long serialVersionUID = 1L;
-
- public void execute(ExecutionContext exeContext) throws Exception {
- exeContext.leaveNode();
- }
-
- }
-
- public static class SimpleAction2 implements ActionHandler {
-
private static int executionCount = 0;
private static final long serialVersionUID = 1L;
17 years, 6 months
JBoss JBPM SVN: r2576 - in jbpm3/trunk/modules/core/src/main/java/org/jbpm: persistence/db and 1 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-10-21 22:54:47 -0400 (Tue, 21 Oct 2008)
New Revision: 2576
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/StaleObjectLogConfigurer.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/svc/Services.java
Log:
[JBPM-1754] added verbosity control code to flushSession()
encapsulated staleObjectExceptionsLog
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java 2008-10-22 02:28:06 UTC (rev 2575)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java 2008-10-22 02:54:47 UTC (rev 2576)
@@ -38,7 +38,6 @@
import org.jbpm.configuration.ValueInfo;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.instantiation.DefaultProcessClassLoaderFactory;
-import org.jbpm.instantiation.ProcessClassLoader;
import org.jbpm.instantiation.ProcessClassLoaderFactory;
import org.jbpm.job.executor.JobExecutor;
import org.jbpm.persistence.db.DbPersistenceServiceFactory;
@@ -51,12 +50,16 @@
* configuration of one jBPM instance.
*
* <p>
- * During process execution, jBPM might need to use some services. A JbpmConfiguration contains the knowledge on how to create those services.
+ * During process execution, jBPM might need to use some services. A
+ * JbpmConfiguration contains the knowledge on how to create those services.
* </p>
*
* <p>
- * A JbpmConfiguration is a thread safe object and serves as a factory for {@link org.jbpm.JbpmContext}s, which means one JbpmConfiguration can be used to create
- * {@link org.jbpm.JbpmContext}s for all threads. The single JbpmConfiguration can be maintained in a static member or in the JNDI tree if that is available.
+ * A JbpmConfiguration is a thread safe object and serves as a factory for
+ * {@link org.jbpm.JbpmContext}s, which means one JbpmConfiguration can be used
+ * to create {@link org.jbpm.JbpmContext}s for all threads. The single
+ * JbpmConfiguration can be maintained in a static member or in the JNDI tree if
+ * that is available.
* </p>
*
* <p>
@@ -87,8 +90,9 @@
* </pre>
*
* </li>
- * <li>By specifying a custom implementation of an object factory. This can be used to specify a JbpmConfiguration in other bean-style notations such as used by JBoss
- * Microcontainer or Spring.
+ * <li>By specifying a custom implementation of an object factory. This can be
+ * used to specify a JbpmConfiguration in other bean-style notations such as
+ * used by JBoss Microcontainer or Spring.
*
* <pre>
* ObjectFactory of = new <i>MyCustomObjectFactory</i>();
@@ -101,7 +105,8 @@
* </p>
*
* <p>
- * JbpmConfigurations can be configured using a spring-like XML notation (in relax ng compact notation):
+ * JbpmConfigurations can be configured using a spring-like XML notation (in
+ * relax ng compact notation):
* </p>
*
* <pre>
@@ -235,8 +240,7 @@
* </p>
*
* <p>
- * Other configuration properties
- * <table>
+ * Other configuration properties <table>
* <tr>
* <td>jbpm.files.dir</td>
* <td></td>
@@ -248,8 +252,8 @@
* </table>
* </p>
*/
-public class JbpmConfiguration implements Serializable
-{
+public class JbpmConfiguration implements Serializable {
+
private static final long serialVersionUID = 1L;
static ObjectFactory defaultObjectFactory;
@@ -260,50 +264,44 @@
private ThreadLocal jbpmContextStacks = new ThreadLocal();
private JobExecutor jobExecutor;
- public JbpmConfiguration(ObjectFactory objectFactory)
- {
+ public JbpmConfiguration(ObjectFactory objectFactory) {
this.objectFactory = objectFactory;
}
- public static JbpmConfiguration getInstance()
- {
+ public static JbpmConfiguration getInstance() {
return getInstance(null);
}
- public static JbpmConfiguration getInstance(String resource)
- {
+ public static JbpmConfiguration getInstance(String resource) {
JbpmConfiguration instance = null;
- synchronized (instances)
- {
- if (resource == null)
- {
+ synchronized (instances) {
+ if (resource == null) {
resource = "jbpm.cfg.xml";
}
- instance = (JbpmConfiguration)instances.get(resource);
- if (instance == null)
- {
+ instance = (JbpmConfiguration) instances.get(resource);
+ if (instance == null) {
- if (defaultObjectFactory != null)
- {
- log.debug("creating jbpm configuration from given default object factory '" + defaultObjectFactory + "'");
+ if (defaultObjectFactory != null) {
+ log.debug("creating jbpm configuration from given default object factory '"
+ + defaultObjectFactory
+ + "'");
instance = new JbpmConfiguration(defaultObjectFactory);
}
- else
- {
+ else {
- try
- {
+ try {
log.info("using jbpm configuration resource '" + resource + "'");
InputStream jbpmCfgXmlStream = ClassLoaderUtil.getJbpmConfigurationStream(resource);
- // if a custom resource is to be used, but is not found in the classpath
+ // if a custom resource is to be used, but is not found in the
+ // classpath
// log a warning (otherwise, users who want to load custom stuff
- // will be confused if the resource is not found and not loaded, without
+ // will be confused if the resource is not found and not loaded,
+ // without
// any notice)
- if (jbpmCfgXmlStream == null && !"jbpm.cfg.xml".equals(resource))
- {
+ if (jbpmCfgXmlStream == null && !"jbpm.cfg.xml".equals(resource)) {
log.warn("jbpm configuration resource '" + resource + "' is not available");
}
@@ -311,9 +309,10 @@
instance = createJbpmConfiguration(objectFactory);
}
- catch (RuntimeException e)
- {
- throw new JbpmException("couldn't parse jbpm configuration from resource '" + resource + "'", e);
+ catch (RuntimeException e) {
+ throw new JbpmException("couldn't parse jbpm configuration from resource '"
+ + resource
+ + "'", e);
}
}
@@ -324,29 +323,25 @@
return instance;
}
- public static boolean hasInstance(String resource)
- {
+ public static boolean hasInstance(String resource) {
boolean hasInstance = false;
- if (resource == null)
- {
+ if (resource == null) {
resource = "jbpm.cfg.xml";
}
- if ((instances != null) && (instances.containsKey(resource)))
- {
+ if ((instances != null) && (instances.containsKey(resource))) {
hasInstance = true;
}
return hasInstance;
}
- protected static ObjectFactory parseObjectFactory(InputStream inputStream)
- {
+ protected static ObjectFactory parseObjectFactory(InputStream inputStream) {
log.debug("loading defaults in jbpm configuration");
ObjectFactoryParser objectFactoryParser = new ObjectFactoryParser();
ObjectFactoryImpl objectFactoryImpl = new ObjectFactoryImpl();
- objectFactoryParser.parseElementsFromResource("org/jbpm/default.jbpm.cfg.xml", objectFactoryImpl);
+ objectFactoryParser.parseElementsFromResource("org/jbpm/default.jbpm.cfg.xml",
+ objectFactoryImpl);
- if (inputStream != null)
- {
+ if (inputStream != null) {
log.debug("loading specific configuration...");
objectFactoryParser.parseElementsStream(inputStream, objectFactoryImpl);
}
@@ -357,31 +352,26 @@
/**
* create an ObjectFacotory from an XML string.
*/
- public static JbpmConfiguration parseXmlString(String xml)
- {
+ public static JbpmConfiguration parseXmlString(String xml) {
log.debug("creating jbpm configuration from xml string");
InputStream inputStream = null;
- if (xml != null)
- {
+ if (xml != null) {
inputStream = new ByteArrayInputStream(xml.getBytes());
}
ObjectFactory objectFactory = parseObjectFactory(inputStream);
return createJbpmConfiguration(objectFactory);
}
- protected static JbpmConfiguration createJbpmConfiguration(ObjectFactory objectFactory)
- {
+ protected static JbpmConfiguration createJbpmConfiguration(ObjectFactory objectFactory) {
JbpmConfiguration jbpmConfiguration = new JbpmConfiguration(objectFactory);
// now we make the bean jbpm.configuration always availble
- if (objectFactory instanceof ObjectFactoryImpl)
- {
- ObjectFactoryImpl objectFactoryImpl = (ObjectFactoryImpl)objectFactory;
+ if (objectFactory instanceof ObjectFactoryImpl) {
+ ObjectFactoryImpl objectFactoryImpl = (ObjectFactoryImpl) objectFactory;
ObjectInfo jbpmConfigurationInfo = new ValueInfo("jbpmConfiguration", jbpmConfiguration);
objectFactoryImpl.addObjectInfo(jbpmConfigurationInfo);
- if (mustStaleObjectExceptionsBeHidden(objectFactory))
- {
+ if (getHideStaleObjectExceptions(objectFactory)) {
StaleObjectLogConfigurer.hideStaleObjectExceptions();
}
}
@@ -389,351 +379,286 @@
return jbpmConfiguration;
}
- private static boolean mustStaleObjectExceptionsBeHidden(ObjectFactory objectFactory)
- {
- if (!objectFactory.hasObject("jbpm.hide.stale.object.exceptions"))
- {
+ private static boolean getHideStaleObjectExceptions(ObjectFactory objectFactory) {
+ if (!objectFactory.hasObject("jbpm.hide.stale.object.exceptions")) {
return true;
}
- Object o = (Boolean)objectFactory.createObject("jbpm.hide.stale.object.exceptions");
- if ((o instanceof Boolean) && (((Boolean)o).booleanValue() == false))
- {
- return false;
- }
- return true;
+ Object object = objectFactory.createObject("jbpm.hide.stale.object.exceptions");
+ return object instanceof Boolean ? ((Boolean) object).booleanValue() : true;
}
- public static JbpmConfiguration parseInputStream(InputStream inputStream)
- {
+ public static JbpmConfiguration parseInputStream(InputStream inputStream) {
ObjectFactory objectFactory = parseObjectFactory(inputStream);
log.debug("creating jbpm configuration from input stream");
return createJbpmConfiguration(objectFactory);
}
- public static JbpmConfiguration parseResource(String resource)
- {
+ public static JbpmConfiguration parseResource(String resource) {
InputStream inputStream = null;
log.debug("creating jbpm configuration from resource '" + resource + "'");
- if (resource != null)
- {
+ if (resource != null) {
inputStream = ClassLoaderUtil.getJbpmConfigurationStream(resource);
}
ObjectFactory objectFactory = parseObjectFactory(inputStream);
return createJbpmConfiguration(objectFactory);
}
- public JbpmContext createJbpmContext()
- {
+ public JbpmContext createJbpmContext() {
return createJbpmContext(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public JbpmContext createJbpmContext(String name)
- {
- JbpmContext jbpmContext = (JbpmContext)objectFactory.createObject(name);
+ public JbpmContext createJbpmContext(String name) {
+ JbpmContext jbpmContext = (JbpmContext) objectFactory.createObject(name);
jbpmContext.jbpmConfiguration = this;
jbpmContextCreated(jbpmContext);
return jbpmContext;
}
- public ServiceFactory getServiceFactory(String serviceName)
- {
+ public ServiceFactory getServiceFactory(String serviceName) {
return getServiceFactory(serviceName, JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public ServiceFactory getServiceFactory(String serviceName, String jbpmContextName)
- {
+ public ServiceFactory getServiceFactory(String serviceName, String jbpmContextName) {
ServiceFactory serviceFactory = null;
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try
- {
+ try {
serviceFactory = jbpmContext.getServices().getServiceFactory(serviceName);
}
- finally
- {
+ finally {
jbpmContext.close();
}
return serviceFactory;
}
-
+
public static ClassLoader getProcessClassLoader(ProcessDefinition processDefinition) {
ProcessClassLoaderFactory factory = null;
if (Configs.hasObject("jbpm.processClassLoader")) {
- factory = (ProcessClassLoaderFactory) Configs.getObject("jbpm.processClassLoader");
+ factory = (ProcessClassLoaderFactory) Configs.getObject("jbpm.processClassLoader");
}
else {
factory = new DefaultProcessClassLoaderFactory();
}
return factory.getProcessClassLoader(processDefinition);
- }
+ }
-
/**
- * gives the jbpm domain model access to configuration information via the current JbpmContext.
+ * gives the jbpm domain model access to configuration information via the
+ * current JbpmContext.
*/
- public abstract static class Configs
- {
- public static ObjectFactory getObjectFactory()
- {
+ public abstract static class Configs {
+
+ public static ObjectFactory getObjectFactory() {
ObjectFactory objectFactory = null;
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
- if (jbpmContext != null)
- {
+ if (jbpmContext != null) {
objectFactory = jbpmContext.objectFactory;
}
- else
- {
+ else {
objectFactory = getInstance().objectFactory;
}
return objectFactory;
}
- public static void setDefaultObjectFactory(ObjectFactory objectFactory)
- {
+ public static void setDefaultObjectFactory(ObjectFactory objectFactory) {
defaultObjectFactory = objectFactory;
}
- public static boolean hasObject(String name)
- {
+ public static boolean hasObject(String name) {
ObjectFactory objectFactory = getObjectFactory();
return objectFactory.hasObject(name);
}
- public static synchronized Object getObject(String name)
- {
+ public static synchronized Object getObject(String name) {
ObjectFactory objectFactory = getObjectFactory();
return objectFactory.createObject(name);
}
- public static String getString(String name)
- {
- return (String)getObject(name);
+ public static String getString(String name) {
+ return (String) getObject(name);
}
- public static long getLong(String name)
- {
- return ((Long)getObject(name)).longValue();
+ public static long getLong(String name) {
+ return ((Long) getObject(name)).longValue();
}
- public static int getInt(String name)
- {
- return ((Integer)getObject(name)).intValue();
+ public static int getInt(String name) {
+ return ((Integer) getObject(name)).intValue();
}
- public static boolean getBoolean(String name)
- {
- return ((Boolean)getObject(name)).booleanValue();
+ public static boolean getBoolean(String name) {
+ return ((Boolean) getObject(name)).booleanValue();
}
}
- public void cleanSchema()
- {
+ public void cleanSchema() {
cleanSchema(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void cleanSchema(String jbpmContextName)
- {
+ public void cleanSchema(String jbpmContextName) {
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try
- {
+ try {
Services services = jbpmContext.getServices();
- DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory)services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
persistenceServiceFactory.cleanSchema();
}
- finally
- {
+ finally {
jbpmContext.close();
}
}
- public void createSchema()
- {
+ public void createSchema() {
createSchema(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void createSchema(String jbpmContextName)
- {
+ public void createSchema(String jbpmContextName) {
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try
- {
+ try {
Services services = jbpmContext.getServices();
- DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory)services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
persistenceServiceFactory.createSchema();
}
- finally
- {
+ finally {
jbpmContext.close();
}
}
- public void dropSchema()
- {
+ public void dropSchema() {
dropSchema(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void dropSchema(String jbpmContextName)
- {
+ public void dropSchema(String jbpmContextName) {
log.warn("Dropping schema: " + jbpmContextName);
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try
- {
+ try {
Services services = jbpmContext.getServices();
- DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory)services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
persistenceServiceFactory.dropSchema();
}
- finally
- {
+ finally {
jbpmContext.close();
}
}
- public void close()
- {
+ public void close() {
close(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void close(String jbpmContextName)
- {
+ public void close(String jbpmContextName) {
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try
- {
+ try {
- synchronized (instances)
- {
+ synchronized (instances) {
Iterator iter = instances.keySet().iterator();
- while (iter.hasNext())
- {
- String resource = (String)iter.next();
- if (this == instances.get(resource))
- {
+ while (iter.hasNext()) {
+ String resource = (String) iter.next();
+ if (this == instances.get(resource)) {
instances.remove(resource);
break;
}
}
}
- if (jobExecutor != null)
- {
+ if (jobExecutor != null) {
jobExecutor.stop();
}
Map serviceFactories = jbpmContext.getServices().getServiceFactories();
- if (serviceFactories != null)
- {
+ if (serviceFactories != null) {
Iterator iter = serviceFactories.values().iterator();
- while (iter.hasNext())
- {
- ServiceFactory serviceFactory = (ServiceFactory)iter.next();
+ while (iter.hasNext()) {
+ ServiceFactory serviceFactory = (ServiceFactory) iter.next();
serviceFactory.close();
}
}
}
- finally
- {
+ finally {
jbpmContext.close();
}
}
- static JbpmConfiguration getCurrentJbpmConfiguration()
- {
+ static JbpmConfiguration getCurrentJbpmConfiguration() {
JbpmConfiguration currentJbpmConfiguration = null;
Stack stack = getJbpmConfigurationStack();
- if (!stack.isEmpty())
- {
- currentJbpmConfiguration = (JbpmConfiguration)stack.peek();
+ if (!stack.isEmpty()) {
+ currentJbpmConfiguration = (JbpmConfiguration) stack.peek();
}
return currentJbpmConfiguration;
}
- static synchronized Stack getJbpmConfigurationStack()
- {
- Stack stack = (Stack)jbpmConfigurationsStacks.get();
- if (stack == null)
- {
+ static synchronized Stack getJbpmConfigurationStack() {
+ Stack stack = (Stack) jbpmConfigurationsStacks.get();
+ if (stack == null) {
stack = new Stack();
jbpmConfigurationsStacks.set(stack);
}
return stack;
}
- synchronized void pushJbpmConfiguration()
- {
+ synchronized void pushJbpmConfiguration() {
getJbpmConfigurationStack().push(this);
}
- synchronized void popJbpmConfiguration()
- {
+ synchronized void popJbpmConfiguration() {
getJbpmConfigurationStack().remove(this);
}
- public JbpmContext getCurrentJbpmContext()
- {
+ public JbpmContext getCurrentJbpmContext() {
JbpmContext currentJbpmContext = null;
Stack stack = getJbpmContextStack();
- if (!stack.isEmpty())
- {
- currentJbpmContext = (JbpmContext)stack.peek();
+ if (!stack.isEmpty()) {
+ currentJbpmContext = (JbpmContext) stack.peek();
}
return currentJbpmContext;
}
- Stack getJbpmContextStack()
- {
- Stack stack = (Stack)jbpmContextStacks.get();
- if (stack == null)
- {
+ Stack getJbpmContextStack() {
+ Stack stack = (Stack) jbpmContextStacks.get();
+ if (stack == null) {
stack = new Stack();
jbpmContextStacks.set(stack);
}
return stack;
}
- void pushJbpmContext(JbpmContext jbpmContext)
- {
+ void pushJbpmContext(JbpmContext jbpmContext) {
getJbpmContextStack().push(jbpmContext);
}
- void popJbpmContext(JbpmContext jbpmContext)
- {
+ void popJbpmContext(JbpmContext jbpmContext) {
Stack stack = getJbpmContextStack();
- if (stack.isEmpty())
- {
- throw new JbpmException("closed JbpmContext more then once... check your try-finally's around JbpmContexts blocks");
+ if (stack.isEmpty()) {
+ throw new JbpmException(
+ "closed JbpmContext more then once... check your try-finally's around JbpmContexts blocks");
}
- JbpmContext popped = (JbpmContext)stack.pop();
- if (jbpmContext != popped)
- {
- throw new JbpmException("closed JbpmContext in different order then they were created... check your try-finally's around JbpmContexts blocks");
+ JbpmContext popped = (JbpmContext) stack.pop();
+ if (jbpmContext != popped) {
+ throw new JbpmException(
+ "closed JbpmContext in different order then they were created... check your try-finally's around JbpmContexts blocks");
}
}
- void jbpmContextCreated(JbpmContext jbpmContext)
- {
+ void jbpmContextCreated(JbpmContext jbpmContext) {
pushJbpmConfiguration();
pushJbpmContext(jbpmContext);
}
- void jbpmContextClosed(JbpmContext jbpmContext)
- {
+ void jbpmContextClosed(JbpmContext jbpmContext) {
popJbpmConfiguration();
popJbpmContext(jbpmContext);
}
- public void startJobExecutor()
- {
+ public void startJobExecutor() {
getJobExecutor().start();
}
- public synchronized JobExecutor getJobExecutor()
- {
- if (jobExecutor == null)
- {
- try
- {
- jobExecutor = (JobExecutor)this.objectFactory.createObject("jbpm.job.executor");
+ public synchronized JobExecutor getJobExecutor() {
+ if (jobExecutor == null) {
+ try {
+ jobExecutor = (JobExecutor) this.objectFactory.createObject("jbpm.job.executor");
}
- catch (ClassCastException e)
- {
- throw new JbpmException("jbpm configuration object under key 'jbpm.job.executor' is not a " + JobExecutor.class.getName(), e);
+ catch (ClassCastException e) {
+ throw new JbpmException("jbpm configuration object under key 'jbpm.job.executor' is not a "
+ + JobExecutor.class.getName(), e);
}
}
return jobExecutor;
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java 2008-10-22 02:28:06 UTC (rev 2575)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/DbPersistenceService.java 2008-10-22 02:54:47 UTC (rev 2576)
@@ -29,7 +29,7 @@
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
-import org.hibernate.StaleObjectStateException;
+import org.hibernate.StaleStateException;
import org.hibernate.Transaction;
import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
@@ -237,8 +237,7 @@
if (flushException!=null) {
// JBPM-1465 transaction has been either committed or rolled back at this point
// on the other hand, it is possible that no transaction is underway
- // rolling back here is redundant and possibly dangerous
- // rollback();
+ // hence rolling back here is redundant and possibly dangerous
closeSession();
closeConnection();
throw new JbpmPersistenceException("hibernate flush failed", flushException);
@@ -258,12 +257,12 @@
Exception commit() {
try {
- log.debug("committing hibernate transaction " + transaction.toString());
+ log.debug("committing " + transaction);
mustSessionBeFlushed = false; // commit does a flush anyway
transaction.commit();
- } catch (StaleObjectStateException e) {
- log.info("optimistic locking failed");
- StaleObjectLogConfigurer.staleObjectExceptionsLog.error("optimistic locking failed", e);
+ } catch (StaleStateException e) {
+ log.info("problem committing transaction: optimistic locking failed");
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error("optimistic locking failed while committing " + transaction, e);
return e;
} catch (Exception e) {
log.error("hibernate commit failed", e);
@@ -275,8 +274,12 @@
Exception flushSession() {
if (mustSessionBeFlushed) {
try {
- log.debug("flushing hibernate session " + session.toString());
+ log.debug("flushing " + session);
session.flush();
+ } catch (StaleStateException e) {
+ log.info("problem flushing session: optimistic locking failed");
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error("optimistic locking failed while flushing " + session, e);
+ return e;
} catch (Exception e) {
log.error("hibernate flush failed", e);
return e;
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/StaleObjectLogConfigurer.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/StaleObjectLogConfigurer.java 2008-10-22 02:28:06 UTC (rev 2575)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/persistence/db/StaleObjectLogConfigurer.java 2008-10-22 02:54:47 UTC (rev 2576)
@@ -26,28 +26,37 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-public abstract class StaleObjectLogConfigurer {
+public class StaleObjectLogConfigurer {
- private static Log log = LogFactory.getLog(StaleObjectLogConfigurer.class);
- public static Log staleObjectExceptionsLog = LogFactory.getLog(StaleObjectLogConfigurer.class.getName()+".staleObjectExceptions");
-
+ private static final Log log = LogFactory.getLog(StaleObjectLogConfigurer.class);
+ private static Log staleObjectExceptionsLog = LogFactory.getLog(StaleObjectLogConfigurer.class.getName()+".staleObjectExceptions");
+
+ private StaleObjectLogConfigurer() {
+ // hide default constructor to prevent instantiation
+ }
+
+ public static Log getStaleObjectExceptionsLog() {
+ return staleObjectExceptionsLog;
+ }
+
public static void hideStaleObjectExceptions() {
+ if (staleObjectExceptionsLog instanceof LogWrapper) {
+ log.debug("stale object exceptions are already hidden from logging");
+ return;
+ }
+
try {
- staleObjectExceptionsLog = wrap(staleObjectExceptionsLog);
+ staleObjectExceptionsLog = new LogWrapper(staleObjectExceptionsLog);
log.info("stale object exceptions will be hidden from logging");
} catch (Exception e) {
log.info("couldn't hide stale object exceptions from logging");
}
}
- private static Log wrap(Log log) {
- return new LogWrapper(log);
- }
-
- public static class LogWrapper implements Log, Serializable {
+ static class LogWrapper implements Log, Serializable {
+ Log delegate;
private static final long serialVersionUID = 1L;
- Log delegate;
- public LogWrapper(Log delegate) {
+ LogWrapper(Log delegate) {
this.delegate = delegate;
}
public void debug(Object arg0, Throwable arg1) {
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/svc/Services.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/svc/Services.java 2008-10-22 02:28:06 UTC (rev 2575)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/svc/Services.java 2008-10-22 02:54:47 UTC (rev 2576)
@@ -238,7 +238,7 @@
// if this is a stale state exception, the jbpm configuration has control over the logging
if (isCausedByStaleState(e)) {
log.info("problem closing service '"+serviceName+"': optimistic locking failed");
- StaleObjectLogConfigurer.staleObjectExceptionsLog.error("problem closing service '"+serviceName+"': optimistic locking failed", e);
+ StaleObjectLogConfigurer.getStaleObjectExceptionsLog().error("problem closing service '"+serviceName+"': optimistic locking failed", e);
} else {
log.error("problem closing service '"+serviceName+"'", e);
}
17 years, 6 months
JBoss JBPM SVN: r2575 - jbpm3/trunk/modules/core/src/main/java/org/jbpm/db.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-10-21 22:28:06 -0400 (Tue, 21 Oct 2008)
New Revision: 2575
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
Log:
removed unused imports
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2008-10-22 00:42:56 UTC (rev 2574)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java 2008-10-22 02:28:06 UTC (rev 2575)
@@ -22,7 +22,6 @@
package org.jbpm.db;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
@@ -37,17 +36,15 @@
import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.graph.exe.Token;
import org.jbpm.job.Job;
import org.jbpm.job.executor.JobExecutor;
import org.jbpm.logging.log.ProcessLog;
-import org.jbpm.persistence.db.DbPersistenceService;
import org.jbpm.persistence.db.DbPersistenceServiceFactory;
import org.jbpm.taskmgmt.exe.TaskInstance;
public abstract class AbstractDbTestCase extends AbstractJbpmTestCase
{
- private static Log log = LogFactory.getLog(AbstractDbTestCase.class);
+ private static final Log log = LogFactory.getLog(AbstractDbTestCase.class);
protected JbpmConfiguration jbpmConfiguration;
17 years, 6 months
JBoss JBPM SVN: r2574 - jbpm3/trunk/modules/core.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-10-21 20:42:56 -0400 (Tue, 21 Oct 2008)
New Revision: 2574
Modified:
jbpm3/trunk/modules/core/pom.xml
Log:
excluded dom4j's xml-apis dependency as it references an ancient version and prevents jbpm4jsf from compiling properly
Modified: jbpm3/trunk/modules/core/pom.xml
===================================================================
--- jbpm3/trunk/modules/core/pom.xml 2008-10-22 00:29:09 UTC (rev 2573)
+++ jbpm3/trunk/modules/core/pom.xml 2008-10-22 00:42:56 UTC (rev 2574)
@@ -46,6 +46,12 @@
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
17 years, 6 months
JBoss JBPM SVN: r2573 - jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-10-21 20:29:09 -0400 (Tue, 21 Oct 2008)
New Revision: 2573
Modified:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072/JBPM1072Test.java
Log:
[JBPM-1072] fixed test case database record leaks
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072/JBPM1072Test.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072/JBPM1072Test.java 2008-10-21 15:58:15 UTC (rev 2572)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jbpm1072/JBPM1072Test.java 2008-10-22 00:29:09 UTC (rev 2573)
@@ -1,3 +1,24 @@
+/*
+ * 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.jbpm1072;
import org.jbpm.EventCallback;
@@ -2,4 +23,2 @@
import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmConfigurationTestHelper;
-import org.jbpm.JbpmContext;
import org.jbpm.db.AbstractDbTestCase;
@@ -20,16 +39,17 @@
* @author Jiri Pechanec
* @author Alejandro Guizar
*/
-public class JBPM1072Test extends AbstractDbTestCase
-{
+public class JBPM1072Test extends AbstractDbTestCase {
- private static final int EXECUTOR_COUNT = 20;
- public static final String PROCESS_NAME = "TestProcess";
+ private static final int JOB_EXECUTOR_COUNT = 20;
- private JobExecutor[] executors = new JobExecutor[EXECUTOR_COUNT];
+ private JobExecutor[] jobExecutors = new JobExecutor[JOB_EXECUTOR_COUNT];
+ private ProcessDefinition processDefinition;
- public static final String PROCESS_DEFINITION = "<?xml version='1.0' encoding='UTF-8'?>"
- + "<process-definition name='" + PROCESS_NAME + "'>"
+ private static final String PROCESS_DEFINITION = "<?xml version='1.0' encoding='UTF-8'?>"
+ + "<process-definition name='"
+ + JBPM1072Test.class.getName()
+ + "'>"
+ "<event type='process-end'>"
+ "<action expression='#{eventCallback.processEnd}' />"
+ "</event>"
@@ -52,87 +72,75 @@
+ "</process-definition>";
@Override
- protected JbpmConfiguration getJbpmConfiguration()
- {
- JbpmConfigurationTestHelper.reset();
- return JbpmConfiguration.getInstance();
+ protected void setUp() throws Exception {
+ super.setUp();
+ processDefinition = ProcessDefinition.parseXmlString(PROCESS_DEFINITION);
+ jbpmContext.deployProcessDefinition(processDefinition);
}
- public void testMultipleJobExecutors()
- {
+ @Override
+ protected void tearDown() throws Exception {
+ graphSession.deleteProcessDefinition(processDefinition);
+ super.tearDown();
+ }
+
+ public void testMultipleJobExecutors() {
// start job executors
- for (int i = 0; i < executors.length; i++)
- {
- executors[i] = (JobExecutor)JbpmConfiguration.Configs.getObjectFactory().createObject("jbpm.job.executor");
- executors[i].setName("JbpmJobExecutor/" + (i + 1));
- executors[i].start();
+ for (int i = 0; i < jobExecutors.length; i++) {
+ jobExecutors[i] = (JobExecutor) JbpmConfiguration.Configs.getObject("jbpm.job.executor");
+ jobExecutors[i].setName("JbpmJobExecutor/" + (i + 1));
+ jobExecutors[i].start();
}
// kick off process instance
- JbpmContext jbpmContext = getJbpmConfiguration().createJbpmContext();
- try
- {
- jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(PROCESS_DEFINITION));
- ProcessInstance processInstance = jbpmContext.newProcessInstance(PROCESS_NAME);
- processInstance.getContextInstance().setVariable("eventCallback", new EventCallback());
- processInstance.signal();
- }
- finally
- {
- jbpmContext.close();
- }
+ ProcessInstance processInstance = new ProcessInstance(processDefinition);
+ processInstance.getContextInstance().setVariable("eventCallback", new EventCallback());
+ processInstance.signal();
+ commitAndCloseSession();
// wait for process end
EventCallback.waitForEvent(Event.EVENTTYPE_PROCESS_END);
// stop job executors
- for (int i = executors.length - 1; i >= 0; i--)
- {
- try
- {
- executors[i].stopAndJoin();
+ for (int i = jobExecutors.length - 1; i >= 0; i--) {
+ try {
+ jobExecutors[i].stopAndJoin();
}
- catch (InterruptedException e)
- {
+ catch (InterruptedException e) {
// continue to next executor
}
}
+ beginSessionTransaction();
assertEquals(1, SimpleAction2.getExecutionCount());
}
- public static class SimpleAction implements ActionHandler
- {
+ public static class SimpleAction implements ActionHandler {
private static final long serialVersionUID = 1L;
- public void execute(ExecutionContext exeContext) throws Exception
- {
+ public void execute(ExecutionContext exeContext) throws Exception {
exeContext.leaveNode();
}
}
- public static class SimpleAction2 implements ActionHandler
- {
+ public static class SimpleAction2 implements ActionHandler {
private static int executionCount = 0;
private static final long serialVersionUID = 1L;
- public void execute(ExecutionContext exeContext) throws Exception
- {
+ public void execute(ExecutionContext exeContext) throws Exception {
incrementCount();
exeContext.leaveNode();
}
- private static synchronized int incrementCount()
- {
+ private static synchronized int incrementCount() {
return ++executionCount;
}
- public static synchronized int getExecutionCount()
- {
+ public static synchronized int getExecutionCount() {
return executionCount;
}
}
17 years, 6 months
JBoss JBPM SVN: r2572 - jbpm3/trunk/modules/enterprise/ear.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-10-21 11:58:15 -0400 (Tue, 21 Oct 2008)
New Revision: 2572
Modified:
jbpm3/trunk/modules/enterprise/ear/pom.xml
Log:
Include gwt-console-server in enterprise package
Modified: jbpm3/trunk/modules/enterprise/ear/pom.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/ear/pom.xml 2008-10-21 15:57:36 UTC (rev 2571)
+++ jbpm3/trunk/modules/enterprise/ear/pom.xml 2008-10-21 15:58:15 UTC (rev 2572)
@@ -1,145 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!-- ====================================================================== -->
- <!-- -->
- <!-- JBoss, the OpenSource J2EE webOS -->
- <!-- -->
- <!-- Distributable under LGPL license. -->
- <!-- See terms of license at http://www.gnu.org. -->
- <!-- -->
- <!-- ====================================================================== -->
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
- <!-- $Id$ -->
+<!-- $Id$ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <name>JBoss jBPM3 - Enterprise (EAR)</name>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-enterprise-bundle</artifactId>
- <packaging>ear</packaging>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <name>JBoss jBPM3 - Enterprise (EAR)</name>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-enterprise-bundle</artifactId>
+ <packaging>ear</packaging>
- <!-- Parent -->
- <parent>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-enterprise</artifactId>
- <version>3.3.0-SNAPSHOT</version>
- </parent>
-
- <!-- Dependencies -->
- <dependencies>
- <dependency>
+ <!-- Parent -->
+ <parent>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-enterprise-beans</artifactId>
- <version>${version}</version>
- <type>ejb</type>
- <exclusions>
- <exclusion>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-console</artifactId>
- <version>${version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-war</artifactId>
- <version>${version}</version>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-core</artifactId>
- <version>${version}</version>
- <exclusions>
- <exclusion>
- <groupId>bsh</groupId>
- <artifactId>bsh</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-identity</artifactId>
- <version>${version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-core</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
+ <artifactId>jbpm-enterprise</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
- <!-- Plugins -->
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-ear-plugin</artifactId>
- <configuration>
- <generateApplicationXml>true</generateApplicationXml>
- <modules>
- <ejbModule>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-enterprise-beans</artifactId>
- <bundleFileName>jbpm-enterprise-beans.jar</bundleFileName>
- <unpack>true</unpack>
- </ejbModule>
- <jarModule>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-core</artifactId>
- <bundleFileName>jbpm-core.jar</bundleFileName>
- <includeInApplicationXml>true</includeInApplicationXml>
- </jarModule>
- <jarModule>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-identity</artifactId>
- <bundleFileName>jbpm-identity.jar</bundleFileName>
- <includeInApplicationXml>true</includeInApplicationXml>
- </jarModule>
- <webModule>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-console</artifactId>
- <bundleFileName>jbpm-console.war</bundleFileName>
- <contextRoot>/jbpm-console</contextRoot>
- <unpack>true</unpack>
- </webModule>
- <webModule>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-war</artifactId>
- <bundleFileName>gwt-console.war</bundleFileName>
- <contextRoot>/gwt-console</contextRoot>
- <unpack>true</unpack>
- </webModule>
- </modules>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-enterprise-beans</artifactId>
+ <version>${version}</version>
+ <type>ejb</type>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-console</artifactId>
+ <version>${version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>gwt-console-war</artifactId>
+ <version>${version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>gwt-console-server-war</artifactId>
+ <version>${version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-core</artifactId>
+ <version>${version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>bsh</groupId>
+ <artifactId>bsh</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-identity</artifactId>
+ <version>${version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-core</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ <!-- Plugins -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <generateApplicationXml>true</generateApplicationXml>
+ <modules>
+ <ejbModule>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-enterprise-beans</artifactId>
+ <bundleFileName>jbpm-enterprise-beans.jar</bundleFileName>
+ <unpack>true</unpack>
+ </ejbModule>
+ <jarModule>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-core</artifactId>
+ <bundleFileName>jbpm-core.jar</bundleFileName>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <jarModule>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-identity</artifactId>
+ <bundleFileName>jbpm-identity.jar</bundleFileName>
+ <includeInApplicationXml>true</includeInApplicationXml>
+ </jarModule>
+ <webModule>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-console</artifactId>
+ <bundleFileName>jbpm-console.war</bundleFileName>
+ <contextRoot>/jbpm-console</contextRoot>
+ <unpack>true</unpack>
+ </webModule>
+ <webModule>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>gwt-console-war</artifactId>
+ <bundleFileName>gwt-console.war</bundleFileName>
+ <contextRoot>/gwt-console</contextRoot>
+ <unpack>true</unpack>
+ </webModule>
+ <webModule>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>gwt-console-server-war</artifactId>
+ <bundleFileName>gwt-console-server.war</bundleFileName>
+ <contextRoot>/gwt-console-server</contextRoot>
+ <unpack>true</unpack>
+ </webModule>
+ </modules>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
17 years, 6 months
JBoss JBPM SVN: r2571 - in jbpm3/trunk/modules/gwt-console: server/src/main/java/org/jboss/bpm/console/server and 3 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-10-21 11:57:36 -0400 (Tue, 21 Oct 2008)
New Revision: 2571
Modified:
jbpm3/trunk/modules/gwt-console/server/pom.xml
jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java
jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java
jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessDAO.java
jbpm3/trunk/modules/gwt-console/server/src/main/webapp/index.html
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java
jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
Log:
Added possibility to delete definitions. Fix instance retrieval according to parent version
Modified: jbpm3/trunk/modules/gwt-console/server/pom.xml
===================================================================
--- jbpm3/trunk/modules/gwt-console/server/pom.xml 2008-10-21 15:56:41 UTC (rev 2570)
+++ jbpm3/trunk/modules/gwt-console/server/pom.xml 2008-10-21 15:57:36 UTC (rev 2571)
@@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<name>JBoss jBPM3 - GWT Console (Server)</name>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>gwt-console-server</artifactId>
+ <artifactId>gwt-console-server-war</artifactId>
<packaging>war</packaging>
<!-- Parent -->
Modified: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java 2008-10-21 15:56:41 UTC (rev 2570)
+++ jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/JBPM3Management.java 2008-10-21 15:57:36 UTC (rev 2571)
@@ -74,6 +74,7 @@
@POST
@Path("definitions/new")
@Produces("application/json")
+ @Consumes("multipart/form-data")
public void postNewDefinition(
@Context
HttpServletRequest request
Modified: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java 2008-10-21 15:56:41 UTC (rev 2570)
+++ jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3CommandDelegate.java 2008-10-21 15:57:36 UTC (rev 2571)
@@ -102,6 +102,12 @@
return match;
}
+ public void removeActualDefinition(long processId)
+ {
+ org.jbpm.graph.def.ProcessDefinition def = getActualDefinition(processId);
+ facade.execute( new DeleteProcessdefinitionCommand(processId));
+ }
+
public org.jbpm.graph.exe.ProcessInstance getActualInstance(long instanceId)
{
org.jbpm.graph.exe.ProcessInstance instance = (org.jbpm.graph.exe.ProcessInstance)
@@ -113,7 +119,7 @@
{
org.jbpm.graph.def.ProcessDefinition p0 = getActualDefinition(processId);
GetProcessInstancesCommand command = new GetProcessInstancesCommand();
- command.setProcessName(p0.getName());
+ command.setProcessId(processId);
List<org.jbpm.graph.exe.ProcessInstance> instances =
(List<org.jbpm.graph.exe.ProcessInstance>) facade.execute(command);
Modified: jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessDAO.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessDAO.java 2008-10-21 15:56:41 UTC (rev 2570)
+++ jbpm3/trunk/modules/gwt-console/server/src/main/java/org/jboss/bpm/console/server/dao/internal/JBPM3ProcessDAO.java 2008-10-21 15:57:36 UTC (rev 2571)
@@ -60,7 +60,8 @@
public List<ProcessDefinition> removeDefinition(long processId)
{
- throw new RuntimeException("Not implemented");
+ delegate.removeActualDefinition(processId);
+ return getAllDefinitions();
}
Modified: jbpm3/trunk/modules/gwt-console/server/src/main/webapp/index.html
===================================================================
--- jbpm3/trunk/modules/gwt-console/server/src/main/webapp/index.html 2008-10-21 15:56:41 UTC (rev 2570)
+++ jbpm3/trunk/modules/gwt-console/server/src/main/webapp/index.html 2008-10-21 15:57:36 UTC (rev 2571)
@@ -87,6 +87,13 @@
<td>Retrieve a process definition coordinates (GPD) of the active node</td>
<td>application/json</td>
</tr>
+
+ <tr>
+ <td>POST</td>
+ <td>/rs/jbpm3/definitions/new</td>
+ <td>Upload a new process definition</td>
+ <td>Accept:multipart/form-data<br>Produce:application/json</td>
+ </tr>
</table>
<h2>Example usage</h2>
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-10-21 15:56:41 UTC (rev 2570)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-10-21 15:57:36 UTC (rev 2571)
@@ -84,7 +84,7 @@
protected void onExamine(int row)
{
ProcessDefinition proc = row2ProcessMap.get(row);
- String editorId = ProcessInstanceEditor.ID+"."+proc.getName();
+ String editorId = ProcessInstanceEditor.createWidgetID(proc);
if(view.hasEditorView(editorId))
view.showEditor(editorId);
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java 2008-10-21 15:56:41 UTC (rev 2570)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceEditor.java 2008-10-21 15:57:36 UTC (rev 2571)
@@ -169,4 +169,9 @@
{
return "bpm-instance-icon";
}
+
+ public static String createWidgetID(ProcessDefinition parent)
+ {
+ return ProcessInstanceEditor.ID+"."+parent.getName()+"."+parent.getVersion();
+ }
}
Modified: jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java
===================================================================
--- jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-10-21 15:56:41 UTC (rev 2570)
+++ jbpm3/trunk/modules/gwt-console/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceListEditor.java 2008-10-21 15:57:36 UTC (rev 2571)
@@ -65,7 +65,7 @@
this.parent = proc;
this.view = view;
- this.setId(ProcessInstanceEditor.ID+"."+proc.getName());
+ this.setId( ProcessInstanceEditor.createWidgetID(proc) );
// --------------------------------------------------
@@ -245,7 +245,7 @@
public String getTitle()
{
- return parent.getName();
+ return parent.getName()+" (#"+parent.getVersion()+")";
}
17 years, 6 months