[jboss-svn-commits] JBL Code SVN: r24451 - labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Dec 20 15:45:28 EST 2008
Author: KrisVerlaenen
Date: 2008-12-20 15:45:28 -0500 (Sat, 20 Dec 2008)
New Revision: 24451
Modified:
labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/JPAPersisterManager.java
labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java
Log:
JBRULES-1887: JPAPersisterManager should take EntityManagerFactory as an input parameter
-applied patch
Modified: labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/JPAPersisterManager.java
===================================================================
--- labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/JPAPersisterManager.java 2008-12-20 20:24:52 UTC (rev 24450)
+++ labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/JPAPersisterManager.java 2008-12-20 20:45:28 UTC (rev 24451)
@@ -14,11 +14,15 @@
private EntityManagerFactory emf;
private PlaceholderResolverStrategyFactory factory;
- public JPAPersisterManager(PlaceholderResolverStrategyFactory factory) {
- emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
+ public JPAPersisterManager(PlaceholderResolverStrategyFactory factory, EntityManagerFactory emf) {
+ this.emf = emf;
this.factory = factory;
}
+ public JPAPersisterManager(PlaceholderResolverStrategyFactory factory) {
+ this(factory, Persistence.createEntityManagerFactory("org.drools.persistence.jpa"));
+ }
+
public void dispose() {
emf.close();
}
Modified: labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java
===================================================================
--- labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java 2008-12-20 20:24:52 UTC (rev 24450)
+++ labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java 2008-12-20 20:45:28 UTC (rev 24451)
@@ -1,5 +1,6 @@
package org.drools.persistence.session;
+import javax.persistence.EntityManagerFactory;
import javax.transaction.xa.XAException;
import org.drools.KnowledgeBase;
@@ -30,8 +31,17 @@
init();
}
+ public SingleSessionCommandService(RuleBase ruleBase, EntityManagerFactory emf) {
+ this(ruleBase, (PlaceholderResolverStrategyFactory)null, emf);
+ }
+
+ public SingleSessionCommandService(RuleBase ruleBase, PlaceholderResolverStrategyFactory factory, EntityManagerFactory emf) {
+ persister = new JPAPersisterManager(factory, emf).getSessionPersister(ruleBase);
+ init();
+ }
+
public SingleSessionCommandService(RuleBase ruleBase, String sessionId) {
- this(ruleBase, sessionId, null);
+ this(ruleBase, sessionId, (PlaceholderResolverStrategyFactory)null);
}
public SingleSessionCommandService(RuleBase ruleBase, String sessionId, PlaceholderResolverStrategyFactory factory) {
@@ -39,22 +49,47 @@
init();
}
+ public SingleSessionCommandService(RuleBase ruleBase, String sessionId, EntityManagerFactory emf) {
+ this(ruleBase, sessionId, null, emf);
+ }
+
+ public SingleSessionCommandService(RuleBase ruleBase, String sessionId, PlaceholderResolverStrategyFactory factory, EntityManagerFactory emf) {
+ persister = new JPAPersisterManager(factory, emf).getSessionPersister(sessionId, ruleBase);
+ init();
+ }
+
public SingleSessionCommandService(KnowledgeBase kbase) {
- this(((KnowledgeBaseImpl) kbase).getRuleBase(), (PlaceholderResolverStrategyFactory) null);
+ this(((KnowledgeBaseImpl) kbase).getRuleBase());
}
public SingleSessionCommandService(KnowledgeBase kbase, PlaceholderResolverStrategyFactory factory) {
this(((KnowledgeBaseImpl) kbase).getRuleBase(), factory);
}
+ public SingleSessionCommandService(KnowledgeBase kbase, EntityManagerFactory emf) {
+ this(((KnowledgeBaseImpl) kbase).getRuleBase(), emf);
+ }
+
+ public SingleSessionCommandService(KnowledgeBase kbase, PlaceholderResolverStrategyFactory factory, EntityManagerFactory emf) {
+ this(((KnowledgeBaseImpl) kbase).getRuleBase(), factory, emf);
+ }
+
public SingleSessionCommandService(KnowledgeBase kbase, String sessionId) {
- this(((KnowledgeBaseImpl) kbase).getRuleBase(), sessionId, null);
+ this(((KnowledgeBaseImpl) kbase).getRuleBase(), sessionId);
}
public SingleSessionCommandService(KnowledgeBase kbase, String sessionId, PlaceholderResolverStrategyFactory factory) {
this(((KnowledgeBaseImpl) kbase).getRuleBase(), sessionId, factory);
}
+ public SingleSessionCommandService(KnowledgeBase kbase, String sessionId, EntityManagerFactory emf) {
+ this(((KnowledgeBaseImpl) kbase).getRuleBase(), sessionId, emf);
+ }
+
+ public SingleSessionCommandService(KnowledgeBase kbase, String sessionId, PlaceholderResolverStrategyFactory factory, EntityManagerFactory emf) {
+ this(((KnowledgeBaseImpl) kbase).getRuleBase(), sessionId, factory, emf);
+ }
+
private void init() {
StatefulSession session = persister.getObject();
((JPAProcessInstanceManager) ((InternalWorkingMemory) session).getProcessInstanceManager())
More information about the jboss-svn-commits
mailing list