Oswofkflow 入门第一例

    工作流应用越来越多了现在,越来越多的朋友开始关注osworkflow,可惜他停止生长,真是个坏事情,作为研究了osworkflow 几年的人,现在遇到问题,只能在源码上修修补补,真希望大牛快点出来,启动这个项目,国内有人吗,合作也可以,我仔细研究过他的代码,真是个学习worklfow的好东西啊,由于其自带的例子是xml配置和内存数据库,许多朋友需要在实际数据库下面运行,今天我就先把配置好的+mysql例子发上来,有问题再说

注明 :tomcat6+mysql5

 step 1:

   新建/META-INF/Context.xml

 

<Context path="/osworkflow" docBase="osworkflow"
        debug="5" reloadable="true" crossContext="true">   

  <Resource name="jdbc/oswf" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="root" password="" driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost:3306/osworkflow?autoReconnect=true"/>

</Context>

 

 

step 2 :

  修改/WEB-INF/classes/osuser.xml

 

 

<opensymphony-user>

   
    <!--
     <provider class="com.opensymphony.user.provider.memory.MemoryAccessProvider" />
    <provider class="com.opensymphony.user.provider.memory.MemoryCredentialsProvider" />
    <provider class="com.opensymphony.user.provider.memory.MemoryProfileProvider" />
		Authenticators can take properties just like providers.

		This smart authenticator should work for 'most' cases - it dynamically looks up
		the most appropriate authenticator for the current server.
	-->
	<provider class="com.opensymphony.user.provider.jdbc.JDBCAccessProvider">
        <property name="datasource">jdbc/oswf</property>
        <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>
    </provider>
    <provider class="com.opensymphony.user.provider.jdbc.JDBCCredentialsProvider">
        <property name="datasource">jdbc/oswf</property>
        <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>
    </provider>
    <provider class="com.opensymphony.user.provider.jdbc.JDBCProfileProvider">
        <property name="datasource">jdbc/oswf</property>
        <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>
    </provider>

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

 

 

step 3:

  修改/WEB-INF/classes/osworkflow.xml

 

 

<osworkflow>
    <!--
    <persistence class="com.opensymphony.workflow.spi.memory.MemoryWorkflowStore"/>
    -->
    <persistence class="com.opensymphony.workflow.spi.jdbc.MySQLWorkflowStore">
	<!-- For jdbc persistence, all are required. -->
	<property key="datasource" value="jdbc/oswf"/>

	
	<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="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"/>
	
	
	
	<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"/>

</persistence>

    
    
    
    <factory class="com.opensymphony.workflow.loader.XMLWorkflowFactory">
        <property key="resource" value="workflows.xml" />
    </factory>
</osworkflow>

 

 

step 4:

   修改/WEB-INF/classes/propertyset.xml

 

  

<propertysets>
    <propertyset name="jdbc" 
      class="com.opensymphony.module.propertyset.database.JDBCPropertySet">
        <arg name="datasource" value="jdbc/oswf"/>
        <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"/>
    </propertyset>
</propertysets>

 

 

step 5:

  在web.xml中添加

  

 <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/oswf</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>

 

最后说明: 数据库 osworkflow 用户 :root 密码: 空  数据源:jdbc/oswf 

 

ok ,lets go!!

 

整体文件见下面

你可能感兴趣的:(mysql,xml,jdbc,workflow,OS)