[jboss-svn-commits] JBL Code SVN: r36688 - in labs/jbossrules/tags/5.2.0.M1: drools-ant and 24 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Feb 24 09:08:19 EST 2011
Author: ge0ffrey
Date: 2011-02-24 09:08:18 -0500 (Thu, 24 Feb 2011)
New Revision: 36688
Added:
labs/jbossrules/tags/5.2.0.M1/drools-ant/
labs/jbossrules/tags/5.2.0.M1/drools-ant/.gitignore
labs/jbossrules/tags/5.2.0.M1/drools-ant/lib/
labs/jbossrules/tags/5.2.0.M1/drools-ant/lib/cheese.jar
labs/jbossrules/tags/5.2.0.M1/drools-ant/pom.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/DroolsCompilerAntTask.java
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/DroolsVerifierAntTask.java
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/GuvnorJRClusterConfigAntTask.java
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/mssql-repository.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/mysql-repository.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle10g-repository.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle11-repository.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle9i-repository.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/postgresql-repository.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/BuildFileTest.java
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/Cheese.java
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/DroolsAntTaskTest.java
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/GuvnorJRClusterConfigTest.java
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/Person.java
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/DroolsAntTask.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/GuvnorJRClusterConfigAntTask.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/org/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/org/drools/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/org/drools/verifier/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/org/drools/verifier/Misc.drl
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/Person.brl
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/emptydir/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/emptydir/Person.brl
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/rule.package
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/tmp.package
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/ruleFlow/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/ruleFlow/workitems.rf
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/MultiSheetDST.xls
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/Person.brl
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/Person.xml
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.drl
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.dsl
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.dslr
labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/rule.package
Log:
All monolothic build versions (<= 5.2.0.M1) stay in subversion
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/.gitignore
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/.gitignore (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/.gitignore 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,10 @@
+/target
+/local
+
+# Eclipse, Netbeans and IntelliJ files
+/.*
+!.gitignore
+/nbproject
+/*.ipr
+/*.iws
+/*.iml
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/lib/cheese.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/tags/5.2.0.M1/drools-ant/lib/cheese.jar
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/pom.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/pom.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/pom.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.drools</groupId>
+ <artifactId>drools</artifactId>
+ <version>5.2.0.M1</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>drools-ant</artifactId>
+ <name>Drools :: Ant Task</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <systemPropertyVariables>
+ <eclipsepath>./</eclipsepath>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-verifier</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-compiler</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-decisiontables</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-nodeps</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.freemarker</groupId>
+ <artifactId>freemarker</artifactId>
+ </dependency>
+ </dependencies>
+</project>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/DroolsCompilerAntTask.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/DroolsCompilerAntTask.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/DroolsCompilerAntTask.java 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,686 @@
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.contrib;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.tools.ant.AntClassLoader;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.RuntimeDroolsException;
+import org.drools.builder.DecisionTableConfiguration;
+import org.drools.builder.DecisionTableInputType;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.ResourceType;
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.decisiontable.InputType;
+import org.drools.decisiontable.SpreadsheetCompiler;
+import org.drools.definition.KnowledgePackage;
+import org.drools.definition.rule.Rule;
+import org.drools.ide.common.client.modeldriven.brl.RuleModel;
+import org.drools.ide.common.server.util.BRDRLPersistence;
+import org.drools.ide.common.server.util.BRXMLPersistence;
+import org.drools.io.ResourceFactory;
+import org.drools.lang.Expander;
+import org.drools.lang.dsl.DSLMappingFile;
+import org.drools.lang.dsl.DSLTokenizedMappingFile;
+import org.drools.lang.dsl.DefaultExpander;
+import org.drools.lang.dsl.DefaultExpanderResolver;
+import org.drools.rule.Package;
+import org.drools.core.util.DroolsStreamUtils;
+
+/**
+ * An ant task to allow rulebase compilation and serialization during a build.
+ *
+ * @author etirelli
+ */
+public class DroolsCompilerAntTask extends MatchingTask {
+
+ public static String BRLFILEEXTENSION = ".brl";
+ public static String XMLFILEEXTENSION = ".xml";
+ public static String RULEFLOWMODELFILEEXTENSION = ".rfm";
+ public static String RULEFLOWFILEEXTENSION = ".rf";
+ public static String DSLFILEEXTENSION = ".dsl";
+ public static String DSLRFILEEXTENSION = ".dslr";
+ public static String XLSFILEEXTENSION = ".xls";
+ public static String DROOLSPACKAGEEXTENSION = ".package";
+
+ public static String PACKAGEBINFORMAT = "package";
+ public static String PACKAGEBINTYPE = "knowledge";
+
+ private File srcdir;
+ private File toFile;
+ private Path classpath;
+
+ private String binformat;
+ private String bintype;
+ private String verbose;
+ private boolean verboseoption;
+
+ /**
+ * Source directory to read DRL files from
+ *
+ * @param directory
+ */
+ public void setSrcDir(File directory) {
+ this.srcdir = directory;
+ }
+
+ /**
+ * File to serialize the rulebase to
+ *
+ * @param toFile
+ */
+ public void setToFile(File toFile) {
+ this.toFile = toFile;
+ }
+
+ /**
+ * The classpath to use when compiling the rulebase
+ *
+ * @param classpath
+ */
+ public void setClasspath(Path classpath) {
+ createClasspath().append(classpath);
+ }
+
+ /**
+ * Classpath to use, by reference, when compiling the rulebase
+ *
+ * @param a
+ * reference to an existing classpath
+ */
+ public void setClasspathref(Reference r) {
+ createClasspath().setRefid(r);
+ }
+
+ /**
+ * Adds a path to the classpath.
+ *
+ * @return created classpath
+ */
+ public Path createClasspath() {
+ if (this.classpath == null) {
+ this.classpath = new Path(getProject());
+ }
+ return this.classpath.createPath();
+ }
+
+ /**
+ * Task's main method
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ verboseoption = verbose != null && verbose.equalsIgnoreCase("true");
+
+ // checking parameters are set
+ if (toFile == null) {
+ throw new BuildException(
+ "Destination rulebase file does not specified.");
+ }
+
+ // checking parameters are set
+ if (srcdir == null) {
+ throw new BuildException("Source directory not specified.");
+ }
+
+ if (!srcdir.exists()) {
+ throw new BuildException("Source directory does not exists."
+ + srcdir.getAbsolutePath());
+ }
+
+ AntClassLoader loader = null;
+ try {
+ // create a specialized classloader
+ loader = getClassLoader();
+
+ if (PACKAGEBINTYPE.equals(bintype)) {
+ createWithKnowledgeBuilder(loader);
+ } else {
+ createWithPackageBuilder(loader);
+ }
+ } catch (Exception e) {
+ throw new BuildException("RuleBaseTask failed: " + e.getMessage(),
+ e);
+ } finally {
+ if (loader != null) {
+ loader.resetThreadContextLoader();
+ }
+ }
+ }
+
+ private void createWithKnowledgeBuilder(AntClassLoader loader)
+ throws FileNotFoundException, DroolsParserException, IOException {
+ // create a package builder configured to use the given classloader
+ KnowledgeBuilder kbuilder = getKnowledgeBuilder(loader);
+
+ // add files to rulebase
+ compileAndAddFiles(kbuilder);
+
+ // gets the packages
+ Collection<KnowledgePackage> pkgs = kbuilder.getKnowledgePackages();
+
+ if(verboseoption) {
+ Iterator<KnowledgePackage> iter = pkgs.iterator();
+ while(iter.hasNext()) {
+ KnowledgePackage pkg = iter.next();
+ log("** Content of package: " + pkg.getName());
+ Iterator<Rule> riter = pkg.getRules().iterator();
+ while(riter.hasNext()) {
+ log("\tRule name: " + riter.next().getName());
+ }
+ }
+ }
+
+ // creates the knowledge base
+ KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+
+ // adds the packages
+ kbase.addKnowledgePackages(pkgs);
+
+ if (PACKAGEBINFORMAT.equals(binformat)) {
+ Iterator<KnowledgePackage> iter = pkgs.iterator();
+ while(iter.hasNext()) {
+ KnowledgePackage pkg = iter.next();
+ if(verboseoption) {
+ log("** Serializing package ["+pkg.getName()+"] to destination file. **** THIS WILL OVERRIDE ANY PREVIOUSLY SERIALIZED PACKAGE ****");
+ }
+ serializeObject(pkg);
+ }
+ } else {
+ if(verboseoption) {
+ log("** Serializing KnowledgeBase to destination file.");
+ }
+ // serialize the knowledge base to the destination file
+ serializeObject(kbase);
+ }
+ }
+
+ private void compileAndAddFiles(KnowledgeBuilder kbuilder)
+ throws FileNotFoundException, DroolsParserException, IOException {
+ // get the list of drools package files
+ String[] droolsPackageNames = getDroolsPackageFileList();
+ if (droolsPackageNames != null) {
+ for (int i = 0; i < droolsPackageNames.length; i++) {
+ // compile rule file and add to the builder
+ compileAndAddFile(kbuilder, droolsPackageNames[i]);
+ }
+ }
+
+ // get the list of files to be added to the rulebase
+ String[] fileNames = getFileList();
+
+ for (int i = 0; i < fileNames.length; i++) {
+ // compile rule file and add to the builder
+ compileAndAddFile(kbuilder, fileNames[i]);
+ }
+
+ if (kbuilder.hasErrors()) {
+ System.err.println(kbuilder.getErrors().toString());
+ }
+ }
+
+ private void compileAndAddFiles(PackageBuilder pbuilder)
+ throws FileNotFoundException, DroolsParserException, IOException {
+ // get the list of drools package files
+ String[] droolsPackageNames = getDroolsPackageFileList();
+ if (droolsPackageNames != null) {
+ for (int i = 0; i < droolsPackageNames.length; i++) {
+ // compile rule file and add to the builder
+ compileAndAddFile(pbuilder, droolsPackageNames[i]);
+ }
+ }
+
+ // get the list of files to be added to the rulebase
+ String[] fileNames = getFileList();
+
+ for (int i = 0; i < fileNames.length; i++) {
+ // compile rule file and add to the builder
+ compileAndAddFile(pbuilder, fileNames[i]);
+ }
+
+ if (pbuilder.hasErrors()) {
+ System.err.println(pbuilder.getErrors().toString());
+ }
+ }
+
+ private void createWithPackageBuilder(AntClassLoader loader)
+ throws FileNotFoundException, DroolsParserException, IOException {
+ // create a package builder configured to use the given classloader
+ PackageBuilder builder = getPackageBuilder(loader);
+
+ compileAndAddFiles(builder);
+
+ org.drools.rule.Package[] packages = builder.getPackages();
+
+ if(verboseoption) {
+ for(org.drools.rule.Package pkg : packages) {
+ log("** Content of package: " + pkg.getName());
+ Rule[] rules = pkg.getRules();
+ for(Rule rule : rules) {
+ log("\tRule name: " + rule.getName());
+ }
+ }
+ }
+
+ // gets the package
+ //org.drools.rule.Package pkg = builder.getPackage();
+
+ // creates the rulebase
+ RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+
+ // adds the packages
+ ruleBase.addPackages(packages);
+
+ if (PACKAGEBINFORMAT.equals(binformat)) {
+ for(org.drools.rule.Package pkg : packages) {
+ if(verboseoption) {
+ log("** Serializing package ["+pkg.getName()+"] to destination file. **** THIS WILL OVERRIDE ANY PREVIOUSLY SERIALIZED PACKAGE ****");
+ }
+ serializeObject(pkg);
+ }
+ } else {
+ if(verboseoption) {
+ log("** Serializing RuleBase to destination file.");
+ }
+ // serialize the rule base to the destination file
+ serializeObject(ruleBase);
+ }
+ }
+
+ /**
+ * @param ruleBase
+ * @throws FileNotFoundException
+ * @throws IOException
+ */
+ private void serializeObject(Object object) throws FileNotFoundException,
+ IOException {
+ FileOutputStream fout = null;
+ try {
+ fout = new FileOutputStream(toFile);
+ DroolsStreamUtils.streamOut(fout, object);
+ } finally {
+ if (fout != null) {
+ fout.close();
+ }
+ }
+ }
+
+ /**
+ * @param builder
+ * @param fileName
+ * @return
+ * @throws FileNotFoundException
+ * @throws DroolsParserException
+ * @throws IOException
+ */
+ private void compileAndAddFile(KnowledgeBuilder kbuilder, String fileName)
+ throws FileNotFoundException, DroolsParserException, IOException {
+
+ FileReader fileReader = new FileReader(new File(this.srcdir, fileName));
+
+ if (fileName.endsWith(DroolsCompilerAntTask.BRLFILEEXTENSION)) {
+
+ // TODO: Right now I have to first change this to String. Change to
+ // use KnowledgeBuilder directly when the support for that is done.
+ // -Toni Rikkola-
+
+ RuleModel model = BRXMLPersistence.getInstance().unmarshal(
+ loadResource(fileName));
+ String packagefile = loadResource(resolvePackageFile(this.srcdir
+ .getAbsolutePath()));
+ model.name = fileName.replace(
+ DroolsCompilerAntTask.BRLFILEEXTENSION, "");
+ ByteArrayInputStream istream = new ByteArrayInputStream(
+ (packagefile + BRDRLPersistence.getInstance()
+ .marshal(model)).getBytes());
+
+ Reader instream = new InputStreamReader(istream);
+
+ kbuilder.add(ResourceFactory.newReaderResource(instream),
+ ResourceType.DRL);
+
+ } else if (fileName
+ .endsWith(DroolsCompilerAntTask.RULEFLOWMODELFILEEXTENSION)
+ || fileName
+ .endsWith(DroolsCompilerAntTask.RULEFLOWFILEEXTENSION)) {
+
+ kbuilder.add(ResourceFactory.newReaderResource(fileReader),
+ ResourceType.DRF);
+
+ } else if (fileName.endsWith(DroolsCompilerAntTask.XMLFILEEXTENSION)) {
+ kbuilder.add(ResourceFactory.newReaderResource(fileReader),
+ ResourceType.XDRL);
+ } else if (fileName.endsWith(DroolsCompilerAntTask.XLSFILEEXTENSION)) {
+
+ DecisionTableConfiguration dtableconfiguration = KnowledgeBuilderFactory
+ .newDecisionTableConfiguration();
+ dtableconfiguration.setInputType(DecisionTableInputType.XLS);
+
+ kbuilder.add(ResourceFactory.newReaderResource(fileReader),
+ ResourceType.DTABLE, dtableconfiguration);
+
+ // } else if
+ // (fileName.endsWith(DroolsCompilerAntTask.DSLFILEEXTENSION)) {
+ //
+ // kbuilder.add(ResourceFactory.newReaderResource(fileReader),
+ // ResourceType.DSL);
+
+ } else if (fileName.endsWith(DroolsCompilerAntTask.DSLRFILEEXTENSION)) {
+
+ // Get the DSL too.
+ String[] dsls = resolveDSLFilesToArray();
+ for (int i = 0; i < dsls.length; i++) {
+ kbuilder.add(ResourceFactory.newFileResource(new File(
+ this.srcdir, dsls[i])), ResourceType.DSL);
+ }
+
+ kbuilder.add(ResourceFactory.newReaderResource(fileReader),
+ ResourceType.DSLR);
+
+ } else {
+ kbuilder.add(ResourceFactory.newReaderResource(fileReader),
+ ResourceType.DRL);
+ }
+ }
+
+ /**
+ * @param builder
+ * @param fileName
+ * @return
+ * @throws FileNotFoundException
+ * @throws DroolsParserException
+ * @throws IOException
+ */
+ private void compileAndAddFile(PackageBuilder builder, String fileName)
+ throws FileNotFoundException, DroolsParserException, IOException {
+ InputStreamReader instream = null;
+ File file = new File(this.srcdir, fileName);
+
+ try {
+
+ if (fileName.endsWith(DroolsCompilerAntTask.BRLFILEEXTENSION)) {
+
+ RuleModel model = BRXMLPersistence.getInstance().unmarshal(
+ loadResource(fileName));
+ String packagefile = loadResource(resolvePackageFile(this.srcdir
+ .getAbsolutePath()));
+ model.name = fileName.replace(
+ DroolsCompilerAntTask.BRLFILEEXTENSION, "");
+ ByteArrayInputStream istream = new ByteArrayInputStream(
+ (packagefile + BRDRLPersistence.getInstance().marshal(
+ model)).getBytes());
+ instream = new InputStreamReader(istream);
+
+ } else {
+ instream = new InputStreamReader(new FileInputStream(file));
+ }
+
+ if (fileName
+ .endsWith(DroolsCompilerAntTask.RULEFLOWMODELFILEEXTENSION)
+ || fileName
+ .endsWith(DroolsCompilerAntTask.RULEFLOWFILEEXTENSION)) {
+ builder.addRuleFlow(instream);
+ } else if (fileName
+ .endsWith(DroolsCompilerAntTask.XMLFILEEXTENSION)) {
+ builder.addPackageFromXml(instream);
+ } else if (fileName
+ .endsWith(DroolsCompilerAntTask.XLSFILEEXTENSION)) {
+
+ final SpreadsheetCompiler converter = new SpreadsheetCompiler();
+ final String drl = converter.compile(new FileInputStream(file),
+ InputType.XLS);
+
+ System.out.println(drl);
+
+ builder.addPackageFromDrl(new StringReader(drl));
+
+ } else if (fileName
+ .endsWith(DroolsCompilerAntTask.DSLRFILEEXTENSION)) {
+ DrlParser parser = new DrlParser();
+ String expandedDRL = parser.getExpandedDRL(
+ loadResource(fileName), resolveDSLFiles());
+ builder.addPackageFromDrl(new StringReader(expandedDRL));
+ } else {
+ builder.addPackageFromDrl(instream);
+ }
+ } finally {
+ if (instream != null) {
+ instream.close();
+ }
+ }
+ }
+
+ private String[] resolveDSLFilesToArray() {
+
+ Collection<String> list = new ArrayList<String>();
+
+ final File dir = new File(this.srcdir.getAbsolutePath());
+
+ FilenameFilter filter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".dsl");
+ }
+ };
+
+ return dir.list(filter);
+ }
+
+ private DefaultExpanderResolver resolveDSLFiles() throws IOException {
+
+ DefaultExpanderResolver resolver = new DefaultExpanderResolver();
+ final File dir = new File(this.srcdir.getAbsolutePath());
+ DSLMappingFile file = new DSLTokenizedMappingFile();
+
+ FilenameFilter filter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".dsl");
+ }
+ };
+
+ String[] children = dir.list(filter);
+ if (children.length == 0) {
+ throw new BuildException(
+ "There are no DSL files for this directory:"
+ + this.srcdir.getAbsolutePath());
+ }
+
+ for (int index = 0; index < children.length; index++) {
+ if (file.parseAndLoad(new StringReader(
+ loadResource(children[index])))) {
+ final Expander expander = new DefaultExpander();
+ expander.addDSLMapping(file.getMapping());
+ resolver.addExpander("*", expander);
+ } else {
+ throw new RuntimeDroolsException(
+ "Error parsing and loading DSL file."
+ + file.getErrors());
+ }
+ }
+
+ return resolver;
+ }
+
+ private String resolvePackageFile(String dirname) {
+
+ File dir = new File(dirname);
+ FilenameFilter filter = new FilenameFilter() {
+ public boolean accept(File dir, String name) {
+ return name.endsWith(".package");
+ }
+ };
+
+ String[] children = dir.list(filter);
+ if (children.length > 1) {
+ throw new BuildException(
+ "There are more than one package configuration file for this directory :"
+ + dirname);
+ }
+
+ if (children.length == 0) {
+ throw new BuildException(
+ "There is no package configuration file for this directory:"
+ + dirname);
+ }
+
+ return children[0];
+ }
+
+ private String loadResource(final String name) throws IOException {
+
+ final InputStream in = new FileInputStream(this.srcdir + "/" + name);
+ final Reader reader = new InputStreamReader(in);
+ final StringBuffer text = new StringBuffer();
+ final char[] buf = new char[1024];
+ int len = 0;
+
+ while ((len = reader.read(buf)) >= 0) {
+ text.append(buf, 0, len);
+ }
+
+ return text.toString();
+ }
+
+ /**
+ * @return
+ */
+ private AntClassLoader getClassLoader() {
+ // defining a new specialized classloader and setting it as the thread
+ // context classloader
+ AntClassLoader loader = null;
+ if (classpath != null) {
+ loader = new AntClassLoader(PackageBuilder.class.getClassLoader(),
+ getProject(), classpath, false);
+ } else {
+ loader = new AntClassLoader(PackageBuilder.class.getClassLoader(),
+ false);
+ }
+ loader.setThreadContextLoader();
+ return loader;
+ }
+
+ /**
+ * @param loader
+ * @return
+ */
+ private PackageBuilder getPackageBuilder(AntClassLoader loader) {
+ // creating package builder configured with the give classloader
+ PackageBuilderConfiguration conf = new PackageBuilderConfiguration(
+ loader);
+ PackageBuilder builder = new PackageBuilder(conf);
+ return builder;
+ }
+
+ /**
+ * Returns the list of files to be added into the rulebase
+ *
+ * @return
+ */
+ private String[] getFileList() {
+ // scan source directory for rule files
+ DirectoryScanner directoryScanner = getDirectoryScanner(srcdir);
+ String[] excludes = { "*\\*\\*." + DROOLSPACKAGEEXTENSION };
+ directoryScanner.setExcludes(excludes);
+ String[] fileNames = directoryScanner.getIncludedFiles();
+
+ if (fileNames == null || fileNames.length <= 0) {
+ throw new BuildException(
+ "No rule files found in include directory.");
+ }
+ return fileNames;
+ }
+
+ /**
+ * Returns the list of drools package files.
+ *
+ * @return drools package files
+ */
+ private String[] getDroolsPackageFileList() {
+ DirectoryScanner directoryScanner = getDirectoryScanner(srcdir);
+ String[] includes = { "*\\*\\*." + DROOLSPACKAGEEXTENSION };
+ directoryScanner.setIncludes(includes);
+
+ String[] fileNames = directoryScanner.getIncludedFiles();
+
+ if (fileNames == null || fileNames.length <= 0) {
+ log("no drools package files found in " + srcdir);
+ }
+ return fileNames;
+ }
+
+ private KnowledgeBuilder getKnowledgeBuilder(AntClassLoader loader) {
+ // creating package builder configured with the give classloader
+ PackageBuilderConfiguration conf = new PackageBuilderConfiguration(
+ loader);
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
+ .newKnowledgeBuilder(conf);
+ return kbuilder;
+ }
+
+ public void setBinformat(String binformat) {
+ this.binformat = binformat;
+ }
+
+ public String getBinformat() {
+ return binformat;
+ }
+
+ public String getBintype() {
+ return bintype;
+ }
+
+ public void setBintype(String bintype) {
+ this.bintype = bintype;
+ }
+
+ public void setVerbose(String verbose) {
+ this.verbose = verbose;
+ }
+
+ public String getVerbose() {
+ return verbose;
+ }
+
+}
Property changes on: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/DroolsCompilerAntTask.java
___________________________________________________________________
Added: svn:executable
+ *
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/DroolsVerifierAntTask.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/DroolsVerifierAntTask.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/DroolsVerifierAntTask.java 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,165 @@
+package org.drools.contrib;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.Reference;
+import org.drools.builder.ResourceType;
+import org.drools.compiler.DroolsParserException;
+import org.drools.io.ResourceFactory;
+import org.drools.verifier.Verifier;
+import org.drools.verifier.builder.VerifierBuilderFactory;
+import org.drools.verifier.data.VerifierReport;
+import org.drools.verifier.report.VerifierReportWriter;
+import org.drools.verifier.report.VerifierReportWriterFactory;
+
+public class DroolsVerifierAntTask extends MatchingTask {
+
+ public static final String DRLFILEEXTENSION = ".drl";
+
+ private File srcdir;
+ private File toFile;
+ private Path classpath;
+
+ /**
+ * Source directory to read DRL files from
+ *
+ * @param directory
+ */
+ public void setSrcDir(File directory) {
+ this.srcdir = directory;
+ }
+
+ /**
+ * File to serialize the rulebase to
+ *
+ * @param toFile
+ */
+ public void setToFile(File toFile) {
+ this.toFile = toFile;
+ }
+
+ /**
+ * The classpath to use when compiling the rulebase
+ *
+ * @param classpath
+ */
+ public void setClasspath(Path classpath) {
+ createClasspath().append( classpath );
+ }
+
+ /**
+ * Classpath to use, by reference, when compiling the rulebase
+ *
+ * @param r
+ * a reference to an existing classpath
+ */
+ public void setClasspathref(Reference r) {
+ createClasspath().setRefid( r );
+ }
+
+ /**
+ * Adds a path to the classpath.
+ *
+ * @return created classpath
+ */
+ public Path createClasspath() {
+ if ( this.classpath == null ) {
+ this.classpath = new Path( getProject() );
+ }
+ return this.classpath.createPath();
+ }
+
+ /**
+ * Task's main method
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ // checking parameters are set
+ if ( toFile == null ) {
+ throw new BuildException( "Destination rulebase file does not specified." );
+ }
+
+ // checking parameters are set
+ if ( srcdir == null ) {
+ throw new BuildException( "Source directory not specified." );
+ }
+
+ if ( !srcdir.exists() ) {
+ throw new BuildException( "Source directory does not exists." + srcdir.getAbsolutePath() );
+ }
+
+ try {
+
+ // create a specialized classloader
+
+ Verifier droolsanalyzer = VerifierBuilderFactory.newVerifierBuilder().newVerifier();
+
+ // get the list of files to be added to the rulebase
+ String[] fileNames = getFileList();
+
+ for ( int i = 0; i < fileNames.length; i++ ) {
+ compileAndAnalyzeFile( droolsanalyzer,
+ fileNames[i] );
+ }
+
+ droolsanalyzer.fireAnalysis();
+
+ VerifierReport result = droolsanalyzer.getResult();
+
+ VerifierReportWriter vReportWriter = VerifierReportWriterFactory.newHTMLReportWriter();
+
+ File path = new File( toFile,
+ "report.zip" );
+
+ OutputStream out = new FileOutputStream( path );
+
+ vReportWriter.writeReport( out,
+ result );
+
+ System.out.println( "Writing verifier report to " + path );
+
+ } catch ( Exception e ) {
+
+ System.out.println( e.getMessage() );
+
+ throw new BuildException( "RuleBaseTask failed: " + e.getMessage(),
+ e );
+ }
+ }
+
+ private void compileAndAnalyzeFile(Verifier droolsVerifier,
+ String filename) throws DroolsParserException {
+
+ // Verifier just works with drl files
+ if ( !filename.endsWith( DroolsVerifierAntTask.DRLFILEEXTENSION ) ) {
+ throw new UnsupportedOperationException();
+ }
+
+ droolsVerifier.addResourcesToVerify( ResourceFactory.newFileResource( new File( srcdir.getAbsolutePath(),
+ filename ) ),
+ ResourceType.DRL );
+ }
+
+ /**
+ * Returns the list of files to be added into the rulebase
+ *
+ * @return
+ */
+ private String[] getFileList() {
+ // scan source directory for rule files
+ DirectoryScanner directoryScanner = getDirectoryScanner( srcdir );
+ String[] fileNames = directoryScanner.getIncludedFiles();
+
+ if ( fileNames == null || fileNames.length <= 0 ) {
+ throw new BuildException( "No rule files found in include directory." );
+ }
+ return fileNames;
+ }
+}
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/GuvnorJRClusterConfigAntTask.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/GuvnorJRClusterConfigAntTask.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/java/org/drools/contrib/GuvnorJRClusterConfigAntTask.java 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,283 @@
+package org.drools.contrib;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.taskdefs.MatchingTask;
+
+import freemarker.template.Configuration;
+import freemarker.template.DefaultObjectWrapper;
+import freemarker.template.Template;
+
+/**
+ * Ant task to help configure JR cluster for a set of Guvnor nodes.
+ *
+ */
+public class GuvnorJRClusterConfigAntTask extends MatchingTask {
+ private String verbose; //optional
+ private String nodecount;
+ private String nodenames; //optional
+ private String destinationdir;
+ private String dbtype;
+ private String dbdriver;
+ private String dburl;
+ private String dbuser;
+ private String dbpasswd;
+ private String journalsyncdelay;
+ private String journaldbdriver;
+ private String journaldburl;
+ private String journaldbuser;
+ private String journaldbpasswd;
+
+ private List<String> nodes = new ArrayList<String>();
+ private Map<String, Map<String, Object>> repoTemplateDataMap = new HashMap<String, Map<String,Object>>();
+ private List<String> availDbTypes = Arrays.asList(new String[] {"mssql", "mysql", "oracle10g", "oracle11", "oracle9i", "postgresql"});
+ private int nodeCountVal;
+ private int journalSyncDelayVal;
+ private boolean verboseVal;
+
+ /**
+ * Task's main method
+ */
+ public void execute() throws BuildException {
+ super.execute();
+
+ verboseVal = verbose != null && verbose.equalsIgnoreCase("true");
+
+ String inputErrors = checkInput();
+ if( inputErrors.length() > 0) {
+ throw new BuildException(inputErrors);
+ }
+
+ createConfigDirectoryStructure();
+ setupRepositoryTemplateData();
+ Iterator<Entry<String, Map<String, Object>>> iter = repoTemplateDataMap.entrySet().iterator();
+ while(iter.hasNext()) {
+ Entry<String, Map<String, Object>> entry = iter.next();
+ createConfigEntries(entry.getKey(), entry.getValue());
+ }
+
+
+ }
+
+ private void createConfigEntries(String node, Map<String, Object> data) {
+ String repositoryConfig = processTemplate(dbtype+"-repository.xml", data);
+ // write configs to file system
+ try {
+ File repoFile = new File(destinationdir + "jrcluster/" + node + "/repository.xml");
+ if(!repoFile.exists()) {
+ boolean success = repoFile.createNewFile();
+ if(!success) throw new BuildException("Unable to create file [" + repoFile.getPath() + "]");
+ }
+ FileOutputStream fosr = new FileOutputStream(repoFile);
+ fosr.write(repositoryConfig.getBytes());
+ fosr.flush();
+ fosr.close();
+ } catch (Exception e) {
+ throw new BuildException(e.getMessage());
+ }
+ }
+
+ private void setupRepositoryTemplateData() {
+ for(String node : nodes) {
+ Map<String, Object> nodeMap = new HashMap<String, Object>();
+ nodeMap.put("nodeID", node);
+ nodeMap.put("dbType", dbtype);
+ nodeMap.put("dbDriver", dbdriver);
+ nodeMap.put("dbUrl", dburl);
+ nodeMap.put("dbUser", dbuser);
+ nodeMap.put("dbPass", dbpasswd);
+ nodeMap.put("journalSyncDelay", journalsyncdelay);
+ nodeMap.put("journalDriver", journaldbdriver);
+ nodeMap.put("journalUrl", journaldburl);
+ nodeMap.put("journalUser", journaldbuser);
+ nodeMap.put("journalPass", journaldbpasswd);
+
+ repoTemplateDataMap.put(node, nodeMap);
+ }
+ }
+
+ private void createConfigDirectoryStructure() {
+ // create top-level configuration directory under destinationDir
+ if(!destinationdir.endsWith("/")) destinationdir = destinationdir + "/";
+ boolean success = (new File(destinationdir + "jrcluster")).mkdir();
+ if (!success) {
+ throw new BuildException("Unable to create directory: [" + destinationdir + "jrcluster/]");
+ }
+
+ // now the node directories
+ for(int i = 0; i < nodeCountVal; i++) {
+ success = (new File(destinationdir + "jrcluster/" + nodes.get(i) )).mkdirs();
+ if (!success) {
+ throw new BuildException("Unable to create directory: [" + destinationdir + "jrcluster/" + nodes.get(i) + "]");
+ }
+ }
+ }
+
+ private String checkInput() {
+ String errors = "";
+ if(nodecount == null) {
+ errors += "\nInvalid node count.";
+ }
+ try {
+ nodeCountVal = Integer.parseInt(nodecount);
+ if(nodeCountVal <= 0) {
+ errors += "\nNode count must be greater than zero.";
+ }
+ } catch (NumberFormatException e) {
+ errors += "\nNode count is not a number";
+ }
+ if(destinationdir == null) {
+ errors += "\nInvalid destination directory.";
+ }
+ if(dbtype == null) {
+ errors += "\nInvalid database type.";
+ }
+ if(!availDbTypes.contains(dbtype)) {
+ errors += "\nInvalid db type [" + dbtype + "].";
+ }
+ if(dbdriver == null) {
+ errors += "\nInvalid database driver.";
+ }
+ if(dburl == null) {
+ errors += "\nInvalid database url.";
+ }
+ if(dbuser == null) {
+ errors += "\nInvalid database user.";
+ }
+ if(dbpasswd == null) {
+ errors += "\nInvalid database password.";
+ }
+ if(journalsyncdelay == null) {
+ errors += "\nInvalid journal sync delay.";
+ }
+ try {
+ journalSyncDelayVal = Integer.parseInt(journalsyncdelay);
+ if(journalSyncDelayVal <= 0) {
+ errors += "\nJournal sync delay must be greater than zero.";
+ }
+ } catch (NumberFormatException e) {
+ errors += "\nJournal sync delay is not a number";
+ }
+ if(journaldbdriver == null) {
+ errors += "\nInvalid journal database driver.";
+ }
+ if(journaldburl == null) {
+ errors += "\nInvalid journal database url.";
+ }
+ if(journaldbuser == null) {
+ errors += "\nInvalid journal database user.";
+ }
+ if(journaldbpasswd == null) {
+ errors += "\nInvalid journal database password.";
+ }
+
+ if(nodenames != null) {
+ nodes = Arrays.asList(nodenames.split(","));
+ if(nodes.size() != nodeCountVal) {
+ errors += "\nNumber of node names [" + nodes.size() + "] does not match given node count [" + nodecount + "]";
+ }
+ } else {
+ for(int i=0; i < nodeCountVal; i++) {
+ if(i < 10 ) {
+ nodes.add("0" + (i+1));
+ } else {
+ nodes.add( (i+1) + "");
+ }
+ }
+ }
+
+ return errors;
+ }
+
+ private String processTemplate(String name, Map<String, Object> data) {
+ if(verboseVal) {
+ log("Processing template [" + name + "] with data: ");
+ for(String key : data.keySet()) {
+ log("\t" + key + " - " + data.get(key));
+ }
+ }
+ try {
+ Configuration cfg = new Configuration();
+ cfg.setObjectWrapper( new DefaultObjectWrapper() );
+ cfg.setTemplateUpdateDelay( 0 );
+
+ Template temp = new Template( name,
+ new InputStreamReader( GuvnorJRClusterConfigAntTask.class.getResourceAsStream( "/jrcluster/templates/repository/" + name ) ),
+ cfg );
+ StringWriter strw = new StringWriter();
+ temp.process( data, strw );
+ return strw.toString();
+ } catch (Exception e) {
+ log("Exception processing template: " + e.getMessage());
+ return null;
+ }
+ }
+
+ public void setNodecount(String nodecount) {
+ this.nodecount = nodecount;
+ }
+
+ public void setNodenames(String nodenames) {
+ this.nodenames = nodenames;
+ }
+
+ public void setDestinationdir(String destinationdir) {
+ this.destinationdir = destinationdir;
+ }
+ public void setDbtype(String dbtype) {
+ this.dbtype = dbtype;
+ }
+
+ public void setDbdriver(String dbdriver) {
+ this.dbdriver = dbdriver;
+ }
+
+ public void setDburl(String dburl) {
+ this.dburl = dburl;
+ }
+
+ public void setDbuser(String dbuser) {
+ this.dbuser = dbuser;
+ }
+
+ public void setDbpasswd(String dbpasswd) {
+ this.dbpasswd = dbpasswd;
+ }
+
+ public void setJournaldbdriver(String journaldbdriver) {
+ this.journaldbdriver = journaldbdriver;
+ }
+
+ public void setJournaldburl(String journaldburl) {
+ this.journaldburl = journaldburl;
+ }
+
+ public void setJournaldbuser(String journaldbuser) {
+ this.journaldbuser = journaldbuser;
+ }
+
+ public void setJournaldbpasswd(String journaldbpasswd) {
+ this.journaldbpasswd = journaldbpasswd;
+ }
+
+ public void setJournalsyncdelay(String journalsyncdelay) {
+ this.journalsyncdelay = journalsyncdelay;
+ }
+
+ public void setVerbose(String verbose) {
+ this.verbose = verbose;
+ }
+
+}
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/mssql-repository.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/mssql-repository.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/mssql-repository.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.4//EN"
+ "http://jackrabbit.apache.org/dtd/repository-1.4.dtd">
+<!-- Example Repository Configuration File -->
+<Repository>
+ <!-- Clustering configuration -->
+ <Cluster id="${nodeID}" syncDelay="${journalSyncDelay}">
+ <Journal class="org.apache.jackrabbit.core.journal.MSSqlDatabaseJournal">
+ <#noparse><param name="revision" value="${rep.home}/revision.log" /></#noparse>
+ <param name="driver" value="${journalDriver}" />
+ <param name="url" value="${journalUrl}" />
+ <param name="user" value="${journalUser}"/>
+ <param name="password" value="${journalPass}"/>
+ </Journal>
+ </Cluster>
+
+ <!--
+ virtual file system where the repository stores global state
+ (e.g. registered namespaces, custom node types, etc.)
+ -->
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="schema" value="mssql"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schemaObjectPrefix" value="FS_"/>
+
+ </FileSystem>
+
+ <!--
+ security configuration
+ -->
+ <Security appName="Jackrabbit">
+ <!--
+ access manager:
+ class: FQN of class implementing the AccessManager interface
+ -->
+ <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+ <!-- <#noparse> <param name="config" value="${rep.home}/access.xml"/> </#noparse> -->
+ </AccessManager>
+
+ <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+ <!-- anonymous user name ('anonymous' is the default value) -->
+ <!-- <param name="anonymousId" value="anonymous"/> -->
+ <!--
+ default user name to be used instead of the anonymous user
+ when no login credentials are provided (unset by default)
+ -->
+ <!-- <param name="defaultUserId" value="superuser"/> -->
+ </LoginModule>
+ </Security>
+
+ <!--
+ location of workspaces root directory and name of default workspace
+ -->
+ <#noparse><Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/></#noparse>
+ <!--
+ workspace configuration template:
+ used to create the initial workspace if there's no workspace yet
+ -->
+ <#noparse><Workspace name="${wsp.name}"></#noparse>
+ <!--
+ virtual file system of the workspace:
+ class: FQN of class implementing the FileSystem interface
+ -->
+
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="mssql"/>
+ <#noparse><param name="schemaObjectPrefix" value="FS_WS_${wsp.name}_"/></#noparse>
+ </FileSystem>
+
+ <!--
+ persistence manager of the workspace:
+ class: FQN of class implementing the PersistenceManager interface
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MSSqlPersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="mssql"/>
+ <#noparse><param name="schemaObjectPrefix" value="PM_WS_${wsp.name}_" /></#noparse>
+ </PersistenceManager>
+
+ <!--
+ Search index and the file system it uses.
+ class: FQN of class implementing the QueryHandler interface
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${wsp.home}/index"/></#noparse>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+ </Workspace>
+
+ <!--
+ Configures the versioning
+ -->
+ <#noparse><Versioning rootPath="${rep.home}/version"></#noparse>
+ <!--
+ Configures the filesystem to use for versioning for the respective
+ persistence manager
+ -->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.MSSqlFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="mssql"/>
+ <param name="schemaObjectPrefix" value="Versioning_FS_"/>
+ </FileSystem>
+
+ <!--
+ Configures the persistence manager to be used for persisting version state.
+ Please note that the current versioning implementation is based on
+ a 'normal' persistence manager, but this could change in future
+ implementations.
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MSSqlPersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="mssql"/>
+ <param name="schemaObjectPrefix" value="Versioning_PM_" />
+ </PersistenceManager>
+
+
+ </Versioning>
+
+ <!--
+ Search index for content that is shared repository wide
+ (/jcr:system tree, contains mainly versions)
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${rep.home}/repository/index"/></#noparse>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+</Repository>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/mysql-repository.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/mysql-repository.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/mysql-repository.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.4//EN"
+ "http://jackrabbit.apache.org/dtd/repository-1.4.dtd">
+<Repository>
+ <!-- Clustering configuration -->
+ <Cluster id="${nodeID}" syncDelay="${journalSyncDelay}">
+ <Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal">
+ <#noparse><param name="revision" value="${rep.home}/revision.log" /></#noparse>
+ <param name="driver" value="${journalDriver}" />
+ <param name="url" value="${journalUrl}" />
+ <param name="user" value="${journalUser}"/>
+ <param name="password" value="${journalPass}"/>
+ <param name="databaseType" value="${dbType}"/>
+ </Journal>
+ </Cluster>
+ <!--
+ virtual file system where the repository stores global state
+ (e.g. registered namespaces, custom node types, etc.)
+ -->
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="mysql"/>
+ <param name="schemaObjectPrefix" value="FS_"/>
+
+ </FileSystem>
+
+ <!--
+ security configuration
+ -->
+ <Security appName="Jackrabbit">
+ <!--
+ access manager:
+ class: FQN of class implementing the AccessManager interface
+ -->
+ <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+ <!-- <#noparse>
+ <param name="config" value="${rep.home}/access.xml"/> </#noparse>-->
+ </AccessManager>
+
+ <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+ <!-- anonymous user name ('anonymous' is the default value) -->
+ <!-- <param name="anonymousId" value="anonymous"/> -->
+ <!--
+ default user name to be used instead of the anonymous user
+ when no login credentials are provided (unset by default)
+ -->
+ <!-- <param name="defaultUserId" value="superuser"/> -->
+ </LoginModule>
+ </Security>
+
+ <!--
+ location of workspaces root directory and name of default workspace
+ -->
+ <#noparse><Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/></#noparse>
+ <!--
+ workspace configuration template:
+ used to create the initial workspace if there's no workspace yet
+ -->
+ <#noparse><Workspace name="${wsp.name}"></#noparse>
+ <!--
+ virtual file system of the workspace:
+ class: FQN of class implementing the FileSystem interface
+ -->
+
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="mysql"/>
+ <#noparse><param name="schemaObjectPrefix" value="FS_WS_${wsp.name}_"/></#noparse>
+ </FileSystem>
+
+ <!--
+ persistence manager of the workspace:
+ class: FQN of class implementing the PersistenceManager interface
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="mysql"/>
+ <#noparse><param name="schemaObjectPrefix" value="PM_WS_${wsp.name}_" /></#noparse>
+ </PersistenceManager>
+
+ <!--
+ Search index and the file system it uses.
+ class: FQN of class implementing the QueryHandler interface
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${wsp.home}/index"/></#noparse>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+ </Workspace>
+
+ <!--
+ Configures the versioning
+ -->
+ <#noparse><Versioning rootPath="${rep.home}/version"></#noparse>
+ <!--
+ Configures the filesystem to use for versioning for the respective
+ persistence manager
+ -->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="mysql"/>
+ <param name="schemaObjectPrefix" value="Versioning_FS_"/>
+ </FileSystem>
+
+ <!--
+ Configures the persistence manager to be used for persisting version state.
+ Please note that the current versioning implementation is based on
+ a 'normal' persistence manager, but this could change in future
+ implementations.
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="mysql"/>
+ <param name="schemaObjectPrefix" value="Versioning_PM_" />
+ </PersistenceManager>
+
+
+ </Versioning>
+
+ <!--
+ Search index for content that is shared repository wide
+ (/jcr:system tree, contains mainly versions)
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${rep.home}/repository/index"/></#noparse>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+</Repository>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle10g-repository.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle10g-repository.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle10g-repository.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.4//EN"
+ "http://jackrabbit.apache.org/dtd/repository-1.4.dtd">
+<!-- Example Repository Configuration File -->
+<Repository>
+ <!-- Clustering configuration -->
+ <Cluster id="${nodeID}" syncDelay="${journalSyncDelay}">
+ <Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
+ <#noparse><param name="revision" value="${rep.home}/revision.log" /></#noparse>
+ <param name="driver" value="${journalDriver}" />
+ <param name="url" value="${journalUrl}" />
+ <param name="user" value="${journalUser}"/>
+ <param name="password" value="${journalPass}"/>
+ </Journal>
+ </Cluster>
+ <!--
+ virtual file system where the repository stores global state
+ (e.g. registered namespaces, custom node types, etc.)
+ -->
+<!--
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <#noparse><param name="path" value="${rep.home}/repository"/></#noparse>
+ </FileSystem>
+-->
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="schemaObjectPrefix" value="FS_"/>
+ </FileSystem>
+ <!--
+ security configuration
+ -->
+ <Security appName="Jackrabbit">
+ <!--
+ access manager:
+ class: FQN of class implementing the AccessManager interface
+ -->
+ <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+ <!-- <#noparse><param name="config" value="${rep.home}/access.xml"/></#noparse> -->
+ </AccessManager>
+
+ <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+ <!-- anonymous user name ('anonymous' is the default value) -->
+ <!-- <param name="anonymousId" value="anonymous"/> -->
+ <!--
+ default user name to be used instead of the anonymous user
+ when no login credentials are provided (unset by default)
+ -->
+ <!-- <param name="defaultUserId" value="superuser"/> -->
+ </LoginModule>
+ </Security>
+
+ <!--
+ location of workspaces root directory and name of default workspace
+ -->
+ <#noparse><Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/></#noparse>
+ <!--
+ workspace configuration template:
+ used to create the initial workspace if there's no workspace yet
+ -->
+ <#noparse><Workspace name="${wsp.name}"></#noparse>
+ <!--
+ virtual file system of the workspace:
+ class: FQN of class implementing the FileSystem interface
+ -->
+
+<!--
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <#noparse><param name="path" value="${wsp.home}"/></#noparse>
+ </FileSystem>
+-->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <#noparse><param name="schemaObjectPrefix" value="FS_WS_${wsp.name}_"/></#noparse>
+ </FileSystem>
+ <!--
+ persistence manager of the workspace:
+ class: FQN of class implementing the PersistenceManager interface
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="tableSpace" value=""/>
+ <param name="externalBLOBs" value="false"/>
+ <#noparse><param name="schemaObjectPrefix" value="PM_WS_${wsp.name}_" /></#noparse>
+ </PersistenceManager>
+
+ <!--
+ Search index and the file system it uses.
+ class: FQN of class implementing the QueryHandler interface
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${wsp.home}/index"/></#noparse>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+ </Workspace>
+
+ <!--
+ Configures the versioning
+ -->
+ <#noparse><Versioning rootPath="${rep.home}/version"></#noparse>
+ <!--
+ Configures the filesystem to use for versioning for the respective
+ persistence manager
+ -->
+<!--
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <#noparse><param name="path" value="${rep.home}/version" /></#noparse>
+ </FileSystem>
+-->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="schemaObjectPrefix" value="Versioning_FS_"/>
+ </FileSystem>
+ <!--
+ Configures the persistence manager to be used for persisting version state.
+ Please note that the current versioning implementation is based on
+ a 'normal' persistence manager, but this could change in future
+ implementations.
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="tableSpace" value=""/>
+ <param name="externalBLOBs" value="false"/>
+ <param name="schemaObjectPrefix" value="Versioning_PM_" />
+ </PersistenceManager>
+
+
+ </Versioning>
+
+ <!--
+ Search index for content that is shared repository wide
+ (/jcr:system tree, contains mainly versions)
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${rep.home}/repository/index"/></#noparse>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+</Repository>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle11-repository.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle11-repository.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle11-repository.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.4//EN"
+ "http://jackrabbit.apache.org/dtd/repository-1.4.dtd">
+<!-- Example Repository Configuration File -->
+<Repository>
+ <!-- Clustering configuration -->
+ <Cluster id="${nodeID}" syncDelay="${journalSyncDelay}">
+ <Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
+ <#noparse><param name="revision" value="${rep.home}/revision.log" /></#noparse>
+ <param name="driver" value="${journalDriver}" />
+ <param name="url" value="${journalUrl}" />
+ <param name="user" value="${journalUser}"/>
+ <param name="password" value="${journalPass}"/>
+ </Journal>
+ </Cluster>
+ <!--
+ virtual file system where the repository stores global state
+ (e.g. registered namespaces, custom node types, etc.)
+ -->
+<!--
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <#noparse><param name="path" value="${rep.home}/repository"/></#noparse>
+ </FileSystem>
+-->
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="schemaObjectPrefix" value="FS_"/>
+ </FileSystem>
+ <!--
+ security configuration
+ -->
+ <Security appName="Jackrabbit">
+ <!--
+ access manager:
+ class: FQN of class implementing the AccessManager interface
+ -->
+ <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+ <#noparse><!-- <param name="config" value="${rep.home}/access.xml"/> --></#noparse>
+ </AccessManager>
+
+ <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+ <!-- anonymous user name ('anonymous' is the default value) -->
+ <!-- <param name="anonymousId" value="anonymous"/> -->
+ <!--
+ default user name to be used instead of the anonymous user
+ when no login credentials are provided (unset by default)
+ -->
+ <!-- <param name="defaultUserId" value="superuser"/> -->
+ </LoginModule>
+ </Security>
+
+ <!--
+ location of workspaces root directory and name of default workspace
+ -->
+ <#noparse><Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/></#noparse>
+ <!--
+ workspace configuration template:
+ used to create the initial workspace if there's no workspace yet
+ -->
+ <#noparse><Workspace name="${wsp.name}"></#noparse>
+ <!--
+ virtual file system of the workspace:
+ class: FQN of class implementing the FileSystem interface
+ -->
+
+<!--
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <#noparse><param name="path" value="${wsp.home}"/></#noparse>
+ </FileSystem>
+-->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <#noparse><param name="schemaObjectPrefix" value="FS_WS_${wsp.name}_"/></#noparse>
+ </FileSystem>
+ <!--
+ persistence manager of the workspace:
+ class: FQN of class implementing the PersistenceManager interface
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="tableSpace" value=""/>
+ <param name="externalBLOBs" value="false"/>
+ <#noparse><param name="schemaObjectPrefix" value="PM_WS_${wsp.name}_" /></#noparse>
+ </PersistenceManager>
+
+ <!--
+ Search index and the file system it uses.
+ class: FQN of class implementing the QueryHandler interface
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${wsp.home}/index"/></#noparse>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+ </Workspace>
+
+ <!--
+ Configures the versioning
+ -->
+ <#noparse><Versioning rootPath="${rep.home}/version"></#noparse>
+ <!--
+ Configures the filesystem to use for versioning for the respective
+ persistence manager
+ -->
+<!--
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <#noparse><param name="path" value="${rep.home}/version" /></#noparse>
+ </FileSystem>
+-->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="schemaObjectPrefix" value="Versioning_FS_"/>
+ </FileSystem>
+ <!--
+ Configures the persistence manager to be used for persisting version state.
+ Please note that the current versioning implementation is based on
+ a 'normal' persistence manager, but this could change in future
+ implementations.
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.OraclePersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="tableSpace" value=""/>
+ <param name="externalBLOBs" value="false"/>
+ <param name="schemaObjectPrefix" value="Versioning_PM_" />
+ </PersistenceManager>
+
+
+ </Versioning>
+
+ <!--
+ Search index for content that is shared repository wide
+ (/jcr:system tree, contains mainly versions)
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${rep.home}/repository/index"/></#noparse>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+</Repository>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle9i-repository.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle9i-repository.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/oracle9i-repository.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,179 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.4//EN"
+ "http://jackrabbit.apache.org/dtd/repository-1.4.dtd">
+<!-- Example Repository Configuration File -->
+<Repository>
+ <!-- Clustering configuration -->
+ <Cluster id="${nodeID}" syncDelay="${journalSyncDelay}">
+ <Journal class="org.apache.jackrabbit.core.journal.OracleDatabaseJournal">
+ <#noparse><param name="revision" value="${rep.home}/revision.log" /></#noparse>
+ <param name="driver" value="${journalDriver}" />
+ <param name="url" value="${journalUrl}" />
+ <param name="user" value="${journalUser}"/>
+ <param name="password" value="${journalPass}"/>
+ </Journal>
+ </Cluster>
+ <!--
+ virtual file system where the repository stores global state
+ (e.g. registered namespaces, custom node types, etc.)
+ -->
+<!--
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <#noparse><param name="path" value="${rep.home}/repository"/></#noparse>
+ </FileSystem>
+-->
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="schemaObjectPrefix" value="FS_"/>
+ </FileSystem>
+ <!--
+ security configuration
+ -->
+ <Security appName="Jackrabbit">
+ <!--
+ access manager:
+ class: FQN of class implementing the AccessManager interface
+ -->
+ <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+ <!-- <#noparse><param name="config" value="${rep.home}/access.xml"/></#noparse> -->
+ </AccessManager>
+
+ <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+ <!-- anonymous user name ('anonymous' is the default value) -->
+ <!-- <param name="anonymousId" value="anonymous"/> -->
+ <!--
+ default user name to be used instead of the anonymous user
+ when no login credentials are provided (unset by default)
+ -->
+ <!-- <param name="defaultUserId" value="superuser"/> -->
+ </LoginModule>
+ </Security>
+
+ <!--
+ location of workspaces root directory and name of default workspace
+ -->
+ <#noparse><Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/></#noparse>
+ <!--
+ workspace configuration template:
+ used to create the initial workspace if there's no workspace yet
+ -->
+ <#noparse><Workspace name="${wsp.name}"></#noparse>
+ <!--
+ virtual file system of the workspace:
+ class: FQN of class implementing the FileSystem interface
+ -->
+<!--
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <#noparse><param name="path" value="${wsp.home}"/></#noparse>
+ </FileSystem>
+-->
+
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <#noparse><param name="schemaObjectPrefix" value="FS_WS_${wsp.name}_"/></#noparse>
+ </FileSystem>
+
+ <!--
+ persistence manager of the workspace:
+ class: FQN of class implementing the PersistenceManager interface
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.Oracle9PersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <#noparse><param name="schemaObjectPrefix" value="PM_WS_${wsp.name}_" /></#noparse>
+ </PersistenceManager>
+
+ <!--
+ Search index and the file system it uses.
+ class: FQN of class implementing the QueryHandler interface
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${wsp.home}/index"/></#noparse>
+ <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+ </Workspace>
+
+ <!--
+ Configures the versioning
+ -->
+ <#noparse><Versioning rootPath="${rep.home}/version"></#noparse>
+ <!--
+ Configures the filesystem to use for versioning for the respective
+ persistence manager
+ -->
+<!--
+ <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+ <#noparse><param name="path" value="${rep.home}/version" /></#noparse>
+ </FileSystem>
+-->
+
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.OracleFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="schemaObjectPrefix" value="Versioning_FS_"/>
+ </FileSystem>
+
+ <!--
+ Configures the persistence manager to be used for persisting version state.
+ Please note that the current versioning implementation is based on
+ a 'normal' persistence manager, but this could change in future
+ implementations.
+ -->
+
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.Oracle9PersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="oracle"/>
+ <param name="schemaObjectPrefix" value="Versioning_PM_" />
+ </PersistenceManager>
+
+
+ </Versioning>
+
+ <!--
+ Search index for content that is shared repository wide
+ (/jcr:system tree, contains mainly versions)
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${rep.home}/repository/index"/></#noparse>
+ <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+</Repository>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/postgresql-repository.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/postgresql-repository.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/main/resources/jrcluster/templates/repository/postgresql-repository.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,166 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.4//EN"
+ "http://jackrabbit.apache.org/dtd/repository-1.4.dtd">
+<!-- Example Repository Configuration File -->
+<Repository>
+ <!-- Clustering configuration -->
+ <Cluster id="${nodeID}" syncDelay="${journalSyncDelay}">
+ <Journal class="org.apache.jackrabbit.core.journal.DatabaseJournal">
+ <#noparse><param name="revision" value="${rep.home}/revision.log" /></#noparse>
+ <param name="driver" value="${journalDriver}" />
+ <param name="url" value="${journalUrl}" />
+ <param name="user" value="${journalUser}"/>
+ <param name="password" value="${journalPass}"/>
+ <param name="databaseType" value="${dbType}"/>
+ </Journal>
+ </Cluster>
+ <!--
+ virtual file system where the repository stores global state
+ (e.g. registered namespaces, custom node types, etc.)
+ -->
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="postgresql"/>
+ <param name="schemaObjectPrefix" value="FS_"/>
+ </FileSystem>
+
+ <!--
+ security configuration
+ -->
+ <Security appName="Jackrabbit">
+ <!--
+ access manager:
+ class: FQN of class implementing the AccessManager interface
+ -->
+ <AccessManager class="org.apache.jackrabbit.core.security.SimpleAccessManager">
+ <!-- <#noparse><param name="config" value="${rep.home}/access.xml"/></#noparse> -->
+ </AccessManager>
+
+ <LoginModule class="org.apache.jackrabbit.core.security.SimpleLoginModule">
+ <!-- anonymous user name ('anonymous' is the default value) -->
+ <!-- <param name="anonymousId" value="anonymous"/> -->
+ <!--
+ default user name to be used instead of the anonymous user
+ when no login credentials are provided (unset by default)
+ -->
+ <!-- <param name="defaultUserId" value="superuser"/> -->
+ </LoginModule>
+ </Security>
+
+ <!--
+ location of workspaces root directory and name of default workspace
+ -->
+ <#noparse><Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/></#noparse>
+ <!--
+ workspace configuration template:
+ used to create the initial workspace if there's no workspace yet
+ -->
+ <#noparse><Workspace name="${wsp.name}"></#noparse>
+ <!--
+ virtual file system of the workspace:
+ class: FQN of class implementing the FileSystem interface
+ -->
+
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="postgresql"/>
+ <#noparse><param name="schemaObjectPrefix" value="FS_WS_${wsp.name}_"/></#noparse>
+ </FileSystem>
+
+ <!--
+ persistence manager of the workspace:
+ class: FQN of class implementing the PersistenceManager interface
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="postgresql"/>
+ <#noparse><param name="schemaObjectPrefix" value="PM_WS_${wsp.name}_" /></#noparse>
+ <param name="externalBLOBs" value="false"/>
+ </PersistenceManager>
+
+ <!--
+ Search index and the file system it uses.
+ class: FQN of class implementing the QueryHandler interface
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${wsp.home}/index"/></#noparse>
+ <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+ </Workspace>
+
+ <!--
+ Configures the versioning
+ -->
+ <#noparse><Versioning rootPath="${rep.home}/version"></#noparse>
+ <!--
+ Configures the filesystem to use for versioning for the respective
+ persistence manager
+ -->
+
+ <FileSystem class="org.apache.jackrabbit.core.fs.db.DbFileSystem">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="postgresql"/>
+ <param name="schemaObjectPrefix" value="Versioning_FS_"/>
+ </FileSystem>
+
+ <!--
+ Configures the persistence manager to be used for persisting version state.
+ Please note that the current versioning implementation is based on
+ a 'normal' persistence manager, but this could change in future
+ implementations.
+ -->
+ <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
+ <param name="driver" value="${dbDriver}"/>
+ <param name="url" value="${dbUrl}"/>
+ <param name="user" value="${dbUser}"/>
+ <param name="password" value="${dbPass}"/>
+ <param name="schema" value="postgresql"/>
+ <param name="schemaObjectPrefix" value="Versioning_PM_" />
+ <param name="externalBLOBs" value="false"/>
+ </PersistenceManager>
+
+
+ </Versioning>
+
+ <!--
+ Search index for content that is shared repository wide
+ (/jcr:system tree, contains mainly versions)
+ -->
+ <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+ <#noparse><param name="path" value="${rep.home}/repository/index"/></#noparse>
+ <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
+ <param name="extractorPoolSize" value="2"/>
+ <param name="supportHighlighting" value="true"/>
+ </SearchIndex>
+</Repository>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/BuildFileTest.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/BuildFileTest.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/BuildFileTest.java 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,506 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.drools.contrib;
+
+import java.io.File;
+import java.io.PrintStream;
+import java.net.URL;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildListener;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+
+/**
+ * A BuildFileTest is a TestCase which executes targets from an Ant buildfile
+ * for testing.
+ *
+ * This class provides a number of utility methods for particular build file
+ * tests which extend this class.
+ *
+ */
+public abstract class BuildFileTest {
+
+ protected Project project;
+
+ private StringBuffer logBuffer;
+ private StringBuffer fullLogBuffer;
+ private StringBuffer outBuffer;
+ private StringBuffer errBuffer;
+ private BuildException buildException;
+
+ /**
+ * run a target, expect for any build exception
+ *
+ *@param target target to run
+ *@param cause information string to reader of report
+ */
+ protected void expectBuildException(String target,
+ String cause) {
+ expectSpecificBuildException( target,
+ cause,
+ null );
+ }
+
+ /**
+ * Assert that only the given message has been logged with a
+ * priority >= INFO when running the given target.
+ */
+ protected void expectLog(String target,
+ String log) {
+ executeTarget( target );
+ String realLog = getLog();
+ assertEquals( log,
+ realLog );
+ }
+
+ /**
+ * Assert that the given substring is in the log messages
+ */
+
+ protected void assertLogContaining(String substring) {
+ String realLog = getLog();
+ assertTrue( "expecting log to contain \"" + substring + "\" log was \"" + realLog + "\"",
+ realLog.indexOf( substring ) >= 0 );
+ }
+
+ /**
+ * Assert that the given message has been logged with a priority
+ * >= INFO when running the given target.
+ */
+ protected void expectLogContaining(String target,
+ String log) {
+ executeTarget( target );
+ assertLogContaining( log );
+ }
+
+ /**
+ * Gets the log the BuildFileTest object.
+ * only valid if configureProject() has
+ * been called.
+ * @pre logBuffer!=null
+ * @return The log value
+ */
+ protected String getLog() {
+ return logBuffer.toString();
+ }
+
+ /**
+ * Assert that the given message has been logged with a priority
+ * >= DEBUG when running the given target.
+ */
+ protected void expectDebuglog(String target,
+ String log) {
+ executeTarget( target );
+ String realLog = getFullLog();
+ assertEquals( log,
+ realLog );
+ }
+
+ /**
+ * Gets the log the BuildFileTest object.
+ * only valid if configureProject() has
+ * been called.
+ * @pre fullLogBuffer!=null
+ * @return The log value
+ */
+ protected String getFullLog() {
+ return fullLogBuffer.toString();
+ }
+
+ /**
+ * execute the target, verify output matches expectations
+ *
+ *@param target target to execute
+ *@param output output to look for
+ */
+
+ protected void expectOutput(String target,
+ String output) {
+ executeTarget( target );
+ String realOutput = getOutput();
+ assertEquals( output,
+ realOutput.trim() );
+ }
+
+ /**
+ * execute the target, verify output matches expectations
+ * and that we got the named error at the end
+ *@param target target to execute
+ *@param output output to look for
+ *@param error Description of Parameter
+ */
+
+ protected void expectOutputAndError(String target,
+ String output,
+ String error) {
+ executeTarget( target );
+ String realOutput = getOutput();
+ assertEquals( output,
+ realOutput );
+ String realError = getError();
+ assertEquals( error,
+ realError );
+ }
+
+ protected String getOutput() {
+ return cleanBuffer( outBuffer );
+ }
+
+ protected String getError() {
+ return cleanBuffer( errBuffer );
+ }
+
+ protected BuildException getBuildException() {
+ return buildException;
+ }
+
+ private String cleanBuffer(StringBuffer buffer) {
+ StringBuffer cleanedBuffer = new StringBuffer();
+ boolean cr = false;
+ for ( int i = 0; i < buffer.length(); i++ ) {
+ char ch = buffer.charAt( i );
+ if ( ch == '\r' ) {
+ cr = true;
+ continue;
+ }
+
+ if ( !cr ) {
+ cleanedBuffer.append( ch );
+ } else {
+ cleanedBuffer.append( ch );
+ }
+ }
+ return cleanedBuffer.toString();
+ }
+
+ /**
+ * set up to run the named project
+ *
+ * @param filename name of project file to run
+ */
+ protected void configureProject(String filename) throws BuildException {
+ configureProject( filename,
+ Project.MSG_DEBUG );
+ }
+
+ /**
+ * set up to run the named project
+ *
+ * @param filename name of project file to run
+ */
+ protected void configureProject(String filename,
+ int logLevel) throws BuildException {
+ logBuffer = new StringBuffer();
+ fullLogBuffer = new StringBuffer();
+ project = new Project();
+ project.init();
+ project.setUserProperty( "ant.file",
+ new File( filename ).getAbsolutePath() );
+ project.addBuildListener( new AntTestListener( logLevel ) );
+ ProjectHelper.configureProject( project,
+ new File( filename ) );
+ }
+
+ /**
+ * execute a target we have set up
+ * @pre configureProject has been called
+ * @param targetName target to run
+ */
+ protected void executeTarget(String targetName) {
+ PrintStream sysOut = System.out;
+ PrintStream sysErr = System.err;
+ try {
+ sysOut.flush();
+ sysErr.flush();
+ outBuffer = new StringBuffer();
+ PrintStream out = new PrintStream( new AntOutputStream( outBuffer ) );
+ System.setOut( out );
+ errBuffer = new StringBuffer();
+ PrintStream err = new PrintStream( new AntOutputStream( errBuffer ) );
+ System.setErr( err );
+ logBuffer = new StringBuffer();
+ fullLogBuffer = new StringBuffer();
+ buildException = null;
+ project.executeTarget( targetName );
+ } finally {
+ System.setOut( sysOut );
+ System.setErr( sysErr );
+ }
+
+ }
+
+ /**
+ * Get the project which has been configured for a test.
+ *
+ * @return the Project instance for this test.
+ */
+ protected Project getProject() {
+ return project;
+ }
+
+ /**
+ * get the directory of the project
+ * @return the base dir of the project
+ */
+ protected File getProjectDir() {
+ return project.getBaseDir();
+ }
+
+ /**
+ * run a target, wait for a build exception
+ *
+ *@param target target to run
+ *@param cause information string to reader of report
+ *@param msg the message value of the build exception we are waiting for
+ set to null for any build exception to be valid
+ */
+ protected void expectSpecificBuildException(String target,
+ String cause,
+ String msg) {
+ try {
+ executeTarget( target );
+ } catch ( org.apache.tools.ant.BuildException ex ) {
+ buildException = ex;
+ if ( (null != msg) && (!ex.getMessage().equals( msg )) ) {
+ fail( "Should throw BuildException because '" + cause + "' with message '" + msg + "' (actual message '" + ex.getMessage() + "' instead)" );
+ }
+ return;
+ }
+ fail( "Should throw BuildException because: " + cause );
+ }
+
+ /**
+ * run a target, expect an exception string
+ * containing the substring we look for (case sensitive match)
+ *
+ *@param target target to run
+ *@param cause information string to reader of report
+ *@param contains substring of the build exception to look for
+ */
+ protected void expectBuildExceptionContaining(String target,
+ String cause,
+ String contains) {
+ try {
+ executeTarget( target );
+ } catch ( org.apache.tools.ant.BuildException ex ) {
+ buildException = ex;
+ if ( (null != contains) && (ex.getMessage().indexOf( contains ) == -1) ) {
+ fail( "Should throw BuildException because '" + cause + "' with message containing '" + contains + "' (actual message '" + ex.getMessage() + "' instead)" );
+ }
+ return;
+ }
+ fail( "Should throw BuildException because: " + cause );
+ }
+
+ /**
+ * call a target, verify property is as expected
+ *
+ * @param target build file target
+ * @param property property name
+ * @param value expected value
+ */
+
+ protected void expectPropertySet(String target,
+ String property,
+ String value) {
+ executeTarget( target );
+ assertPropertyEquals( property,
+ value );
+ }
+
+ /**
+ * assert that a property equals a value; comparison is case sensitive.
+ * @param property property name
+ * @param value expected value
+ */
+ protected void assertPropertyEquals(String property,
+ String value) {
+ String result = project.getProperty( property );
+ assertEquals( "property " + property,
+ value,
+ result );
+ }
+
+ /**
+ * assert that a property equals "true"
+ * @param property property name
+ */
+ protected void assertPropertySet(String property) {
+ assertPropertyEquals( property,
+ "true" );
+ }
+
+ /**
+ * assert that a property is null
+ * @param property property name
+ */
+ protected void assertPropertyUnset(String property) {
+ assertPropertyEquals( property,
+ null );
+ }
+
+ /**
+ * call a target, verify named property is "true".
+ *
+ * @param target build file target
+ * @param property property name
+ */
+ protected void expectPropertySet(String target,
+ String property) {
+ expectPropertySet( target,
+ property,
+ "true" );
+ }
+
+ /**
+ * call a target, verify property is null
+ * @param target build file target
+ * @param property property name
+ */
+ protected void expectPropertyUnset(String target,
+ String property) {
+ expectPropertySet( target,
+ property,
+ null );
+ }
+
+ /**
+ * Retrieve a resource from the caller classloader to avoid
+ * assuming a vm working directory. The resource path must be
+ * relative to the package name or absolute from the root path.
+ * @param resource the resource to retrieve its url.
+ */
+ protected URL getResource(String resource) {
+ URL url = getClass().getResource( resource );
+ assertNotNull( "Could not find resource :" + resource,
+ url );
+ return url;
+ }
+
+ /**
+ * an output stream which saves stuff to our buffer.
+ */
+ private static class AntOutputStream extends java.io.OutputStream {
+ private StringBuffer buffer;
+
+ public AntOutputStream(StringBuffer buffer) {
+ this.buffer = buffer;
+ }
+
+ public void write(int b) {
+ buffer.append( (char) b );
+ }
+ }
+
+ /**
+ * our own personal build listener
+ */
+ private class AntTestListener
+ implements
+ BuildListener {
+ private int logLevel;
+
+ /**
+ * Constructs a test listener which will ignore log events
+ * above the given level
+ */
+ public AntTestListener(int logLevel) {
+ this.logLevel = logLevel;
+ }
+
+ /**
+ * Fired before any targets are started.
+ */
+ public void buildStarted(BuildEvent event) {
+ }
+
+ /**
+ * Fired after the last target has finished. This event
+ * will still be thrown if an error occured during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void buildFinished(BuildEvent event) {
+ }
+
+ /**
+ * Fired when a target is started.
+ *
+ * @see BuildEvent#getTarget()
+ */
+ public void targetStarted(BuildEvent event) {
+ //System.out.println("targetStarted " + event.getTarget().getName());
+ }
+
+ /**
+ * Fired when a target has finished. This event will
+ * still be thrown if an error occured during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void targetFinished(BuildEvent event) {
+ //System.out.println("targetFinished " + event.getTarget().getName());
+ }
+
+ /**
+ * Fired when a task is started.
+ *
+ * @see BuildEvent#getTask()
+ */
+ public void taskStarted(BuildEvent event) {
+ //System.out.println("taskStarted " + event.getTask().getTaskName());
+ }
+
+ /**
+ * Fired when a task has finished. This event will still
+ * be throw if an error occured during the build.
+ *
+ * @see BuildEvent#getException()
+ */
+ public void taskFinished(BuildEvent event) {
+ //System.out.println("taskFinished " + event.getTask().getTaskName());
+ }
+
+ /**
+ * Fired whenever a message is logged.
+ *
+ * @see BuildEvent#getMessage()
+ * @see BuildEvent#getPriority()
+ */
+ public void messageLogged(BuildEvent event) {
+ if ( event.getPriority() > logLevel ) {
+ // ignore event
+ return;
+ }
+
+ if ( event.getPriority() == Project.MSG_INFO || event.getPriority() == Project.MSG_WARN || event.getPriority() == Project.MSG_ERR ) {
+ logBuffer.append( event.getMessage() );
+ }
+ fullLogBuffer.append( event.getMessage() );
+
+ }
+ }
+
+}
Property changes on: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/BuildFileTest.java
___________________________________________________________________
Added: svn:executable
+ *
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/Cheese.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/Cheese.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/Cheese.java 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,66 @@
+package org.drools.contrib;
+
+import java.io.Serializable;
+
+public class Cheese
+ implements
+ Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 510l;
+ private String type;
+ private int price;
+
+ public Cheese() {
+
+ }
+
+ public Cheese(final String type,
+ final int price) {
+ super();
+ this.type = type;
+ this.price = price;
+ }
+
+ public int getPrice() {
+ return this.price;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+
+ public void setType(final String type) {
+ this.type = type;
+ }
+
+ public void setPrice(final int price) {
+ this.price = price;
+ }
+
+ public String toString() {
+ return "Cheese( type='" + this.type + "', price=" + this.price + " )";
+ }
+
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = PRIME * result + price;
+ result = PRIME * result + ((type == null) ? 0 : type.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if ( this == obj ) return true;
+ if ( obj == null ) return false;
+ if ( getClass() != obj.getClass() ) return false;
+ final Cheese other = (Cheese) obj;
+ if ( price != other.price ) return false;
+ if ( type == null ) {
+ if ( other.type != null ) return false;
+ } else if ( !type.equals( other.type ) ) return false;
+ return true;
+ }
+
+}
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/DroolsAntTaskTest.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/DroolsAntTaskTest.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/DroolsAntTaskTest.java 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,182 @@
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.contrib;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.drools.KnowledgeBase;
+import org.drools.RuleBase;
+import org.drools.core.util.DroolsStreamUtils;
+import org.drools.definition.KnowledgePackage;
+import org.drools.rule.Package;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * DroolsAntTask test case
+ */
+public class DroolsAntTaskTest extends BuildFileTest {
+
+ @Before
+ public void setUp() {
+
+ // Maven and eclipse need different paths
+ // When running in Maven the property is set.
+ String path = System.getProperty( "eclipsepath" );
+ if ( path == null ) {
+ System.setProperty( "eclipsepath",
+ "../../../" );
+ }
+
+ configureProject( "src/test/resources/DroolsAntTask.xml" );
+ }
+
+ @Test
+ public void testVerifierReport() {
+ try {
+ executeTarget( "verifierreport" );
+ } catch ( Exception e ) {
+ fail( e.getMessage() );
+ }
+ }
+
+ @Test
+ public void testDslRules() throws IOException,
+ ClassNotFoundException {
+ try {
+ executeTarget( "dslRules" );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ fail( "Should not throw any exception: " + e.getMessage() );
+ }
+
+ Package p1 = (Package) DroolsStreamUtils.streamIn( new FileInputStream( "target/cheese.rules.pkg" ) );
+
+ assertNotNull( p1 );
+ assertEquals( 1,
+ p1.getRules().length );
+ }
+
+ @Test
+ public void testDslRulesKnowledge() throws IOException,
+ ClassNotFoundException {
+ try {
+ executeTarget( "dslRulesKnowledge" );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ fail( "Should not throw any exception: " + e.getMessage() );
+ }
+
+ KnowledgePackage kpackage1 = (KnowledgePackage) DroolsStreamUtils.streamIn( new FileInputStream( "target/cheese.rules.pkg" ) );
+
+ assertNotNull( kpackage1 );
+ assertEquals( 1,
+ kpackage1.getRules().size() );
+ }
+
+ @Test
+ public void testRules() throws IOException,
+ ClassNotFoundException {
+ try {
+ executeTarget( "rules" );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ fail( "Should not throw any exception: " + e.getMessage() );
+ }
+
+ RuleBase r1 = (RuleBase) DroolsStreamUtils.streamIn( new FileInputStream( "target/cheese.rules" ) );
+
+ assertNotNull( r1 );
+ assertEquals( 1,
+ r1.getPackages().length );
+ }
+
+ @Test
+ public void testRulesKnowledge() throws IOException,
+ ClassNotFoundException {
+ try {
+ executeTarget( "rulesKnowledge" );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ fail( "Should not throw any exception: " + e.getMessage() );
+ }
+
+ KnowledgeBase kbase = (KnowledgeBase) DroolsStreamUtils.streamIn( new FileInputStream( "target/cheese.rules" ) );
+
+ assertNotNull( kbase );
+ assertEquals( 1,
+ kbase.getKnowledgePackages().size() );
+ }
+
+ @Test
+ public void testRuleFlow() throws IOException,
+ ClassNotFoundException {
+ try {
+ executeTarget( "ruleFlow" );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ fail( "Should not throw any exception: " + e.getMessage() );
+ }
+
+ RuleBase r1 = (RuleBase) DroolsStreamUtils.streamIn( new FileInputStream( "target/ruleFlow.rules" ) );
+
+ assertNotNull( r1 );
+ assertEquals( 1,
+ r1.getPackages().length );
+ }
+
+ @Test
+ public void testRuleFlowKnowledge() throws IOException,
+ ClassNotFoundException {
+ try {
+ executeTarget( "ruleFlowKnowledge" );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ fail( "Should not throw any exception: " + e.getMessage() );
+ }
+
+ KnowledgeBase kbase = (KnowledgeBase) DroolsStreamUtils.streamIn( new FileInputStream( "target/ruleFlow.rules" ) );
+
+ assertNotNull( kbase );
+ assertEquals( 1,
+ kbase.getKnowledgePackages().size() );
+ }
+
+ @Test
+ public void testNoPackageFile() {
+ try {
+ executeTarget( "rulesnopackagefile" );
+ fail( "Should throw an exception " );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testManyPackageFiles() {
+ try {
+ executeTarget( "rulesmanypackagefile" );
+ fail( "Should throw an exception " );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ }
+ }
+
+}
Property changes on: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/DroolsAntTaskTest.java
___________________________________________________________________
Added: svn:executable
+ *
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/GuvnorJRClusterConfigTest.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/GuvnorJRClusterConfigTest.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/GuvnorJRClusterConfigTest.java 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,41 @@
+package org.drools.contrib;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * GuvnorJRClusterConfig test case
+ */
+public class GuvnorJRClusterConfigTest extends BuildFileTest {
+
+ @Before
+ public void setUp() {
+ String path = System.getProperty( "eclipsepath" );
+ if ( path == null ) {
+ System.setProperty( "eclipsepath",
+ "../../../" );
+ }
+ configureProject( "src/test/resources/GuvnorJRClusterConfigAntTask.xml" );
+ }
+
+ @Test
+ public void testConfigurationWasCreated() throws IOException, ClassNotFoundException {
+ try {
+ executeTarget( "jrcluster" );
+ } catch ( Exception e ) {
+ e.printStackTrace();
+ fail( "Should not throw any exception: " + e.getMessage() );
+ }
+
+ FileInputStream fis1 = new FileInputStream("target/jrcluster/01/repository.xml");
+ FileInputStream fis2 = new FileInputStream("target/jrcluster/02/repository.xml");
+
+ assertNotNull(fis1);
+ assertNotNull(fis2);
+ }
+}
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/Person.java
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/Person.java (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/java/org/drools/contrib/Person.java 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,33 @@
+package org.drools.contrib;
+
+public class Person {
+
+ private static final long serialVersionUID = 510l;
+ private String name;
+ private String status;
+ private int age;
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+}
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/DroolsAntTask.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/DroolsAntTask.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/DroolsAntTask.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,110 @@
+<project default="rules">
+
+ <path id="cheese.classpath">
+ <pathelement location="${eclipsepath}lib/cheese.jar"/>
+ </path>
+
+ <path id="drools.classpath">
+ <pathelement location="target"/>
+ </path>
+
+ <taskdef name="compiler" classname="org.drools.contrib.DroolsCompilerAntTask" classpathref="drools.classpath" />
+ <taskdef name="verifier" classname="org.drools.contrib.DroolsVerifierAntTask" classpathref="drools.classpath" />
+
+
+ <target name="verifierreport">
+ <verifier
+ srcdir="${eclipsepath}src/test/resources/org/drools/verifier"
+ tofile="${eclipsepath}target/"
+ classpathref="cheese.classpath" >
+ <include name="*.drl" />
+ </verifier>
+ </target>
+
+
+ <target name="dslRules" >
+ <compiler
+ srcdir="${eclipsepath}src/test/resources/rules"
+ tofile="${eclipsepath}target/cheese.rules.pkg"
+ classpathref="cheese.classpath"
+ binformat="package" >
+ <include name="*.dslr" />
+ </compiler>
+ </target>
+
+ <target name="dslRulesKnowledge" >
+ <compiler
+ srcdir="${eclipsepath}src/test/resources/rules"
+ tofile="${eclipsepath}target/cheese.rules.pkg"
+ classpathref="cheese.classpath"
+ binformat="package"
+ bintype="knowledge" >
+ <include name="*.dslr" />
+ </compiler>
+ </target>
+
+ <target name="rules" >
+ <compiler
+ srcdir="${eclipsepath}src/test/resources/rules"
+ tofile="${eclipsepath}target/cheese.rules"
+ classpathref="cheese.classpath" >
+ <include name="*.drl" />
+ <include name="*.brl" />
+ <include name="*.xml" />
+ <include name="*.dslr" />
+ </compiler>
+ </target>
+
+ <target name="rulesKnowledge" >
+ <compiler
+ srcdir="${eclipsepath}src/test/resources/rules"
+ tofile="${eclipsepath}target/cheese.rules"
+ classpathref="cheese.classpath"
+ bintype="knowledge" >
+ <include name="*.drl" />
+ <include name="*.brl" />
+ <include name="*.xml" />
+ <include name="*.dslr" />
+ </compiler>
+ </target>
+
+ <target name="ruleFlow" >
+ <compiler
+ srcdir="${eclipsepath}src/test/resources/ruleFlow"
+ tofile="${eclipsepath}target/ruleFlow.rules" >
+ <include name="*.drl" />
+ <include name="*.rf" />
+ </compiler>
+ </target>
+
+ <target name="ruleFlowKnowledge" >
+ <compiler
+ srcdir="${eclipsepath}src/test/resources/ruleFlow"
+ tofile="${eclipsepath}target/ruleFlow.rules"
+ bintype="knowledge" >
+ <include name="*.drl" />
+ <include name="*.rf" />
+ </compiler>
+ </target>
+
+ <target name="rulesnopackagefile" >
+ <compiler
+ srcdir="${eclipsepath}src/test/resources/packagefiletest/emptydir"
+ tofile="${eclipsepath}target/cheese.rules"
+ classpathref="cheese.classpath" >
+ <include name="*.drl" />
+ <include name="*.brl" />
+ </compiler>
+ </target>
+
+ <target name="rulesmanypackagefile" >
+ <compiler
+ srcdir="${eclipsepath}src/test/resources/packagefiletest"
+ tofile="${eclipsepath}target/cheese.rules"
+ classpathref="cheese.classpath" >
+ <include name="*.drl" />
+ <include name="*.brl" />
+ </compiler>
+ </target>
+
+</project>
Property changes on: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/DroolsAntTask.xml
___________________________________________________________________
Added: svn:executable
+ *
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/GuvnorJRClusterConfigAntTask.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/GuvnorJRClusterConfigAntTask.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/GuvnorJRClusterConfigAntTask.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,26 @@
+<project default="jrcluster">
+ <path id="drools.classpath">
+ <pathelement location="target"/>
+ </path>
+
+ <taskdef name="cluster" classname="org.drools.contrib.GuvnorJRClusterConfigAntTask" classpathref="drools.classpath" />
+
+ <target name="jrcluster" >
+ <!-- <record name="cluster-log.txt"/> -->
+ <cluster
+ verbose="true"
+ nodecount="2"
+ destinationdir="${eclipsepath}target/"
+ dbtype="mysql"
+ dbdriver="com.mysql.jdbc.Driver"
+ dburl="jdbc:mysql://localhost:3306/brmscluster"
+ dbuser="brms"
+ dbpasswd="brms"
+ journalsyncdelay="2000"
+ journaldbdriver="com.mysql.jdbc.Driver"
+ journaldburl="jdbc:mysql://localhost:3306/brmsjournal"
+ journaldbuser="brms"
+ journaldbpasswd="brms"
+ />
+ </target>
+</project>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/org/drools/verifier/Misc.drl
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/org/drools/verifier/Misc.drl (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/org/drools/verifier/Misc.drl 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,78 @@
+package com.misc.someData
+
+import com.sample.DroolsTest.Message;
+
+rule "nro 1."
+ when
+ Foo( bar > 10 )
+ then
+ System.out.println("Test");
+end
+
+rule "nro 2."
+ when
+ Foo( bar < 10 )
+ then
+ System.out.println("Test");
+end
+
+rule "Rule with patterns"
+ when
+ Foo1()
+ Foo1()
+ TestPattern1( a == 10, b == 10, c == 10, d == 10, e == 10)
+ TestPattern2()
+ TestPattern3()
+ TestPattern4()
+ then
+ System.out.println( "Test" );
+end
+
+rule "Field rule"
+ when
+ PatThePattern( gg > 100 )
+ then
+ System.out.println( "Test" );
+end
+
+rule "Field rule 2"
+ when
+ PatThePattern()
+ then
+ System.out.println( "Test" );
+end
+
+rule "Numbers 1"
+ when
+ NumbersInPattern( x == 10 )
+ then
+ System.out.println( "Test" );
+end
+
+rule "Numbers 2"
+ when
+ NumbersInPattern( x == 20 )
+ then
+ System.out.println( "Test" );
+end
+
+rule "Numbers 3"
+ when
+ NumbersInPattern( x == 30 )
+ then
+ System.out.println( "Test" );
+end
+
+rule "Numbers 5"
+ when
+ NumbersInPattern( x == 50 )
+ then
+ System.out.println( "Test" );
+end
+
+rule "Numbers 6"
+ when
+ NumbersInPattern( x == 60 )
+ then
+ System.out.println( "Test" );
+end
\ No newline at end of file
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/Person.brl
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/Person.brl (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/Person.brl 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,49 @@
+<rule>
+ <modelVersion>1.0</modelVersion>
+ <attributes>
+ <attribute>
+ <attributeName>no-loop</attributeName>
+ <value>true</value>
+ </attribute>
+ </attributes>
+ <lhs>
+ <fact>
+ <constraintList>
+ <constraints>
+ <fieldConstraint>
+ <fieldBinding>f1</fieldBinding>
+ <fieldName>age</fieldName>
+ <operator><</operator>
+ <value>42</value>
+ <constraintValueType>0</constraintValueType>
+ </fieldConstraint>
+ </constraints>
+ </constraintList>
+ <factType>Person</factType>
+ <boundName>p1</boundName>
+ </fact>
+ <compositePattern>
+ <type>not</type>
+ <patterns>
+ <fact>
+ <factType>Cheese</factType>
+ </fact>
+ </patterns>
+ </compositePattern>
+ </lhs>
+ <rhs>
+ <modify>
+ <variable>p1</variable>
+ <fieldValues>
+ <fieldValue>
+ <field>status</field>
+ <value>rejected</value>
+ <type>String</type>
+ </fieldValue>
+ </fieldValues>
+ </modify>
+ <retract>
+ <variableName>p1</variableName>
+ </retract>
+ </rhs>
+</rule>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/emptydir/Person.brl
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/emptydir/Person.brl (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/emptydir/Person.brl 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,49 @@
+<rule>
+ <modelVersion>1.0</modelVersion>
+ <attributes>
+ <attribute>
+ <attributeName>no-loop</attributeName>
+ <value>true</value>
+ </attribute>
+ </attributes>
+ <lhs>
+ <fact>
+ <constraintList>
+ <constraints>
+ <fieldConstraint>
+ <fieldBinding>f1</fieldBinding>
+ <fieldName>age</fieldName>
+ <operator><</operator>
+ <value>42</value>
+ <constraintValueType>0</constraintValueType>
+ </fieldConstraint>
+ </constraints>
+ </constraintList>
+ <factType>Person</factType>
+ <boundName>p1</boundName>
+ </fact>
+ <compositePattern>
+ <type>not</type>
+ <patterns>
+ <fact>
+ <factType>Cheese</factType>
+ </fact>
+ </patterns>
+ </compositePattern>
+ </lhs>
+ <rhs>
+ <modify>
+ <variable>p1</variable>
+ <fieldValues>
+ <fieldValue>
+ <field>status</field>
+ <value>rejected</value>
+ <type>String</type>
+ </fieldValue>
+ </fieldValues>
+ </modify>
+ <retract>
+ <variableName>p1</variableName>
+ </retract>
+ </rhs>
+</rule>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/rule.package
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/rule.package (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/rule.package 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,8 @@
+//This is a package configuration file
+//Add imports, globals etc here which will be used by all the rule assets in thise folder.
+
+package org.drools.test;
+
+import org.drools.contrib.Person;
+import org.drools.contrib.Cheese;
+
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/packagefiletest/tmp.package
===================================================================
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/ruleFlow/workitems.rf
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/ruleFlow/workitems.rf (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/ruleFlow/workitems.rf 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-5.0.xsd"
+ type="RuleFlow" name="workitems" id="com.sample.ruleflow" package-name="com.sample" version="1" >
+
+ <header>
+ </header>
+
+ <nodes>
+ <start id="1" name="Start" x="21" y="100" width="80" height="40" />
+ <split id="2" name="Split" x="120" y="100" width="80" height="40" type="1" />
+ <workItem id="3" name="Log" x="232" y="61" width="80" height="40" >
+ <work name="Log" >
+ <parameter name="Message" >
+ <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+ <value>This is the first log message</value>
+ </parameter>
+ </work>
+ </workItem>
+ <workItem id="4" name="Email" x="231" y="139" width="80" height="40" >
+ <work name="Email" >
+ <parameter name="From" >
+ <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+ <value>me at mail.com</value>
+ </parameter>
+ <parameter name="Subject" >
+ <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+ <value>Urgent!</value>
+ </parameter>
+ <parameter name="To" >
+ <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+ <value>you at mail.com</value>
+ </parameter>
+ <parameter name="Text" >
+ <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+ <value>This is an urgent email !</value>
+ </parameter>
+ </work>
+ </workItem>
+ <join id="5" name="Join" x="333" y="99" width="80" height="40" type="1" />
+ <workItem id="6" name="Log" x="435" y="97" width="80" height="40" >
+ <work name="Log" >
+ <parameter name="Message" >
+ <type name="org.drools.process.core.datatype.impl.type.StringDataType" />
+ <value>This is the second log message</value>
+ </parameter>
+ </work>
+ </workItem>
+ <end id="7" name="End" x="538" y="95" width="80" height="40" />
+ </nodes>
+
+ <connections>
+ <connection from="1" to="2" />
+ <connection from="2" to="3" />
+ <connection from="2" to="4" />
+ <connection from="4" to="5" />
+ <connection from="3" to="5" />
+ <connection from="5" to="6" />
+ <connection from="6" to="7" />
+ </connections>
+
+</process>
\ No newline at end of file
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/MultiSheetDST.xls
===================================================================
(Binary files differ)
Property changes on: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/MultiSheetDST.xls
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/Person.brl
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/Person.brl (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/Person.brl 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,49 @@
+<rule>
+ <modelVersion>1.0</modelVersion>
+ <attributes>
+ <attribute>
+ <attributeName>no-loop</attributeName>
+ <value>true</value>
+ </attribute>
+ </attributes>
+ <lhs>
+ <fact>
+ <constraintList>
+ <constraints>
+ <fieldConstraint>
+ <fieldBinding>f1</fieldBinding>
+ <fieldName>age</fieldName>
+ <operator><</operator>
+ <value>42</value>
+ <constraintValueType>0</constraintValueType>
+ </fieldConstraint>
+ </constraints>
+ </constraintList>
+ <factType>Person</factType>
+ <boundName>p1</boundName>
+ </fact>
+ <compositePattern>
+ <type>not</type>
+ <patterns>
+ <fact>
+ <factType>Cheese</factType>
+ </fact>
+ </patterns>
+ </compositePattern>
+ </lhs>
+ <rhs>
+ <modify>
+ <variable>p1</variable>
+ <fieldValues>
+ <fieldValue>
+ <field>status</field>
+ <value>rejected</value>
+ <type>String</type>
+ </fieldValue>
+ </fieldValues>
+ </modify>
+ <retract>
+ <variableName>p1</variableName>
+ </retract>
+ </rhs>
+</rule>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/Person.xml
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/Person.xml (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/Person.xml 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<package name="org.drools.test"
+ 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-5.0.xsd">
+
+
+ <import name="org.drools.contrib.Person" />
+ <import name="org.drools.contrib.Cheese" />
+
+<rule name="simple_rule">
+ <rule-attribute name="salience" value="10" />
+ <rule-attribute name="no-loop" value="true" />
+
+ <lhs>
+
+ <pattern identifier="p" object-type="Person" >
+ <field-binding field-name="status" identifier="s" />
+ <field-constraint field-name="name">
+ <literal-restriction evaluator="==" value="bob" />
+ </field-constraint>
+ </pattern>
+
+ </lhs>
+ <rhs>
+ s = "DONE";
+ </rhs>
+</rule>
+
+</package>
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.drl
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.drl (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.drl 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,12 @@
+#created on: Jul 21, 2006
+package org.drools.test;
+
+import org.drools.contrib.Cheese;
+
+rule "Cheese"
+ when
+ Cheese( type == "stilton" )
+ then
+ System.out.println("STILTON");
+end
+
Property changes on: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.drl
___________________________________________________________________
Added: svn:executable
+ *
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.dsl
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.dsl (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.dsl 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,2 @@
+[condition][]There is a stilton cheese=$cheese : Cheese( type == "stilton" )
+[consequence][]Print the cheese type=System.out.println("STILTON");
\ No newline at end of file
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.dslr
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.dslr (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/cheese.dslr 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.contrib.Cheese;
+
+expander chesse.dsl
+
+rule "Your DSL cheese rule"
+
+ when
+ There is a stilton cheese
+ then
+ Print the cheese type
+end
Added: labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/rule.package
===================================================================
--- labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/rule.package (rev 0)
+++ labs/jbossrules/tags/5.2.0.M1/drools-ant/src/test/resources/rules/rule.package 2011-02-24 14:08:18 UTC (rev 36688)
@@ -0,0 +1,8 @@
+//This is a package configuration file
+//Add imports, globals etc here which will be used by all the rule assets in thise folder.
+
+package org.drools.test;
+
+import org.drools.contrib.Person;
+import org.drools.contrib.Cheese;
+
More information about the jboss-svn-commits
mailing list