[jboss-svn-commits] JBL Code SVN: r24245 - in labs/jbossrules/trunk: drools-api/src/main/java/org/drools/builder and 22 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Dec 5 04:57:54 EST 2008
Author: mark.proctor at jboss.com
Date: 2008-12-05 04:57:53 -0500 (Fri, 05 Dec 2008)
New Revision: 24245
Added:
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/ChangeSet.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ChangeSetSemanticModule.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlChangeSetReader.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/AddHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ChangeSetHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ModifyHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/RemoveHandler.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/ChangeSetTest.java
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.drl
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset2Test.drl
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ChangeSetImpl.java
labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/ChangeSetTest.java
labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.drl
labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.xml
labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset2Test.drl
Removed:
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseChangeSet.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/CompositionSemanticModule.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlCompositionReader.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/CompositionHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/composition/
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/CompositionTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/composition/
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/composition1Test.drl
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/composition1Test.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/composition2Test.drl
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/composition/
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/KnowledgeBaseChangeSetImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/KnowledgeComposition.java
labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/CompositionTest.java
labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.drl
labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.xml
labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition2Test.drl
Modified:
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderFactory.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderProvider.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeType.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/event/io/ResourceChangeListener.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/io/Resource.java
labs/jbossrules/trunk/drools-api/src/main/java/org/drools/io/ResourceChangeNotifier.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/builder/impl/KnowledgeBuilderProviderImpl.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ExtensibleXmlParser.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessSemanticModule.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/RulesSemanticModule.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlDumper.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcessDumper.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/DecisionTableConfigurationHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ResourceHandler.java
labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-4.0.xsd
labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-processes-4.0.xsd
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/api/KnowledgeBuilderTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessActionTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessEventTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessExceptionHandlerTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessHumanTaskTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessMarchallingTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessStartTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessTimerTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessUpgradeTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessWorkItemTest.java
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/SubProcessTest.java
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ProcessMultithreadEvent.rf
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlDslTest.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlTest.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseAccumulate.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseCollect.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseComplex.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseExists.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseForall.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseFrom.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseFunction.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseGlobal.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseImport.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseLhs.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParsePackageName.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseQuery.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseRhs.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseRule.xml
labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_RoundTrip.xml
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/agent/impl/KnowledgeAgentImpl.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/InternalResource.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/BaseResource.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ClassPathResource.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/EncodedResource.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/FileSystemResource.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/io/impl/UrlResource.java
Log:
JBRULES-1885 Update KnowledgeAgent to use new Resource api
JBRULES-1874 Create Resource Framework
JBRULES-1875 Load Composition XML files for multiple resources
-This one is now called ChangeSets
Copied: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/ChangeSet.java (from rev 24233, labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseChangeSet.java)
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/ChangeSet.java (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/ChangeSet.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,19 @@
+package org.drools;
+
+import java.util.Collection;
+
+import org.drools.definition.KnowledgeDefinition;
+import org.drools.io.Resource;
+
+public interface ChangeSet {
+ public Collection<Resource> getResourcesRemoved();
+
+
+ public Collection<Resource> getResourcesAdded();
+
+ public Collection<Resource> getResourcesModified();
+
+
+ //public Collection<KnowledgeDefinition> getKnowledgeDefinitionsRemoved();
+
+}
Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/ChangeSet.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseChangeSet.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseChangeSet.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseChangeSet.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,19 +0,0 @@
-package org.drools;
-
-import java.util.Collection;
-
-import org.drools.definition.KnowledgeDefinition;
-import org.drools.io.Resource;
-
-public interface KnowledgeBaseChangeSet {
- public Collection<Resource> getResourcesRemoved();
-
-
- public Collection<Resource> getResourcesAdded();
-
- public Collection<Resource> getResourcesModified();
-
-
- public Collection<KnowledgeDefinition> getKnowledgeDefinitionsRemoved();
-
-}
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderFactory.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderFactory.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -2,6 +2,7 @@
import java.util.Properties;
+import org.drools.KnowledgeBase;
import org.drools.ProviderInitializationException;
/**
@@ -35,6 +36,14 @@
public static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBuilderConfiguration conf) {
return getKnowledgeBuilderProvider().newKnowledgeBuilder( conf );
}
+
+ public static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase) {
+ return getKnowledgeBuilderProvider().newKnowledgeBuilder( kbase );
+ }
+
+ public static KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase, KnowledgeBuilderConfiguration conf) {
+ return getKnowledgeBuilderProvider().newKnowledgeBuilder( kbase, conf );
+ }
/**
* Create a KnowledgeBuilderConfiguration on which properties can be set.
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderProvider.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderProvider.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -2,6 +2,8 @@
import java.util.Properties;
+import org.drools.KnowledgeBase;
+
/**
* KnowledgeBuilderProvider is used by the KnowledgeBuilderFacotry to "provide" it's concrete implementation.
*
@@ -55,4 +57,9 @@
* The KnowledgeBuilder
*/
KnowledgeBuilder newKnowledgeBuilder(KnowledgeBuilderConfiguration conf);
+
+ public KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase);
+
+ public KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase,
+ KnowledgeBuilderConfiguration conf);
}
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeType.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeType.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeType.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -19,6 +19,9 @@
/** Decision Table */
DTABLE,
- /** Composition */
- COMPOSITION;
+ /** Binary Package */
+ PKG,
+
+ /** ChangeSet */
+ ChangeSet;
}
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/event/io/ResourceChangeListener.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/event/io/ResourceChangeListener.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/event/io/ResourceChangeListener.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -3,8 +3,8 @@
*/
package org.drools.event.io;
-import org.drools.KnowledgeBaseChangeSet;
+import org.drools.ChangeSet;
public interface ResourceChangeListener {
- void resourceChanged(KnowledgeBaseChangeSet changeSet);
+ void resourceChanged(ChangeSet changeSet);
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/io/Resource.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/io/Resource.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/io/Resource.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -10,17 +10,5 @@
InputStream getInputStream() throws IOException;
public Reader getReader() throws IOException;
-
- URL getURL() throws IOException;
-
- boolean hasURL();
-
- boolean isDirectory();
-
- Collection<Resource> listResources();
-
- long getLastModified();
-
- public long getLastRead();
-
+
}
Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/io/ResourceChangeNotifier.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/io/ResourceChangeNotifier.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/io/ResourceChangeNotifier.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -2,7 +2,7 @@
import java.util.Collection;
-import org.drools.KnowledgeBaseChangeSet;
+import org.drools.ChangeSet;
import org.drools.event.io.ResourceChangeListener;
public interface ResourceChangeNotifier {
@@ -20,5 +20,5 @@
Collection<ResourceChangeMonitor> getResourceChangeMonitor();
- public void publishKnowledgeBaseChangeSet(KnowledgeBaseChangeSet changeSet);
+ public void publishKnowledgeBaseChangeSet(ChangeSet changeSet);
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/builder/impl/KnowledgeBuilderProviderImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/builder/impl/KnowledgeBuilderProviderImpl.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/builder/impl/KnowledgeBuilderProviderImpl.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -2,12 +2,14 @@
import java.util.Properties;
+import org.drools.KnowledgeBase;
import org.drools.builder.DecisionTableConfiguration;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderConfiguration;
import org.drools.builder.KnowledgeBuilderProvider;
import org.drools.compiler.PackageBuilder;
import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.impl.KnowledgeBaseImpl;
public class KnowledgeBuilderProviderImpl implements KnowledgeBuilderProvider {
@@ -30,4 +32,13 @@
public KnowledgeBuilder newKnowledgeBuilder(KnowledgeBuilderConfiguration conf) {
return new KnowledgeBuilderImpl( new PackageBuilder( (PackageBuilderConfiguration) conf ) );
}
+
+ public KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase) {
+ return new KnowledgeBuilderImpl( new PackageBuilder( ((KnowledgeBaseImpl) kbase).ruleBase ) );
+ }
+
+ public KnowledgeBuilder newKnowledgeBuilder(KnowledgeBase kbase,
+ KnowledgeBuilderConfiguration conf) {
+ return new KnowledgeBuilderImpl( new PackageBuilder( ((KnowledgeBaseImpl) kbase).ruleBase, (PackageBuilderConfiguration) conf ) );
+ }
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -17,21 +17,28 @@
*/
import java.beans.IntrospectionException;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
+import org.drools.ChangeSet;
+import org.drools.PackageIntegrationException;
import org.drools.RuleBase;
+import org.drools.RuntimeDroolsException;
import org.drools.base.ClassFieldAccessor;
import org.drools.base.ClassFieldAccessorCache;
import org.drools.base.ClassFieldAccessorStore;
@@ -51,7 +58,6 @@
import org.drools.io.InternalResource;
import org.drools.io.Resource;
import org.drools.io.impl.ClassPathResource;
-import org.drools.io.impl.KnowledgeComposition;
import org.drools.io.impl.KnowledgeResource;
import org.drools.io.impl.ReaderResource;
import org.drools.io.impl.UrlResource;
@@ -73,6 +79,8 @@
import org.drools.lang.dsl.DefaultExpander;
import org.drools.reteoo.ReteooRuleBase;
import org.drools.rule.CompositeClassLoader;
+import org.drools.rule.Function;
+import org.drools.rule.ImportDeclaration;
import org.drools.rule.JavaDialectRuntimeData;
import org.drools.rule.Package;
import org.drools.rule.Rule;
@@ -80,7 +88,8 @@
import org.drools.rule.builder.RuleBuildContext;
import org.drools.rule.builder.RuleBuilder;
import org.drools.spi.InternalReadAccessor;
-import org.drools.xml.XmlCompositionReader;
+import org.drools.util.DroolsStreamUtils;
+import org.drools.xml.XmlChangeSetReader;
import org.drools.xml.XmlPackageReader;
import org.xml.sax.SAXException;
@@ -424,7 +433,7 @@
ProcessBuilder processBuilder = new ProcessBuilder( this );
try {
processBuilder.addProcessFromFile( processSource,
- resource );
+ this.resource );
this.results.addAll( processBuilder.getErrors() );
} catch ( Exception e ) {
if ( e instanceof RuntimeException ) {
@@ -478,28 +487,35 @@
addPackageFromDrl( new StringReader( string ) );
break;
}
- case COMPOSITION : {
+ case PKG : {
+ InputStream is = resource.getInputStream();
+ Package pkg = (Package) DroolsStreamUtils.streamIn( is );
+ is.close();
+ addPackage( pkg );
+ break;
+ }
+ case ChangeSet : {
((InternalResource)resource).setKnowledgeType( type );
- XmlCompositionReader reader = new XmlCompositionReader( this.configuration.getSemanticModules() );
- KnowledgeComposition composition = reader.read( resource.getReader() );
- for ( KnowledgeResource kresource : composition.getResources() ) {
- Resource ioresource = null;
- String src = kresource.getSource();
- if ( src.trim().startsWith( "classpath:" ) ) {
- ioresource = new ClassPathResource( src.substring( src.indexOf( ':' ) + 1 ), this.configuration.getClassLoader() );
- } else {
- ioresource = new UrlResource( src );
- }
- ((InternalResource)ioresource).setKnowledgeType( kresource.getType() );
- if ( ioresource.isDirectory() ) {
- this.resourceDirectories.add( ioresource );
- for ( Resource childResource : ioresource.listResources() ) {
- ((InternalResource)childResource).setKnowledgeType( kresource.getType() );
- ((InternalResource)childResource).setFromDirectory( true );
- addKnowledgeResource( childResource, kresource.getType(), kresource.getConfiguration() );
+ XmlChangeSetReader reader = new XmlChangeSetReader( this.configuration.getSemanticModules() );
+ if ( resource instanceof ClassPathResource ) {
+ reader.setClassLoader( ((ClassPathResource )resource).getClassLoader() );
+ } else {
+ reader.setClassLoader( this.configuration.getClassLoader() );
+ }
+ ChangeSet chageSet = reader.read( resource.getReader() );
+ if ( chageSet == null ) {
+ // @TODO should log an error
+ }
+ for ( Resource nestedResource : chageSet.getResourcesAdded() ) {
+ InternalResource iNestedResourceResource = (InternalResource) nestedResource;
+ if ( iNestedResourceResource.isDirectory() ) {
+ this.resourceDirectories.add( iNestedResourceResource );
+ for ( Resource childResource : iNestedResourceResource.listResources() ) {
+ ((InternalResource)childResource).setKnowledgeType( iNestedResourceResource.getKnowledgeType() );
+ addKnowledgeResource( childResource, iNestedResourceResource.getKnowledgeType(), iNestedResourceResource.getConfiguration() );
}
} else {
- addKnowledgeResource( ioresource, kresource.getType(), kresource.getConfiguration() );
+ addKnowledgeResource( iNestedResourceResource, iNestedResourceResource.getKnowledgeType(), iNestedResourceResource.getConfiguration() );
}
}
}
@@ -660,7 +676,128 @@
}
return results;
}
+
+ public synchronized void addPackage(final Package newPkg) {
+ Package pkg = this.pkgRegistryMap.get( newPkg.getName() ).getPackage();
+
+ // // create new base package if it doesn't exist, as we always merge the newPkg into the existing one,
+ // // to isolate the base package from further possible changes to newPkg.
+ // if ( pkg == null ) {
+ // // create a new package, use the same parent classloader as the incoming new package
+ // pkg = new Package( newPkg.getName(),
+ // new MapBackedClassLoader( newPkg.getPackageScopeClassLoader().getParent() ) );
+ // //newPkg.getPackageScopeClassLoader() );
+ // pkgs.put( pkg.getName(),
+ // pkg );
+ // // add the dialect registry composite classloader (which uses the above classloader as it's parent)
+ // this.packageClassLoader.addClassLoader( pkg.getDialectRuntimeRegistry().getClassLoader() );
+ // }
+
+ if ( pkg == null ) {
+ pkg = newPackage( new PackageDescr( newPkg.getName() ) ).getPackage();
+ }
+
+ // first merge anything related to classloader re-wiring
+ pkg.getDialectRuntimeRegistry().merge( newPkg.getDialectRuntimeRegistry(), this.rootClassLoader );
+ if ( newPkg.getFunctions() != null ) {
+ for ( Map.Entry<String, Function> entry : newPkg.getFunctions().entrySet() ) {
+ pkg.addFunction( entry.getValue() );
+ }
+ }
+ pkg.getClassFieldAccessorStore().merge( newPkg.getClassFieldAccessorStore() );
+ pkg.getDialectRuntimeRegistry().onBeforeExecute();
+
+ // we have to do this before the merging, as it does some classloader resolving
+ TypeDeclaration lastType = null;
+ try {
+ // Add the type declarations to the RuleBase
+ if ( newPkg.getTypeDeclarations() != null ) {
+ // add type declarations
+ for ( TypeDeclaration type : newPkg.getTypeDeclarations().values() ) {
+ lastType = type;
+ type.setTypeClass( this.rootClassLoader.loadClass( pkg.getName() + "." + type.getTypeName() ) );
+ }
+ }
+ } catch ( ClassNotFoundException e ) {
+ throw new RuntimeDroolsException( "unable to resolve Type Declaration class '" + lastType.getTypeName()+"'" );
+ }
+
+ // now merge the new package into the existing one
+ mergePackage( pkg,
+ newPkg );
+
+ }
+
+ /**
+ * Merge a new package with an existing package.
+ * Most of the work is done by the concrete implementations,
+ * but this class does some work (including combining imports, compilation data, globals,
+ * and the actual Rule objects into the package).
+ */
+ private void mergePackage(final Package pkg,
+ final Package newPkg) {
+ // Merge imports
+ final Map<String, ImportDeclaration> imports = pkg.getImports();
+ imports.putAll( newPkg.getImports() );
+ pkg.setResourceDirectories( newPkg.getResourceDirectories() );
+
+ String lastType = null;
+ try {
+ // merge globals
+ if ( newPkg.getGlobals() != null && newPkg.getGlobals() != Collections.EMPTY_MAP ) {
+ Map<String, String> globals = pkg.getGlobals();
+ // Add globals
+ for ( final Map.Entry<String, String> entry : newPkg.getGlobals().entrySet() ) {
+ final String identifier = entry.getKey();
+ final String type = entry.getValue();
+ lastType = type;
+ if ( globals.containsKey( identifier ) && !globals.get( identifier ).equals( type ) ) {
+ throw new PackageIntegrationException( pkg );
+ } else {
+ pkg.addGlobal( identifier,
+ this.rootClassLoader.loadClass( type ) );
+ // this isn't a package merge, it's adding to the rulebase, but I've put it here for convienience
+ this.globals.put( identifier,
+ this.rootClassLoader.loadClass( type ) );
+ }
+ }
+ }
+ } catch ( ClassNotFoundException e ) {
+ throw new RuntimeDroolsException( "Unable to resolve class '" + lastType + "'" );
+ }
+
+ // merge the type declarations
+ if ( newPkg.getTypeDeclarations() != null ) {
+ // add type declarations
+ for ( TypeDeclaration type : newPkg.getTypeDeclarations().values() ) {
+ // @TODO should we allow overrides? only if the class is not in use.
+ if ( !pkg.getTypeDeclarations().containsKey( type.getTypeName() ) ) {
+ // add to package list of type declarations
+ pkg.addTypeDeclaration( type );
+ }
+ }
+ }
+
+ final Rule[] newRules = newPkg.getRules();
+ for ( int i = 0; i < newRules.length; i++ ) {
+ final Rule newRule = newRules[i];
+
+ pkg.addRule( newRule );
+ }
+
+ //Merge The Rule Flows
+ if ( newPkg.getRuleFlows() != null ) {
+ final Map flows = newPkg.getRuleFlows();
+ for ( final Iterator iter = flows.values().iterator(); iter.hasNext(); ) {
+ final Process flow = (Process) iter.next();
+ pkg.addProcess( flow );
+ }
+ }
+
+ }
+
+
//
// private void validatePackageName(final PackageDescr packageDescr) {
// if ( (this.pkg == null || this.pkg.getName() == null || this.pkg.getName().equals( "" )) && (packageDescr.getName() == null || "".equals( packageDescr.getName() )) ) {
@@ -789,7 +926,9 @@
}
TypeDeclaration type = new TypeDeclaration( typeDescr.getTypeName() );
- type.setResource( this.resource );
+ if ( ((InternalResource)resource).hasURL() ) {
+ type.setResource( this.resource );
+ }
// is it a regular fact or an event?
String role = typeDescr.getMetaAttribute( TypeDeclaration.Role.ID );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -39,7 +39,7 @@
import org.drools.util.ConfFileUtils;
import org.drools.util.StringUtils;
import org.drools.workflow.core.Node;
-import org.drools.xml.CompositionSemanticModule;
+import org.drools.xml.ChangeSetSemanticModule;
import org.drools.xml.DefaultSemanticModule;
import org.drools.xml.Handler;
import org.drools.xml.ProcessSemanticModule;
@@ -322,7 +322,7 @@
this.semanticModules.addSemanticModule( new ProcessSemanticModule() );
this.semanticModules.addSemanticModule( new RulesSemanticModule() );
- this.semanticModules.addSemanticModule( new CompositionSemanticModule() );
+ this.semanticModules.addSemanticModule( new ChangeSetSemanticModule() );
// split on each space
String locations[] = this.chainedProperties.getProperty( "semanticModules",
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/ProcessBuilder.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -40,6 +40,7 @@
import org.drools.definition.process.NodeContainer;
import org.drools.definition.process.Process;
import org.drools.definition.process.WorkflowProcess;
+import org.drools.io.InternalResource;
import org.drools.io.Resource;
import org.drools.lang.descr.ActionDescr;
import org.drools.lang.descr.ProcessDescr;
@@ -77,8 +78,8 @@
private final List<DroolsError> errors = new ArrayList<DroolsError>();
private Map<String, ProcessValidator> processValidators = new HashMap<String, ProcessValidator>();
private static final String XSL_FROM_4_TO_5 = "/org/drools/xml/processes/RuleFlowFrom4To5.xsl";
- private static final String PROCESS_ELEMENT_WITH_NAMESPACE = "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" + " xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
- + " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n";
+ private static final String PROCESS_ELEMENT_WITH_NAMESPACE = "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" + " xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+ + " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n";
public ProcessBuilder(PackageBuilder packageBuilder) {
this.packageBuilder = packageBuilder;
@@ -91,7 +92,9 @@
}
public void buildProcess(final Process process, Resource resource) {
- ((org.drools.process.core.Process) process).setResource( resource );
+ if ( ((InternalResource)resource).hasURL() ) {
+ ((org.drools.process.core.Process) process).setResource( resource );
+ }
boolean hasErrors = false;
ProcessValidator validator = processValidators.get(((Process)process).getType());
if (validator == null) {
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -32,6 +32,7 @@
import org.drools.compiler.PackageBuilder.RuleInvokerErrorHandler;
import org.drools.compiler.PackageBuilder.SrcErrorHandler;
import org.drools.definition.process.Process;
+import org.drools.io.InternalResource;
import org.drools.io.Resource;
import org.drools.lang.descr.AccumulateDescr;
import org.drools.lang.descr.AndDescr;
@@ -591,7 +592,9 @@
Function function = new Function( functionDescr.getName(),
this.ID );
- function.setResource( resource );
+ if ( ((InternalResource)resource).hasURL() ) {
+ function.setResource( resource );
+ }
this.pkg.addFunction( function );
final String functionSrc = getFunctionBuilder().build( this.pkg,
Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ChangeSetSemanticModule.java (from rev 24227, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/CompositionSemanticModule.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ChangeSetSemanticModule.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ChangeSetSemanticModule.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,37 @@
+/**
+ *
+ */
+package org.drools.xml;
+
+import org.drools.xml.changeset.AddHandler;
+import org.drools.xml.changeset.ChangeSetHandler;
+import org.drools.xml.changeset.DecisionTableConfigurationHandler;
+import org.drools.xml.changeset.ModifyHandler;
+import org.drools.xml.changeset.RemoveHandler;
+import org.drools.xml.changeset.ResourceHandler;
+
+public class ChangeSetSemanticModule extends DefaultSemanticModule implements SemanticModule {
+
+ public ChangeSetSemanticModule() {
+ super( "http://drools.org/drools-5.0/change-set" );
+
+ addHandler( "change-set",
+ new ChangeSetHandler() );
+
+ addHandler( "add",
+ new AddHandler() );
+
+ addHandler( "removed",
+ new RemoveHandler() );
+
+ addHandler( "modified",
+ new ModifyHandler() );
+
+ addHandler( "resource",
+ new ResourceHandler() );
+
+ addHandler( "decisiontable-conf",
+ new DecisionTableConfigurationHandler() );
+ }
+
+}
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ChangeSetSemanticModule.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/CompositionSemanticModule.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/CompositionSemanticModule.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/CompositionSemanticModule.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,25 +0,0 @@
-/**
- *
- */
-package org.drools.xml;
-
-import org.drools.xml.composition.CompositionHandler;
-import org.drools.xml.composition.DecisionTableConfigurationHandler;
-import org.drools.xml.composition.ResourceHandler;
-
-public class CompositionSemanticModule extends DefaultSemanticModule implements SemanticModule {
-
- public CompositionSemanticModule() {
- super( "http://drools.org/drools-4.0/composition" );
-
- addHandler( "composition",
- new CompositionHandler() );
-
- addHandler( "resource",
- new ResourceHandler() );
-
- addHandler( "decisiontable-conf",
- new DecisionTableConfigurationHandler() );
- }
-
-}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ExtensibleXmlParser.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ExtensibleXmlParser.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ExtensibleXmlParser.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -110,6 +110,8 @@
private Document document;
private DocumentFragment docFragment;
+
+ private ClassLoader classLoader;
// ----------------------------------------------------------------------
// Constructors
@@ -262,8 +264,16 @@
public Object getData() {
return this.data;
+ }
+
+ public ClassLoader getClassLoader() {
+ return classLoader;
}
+ public void setClassLoader(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
/**
* @see org.xml.sax.ContentHandler
*/
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessSemanticModule.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessSemanticModule.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/ProcessSemanticModule.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -37,7 +37,7 @@
public class ProcessSemanticModule extends DefaultSemanticModule implements SemanticModule {
public ProcessSemanticModule() {
- super ( "http://drools.org/drools-4.0/process" );
+ super ( "http://drools.org/drools-5.0/process" );
addHandler( "process",
new ProcessHandler() );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/RulesSemanticModule.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/RulesSemanticModule.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/RulesSemanticModule.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -29,7 +29,7 @@
implements
SemanticModule {
public RulesSemanticModule() {
- super( "http://drools.org/drools-4.0" );
+ super( "http://drools.org/drools-5.0" );
addHandler( "package",
new PackageHandler() );
Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlChangeSetReader.java (from rev 24233, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlCompositionReader.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlChangeSetReader.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlChangeSetReader.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,77 @@
+package org.drools.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.parsers.SAXParser;
+
+import org.drools.ChangeSet;
+import org.drools.lang.descr.PackageDescr;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+public class XmlChangeSetReader {
+ private ExtensibleXmlParser parser;
+
+ public XmlChangeSetReader(final SemanticModules modules) {
+ this( modules, null );
+ }
+
+ public XmlChangeSetReader(final SemanticModules modules, final SAXParser parser) {
+ if ( parser == null ) {
+ this.parser = new ExtensibleXmlParser();
+ } else {
+ this.parser = new ExtensibleXmlParser( parser );
+ }
+ this.parser.setSemanticModules( modules );
+ }
+
+ public void setClassLoader(ClassLoader classLoader) {
+ this.parser.setClassLoader( classLoader );
+ }
+
+ public ExtensibleXmlParser getParser() {
+ return this.parser;
+ }
+
+ /**
+ * Read a <code>RuleSet</code> from a <code>Reader</code>.
+ *
+ * @param reader
+ * The reader containing the rule-set.
+ *
+ * @return The rule-set.
+ */
+ public ChangeSet read(final Reader reader) throws SAXException,
+ IOException {
+ return (ChangeSet) this.parser.read( reader );
+ }
+
+ /**
+ * Read a <code>RuleSet</code> from an <code>InputStream</code>.
+ *
+ * @param inputStream
+ * The input-stream containing the rule-set.
+ *
+ * @return The rule-set.
+ */
+ public ChangeSet read(final InputStream inputStream) throws SAXException,
+ IOException {
+ return (ChangeSet) this.parser.read( inputStream );
+ }
+
+ /**
+ * Read a <code>RuleSet</code> from an <code>InputSource</code>.
+ *
+ * @param in
+ * The rule-set input-source.
+ *
+ * @return The rule-set.
+ */
+ public ChangeSet read(final InputSource in) throws SAXException,
+ IOException {
+ return (ChangeSet) this.parser.read( in );
+ }
+}
Property changes on: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlChangeSetReader.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlCompositionReader.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlCompositionReader.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlCompositionReader.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,73 +0,0 @@
-package org.drools.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-
-import javax.xml.parsers.SAXParser;
-
-import org.drools.io.impl.KnowledgeComposition;
-import org.drools.lang.descr.PackageDescr;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-public class XmlCompositionReader {
- private ExtensibleXmlParser parser;
-
- public XmlCompositionReader(final SemanticModules modules) {
- this( modules, null );
- }
-
- public XmlCompositionReader(final SemanticModules modules, final SAXParser parser) {
- if ( parser == null ) {
- this.parser = new ExtensibleXmlParser();
- } else {
- this.parser = new ExtensibleXmlParser( parser );
- }
- this.parser.setSemanticModules( modules );
- }
-
- public ExtensibleXmlParser getParser() {
- return this.parser;
- }
-
- /**
- * Read a <code>RuleSet</code> from a <code>Reader</code>.
- *
- * @param reader
- * The reader containing the rule-set.
- *
- * @return The rule-set.
- */
- public KnowledgeComposition read(final Reader reader) throws SAXException,
- IOException {
- return (KnowledgeComposition) this.parser.read( reader );
- }
-
- /**
- * Read a <code>RuleSet</code> from an <code>InputStream</code>.
- *
- * @param inputStream
- * The input-stream containing the rule-set.
- *
- * @return The rule-set.
- */
- public KnowledgeComposition read(final InputStream inputStream) throws SAXException,
- IOException {
- return (KnowledgeComposition) this.parser.read( inputStream );
- }
-
- /**
- * Read a <code>RuleSet</code> from an <code>InputSource</code>.
- *
- * @param in
- * The rule-set input-source.
- *
- * @return The rule-set.
- */
- public KnowledgeComposition read(final InputSource in) throws SAXException,
- IOException {
- return (KnowledgeComposition) this.parser.read( in );
- }
-}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlDumper.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlDumper.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlDumper.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -221,8 +221,8 @@
public void visitPackageDescr(final PackageDescr packageDescr) {
final String packageName = packageDescr.getName();
- final String xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + XmlDumper.eol + " <package name=\"" + packageName + "\" " + XmlDumper.eol + "\txmlns=\"http://drools.org/drools-4.0\" " + XmlDumper.eol
- + "\txmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\" " + XmlDumper.eol + "\txs:schemaLocation=\"http://drools.org/drools-4.0 drools-4.0.xsd\"> " + XmlDumper.eol;
+ final String xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + XmlDumper.eol + " <package name=\"" + packageName + "\" " + XmlDumper.eol + "\txmlns=\"http://drools.org/drools-5.0\" " + XmlDumper.eol
+ + "\txmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\" " + XmlDumper.eol + "\txs:schemaLocation=\"http://drools.org/drools-5.0 drools-4.0.xsd\"> " + XmlDumper.eol;
appendXmlDump( xmlString );
appendXmlDump( processImportsList( packageDescr.getImports() ) );
appendXmlDump( processGlobalsList( packageDescr.getGlobals() ) );
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcessDumper.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcessDumper.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/XmlRuleFlowProcessDumper.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -7,7 +7,7 @@
private XmlRuleFlowProcessDumper() {
super(
"RuleFlow",
- "http://drools.org/drools-4.0/process",
+ "http://drools.org/drools-5.0/process",
"drools-processes-4.0.xsd",
new ProcessSemanticModule()
);
Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset (from rev 24244, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/composition)
Property changes on: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset
___________________________________________________________________
Name: svn:mergeinfo
+
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/AddHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/AddHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/AddHandler.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,68 @@
+package org.drools.xml.changeset;
+
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.drools.ChangeSet;
+import org.drools.builder.KnowledgeType;
+import org.drools.io.Resource;
+import org.drools.io.impl.ChangeSetImpl;
+import org.drools.io.impl.ClassPathResource;
+import org.drools.io.impl.KnowledgeResource;
+import org.drools.io.impl.UrlResource;
+import org.drools.util.StringUtils;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class AddHandler extends BaseAbstractHandler
+ implements
+ Handler {
+
+ public AddHandler() {
+ if ( (this.validParents == null) && (this.validPeers == null) ) {
+ this.validParents = new HashSet(1);
+ this.validParents.add( ChangeSet.class );
+
+ this.validPeers = new HashSet(2);
+ this.validPeers.add( null );
+ this.validPeers.add( Collection.class );
+
+ this.allowNesting = true;
+ }
+ }
+
+ public Object start(String uri,
+ String localName,
+ Attributes attrs,
+ ExtensibleXmlParser parser) throws SAXException {
+ parser.startElementBuilder( localName,
+ attrs );
+
+ final ChangeSet changeSet = (ChangeSet) parser.getParent();
+
+ return new ArrayList();
+ }
+
+ public Object end(String uri,
+ String localName,
+ ExtensibleXmlParser parser) throws SAXException {
+ final Element element = parser.endElementBuilder();
+
+ final ChangeSetImpl changeSet = (ChangeSetImpl) parser.getParent();
+ final Collection add = ( Collection ) parser.getCurrent();
+ changeSet.setResourcesAdded( add );
+ return add;
+ }
+
+
+ public Class< ? > generateNodeFor() {
+ return Collection.class;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ChangeSetHandler.java (from rev 24233, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/composition/CompositionHandler.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ChangeSetHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ChangeSetHandler.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,55 @@
+package org.drools.xml.changeset;
+
+import java.util.HashSet;
+
+import org.drools.io.impl.ChangeSetImpl;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ChangeSetHandler extends BaseAbstractHandler
+ implements
+ Handler {
+
+ public ChangeSetHandler() {
+ if ( (this.validParents == null) && (this.validPeers == null) ) {
+ this.validParents = new HashSet(1);
+ this.validParents.add(null );
+
+ this.validPeers = new HashSet(1);
+ this.validPeers.add( null );
+
+ this.allowNesting = true;
+ }
+ }
+
+ public Object start(String uri,
+ String localName,
+ Attributes attrs,
+ ExtensibleXmlParser parser) throws SAXException {
+ parser.startElementBuilder( localName,
+ attrs );
+ ChangeSetImpl changeSet = new ChangeSetImpl();
+
+ parser.setData( changeSet );
+
+ return changeSet;
+ }
+
+ public Object end(String uri,
+ String localName,
+ ExtensibleXmlParser parser) throws SAXException {
+ final Element element = parser.endElementBuilder();
+
+ final ChangeSetImpl changeSet = (ChangeSetImpl) parser.getCurrent();
+ return changeSet;
+ }
+
+ public Class< ? > generateNodeFor() {
+ return ChangeSetImpl.class;
+ }
+
+}
Property changes on: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ChangeSetHandler.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/CompositionHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/composition/CompositionHandler.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/CompositionHandler.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,55 +0,0 @@
-package org.drools.xml.composition;
-
-import java.util.HashSet;
-
-import org.drools.io.impl.KnowledgeComposition;
-import org.drools.xml.BaseAbstractHandler;
-import org.drools.xml.ExtensibleXmlParser;
-import org.drools.xml.Handler;
-import org.w3c.dom.Element;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-public class CompositionHandler extends BaseAbstractHandler
- implements
- Handler {
-
- public CompositionHandler() {
- if ( (this.validParents == null) && (this.validPeers == null) ) {
- this.validParents = new HashSet(1);
- this.validParents.add(null );
-
- this.validPeers = new HashSet(1);
- this.validPeers.add( null );
-
- this.allowNesting = true;
- }
- }
-
- public Object start(String uri,
- String localName,
- Attributes attrs,
- ExtensibleXmlParser parser) throws SAXException {
- parser.startElementBuilder( localName,
- attrs );
- KnowledgeComposition composition = new KnowledgeComposition();
-
- parser.setData( composition );
-
- return composition;
- }
-
- public Object end(String uri,
- String localName,
- ExtensibleXmlParser parser) throws SAXException {
- final Element element = parser.endElementBuilder();
-
- final KnowledgeComposition composition = (KnowledgeComposition) parser.getCurrent();
- return composition;
- }
-
- public Class< ? > generateNodeFor() {
- return KnowledgeComposition.class;
- }
-
-}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/DecisionTableConfigurationHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/composition/DecisionTableConfigurationHandler.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/DecisionTableConfigurationHandler.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,4 +1,4 @@
-package org.drools.xml.composition;
+package org.drools.xml.changeset;
import java.util.HashSet;
@@ -6,7 +6,8 @@
import org.drools.builder.DecisionTableInputType;
import org.drools.builder.ResourceConfiguration;
import org.drools.builder.impl.DecisionTableConfigurationImpl;
-import org.drools.io.impl.KnowledgeComposition;
+import org.drools.io.InternalResource;
+import org.drools.io.Resource;
import org.drools.io.impl.KnowledgeResource;
import org.drools.util.StringUtils;
import org.drools.xml.BaseAbstractHandler;
@@ -23,7 +24,7 @@
public DecisionTableConfigurationHandler() {
if ( (this.validParents == null) && (this.validPeers == null) ) {
this.validParents = new HashSet( 1 );
- this.validParents.add( KnowledgeResource.class );
+ this.validParents.add( Resource.class );
this.validPeers = new HashSet( 1 );
this.validPeers.add( null );
@@ -60,9 +61,9 @@
String localName,
ExtensibleXmlParser parser) throws SAXException {
final Element element = parser.endElementBuilder();
- final KnowledgeResource part = (KnowledgeResource) parser.getParent();
+ final InternalResource resource = (InternalResource) parser.getParent();
ResourceConfiguration dtConf = (ResourceConfiguration) parser.getCurrent();
- part.setConfiguration( dtConf );
+ resource.setConfiguration( dtConf );
return dtConf;
}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ModifyHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ModifyHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ModifyHandler.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,68 @@
+package org.drools.xml.changeset;
+
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.drools.ChangeSet;
+import org.drools.builder.KnowledgeType;
+import org.drools.io.Resource;
+import org.drools.io.impl.ChangeSetImpl;
+import org.drools.io.impl.ClassPathResource;
+import org.drools.io.impl.KnowledgeResource;
+import org.drools.io.impl.UrlResource;
+import org.drools.util.StringUtils;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ModifyHandler extends BaseAbstractHandler
+ implements
+ Handler {
+
+ public ModifyHandler() {
+ if ( (this.validParents == null) && (this.validPeers == null) ) {
+ this.validParents = new HashSet(1);
+ this.validParents.add( ChangeSet.class );
+
+ this.validPeers = new HashSet(2);
+ this.validPeers.add( null );
+ this.validPeers.add( Collection.class );
+
+ this.allowNesting = true;
+ }
+ }
+
+ public Object start(String uri,
+ String localName,
+ Attributes attrs,
+ ExtensibleXmlParser parser) throws SAXException {
+ parser.startElementBuilder( localName,
+ attrs );
+
+ final ChangeSet changeSet = (ChangeSet) parser.getParent();
+
+ return new ArrayList();
+ }
+
+ public Object end(String uri,
+ String localName,
+ ExtensibleXmlParser parser) throws SAXException {
+ final Element element = parser.endElementBuilder();
+
+ final ChangeSetImpl changeSet = (ChangeSetImpl) parser.getParent();
+ final Collection modified = ( Collection ) parser.getCurrent();
+ changeSet.setResourcesModified( modified );
+ return modified;
+ }
+
+
+ public Class< ? > generateNodeFor() {
+ return Collection.class;
+ }
+
+}
Added: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/RemoveHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/RemoveHandler.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/RemoveHandler.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,68 @@
+package org.drools.xml.changeset;
+
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.drools.ChangeSet;
+import org.drools.builder.KnowledgeType;
+import org.drools.io.Resource;
+import org.drools.io.impl.ChangeSetImpl;
+import org.drools.io.impl.ClassPathResource;
+import org.drools.io.impl.KnowledgeResource;
+import org.drools.io.impl.UrlResource;
+import org.drools.util.StringUtils;
+import org.drools.xml.BaseAbstractHandler;
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class RemoveHandler extends BaseAbstractHandler
+ implements
+ Handler {
+
+ public RemoveHandler() {
+ if ( (this.validParents == null) && (this.validPeers == null) ) {
+ this.validParents = new HashSet(1);
+ this.validParents.add( ChangeSet.class );
+
+ this.validPeers = new HashSet(2);
+ this.validPeers.add( null );
+ this.validPeers.add( Collection.class );
+
+ this.allowNesting = true;
+ }
+ }
+
+ public Object start(String uri,
+ String localName,
+ Attributes attrs,
+ ExtensibleXmlParser parser) throws SAXException {
+ parser.startElementBuilder( localName,
+ attrs );
+
+ final ChangeSet changeSet = (ChangeSet) parser.getParent();
+
+ return new ArrayList();
+ }
+
+ public Object end(String uri,
+ String localName,
+ ExtensibleXmlParser parser) throws SAXException {
+ final Element element = parser.endElementBuilder();
+
+ final ChangeSetImpl changeSet = (ChangeSetImpl) parser.getParent();
+ final Collection removed = ( Collection ) parser.getCurrent();
+ changeSet.setResourcesRemoved( removed );
+ return removed;
+ }
+
+
+ public Class< ? > generateNodeFor() {
+ return Collection.class;
+ }
+
+}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ResourceHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/composition/ResourceHandler.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/xml/changeset/ResourceHandler.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,15 +1,14 @@
-package org.drools.xml.composition;
+package org.drools.xml.changeset;
-import java.net.URLClassLoader;
+import java.util.Collection;
import java.util.HashSet;
import org.drools.builder.KnowledgeType;
+import org.drools.io.InternalResource;
import org.drools.io.Resource;
import org.drools.io.impl.ClassPathResource;
-import org.drools.io.impl.KnowledgeComposition;
import org.drools.io.impl.KnowledgeResource;
import org.drools.io.impl.UrlResource;
-import org.drools.util.StringUtils;
import org.drools.xml.BaseAbstractHandler;
import org.drools.xml.ExtensibleXmlParser;
import org.drools.xml.Handler;
@@ -24,11 +23,11 @@
public ResourceHandler() {
if ( (this.validParents == null) && (this.validPeers == null) ) {
this.validParents = new HashSet(1);
- this.validParents.add( KnowledgeComposition.class );
+ this.validParents.add( Collection.class );
this.validPeers = new HashSet(2);
this.validPeers.add( null );
- this.validPeers.add( KnowledgeResource.class );
+ this.validPeers.add( Resource.class );
this.allowNesting = true;
}
@@ -41,7 +40,7 @@
parser.startElementBuilder( localName,
attrs );
- final KnowledgeComposition composition = (KnowledgeComposition) parser.getParent();
+ final Collection collection = (Collection) parser.getParent();
String src = attrs.getValue( "source" );
String type = attrs.getValue( "type" );
@@ -55,9 +54,17 @@
"type",
type,
parser );
- KnowledgeResource part = new KnowledgeResource( src, KnowledgeType.valueOf( type ) );
+ InternalResource resource = null;
- return part;
+ if ( src.trim().startsWith( "classpath:" ) ) {
+ resource = new ClassPathResource( src.substring( src.indexOf( ':' ) + 1 ), parser.getClassLoader() );
+ } else {
+ resource = new UrlResource( src );
+ }
+
+ resource.setKnowledgeType( KnowledgeType.valueOf( type ) );
+
+ return resource;
}
public Object end(String uri,
@@ -65,10 +72,10 @@
ExtensibleXmlParser parser) throws SAXException {
final Element element = parser.endElementBuilder();
- final KnowledgeComposition composition = (KnowledgeComposition) parser.getParent();
- final KnowledgeResource part = ( KnowledgeResource ) parser.getCurrent();
- composition.getResources().add( part );
- return part;
+ final Collection collection = (Collection) parser.getParent();
+ final Resource resource = ( Resource ) parser.getCurrent();
+ collection.add( resource );
+ return resource;
}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-4.0.xsd
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-4.0.xsd 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-4.0.xsd 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:drools="http://drools.org/drools-4.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://drools.org/drools-4.0">
+<xs:schema xmlns:drools="http://drools.org/drools-5.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://drools.org/drools-5.0">
<xs:element name="package">
<xs:complexType>
<xs:choice maxOccurs="unbounded" minOccurs="0">
Modified: labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-processes-4.0.xsd
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-processes-4.0.xsd 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools-processes-4.0.xsd 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:drools="http://drools.org/drools-4.0/process" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://drools.org/drools-4.0/process" elementFormDefault="qualified">
+<xs:schema xmlns:drools="http://drools.org/drools-5.0/process" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://drools.org/drools-5.0/process" elementFormDefault="qualified">
<xs:element name="process">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/api/KnowledgeBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/api/KnowledgeBuilderTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/api/KnowledgeBuilderTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -72,7 +72,7 @@
String str = "";
str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
- str += "<process xmlns=\"http://drools.org/drools-4.0/process\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\" xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\" ";
+ str += "<process xmlns=\"http://drools.org/drools-5.0/process\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\" xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\" ";
str += " type=\"RuleFlow\" name=\"flow1\" id=\"0\" package-name=\"org.test1\" >";
str += " <header/>\n";
str += " <nodes><start id=\"1\" name=\"Start\" /><end id=\"2\" name=\"End\" /></nodes>\n";
@@ -82,7 +82,7 @@
str = "";
str += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
- str += "<process xmlns=\"http://drools.org/drools-4.0/process\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\" xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\" ";
+ str += "<process xmlns=\"http://drools.org/drools-5.0/process\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\" xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\" ";
str += " type=\"RuleFlow\" name=\"flow2\" id=\"0\" package-name=\"org.test2\" >";
str += " <header/>\n";
str += " <nodes><start id=\"1\" name=\"Start\" /><end id=\"2\" name=\"End\" /></nodes>\n";
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessActionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessActionTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessActionTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -28,9 +28,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.actions\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -99,9 +99,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.actions\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -172,9 +172,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.actions\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessEventTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessEventTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessEventTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -21,9 +21,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.event\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -74,9 +74,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.event\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -127,9 +127,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.event\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -183,9 +183,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.event\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -236,9 +236,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.event\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -301,9 +301,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.event\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -366,9 +366,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.event\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -431,9 +431,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.event\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessExceptionHandlerTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessExceptionHandlerTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessExceptionHandlerTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -22,9 +22,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.exception\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -61,9 +61,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.exception\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -114,9 +114,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.exception\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -154,9 +154,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.exception\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -231,9 +231,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.exception\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessHumanTaskTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessHumanTaskTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessHumanTaskTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -23,9 +23,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.humantask\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -80,9 +80,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.humantask\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessMarchallingTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessMarchallingTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessMarchallingTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -47,9 +47,9 @@
String process =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"org.test.ruleflow\" package-name=\"org.test\" >\n" +
" <header>\n" +
" </header>\n" +
@@ -93,9 +93,9 @@
public void test2() throws Exception {
String process =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"org.test.ruleflow\" package-name=\"org.test\" >\n" +
" <header>\n" +
" <variables>\n" +
@@ -165,9 +165,9 @@
public void test3() throws Exception {
String process1 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"com.sample.ruleflow\" package-name=\"com.sample\" >\n" +
"\n" +
" <header>\n" +
@@ -284,9 +284,9 @@
String process2 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"com.sample.subflow\" package-name=\"com.sample\" >\n" +
"\n" +
" <header>\n" +
@@ -358,9 +358,9 @@
public void test4() throws Exception {
String process =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"com.sample.ruleflow\" package-name=\"com.sample\" >\n" +
"\n" +
" <header>\n" +
@@ -443,9 +443,9 @@
public void test5() throws Exception {
String process =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"com.sample.ruleflow\" package-name=\"com.sample\" >\n" +
"\n" +
" <header>\n" +
@@ -483,9 +483,9 @@
public void test6() throws Exception {
String process =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"com.sample.ruleflow\" package-name=\"com.sample\" >\n" +
"\n" +
" <header>\n" +
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessStartTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessStartTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessStartTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -22,9 +22,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.start\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -97,9 +97,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.start\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessTimerTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessTimerTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessTimerTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -25,9 +25,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.timer\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -112,9 +112,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.timer\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -175,9 +175,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.timer\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -238,9 +238,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.timer\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
@@ -313,9 +313,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.timer\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessUpgradeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessUpgradeTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessUpgradeTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -36,9 +36,9 @@
String process =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"org.test.ruleflow\" package-name=\"org.test\" >\n" +
" <header>\n" +
" </header>\n" +
@@ -73,9 +73,9 @@
String process2 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"org.test.ruleflow2\" package-name=\"org.test\" >\n" +
" <header>\n" +
" <globals>\n" +
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessWorkItemTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessWorkItemTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/ProcessWorkItemTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -29,9 +29,9 @@
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"org.drools.actions\" package-name=\"org.drools\" version=\"1\" >\n" +
"\n" +
" <header>\n" +
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/SubProcessTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/SubProcessTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/SubProcessTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -100,9 +100,9 @@
PackageBuilder builder = new PackageBuilder();
Reader source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"ruleflow\" id=\"com.sample.ruleflow\" package-name=\"com.sample\" >\n" +
"\n" +
" <header>\n" +
@@ -132,9 +132,9 @@
builder.addRuleFlow(source);
source = new StringReader(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<process xmlns=\"http://drools.org/drools-4.0/process\"\n" +
+ "<process xmlns=\"http://drools.org/drools-5.0/process\"\n" +
" xmlns:xs=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
- " xs:schemaLocation=\"http://drools.org/drools-4.0/process drools-processes-4.0.xsd\"\n" +
+ " xs:schemaLocation=\"http://drools.org/drools-5.0/process drools-processes-4.0.xsd\"\n" +
" type=\"RuleFlow\" name=\"flow\" id=\"com.sample.subflow\" package-name=\"com.sample\" >\n" +
"\n" +
" <header>\n" +
Copied: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset (from rev 24244, labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/composition)
Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/ChangeSetTest.java (from rev 24244, labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/composition/CompositionTest.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/ChangeSetTest.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/ChangeSetTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,340 @@
+package org.drools.xml.changeset;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import junit.framework.TestCase;
+
+import org.drools.ChangeSet;
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.agent.KnowledgeAgent;
+import org.drools.agent.KnowledgeAgentConfiguration;
+import org.drools.agent.KnowledgeAgentFactory;
+import org.drools.agent.impl.KnowledgeAgentConfigurationImpl;
+import org.drools.agent.impl.KnowledgeAgentImpl;
+import org.drools.builder.DecisionTableConfiguration;
+import org.drools.builder.DecisionTableInputType;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.KnowledgeType;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.io.Resource;
+import org.drools.io.ResourceChangeScannerConfiguration;
+import org.drools.io.ResourceFactory;
+import org.drools.io.impl.FileSystemResource;
+import org.drools.io.impl.KnowledgeResource;
+import org.drools.io.impl.ResourceChangeNotifierImpl;
+import org.drools.io.impl.UrlResource;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.xml.XmlChangeSetReader;
+import org.xml.sax.SAXException;
+
+public class ChangeSetTest extends TestCase {
+ public void testXmlParser() throws SAXException,
+ IOException {
+
+ PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
+ XmlChangeSetReader xmlReader = new XmlChangeSetReader( conf.getSemanticModules() );
+
+ String str = "";
+ str += "<change-set ";
+ str += "xmlns='http://drools.org/drools-5.0/change-set' ";
+ str += "xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' ";
+ str += "xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-4.0.xsd' >";
+ str += " <add> ";
+ str += " <resource source='http://www.domain.com/test.drl' type='DRL' />";
+ str += " <resource source='http://www.domain.com/test.xls' type='DTABLE' >";
+ str += " <decisiontable-conf worksheet-name='sheet10' input-type='XLS' />";
+ str += " </resource>";
+ str += " </add> ";
+ str += "</change-set>";
+
+ StringReader reader = new StringReader( str );
+ ChangeSet changeSet = xmlReader.read( reader );
+
+ assertEquals( 2,
+ changeSet.getResourcesAdded().size() );
+ UrlResource resource = ( UrlResource ) ((List)changeSet.getResourcesAdded()).get( 0 );
+ assertNull( resource.getConfiguration() );
+ assertEquals( "http://www.domain.com/test.drl",
+ resource.getURL().toString() );
+ assertEquals( KnowledgeType.DRL,
+ resource.getKnowledgeType() );
+
+ resource = ( UrlResource ) ((List)changeSet.getResourcesAdded()).get( 1 );
+
+ assertEquals( "http://www.domain.com/test.xls",
+ resource.getURL().toString() );
+ assertEquals( KnowledgeType.DTABLE,
+ resource.getKnowledgeType() );
+ DecisionTableConfiguration dtConf = (DecisionTableConfiguration) resource.getConfiguration();
+ assertEquals( DecisionTableInputType.XLS,
+ dtConf.getInputType() );
+ }
+
+ public void testIntegregation() {
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ kbuilder.add( ResourceFactory.newClassPathResource( "changeset1Test.xml",
+ getClass() ),
+ KnowledgeType.ChangeSet );
+ assertFalse( kbuilder.hasErrors() );
+ KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+ kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
+ StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
+ List list = new ArrayList();
+ ksession.setGlobal( "list",
+ list );
+ ksession.fireAllRules();
+ ksession.dispose();
+
+ assertEquals( 2,
+ list.size() );
+ assertTrue( list.containsAll( Arrays.asList( new String[]{"rule1", "rule2"} ) ) );
+ }
+
+ public void testModifyFile() throws IOException,
+ InterruptedException {
+ String rule1 = "";
+ rule1 += "package org.drools.test\n";
+ rule1 += "global java.util.List list\n";
+ rule1 += "rule rule1\n";
+ rule1 += "when\n";
+ rule1 += "then\n";
+ rule1 += "list.add( drools.getRule().getName() );\n";
+ rule1 += "end\n";
+ File f1 = File.createTempFile( "rule1",
+ ".drl" );
+ f1.deleteOnExit();
+ Writer output = new BufferedWriter( new FileWriter( f1 ) );
+ output.write( rule1 );
+ output.close();
+
+ String rule2 = "";
+ rule2 += "package org.drools.test\n";
+ rule2 += "global java.util.List list\n";
+ rule2 += "rule rule2\n";
+ rule2 += "when\n";
+ rule2 += "then\n";
+ rule2 += "list.add( drools.getRule().getName() );\n";
+ rule2 += "end\n";
+ File f2 = File.createTempFile( "rule2",
+ ".drl" );
+ f2.deleteOnExit();
+ output = new BufferedWriter( new FileWriter( f2 ) );
+ output.write( rule2 );
+ output.close();
+
+ String xml = "";
+ xml += "<change-set xmlns='http://drools.org/drools-5.0/change-set'";
+ xml += " xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'";
+ xml += " xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-4.0.xsd' >";
+ xml += " <add> ";
+ xml += " <resource source='" + f1.toURI().toURL() + "' type='DRL' />";
+ xml += " <resource source='" + f2.toURI().toURL() + "' type='DRL' />";
+ xml += " </add> ";
+ xml += "</change-set>";
+ File fxml = File.createTempFile( "changeset",
+ ".xml" );
+ fxml.deleteOnExit();
+ output = new BufferedWriter( new FileWriter( fxml ) );
+ output.write( xml );
+ output.close();
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ kbuilder.add( ResourceFactory.newUrlResource( fxml.toURI().toURL() ),
+ KnowledgeType.ChangeSet );
+ assertFalse( kbuilder.hasErrors() );
+
+ KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+ kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
+
+ ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
+ sconf.setProperty( "drools.resource.scanner.interval",
+ "2" );
+ ResourceFactory.getResourceChangeScannerService().configure( sconf );
+
+ KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
+ aconf.setProperty( "drools.agent.scanResources",
+ "true" );
+ aconf.setProperty( "drools.agent.newInstance",
+ "true" );
+ KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "test agent",
+ kbase,
+ aconf );
+
+ StatefulKnowledgeSession ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
+ List list = new ArrayList();
+ ksession.setGlobal( "list",
+ list );
+ ksession.fireAllRules();
+ ksession.dispose();
+
+ assertEquals( 2,
+ list.size() );
+ assertTrue( list.contains( "rule1" ) );
+ assertTrue( list.contains( "rule2" ) );
+
+ list.clear();
+ rule1 = "";
+ rule1 += "package org.drools.test\n";
+ rule1 += "global java.util.List list\n";
+ rule1 += "rule rule3\n";
+ rule1 += "when\n";
+ rule1 += "then\n";
+ rule1 += "list.add( drools.getRule().getName() );\n";
+ rule1 += "end\n";
+ output = new BufferedWriter( new FileWriter( f1 ) );
+ output.write( rule1 );
+ output.close();
+ Thread.sleep( 3000 );
+
+ ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
+ list = new ArrayList();
+ ksession.setGlobal( "list",
+ list );
+ ksession.fireAllRules();
+ ksession.dispose();
+
+ assertEquals( 2,
+ list.size() );
+ assertTrue( list.contains( "rule3" ) );
+ assertTrue( list.contains( "rule2" ) );
+ }
+
+ public void testModifyDirectory() throws IOException,
+ InterruptedException {
+ File dir = File.createTempFile( UUID.randomUUID().toString(),
+ "" );
+ dir = dir.getParentFile();
+ dir.deleteOnExit();
+
+ dir = new File( dir, UUID.randomUUID().toString() );
+ dir.mkdir();
+ dir.deleteOnExit();
+
+ String rule1 = "";
+ rule1 += "package org.drools.test\n";
+ rule1 += "global java.util.List list\n";
+ rule1 += "rule rule1\n";
+ rule1 += "when\n";
+ rule1 += "then\n";
+ rule1 += "list.add( drools.getRule().getName() );\n";
+ rule1 += "end\n";
+ File f1 = File.createTempFile( "rule1",
+ ".drl",
+ dir );
+ f1.deleteOnExit();
+ Writer output = new BufferedWriter( new FileWriter( f1 ) );
+ output.write( rule1 );
+ output.close();
+
+ String rule2 = "";
+ rule2 += "package org.drools.test\n";
+ rule2 += "global java.util.List list\n";
+ rule2 += "rule rule2\n";
+ rule2 += "when\n";
+ rule2 += "then\n";
+ rule2 += "list.add( drools.getRule().getName() );\n";
+ rule2 += "end\n";
+ File f2 = File.createTempFile( "rule2",
+ ".drl",
+ dir );
+ f2.deleteOnExit();
+ output = new BufferedWriter( new FileWriter( f2 ) );
+ output.write( rule2 );
+ output.close();
+
+ String xml = "";
+ xml += "<change-set xmlns='http://drools.org/drools-5.0/change-set'";
+ xml += " xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'";
+ xml += " xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-5.0.xsd' >";
+ xml += " <add> ";
+ xml += " <resource source='" + f1.getParentFile().toURI().toURL() + "' type='DRL' />";
+ xml += " </add> ";
+ xml += "</change-set>";
+ File fxml = File.createTempFile( "changeset",
+ ".xml" );
+ fxml.deleteOnExit();
+ output = new BufferedWriter( new FileWriter( fxml ) );
+ output.write( xml );
+ output.close();
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ kbuilder.add( ResourceFactory.newUrlResource( fxml.toURI().toURL() ),
+ KnowledgeType.ChangeSet );
+ assertFalse( kbuilder.hasErrors() );
+
+ KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+ kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
+
+ ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
+ sconf.setProperty( "drools.resource.scanner.interval",
+ "2" );
+ ResourceFactory.getResourceChangeScannerService().configure( sconf );
+
+ KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
+ aconf.setProperty( "drools.agent.scanResources",
+ "true" );
+ aconf.setProperty( "drools.agent.newInstance",
+ "true" );
+ KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "test agent",
+ kbase,
+ aconf );
+
+ StatefulKnowledgeSession ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
+ List list = new ArrayList();
+ ksession.setGlobal( "list",
+ list );
+ ksession.fireAllRules();
+ ksession.dispose();
+
+ assertEquals( 2,
+ list.size() );
+ assertTrue( list.contains( "rule1" ) );
+ assertTrue( list.contains( "rule2" ) );
+
+ list.clear();
+ String rule3 = "";
+ rule3 += "package org.drools.test\n";
+ rule3 += "global java.util.List list\n";
+ rule3 += "rule rule3\n";
+ rule3 += "when\n";
+ rule3 += "then\n";
+ rule3 += "list.add( drools.getRule().getName() );\n";
+ rule3 += "end\n";
+ File f3 = File.createTempFile( "rule3",
+ ".drl",
+ dir );
+ f3.deleteOnExit();
+ output = new BufferedWriter( new FileWriter( f3 ) );
+ output.write( rule3 );
+ output.close();
+
+ assertTrue( f1.delete() );
+
+
+ Thread.sleep( 3000 );
+
+ ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
+ list = new ArrayList();
+ ksession.setGlobal( "list",
+ list );
+ ksession.fireAllRules();
+ ksession.dispose();
+
+ assertEquals( 2,
+ list.size() );
+ assertTrue( list.contains( "rule2" ) );
+ assertTrue( list.contains( "rule3" ) );
+ }
+
+}
Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/ChangeSetTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/CompositionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/composition/CompositionTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/xml/changeset/CompositionTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,333 +0,0 @@
-package org.drools.xml.composition;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
-
-import junit.framework.TestCase;
-
-import org.drools.KnowledgeBase;
-import org.drools.KnowledgeBaseFactory;
-import org.drools.agent.KnowledgeAgent;
-import org.drools.agent.KnowledgeAgentConfiguration;
-import org.drools.agent.KnowledgeAgentFactory;
-import org.drools.agent.impl.KnowledgeAgentConfigurationImpl;
-import org.drools.agent.impl.KnowledgeAgentImpl;
-import org.drools.builder.DecisionTableConfiguration;
-import org.drools.builder.DecisionTableInputType;
-import org.drools.builder.KnowledgeBuilder;
-import org.drools.builder.KnowledgeBuilderFactory;
-import org.drools.builder.KnowledgeType;
-import org.drools.compiler.PackageBuilderConfiguration;
-import org.drools.io.Resource;
-import org.drools.io.ResourceChangeScannerConfiguration;
-import org.drools.io.ResourceFactory;
-import org.drools.io.impl.FileSystemResource;
-import org.drools.io.impl.KnowledgeComposition;
-import org.drools.io.impl.KnowledgeResource;
-import org.drools.io.impl.ResourceChangeNotifierImpl;
-import org.drools.io.impl.UrlResource;
-import org.drools.runtime.StatefulKnowledgeSession;
-import org.drools.xml.XmlCompositionReader;
-import org.xml.sax.SAXException;
-
-public class CompositionTest extends TestCase {
- public void testXmlParser() throws SAXException,
- IOException {
-
- PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
- XmlCompositionReader xmlReader = new XmlCompositionReader( conf.getSemanticModules() );
-
- String str = "";
- str += "<composition ";
- str += "xmlns='http://drools.org/drools-4.0/composition' ";
- str += "xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' ";
- str += "xs:schemaLocation='http://drools.org/drools-4.0/composition drools-composition-4.0.xsd' >";
- str += " <resource source='http://www.domain.com/test.drl' type='DRL' />";
- str += " <resource source='http://www.domain.com/test.xls' type='DTABLE' >";
- str += " <decisiontable-conf worksheet-name='sheet10' input-type='XLS' />";
- str += " </resource>";
- str += "</composition>";
-
- StringReader reader = new StringReader( str );
- KnowledgeComposition composition = xmlReader.read( reader );
-
- assertEquals( 2,
- composition.getResources().size() );
- KnowledgeResource resource = composition.getResources().get( 0 );
- assertNull( resource.getConfiguration() );
- assertEquals( "http://www.domain.com/test.drl",
- resource.getSource() );
- assertEquals( KnowledgeType.DRL,
- resource.getType() );
-
- resource = composition.getResources().get( 1 );
- assertEquals( "http://www.domain.com/test.xls",
- resource.getSource() );
- assertEquals( KnowledgeType.DTABLE,
- resource.getType() );
- DecisionTableConfiguration dtConf = (DecisionTableConfiguration) resource.getConfiguration();
- assertEquals( DecisionTableInputType.XLS,
- dtConf.getInputType() );
- }
-
- public void testIntegregation() {
- KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- kbuilder.add( ResourceFactory.newClassPathResource( "composition1Test.xml",
- getClass() ),
- KnowledgeType.COMPOSITION );
- assertFalse( kbuilder.hasErrors() );
- KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
- kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
- StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
- List list = new ArrayList();
- ksession.setGlobal( "list",
- list );
- ksession.fireAllRules();
- ksession.dispose();
-
- assertEquals( 2,
- list.size() );
- assertTrue( list.containsAll( Arrays.asList( new String[]{"rule1", "rule2"} ) ) );
- }
-
- public void testModifyFile() throws IOException,
- InterruptedException {
- String rule1 = "";
- rule1 += "package org.drools.test\n";
- rule1 += "global java.util.List list\n";
- rule1 += "rule rule1\n";
- rule1 += "when\n";
- rule1 += "then\n";
- rule1 += "list.add( drools.getRule().getName() );\n";
- rule1 += "end\n";
- File f1 = File.createTempFile( "rule1",
- ".drl" );
- f1.deleteOnExit();
- Writer output = new BufferedWriter( new FileWriter( f1 ) );
- output.write( rule1 );
- output.close();
-
- String rule2 = "";
- rule2 += "package org.drools.test\n";
- rule2 += "global java.util.List list\n";
- rule2 += "rule rule2\n";
- rule2 += "when\n";
- rule2 += "then\n";
- rule2 += "list.add( drools.getRule().getName() );\n";
- rule2 += "end\n";
- File f2 = File.createTempFile( "rule2",
- ".drl" );
- f2.deleteOnExit();
- output = new BufferedWriter( new FileWriter( f2 ) );
- output.write( rule2 );
- output.close();
-
- String xml = "";
- xml += "<composition xmlns='http://drools.org/drools-4.0/composition'";
- xml += " xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'";
- xml += " xs:schemaLocation='http://drools.org/drools-4.0/composition drools-composition-4.0.xsd' >";
- xml += " <resource source='" + f1.toURI().toURL() + "' type='DRL' />";
- xml += " <resource source='" + f2.toURI().toURL() + "' type='DRL' />";
- xml += "</composition>";
- File fxml = File.createTempFile( "composition",
- ".xml" );
- fxml.deleteOnExit();
- output = new BufferedWriter( new FileWriter( fxml ) );
- output.write( xml );
- output.close();
-
- KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- kbuilder.add( ResourceFactory.newUrlResource( fxml.toURI().toURL() ),
- KnowledgeType.COMPOSITION );
- assertFalse( kbuilder.hasErrors() );
-
- KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
- kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
-
- ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
- sconf.setProperty( "drools.resource.scanner.interval",
- "2" );
- ResourceFactory.getResourceChangeScannerService().configure( sconf );
-
- KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
- aconf.setProperty( "drools.agent.scanResources",
- "true" );
- aconf.setProperty( "drools.agent.newInstance",
- "true" );
- KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "test agent",
- kbase,
- aconf );
-
- StatefulKnowledgeSession ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
- List list = new ArrayList();
- ksession.setGlobal( "list",
- list );
- ksession.fireAllRules();
- ksession.dispose();
-
- assertEquals( 2,
- list.size() );
- assertTrue( list.contains( "rule1" ) );
- assertTrue( list.contains( "rule2" ) );
-
- list.clear();
- rule1 = "";
- rule1 += "package org.drools.test\n";
- rule1 += "global java.util.List list\n";
- rule1 += "rule rule3\n";
- rule1 += "when\n";
- rule1 += "then\n";
- rule1 += "list.add( drools.getRule().getName() );\n";
- rule1 += "end\n";
- output = new BufferedWriter( new FileWriter( f1 ) );
- output.write( rule1 );
- output.close();
- Thread.sleep( 3000 );
-
- ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
- list = new ArrayList();
- ksession.setGlobal( "list",
- list );
- ksession.fireAllRules();
- ksession.dispose();
-
- assertEquals( 2,
- list.size() );
- assertTrue( list.contains( "rule3" ) );
- assertTrue( list.contains( "rule2" ) );
- }
-
- public void testModifyDirectory() throws IOException,
- InterruptedException {
- File dir = File.createTempFile( UUID.randomUUID().toString(),
- "" );
- dir = dir.getParentFile();
- dir.deleteOnExit();
-
- dir = new File( dir, UUID.randomUUID().toString() );
- dir.mkdir();
- dir.deleteOnExit();
-
- String rule1 = "";
- rule1 += "package org.drools.test\n";
- rule1 += "global java.util.List list\n";
- rule1 += "rule rule1\n";
- rule1 += "when\n";
- rule1 += "then\n";
- rule1 += "list.add( drools.getRule().getName() );\n";
- rule1 += "end\n";
- File f1 = File.createTempFile( "rule1",
- ".drl",
- dir );
- f1.deleteOnExit();
- Writer output = new BufferedWriter( new FileWriter( f1 ) );
- output.write( rule1 );
- output.close();
-
- String rule2 = "";
- rule2 += "package org.drools.test\n";
- rule2 += "global java.util.List list\n";
- rule2 += "rule rule2\n";
- rule2 += "when\n";
- rule2 += "then\n";
- rule2 += "list.add( drools.getRule().getName() );\n";
- rule2 += "end\n";
- File f2 = File.createTempFile( "rule2",
- ".drl",
- dir );
- f2.deleteOnExit();
- output = new BufferedWriter( new FileWriter( f2 ) );
- output.write( rule2 );
- output.close();
-
- String xml = "";
- xml += "<composition xmlns='http://drools.org/drools-4.0/composition'";
- xml += " xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'";
- xml += " xs:schemaLocation='http://drools.org/drools-4.0/composition drools-composition-4.0.xsd' >";
- xml += " <resource source='" + f1.getParentFile().toURI().toURL() + "' type='DRL' />";
- xml += "</composition>";
- File fxml = File.createTempFile( "composition",
- ".xml" );
- fxml.deleteOnExit();
- output = new BufferedWriter( new FileWriter( fxml ) );
- output.write( xml );
- output.close();
-
- KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- kbuilder.add( ResourceFactory.newUrlResource( fxml.toURI().toURL() ),
- KnowledgeType.COMPOSITION );
- assertFalse( kbuilder.hasErrors() );
-
- KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
- kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
-
- ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
- sconf.setProperty( "drools.resource.scanner.interval",
- "2" );
- ResourceFactory.getResourceChangeScannerService().configure( sconf );
-
- KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
- aconf.setProperty( "drools.agent.scanResources",
- "true" );
- aconf.setProperty( "drools.agent.newInstance",
- "true" );
- KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "test agent",
- kbase,
- aconf );
-
- StatefulKnowledgeSession ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
- List list = new ArrayList();
- ksession.setGlobal( "list",
- list );
- ksession.fireAllRules();
- ksession.dispose();
-
- assertEquals( 2,
- list.size() );
- assertTrue( list.contains( "rule1" ) );
- assertTrue( list.contains( "rule2" ) );
-
- list.clear();
- String rule3 = "";
- rule3 += "package org.drools.test\n";
- rule3 += "global java.util.List list\n";
- rule3 += "rule rule3\n";
- rule3 += "when\n";
- rule3 += "then\n";
- rule3 += "list.add( drools.getRule().getName() );\n";
- rule3 += "end\n";
- File f3 = File.createTempFile( "rule3",
- ".drl",
- dir );
- f3.deleteOnExit();
- output = new BufferedWriter( new FileWriter( f3 ) );
- output.write( rule3 );
- output.close();
-
- assertTrue( f1.delete() );
-
-
- Thread.sleep( 3000 );
-
- ksession = kagent.getKnowledgeBase().newStatefulKnowledgeSession();
- list = new ArrayList();
- ksession.setGlobal( "list",
- list );
- ksession.fireAllRules();
- ksession.dispose();
-
- assertEquals( 2,
- list.size() );
- assertTrue( list.contains( "rule2" ) );
- assertTrue( list.contains( "rule3" ) );
- }
-
-}
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/empty_ruleflow.rfm 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
type="RuleFlow" name="empty_ruleflow" id="empty_ruleflow" package-name="com.empty" >
<header>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/error_ruleflow.rfm 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
type="RuleFlow" name="empty_ruleflow" id="empty_ruleflow" >
<header>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rfm 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/ruleflow.rfm 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
type="RuleFlow" name="ruleflow" id="0" package-name="com.sample" >
<header>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ActionDialects.rfm 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
type="RuleFlow" name="ActionDialects" id="ActionDialects" package-name="org.drools.test" >
<header>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ConstraintDialects.rfm 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
type="RuleFlow" name="ConstraintDialects" id="ConstraintDialects" package-name="org.drools.test" >
<header>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ProcessMultithreadEvent.rf
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ProcessMultithreadEvent.rf 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ProcessMultithreadEvent.rf 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
type="RuleFlow" name="flow" id="org.drools.integrationtests.multithread" package-name="org.drools.integrationtests" >
<header>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ruleflowClear.rfm 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
type="RuleFlow" name="test_ruleflowClear" id="ruleFlowClear" package-name="com.sample" >
<header>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlDslTest.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlDslTest.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlDslTest.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:mydsl="http://domain/org/mydsl"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
name="process name" id="process name" type="RuleFlow" package-name="org.domain" >
<header>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlTest.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlTest.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/XmlTest.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,6 +1,6 @@
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
name="process name" id="process name" package-name="org.domain" >
<header>
Copied: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset (from rev 24244, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/composition)
Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.drl (from rev 24244, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/composition/composition1Test.drl)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.drl (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.drl 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,9 @@
+package org.drools.test
+
+global java.util.List list;
+
+rule "rule1"
+when
+then
+ list.add( "rule1" );
+end
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.drl
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.xml (from rev 24244, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/composition/composition1Test.xml)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.xml (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,10 @@
+<change-set xmlns='http://drools.org/drools-5.0/change-set'
+ xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
+ xs:schemaLocation='http://drools.org/drools-5.0/composition drools-composition-4.0.xsd' >
+ <add>
+ <resource source='classpath:org/drools/xml/changeset/changeset1Test.drl' type='DRL' />
+ <resource source='classpath:org/drools/xml/changeset/changeset2Test.drl' type='DRL' />
+ </add>
+
+
+</change-set>
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset1Test.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset2Test.drl (from rev 24244, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/composition/composition2Test.drl)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset2Test.drl (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset2Test.drl 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,9 @@
+package org.drools.test
+
+global java.util.List list;
+
+rule "rule2"
+when
+then
+ list.add( "rule2" );
+end
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/changeset2Test.drl
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/composition1Test.drl
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/composition/composition1Test.drl 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/composition1Test.drl 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,9 +0,0 @@
-package org.drools.test
-
-global java.util.List list;
-
-rule "rule1"
-when
-then
- list.add( "rule1" );
-end
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/composition1Test.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/composition/composition1Test.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/composition1Test.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,6 +0,0 @@
-<composition xmlns='http://drools.org/drools-4.0/composition'
- xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
- xs:schemaLocation='http://drools.org/drools-4.0/composition drools-composition-4.0.xsd' >
- <resource source='classpath:org/drools/xml/composition/composition1Test.drl' type='DRL' />
- <resource source='classpath:org/drools/xml/composition/composition2Test.drl' type='DRL' />
-</composition>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/composition2Test.drl
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/composition/composition2Test.drl 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/changeset/composition2Test.drl 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,9 +0,0 @@
-package org.drools.test
-
-global java.util.List list;
-
-rule "rule2"
-when
-then
- list.add( "rule2" );
-end
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/processes/ActionNodeTest.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,6 +1,6 @@
-<process xmlns="http://drools.org/drools-4.0/process"
+<process xmlns="http://drools.org/drools-5.0/process"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0/process drools-processes-4.0.xsd"
+ xs:schemaLocation="http://drools.org/drools-5.0/process drools-processes-4.0.xsd"
name="process name" id="process name" type="RuleFlow" package-name="org.domain" >
<header>
<imports>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseAccumulate.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseAccumulate.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseAccumulate.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="import java.util.List"/>
<import name="org.drools.Person" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseCollect.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseCollect.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseCollect.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<package name="com.sample" xmlns="http://drools.org/drools-4.0"
+<package name="com.sample" xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="import java.util.List"/>
<import name="org.drools.Cheese"/>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseComplex.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseComplex.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseComplex.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="pt.inescporto.cec.rules"
- xmlns="http://drools.org/drools-4.0"
- xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xmlns="http://drools.org/drools-5.0"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="pt.inescporto.cec.entities.SetupInUse"/>
<import name="pt.inescporto.cec.entities.SetupUse"/>
<import name="pt.inescporto.cec.entities.ArtigoProducao"/>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseExists.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseExists.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseExists.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<package name="com.sample" xmlns="http://drools.org/drools-4.0"
+<package name="com.sample" xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<rule name="simple_rule">
<lhs>
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseForall.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseForall.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseForall.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<global identifier="results" type="java.util.List" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseFrom.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseFrom.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseFrom.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="import java.util.List"/>
<import name="org.drools.Cheese" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseFunction.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseFunction.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseFunction.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="java.util.HashMap" />
<import name="org.drools.*" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseGlobal.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseGlobal.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseGlobal.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="java.util.HashMap" />
<import name="org.drools.*" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseImport.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseImport.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseImport.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="java.util.HashMap" />
<import name="org.drools.*" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseLhs.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseLhs.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseLhs.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="java.util.HashMap" />
<import name="org.drools.*" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParsePackageName.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParsePackageName.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParsePackageName.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
</package>
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseQuery.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseQuery.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseQuery.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="java.util.HashMap" />
<import name="org.drools.*" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseRhs.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseRhs.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseRhs.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="java.util.HashMap" />
<import name="org.drools.*" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseRule.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseRule.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_ParseRule.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="com.sample"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="java.util.HashMap" />
<import name="org.drools.*" />
Modified: labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_RoundTrip.xml
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_RoundTrip.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/xml/rules/test_RoundTrip.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<package name="foo"
- xmlns="http://drools.org/drools-4.0"
+ xmlns="http://drools.org/drools-5.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
- xs:schemaLocation="http://drools.org/drools-4.0 drools-4.0.xsd">
+ xs:schemaLocation="http://drools.org/drools-5.0 drools-4.0.xsd">
<import name="java.util.HashMap" />
<import name="java.util.HashSet" />
<import name="java.utilArrayList" />
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-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/agent/impl/KnowledgeAgentImpl.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -6,7 +6,7 @@
import java.util.Set;
import org.drools.KnowledgeBase;
-import org.drools.KnowledgeBaseChangeSet;
+import org.drools.ChangeSet;
import org.drools.KnowledgeBaseFactory;
import org.drools.RuleBase;
import org.drools.agent.KnowledgeAgent;
@@ -72,7 +72,7 @@
for ( Rule rule : pkg.getRules() ) {
Resource resource = rule.getResource();
- if ( resource == null || !resource.hasURL() ) {
+ if ( resource == null || !((InternalResource)resource).hasURL() ) {
continue;
}
ResourceMapping mapping = this.resources.get( resource );
@@ -89,7 +89,7 @@
for ( Process process : pkg.getRuleFlows().values() ) {
Resource resource = ((org.drools.process.core.Process) process).getResource();
- if ( resource == null || !resource.hasURL() ) {
+ if ( resource == null || !((InternalResource)resource).hasURL() ) {
continue;
}
ResourceMapping mapping = this.resources.get( resource );
@@ -106,7 +106,7 @@
for ( TypeDeclaration typeDeclaration : pkg.getTypeDeclarations().values() ) {
Resource resource = typeDeclaration.getResource();
- if ( resource == null || !resource.hasURL() ) {
+ if ( resource == null || !((InternalResource)resource).hasURL() ) {
continue;
}
ResourceMapping mapping = this.resources.get( resource );
@@ -123,7 +123,7 @@
for ( Function function : pkg.getFunctions().values() ) {
Resource resource = function.getResource();
- if ( resource == null || !resource.hasURL() ) {
+ if ( resource == null || !((InternalResource)resource).hasURL() ) {
continue;
}
ResourceMapping mapping = this.resources.get( resource );
@@ -163,7 +163,7 @@
// }
// }
- public void resourceChanged(KnowledgeBaseChangeSet changeSet) {
+ public void resourceChanged(ChangeSet changeSet) {
// for now we assume newIntance only, so just blow away the mappings and knowledgedefinition sets.
synchronized ( this.resources ) {
// first remove the unneeded resources
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/InternalResource.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/InternalResource.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/InternalResource.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,13 +1,31 @@
package org.drools.io;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+
import org.drools.builder.KnowledgeType;
+import org.drools.builder.ResourceConfiguration;
public interface InternalResource extends Resource {
- boolean isFromDirectory();
-
- void setFromDirectory(boolean fromDirectory);
-
void setKnowledgeType(KnowledgeType knowledgeType);
+
KnowledgeType getKnowledgeType();
+
+ ResourceConfiguration getConfiguration();
+ void setConfiguration(ResourceConfiguration configuration);
+
+ URL getURL() throws IOException;
+
+ boolean hasURL();
+
+ boolean isDirectory();
+
+ Collection<Resource> listResources();
+
+ long getLastModified();
+
+ long getLastRead();
+
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/BaseResource.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/BaseResource.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/BaseResource.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,28 +1,31 @@
package org.drools.io.impl;
+import java.io.Externalizable;
+
import org.drools.builder.KnowledgeType;
+import org.drools.builder.ResourceConfiguration;
+import org.drools.io.InternalResource;
-public abstract class BaseResource {
- private boolean fromDirectory;
- private KnowledgeType KnowledgeType;
-
- public boolean isFromDirectory() {
- return this.fromDirectory;
+public abstract class BaseResource
+ implements
+ InternalResource {
+ private KnowledgeType KnowledgeType;
+ private ResourceConfiguration configuration;
+
+ public ResourceConfiguration getConfiguration() {
+ return configuration;
}
- public void setFromDirectory(boolean fromDirectory) {
- this.fromDirectory = fromDirectory;
- }
-
+ public void setConfiguration(ResourceConfiguration configuration) {
+ this.configuration = configuration;
+ }
public void setKnowledgeType(KnowledgeType knowledgeType) {
this.KnowledgeType = knowledgeType;
}
-
-
+
public KnowledgeType getKnowledgeType() {
return this.KnowledgeType;
}
-
}
Copied: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ChangeSetImpl.java (from rev 24233, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/KnowledgeBaseChangeSetImpl.java)
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ChangeSetImpl.java (rev 0)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ChangeSetImpl.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,52 @@
+package org.drools.io.impl;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.drools.ChangeSet;
+import org.drools.definition.KnowledgeDefinition;
+import org.drools.io.Resource;
+
+public class ChangeSetImpl implements ChangeSet {
+ private Collection<Resource> resourcesRemoved = Collections.<Resource>emptyList();
+ private Collection<Resource> resourcesAdded = Collections.<Resource>emptyList();
+ private Collection<Resource> resourcesModified = Collections.<Resource>emptyList();
+ private Collection<KnowledgeDefinition> knowledgeDefinitionsRemoved = Collections.<KnowledgeDefinition>emptyList();
+
+ public ChangeSetImpl() {
+
+ }
+
+ public void setResourcesRemoved(Collection<Resource> resourcesRemoved) {
+ this.resourcesRemoved = resourcesRemoved;
+ }
+
+ public Collection<Resource> getResourcesRemoved() {
+ return resourcesRemoved;
+ }
+
+ public void setResourcesAdded(Collection<Resource> resourcesAdded) {
+ this.resourcesAdded = resourcesAdded;
+ }
+
+ public Collection<Resource> getResourcesAdded() {
+ return resourcesAdded;
+ }
+
+ public Collection<Resource> getResourcesModified() {
+ return resourcesModified;
+ }
+
+ public void setResourcesModified(Collection<Resource> resourcesModified) {
+ this.resourcesModified = resourcesModified;
+ }
+
+ public void setKnowledgeDefinitionsRemoved(Collection<KnowledgeDefinition> knowledgeDefinitionsRemoved) {
+ this.knowledgeDefinitionsRemoved = knowledgeDefinitionsRemoved;
+ }
+
+ public Collection<KnowledgeDefinition> getKnowledgeDefinitionsRemoved() {
+ return knowledgeDefinitionsRemoved;
+ }
+
+}
Property changes on: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ChangeSetImpl.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ClassPathResource.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ClassPathResource.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ClassPathResource.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,10 +1,13 @@
package org.drools.io.impl;
+import java.io.Externalizable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.io.Reader;
import java.net.URI;
import java.net.URISyntaxException;
@@ -26,11 +29,15 @@
public class ClassPathResource extends BaseResource
implements
- InternalResource {
+ InternalResource, Externalizable {
private String path;
private ClassLoader classLoader;
private Class clazz;
private long lastRead;
+
+ public ClassPathResource() {
+
+ }
public ClassPathResource(String path) {
this( path,
@@ -62,7 +69,16 @@
this.clazz = clazz;
this.classLoader = classLoader;
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject( this.path );
+ }
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ this.path = (String) in.readObject();
+ }
+
/**
* This implementation opens an InputStream for the given class path resource.
* @see java.lang.ClassLoader#getResourceAsStream(String)
@@ -179,6 +195,10 @@
throw new RuntimeException( "This Resource cannot be listed, or is not a directory" );
}
+ public ClassLoader getClassLoader() {
+ return this.classLoader;
+ }
+
public boolean equals(Object object) {
if ( object == null || !(object instanceof ClassPathResource) ) {
return false;
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/EncodedResource.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/EncodedResource.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/EncodedResource.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -11,7 +11,7 @@
import org.drools.io.Resource;
public class EncodedResource extends BaseResource implements InternalResource {
- private final Resource resource;
+ private final InternalResource resource;
private final String encoding;
@@ -35,7 +35,7 @@
if ( resource == null ) {
throw new IllegalArgumentException( "resource cannot be null" );
}
- this.resource = resource;
+ this.resource = (InternalResource) resource;
this.encoding = encoding;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/FileSystemResource.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/FileSystemResource.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/FileSystemResource.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,10 +1,13 @@
package org.drools.io.impl;
+import java.io.Externalizable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.io.Reader;
import java.net.URL;
import java.util.ArrayList;
@@ -20,10 +23,13 @@
* Borrowed gratuitously from Spring under ASL2.0.
*
*/
-public class FileSystemResource extends BaseResource implements InternalResource {
+public class FileSystemResource extends BaseResource implements InternalResource, Externalizable {
private File file;
private long lastRead = -1;
- private boolean FromDirectory;
+
+ public FileSystemResource() {
+
+ }
/**
* Create a new FileSystemResource from a File handle.
@@ -42,7 +48,16 @@
}
this.file = new File( StringUtils.cleanPath(file.getPath()) );
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject( this.file );
+ }
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ this.file = (File) in.readObject();
+ }
+
/**
* Create a new FileSystemResource from a file path.
* <p>Note: When building relative resources via {@link #createRelative},
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/KnowledgeBaseChangeSetImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/KnowledgeBaseChangeSetImpl.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/KnowledgeBaseChangeSetImpl.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,52 +0,0 @@
-package org.drools.io.impl;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.drools.KnowledgeBaseChangeSet;
-import org.drools.definition.KnowledgeDefinition;
-import org.drools.io.Resource;
-
-public class KnowledgeBaseChangeSetImpl implements KnowledgeBaseChangeSet {
- private Collection<Resource> resourcesRemoved = Collections.<Resource>emptyList();
- private Collection<Resource> resourcesAdded = Collections.<Resource>emptyList();
- private Collection<Resource> resourcesModified = Collections.<Resource>emptyList();
- private Collection<KnowledgeDefinition> knowledgeDefinitionsRemoved = Collections.<KnowledgeDefinition>emptyList();
-
- public KnowledgeBaseChangeSetImpl() {
-
- }
-
- public void setResourcesRemoved(Collection<Resource> resourcesRemoved) {
- this.resourcesRemoved = resourcesRemoved;
- }
-
- public Collection<Resource> getResourcesRemoved() {
- return resourcesRemoved;
- }
-
- public void setResourcesAdded(Collection<Resource> resourcesAdded) {
- this.resourcesAdded = resourcesAdded;
- }
-
- public Collection<Resource> getResourcesAdded() {
- return resourcesAdded;
- }
-
- public Collection<Resource> getResourcesModified() {
- return resourcesModified;
- }
-
- public void setResourcesModified(Collection<Resource> resourcesModified) {
- this.resourcesModified = resourcesModified;
- }
-
- public void setKnowledgeDefinitionsRemoved(Collection<KnowledgeDefinition> knowledgeDefinitionsRemoved) {
- this.knowledgeDefinitionsRemoved = knowledgeDefinitionsRemoved;
- }
-
- public Collection<KnowledgeDefinition> getKnowledgeDefinitionsRemoved() {
- return knowledgeDefinitionsRemoved;
- }
-
-}
Deleted: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/KnowledgeComposition.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/KnowledgeComposition.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/KnowledgeComposition.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,21 +0,0 @@
-package org.drools.io.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class KnowledgeComposition {
- private List<KnowledgeResource> resources;
-
- public KnowledgeComposition() {
- this.resources = new ArrayList<KnowledgeResource>();
- }
-
- public List<KnowledgeResource> getResources() {
- return resources;
- }
-
- public void setResources(List<KnowledgeResource> parts) {
- this.resources = parts;
- }
-
-}
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-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeNotifierImpl.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -11,7 +11,7 @@
import java.util.Map.Entry;
import java.util.concurrent.CopyOnWriteArrayList;
-import org.drools.KnowledgeBaseChangeSet;
+import org.drools.ChangeSet;
import org.drools.event.io.ResourceChangeListener;
import org.drools.io.Resource;
import org.drools.io.ResourceChangeMonitor;
@@ -81,21 +81,21 @@
}
}
- public void publishKnowledgeBaseChangeSet(KnowledgeBaseChangeSet changeSet) {
+ public void publishKnowledgeBaseChangeSet(ChangeSet changeSet) {
// this provides the complete published change set for this notifier.
// however different listeners might be listening to different resources, so provide
// listener change specified change sets.
- Map<ResourceChangeListener, KnowledgeBaseChangeSetImpl> localChangeSets = new HashMap<ResourceChangeListener, KnowledgeBaseChangeSetImpl>();
+ Map<ResourceChangeListener, ChangeSetImpl> localChangeSets = new HashMap<ResourceChangeListener, ChangeSetImpl>();
for ( Resource resource : changeSet.getResourcesAdded() ) {
Set<ResourceChangeListener> listeners = this.subscriptions.get( resource );
for ( ResourceChangeListener listener : listeners ) {
- KnowledgeBaseChangeSetImpl localChangeSet = localChangeSets.get( listener );
+ ChangeSetImpl localChangeSet = localChangeSets.get( listener );
if ( localChangeSet == null ) {
// lazy initialise changeSet
- localChangeSet = new KnowledgeBaseChangeSetImpl();
+ localChangeSet = new ChangeSetImpl();
localChangeSets.put( listener, localChangeSet );
}
if ( localChangeSet.getResourcesAdded().isEmpty() ) {
@@ -109,10 +109,10 @@
for ( Resource resource : changeSet.getResourcesRemoved() ) {
Set<ResourceChangeListener> listeners = this.subscriptions.remove( resource );
for ( ResourceChangeListener listener : listeners ) {
- KnowledgeBaseChangeSetImpl localChangeSet = localChangeSets.get( listener );
+ ChangeSetImpl localChangeSet = localChangeSets.get( listener );
if ( localChangeSet == null ) {
// lazy initialise changeSet
- localChangeSet = new KnowledgeBaseChangeSetImpl();
+ localChangeSet = new ChangeSetImpl();
localChangeSets.put( listener, localChangeSet );
}
if ( localChangeSet.getResourcesRemoved().isEmpty() ) {
@@ -126,10 +126,10 @@
for ( Resource resource : changeSet.getResourcesModified() ) {
Set<ResourceChangeListener> listeners = this.subscriptions.get( resource );
for ( ResourceChangeListener listener : listeners ) {
- KnowledgeBaseChangeSetImpl localChangeSet = localChangeSets.get( listener );
+ ChangeSetImpl localChangeSet = localChangeSets.get( listener );
if ( localChangeSet == null ) {
// lazy initialise changeSet
- localChangeSet = new KnowledgeBaseChangeSetImpl();
+ localChangeSet = new ChangeSetImpl();
localChangeSets.put( listener, localChangeSet );
}
if ( localChangeSet.getResourcesModified().isEmpty() ) {
@@ -139,9 +139,9 @@
}
}
- for ( Entry<ResourceChangeListener, KnowledgeBaseChangeSetImpl> entry : localChangeSets.entrySet() ) {
+ for ( Entry<ResourceChangeListener, ChangeSetImpl> entry : localChangeSets.entrySet() ) {
ResourceChangeListener listener = entry.getKey();
- KnowledgeBaseChangeSetImpl localChangeSet = entry.getValue();
+ ChangeSetImpl localChangeSet = entry.getValue();
listener.resourceChanged( localChangeSet );
}
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-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/ResourceChangeScannerImpl.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -13,7 +13,7 @@
import java.util.Set;
import java.util.Map.Entry;
-import org.drools.KnowledgeBaseChangeSet;
+import org.drools.ChangeSet;
import org.drools.io.InternalResource;
import org.drools.io.Resource;
import org.drools.io.ResourceChangeNotifier;
@@ -60,7 +60,7 @@
Resource resource) {
System.out.println( "scanner : " + resource );
synchronized ( this.resources ) {
- if ( resource.isDirectory() ) {
+ if ( ((InternalResource)resource).isDirectory() ) {
this.directories.add( resource );
}
Set<ResourceChangeNotifier> notifiers = this.resources.get( resource );
@@ -94,24 +94,24 @@
if ( this.resources.size() > 0 ) {
System.out.println( "x" );
}
- Map<ResourceChangeNotifier, KnowledgeBaseChangeSet> notifications = new HashMap<ResourceChangeNotifier, KnowledgeBaseChangeSet>();
+ Map<ResourceChangeNotifier, ChangeSet> notifications = new HashMap<ResourceChangeNotifier, ChangeSet>();
List<Resource> removed = new ArrayList<Resource>();
// detect modified and added
for ( Resource resource : this.directories ) {
- for ( Resource child : resource.listResources() ) {
+ for ( Resource child : ((InternalResource)resource).listResources() ) {
if ( !this.resources.containsKey( child ) ) {
System.out.println( "found new file : " + child );
// child is new
((InternalResource)child).setKnowledgeType( ((InternalResource)resource).getKnowledgeType() );
Set<ResourceChangeNotifier> notifiers = this.resources.get( resource ); // get notifiers for this directory
for ( ResourceChangeNotifier notifier : notifiers ) {
- KnowledgeBaseChangeSetImpl changeSet = (KnowledgeBaseChangeSetImpl) notifications.get( notifier );
+ ChangeSetImpl changeSet = (ChangeSetImpl) notifications.get( notifier );
if ( changeSet == null ) {
// lazy initialise changeSet
- changeSet = new KnowledgeBaseChangeSetImpl();
+ changeSet = new ChangeSetImpl();
notifications.put( notifier,
changeSet );
}
@@ -129,19 +129,19 @@
Resource resource = entry.getKey();
Set<ResourceChangeNotifier> notifiers = entry.getValue();
- if ( !resource.isDirectory() ) {
+ if ( !((InternalResource)resource).isDirectory() ) {
// detect if Resource has been modified
- System.out.println( "scan " + resource + ": " + resource.getLastModified() + " : " + resource.getLastRead() );
- long lastModified = resource.getLastModified();
+ System.out.println( "scan " + resource + ": " + ((InternalResource)resource).getLastModified() + " : " + ((InternalResource)resource).getLastRead() );
+ long lastModified = ((InternalResource)resource).getLastModified();
if ( lastModified == 0 ) {
removed.add( resource );
// resource is no longer present
// iterate notifiers for this resource and add to each removed
for ( ResourceChangeNotifier notifier : notifiers ) {
- KnowledgeBaseChangeSetImpl changeSet = (KnowledgeBaseChangeSetImpl) notifications.get( notifier );
+ ChangeSetImpl changeSet = (ChangeSetImpl) notifications.get( notifier );
if ( changeSet == null ) {
// lazy initialise changeSet
- changeSet = new KnowledgeBaseChangeSetImpl();
+ changeSet = new ChangeSetImpl();
notifications.put( notifier,
changeSet );
}
@@ -150,14 +150,14 @@
}
changeSet.getResourcesRemoved().add( resource );
}
- } else if ( resource.getLastRead() < lastModified ) {
+ } else if ( ((InternalResource)resource).getLastRead() < lastModified ) {
// it's modified
// iterate notifiers for this resource and add to each modified
for ( ResourceChangeNotifier notifier : notifiers ) {
- KnowledgeBaseChangeSetImpl changeSet = (KnowledgeBaseChangeSetImpl) notifications.get( notifier );
+ ChangeSetImpl changeSet = (ChangeSetImpl) notifications.get( notifier );
if ( changeSet == null ) {
// lazy initialise changeSet
- changeSet = new KnowledgeBaseChangeSetImpl();
+ changeSet = new ChangeSetImpl();
notifications.put( notifier,
changeSet );
}
@@ -175,9 +175,9 @@
this.resources.remove( resource );
}
- for ( Entry<ResourceChangeNotifier, KnowledgeBaseChangeSet> entry : notifications.entrySet() ) {
+ for ( Entry<ResourceChangeNotifier, ChangeSet> entry : notifications.entrySet() ) {
ResourceChangeNotifier notifier = entry.getKey();
- KnowledgeBaseChangeSet changeSet = entry.getValue();
+ ChangeSet changeSet = entry.getValue();
notifier.publishKnowledgeBaseChangeSet( changeSet );
}
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/UrlResource.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/UrlResource.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/io/impl/UrlResource.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,16 +1,18 @@
package org.drools.io.impl;
+import java.io.Externalizable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
import org.drools.io.InternalResource;
@@ -21,13 +23,17 @@
* Borrowed gratuitously from Spring under ASL2.0.
*
*/
-public class UrlResource extends BaseResource implements InternalResource {
- private URL url;
- private long lastRead = -1;
-
- private boolean FromDirectory;
+public class UrlResource extends BaseResource
+ implements
+ InternalResource,
+ Externalizable {
+ private URL url;
+ private long lastRead = -1;
+ public UrlResource() {
+ }
+
public UrlResource(URL url) {
this.url = getCleanedUrl( url,
url.toString() );
@@ -38,10 +44,20 @@
this.url = getCleanedUrl( new URL( path ),
path );
} catch ( MalformedURLException e ) {
- throw new IllegalArgumentException( "'" + path + "' path is malformed", e);
+ throw new IllegalArgumentException( "'" + path + "' path is malformed",
+ e );
}
}
-
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ out.writeObject( this.url );
+ }
+
+ public void readExternal(ObjectInput in) throws IOException,
+ ClassNotFoundException {
+ this.url = (URL) in.readObject();
+ }
+
/**
* This implementation opens an InputStream for the given URL.
* It sets the "UseCaches" flag to <code>false</code>,
@@ -51,16 +67,15 @@
* @see java.net.URLConnection#getInputStream()
*/
public InputStream getInputStream() throws IOException {
- this.lastRead = getLastModified();
+ this.lastRead = getLastModified();
URLConnection con = this.url.openConnection();
- con.setUseCaches(false);
+ con.setUseCaches( false );
return con.getInputStream();
}
-
+
public Reader getReader() throws IOException {
return new InputStreamReader( getInputStream() );
}
-
/**
* Determine a cleaned URL for the given original URL.
@@ -79,44 +94,44 @@
return originalUrl;
}
}
-
+
public URL getURL() throws IOException {
return this.url;
}
-
+
public boolean hasURL() {
return true;
- }
+ }
public long getLastModified() {
try {
URLConnection conn = getURL().openConnection();
- long date = conn.getLastModified();
+ long date = conn.getLastModified();
return date;
} catch ( IOException e ) {
throw new RuntimeException( "Unable to get LastMofified for ClasspathResource",
e );
}
}
-
+
public long getLastRead() {
return this.lastRead;
}
-
+
public boolean isDirectory() {
try {
URL url = getURL();
if ( "file".equals( url.getProtocol() ) ) {
-
+
File file = new File( StringUtils.toURI( url.toString() ).getSchemeSpecificPart() );
-
+
return file.isDirectory();
}
} catch ( Exception e ) {
// swallow as returned false
}
-
+
return false;
}
@@ -124,23 +139,23 @@
try {
URL url = getURL();
- if ( "file".equals( url.getProtocol() ) ) {
+ if ( "file".equals( url.getProtocol() ) ) {
File dir = new File( StringUtils.toURI( url.toString() ).getSchemeSpecificPart() );
-
+
List<Resource> resources = new ArrayList<Resource>();
-
+
for ( File file : dir.listFiles() ) {
resources.add( new FileSystemResource( file ) );
}
-
+
return resources;
}
} catch ( Exception e ) {
// swallow as we'll throw an exception anyway
}
throw new RuntimeException( "This Resource cannot be listed, or is not a directory" );
- }
-
+ }
+
/**
* This implementation compares the underlying URL references.
*/
@@ -157,7 +172,7 @@
public int hashCode() {
return this.url.hashCode();
}
-
+
public String toString() {
return "[UrlResource path='" + this.url.toString() + "']";
}
Copied: labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/ChangeSetTest.java (from rev 24244, labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/CompositionTest.java)
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/ChangeSetTest.java (rev 0)
+++ labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/ChangeSetTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,57 @@
+package org.drools.decisiontable;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.builder.DecisionTableConfiguration;
+import org.drools.builder.DecisionTableInputType;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.KnowledgeType;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.io.ResourceFactory;
+import org.drools.io.impl.ClassPathResource;
+import org.drools.io.impl.KnowledgeResource;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.xml.XmlChangeSetReader;
+import org.xml.sax.SAXException;
+
+public class ChangeSetTest extends TestCase {
+
+ public void testIntegregation() {
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ kbuilder.add( ResourceFactory.newClassPathResource( "changeset1Test.xml", getClass()), KnowledgeType.ChangeSet );
+ assertFalse( kbuilder.hasErrors() );
+ KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+ kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
+ StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
+ List list = new ArrayList();
+ ksession.setGlobal( "list", list );
+
+ ksession.insert( new Cheese( "cheddar",
+ 42 ) );
+ ksession.insert( new Person( "michael",
+ "stilton",
+ 25 ) );
+
+ ksession.fireAllRules();
+ ksession.dispose();
+
+ assertEquals( 3, list.size() );
+
+ assertEquals( "Young man cheddar",
+ list.get( 0 ) );
+
+ assertEquals( "rule1",
+ list.get( 1 ) );
+ assertEquals( "rule2",
+ list.get( 2 ) );
+ }
+}
Property changes on: labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/ChangeSetTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/CompositionTest.java
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/CompositionTest.java 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-decisiontables/src/test/java/org/drools/decisiontable/CompositionTest.java 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,58 +0,0 @@
-package org.drools.decisiontable;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.drools.KnowledgeBase;
-import org.drools.KnowledgeBaseFactory;
-import org.drools.builder.DecisionTableConfiguration;
-import org.drools.builder.DecisionTableInputType;
-import org.drools.builder.KnowledgeBuilder;
-import org.drools.builder.KnowledgeBuilderFactory;
-import org.drools.builder.KnowledgeType;
-import org.drools.compiler.PackageBuilderConfiguration;
-import org.drools.io.ResourceFactory;
-import org.drools.io.impl.ClassPathResource;
-import org.drools.io.impl.KnowledgeComposition;
-import org.drools.io.impl.KnowledgeResource;
-import org.drools.runtime.StatefulKnowledgeSession;
-import org.drools.xml.XmlCompositionReader;
-import org.xml.sax.SAXException;
-
-public class CompositionTest extends TestCase {
-
- public void testIntegregation() {
- KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- kbuilder.add( ResourceFactory.newClassPathResource( "composition1Test.xml", getClass()), KnowledgeType.COMPOSITION );
- assertFalse( kbuilder.hasErrors() );
- KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
- kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
- StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
- List list = new ArrayList();
- ksession.setGlobal( "list", list );
-
- ksession.insert( new Cheese( "cheddar",
- 42 ) );
- ksession.insert( new Person( "michael",
- "stilton",
- 25 ) );
-
- ksession.fireAllRules();
- ksession.dispose();
-
- assertEquals( 3, list.size() );
-
- assertEquals( "Young man cheddar",
- list.get( 0 ) );
-
- assertEquals( "rule1",
- list.get( 1 ) );
- assertEquals( "rule2",
- list.get( 2 ) );
- }
-}
Copied: labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.drl (from rev 24244, labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.drl)
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.drl (rev 0)
+++ labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.drl 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,10 @@
+package org.drools.test
+
+global java.util.List list;
+
+rule "rule1"
+ salience 10
+when
+then
+ list.add( "rule1" );
+end
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.drl
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.xml (from rev 24244, labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.xml)
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.xml (rev 0)
+++ labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,11 @@
+<change-set xmlns='http://drools.org/drools-5.0/change-set'
+ xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
+ xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-5.0.xsd' >
+ <add>
+ <resource source='classpath:org/drools/decisiontable/changeset1Test.drl' type='DRL' />
+ <resource source='classpath:data/IntegrationExampleTest.xls' type="DTABLE">
+ <decisiontable-conf input-type="XLS" worksheet-name="Tables_2" />
+ </resource>
+ <resource source='classpath:org/drools/decisiontable/changeset2Test.drl' type='DRL' />
+ </add>
+</change-set>
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset1Test.xml
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset2Test.drl (from rev 24244, labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition2Test.drl)
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset2Test.drl (rev 0)
+++ labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset2Test.drl 2008-12-05 09:57:53 UTC (rev 24245)
@@ -0,0 +1,10 @@
+package org.drools.test
+
+global java.util.List list;
+
+rule "rule2"
+ salience 5
+when
+then
+ list.add( "rule2" );
+end
\ No newline at end of file
Property changes on: labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/changeset2Test.drl
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.drl
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.drl 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.drl 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,10 +0,0 @@
-package org.drools.test
-
-global java.util.List list;
-
-rule "rule1"
- salience 10
-when
-then
- list.add( "rule1" );
-end
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.xml
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.xml 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition1Test.xml 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,9 +0,0 @@
-<composition xmlns='http://drools.org/drools-4.0/composition'
- xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
- xs:schemaLocation='http://drools.org/drools-4.0/composition drools-composition-4.0.xsd' >
- <resource source='classpath:org/drools/decisiontable/composition1Test.drl' type='DRL' />
- <resource source='classpath:data/IntegrationExampleTest.xls' type="DTABLE">
- <decisiontable-conf input-type="XLS" worksheet-name="Tables_2" />
- </resource>
- <resource source='classpath:org/drools/decisiontable/composition2Test.drl' type='DRL' />
-</composition>
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition2Test.drl
===================================================================
--- labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition2Test.drl 2008-12-05 00:04:45 UTC (rev 24244)
+++ labs/jbossrules/trunk/drools-decisiontables/src/test/resources/org/drools/decisiontable/composition2Test.drl 2008-12-05 09:57:53 UTC (rev 24245)
@@ -1,10 +0,0 @@
-package org.drools.test
-
-global java.util.List list;
-
-rule "rule2"
- salience 5
-when
-then
- list.add( "rule2" );
-end
\ No newline at end of file
More information about the jboss-svn-commits
mailing list