osworkflow-2.8.0-example.war 例子应用

本文所讲的例子是对OSWorkflow网站例子程序的完善和补充,osworkflow自带例子主要是针对内存中运行的工作流,用户,组,工作流实例都是在内存中的。由于实际工作中,用户及组的信息是要入库的,所以本文主要讲解:OSWorkflow数据库方面的配置。读者可以先下载OSWorkflow的例子,再按以下方法修改相关配置。

下载地址:https://osworkflow.dev.java.net/files/documents/635/27138/osworkflow-2.8.0.zip

在下载的zip包中,有一个osworkflow-2.8.0-example.war包,可以直接在容器中解压运行。

修改如下配置文件:


1.osworkflow.xml修改成如下:该文件负责工作相关信息入库配置。
java:comp/env/jdbc/DefaultDS

 
3. 加入propertyset.xml文件,该文件是工作流中所有属性入库的配置文件,有点像Hibernate的hbm映射文件:
 

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


 
4. DataSource的配置

    在Tomcat中,配置如下:
 注意:要是使用的Tomcat服务器,以上配置文件osuser.xml、propertyset.xml中的datasource的值应该改成java:comp/env/jdbc/DefaultDS。这样才能保证在Tomcat下的正常入库。这是因为osuser及propertyset模块找查datasource时代码不够完善造成的。大家可以参考一下osuser中找查datasource的代码。

<!---->
< Context  displayName ="OSWorkflow Example App"  docBase ="osworkflow-2.8.0-example"  path ="/osworkflow"  workDir ="work\Catalina\localhost\osworkflow" >
  
< Resource  name ="jdbc/DefaultDS"  type ="javax.sql.DataSource" />
  
< ResourceParams  name ="jdbc/DefaultDS" >
    
< parameter >
      
< name > url name>
      
<value>jdbc:oracle:thin:@127.0.0.1:1521:ORA9Ivalue>
    
parameter>
    
<parameter>
      
<name>passwordname>
      
<value>OSWFvalue>
    
parameter>
    
<parameter>
      
<name>maxActivename>
      
<value>4value>
    
parameter>
    
<parameter>
      
<name>maxWaitname>
      
<value>5000value>
    
parameter>
    
<parameter>
      
<name>driverClassNamename>
      
<value>oracle.jdbc.driver.OracleDrivervalue>
    
parameter>
    
<parameter>
      
<name>usernamename>
      
<value>OSWFvalue>
    
parameter>
    
<parameter>
      
<name>maxIdlename>
      
<value>2value>
    
parameter>
  
ResourceParams>
Context>

 

tomcat5.5以上的配置:(数据库连接池的配置同以前版本发生变化。)

在webapp目录下,在META-INF目录中新建一个context.xml。参考如下

<!---->xml version="1.0" encoding="UTF-8"?>
<Context reloadable="true" crossContext="true">
    
<Resource name="jdbc/DefaultDS" auth="Container"
        type
="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
        url
="jdbc:oracle:thin:@127.0.0.1:1521:ora9i" username="oswf"
        password
="oswf" maxActive="10" maxIdle="5" maxWait="-1" />
Context>

 

< osworkflow >
    
<!---->

 
< persistence  class ="com.opensymphony.workflow.spi.jdbc.JDBCWorkflowStore" >
<!---->
              
< property  key ="datasource"  value ="jdbc/DefaultDS" />
              
<!---->
              
< property  key ="entry.sequence"
                     value
="SELECT seq_os_wfentry.nextval FROM dual"   />
              
< 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 seq_os_currentsteps.nextval FROM dual"   />
              
< 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>

 

 2. osuser.xml修改成如下:该文件负责用户及组的入库配置。

注意:datasource可能必须是

< opensymphony-user >
    
< provider  class ="com.opensymphony.user.provider.jdbc.JDBCAccessProvider" >
      
< property  name ="user.table" > os_user property>
      
<property name="group.table">os_groupproperty>
      
<property name="membership.table">os_membershipproperty>
      
<property name="user.name" >usernameproperty>
      
<property name="user.password">passwordhashproperty>
      
<property name="group.name">groupnameproperty>
      
<property name="membership.userName" >usernameproperty>
      
<property name="membership.groupName">groupnameproperty>
   
<!---->
       
<property name="datasource">java:comp/env/jdbc/DefaultDSproperty>
     
provider>

    
<provider class="com.opensymphony.user.provider.jdbc.JDBCCredentialsProvider">
      
<property name="user.table">os_userproperty>
      
<property name="group.table">os_groupproperty>
      
<property name="membership.table">os_membershipproperty>
      
<property name="user.name" >usernameproperty>
      
<property name="user.password">passwordhashproperty>
      
<property name="group.name">groupnameproperty>
      
<property name="membership.userName" >usernameproperty>
      
<property name="membership.groupName">groupnameproperty>
 
<!---->
      
<property name="datasource">java:comp/env/jdbc/DefaultDSproperty>
     
provider>

        
<provider class="com.opensymphony.user.provider.jdbc.JDBCProfileProvider">
      
<property name="user.table">os_userproperty>
      
<property name="group.table">os_groupproperty>
      
<property name="membership.table">os_membershipproperty>
      
<property name="user.name" >usernameproperty>
      
<property name="user.password">passwordhashproperty>
      
<property name="group.name">groupnameproperty>
      
<property name="membership.userName" >usernameproperty>
      
<property name="membership.groupName">groupnameproperty>
 
<!---->
      
<property name="datasource">java:comp/env/jdbc/DefaultDSproperty>
     
provider>

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

opensymphony-user>

你可能感兴趣的:(oracle,应用服务器,jdbc,workflow,OS)