Author: Grid.Qian
Date: 2008-08-04 05:03:38 -0400 (Mon, 04 Aug 2008)
New Revision: 9481
Added:
workspace/grid/
workspace/grid/org.jboss.tools.b2j/
workspace/grid/org.jboss.tools.b2j/.classpath
workspace/grid/org.jboss.tools.b2j/.project
workspace/grid/org.jboss.tools.b2j/.settings/
workspace/grid/org.jboss.tools.b2j/.settings/org.eclipse.jdt.core.prefs
workspace/grid/org.jboss.tools.b2j/META-INF/
workspace/grid/org.jboss.tools.b2j/META-INF/MANIFEST.MF
workspace/grid/org.jboss.tools.b2j/bin/
workspace/grid/org.jboss.tools.b2j/bin/org/
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/B2J.class
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/action/
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/action/B2JAction.class
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/messages/
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/messages/B2J.properties
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/messages/B2JMessages.class
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/BPMN2JPDL.class
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/JpdlXmlWriter.class
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/TranslateHelper.class
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/util/
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/util/B2JUtil.class
workspace/grid/org.jboss.tools.b2j/build.properties
workspace/grid/org.jboss.tools.b2j/lib/
workspace/grid/org.jboss.tools.b2j/lib/commons-logging.jar
workspace/grid/org.jboss.tools.b2j/lib/dom4j-1.6.1.jar
workspace/grid/org.jboss.tools.b2j/lib/jbpm-jpdl.jar
workspace/grid/org.jboss.tools.b2j/lib/jbpm.cfg.xml
workspace/grid/org.jboss.tools.b2j/lib/org/
workspace/grid/org.jboss.tools.b2j/lib/org/jbpm/
workspace/grid/org.jboss.tools.b2j/lib/org/jbpm/default.jbpm.cfg.xml
workspace/grid/org.jboss.tools.b2j/plugin.properties
workspace/grid/org.jboss.tools.b2j/plugin.xml
workspace/grid/org.jboss.tools.b2j/src/
workspace/grid/org.jboss.tools.b2j/src/org/
workspace/grid/org.jboss.tools.b2j/src/org/jboss/
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/B2J.java
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/action/
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/action/B2JAction.java
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2J.properties
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2JMessages.java
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/TranslateHelper.java
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/util/
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/util/B2JUtil.java
Log:
add grid.qian workspace
Added: workspace/grid/org.jboss.tools.b2j/.classpath
===================================================================
--- workspace/grid/org.jboss.tools.b2j/.classpath (rev 0)
+++ workspace/grid/org.jboss.tools.b2j/.classpath 2008-08-04 09:03:38 UTC (rev 9481)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib"
path="lib/"/>
+ <classpathentry exported="true" kind="lib"
path="lib/commons-logging.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/dom4j-1.6.1.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/jbpm-jpdl.jar"
sourcepath="D:/sources/jbpm/trunk/modules/jpdl"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: workspace/grid/org.jboss.tools.b2j/.classpath
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/.project
===================================================================
--- workspace/grid/org.jboss.tools.b2j/.project (rev 0)
+++ workspace/grid/org.jboss.tools.b2j/.project 2008-08-04 09:03:38 UTC (rev 9481)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.b2j</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: workspace/grid/org.jboss.tools.b2j/.project
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- workspace/grid/org.jboss.tools.b2j/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++ workspace/grid/org.jboss.tools.b2j/.settings/org.eclipse.jdt.core.prefs 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,7 @@
+#Wed Jul 23 02:43:33 CST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on:
workspace/grid/org.jboss.tools.b2j/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/META-INF/MANIFEST.MF
===================================================================
--- workspace/grid/org.jboss.tools.b2j/META-INF/MANIFEST.MF (rev
0)
+++ workspace/grid/org.jboss.tools.b2j/META-INF/MANIFEST.MF 2008-08-04 09:03:38 UTC (rev
9481)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: B2j Plug-in
+Bundle-SymbolicName: org.jboss.tools.b2j;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Localization: plugin
+Bundle-Activator: org.jboss.tools.b2j.B2J
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.stp.bpmn;bundle-version="1.0.0",
+ org.jboss.tools.common;bundle-version="2.0.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ClassPath: lib/jbpm-jpdl.jar,
+ .,
+ lib/dom4j-1.6.1.jar,
+ lib/commons-logging.jar,
+ lib/
Property changes on: workspace/grid/org.jboss.tools.b2j/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/B2J.class
===================================================================
(Binary files differ)
Property changes on: workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/B2J.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/action/B2JAction.class
===================================================================
(Binary files differ)
Property changes on:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/action/B2JAction.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/messages/B2J.properties
===================================================================
--- workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/messages/B2J.properties
(rev 0)
+++
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/messages/B2J.properties 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,21 @@
+Loop_Decision=Loop Decition
+Loop_Decision_Description=this decision is for mocking bpmn loop activity
+To=to
+Bpmn_Suffix=bpmn
+Workspace_Prefix=platform:/resource
+Jpdl_Suffix=jpdl
+Jpdl_Process_Definition_Name=processdefinition.xml
+Jpdl_32_Namespace_Url=urn:jbpm.org:jpdl-3.2
+Jpdl_Element_Name=name
+Jpdl_Process_Definition_Element=process-definition
+Jpdl_Transition_Element=transition
+Jpdl_ProcessState_Element_Name=process-state
+Jpdl_SubProcess_Element_Name=sub-process
+Folder_Name_Separator=.
+Translate_Error_JpdlWriter_Null=The JPDL Writer is null.
+Translate_Error_JpdlProcess_Definition_Null=The JPDL process definition is null.
+Translate_Error_JpdlFile_CanNotGenerate=Couldn't write process definition xml:
+Translate_Error_JpdlFile_CanNotWrite=Couldn't write process definition to a jpdl
file:
+Translate_Error_BpmnFile_CanNotRead=Couldn't read bpmn file:
+Translate_Error_Bpmn_Element_Name= The bpmn element's name is null or same to another
element's name:
+Translate_Warning_Bpmn_Element_Type=The type of this bpmn element is not translated to
corresponding jpdl element:
\ No newline at end of file
Property changes on:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/messages/B2J.properties
___________________________________________________________________
Name: svn:executable
+ *
Added:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/messages/B2JMessages.class
===================================================================
(Binary files differ)
Property changes on:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/messages/B2JMessages.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/BPMN2JPDL.class
===================================================================
(Binary files differ)
Property changes on:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/BPMN2JPDL.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/JpdlXmlWriter.class
===================================================================
(Binary files differ)
Property changes on:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/JpdlXmlWriter.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/TranslateHelper.class
===================================================================
(Binary files differ)
Property changes on:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/translate/TranslateHelper.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/util/B2JUtil.class
===================================================================
(Binary files differ)
Property changes on:
workspace/grid/org.jboss.tools.b2j/bin/org/jboss/tools/b2j/util/B2JUtil.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.b2j/build.properties
===================================================================
--- workspace/grid/org.jboss.tools.b2j/build.properties (rev 0)
+++ workspace/grid/org.jboss.tools.b2j/build.properties 2008-08-04 09:03:38 UTC (rev
9481)
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ lib/jbpm-jpdl.jar,\
+ lib/dom4j-1.6.1.jar,\
+ lib/commons-logging.jar,\
+ lib/,\
+ plugin.properties
Property changes on: workspace/grid/org.jboss.tools.b2j/build.properties
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/lib/commons-logging.jar
===================================================================
(Binary files differ)
Property changes on: workspace/grid/org.jboss.tools.b2j/lib/commons-logging.jar
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.b2j/lib/dom4j-1.6.1.jar
===================================================================
(Binary files differ)
Property changes on: workspace/grid/org.jboss.tools.b2j/lib/dom4j-1.6.1.jar
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.b2j/lib/jbpm-jpdl.jar
===================================================================
(Binary files differ)
Property changes on: workspace/grid/org.jboss.tools.b2j/lib/jbpm-jpdl.jar
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ application/octet-stream
Added: workspace/grid/org.jboss.tools.b2j/lib/jbpm.cfg.xml
===================================================================
--- workspace/grid/org.jboss.tools.b2j/lib/jbpm.cfg.xml (rev 0)
+++ workspace/grid/org.jboss.tools.b2j/lib/jbpm.cfg.xml 2008-08-04 09:03:38 UTC (rev
9481)
@@ -0,0 +1,52 @@
+<jbpm-configuration>
+
+ <!--
+ This configuration is used when there is no jbpm.cfg.xml file found in the
+ root of the classpath. It is a very basic configuration without persistence
+ and message services. Only the authorization service installed.
+ You can parse and create processes, but when you try to use one of the
+ unavailable services, you'll get an exception.
+ -->
+
+ <jbpm-context>
+ <service name="persistence"
factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
+ <service name="tx" factory="org.jbpm.tx.TxServiceFactory"
/>
+ <service name="message"
factory="org.jbpm.msg.db.DbMessageServiceFactory" />
+ <service name="scheduler"
factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
+ <service name="logging"
factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
+ <service name="authentication"
factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory"
/>
+ </jbpm-context>
+
+ <!-- configuration property used by persistence service impl
org.jbpm.persistence.db.DbPersistenceServiceFactory -->
+ <string name="resource.hibernate.cfg.xml"
value="hibernate.cfg.xml" />
+
+ <!-- configuration resource files pointing to default configuration files in
jbpm-{version}.jar -->
+ <string name="resource.business.calendar"
value="org/jbpm/calendar/jbpm.business.calendar.properties" />
+ <string name="resource.default.modules"
value="org/jbpm/graph/def/jbpm.default.modules.properties" />
+ <string name="resource.converter"
value="org/jbpm/db/hibernate/jbpm.converter.properties" />
+ <string name="resource.action.types"
value="org/jbpm/graph/action/action.types.xml" />
+ <string name="resource.node.types"
value="org/jbpm/graph/node/node.types.xml" />
+ <string name="resource.parsers"
value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
+ <string name="resource.varmapping"
value="org/jbpm/context/exe/jbpm.varmapping.xml" />
+ <string name="resource.mail.templates"
value="jbpm.mail.templates.xml" />
+
+ <int name="jbpm.byte.block.size" value="1024"
singleton="true" />
+ <bean name="jbpm.task.instance.factory"
class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl"
singleton="true" />
+ <bean name="jbpm.variable.resolver"
class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true"
/>
+ <string name="jbpm.mail.smtp.host" value="localhost" />
+ <bean name="jbpm.mail.address.resolver"
class="org.jbpm.identity.mail.IdentityAddressResolver"
singleton="true" />
+ <string name="jbpm.mail.from.address" value="jbpm@noreply"
/>
+
+ <bean name="jbpm.job.executor"
class="org.jbpm.job.executor.JobExecutor">
+ <field name="jbpmConfiguration"><ref
bean="jbpmConfiguration" /></field>
+ <field name="name"><string value="JbpmJobExector"
/></field>
+ <field name="nbrOfThreads"><int value="1"
/></field>
+ <field name="idleInterval"><int value="5000"
/></field>
+ <field name="maxIdleInterval"><int value="3600000"
/></field> <!-- 1 hour -->
+ <field name="historyMaxSize"><int value="20"
/></field>
+ <field name="maxLockTime"><int value="600000"
/></field> <!-- 10 minutes -->
+ <field name="lockMonitorInterval"><int value="60000"
/></field> <!-- 1 minute -->
+ <field name="lockBufferTime"><int value="5000"
/></field> <!-- 5 seconds -->
+ </bean>
+
+</jbpm-configuration>
Property changes on: workspace/grid/org.jboss.tools.b2j/lib/jbpm.cfg.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/lib/org/jbpm/default.jbpm.cfg.xml
===================================================================
--- workspace/grid/org.jboss.tools.b2j/lib/org/jbpm/default.jbpm.cfg.xml
(rev 0)
+++ workspace/grid/org.jboss.tools.b2j/lib/org/jbpm/default.jbpm.cfg.xml 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,52 @@
+<jbpm-configuration>
+
+ <!--
+ This configuration is used when there is no jbpm.cfg.xml file found in the
+ root of the classpath. It is a very basic configuration without persistence
+ and message services. Only the authorization service installed.
+ You can parse and create processes, but when you try to use one of the
+ unavailable services, you'll get an exception.
+ -->
+
+ <jbpm-context>
+ <service name="persistence"
factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
+ <service name="tx" factory="org.jbpm.tx.TxServiceFactory"
/>
+ <service name="message"
factory="org.jbpm.msg.db.DbMessageServiceFactory" />
+ <service name="scheduler"
factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
+ <service name="logging"
factory="org.jbpm.logging.db.DbLoggingServiceFactory" />
+ <service name="authentication"
factory="org.jbpm.security.authentication.DefaultAuthenticationServiceFactory"
/>
+ </jbpm-context>
+
+ <!-- configuration property used by persistence service impl
org.jbpm.persistence.db.DbPersistenceServiceFactory -->
+ <string name="resource.hibernate.cfg.xml"
value="hibernate.cfg.xml" />
+
+ <!-- configuration resource files pointing to default configuration files in
jbpm-{version}.jar -->
+ <string name="resource.business.calendar"
value="org/jbpm/calendar/jbpm.business.calendar.properties" />
+ <string name="resource.default.modules"
value="org/jbpm/graph/def/jbpm.default.modules.properties" />
+ <string name="resource.converter"
value="org/jbpm/db/hibernate/jbpm.converter.properties" />
+ <string name="resource.action.types"
value="org/jbpm/graph/action/action.types.xml" />
+ <string name="resource.node.types"
value="org/jbpm/graph/node/node.types.xml" />
+ <string name="resource.parsers"
value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
+ <string name="resource.varmapping"
value="org/jbpm/context/exe/jbpm.varmapping.xml" />
+ <string name="resource.mail.templates"
value="jbpm.mail.templates.xml" />
+
+ <int name="jbpm.byte.block.size" value="1024"
singleton="true" />
+ <bean name="jbpm.task.instance.factory"
class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceFactoryImpl"
singleton="true" />
+ <bean name="jbpm.variable.resolver"
class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true"
/>
+ <string name="jbpm.mail.smtp.host" value="localhost" />
+ <bean name="jbpm.mail.address.resolver"
class="org.jbpm.identity.mail.IdentityAddressResolver"
singleton="true" />
+ <string name="jbpm.mail.from.address" value="jbpm@noreply"
/>
+
+ <bean name="jbpm.job.executor"
class="org.jbpm.job.executor.JobExecutor">
+ <field name="jbpmConfiguration"><ref
bean="jbpmConfiguration" /></field>
+ <field name="name"><string value="JbpmJobExector"
/></field>
+ <field name="nbrOfThreads"><int value="1"
/></field>
+ <field name="idleInterval"><int value="5000"
/></field>
+ <field name="maxIdleInterval"><int value="3600000"
/></field> <!-- 1 hour -->
+ <field name="historyMaxSize"><int value="20"
/></field>
+ <field name="maxLockTime"><int value="600000"
/></field> <!-- 10 minutes -->
+ <field name="lockMonitorInterval"><int value="60000"
/></field> <!-- 1 minute -->
+ <field name="lockBufferTime"><int value="5000"
/></field> <!-- 5 seconds -->
+ </bean>
+
+</jbpm-configuration>
Property changes on: workspace/grid/org.jboss.tools.b2j/lib/org/jbpm/default.jbpm.cfg.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/plugin.properties
===================================================================
--- workspace/grid/org.jboss.tools.b2j/plugin.properties (rev 0)
+++ workspace/grid/org.jboss.tools.b2j/plugin.properties 2008-08-04 09:03:38 UTC (rev
9481)
@@ -0,0 +1 @@
+b2jaction=BPMN -> JPDL
\ No newline at end of file
Property changes on: workspace/grid/org.jboss.tools.b2j/plugin.properties
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/plugin.xml
===================================================================
--- workspace/grid/org.jboss.tools.b2j/plugin.xml (rev 0)
+++ workspace/grid/org.jboss.tools.b2j/plugin.xml 2008-08-04 09:03:38 UTC (rev 9481)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ id="org.jboss.tools.b2j.objectContribution.bpmnfile"
+ nameFilter="*.bpmn"
+ objectClass="org.eclipse.core.resources.IFile">
+ <action
+ label="%b2jaction"
+ class="org.jboss.tools.b2j.action.B2JAction"
+ menubarPath="additions"
+ enablesFor="1"
+ id="org.jboss.tools.b2j.Bpmn2JpdlAction">
+ </action>
+ </objectContribution>
+ </extension>
+
+</plugin>
Property changes on: workspace/grid/org.jboss.tools.b2j/plugin.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/B2J.java
===================================================================
--- workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/B2J.java
(rev 0)
+++ workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/B2J.java 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,50 @@
+package org.jboss.tools.b2j;
+
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class B2J extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.b2j";
+
+ // The shared instance
+ private static B2J plugin;
+
+ /**
+ * The constructor
+ */
+ public B2J() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static B2J getDefault() {
+ return plugin;
+ }
+
+}
Property changes on: workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/B2J.java
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/action/B2JAction.java
===================================================================
--- workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/action/B2JAction.java
(rev 0)
+++
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/action/B2JAction.java 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,30 @@
+package org.jboss.tools.b2j.action;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.jboss.tools.b2j.translate.BPMN2JPDL;
+
+public class B2JAction implements IObjectActionDelegate{
+
+ //private IWorkbenchPart myPart;
+ private IFile bpmnFile;
+
+ public void setActivePart(IAction arg0, IWorkbenchPart part) {
+ //myPart = part;
+ }
+
+ public void run(IAction arg0) {
+ BPMN2JPDL translator = new BPMN2JPDL();
+ translator.setBpmnFile(bpmnFile);
+ translator.translateToFiles();
+ }
+
+ public void selectionChanged(IAction arg0, ISelection selection) {
+ bpmnFile = (IFile) ((IStructuredSelection) selection).getFirstElement();
+ }
+
+}
Property changes on:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/action/B2JAction.java
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2J.properties
===================================================================
--- workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2J.properties
(rev 0)
+++
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2J.properties 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,21 @@
+Loop_Decision=Loop Decition
+Loop_Decision_Description=this decision is for mocking bpmn loop activity
+To=to
+Bpmn_Suffix=bpmn
+Workspace_Prefix=platform:/resource
+Jpdl_Suffix=jpdl
+Jpdl_Process_Definition_Name=processdefinition.xml
+Jpdl_32_Namespace_Url=urn:jbpm.org:jpdl-3.2
+Jpdl_Element_Name=name
+Jpdl_Process_Definition_Element=process-definition
+Jpdl_Transition_Element=transition
+Jpdl_ProcessState_Element_Name=process-state
+Jpdl_SubProcess_Element_Name=sub-process
+Folder_Name_Separator=.
+Translate_Error_JpdlWriter_Null=The JPDL Writer is null.
+Translate_Error_JpdlProcess_Definition_Null=The JPDL process definition is null.
+Translate_Error_JpdlFile_CanNotGenerate=Couldn't write process definition xml:
+Translate_Error_JpdlFile_CanNotWrite=Couldn't write process definition to a jpdl
file:
+Translate_Error_BpmnFile_CanNotRead=Couldn't read bpmn file:
+Translate_Error_Bpmn_Element_Name= The bpmn element's name is null or same to another
element's name:
+Translate_Warning_Bpmn_Element_Type=The type of this bpmn element is not translated to
corresponding jpdl element:
\ No newline at end of file
Property changes on:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2J.properties
___________________________________________________________________
Name: svn:executable
+ *
Added:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2JMessages.java
===================================================================
--- workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2JMessages.java
(rev 0)
+++
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2JMessages.java 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,39 @@
+package org.jboss.tools.b2j.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class B2JMessages {
+
+ private static final String BUNDLE_NAME = "org.jboss.tools.b2j.messages.B2J";
//$NON-NLS-1$
+
+ private B2JMessages() {
+ // Do not instantiate
+ }
+
+ public static String Loop_Decision;
+ public static String Loop_Decision_Description;
+ public static String To;
+ public static String Bpmn_Suffix;
+ public static String Workspace_Prefix;
+ public static String Folder_Name_Separator;
+ public static String Jpdl_Suffix;
+ public static String Jpdl_Process_Definition_Name;
+ public static String Jpdl_ProcessState_Element_Name;
+ public static String Jpdl_SubProcess_Element_Name;
+ public static String Jpdl_32_Namespace_Url;
+ public static String Jpdl_Process_Definition_Element;
+ public static String Jpdl_Transition_Element;
+ public static String Jpdl_Element_Name;
+ public static String Translate_Error_JpdlWriter_Null;
+ public static String Translate_Error_JpdlProcess_Definition_Null;
+ public static String Translate_Error_JpdlFile_CanNotWrite;
+ public static String Translate_Error_JpdlFile_CanNotGenerate;
+ public static String Translate_Error_BpmnFile_CanNotRead;
+ public static String Translate_Error_Bpmn_Element_Name;
+ public static String Translate_Warning_Bpmn_Element_Type;
+
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, B2JMessages.class);
+ }
+}
\ No newline at end of file
Property changes on:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/messages/B2JMessages.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java
===================================================================
--- workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java
(rev 0)
+++
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,334 @@
+package org.jboss.tools.b2j.translate;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.stp.bpmn.*;
+import org.jboss.tools.b2j.B2J;
+import org.jboss.tools.b2j.messages.B2JMessages;
+import org.jbpm.graph.def.*;
+import org.jbpm.graph.node.*;
+
+public class BPMN2JPDL {
+
+ IFile bpmnFile;
+ IFile[] jpdlFiles;
+ List<ProcessDefinition> processDefs = new LinkedList<ProcessDefinition>();
+ Map<String, String> map = new HashMap<String, String>();
+
+ List<String> warnings = new ArrayList<String>();
+ List<String> errors = new ArrayList<String>();
+
+ public List<String> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(List<String> errors) {
+ this.errors = errors;
+ }
+
+ public List<String> getWarnings() {
+ return warnings;
+ }
+
+ public void setWarnings(List<String> warnings) {
+ this.warnings = warnings;
+ }
+
+ public IFile[] getJpdlFiles() {
+ return jpdlFiles;
+ }
+
+ public IFile getBpmnFile() {
+ return bpmnFile;
+ }
+
+ public void setBpmnFile(IFile bpmnFile) {
+ this.bpmnFile = bpmnFile;
+ }
+
+ public BPMN2JPDL() {
+ }
+
+ public BPMN2JPDL(IFile bpmnFile) {
+ this.bpmnFile = bpmnFile;
+ }
+
+ /*
+ * Translate a bpmn diagram to string[]. Every string is jpdl process
+ * definition
+ */
+ public String[] translateToStrings() {
+ this.translateDiagram(this.bpmnFile);
+ String[] strForProcessDefs = new String[processDefs.size()];
+
+ JpdlXmlWriter writer = new JpdlXmlWriter();
+ int i = 0;
+ for (ProcessDefinition def : processDefs) {
+ writer.setWriter(new StringWriter());
+ writer.setUseNamespace(true);
+ strForProcessDefs[i] = translatetoString(writer, def);
+ this.errors.addAll(writer.getProblems());
+ i++;
+ }
+
+ return strForProcessDefs;
+ }
+
+ /*
+ * Tranlate a jpdl process definition to a string
+ */
+ private String translatetoString(JpdlXmlWriter writer, ProcessDefinition def) {
+ return writer.toString(def);
+ }
+
+ /*
+ * Translate a bpmn diagram to file[]. Every file is a jpdl file
+ */
+ public void translateToFiles() {
+ String[] strForProcessDefs = translateToStrings();
+ String[] jpdlFileNames = new String[processDefs.size()];
+
+ int i = 0;
+ for (ProcessDefinition def : processDefs) {
+ jpdlFileNames[i] = def.getName();
+ i++;
+ }
+
+ try {
+ jpdlFiles = TranslateHelper.createJpdlFiles(this.getBpmnFile(),
+ strForProcessDefs, jpdlFileNames);
+ } catch (CoreException e) {
+ errors.add(B2JMessages.Translate_Error_JpdlFile_CanNotWrite
+ + e.getMessage());
+ }
+
+ if (errors.size() != 0) {
+ for (String str : errors) {
+ B2J.getDefault().logError(str);
+ }
+ }
+
+ if (warnings.size() != 0) {
+ for (String str : warnings) {
+ B2J.getDefault().logWarning(str);
+ }
+ }
+ }
+
+ /*
+ * Translate a bpmn diagram to jpdl process definitions
+ */
+ public void translateDiagram(IFile bpmnFile) {
+ BpmnDiagram bpmnDiagram = null;
+ try {
+ bpmnDiagram = TranslateHelper.getBpmnDiagram(bpmnFile);
+ } catch (IOException e) {
+ errors.add(B2JMessages.Translate_Error_BpmnFile_CanNotRead
+ + e.getMessage());
+ }
+ for (Pool pool : bpmnDiagram.getPools()) {
+ ProcessDefinition processDef = new ProcessDefinition();
+ translateGraph(pool, processDef);
+ }
+
+ }
+
+ /*
+ * Translate a bpmn graph(pool or subprocess) to a jpdl process difinition
+ */
+ private void translateGraph(Graph graph, ProcessDefinition processDef) {
+
+ // if graph is subprocess type, we will check the name when look it as activity not as
sub process
+ if (!(graph instanceof SubProcess) &&
!TranslateHelper.checkElementName((NamedBpmnObject) graph)) {
+ errors.add(B2JMessages.Translate_Error_Bpmn_Element_Name
+ + graph.getID());
+ }
+ processDef.setName(TranslateHelper
+ .generateProcessName((NamedBpmnObject) graph));
+ processDef.setDescription(graph.getDocumentation());
+
+ if (graph instanceof Pool && ((Pool) graph).getLanes().size() != 0) {
+ for (Lane lane : ((Pool) graph).getLanes()) {
+ for (Activity activity : lane.getActivities()) {
+ translateActivity(activity, processDef);
+ }
+ }
+ } else {
+ for (Vertex activity : graph.getVertices()) {
+ if (activity instanceof Activity) {
+ translateActivity((Activity) activity, processDef);
+ }
+ }
+ }
+ translateSequenceFlows(graph, processDef);
+ processDefs.add(processDef);
+
+ }
+
+ /*
+ * Translate a bpmn activity to a jpdl node according to activity type
+ */
+ private void translateActivity(Activity activity,
+ ProcessDefinition processDef) {
+ ActivityType type = activity.getActivityType();
+ Node element = null;
+
+ // According to bpmn activity type, map to different jpdl node
+ // Some type can not be supported by this translation, we give
+ // a warining message for it.
+ if (ActivityType.TASK == type.getValue()) {
+ element = new Node();
+ } else if (ActivityType.SUB_PROCESS == type.getValue()) {
+ element = new ProcessState();
+ translateSubprocess((Graph)activity,
+ (ProcessState) element);
+ } else if (ActivityType.EVENT_START_EMPTY <= type.getValue()
+ && type.getValue() <= ActivityType.EVENT_START_TIMER
+ || ActivityType.EVENT_START_SIGNAL == type.getValue()) {
+ element = new StartState();
+ if (type.getValue() != ActivityType.EVENT_START_EMPTY) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ } else if (ActivityType.EVENT_INTERMEDIATE_EMPTY <= type.getValue()
+ && type.getValue() <= ActivityType.EVENT_INTERMEDIATE_CANCEL
+ || ActivityType.EVENT_INTERMEDIATE_SIGNAL == type.getValue()) {
+ element = new State();
+ if (type.getValue() != ActivityType.EVENT_INTERMEDIATE_EMPTY) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ } else if (ActivityType.EVENT_END_EMPTY <= type.getValue()
+ && type.getValue() <= ActivityType.EVENT_END_CANCEL
+ || ActivityType.EVENT_END_SIGNAL == type.getValue()) {
+ element = new EndState();
+ if (type.getValue() != ActivityType.EVENT_END_EMPTY) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ } else if (ActivityType.GATEWAY_DATA_BASED_EXCLUSIVE <= type.getValue()
+ && type.getValue() <= ActivityType.GATEWAY_EVENT_BASED_EXCLUSIVE
+ || ActivityType.GATEWAY_COMPLEX == type.getValue()) {
+ element = new Decision();
+ if (type.getValue() != ActivityType.GATEWAY_DATA_BASED_EXCLUSIVE) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ } else if (ActivityType.GATEWAY_PARALLEL == type.getValue()
+ || ActivityType.GATEWAY_DATA_BASED_INCLUSIVE == type.getValue()) {
+ if (activity.getIncomingEdges().size() <= 1) {
+ element = new Fork();
+ } else {
+ element = new Join();
+ }
+ if (type.getValue() != ActivityType.GATEWAY_PARALLEL) {
+ warnings.add(B2JMessages.Translate_Warning_Bpmn_Element_Type
+ + type.getName());
+ }
+ }
+
+ element.setProcessDefinition(processDef);
+ processDef.addNode(element);
+ if (!TranslateHelper.mapNamedObjToGraphEle((NamedBpmnObject) activity,
+ (GraphElement) element)) {
+ errors.add(B2JMessages.Translate_Error_Bpmn_Element_Name
+ + activity.getID());
+ }
+ map.put(activity.getID(), element.getName());
+
+ // If bpmn activity is loop type, then create a structure to mock it.
+ if (activity.isLooping()) {
+ createMockLoop(activity, element);
+ }
+ }
+
+ /*
+ * Translate a bpmn subprocess to a jpdl processstate and a new jpdl process
+ * difinition
+ */
+ private void translateSubprocess(Graph subProcess,
+ ProcessState element) {
+ ProcessDefinition processDef = new ProcessDefinition();
+ translateGraph(subProcess, processDef);
+ element.setSubProcessDefinition(processDef);
+ }
+
+ /*
+ * Translate bpmn sequenceflows to jpdl transitions
+ */
+ private void translateSequenceFlows(Graph graph,
+ ProcessDefinition processDef) {
+ for (SequenceEdge edge : graph.getSequenceEdges()) {
+ translateSequenceFlow(edge, processDef);
+ }
+ }
+
+ /*
+ * Translate a bpmn sequenceflow to a jpdl transition
+ */
+ private void translateSequenceFlow(SequenceEdge edge,
+ ProcessDefinition processDef) {
+ Transition transition = new Transition();
+ Node element = processDef.getNode(map.get(edge.getSource().getID()));
+ if (!TranslateHelper.mapNamedObjToGraphEle((NamedBpmnObject) edge,
+ (GraphElement) transition)) {
+ errors.add(B2JMessages.Translate_Error_Bpmn_Element_Name
+ + edge.getID());
+ }
+ transition.setProcessDefinition(processDef);
+
+ transition.setFrom(element);
+ transition.setTo(processDef.getNode(map.get(edge.getTarget().getID())));
+ element.addLeavingTransition(transition);
+ if (SequenceFlowConditionType.DEFAULT == edge.getConditionType()
+ .getValue()) {
+ // move default transition to the first of transition list
+ element.reorderLeavingTransition(element.getLeavingTransitions()
+ .size() - 1, 0);
+ } else if (SequenceFlowConditionType.EXPRESSION == edge
+ .getConditionType().getValue()) {
+ transition.setCondition("");
+ }
+ }
+
+ /*
+ * create a jpdl decision structure to map bpmn loop activity
+ */
+ private void createMockLoop(Activity activity, Node element) {
+
+ // create a decision
+ Decision decision = new Decision();
+ String name = activity.getName() + B2JMessages.Loop_Decision;
+ decision.setName(name);
+ decision.setDescription(B2JMessages.Loop_Decision_Description);
+ decision.setProcessDefinition(element.getProcessDefinition());
+ element.getProcessDefinition().addNode(decision);
+ map.put(activity.getID(), name);
+
+ // create a transition from element to decision
+ Transition first = new Transition();
+ first.setName(B2JMessages.To + name);
+ first.setFrom(element);
+ first.setTo(decision);
+ first.setProcessDefinition(element.getProcessDefinition());
+ element.addLeavingTransition(first);
+
+ // create a transition from decision to element
+ Transition second = new Transition();
+ second.setName(B2JMessages.To + element.getName());
+ second.setFrom(decision);
+ second.setTo(element);
+ second.setProcessDefinition(element.getProcessDefinition());
+ decision.addLeavingTransition(second);
+
+ }
+
+}
Property changes on:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/BPMN2JPDL.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java
===================================================================
---
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java
(rev 0)
+++
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,211 @@
+/*
+ * 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.jboss.tools.b2j.translate;
+
+import java.io.*;
+import java.util.*;
+
+import org.dom4j.*;
+import org.dom4j.io.*;
+import org.jboss.tools.b2j.messages.B2JMessages;
+import org.jbpm.graph.def.*;
+import org.jbpm.graph.node.*;
+
+public class JpdlXmlWriter {
+
+ Namespace jbpmNamespace = new Namespace(null,
+ B2JMessages.Jpdl_32_Namespace_Url);
+ Writer writer;
+ boolean useNamespace = false;
+
+ List<String> errors;
+
+ public List<String> getProblems() {
+ return errors;
+ }
+
+ public void setProblems(List<String> errors) {
+ this.errors = errors;
+ }
+
+ public Namespace getJbpmNamespace() {
+ return jbpmNamespace;
+ }
+
+ public void setJbpmNamespace(Namespace jbpmNamespace) {
+ this.jbpmNamespace = jbpmNamespace;
+ }
+
+ public JpdlXmlWriter() {
+ }
+
+ public void addError(String msg) {
+ errors.add(msg);
+ }
+
+ public String toString(ProcessDefinition processDefinition) {
+ write(processDefinition);
+ return writer.toString();
+ }
+
+ public void setUseNamespace(boolean useNamespace) {
+ this.useNamespace = useNamespace;
+ }
+
+ public void write(ProcessDefinition processDefinition) {
+ errors = new ArrayList<String>();
+ if (writer == null) {
+ addError(B2JMessages.Translate_Error_JpdlWriter_Null);
+ }
+ if (processDefinition == null) {
+ addError(B2JMessages.Translate_Error_JpdlProcess_Definition_Null);
+ }
+ try {
+ // collect the actions of the process definition
+ // we will remove each named event action and the remaining ones
+ // will be written
+ // on the process definition.
+ // create a dom4j dom-tree for the process definition
+ Document document = createDomTree(processDefinition);
+
+ // write the dom-tree to the given writer
+ OutputFormat outputFormat = new OutputFormat(" ", true);
+ // OutputFormat outputFormat = OutputFormat.createPrettyPrint();
+ XMLWriter xmlWriter = new XMLWriter(writer, outputFormat);
+ xmlWriter.write(document);
+ xmlWriter.flush();
+ writer.flush();
+ } catch (IOException e) {
+ addError(B2JMessages.Translate_Error_JpdlFile_CanNotGenerate
+ + e.getMessage());
+ }
+ }
+
+ private Document createDomTree(ProcessDefinition processDefinition) {
+ Document document = DocumentHelper.createDocument();
+ Element root = null;
+
+ if (useNamespace) {
+ root = document.addElement(
+ B2JMessages.Jpdl_Process_Definition_Element, jbpmNamespace
+ .getURI());
+ } else {
+ root = document
+ .addElement(B2JMessages.Jpdl_Process_Definition_Element);
+ }
+ addAttribute(root, B2JMessages.Jpdl_Element_Name, processDefinition
+ .getName());
+
+ // write the start-state
+ if (processDefinition.getStartState() != null) {
+ writeStartNode(root, (StartState) processDefinition.getStartState());
+ }
+
+ // write the nodeMap
+ if ((processDefinition.getNodes() != null)
+ && (processDefinition.getNodes().size() > 0)) {
+ writeNodes(root, processDefinition.getNodes());
+ }
+
+ root.addText(System.getProperty("line.separator"));
+
+ return document;
+ }
+
+ private void writeStartNode(Element element, StartState startState) {
+ if (startState != null) {
+ writeNode(addElement(element, getTypeName(startState)), startState);
+ }
+ }
+
+ private void writeNodes(Element parentElement, Collection<?> nodes) {
+ Iterator<?> iter = nodes.iterator();
+ while (iter.hasNext()) {
+ org.jbpm.graph.def.Node node = (org.jbpm.graph.def.Node) iter
+ .next();
+ if (!(node instanceof StartState)) {
+ Element nodeElement = addElement(parentElement, ProcessFactory
+ .getTypeName(node));
+ node.write(nodeElement);
+ writeNode(nodeElement, node);
+ }
+ }
+ }
+
+ private void writeNode(Element element, org.jbpm.graph.def.Node node) {
+ addAttribute(element, B2JMessages.Jpdl_Element_Name, node.getName());
+
+ if (B2JMessages.Jpdl_ProcessState_Element_Name
+ .equals(getTypeName(node))) {
+ Element ele = addElement(element,
+ B2JMessages.Jpdl_SubProcess_Element_Name);
+ addAttribute(ele, B2JMessages.Jpdl_Element_Name,
+ ((ProcessState) node).getSubProcessDefinition().getName());
+ }
+
+ writeTransitions(element, node);
+ }
+
+ private void writeTransitions(Element element, org.jbpm.graph.def.Node node) {
+ if (node.getLeavingTransitionsMap() != null) {
+ Iterator<?> iter = node.getLeavingTransitionsList().iterator();
+ while (iter.hasNext()) {
+ Transition transition = (Transition) iter.next();
+ writeTransition(element
+ .addElement(B2JMessages.Jpdl_Transition_Element),
+ transition);
+ }
+ }
+ }
+
+ private void writeTransition(Element transitionElement,
+ Transition transition) {
+ if (transition.getTo() != null) {
+ transitionElement.addAttribute(B2JMessages.To, transition.getTo()
+ .getName());
+ }
+ if (transition.getName() != null) {
+ transitionElement.addAttribute(B2JMessages.Jpdl_Element_Name,
+ transition.getName());
+ }
+ }
+
+ private Element addElement(Element element, String elementName) {
+ Element newElement = element.addElement(elementName);
+ return newElement;
+ }
+
+ private void addAttribute(Element e, String attributeName, String value) {
+ if (value != null) {
+ e.addAttribute(attributeName, value);
+ }
+ }
+
+ private String getTypeName(Object o) {
+ return ProcessFactory.getTypeName((org.jbpm.graph.def.Node) o);
+ }
+
+ public void setWriter(Writer writer) {
+ this.writer = writer;
+ }
+
+}
Property changes on:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/JpdlXmlWriter.java
___________________________________________________________________
Name: svn:executable
+ *
Added:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/TranslateHelper.java
===================================================================
---
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/TranslateHelper.java
(rev 0)
+++
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/TranslateHelper.java 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,114 @@
+package org.jboss.tools.b2j.translate;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory;
+import org.eclipse.stp.bpmn.BpmnDiagram;
+import org.eclipse.stp.bpmn.NamedBpmnObject;
+import org.jboss.tools.b2j.messages.B2JMessages;
+import org.jboss.tools.b2j.util.B2JUtil;
+import org.jbpm.graph.def.GraphElement;
+
+public class TranslateHelper {
+
+ static List<String> nameList = new ArrayList<String>();
+
+ /*
+ * get a bpmn diagram from a bpmn file
+ */
+ public static BpmnDiagram getBpmnDiagram(IFile bpmnFile) throws IOException {
+ nameList.clear();
+ GMFResourceFactory RESOURCE_FACTORY = new GMFResourceFactory();
+ ResourceSet resourceSet = new ResourceSetImpl();
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
+ .put(B2JMessages.Bpmn_Suffix, RESOURCE_FACTORY);
+ URI uriBpmn = URI.createURI(B2JMessages.Workspace_Prefix
+ + bpmnFile.getFullPath());
+ Resource resBpmn = resourceSet.createResource(uriBpmn);
+ resBpmn.load(GMFResourceFactory.getDefaultLoadOptions());
+ return (BpmnDiagram) resBpmn.getContents().get(0);
+ }
+
+ /*
+ * map bpmn's NamedBpmnObject to jpdl's GraphElement
+ */
+ public static boolean mapNamedObjToGraphEle(NamedBpmnObject namedObject,
+ GraphElement graphEle) {
+ if (checkElementName(namedObject)) {
+ graphEle.setDescription(namedObject.getDocumentation());
+ graphEle.setName(namedObject.getName());
+ return true;
+ }
+ return false;
+ }
+
+ public static IFile[] createJpdlFiles(IFile bpmnFile,
+ String[] strForProcessDefs, String[] jpdlFileNames)
+ throws CoreException {
+ IFolder jpdlFolder = B2JUtil.createFolder(bpmnFile.getParent(),
+ B2JMessages.Jpdl_Suffix);
+ IFolder diagramFolder = B2JUtil.createFolder(jpdlFolder, bpmnFile
+ .getName());
+
+ IFile[] jpdlFiles = new IFile[strForProcessDefs.length];
+ IFolder processFolder = null;
+ int i = 0;
+ ByteArrayInputStream bytes = null;
+ for (String str : strForProcessDefs) {
+ bytes = new ByteArrayInputStream(str.getBytes());
+ processFolder = B2JUtil.createFolder(diagramFolder,
+ jpdlFileNames[i]);
+ jpdlFiles[i] = B2JUtil.createFile(processFolder,
+ B2JMessages.Jpdl_Process_Definition_Name, bytes);
+ i++;
+ }
+ return jpdlFiles;
+ }
+
+ /*
+ * generate a process definition name. the name is composed of the names
+ * from bpmn diagram to the element
+ */
+ public static String generateProcessName(NamedBpmnObject graph) {
+ if (graph instanceof BpmnDiagram) {
+ return graph.getName();
+ } else {
+ String str = generateProcessName((NamedBpmnObject) graph
+ .eContainer());
+ if (str == null) {
+ return graph.getName();
+ } else {
+ return str + B2JMessages.Folder_Name_Separator
+ + graph.getName();
+ }
+ }
+
+ }
+
+ /*
+ * check the bpmn element name is null or "" or same to another element name
+ */
+ public static boolean checkElementName(NamedBpmnObject graph) {
+ if (graph.getName() == null && "".equals(graph.getName())) {
+ return false;
+ }
+
+ if (nameList.contains(graph.getName())) {
+ return false;
+ }
+ nameList.add(graph.getName());
+ return true;
+
+ }
+
+}
Property changes on:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/translate/TranslateHelper.java
___________________________________________________________________
Name: svn:executable
+ *
Added: workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/util/B2JUtil.java
===================================================================
--- workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/util/B2JUtil.java
(rev 0)
+++
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/util/B2JUtil.java 2008-08-04
09:03:38 UTC (rev 9481)
@@ -0,0 +1,61 @@
+package org.jboss.tools.b2j.util;
+
+import java.io.InputStream;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+
+public class B2JUtil {
+
+ public static IFolder createFolder(IContainer parent, String folderName)
+ throws CoreException {
+ IResource child = parent.findMember(folderName);
+ if (child == null) {
+ IFolder folder = parent.getFolder(new Path(folderName));
+ folder.create(true, true, null);
+ return folder;
+ } else {
+ if (child.getType() == IResource.FOLDER) {
+ return (IFolder) child;
+ } else {
+ return null;
+ }
+ }
+ }
+
+ public static IFile createFile(IContainer parent, String fileName,
+ InputStream inputStream) throws CoreException {
+ IResource child = parent.findMember(fileName);
+
+ if (child != null) {
+ if (child.getType() == IResource.FILE) {
+
+ // We have permission to overwrite so check if file is read-only
+ if (child.getResourceAttributes() != null
+ && child.getResourceAttributes().isReadOnly()) {
+ IFile[] files = new IFile[1];
+ files[0] = (IFile) child;
+ }
+
+ // Change the contents of the existing file.
+ IFile file = parent.getFile(new Path(fileName));
+ file.setContents(inputStream, true, true, null);
+
+ return file;
+
+ } else {
+ return null;
+ }
+ } else {
+ // Create a new file.
+ IFile file = parent.getFile(new Path(fileName));
+ file.create(inputStream, true, null);
+ return file;
+ }
+ }
+
+}
Property changes on:
workspace/grid/org.jboss.tools.b2j/src/org/jboss/tools/b2j/util/B2JUtil.java
___________________________________________________________________
Name: svn:executable
+ *