[jboss-svn-commits] JBL Code SVN: r24188 - in labs/jbossrules/trunk: drools-api/src/main/java/org/drools/logger and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Dec 1 18:36:09 EST 2008
Author: KrisVerlaenen
Date: 2008-12-01 18:36:09 -0500 (Mon, 01 Dec 2008)
New Revision: 24188
Added:
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeLog.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLogger.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLoggerFactory.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLoggerProvider.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/KnowledgeRuntimeLoggerProviderImpl.java
Modified:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/ThreadedWorkingMemoryFileLogger.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persistence/session/StatefulSessionSnapshotter.java
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/DecisionTableLauncherSample.java.template
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/RuleFlowLauncherSample.java.template
labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/RuleLauncherSample.java.template
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-1879: Add audit logging to drools-api
- added audit loggers factory + implementation
JBRULES-1878: Update IDE to new API
- updated projects wizards to new API
Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeLog.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeLog.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeLog.java 2008-12-01 23:36:09 UTC (rev 24188)
@@ -0,0 +1,5 @@
+package org.drools.logger;
+
+public interface KnowledgeLog {
+
+}
Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLogger.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLogger.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLogger.java 2008-12-01 23:36:09 UTC (rev 24188)
@@ -0,0 +1,15 @@
+package org.drools.logger;
+
+/**
+ * A logger for audit events.
+ */
+public interface KnowledgeRuntimeLogger {
+
+ /**
+ * Release any resources allocated within the logger such as file
+ * handles, network connections, etc.
+ * It is a programming error to append to a closed appender.
+ */
+ public void close();
+
+}
Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLoggerFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLoggerFactory.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLoggerFactory.java 2008-12-01 23:36:09 UTC (rev 24188)
@@ -0,0 +1,47 @@
+package org.drools.logger;
+
+import org.drools.ProviderInitializationException;
+import org.drools.event.KnowledgeRuntimeEventManager;
+
+public class KnowledgeRuntimeLoggerFactory {
+
+ private static KnowledgeRuntimeLoggerProvider knowledgeRuntimeLoggerProvider;
+
+ public static KnowledgeRuntimeLogger newFileLogger(KnowledgeRuntimeEventManager session, String fileName) {
+ return getKnowledgeRuntimeLoggerProvider().newFileLogger(session, fileName);
+ }
+
+ public static KnowledgeRuntimeLogger newThreadedFileLogger(
+ KnowledgeRuntimeEventManager session, String fileName, int interval) {
+ return getKnowledgeRuntimeLoggerProvider().newThreadedFileLogger(session, fileName, interval);
+ }
+
+ public static KnowledgeRuntimeLogger newConsoleLogger(KnowledgeRuntimeEventManager session) {
+ return getKnowledgeRuntimeLoggerProvider().newConsoleLogger(session);
+ }
+
+ private static synchronized void setKnowledgeRuntimeLoggerProvider(
+ KnowledgeRuntimeLoggerProvider provider) {
+ KnowledgeRuntimeLoggerFactory.knowledgeRuntimeLoggerProvider = provider;
+ }
+
+ private static synchronized KnowledgeRuntimeLoggerProvider getKnowledgeRuntimeLoggerProvider() {
+ if (knowledgeRuntimeLoggerProvider == null) {
+ loadProvider();
+ }
+ return knowledgeRuntimeLoggerProvider;
+ }
+
+ @SuppressWarnings("unchecked")
+ private static void loadProvider() {
+ try {
+ Class<KnowledgeRuntimeLoggerProvider> cls = (Class<KnowledgeRuntimeLoggerProvider>)
+ Class.forName("org.drools.audit.KnowledgeRuntimeLoggerProviderImpl");
+ setKnowledgeRuntimeLoggerProvider(cls.newInstance());
+ } catch (Exception e) {
+ throw new ProviderInitializationException(
+ "Provider org.drools.audit.KnowledgeRuntimeLoggerProviderImpl could not be set.", e);
+ }
+ }
+
+}
Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLoggerProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLoggerProvider.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/logger/KnowledgeRuntimeLoggerProvider.java 2008-12-01 23:36:09 UTC (rev 24188)
@@ -0,0 +1,13 @@
+package org.drools.logger;
+
+import org.drools.event.KnowledgeRuntimeEventManager;
+
+public interface KnowledgeRuntimeLoggerProvider {
+
+ KnowledgeRuntimeLogger newFileLogger(KnowledgeRuntimeEventManager session, String fileName);
+
+ KnowledgeRuntimeLogger newThreadedFileLogger(KnowledgeRuntimeEventManager session, String fileName, int interval);
+
+ KnowledgeRuntimeLogger newConsoleLogger(KnowledgeRuntimeEventManager session);
+
+}
Added: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/KnowledgeRuntimeLoggerProviderImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/KnowledgeRuntimeLoggerProviderImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/KnowledgeRuntimeLoggerProviderImpl.java 2008-12-01 23:36:09 UTC (rev 24188)
@@ -0,0 +1,74 @@
+package org.drools.audit;
+
+import org.drools.event.KnowledgeRuntimeEventManager;
+import org.drools.logger.KnowledgeRuntimeLogger;
+import org.drools.logger.KnowledgeRuntimeLoggerProvider;
+
+public class KnowledgeRuntimeLoggerProviderImpl implements KnowledgeRuntimeLoggerProvider {
+
+ public KnowledgeRuntimeLogger newFileLogger(KnowledgeRuntimeEventManager session, String fileName) {
+ WorkingMemoryFileLogger logger = new WorkingMemoryFileLogger(session);
+ if (fileName != null) {
+ logger.setFileName(fileName);
+ }
+ return new KnowledgeRuntimeFileLoggerWrapper(logger);
+ }
+
+ public KnowledgeRuntimeLogger newThreadedFileLogger(KnowledgeRuntimeEventManager session, String fileName, int interval) {
+ ThreadedWorkingMemoryFileLogger logger = new ThreadedWorkingMemoryFileLogger(session);
+ if (fileName != null) {
+ logger.setFileName(fileName);
+ }
+ logger.start(interval);
+ return new KnowledgeRuntimeThreadedFileLoggerWrapper(logger);
+ }
+
+ public KnowledgeRuntimeLogger newConsoleLogger(KnowledgeRuntimeEventManager session) {
+ WorkingMemoryConsoleLogger logger = new WorkingMemoryConsoleLogger(session);
+ return new KnowledgeRuntimeConsoleLoggerWrapper(logger);
+ }
+
+ private class KnowledgeRuntimeFileLoggerWrapper implements KnowledgeRuntimeLogger {
+
+ private WorkingMemoryFileLogger logger;
+
+ public KnowledgeRuntimeFileLoggerWrapper(WorkingMemoryFileLogger logger) {
+ this.logger = logger;
+ }
+
+ public void close() {
+ logger.writeToDisk();
+ }
+
+ }
+
+ private class KnowledgeRuntimeThreadedFileLoggerWrapper implements KnowledgeRuntimeLogger {
+
+ private ThreadedWorkingMemoryFileLogger logger;
+
+ public KnowledgeRuntimeThreadedFileLoggerWrapper(ThreadedWorkingMemoryFileLogger logger) {
+ this.logger = logger;
+ }
+
+ public void close() {
+ logger.stop();
+ logger.writeToDisk();
+ }
+
+ }
+
+ private class KnowledgeRuntimeConsoleLoggerWrapper implements KnowledgeRuntimeLogger {
+
+ // private WorkingMemoryConsoleLogger logger;
+
+ public KnowledgeRuntimeConsoleLoggerWrapper(WorkingMemoryConsoleLogger logger) {
+ // this.logger = logger;
+ }
+
+ public void close() {
+ // Do nothing
+ }
+
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/ThreadedWorkingMemoryFileLogger.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/ThreadedWorkingMemoryFileLogger.java 2008-12-01 18:05:53 UTC (rev 24187)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/audit/ThreadedWorkingMemoryFileLogger.java 2008-12-01 23:36:09 UTC (rev 24188)
@@ -2,7 +2,7 @@
import org.drools.WorkingMemoryEventManager;
import org.drools.audit.event.LogEvent;
-import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.event.KnowledgeRuntimeEventManager;
public class ThreadedWorkingMemoryFileLogger extends WorkingMemoryFileLogger {
@@ -14,7 +14,7 @@
setSplit(false);
}
- public ThreadedWorkingMemoryFileLogger(StatefulKnowledgeSession session) {
+ public ThreadedWorkingMemoryFileLogger(KnowledgeRuntimeEventManager session) {
super( session );
setSplit( false );
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persistence/session/StatefulSessionSnapshotter.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persistence/session/StatefulSessionSnapshotter.java 2008-12-01 18:05:53 UTC (rev 24187)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/persistence/session/StatefulSessionSnapshotter.java 2008-12-01 23:36:09 UTC (rev 24188)
@@ -9,23 +9,37 @@
import org.drools.common.InternalRuleBase;
import org.drools.marshalling.DefaultMarshaller;
import org.drools.marshalling.Marshaller;
+import org.drools.marshalling.PlaceholderResolverStrategyFactory;
import org.drools.persistence.ByteArraySnapshotter;
public class StatefulSessionSnapshotter implements ByteArraySnapshotter<StatefulSession> {
private RuleBase ruleBase;
private StatefulSession session;
- private Marshaller marshaller = new DefaultMarshaller();
+ private Marshaller marshaller;
- public StatefulSessionSnapshotter(RuleBase ruleBase) {
+ private StatefulSessionSnapshotter(StatefulSession session, RuleBase ruleBase, PlaceholderResolverStrategyFactory factory) {
+ this.session = session;
this.ruleBase = ruleBase;
+ this.marshaller = new DefaultMarshaller(null, factory);
}
+ public StatefulSessionSnapshotter(RuleBase ruleBase) {
+ this(null, ruleBase, null);
+ }
+
+ public StatefulSessionSnapshotter(RuleBase ruleBase, PlaceholderResolverStrategyFactory factory) {
+ this(null, ruleBase, factory);
+ }
+
public StatefulSessionSnapshotter(StatefulSession session) {
- this.session = session;
- this.ruleBase = session.getRuleBase();
+ this(session, session.getRuleBase(), null);
}
+ public StatefulSessionSnapshotter(StatefulSession session, PlaceholderResolverStrategyFactory factory) {
+ this(session, session.getRuleBase(), factory);
+ }
+
public byte[] getSnapshot() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/DecisionTableLauncherSample.java.template
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/DecisionTableLauncherSample.java.template 2008-12-01 18:05:53 UTC (rev 24187)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/DecisionTableLauncherSample.java.template 2008-12-01 23:36:09 UTC (rev 24188)
@@ -5,9 +5,13 @@
import org.drools.builder.DecisionTableConfiguration;
import org.drools.builder.DecisionTableInputType;
import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderError;
+import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.KnowledgeType;
-import org.drools.io.impl.ClassPathResource;
+import org.drools.io.ResourceFactory;
+import org.drools.logger.KnowledgeRuntimeLogger;
+import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
/**
@@ -20,12 +24,14 @@
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
+ KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// go !
Message message = new Message();
message.setMessage("Hello World");
message.setStatus(Message.HELLO);
ksession.insert(message);
ksession.fireAllRules();
+ logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
@@ -35,13 +41,21 @@
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
DecisionTableConfiguration config = KnowledgeBuilderFactory.newDecisionTableConfiguration();
config.setInputType(DecisionTableInputType.XLS);
- kbuilder.add(new ClassPathResource("Sample.xls"), KnowledgeType.DTABLE, config);
+ kbuilder.add(ResourceFactory.newClassPathResource("Sample.xls"), KnowledgeType.DTABLE, config);
+ KnowledgeBuilderErrors errors = kbuilder.getErrors();
+ if (errors.size() > 0) {
+ for (KnowledgeBuilderError error: errors) {
+ System.err.println(error);
+ }
+ throw new IllegalArgumentException("Could not parse knowledge.");
+ }
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
public static class Message {
+
public static final int HELLO = 0;
public static final int GOODBYE = 1;
@@ -64,6 +78,7 @@
public void setStatus(int status) {
this.status = status;
}
+
}
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/RuleFlowLauncherSample.java.template
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/RuleFlowLauncherSample.java.template 2008-12-01 18:05:53 UTC (rev 24187)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/RuleFlowLauncherSample.java.template 2008-12-01 23:36:09 UTC (rev 24188)
@@ -3,9 +3,13 @@
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderError;
+import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.KnowledgeType;
-import org.drools.io.impl.ClassPathResource;
+import org.drools.io.ResourceFactory;
+import org.drools.logger.KnowledgeRuntimeLogger;
+import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
/**
@@ -18,8 +22,10 @@
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
+ KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// start a new process instance
ksession.startProcess("com.sample.ruleflow");
+ logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
@@ -27,7 +33,14 @@
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- kbuilder.add(new ClassPathResource("ruleflow.rf"), KnowledgeType.DRF);
+ kbuilder.add(ResourceFactory.newClassPathResource("ruleflow.rf"), KnowledgeType.DRF);
+ KnowledgeBuilderErrors errors = kbuilder.getErrors();
+ if (errors.size() > 0) {
+ for (KnowledgeBuilderError error: errors) {
+ System.err.println(error);
+ }
+ throw new IllegalArgumentException("Could not parse knowledge.");
+ }
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
Modified: labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/RuleLauncherSample.java.template
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/RuleLauncherSample.java.template 2008-12-01 18:05:53 UTC (rev 24187)
+++ labs/jbossrules/trunk/drools-eclipse/org.drools.eclipse/src/main/resources/org/drools/eclipse/wizard/project/RuleLauncherSample.java.template 2008-12-01 23:36:09 UTC (rev 24188)
@@ -3,9 +3,13 @@
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderError;
+import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.KnowledgeType;
-import org.drools.io.impl.ClassPathResource;
+import org.drools.io.ResourceFactory;
+import org.drools.logger.KnowledgeRuntimeLogger;
+import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
/**
@@ -18,12 +22,14 @@
// load up the knowledge base
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
+ KnowledgeRuntimeLogger logger = KnowledgeRuntimeLoggerFactory.newFileLogger(ksession, "test");
// go !
Message message = new Message();
message.setMessage("Hello World");
message.setStatus(Message.HELLO);
ksession.insert(message);
ksession.fireAllRules();
+ logger.close();
} catch (Throwable t) {
t.printStackTrace();
}
@@ -31,13 +37,21 @@
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- kbuilder.add(new ClassPathResource("Sample.drl"), KnowledgeType.DRL);
+ kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"), KnowledgeType.DRL);
+ KnowledgeBuilderErrors errors = kbuilder.getErrors();
+ if (errors.size() > 0) {
+ for (KnowledgeBuilderError error: errors) {
+ System.err.println(error);
+ }
+ throw new IllegalArgumentException("Could not parse knowledge.");
+ }
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
return kbase;
}
public static class Message {
+
public static final int HELLO = 0;
public static final int GOODBYE = 1;
@@ -60,6 +74,7 @@
public void setStatus(int status) {
this.status = status;
}
+
}
-}
+}
\ No newline at end of file
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-01 18:05:53 UTC (rev 24187)
+++ labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/JPAPersisterManager.java 2008-12-01 23:36:09 UTC (rev 24188)
@@ -5,15 +5,18 @@
import org.drools.RuleBase;
import org.drools.StatefulSession;
+import org.drools.marshalling.PlaceholderResolverStrategyFactory;
import org.drools.persistence.Persister;
import org.drools.persistence.jpa.JPAPersister;
public class JPAPersisterManager {
private EntityManagerFactory emf;
+ private PlaceholderResolverStrategyFactory factory;
- public JPAPersisterManager() {
+ public JPAPersisterManager(PlaceholderResolverStrategyFactory factory) {
emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
+ this.factory = factory;
}
public void dispose() {
@@ -21,16 +24,16 @@
}
public Persister<StatefulSession> getSessionPersister(StatefulSession session) {
- return new JPAPersister<StatefulSession>(emf, new StatefulSessionSnapshotter(session));
+ return new JPAPersister<StatefulSession>(emf, new StatefulSessionSnapshotter(session, factory));
}
public Persister<StatefulSession> getSessionPersister(RuleBase ruleBase) {
- return new JPAPersister<StatefulSession>(emf, new StatefulSessionSnapshotter(ruleBase.newStatefulSession()));
+ return new JPAPersister<StatefulSession>(emf, new StatefulSessionSnapshotter(ruleBase.newStatefulSession(), factory));
}
public Persister<StatefulSession> getSessionPersister(String uniqueId, RuleBase ruleBase) {
Persister<StatefulSession> persister = new JPAPersister<StatefulSession>(
- emf, new StatefulSessionSnapshotter(ruleBase));
+ emf, new StatefulSessionSnapshotter(ruleBase, factory));
persister.setUniqueId(uniqueId);
persister.load();
return persister;
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-01 18:05:53 UTC (rev 24187)
+++ labs/jbossrules/trunk/drools-process/drools-process-enterprise/src/main/java/org/drools/persistence/session/SingleSessionCommandService.java 2008-12-01 23:36:09 UTC (rev 24188)
@@ -5,6 +5,7 @@
import org.drools.RuleBase;
import org.drools.StatefulSession;
import org.drools.common.InternalWorkingMemory;
+import org.drools.marshalling.PlaceholderResolverStrategyFactory;
import org.drools.persistence.Persister;
import org.drools.persistence.Transaction;
import org.drools.persistence.jpa.JPAPersister;
@@ -19,12 +20,20 @@
private Persister<StatefulSession> persister;
public SingleSessionCommandService(RuleBase ruleBase) {
- persister = new JPAPersisterManager().getSessionPersister(ruleBase);
+ this(ruleBase, (PlaceholderResolverStrategyFactory) null);
+ }
+
+ public SingleSessionCommandService(RuleBase ruleBase, PlaceholderResolverStrategyFactory factory) {
+ persister = new JPAPersisterManager(factory).getSessionPersister(ruleBase);
init();
}
public SingleSessionCommandService(RuleBase ruleBase, String sessionId) {
- persister = new JPAPersisterManager().getSessionPersister(sessionId, ruleBase);
+ this(ruleBase, sessionId, null);
+ }
+
+ public SingleSessionCommandService(RuleBase ruleBase, String sessionId, PlaceholderResolverStrategyFactory factory) {
+ persister = new JPAPersisterManager(factory).getSessionPersister(sessionId, ruleBase);
init();
}
More information about the jboss-svn-commits
mailing list