[jboss-svn-commits] JBL Code SVN: r24511 - in labs/jbossrules/trunk: drools-api/src/main/java/org/drools/runtime/dataloader and 11 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Dec 31 11:27:08 EST 2008
Author: mark.proctor at jboss.com
Date: 2008-12-31 11:27:08 -0500 (Wed, 31 Dec 2008)
New Revision: 24511
Added:
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/Service.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/XStreamPipelineProvider.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointPipelineContext.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointReceiverAdapter.java
labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/.settings/
labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/.settings/org.eclipse.jdt.core.prefs
Removed:
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionPipelineContext.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionReceiverAdapter.java
Modified:
labs/jbossrules/trunk/drools-api/.classpath
labs/jbossrules/trunk/drools-api/pom.xml
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/dataloader/DataLoaderFactory.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/dataloader/DataLoaderProvider.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/CorePipelineProvider.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/PipelineContext.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/PipelineFactory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/agent/impl/KnowledgeAgentImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryEntryPoint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/NamedEntryPoint.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeNotifierImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeScannerImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/DataLoaderProviderImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionDataLoaderImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/pipeline/impl/BasePipelineContext.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/pipeline/impl/CorePipelineProviderImpl.java
labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/pom.xml
labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/src/test/java/org/drools/runtime/pipeline/impl/DroolsJaxbTest.java
labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/pom.xml
labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/src/test/java/org/drools/runtime/pipeline/impl/DroolsSmookStatefulSessionTest.java
Log:
JBRULES-1903 Pipeline support for DataLoaders and Feeders
-Added XStream support
-Added Service support
Modified: labs/jbossrules/trunk/drools-api/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-api/.classpath 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-api/.classpath 2008-12-31 16:27:08 UTC (rev 24511)
@@ -6,8 +6,12 @@
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-digester/commons-digester/1.8/commons-digester-1.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-jexl/commons-jexl/1.1/commons-jexl-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.3/commons-lang-2.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"/>
<classpathentry kind="var" path="M2_REPO/org/freemarker/freemarker/2.3.9/freemarker-2.3.9.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar"/>
@@ -17,11 +21,13 @@
<classpathentry kind="var" path="M2_REPO/org/jmock/jmock/2.5.0.1/jmock-2.5.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/net/sf/jxls/jxls-reader/0.9.6/jxls-reader-0.9.6.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar"/>
<classpathentry kind="var" path="M2_REPO/org/milyn/milyn-commons/1.1/milyn-commons-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/milyn/milyn-smooks-core/1.1/milyn-smooks-core-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/milyn/milyn-smooks-javabean/1.1/milyn-smooks-javabean-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/mvel/mvel/1.3.12-java1.5/mvel-1.3.12-java1.5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/poi/poi/3.0.2-FINAL/poi-3.0.2-FINAL.jar"/>
<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.8.0/xercesImpl-2.8.0.jar"/>
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/2.0.2/xml-apis-2.0.2.jar"/>
<classpathentry kind="var" path="M2_REPO/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar"/>
Modified: labs/jbossrules/trunk/drools-api/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-api/pom.xml 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-api/pom.xml 2008-12-31 16:27:08 UTC (rev 24511)
@@ -32,7 +32,20 @@
<artifactId>milyn-smooks-javabean</artifactId>
<version>1.1</version>
<scope>provided</scope>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.jxls</groupId>
+ <artifactId>jxls-reader</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
<build>
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/dataloader/DataLoaderFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/dataloader/DataLoaderFactory.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/dataloader/DataLoaderFactory.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -12,6 +12,12 @@
Receiver pipeline) {
return getDataLoaderProvider().newStatefulKnowledgeSessionDataLoader( ksession, pipeline );
}
+
+ public static StatefulKnowledgeSessionDataLoader newStatefulKnowledgeSessionDataLoader(StatefulKnowledgeSession ksession,
+ String entryPointName,
+ Receiver pipeline) {
+ return getDataLoaderProvider().newStatefulKnowledgeSessionDataLoader( ksession, entryPointName, pipeline );
+ }
public static StatelessKnowledgeSessionDataLoader newStatelessKnowledgeSessionDataLoader(StatelessKnowledgeSession ksession,
Receiver pipeline) {
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/dataloader/DataLoaderProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/dataloader/DataLoaderProvider.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/dataloader/DataLoaderProvider.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -8,6 +8,10 @@
StatefulKnowledgeSessionDataLoader newStatefulKnowledgeSessionDataLoader(StatefulKnowledgeSession ksession,
Receiver pipeline);
+ StatefulKnowledgeSessionDataLoader newStatefulKnowledgeSessionDataLoader(StatefulKnowledgeSession ksession,
+ String entryPointName,
+ Receiver pipeline);
+
StatelessKnowledgeSessionDataLoader newStatelessKnowledgeSessionDataLoader(StatelessKnowledgeSession ksession,
Receiver pipeline);
}
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/CorePipelineProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/CorePipelineProvider.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/CorePipelineProvider.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -5,7 +5,7 @@
public Splitter newIterateSplitter();
- public Adapter newStatefulKnowledgeSessionReceiverAdapter();
+ public Adapter newEntryPointReceiverAdapter();
public Adapter newStatelessKnowledgeSessionReceiverAdapter();
}
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/PipelineContext.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/PipelineContext.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/PipelineContext.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -1,5 +1,9 @@
package org.drools.runtime.pipeline;
+import java.util.Map;
+
public interface PipelineContext {
ClassLoader getClassLoader();
+
+ public Map<String, Object> getProperties();
}
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/PipelineFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/PipelineFactory.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/PipelineFactory.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -39,8 +39,8 @@
return getCorePipelineProvider().newIterateSplitter();
}
- public static Adapter newStatefulKnowledgeSessionReceiverAdapter() {
- return getCorePipelineProvider().newStatefulKnowledgeSessionReceiverAdapter();
+ public static Adapter newEntryPointReceiverAdapter() {
+ return getCorePipelineProvider().newEntryPointReceiverAdapter();
}
public static Adapter newStatelessKnowledgeSessionReceiverAdapter() {
Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/Service.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/Service.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/Service.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -0,0 +1,6 @@
+package org.drools.runtime.pipeline;
+
+public interface Service {
+ void start();
+ void stop();
+}
Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/XStreamPipelineProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/XStreamPipelineProvider.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/pipeline/XStreamPipelineProvider.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -0,0 +1,7 @@
+package org.drools.runtime.pipeline;
+
+import com.thoughtworks.xstream.XStream;
+
+public interface XStreamPipelineProvider {
+ Transformer newXStreamTransformer(XStream xstream);
+}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/agent/impl/KnowledgeAgentImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/agent/impl/KnowledgeAgentImpl.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/agent/impl/KnowledgeAgentImpl.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -434,6 +434,7 @@
} else {
// this will stop the thread
this.changeSetNotificationDetector.monitor = false;
+ this.thread.interrupt();
}
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryEntryPoint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryEntryPoint.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryEntryPoint.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -1,7 +1,9 @@
package org.drools.common;
+import org.drools.RuleBase;
import org.drools.WorkingMemoryEntryPoint;
public interface InternalWorkingMemoryEntryPoint extends WorkingMemoryEntryPoint {
ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry();
+ RuleBase getRuleBase();
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/NamedEntryPoint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/NamedEntryPoint.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/NamedEntryPoint.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -8,6 +8,7 @@
import java.util.concurrent.locks.ReentrantLock;
import org.drools.FactException;
+import org.drools.RuleBase;
import org.drools.RuntimeDroolsException;
import org.drools.WorkingMemoryEntryPoint;
import org.drools.RuleBaseConfiguration.AssertBehaviour;
@@ -477,4 +478,8 @@
return this.typeConfReg;
}
+ public RuleBase getRuleBase() {
+ return this.ruleBase;
+ }
+
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeNotifierImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeNotifierImpl.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeNotifierImpl.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -206,13 +206,14 @@
if ( !this.processChangeSet.isRunning() ) {
this.processChangeSet.setNotify( true );
- thread = new Thread( this.processChangeSet );
- thread.start();
+ this.thread = new Thread( this.processChangeSet );
+ this.thread.start();
}
}
public void stop() {
-
+ this.processChangeSet.setNotify( false );
+ this.thread.notify();
}
private Thread thread;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeScannerImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeScannerImpl.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeScannerImpl.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -208,9 +208,7 @@
public void stop() {
this.scannerScheduler.setScan( false );
- synchronized ( this.resources ) {
- this.resources.notify(); // notify wait, so that it will wait again
- }
+ this.thread.interrupt();
}
public void reset() {
@@ -255,15 +253,18 @@
}
public void run() {
- synchronized ( this.resources ) {
+ synchronized ( this ) {
if ( this.scan ) {
this.listener.info( "ResourceChangeNotification scanner has started" );
}
while ( this.scan ) {
- this.scanner.scan();
+ synchronized ( this.resources ) {
+ // lock the resources, as we don't want this modified while processing
+ this.scanner.scan();
+ }
try {
this.listener.debug( "ResourceChangeNotification scanner thread is waiting for " + ( this.interval / 1000 ) );
- this.resources.wait( this.interval );
+ wait( this.interval );
} catch ( InterruptedException e ) {
this.listener.exception( new RuntimeException( "ResourceChangeNotification ChangeSet scanning thread was interrupted",
e ) );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/DataLoaderProviderImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/DataLoaderProviderImpl.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/DataLoaderProviderImpl.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -10,12 +10,18 @@
public class DataLoaderProviderImpl
implements
DataLoaderProvider {
-
+
public StatefulKnowledgeSessionDataLoader newStatefulKnowledgeSessionDataLoader(StatefulKnowledgeSession ksession,
Receiver pipeline) {
return new StatefulKnowledgeSessionDataLoaderImpl(ksession, pipeline);
+ }
+
+ public StatefulKnowledgeSessionDataLoader newStatefulKnowledgeSessionDataLoader(StatefulKnowledgeSession ksession,
+ String entryPointName,
+ Receiver pipeline) {
+ return new StatefulKnowledgeSessionDataLoaderImpl(ksession, entryPointName, pipeline);
}
-
+
public StatelessKnowledgeSessionDataLoader newStatelessKnowledgeSessionDataLoader(StatelessKnowledgeSession ksession,
Receiver pipeline) {
return newStatelessKnowledgeSessionDataLoader(ksession, pipeline);
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointPipelineContext.java (from rev 24491, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionPipelineContext.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointPipelineContext.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointPipelineContext.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -0,0 +1,38 @@
+/**
+ *
+ */
+package org.drools.runtime.dataloader.impl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.common.InternalRuleBase;
+import org.drools.common.InternalWorkingMemoryEntryPoint;
+import org.drools.impl.KnowledgeBaseImpl;
+import org.drools.impl.StatefulKnowledgeSessionImpl;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.runtime.pipeline.PipelineContext;
+import org.drools.runtime.pipeline.impl.BasePipelineContext;
+import org.drools.runtime.rule.FactHandle;
+import org.drools.runtime.rule.WorkingMemoryEntryPoint;
+
+public class EntryPointPipelineContext extends BasePipelineContext
+ implements
+ PipelineContext {
+ private Map handles;
+ private WorkingMemoryEntryPoint entryPoint;
+
+ public EntryPointPipelineContext(WorkingMemoryEntryPoint entryPoint) {
+ super( ((InternalRuleBase)((InternalWorkingMemoryEntryPoint)entryPoint).getRuleBase()).getRootClassLoader() );
+ this.handles = new HashMap<FactHandle, Object>();
+ this.entryPoint = entryPoint;
+ }
+
+ public Map getHandles() {
+ return handles;
+ }
+
+ public WorkingMemoryEntryPoint getEntryPoint() {
+ return entryPoint;
+ }
+}
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointPipelineContext.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointReceiverAdapter.java (from rev 24496, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionReceiverAdapter.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointReceiverAdapter.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointReceiverAdapter.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -0,0 +1,23 @@
+/**
+ *
+ */
+package org.drools.runtime.dataloader.impl;
+
+import org.drools.runtime.pipeline.Adapter;
+import org.drools.runtime.pipeline.PipelineContext;
+import org.drools.runtime.pipeline.impl.BaseStage;
+import org.drools.runtime.rule.FactHandle;
+
+public class EntryPointReceiverAdapter extends BaseStage
+ implements
+ Adapter {
+ public void signal(Object object,
+ PipelineContext context) {
+ EntryPointPipelineContext pContext = (EntryPointPipelineContext) context;
+
+ FactHandle handle = ((pContext).getEntryPoint()).insert( object );
+ ((pContext).getHandles()).put( handle,
+ object );
+ }
+
+}
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/EntryPointReceiverAdapter.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionDataLoaderImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionDataLoaderImpl.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionDataLoaderImpl.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -1,31 +1,42 @@
package org.drools.runtime.dataloader.impl;
-import java.util.Collection;
import java.util.Map;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.dataloader.StatefulKnowledgeSessionDataLoader;
-import org.drools.runtime.pipeline.Emitter;
import org.drools.runtime.pipeline.Receiver;
+import org.drools.runtime.rule.WorkingMemoryEntryPoint;
public class StatefulKnowledgeSessionDataLoaderImpl
implements
StatefulKnowledgeSessionDataLoader {
private StatefulKnowledgeSession ksession;
+ private String entryPointName;
+ private WorkingMemoryEntryPoint entryPoint;
private Receiver pipeline;
public StatefulKnowledgeSessionDataLoaderImpl(StatefulKnowledgeSession ksession,
+ String entryPointName,
Receiver pipeline) {
this.ksession = ksession;
+ this.entryPointName = entryPointName;
+ this.entryPoint = ksession.getWorkingMemoryEntryPoint( this.entryPointName );
this.pipeline = pipeline;
}
+ public StatefulKnowledgeSessionDataLoaderImpl(StatefulKnowledgeSession ksession,
+ Receiver pipeline) {
+ this.ksession = ksession;
+ this.entryPoint = ksession;
+ this.pipeline = pipeline;
+ }
+
/* (non-Javadoc)
* @see org.drools.dataloaders.smooks.StatefulKnowledgeSessionDataLoader#insert(java.lang.Object)
*/
public Map insert(Object object) {
- StatefulKnowledgeSessionPipelineContext context = new StatefulKnowledgeSessionPipelineContext( this.ksession );
+ EntryPointPipelineContext context = new EntryPointPipelineContext( this.entryPoint );
this.pipeline.signal( object,
context );
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionPipelineContext.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionPipelineContext.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionPipelineContext.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -1,36 +0,0 @@
-/**
- *
- */
-package org.drools.runtime.dataloader.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.drools.common.InternalRuleBase;
-import org.drools.impl.KnowledgeBaseImpl;
-import org.drools.impl.StatefulKnowledgeSessionImpl;
-import org.drools.runtime.StatefulKnowledgeSession;
-import org.drools.runtime.pipeline.PipelineContext;
-import org.drools.runtime.pipeline.impl.BasePipelineContext;
-import org.drools.runtime.rule.FactHandle;
-
-public class StatefulKnowledgeSessionPipelineContext extends BasePipelineContext
- implements
- PipelineContext {
- private Map handles;
- private StatefulKnowledgeSession ksession;
-
- public StatefulKnowledgeSessionPipelineContext(StatefulKnowledgeSession ksession) {
- super( ((InternalRuleBase)((KnowledgeBaseImpl)((StatefulKnowledgeSessionImpl)ksession).getKnowledgeBase()).getRuleBase()).getRootClassLoader() );
- this.handles = new HashMap<FactHandle, Object>();
- this.ksession = ksession;
- }
-
- public Map getHandles() {
- return handles;
- }
-
- public StatefulKnowledgeSession getKsession() {
- return ksession;
- }
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionReceiverAdapter.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionReceiverAdapter.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/dataloader/impl/StatefulKnowledgeSessionReceiverAdapter.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -1,23 +0,0 @@
-/**
- *
- */
-package org.drools.runtime.dataloader.impl;
-
-import org.drools.runtime.pipeline.Adapter;
-import org.drools.runtime.pipeline.PipelineContext;
-import org.drools.runtime.pipeline.impl.BaseStage;
-import org.drools.runtime.rule.FactHandle;
-
-public class StatefulKnowledgeSessionReceiverAdapter extends BaseStage
- implements
- Adapter {
- public void signal(Object object,
- PipelineContext context) {
- StatefulKnowledgeSessionPipelineContext pContext = (StatefulKnowledgeSessionPipelineContext) context;
-
- FactHandle handle = ((pContext).getKsession()).insert( object );
- ((pContext).getHandles()).put( handle,
- object );
- }
-
-}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/pipeline/impl/BasePipelineContext.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/pipeline/impl/BasePipelineContext.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/pipeline/impl/BasePipelineContext.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -1,15 +1,25 @@
package org.drools.runtime.pipeline.impl;
+import java.util.HashMap;
+import java.util.Map;
+
import org.drools.runtime.pipeline.PipelineContext;
public class BasePipelineContext implements PipelineContext {
- private ClassLoader rootClassLoader;
+ private ClassLoader classLoader;
+ private Map<String, Object> properties;
- public BasePipelineContext(ClassLoader rootClassLoader) {
- this.rootClassLoader = rootClassLoader;
+ public BasePipelineContext(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ this.properties = new HashMap<String, Object>();
}
public ClassLoader getClassLoader() {
- return this.rootClassLoader;
+ return this.classLoader;
}
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/pipeline/impl/CorePipelineProviderImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/pipeline/impl/CorePipelineProviderImpl.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/runtime/pipeline/impl/CorePipelineProviderImpl.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -1,6 +1,6 @@
package org.drools.runtime.pipeline.impl;
-import org.drools.runtime.dataloader.impl.StatefulKnowledgeSessionReceiverAdapter;
+import org.drools.runtime.dataloader.impl.EntryPointReceiverAdapter;
import org.drools.runtime.dataloader.impl.StatelessKnowledgeSessionReceiverAdapter;
import org.drools.runtime.pipeline.Adapter;
import org.drools.runtime.pipeline.CorePipelineProvider;
@@ -16,8 +16,8 @@
return new IterateSplitter();
}
- public Adapter newStatefulKnowledgeSessionReceiverAdapter() {
- return new StatefulKnowledgeSessionReceiverAdapter();
+ public Adapter newEntryPointReceiverAdapter() {
+ return new EntryPointReceiverAdapter();
}
public Adapter newStatelessKnowledgeSessionReceiverAdapter() {
Added: labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/.settings/org.eclipse.jdt.core.prefs 2008-12-31 16:27:08 UTC (rev 24511)
@@ -0,0 +1,5 @@
+#Tue Dec 23 20:50:15 GMT 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Modified: labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/pom.xml 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/pom.xml 2008-12-31 16:27:08 UTC (rev 24511)
@@ -10,7 +10,7 @@
<artifactId>drools-transformer-jaxb</artifactId>
<packaging>jar</packaging>
- <name>Drools :: Transformer :: JAXB</name>
+ <name>Drools :: Pipeline :: Transformer :: JAXB</name>
<dependencies>
<dependency>
Modified: labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/src/test/java/org/drools/runtime/pipeline/impl/DroolsJaxbTest.java
===================================================================
--- labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/src/test/java/org/drools/runtime/pipeline/impl/DroolsJaxbTest.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-pipeline/drools-transformer-jaxb/src/test/java/org/drools/runtime/pipeline/impl/DroolsJaxbTest.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -101,7 +101,7 @@
kbase );
Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller();
Transformer transformer = PipelineFactory.newJaxbTransformer( unmarshaller );
- transformer.addReceiver( PipelineFactory.newStatefulKnowledgeSessionReceiverAdapter() );
+ transformer.addReceiver( PipelineFactory.newEntryPointReceiverAdapter() );
StatefulKnowledgeSessionDataLoader dataLoader = new StatefulKnowledgeSessionDataLoaderImpl( ksession,
transformer );
@@ -154,7 +154,7 @@
transformer.addReceiver( expression );
Splitter splitter = PipelineFactory.newIterateSplitter();
expression.addReceiver( splitter );
- splitter.addReceiver( PipelineFactory.newStatefulKnowledgeSessionReceiverAdapter() );
+ splitter.addReceiver( PipelineFactory.newEntryPointReceiverAdapter() );
StatefulKnowledgeSessionDataLoader dataLoader = new StatefulKnowledgeSessionDataLoaderImpl( ksession,
transformer );
Map<FactHandle, Object> handles = dataLoader.insert( new StreamSource( getClass().getResourceAsStream( "order.xml" ) ) );
Modified: labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/pom.xml 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/pom.xml 2008-12-31 16:27:08 UTC (rev 24511)
@@ -10,7 +10,7 @@
<artifactId>drools-transformer-smooks</artifactId>
<packaging>jar</packaging>
- <name>Drools :: Transformer :: Smooks</name>
+ <name>Drools :: Pipeline :: Transformer :: Smooks</name>
<dependencies>
<dependency>
Modified: labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/src/test/java/org/drools/runtime/pipeline/impl/DroolsSmookStatefulSessionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/src/test/java/org/drools/runtime/pipeline/impl/DroolsSmookStatefulSessionTest.java 2008-12-31 13:57:23 UTC (rev 24510)
+++ labs/jbossrules/trunk/drools-pipeline/drools-transformer-smooks/src/test/java/org/drools/runtime/pipeline/impl/DroolsSmookStatefulSessionTest.java 2008-12-31 16:27:08 UTC (rev 24511)
@@ -20,7 +20,7 @@
import org.drools.runtime.dataloader.DataLoaderFactory;
import org.drools.runtime.dataloader.StatefulKnowledgeSessionDataLoader;
import org.drools.runtime.dataloader.impl.StatefulKnowledgeSessionDataLoaderImpl;
-import org.drools.runtime.dataloader.impl.StatefulKnowledgeSessionReceiverAdapter;
+import org.drools.runtime.dataloader.impl.EntryPointReceiverAdapter;
import org.drools.runtime.pipeline.Expression;
import org.drools.runtime.pipeline.PipelineFactory;
import org.drools.runtime.pipeline.Splitter;
@@ -55,7 +55,7 @@
Smooks smooks = new Smooks( getClass().getResourceAsStream( "smooks-config.xml" ) );
Transformer transformer = PipelineFactory.newSmooksTransformer( smooks, "orderItem" );
- transformer.addReceiver( PipelineFactory.newStatefulKnowledgeSessionReceiverAdapter() );
+ transformer.addReceiver( PipelineFactory.newEntryPointReceiverAdapter() );
StatefulKnowledgeSessionDataLoader dataLoader = DataLoaderFactory.newStatefulKnowledgeSessionDataLoader( ksession,
transformer );
@@ -96,7 +96,7 @@
transformer.addReceiver( expression );
Splitter splitter = PipelineFactory.newIterateSplitter();
expression.addReceiver( splitter );
- splitter.addReceiver( PipelineFactory.newStatefulKnowledgeSessionReceiverAdapter() );
+ splitter.addReceiver( PipelineFactory.newEntryPointReceiverAdapter() );
StatefulKnowledgeSessionDataLoader dataLoader = DataLoaderFactory.newStatefulKnowledgeSessionDataLoader( ksession,
transformer );
More information about the jboss-svn-commits
mailing list