osworkflow-2.8.0-example部署详细步骤

部署环境:
        JDK:jdk1.5.0_11
       Mysql:5.0
       tomcat:5.5
步骤:
        1.安装Mysql数据库,创建名为DefaultDS的数据库
          命令为:Create DATABASE IF NOT EXISTS DefaultDS default charset utf8 COLLATE utf8_general_ci;
         use DefaultDS;
         在下载的包中找到源码,并在源码中的osworkflow-2.8.0\src\etc\deployment\jdbc\找到mysql.sql文件,打开,然后全选,在Mysql控制台中用鼠标右键粘贴,Mysql会自用执行。
          2.在Apache Software Foundation\Tomcat 5.5\conf\Catalina\localhost\下新建一个tomcat的配置文件osworkflow_example.xml,内容为
          
<?xml version='1.0' encoding='utf-8'?>
<Context path="/osworkflow_example" docBase="D:\Program Files\osworkflow-2.8.0-example/" debug="0" reloadable="true" crossContext="true">
   <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_sessiontest_log." suffix=".txt" timestamp="true"/>
   <Environment name="maxExemptions" type="Java.lang.Integer" value="15"/>
   <Parameter name="context.param.name" value="context.param.value" override="false"/>
   <Resource name="jdbc/DefaultDS" auth="Container" type="javax.sql.DataSource"
	password="123456"
    driverClassName="com.mysql.jdbc.Driver"
    maxIdle="2"
    maxWait="5000"
    username="root"
    url="jdbc:mysql://localhost:3306/DefaultDS"
    maxActive="4"
   />
</Context>

         3.将安装文件osworkflow-2.8.0-example.war解压到指定的目录,本文为:D:\Program Files\
         4.修改安装文件中的内容
           WEB-INF/web.xml:增加以下内容
          
<resource-ref>
		<description>MySQL DataSource</description> 
		<res-ref-name>jdbc/DefaultDS</res-ref-name> 
		<res-type>javax.sql.DataSource</res-type> 
		<res-auth>Container</res-auth> 
</resource-ref>

        WEB-INF\classes\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:comp/env/jdbc/DefaultDS</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:comp/env/jdbc/DefaultDS</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:comp/env/jdbc/DefaultDS</property>
	</provider>
	<authenticator class="com.opensymphony.user.authenticator.SmartAuthenticator" />
</opensymphony-user>

             WEB-INF\classes\osworkflow.xml修改为以下内容:
              
<osworkflow>
	<persistence class="com.opensymphony.workflow.spi.jdbc.MySQLWorkflowStore">
	<property key="datasource" value="jdbc/DefaultDS"/>
	<property key="entry.sequence" 
		value="SELECT nextVal('seq_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 nextVal('seq_os_currentsteps')"/>
	-->
	<property key="step.sequence" value="select sum(c1) + 1 from (select 1 as tb, count(*) as c1 from os_currentstep union select 2 as		tb, count(*) as c1 from os_historystep) as TabelaFinal" />
	<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>

         WEB-INF\classes\下,新建一个文件propertyset.xml内容为:
         
<propertysets>
	<propertyset name="jdbc" 
	class="com.opensymphony.module.propertyset.database.JDBCPropertySet">
		<arg name="datasource" value="jdbc/DefaultDS"/>
		<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>

         将Mysql的驱动JAR放入Apache Software Foundation\Tomcat 5.5\common\lib\下,
           启动Tomcat。
           运行http://localhost:8083/osworkflow_example/
         OK。

本文参考了网上的各位前辈的文章。
         

你可能感兴趣的:(sql,tomcat,mysql,jdbc,OS)