Oracle神谕

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  284 随笔 :: 9 文章 :: 106 评论 :: 0 Trackbacks

(一)结构:
(1)XML定义文件(definition)
(2)plain java   JBpm对象模型  定义 执行 日志
(3)DataBase  定义 执行 日志
(二)
A process definition can be represented in 3 different forms : as xml, as java objects and as records in the jBPM database. Executional (=runtime) information and logging information can be represented in 2 forms : as java objects and as records in the jBPM database.{一个流程定义可以表现为三种不同的形态:XML 、java对象和jBpm数据库中的记录。执行(运行)信息和日志信息可以表现为两种形态:java对象和jBpm数据库中的记录}

For more information about the xml representation of process definitions and process archives, see Chapter 13, jBPM Process Definition Language (JPDL).{Process Definition Language JPDL}

This chapter will discuss the transformations done between the java objects and the jBPM database. To store java objects in the database and retrieve them, jBPM uses hibernate internally. While it is not strictly necessary to have hibernate knowledge for using jBPM, it is recommended. {这个章节将要讨论在java对象和jBPM数据库之间的转换。为了在数据库中存储对象和获取他们,jBPM使用内部使用了Hibernate。当然不是在使用jBPM中严格要拥有Hibernate的知识,它是建议的}

More information on how to deploy a process archive to the database can be found in Section 13.1.1, “Deploying a process archive” .


(三)Session的层次:
JbpmSessionFactory
|
|
|
JbpmSession
|
|
|
GraphSession
TaskMgmtSession
ContextSession

(四) The jBPM database classes

The jBPM persistence operations can be found in the named sessions like e.g. GraphSession, TaskMgmtSession and ContextSession,... The named sessions can be obtained from a JbpmSession. The JbpmSession in its turn can be obtained from a JbpmSessionFactory. {jBPM持久层操作可以发现被命名为sessions,例如想GraphSession TaskMgmtSession和ContextSession.... 这个命名sessions可以从JbpmSession中获得。JbmpSession可以从JbpmSessionFactory中获得}

A JbpmSessionFactory is threadsafe so in your application, you need one JbpmSessionFactory. That singleton can be referenced e.g. in a static variable with lazy initialization (beware about the issues around lazy initialization and double-checked locking). At creation time, the JbpmSessionFactory prepares all information in a way that JbpmSessions can be created super fast. {一个JbpmSessionFactory在你的程序中是线程安全的,你仅仅需要一个JbpmSessionFactory. 那个单例可以被参考在例如在lazy初始化下的静态变量(小心发布在Lazy 初始化并且双层检查锁定。在创建时刻,JbpmSessionFactory 在某种程度准备所有信息那样可以被快速创建)}

As a user, you should create one JbpmSession per thread or per request. The JbpmSession has a JDBC connection to the database. {作为一个用户,你应该创建一个JbpmSession 每一个线程或每一次请求。JbpmSession拥有一个连接数据库的Jdbc连接。}

The purpose of the JbpmSession and JbpmSessionFactory is only to wrap their hibernate counterparts. For advanced features such as detached objects or optimistic locking, see the hibernate documentation. {这个JbpmSession和JbpmSessionFactory的目的仅仅是为了包装Hibernate 副本。 对于高级特征 例如分离对象或乐观锁,看hibernate文档。}

public class PersistenceApiTest extends TestCase {

  static JbpmSessionFactory jbpmSessionFactory = JbpmSessionFactory.buildJbpmSessionFactory();

  public void testStartProcessInstance() {
    // obtain a session
    JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession();
    try {
      // start a user managed transaction
      jbpmSession.beginTransaction();

      // load information from the database
      // (note that process definitions will be cached in memory
      // in the second level cache of hibernate)
      ProcessDefinition auctionProcess =
        jbpmSession.getGraphSession().findLatestProcessDefinition("auction");

      // perform a POJO workflow operation on the plain object model.
      ProcessInstance auctionInstance = new ProcessInstance(auctionProcess);
      auctionInstance.signal();
     
      // store the result in the database
      jbpmSession.getGraphSession().saveProcessInstance(auctionInstance);
     
      // commit the user transaction
      jbpmSession.commitTransaction();

    } finally {
      // close the session.
      jbpmSession.close();     
    }
  }
}

posted on 2005-06-14 18:04 java世界畅谈 阅读(1816) 评论(0)  编辑  收藏 所属分类: 工作流

只有注册用户登录后才能发表评论。


网站导航: