星期四, 九月 20, 2012

Fwd: OSWORKFLOW on JBOSS 4.22 Config.

1.download osworkflow 2.8,2006年以后已不再维护。
   http://java.net/downloads/osworkflow/

2.将osworkflow-2.8.0-example.war展开到jboss 422/server/default/deploy/osworkflow-2.8.0-example.war 目录下。

3.在MYSQL 上建立一个osworkflow的database,并运行osworkflow-2.8.0\src\etc\deployment\jdbc
 \mysql.sql,建立其需要使用的表格.
4.配置JBOSS 数据源
   在
jboss 422/server/default/deploy/mysql-ds.xml里加入数据源:
   <!-- add for osworkflow datasorce -->
  <local-tx-datasource>
    <jndi-name>osworkflow</jndi-name>
   <connection-url>jdbc:mysql://192.1.1.100:3306/osworkflow?autoReconnect=true&amp;useUnicode=TRUE&amp;characterEncoding=utf-8</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>root</user-name>
    <password></password>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
        <min-pool-size>5</min-pool-size>
        <max-pool-size>10</max-pool-size>
        <idle-timeout-minutes>1</idle-timeout-minutes>
    <metadata>
       <type-mapping>mySQL</type-mapping>
    </metadata>
  </local-tx-datasource>


5.进入
jboss 422/server/default/deploy/osworkflow-2.8.0-example.war/WEB-INF/classes下修改配置,加入数据源说明.
  注意Linux table name 有大小写的问题。

  osuser.xml:
<opensymphony-user>
   <provider class="com.opensymphony.user.provider.jdbc.JDBCAccessProvider">
  <property name="user.table">OS_USER</property>
  <property name="group.table">OS_GROUP</property>
  <property name="membership.table">OS_MEMBERSHIP</property>
  <property name="user.name" >username</property>
  <property name="user.password">passwordhash</property>
  <property name="group.name">groupname</property>
  <property name="membership.userName" >username</property>
  <property name="membership.groupName">groupname</property>
  <property name="datasource">java:/osworkflow</property>
</provider>

<provider class="com.opensymphony.user.provider.jdbc.JDBCCredentialsProvider">
 <property name="user.table">OS_USER</property>
  <property name="group.table">OS_GROUP</property>
  <property name="membership.table">OS_MEMBERSHIP</property>
<property name="user.name" >username</property>
  <property name="user.password">passwordhash</property>
  <property name="group.name">groupname</property>
  <property name="membership.userName" >username</property>
  <property name="membership.groupName">groupname</property>
  <property name="datasource">java:/osworkflow</property>
 </provider>

    <provider class="com.opensymphony.user.provider.jdbc.JDBCProfileProvider">
 <property name="user.table">OS_USER</property>
  <property name="group.table">OS_GROUP</property>
  <property name="membership.table">OS_MEMBERSHIP</property>
<property name="user.name" >username</property>
  <property name="user.password">passwordhash</property>
  <property name="group.name">groupname</property>
  <property name="membership.userName" >username</property>
  <property name="membership.groupName">groupname</property>
  <property name="datasource">java:/osworkflow</property>
 </provider>

 <authenticator class="com.opensymphony.user.authenticator.SmartAuthenticator" />

</opensymphony-user>

osworkflow.xml:
<osworkflow>
    <!--persistence class="com.opensymphony.workflow.spi.memory.MemoryWorkflowStore"/-->
    <persistence class="com.opensymphony.workflow.spi.jdbc.MySQLWorkflowStore">
 <property key="datasource" value="java:/osworkflow"/>
<property key="entry.sequence"
                      value="SELECT max(id)+1 FROM OS_WFENTRY"/>
 <property key="entry.table" value="OS_WFENTRY"/>
 <property key="entry.id" value="ID"/>
 <property key="entry.name" value="NAME"/>
 <property key="entry.state" value="STATE"/>
 <property key="step.sequence"  value="SELECT max(ID)+1 FROM OS_STEPIDS"/>

 <property key="step.sequence.increment"    value="INSERT INTO OS_STEPIDS (ID) values (null)"/>
 <property key="step.sequence.retrieve"   value="SELECT max(ID) FROM OS_STEPIDS"/>
 <property key="entry.sequence.increment" value="INSERT INTO OS_ENTRYIDS (ID) values (null)"/>
 <property key="entry.sequence.retrieve" value="SELECT max(ID) FROM OS_ENTRYIDS"/>

 <property key="history.table" value="OS_HISTORYSTEP"/>
 <property key="current.table" value="OS_CURRENTSTEP"/>
 <property key="historyPrev.table" value="OS_HISTORYSTEP_PREV"/>
 <property key="currentPrev.table" value="OS_CURRENTSTEP_PREV"/>
 <property key="step.id" value="ID"/>
 <property key="step.entryId" value="ENTRY_ID"/>
 <property key="step.stepId" value="STEP_ID"/>
 <property key="step.actionId" value="ACTION_ID"/>
 <property key="step.owner" value="OWNER"/>
 <property key="step.caller" value="CALLER"/>
 <property key="step.startDate" value="START_DATE"/>
 <property key="step.finishDate" value="FINISH_DATE"/>
 <property key="step.dueDate" value="DUE_DATE"/>
 <property key="step.status" value="STATUS"/>
 <property key="step.previousId" value="PREVIOUS_ID"/>
</persistence>
    <factory class="com.opensymphony.workflow.loader.XMLWorkflowFactory">
        <property key="resource" value="workflows.xml" />
    </factory>
</osworkflow>

 propertyset.xml:
<propertysets>
 <propertyset name="jdbc" class="com.opensymphony.module.propertyset.database.JDBCPropertySet">
  <arg name="table.name" value="OS_PROPERTYENTRY"/>
  <arg name="col.globalKey" value="GLOBAL_KEY"/>
  <arg name="col.itemKey" value="ITEM_KEY"/>
  <arg name="col.itemType" value="ITEM_TYPE"/>
  <arg name="col.string" value="STRING_VALUE"/>
  <arg name="col.date" value="DATE_VALUE"/>
  <arg name="col.data" value="DATA_VALUE"/>
  <arg name="col.float" value="FLOAT_VALUE"/>
  <arg name="col.number" value="NUMBER_VALUE"/>
  <arg name="datasource" value="java:/osworkflow"/>
  <arg name="" value=""/>
 </propertyset>
</propertysets>


至此配置完成,启动JBOSS,从浏览器输入:
http://192.168.1.1:8080/osworkflow-2.8.0-example/

即可查看.