[jbpm-commits] JBoss JBPM SVN: r5765 - in jbpm4/trunk/modules: db/src/main/java/org/jbpm/db/internal and 3 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Oct 21 05:33:37 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-10-21 05:33:36 -0400 (Wed, 21 Oct 2009)
New Revision: 5765
Added:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
Removed:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/
Modified:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java
jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java
jbpm4/trunk/modules/distro/src/main/files/install/build.xml
Log:
JBPM-2509 database upgrade work. refactored ant tasks to main methods
Copied: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java (from rev 5764, jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/CreatePropertiesTask.java)
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java (rev 0)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java 2009-10-21 09:33:36 UTC (rev 5765)
@@ -0,0 +1,41 @@
+/*
+ * 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.db;
+
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.db.internal.upgrade.CreatePropertiesCmd;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class CreateProperties {
+
+ public static void main(String[] args) {
+ ProcessEngine processEngine = new ProcessEngineImpl()
+ .skipDbCheck()
+ .buildProcessEngine();
+
+ // create properties
+ processEngine.execute(new CreatePropertiesCmd());
+ }
+}
Property changes on: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/CreateProperties.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java (from rev 5764, jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/ant/UpgradeTask.java)
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java (rev 0)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-10-21 09:33:36 UTC (rev 5765)
@@ -0,0 +1,54 @@
+/*
+ * 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.db;
+
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.db.internal.upgrade.AddLangIdCmd;
+import org.jbpm.db.internal.upgrade.GetJbpmVersionCmd;
+import org.jbpm.db.internal.upgrade.JbpmVersion;
+import org.jbpm.db.internal.upgrade.UpdateSchemaCmd;
+import org.jbpm.db.internal.upgrade.UpgradePropertiesCmd;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class Upgrade {
+
+ public static void main(String[] args) {
+ ProcessEngine processEngine = new ProcessEngineImpl()
+ .skipDbCheck()
+ .buildProcessEngine();
+
+ // update database schema
+ processEngine.execute(new UpdateSchemaCmd());
+
+ // check whether database version predates engine version
+ JbpmVersion currentVersion = processEngine.execute(new GetJbpmVersionCmd());
+ if (currentVersion.isEarlier(JbpmVersion.V_4_2)) {
+ // add property "langid" to each deployed process
+ processEngine.execute(new AddLangIdCmd());
+ // upgrade properties
+ processEngine.execute(new UpgradePropertiesCmd());
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java 2009-10-21 07:14:47 UTC (rev 5764)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/internal/upgrade/JbpmVersion.java 2009-10-21 09:33:36 UTC (rev 5765)
@@ -39,4 +39,8 @@
return dbVersion.startsWith("4.") && dbVersion.length() > 2 ? valueOf("V_4_"
+ dbVersion.substring(2)) : null;
}
+
+ public boolean isEarlier(JbpmVersion other) {
+ return ordinal() < other.ordinal();
+ }
}
Modified: jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java
===================================================================
--- jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java 2009-10-21 07:14:47 UTC (rev 5764)
+++ jbpm4/trunk/modules/db/src/test/java/org/jbpm/db/internal/ant/UpgradeTaskTest.java 2009-10-21 09:33:36 UTC (rev 5765)
@@ -23,12 +23,9 @@
import org.jbpm.api.Configuration;
import org.jbpm.api.JbpmException;
-import org.jbpm.db.internal.cmd.GetDeploymentPropertyCmd;
-import org.jbpm.db.internal.cmd.RemoveDeploymentPropertyCmd;
import org.jbpm.db.internal.cmd.RunScriptCmd;
import org.jbpm.db.internal.cmd.TableExistsCmd;
import org.jbpm.db.internal.upgrade.UpdateSchemaCmd;
-import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.test.JbpmTestCase;
/**
@@ -80,7 +77,7 @@
try {
// processEngine.execute(new RemoveDeploymentPropertyCmd(deploymentId, processName, DeploymentImpl.KEY_PROCESS_LANGUAGE_ID));
// do upgrade
- new UpgradeTask().execute();
+ // new Upgrade().execute();
// verify new table was created
assert processEngine.execute(new TableExistsCmd("JBPM4_PROPERTY"));
// verify langid attribute was added
Modified: jbpm4/trunk/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-10-21 07:14:47 UTC (rev 5764)
+++ jbpm4/trunk/modules/distro/src/main/files/install/build.xml 2009-10-21 09:33:36 UTC (rev 5765)
@@ -599,12 +599,16 @@
</target>
<!-- ### UPGRADE JBPM SCHEMA ############################################# -->
- <target name="upgrade.jbpm.schema"
+ <target name="upgrade.jbpm.schema"
+ depends="create.cfg"
description="Upgrades the jBPM tables in the database to the current version">
<echo message="upgrading jbpm schema..." />
- <java classname="org.jbpm.db.DbUpgrade">
- <arg line="${jbpm.home} ${database}" />
+ <java classname="org.jbpm.db.Upgrade">
<classpath>
+ <pathelement location="${jbpm.home}/install/generated/cfg" />
+ <fileset dir="${jbpm.home}">
+ <include name="jbpm.jar"/>
+ </fileset>
<fileset dir="${jbpm.home}/lib">
<include name="*.jar"/>
</fileset>
More information about the jbpm-commits
mailing list