首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Hibernate,proxool,mule框架筹建

2012-11-18 
Hibernate,proxool,mule框架搭建最近刚刚搭建了hibernate,proxool和mule的开发框架,为了防止忘记,做个笔记

Hibernate,proxool,mule框架搭建
最近刚刚搭建了hibernate,proxool和mule的开发框架,为了防止忘记,做个笔记吧。
配置文件如下:
1.proxoolconf.xml

<?xml version="1.0" encoding="utf-8"?>  
<something-else-entirely>  
<proxool>  
<alias>proxoolPool</alias>  
<!--proxool只能管理由自己产生的连接-->  

<driver-url>jdbc:mysql://localhost:3306/muleapp</driver-url>  
<driver-class>com.mysql.jdbc.Driver</driver-class>  
<driver-properties>  
<property name="user" value="java"/>  
<property name="password" value="java"/>  
</driver-properties>  

<!-- proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回收,超时的销毁-->  
<house-keeping-sleep-time>10000</house-keeping-sleep-time>  
<!-- 指因未有空闲连接可以分配而在队列中等候的最大请求数,超过这个请求数的用户连接就不会被接受-->  
<maximum-new-connections>20</maximum-new-connections>  

<!-- 最少保持的空闲连接数-->  
<prototype-count>5</prototype-count>  
<!-- 允许最大连接数,超过了这个连接,再有请求时,就排在队列中等候,最大的等待请求数由maximum-new-connections决定-->  
<maximum-connection-count>200</maximum-connection-count>  
<!-- 最小连接数-->  
<minimum-connection-count>30</minimum-connection-count>  
</proxool>  
</something-else-entirely>  

2.hibernate.cfg.xml

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

<!-- hibernate dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
<!--<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>-->

<property name="proxool.pool_alias">proxoolPool</property>                                                    
<property name="proxool.xml">proxoolconf.xml</property>                                                       
<property name="hibernate.proxool.existing_pool">true</property>                                              
<property name="connection.provider_class">org.hibernate.connection.ProxoolConnectionProvider</property>      

<!-- JDBC connection properties (end) -->

<!-- DataSource properties (begin) ===
<property name="hibernate.connection.datasource">java:JbpmDS</property>
==== DataSource properties (end) -->

<!-- JTA transaction properties (begin) ===
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
==== JTA transaction properties (end) -->

<!-- CMT transaction properties (begin) ===
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
==== CMT transaction properties (end) -->

<!-- ################################### -->
<!-- # common settings                 # -->
<!-- ################################### -->

<!-- Automatic schema creation (begin) -->
<!--<property name="hibernate.hbm2ddl.auto">update</property>-->
<!-- Automatic schema creation (end) -->

<!-- Simple memory-only cache -->
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>

<!-- logging properties -->
<property name="hibernate.format_sql">true</property>
<property name="hibernate.use_sql_comments">true</property>

<!-- ############################################ -->
<!-- # mapping files with external dependencies # -->
<!-- ############################################ -->
<!-- ybt mappings -->
<mapping resource="com/hundsun/hibernate/TsYwtyXtywzt.hbm.xml"/>
<mapping resource="com/hundsun/hibernate/ybt/YbtGsxxb.hbm.xml"/>
   

<!-- Additional mappings defined per module go here -->
<mapping resource="hibernate.extra.hbm.xml" />
<mapping resource="hibernate.identity.hbm.xml" />
  <!-- ###################### -->
    <!-- # jbpm mapping files # -->
    <!-- ###################### -->

    <!-- hql queries -->
    <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />

    <!-- hql queries used in simulation for querying historical data.
         uncomment if you want to use the GetSimulationInputCommand
         or you want to use the queries directly.
         beware: the queries need the stddev function to be enabled in your dialect.
         for more information, visit:
         http://www.camunda.com/business_process_simulation_news/mysql_and_stddev.html -->
    <!--
    <mapping resource="org/jbpm/sim/bam/hibernate.queries.hbm.xml" />
    -->

    <!-- graph.action mapping files -->
    <mapping resource="org/jbpm/graph/action/MailAction.hbm.xml"/>

    <!-- graph.def mapping files -->
    <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
    <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>

    <!-- ########################################### -->
    <!-- # mapping file with external dependencies # -->
    <!-- ########################################### -->
    <!-- the following mapping file has a dependency on 'bsh-{version}.jar'.
         uncomment this if bsh is not in your classpath.
         the script element will not be available in process definition files.
         note: this mapping must appear below org/jbpm/graph/def/Action.hbm.xml -->
    <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>

    <!-- graph.node mapping files -->
    <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/MailNode.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>

    <!-- context.def mapping files -->
    <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>

    <!-- bytes mapping files -->
    <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>

    <!-- module.def mapping files -->
    <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>

    <!-- file.def mapping files -->
    <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>

    <!-- taskmgmt.def mapping files -->
    <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>

    <!-- scheduler.def mapping files -->
    <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
    <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>

    <!-- graph.exe mapping files -->
    <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>

    <!-- module.exe mapping files -->
    <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>

    <!-- context.exe mapping files -->
    <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>

    <!-- job mapping files -->
    <mapping resource="org/jbpm/job/Job.hbm.xml"/>
    <mapping resource="org/jbpm/job/Timer.hbm.xml"/>
    <mapping resource="org/jbpm/job/ExecuteNodeJob.hbm.xml"/>
    <mapping resource="org/jbpm/job/ExecuteActionJob.hbm.xml"/>
    <mapping resource="org/jbpm/job/CleanUpProcessJob.hbm.xml"/>
 

    <!-- taskmgmt.exe mapping files -->
    <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>

    <!-- logging mapping files -->
    <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
    <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
    <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>

    <!-- ################## -->
    <!-- # cache settings # -->
    <!-- ##################-->

    <!-- strategy="nonstrict-read-write" can be used with HashtableCacheProvider -->

    <class-cache usage="nonstrict-read-write" />

    <collection-cache collection="org.jbpm.file.def.FileDefinition.processFiles" usage="nonstrict-read-write" />

    <collection-cache collection="org.jbpm.graph.action.Script.variableAccesses" usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.Event.actions" usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.ExceptionHandler.actions" usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.Node.events" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.Node.exceptionHandlers" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.Node.leavingTransitions" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.Node.arrivingTransitions" usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.events" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.exceptionHandlers" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.nodes" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.actions" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.ProcessDefinition.definitions" usage="nonstrict-read-write" />

    <collection-cache collection="org.jbpm.graph.def.SuperState.nodes" usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.Transition.events" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.graph.def.Transition.exceptionHandlers" usage="nonstrict-read-write" />

    <collection-cache collection="org.jbpm.graph.node.Decision.decisionConditions" usage="nonstrict-read-write" />

    <collection-cache collection="org.jbpm.graph.node.ProcessState.variableAccesses" usage="nonstrict-read-write" />

    <collection-cache collection="org.jbpm.graph.node.TaskNode.tasks" usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />

    <collection-cache collection="org.jbpm.taskmgmt.def.Swimlane.tasks" usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.taskmgmt.def.TaskController.variableAccesses" usage="nonstrict-read-write" />

    <class-cache usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.taskmgmt.def.Task.events" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.taskmgmt.def.Task.exceptionHandlers" usage="nonstrict-read-write" />

    <collection-cache collection="org.jbpm.taskmgmt.def.TaskMgmtDefinition.swimlanes" usage="nonstrict-read-write" />
    <collection-cache collection="org.jbpm.taskmgmt.def.TaskMgmtDefinition.tasks" usage="nonstrict-read-write" />
</session-factory>
</hibernate-configuration>

3.web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>TPS Administration</display-name>
<description>Administration console for the Mule-powered TPS</description>

<!-- The Mule configuration is provided as a context parameter -->
<context-param>
<param-name>org.mule.config</param-name>
<param-value>mule-config.xml</param-value>
</context-param>

<!-- This listener will start up Mule inside the webapp -->
<listener>
<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
</listener>

<!-- This servlet will route a URL of "/bookstore-admin/services/foo"
to the inbound endpoint "servlet://foo" in Mule -->
<servlet>
<servlet-name>muleServlet</servlet-name>
<servlet-class>org.mule.transport.servlet.MuleRESTReceiverServlet</servlet-class>

<!-- Responses from the servlet are of type HTML by default -->
<init-param>
<param-name>org.mule.servlet.default.content.type</param-name>
<param-value>text/html</param-value>
</init-param>               
</servlet>
<servlet>
<servlet-name>uploadprocess-servlet</servlet-name>
<!--<servlet-class>org.jbpm.web.ProcessUploadServlet</servlet-class>-->
<servlet-class>com.hundsun.jbpm.deploy.UploadServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>fileupload-servlet</servlet-name>
<servlet-class>com.hundsun.util.FileUploadServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>init-servlet</servlet-name>
<servlet-class>com.hundsun.jbpm.deploy.servlet.InitServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>uploadprocess-servlet</servlet-name>
<url-pattern>/upload</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>muleServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<!--proxool  begin-->
<servlet>
<servlet-name>proxoolInitialServlet</servlet-name>
<servlet-class>
            org.logicalcobwebs.proxool.configuration.ServletConfigurator
</servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>WEB-INF/classes/proxoolconf.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>                               
<servlet-name>Admin</servlet-name>  
<servlet-class>                     
         org.logicalcobwebs.proxool.admin.servlet.AdminServlet        
</servlet-class>                    
</servlet>                              
<servlet-mapping>                       
<servlet-name>Admin</servlet-name>  
<url-pattern>/admin</url-pattern>   
</servlet-mapping>                      
<!--proxool end-->

<welcome-file-list>
<welcome-file>log.html</welcome-file>
</welcome-file-list>
</web-app>


热点排行