[jboss-svn-commits] JBL Code SVN: r25316 - in labs/jbossrules/trunk: drools-api/src/main/java/org/drools/builder and 22 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Feb 17 21:41:08 EST 2009


Author: tirelli
Date: 2009-02-17 21:41:07 -0500 (Tue, 17 Feb 2009)
New Revision: 25316

Added:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/AccumulateFunctionOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DefaultDialectOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DumpDirOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/EvaluatorOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/ProcessStringEscapesOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/Option.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/OptionsConfiguration.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/Evaluator.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/EvaluatorDefinition.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/Operator.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/builder/
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/builder/KnowledgeBuilderConfigurationTest.java
Modified:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseConfiguration.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderConfiguration.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/AntlrDSLMappingEntry.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/PatternBuilder.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilder.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAccumulateBuilder.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ValueType.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/accumulators/JavaAccumulatorFunctionExecutor.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/accumulators/MVELAccumulatorFunctionExecutor.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/AfterEvaluatorDefinition.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/EvaluatorDefinition.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/Operator.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CompositeObjectSinkAdapter.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/Evaluator.java
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/AgendaEventSupportTest.java
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/RuleBaseEventSupportTest.java
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/rule/AgendaEventSupportTest.java
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/examples/manners/BaseMannersTest.java
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/QueryTerminalNodeTest.java
   labs/jbossrules/trunk/drools-core/src/test/java/org/drools/rule/FieldConstraintTest.java
Log:
Adding type safe configuration to KnowledgePackageBuilder

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseConfiguration.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseConfiguration.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -1,5 +1,7 @@
 package org.drools;
 
+import org.drools.conf.OptionsConfiguration;
+
 /**
  *<p>
  * A class to store KnowledgeBase related configuration. It must be used at KnowledgeBase instantiation time

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderConfiguration.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderConfiguration.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -1,6 +1,7 @@
 package org.drools.builder;
 
 import org.drools.PropertiesConfiguration;
+import org.drools.conf.OptionsConfiguration;
 
 /**
  * <p>
@@ -49,6 +50,7 @@
  */
 public interface KnowledgeBuilderConfiguration
     extends
-    PropertiesConfiguration {
+    PropertiesConfiguration,
+    OptionsConfiguration {
 
 }

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/AccumulateFunctionOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/AccumulateFunctionOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/AccumulateFunctionOption.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,122 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * 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.builder.conf;
+
+import org.drools.conf.Option;
+import org.drools.runtime.rule.AccumulateFunction;
+
+/**
+ * A class for the accumulate function configuration.
+ * 
+ * @author etirelli
+ */
+public class AccumulateFunctionOption implements Option {
+
+    private static final long serialVersionUID = -8461267995706982981L;
+
+    /**
+     * The prefix for the property name for accumulate functions
+     */
+    public static final String PROPERTY_NAME = "drools.accumulate.function.";
+    
+    /**
+     * accumulate function name
+     */
+    private final String name;
+    
+    /**
+     * the accumulate function instance
+     */
+    private final AccumulateFunction function;
+    
+    /**
+     * Private constructor to enforce the use of the factory method
+     * @param name
+     */
+    private AccumulateFunctionOption( final String name, final AccumulateFunction function ) {
+        this.name = name;
+        this.function = function;
+    }
+    
+    /**
+     * This is a factory method for this DefaultDialect configuration.
+     * The factory method is a best practice for the case where the 
+     * actual object construction is changed in the future.
+     * 
+     * @param name the name of the dialect to be configured as default
+     * 
+     * @return the actual type safe default dialect configuration.
+     */
+    public static AccumulateFunctionOption get( final String name, final AccumulateFunction function ) {
+        return new AccumulateFunctionOption( name, function );
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME+name;
+    }
+    
+    /**
+     * Returns the name of the dialect configured as default
+     * 
+     * @return
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the accumulate function instance
+     * @return
+     */
+    public AccumulateFunction getFunction() {
+        return function;
+    }
+    
+    @Override
+    public String toString() {
+        return "AccumulateFunction( name="+name+" function="+function+" )";
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((function == null) ? 0 : function.hashCode());
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        AccumulateFunctionOption other = (AccumulateFunctionOption) obj;
+        if ( function == null ) {
+            if ( other.function != null ) return false;
+        } else if ( other.function == null ) {
+            return false; 
+        } else if( !function.getClass().getName().equals( other.function.getClass().getName() ) ) return false;
+        if ( name == null ) {
+            if ( other.name != null ) return false;
+        } else if ( !name.equals( other.name ) ) return false;
+        return true;
+    }
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/AccumulateFunctionOption.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DefaultDialectOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DefaultDialectOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DefaultDialectOption.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * 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.builder.conf;
+
+import org.drools.conf.Option;
+
+/**
+ * A class for the default dialect configuration.
+ * 
+ * @author etirelli
+ */
+public class DefaultDialectOption implements Option {
+
+    private static final long serialVersionUID = -8461267995706982981L;
+
+    /**
+     * The property name for the default DIALECT
+     */
+    public static final String PROPERTY_NAME = "drools.dialect.default";
+    
+    /**
+     * dialect name
+     */
+    private final String name;
+    
+    /**
+     * Private constructor to enforce the use of the factory method
+     * @param name
+     */
+    private DefaultDialectOption( String name ) {
+        this.name = name;
+    }
+    
+    /**
+     * This is a factory method for this DefaultDialect configuration.
+     * The factory method is a best practice for the case where the 
+     * actual object construction is changed in the future.
+     * 
+     * @param name the name of the dialect to be configured as default
+     * 
+     * @return the actual type safe default dialect configuration.
+     */
+    public static DefaultDialectOption get( String name ) {
+        return new DefaultDialectOption( name );
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    /**
+     * Returns the name of the dialect configured as default
+     * 
+     * @return
+     */
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((name == null) ? 0 : name.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        DefaultDialectOption other = (DefaultDialectOption) obj;
+        if ( name == null ) {
+            if ( other.name != null ) return false;
+        } else if ( !name.equals( other.name ) ) return false;
+        return true;
+    }
+    
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DefaultDialectOption.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DumpDirOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DumpDirOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DumpDirOption.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * 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.builder.conf;
+
+import java.io.File;
+
+import org.drools.conf.Option;
+
+/**
+ * A class for the dump directory configuration. I.e., for the directory
+ * where Drools will dump generated code for debugging purposes. If this
+ * option is not set, drools will generate and compile all code in memory.
+ * 
+ * @author etirelli
+ */
+public class DumpDirOption implements Option {
+
+    private static final long serialVersionUID = -8461267995706982981L;
+
+    /**
+     * The property name for the drools dump directory configuration
+     */
+    public static final String PROPERTY_NAME = "drools.dump.dir";
+    
+    /**
+     * directory reference
+     */
+    private final File dir;
+    
+    /**
+     * Private constructor to enforce the use of the factory method
+     * @param dir directory to set
+     */
+    private DumpDirOption( File dir ) {
+        this.dir = dir;
+    }
+    
+    /**
+     * This is a factory method for this DumpDirectoryOption configuration.
+     * The factory method is a best practice for the case where the 
+     * actual object construction is changed in the future.
+     * 
+     * @param dir the directory to which drools will dump files
+     * 
+     * @return the actual type safe dump directory configuration.
+     */
+    public static DumpDirOption get( File dir ) {
+        return new DumpDirOption( dir );
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    /**
+     * Returns the directory to which drools should dump generated files
+     * 
+     * @return
+     */
+    public File getDirectory() {
+        return dir;
+    }
+
+    @Override
+    public String toString() {
+        return "DumpDirOption( directory="+dir.toString()+" )";
+    }
+    
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((dir == null) ? 0 : dir.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        DumpDirOption other = (DumpDirOption) obj;
+        if ( dir == null ) {
+            if ( other.dir != null ) return false;
+        } else if ( !dir.equals( other.dir ) ) return false;
+        return true;
+    }
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DumpDirOption.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/EvaluatorOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/EvaluatorOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/EvaluatorOption.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * 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.builder.conf;
+
+import org.drools.conf.Option;
+import org.drools.runtime.rule.EvaluatorDefinition;
+
+/**
+ * A class for the evaluators configuration. 
+ * 
+ * Drools supports custom evaluators. After implementing an evaluator
+ * use this option class to register it to the knowledge builder.
+ * 
+ * @author etirelli
+ */
+public class EvaluatorOption implements Option {
+
+    private static final long serialVersionUID = -8461267995706982981L;
+
+    /**
+     * The prefix for the property name for evaluators
+     */
+    public static final String PROPERTY_NAME = "drools.evaluator.";
+    
+    /**
+     * evaluator key
+     */
+    private final String key;
+    
+    /**
+     * the evaluator instance
+     */
+    private final EvaluatorDefinition evaluator;
+    
+    /**
+     * Private constructor to enforce the use of the factory method
+     * @param key
+     */
+    private EvaluatorOption( final String key, final EvaluatorDefinition evaluator ) {
+        this.key = key;
+        this.evaluator = evaluator;
+    }
+    
+    /**
+     * This is a factory method for this EvaluatorOption configuration.
+     * The factory method is a best practice for the case where the 
+     * actual object construction is changed in the future.
+     * 
+     * @param key the key of the evaluator to be configured
+     * @param evaluator the evaluator definition
+     * 
+     * @return the actual type safe default dialect configuration.
+     */
+    public static EvaluatorOption get( final String key, final EvaluatorDefinition evaluator ) {
+        return new EvaluatorOption( key, evaluator );
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME+key;
+    }
+    
+    /**
+     * Returns the name of the dialect configured as default
+     * 
+     * @return
+     */
+    public String getName() {
+        return key;
+    }
+
+    /**
+     * Returns the accumulate function instance
+     * @return
+     */
+    public EvaluatorDefinition getEvaluatorDefinition() {
+        return evaluator;
+    }
+    
+    @Override
+    public String toString() {
+        return "EvaluatorOption( name="+key+" evaluator="+evaluator+" )";
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((evaluator == null) ? 0 : evaluator.hashCode());
+        result = prime * result + ((key == null) ? 0 : key.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        EvaluatorOption other = (EvaluatorOption) obj;
+        if ( evaluator == null ) {
+            if ( other.evaluator != null ) return false;
+        } else if ( other.evaluator == null ) {
+            return false; 
+        } else if( !evaluator.getClass().getName().equals( other.evaluator.getClass().getName() ) ) return false;
+        if ( key == null ) {
+            if ( other.key != null ) return false;
+        } else if ( !key.equals( other.key ) ) return false;
+        return true;
+    }
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/EvaluatorOption.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/ProcessStringEscapesOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/ProcessStringEscapesOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/ProcessStringEscapesOption.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * 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.builder.conf;
+
+import org.drools.conf.Option;
+
+/**
+ * An enum for ProcessStringEscapes option.
+ * 
+ * @author etirelli
+ */
+public enum ProcessStringEscapesOption implements Option {
+    
+    YES,
+    NO;
+
+    /**
+     * The property name for the process string escapes option
+     */
+    public static final String PROPERTY_NAME = "drools.parser.processStringEscapes";
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/ProcessStringEscapesOption.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/Option.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/Option.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/Option.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * 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.conf;
+
+import java.io.Serializable;
+
+/**
+ * A base interface for type safe options
+ * 
+ * @author etirelli
+ */
+public interface Option extends Serializable {
+    
+    /**
+     * Returns the property name for this option
+     * 
+     * @return
+     */
+    public String getPropertyName();
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/Option.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/OptionsConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/OptionsConfiguration.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/OptionsConfiguration.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * 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.conf;
+
+
+/**
+ * A base interface for type safe configurations
+ * 
+ * @author etirelli
+ */
+public interface OptionsConfiguration {
+    
+    /**
+     * Sets an option
+     * 
+     * @param option the option to be set. As options are type safe, the option
+     *               itself contains the option key, and so a single parameter
+     *               is enough.
+     */
+    public <T extends Option> void setOption( T option );
+
+    /**
+     * Gets an option value
+     * 
+     * @param option the option class for the option being requested
+     * 
+     * @return the Option value for the given option. Returns null if option is 
+     *         not configured.
+     */
+    public <T extends Option> T getOption( Class<T> option );
+    
+    
+    /**
+     * Gets an option value for the given option + key. This method should
+     * be used for multi-value options, like accumulate functions configuration
+     * where one option has multiple values, distinguished by a sub-key.
+     * 
+     * @param option the option class for the option being requested
+     * @param key the key for the option being requested
+     * 
+     * @return the Option value for the given option + key. Returns null if option is 
+     *         not configured.
+     */
+    public <T extends Option> T getOption( Class<T> option, String key );
+    
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/OptionsConfiguration.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/Evaluator.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/Evaluator.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/Evaluator.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,45 @@
+package org.drools.runtime.rule;
+
+/*
+ * 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.
+ */
+
+import java.io.Serializable;
+
+/**
+ * A public interface to be implemented by all evaluators
+ */
+public interface Evaluator
+    extends
+    Serializable {
+
+    /**
+     * Returns the operator representation object for this evaluator
+     * 
+     * @return
+     */
+    public Operator getOperator();
+    
+    /**
+     * Returns true if this evaluator implements a temporal evaluation,
+     * i.e., a time sensitive evaluation whose properties of matching
+     * only events within an specific time interval can be used for
+     * determining event expirations automatically. 
+     * 
+     * @return true if the evaluator is a temporal evaluator. 
+     */
+    public boolean isTemporal();
+
+}
\ No newline at end of file

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/EvaluatorDefinition.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/EvaluatorDefinition.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/EvaluatorDefinition.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * 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.runtime.rule;
+
+/**
+ * A markup interface for Evaluator definitions
+ * 
+ * @author etirelli
+ */
+public interface EvaluatorDefinition {
+
+}


Property changes on: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/EvaluatorDefinition.java
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/Operator.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/Operator.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/runtime/rule/Operator.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,24 @@
+package org.drools.runtime.rule;
+
+/**
+ * An interface for Operator definitions.
+ * 
+ * @author etirelli
+ */
+public interface Operator {
+
+    /**
+     * Returns the String representation for this operator
+     * 
+     * @return
+     */
+    public String getOperatorString();
+
+    /**
+     * Returns true if this operator instance is negated.
+     * 
+     * @return
+     */
+    public boolean isNegated();
+
+}
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -18,7 +18,6 @@
 
 import java.io.File;
 import java.net.URL;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -27,13 +26,19 @@
 
 import org.drools.RuleBaseConfiguration;
 import org.drools.RuntimeDroolsException;
-import org.drools.base.accumulators.AccumulateFunction;
 import org.drools.base.evaluators.EvaluatorDefinition;
 import org.drools.base.evaluators.EvaluatorRegistry;
 import org.drools.builder.KnowledgeBuilderConfiguration;
+import org.drools.builder.conf.AccumulateFunctionOption;
+import org.drools.builder.conf.DefaultDialectOption;
+import org.drools.builder.conf.DumpDirOption;
+import org.drools.builder.conf.EvaluatorOption;
+import org.drools.builder.conf.ProcessStringEscapesOption;
+import org.drools.conf.Option;
 import org.drools.process.builder.ProcessNodeBuilder;
 import org.drools.process.builder.ProcessNodeBuilderRegistry;
 import org.drools.rule.Package;
+import org.drools.runtime.rule.AccumulateFunction;
 import org.drools.util.ChainedProperties;
 import org.drools.util.ClassUtils;
 import org.drools.util.ConfFileUtils;
@@ -72,50 +77,45 @@
  * 
  * drools.parser.processStringEscapes = true|false
  */
-public class PackageBuilderConfiguration implements KnowledgeBuilderConfiguration {
+public class PackageBuilderConfiguration
+    implements
+    KnowledgeBuilderConfiguration {
 
-    private static final String        ACCUMULATE_FUNCTION_PREFIX  = "drools.accumulate.function.";
+    private Map                             dialectConfigurations;
 
-    private static final String        EVALUATOR_DEFINITION_PREFIX = "drools.evaluator.";
+    private DefaultDialectOption            defaultDialect;
 
-    private static final String        DROOLS_PARSER_PROCESS_STRING_ESCAPES = "drools.parser.processStringEscapes";
+    private ClassLoader                     classLoader;
 
-    private Map                        dialectConfigurations;
+    private ChainedProperties               chainedProperties;
 
-    private String                     defaultDialect;
+    private Map<String, AccumulateFunction> accumulateFunctions;
 
-    private ClassLoader                classLoader;
+    private EvaluatorRegistry               evaluatorRegistry;
 
-    private ChainedProperties          chainedProperties;
+    private SemanticModules                 semanticModules;
 
-    private Map<String, String>        accumulateFunctions;
+    private ProcessNodeBuilderRegistry      nodeBuilderRegistry;
 
-    private EvaluatorRegistry          evaluatorRegistry;
+    private File                            dumpDirectory;
 
-    private SemanticModules            semanticModules;
+    private boolean                         allowMultipleNamespaces              = true;
 
-    private ProcessNodeBuilderRegistry nodeBuilderRegistry;
+    private boolean                         processStringEscapes                 = true;
 
-    private File                       dumpDirectory;
-
-    private boolean					   allowMultipleNamespaces = true;
-    
-    private boolean                    processStringEscapes = true;
-
     public boolean isAllowMultipleNamespaces() {
-		return allowMultipleNamespaces;
-	}
+        return allowMultipleNamespaces;
+    }
 
-
     /**
      * By default multiple namespaces are allowed. If you set this to "false" it will
      * make it all happen in the "default" namespace (the first namespace you define).
      */
-	public void setAllowMultipleNamespaces(boolean allowMultipleNamespaces) {
-		this.allowMultipleNamespaces = allowMultipleNamespaces;
-	}
+    public void setAllowMultipleNamespaces(boolean allowMultipleNamespaces) {
+        this.allowMultipleNamespaces = allowMultipleNamespaces;
+    }
 
-	/**
+    /**
      * Constructor that sets the parent class loader for the package being built/compiled
      * @param classLoader
      */
@@ -175,45 +175,52 @@
         buildEvaluatorRegistry();
 
         buildDumpDirectory();
-        
-        setProperty( DROOLS_PARSER_PROCESS_STRING_ESCAPES, 
-                     this.chainedProperties.getProperty( DROOLS_PARSER_PROCESS_STRING_ESCAPES, "true" ) );
+
+        setProperty( ProcessStringEscapesOption.PROPERTY_NAME,
+                     this.chainedProperties.getProperty( ProcessStringEscapesOption.PROPERTY_NAME,
+                                                         "true" ) );
     }
-    
-    public void setProperty(String name, String value) {
+
+    public void setProperty(String name,
+                            String value) {
         name = name.trim();
         if ( StringUtils.isEmpty( name ) ) {
             return;
         }
-        
-        if ( name.equals( "drools.dialect.default" ) ) {
-            setDefaultDialect( value );    
-        } else if ( name.startsWith( "drools.accumulate.function" ) ) {
-            addAccumulateFunction( name.substring( name.lastIndexOf( '.' ) ), value );
-        } else if ( name.startsWith( "drools.evaluator." ) ) {
+
+        if ( name.equals( DefaultDialectOption.PROPERTY_NAME ) ) {
+            setDefaultDialect( value );
+        } else if ( name.startsWith( AccumulateFunctionOption.PROPERTY_NAME ) ) {
+            addAccumulateFunction( name.substring( AccumulateFunctionOption.PROPERTY_NAME.length() ),
+                                   value );
+        } else if ( name.startsWith( EvaluatorOption.PROPERTY_NAME ) ) {
             this.evaluatorRegistry.addEvaluatorDefinition( value );
-        } else if ( name.equals(  "drools.dump.dir" ) ) {
+        } else if ( name.equals( DumpDirOption.PROPERTY_NAME ) ) {
             buildDumpDirectory( value );
-        } else if ( name.equals(  DROOLS_PARSER_PROCESS_STRING_ESCAPES ) ) {
+        } else if ( name.equals( ProcessStringEscapesOption.PROPERTY_NAME ) ) {
             setProcessStringEscapes( Boolean.parseBoolean( value ) );
         }
     }
-    
+
     public String getProperty(String name) {
         name = name.trim();
         if ( StringUtils.isEmpty( name ) ) {
             return null;
         }
-        
-        if ( name.equals( "drools.dialect.default" ) ) {
-            return getDefaultDialect( );    
-        } else if ( name.startsWith( "drools.accumulate.function" ) ) {
-            return this.accumulateFunctions.get( name );
-        }else if ( name.startsWith( "drools.evaluator." ) ) {
-            return this.evaluatorRegistry.getEvaluatorDefinition( name.substring( name.lastIndexOf( '.' ) ) ).getClass().getName();
-        } else if ( name.equals(  "drools.dump.dir" ) ) {
-            return Boolean.toString( this.dumpDirectory != null ); 
-        } else if ( name.equals(  DROOLS_PARSER_PROCESS_STRING_ESCAPES ) ) {
+
+        if ( name.equals( DefaultDialectOption.PROPERTY_NAME ) ) {
+            return getDefaultDialect();
+        } else if ( name.startsWith( AccumulateFunctionOption.PROPERTY_NAME ) ) {
+            int index = AccumulateFunctionOption.PROPERTY_NAME.length();
+            AccumulateFunction function = this.accumulateFunctions.get( name.substring( index ) );
+            return function != null ? function.getClass().getName() : null;
+        } else if ( name.startsWith( EvaluatorOption.PROPERTY_NAME ) ) {
+            String key = name.substring( name.lastIndexOf( '.' )+1 );
+            EvaluatorDefinition evalDef = this.evaluatorRegistry.getEvaluatorDefinition( key ); 
+            return evalDef != null ? evalDef.getClass().getName() : null;
+        } else if ( name.equals( DumpDirOption.PROPERTY_NAME ) ) {
+            return this.dumpDirectory != null ? this.dumpDirectory.toString() : null;
+        } else if ( name.equals( ProcessStringEscapesOption.PROPERTY_NAME ) ) {
             return String.valueOf( isProcessStringEscapes() );
         }
         return null;
@@ -229,7 +236,7 @@
         this.chainedProperties.mapStartsWith( dialectProperties,
                                               "drools.dialect",
                                               false );
-        setDefaultDialect( (String) dialectProperties.remove( "drools.dialect.default" ) );
+        setDefaultDialect( (String) dialectProperties.remove( DefaultDialectOption.PROPERTY_NAME ) );
 
         for ( Iterator it = dialectProperties.entrySet().iterator(); it.hasNext(); ) {
             Entry entry = (Entry) it.next();
@@ -243,15 +250,15 @@
 
     public void addDialect(String dialectName,
                            String dialectClass) {
-    	Class cls = null;
-    	try {
+        Class cls = null;
+        try {
             cls = classLoader.loadClass( dialectClass );
             DialectConfiguration dialectConf = (DialectConfiguration) cls.newInstance();
             dialectConf.init( this );
             addDialect( dialectName,
                         dialectConf );
         } catch ( Exception e ) {
-            throw new RuntimeDroolsException( "Unable to load dialect '" + dialectClass + ":" + dialectName + ":" + ((cls!=null) ? cls.getName() : "null") + "'",
+            throw new RuntimeDroolsException( "Unable to load dialect '" + dialectClass + ":" + dialectName + ":" + ((cls != null) ? cls.getName() : "null") + "'",
                                               e );
         }
     }
@@ -262,11 +269,15 @@
                                    dialectConf );
     }
 
-    public DialectCompiletimeRegistry buildDialectRegistry(PackageBuilder packageBuilder, PackageRegistry pkgRegistry, Package pkg) {
-        DialectCompiletimeRegistry registry = new DialectCompiletimeRegistry(pkg);
+    public DialectCompiletimeRegistry buildDialectRegistry(PackageBuilder packageBuilder,
+                                                           PackageRegistry pkgRegistry,
+                                                           Package pkg) {
+        DialectCompiletimeRegistry registry = new DialectCompiletimeRegistry( pkg );
         for ( Iterator it = this.dialectConfigurations.values().iterator(); it.hasNext(); ) {
             DialectConfiguration conf = (DialectConfiguration) it.next();
-            Dialect dialect = conf.newDialect(packageBuilder, pkgRegistry, pkg);
+            Dialect dialect = conf.newDialect( packageBuilder,
+                                               pkgRegistry,
+                                               pkg );
             registry.addDialect( dialect.getId(),
                                  dialect );
         }
@@ -274,11 +285,11 @@
     }
 
     public String getDefaultDialect() {
-        return this.defaultDialect;
+        return this.defaultDialect.getName();
     }
 
     public void setDefaultDialect(String defaultDialect) {
-        this.defaultDialect = defaultDialect;
+        this.defaultDialect = DefaultDialectOption.get( defaultDialect );
     }
 
     public DialectConfiguration getDialectConfiguration(String name) {
@@ -449,64 +460,85 @@
     }
 
     private void buildAccumulateFunctionsMap() {
-        this.accumulateFunctions = new HashMap<String, String>();
-        Map temp = new HashMap();
+        this.accumulateFunctions = new HashMap<String, AccumulateFunction>();
+        Map<String, String> temp = new HashMap<String, String>();
         this.chainedProperties.mapStartsWith( temp,
-                                              ACCUMULATE_FUNCTION_PREFIX,
+                                              AccumulateFunctionOption.PROPERTY_NAME,
                                               true );
-        for ( Iterator it = temp.entrySet().iterator(); it.hasNext(); ) {
-            Map.Entry entry = (Map.Entry) it.next();
-            String identifier = ((String) entry.getKey()).trim().substring( ACCUMULATE_FUNCTION_PREFIX.length() );
+        int index = AccumulateFunctionOption.PROPERTY_NAME.length();
+        for ( Map.Entry<String, String> entry : temp.entrySet() ) {
+            String identifier = entry.getKey().trim().substring( index );
             this.accumulateFunctions.put( identifier,
-                                          (String) entry.getValue() );
+                                          loadAccumulateFunction( identifier,
+                                                                  entry.getValue() ) );
         }
     }
 
+    /**
+     * This method is deprecated and will be removed 
+     * @return
+     * 
+     * @deprecated
+     */
     public Map<String, String> getAccumulateFunctionsMap() {
-        return Collections.unmodifiableMap( this.accumulateFunctions );
+        Map<String, String> result = new HashMap<String, String>();
+        for ( Map.Entry<String, AccumulateFunction> entry : this.accumulateFunctions.entrySet() ) {
+            result.put( entry.getKey(),
+                        entry.getValue().getClass().getName() );
+        }
+        return result;
     }
 
     public void addAccumulateFunction(String identifier,
                                       String className) {
         this.accumulateFunctions.put( identifier,
-                                      className );
+                                      loadAccumulateFunction( identifier,
+                                                              className ) );
     }
 
     public void addAccumulateFunction(String identifier,
-                                      Class<? extends AccumulateFunction> clazz) {
-        this.accumulateFunctions.put( identifier,
-                                      clazz.getName() );
+                                      Class< ? extends AccumulateFunction> clazz) {
+        try {
+            this.accumulateFunctions.put( identifier,
+                                          clazz.newInstance() );
+        } catch ( InstantiationException e ) {
+            throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Instantiation failed for class " + clazz.getName(),
+                                              e );
+        } catch ( IllegalAccessException e ) {
+            throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Illegal access to class " + clazz.getName(),
+                                              e );
+        }
     }
 
+    public AccumulateFunction getAccumulateFunction(String identifier) {
+        return this.accumulateFunctions.get( identifier );
+    }
+
     @SuppressWarnings("unchecked")
-    public AccumulateFunction getAccumulateFunction(String identifier) {
-        String className = this.accumulateFunctions.get( identifier );
-        if ( className == null ) {
-            throw new RuntimeDroolsException( "No accumulator function found for identifier: " + identifier );
-        }
+    private AccumulateFunction loadAccumulateFunction(String identifier,
+                                                      String className) {
         try {
-            Class<? extends AccumulateFunction> clazz = (Class<? extends AccumulateFunction>)this.classLoader.loadClass( className );
+            Class< ? extends AccumulateFunction> clazz = (Class< ? extends AccumulateFunction>) this.classLoader.loadClass( className );
             return (AccumulateFunction) clazz.newInstance();
         } catch ( ClassNotFoundException e ) {
-            throw new RuntimeDroolsException( "Error loading accumulator function for identifier " + identifier + ". Class " + className + " not found",
+            throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Class " + className + " not found",
                                               e );
         } catch ( InstantiationException e ) {
-            throw new RuntimeDroolsException( "Error loading accumulator function for identifier " + identifier + ". Instantiation failed for class " + className,
+            throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Instantiation failed for class " + className,
                                               e );
         } catch ( IllegalAccessException e ) {
-            throw new RuntimeDroolsException( "Error loading accumulator function for identifier " + identifier + ". Illegal access to class " + className,
+            throw new RuntimeDroolsException( "Error loading accumulate function for identifier " + identifier + ". Illegal access to class " + className,
                                               e );
         }
     }
 
     private void buildEvaluatorRegistry() {
         this.evaluatorRegistry = new EvaluatorRegistry( this.classLoader );
-        Map temp = new HashMap();
+        Map<String, String> temp = new HashMap<String, String>();
         this.chainedProperties.mapStartsWith( temp,
-                                              EVALUATOR_DEFINITION_PREFIX,
+                                              EvaluatorOption.PROPERTY_NAME,
                                               true );
-        for ( Iterator it = temp.values().iterator(); it.hasNext(); ) {
-            String className = (String) it.next();
+        for ( String className : temp.values() ) {
             this.evaluatorRegistry.addEvaluatorDefinition( className );
         }
     }
@@ -547,20 +579,16 @@
     }
 
     private void buildDumpDirectory() {
-        String dumpStr = this.chainedProperties.getProperty( "drools.dump.dir",
+        String dumpStr = this.chainedProperties.getProperty( DumpDirOption.PROPERTY_NAME,
                                                              null );
         buildDumpDirectory( dumpStr );
     }
-    
+
     private void buildDumpDirectory(String dumpStr) {
         if ( dumpStr != null ) {
-            this.dumpDirectory = new File( dumpStr );
-            if ( !dumpDirectory.isDirectory() || !dumpDirectory.canWrite() || !dumpDirectory.canRead() ) {
-                this.dumpDirectory = null;
-                throw new RuntimeDroolsException( "Drools dump directory is not accessible: " + dumpStr );
-            }
+            setDumpDir( new File( dumpStr ) );
         }
-    }    
+    }
 
     public File getDumpDir() {
         return this.dumpDirectory;
@@ -573,14 +601,51 @@
         this.dumpDirectory = dumpDir;
     }
 
-
     public boolean isProcessStringEscapes() {
         return processStringEscapes;
     }
 
-
     public void setProcessStringEscapes(boolean processStringEscapes) {
         this.processStringEscapes = processStringEscapes;
     }
 
+    @SuppressWarnings("unchecked")
+    public <T extends Option> T getOption(Class<T> option) {
+        if ( DefaultDialectOption.class.equals( option ) ) {
+            return (T) this.defaultDialect;
+        } else if ( DumpDirOption.class.equals( option ) ) {
+            return (T) DumpDirOption.get( this.dumpDirectory );
+        } else if ( ProcessStringEscapesOption.class.equals( option ) ) {
+            return (T) ( this.processStringEscapes ? ProcessStringEscapesOption.YES : ProcessStringEscapesOption.NO ); 
+        }
+        return null;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T extends Option> T getOption(Class<T> option,
+                                          String key) {
+        if ( AccumulateFunctionOption.class.equals( option ) ) {
+            return (T) AccumulateFunctionOption.get( key,
+                                                     this.accumulateFunctions.get( key ) );
+        } else if ( EvaluatorOption.class.equals( option ) ) {
+            return (T) EvaluatorOption.get( key,
+                                            this.evaluatorRegistry.getEvaluatorDefinition( key ) );
+        }
+        return null;
+    }
+
+    public <T extends Option> void setOption(T option) {
+        if ( option instanceof DefaultDialectOption ) {
+            this.defaultDialect = (DefaultDialectOption) option;
+        } else if ( option instanceof AccumulateFunctionOption ) {
+            this.accumulateFunctions.put( ((AccumulateFunctionOption) option).getName(),
+                                          ((AccumulateFunctionOption) option).getFunction() );
+        } else if ( option instanceof DumpDirOption ) {
+            this.dumpDirectory = ((DumpDirOption) option).getDirectory();
+        } else if ( option instanceof EvaluatorOption ) {
+            this.evaluatorRegistry.addEvaluatorDefinition( (EvaluatorDefinition) ((EvaluatorOption)option).getEvaluatorDefinition() );
+        } else if ( option instanceof ProcessStringEscapesOption ) {
+            this.processStringEscapes = ( option == ProcessStringEscapesOption.YES );
+        }
+    }
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/AntlrDSLMappingEntry.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/AntlrDSLMappingEntry.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/dsl/AntlrDSLMappingEntry.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -58,7 +58,7 @@
     }
 
     /**
-     * @param key
+     * @param KEY
      *            the key to set
      */
     public void setKeyPattern(final String keyPat) {

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/PatternBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/PatternBuilder.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/PatternBuilder.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -21,7 +21,6 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
-import java.util.regex.Matcher;
 
 import org.drools.base.ClassObjectType;
 import org.drools.base.FieldFactory;

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilder.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaAccumulateBuilder.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -25,7 +25,6 @@
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.drools.base.accumulators.AccumulateFunction;
 import org.drools.base.accumulators.JavaAccumulatorFunctionExecutor;
 import org.drools.compiler.Dialect;
 import org.drools.lang.descr.AccumulateDescr;
@@ -38,6 +37,7 @@
 import org.drools.rule.builder.RuleBuildContext;
 import org.drools.rule.builder.RuleConditionBuilder;
 import org.drools.rule.builder.dialect.java.parser.JavaLocalDeclarationDescr;
+import org.drools.runtime.rule.AccumulateFunction;
 
 /**
  * A builder for the java dialect accumulate version

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAccumulateBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAccumulateBuilder.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELAccumulateBuilder.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -19,7 +19,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-import org.drools.base.accumulators.AccumulateFunction;
 import org.drools.base.accumulators.MVELAccumulatorFunctionExecutor;
 import org.drools.base.mvel.MVELAccumulator;
 import org.drools.base.mvel.MVELCompilationUnit;
@@ -36,6 +35,7 @@
 import org.drools.rule.builder.AccumulateBuilder;
 import org.drools.rule.builder.RuleBuildContext;
 import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.runtime.rule.AccumulateFunction;
 import org.drools.spi.Accumulator;
 
 /**

Added: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/builder/KnowledgeBuilderConfigurationTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/builder/KnowledgeBuilderConfigurationTest.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/builder/KnowledgeBuilderConfigurationTest.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -0,0 +1,217 @@
+/*
+ * Copyright 2008 Red Hat
+ * 
+ * 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.builder;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.drools.base.accumulators.AverageAccumulateFunction;
+import org.drools.base.accumulators.MaxAccumulateFunction;
+import org.drools.base.evaluators.AfterEvaluatorDefinition;
+import org.drools.base.evaluators.BeforeEvaluatorDefinition;
+import org.drools.base.evaluators.EvaluatorDefinition;
+import org.drools.builder.conf.AccumulateFunctionOption;
+import org.drools.builder.conf.DefaultDialectOption;
+import org.drools.builder.conf.DumpDirOption;
+import org.drools.builder.conf.EvaluatorOption;
+import org.drools.builder.conf.ProcessStringEscapesOption;
+import org.drools.runtime.rule.AccumulateFunction;
+
+/**
+ * @author etirelli
+ *
+ */
+public class KnowledgeBuilderConfigurationTest extends TestCase {
+
+    private KnowledgeBuilderConfiguration config;
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+        config = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
+    }
+
+    public void testDefaultDialectConfiguration() {
+        // setting the default dialect using the type safe method
+        config.setOption( DefaultDialectOption.get( "mvel" ) );
+
+        // checking the type safe getOption() method
+        assertEquals( DefaultDialectOption.get( "mvel" ),
+                      config.getOption( DefaultDialectOption.class ) );
+        // checking string conversion
+        assertEquals( "mvel",
+                      config.getOption( DefaultDialectOption.class ).getName() );
+        // checking the string based getProperty() method
+        assertEquals( "mvel",
+                      config.getProperty( DefaultDialectOption.PROPERTY_NAME ) );
+
+        // setting the default dialect using the string based setProperty() method
+        config.setProperty( DefaultDialectOption.PROPERTY_NAME,
+                            "java" );
+        
+        // checking the type safe getOption() method
+        assertEquals( DefaultDialectOption.get( "java" ),
+                      config.getOption( DefaultDialectOption.class ) );
+        // checking string conversion
+        assertEquals( "java",
+                      config.getOption( DefaultDialectOption.class ).getName() );
+        // checking the string based getProperty() method
+        assertEquals( "java",
+                      config.getProperty( DefaultDialectOption.PROPERTY_NAME ) );
+    }
+    
+    public void testAccumulateFunctionConfiguration() {
+        // in this use case, the application already has the instance of the accumulate function
+        AccumulateFunction function = new AverageAccumulateFunction();
+        
+        // creating the option and storing in a local var just to make test easier
+        AccumulateFunctionOption option = AccumulateFunctionOption.get( "avg", function );
+        
+        // wiring the accumulate function using the type safe method
+        config.setOption( option );
+
+        // checking the type safe getOption() method
+        assertEquals( option,
+                      config.getOption( AccumulateFunctionOption.class, "avg" ) );
+        // checking string conversion
+        assertEquals( "avg",
+                      config.getOption( AccumulateFunctionOption.class, "avg" ).getName() );
+        assertEquals( function,
+                      config.getOption( AccumulateFunctionOption.class, "avg" ).getFunction() );
+        // checking the string based getProperty() method
+        assertEquals( AverageAccumulateFunction.class.getName(),
+                      config.getProperty( AccumulateFunctionOption.PROPERTY_NAME+"avg" ) );
+
+        // wiring the accumulate function using the string based setProperty() method
+        config.setProperty( AccumulateFunctionOption.PROPERTY_NAME+"maximum",
+                            MaxAccumulateFunction.class.getName() );
+        
+        MaxAccumulateFunction max = new MaxAccumulateFunction();
+        // checking the type safe getOption() method
+        assertEquals( AccumulateFunctionOption.get( "maximum", max ),
+                      config.getOption( AccumulateFunctionOption.class, "maximum" ) );
+        // checking string conversion
+        assertEquals( "maximum",
+                      config.getOption( AccumulateFunctionOption.class, "maximum" ).getName() );
+        assertEquals( max.getClass().getName(),
+                      config.getOption( AccumulateFunctionOption.class, "maximum" ).getFunction().getClass().getName() );
+        // checking the string based getProperty() method
+        assertEquals( MaxAccumulateFunction.class.getName(),
+                      config.getProperty( AccumulateFunctionOption.PROPERTY_NAME+"maximum" ) );
+    }
+    
+    public void testDumpDirectoryConfiguration() {
+        File dumpDir = new File("target");
+        // setting the dump directory using the type safe method
+        config.setOption( DumpDirOption.get( dumpDir ) );
+
+        // checking the type safe getOption() method
+        assertEquals( DumpDirOption.get( dumpDir ),
+                      config.getOption( DumpDirOption.class ) );
+        // checking string conversion
+        assertEquals( dumpDir,
+                      config.getOption( DumpDirOption.class ).getDirectory() );
+        // checking the string based getProperty() method
+        assertEquals( dumpDir.toString(),
+                      config.getProperty( DumpDirOption.PROPERTY_NAME ) );
+
+        // setting the dump dir using the string based setProperty() method
+        dumpDir = new File( "src/main/resources" );
+        config.setProperty( DumpDirOption.PROPERTY_NAME,
+                            "src/main/resources" );
+        
+        // checking the type safe getOption() method
+        assertEquals( DumpDirOption.get( dumpDir ),
+                      config.getOption( DumpDirOption.class ) );
+        // checking string conversion
+        assertEquals( dumpDir,
+                      config.getOption( DumpDirOption.class ).getDirectory() );
+        // checking the string based getProperty() method
+        assertEquals( dumpDir.toString(),
+                      config.getProperty( DumpDirOption.PROPERTY_NAME ) );
+    }
+    
+    public void testEvaluatorConfiguration() {
+        // in this use case, the application already has the instance of the evaluator definition
+        EvaluatorDefinition afterDef = new AfterEvaluatorDefinition();
+        assertNotNull( afterDef );
+        
+        // creating the option and storing in a local var just to make test easier
+        EvaluatorOption option = EvaluatorOption.get( "after", afterDef );
+        
+        // wiring the evaluator definition using the type safe method
+        config.setOption( option );
+
+        // checking the type safe getOption() method
+        assertEquals( option,
+                      config.getOption( EvaluatorOption.class, "after" ) );
+        // checking string conversion
+        assertEquals( "after",
+                      config.getOption( EvaluatorOption.class, "after" ).getName() );
+        assertEquals( afterDef,
+                      config.getOption( EvaluatorOption.class, "after" ).getEvaluatorDefinition() );
+        // checking the string based getProperty() method
+        assertEquals( AfterEvaluatorDefinition.class.getName(),
+                      config.getProperty( EvaluatorOption.PROPERTY_NAME+"after" ) );
+
+        // wiring the evaluator definition using the string based setProperty() method
+        config.setProperty( EvaluatorOption.PROPERTY_NAME+"before",
+                            BeforeEvaluatorDefinition.class.getName() );
+        
+        BeforeEvaluatorDefinition beforeDef = new BeforeEvaluatorDefinition();
+        // checking the type safe getOption() method
+        assertEquals( EvaluatorOption.get( "before", beforeDef ),
+                      config.getOption( EvaluatorOption.class, "before" ) );
+        // checking string conversion
+        assertEquals( "before",
+                      config.getOption( EvaluatorOption.class, "before" ).getName() );
+        assertEquals( beforeDef.getClass().getName(),
+                      config.getOption( EvaluatorOption.class, "before" ).getEvaluatorDefinition().getClass().getName() );
+        // checking the string based getProperty() method
+        assertEquals( beforeDef.getClass().getName(),
+                      config.getProperty( EvaluatorOption.PROPERTY_NAME+"before" ) );
+    }
+    
+    public void testProcessStringEscapesConfiguration() {
+        // setting the process string escapes option using the type safe method
+        config.setOption( ProcessStringEscapesOption.YES );
+
+        // checking the type safe getOption() method
+        assertEquals( ProcessStringEscapesOption.YES,
+                      config.getOption( ProcessStringEscapesOption.class ) );
+        // checking the string based getProperty() method
+        assertEquals( "true",
+                      config.getProperty( ProcessStringEscapesOption.PROPERTY_NAME ) );
+
+        // setting the default dialect using the string based setProperty() method
+        config.setProperty( ProcessStringEscapesOption.PROPERTY_NAME,
+                            "false" );
+        
+        // checking the type safe getOption() method
+        assertEquals( ProcessStringEscapesOption.NO,
+                      config.getOption( ProcessStringEscapesOption.class ) );
+        // checking the string based getProperty() method
+        assertEquals( "false",
+                      config.getProperty( ProcessStringEscapesOption.PROPERTY_NAME ) );
+    }
+    
+    
+
+}


Property changes on: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/builder/KnowledgeBuilderConfigurationTest.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ValueType.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ValueType.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/ValueType.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -129,14 +129,23 @@
         return determineValueType( this.classType );
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.ValueTypeInterface#getName()
+     */
     public String getName() {
         return this.name;
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.ValueTypeInterface#getClassType()
+     */
     public Class<?> getClassType() {
         return this.classType;
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.ValueTypeInterface#getSimpleType()
+     */
     public int getSimpleType() {
         return this.simpleType;
     }
@@ -219,28 +228,46 @@
         return false;
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.ValueTypeInterface#isBoolean()
+     */
     public boolean isBoolean() {
         return ((this.classType == Boolean.class) || (this.classType == Boolean.TYPE));
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.ValueTypeInterface#isNumber()
+     */
     public boolean isNumber() {
         return (this.simpleType == SimpleValueType.INTEGER ||
                 this.simpleType == SimpleValueType.DECIMAL ||
                 this.simpleType == SimpleValueType.CHAR);
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.ValueTypeInterface#isIntegerNumber()
+     */
     public boolean isIntegerNumber() {
         return this.simpleType == SimpleValueType.INTEGER;
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.ValueTypeInterface#isFloatNumber()
+     */
     public boolean isFloatNumber() {
         return this.simpleType == SimpleValueType.DECIMAL;
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.ValueTypeInterface#isChar()
+     */
     public boolean isChar() {
         return this.simpleType == SimpleValueType.CHAR;
     }
     
+    /* (non-Javadoc)
+     * @see org.drools.base.ValueTypeInterface#isEvent()
+     */
     public boolean isEvent() { 
         return this.classType == EventFactHandle.class;
     }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/accumulators/JavaAccumulatorFunctionExecutor.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/accumulators/JavaAccumulatorFunctionExecutor.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/accumulators/JavaAccumulatorFunctionExecutor.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -48,13 +48,13 @@
     private static final long     serialVersionUID = 400L;
 
     private ReturnValueExpression expression;
-    private AccumulateFunction    function;
+    private org.drools.runtime.rule.AccumulateFunction    function;
 
     public JavaAccumulatorFunctionExecutor() {
 
     }
 
-    public JavaAccumulatorFunctionExecutor(final AccumulateFunction function) {
+    public JavaAccumulatorFunctionExecutor(final org.drools.runtime.rule.AccumulateFunction function) {
         super();
         this.function = function;
     }
@@ -62,7 +62,7 @@
     public void readExternal(ObjectInput in) throws IOException,
                                             ClassNotFoundException {
         expression = (ReturnValueExpression) in.readObject();
-        function = (AccumulateFunction) in.readObject();
+        function = (org.drools.runtime.rule.AccumulateFunction) in.readObject();
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/accumulators/MVELAccumulatorFunctionExecutor.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/accumulators/MVELAccumulatorFunctionExecutor.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/accumulators/MVELAccumulatorFunctionExecutor.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -51,7 +51,7 @@
     private final Object        dummy            = new Object();
 
     private MVELCompilationUnit unit;
-    private AccumulateFunction  function;
+    private org.drools.runtime.rule.AccumulateFunction  function;
 
     private DroolsMVELFactory   model;
     private Serializable        expression;
@@ -61,7 +61,7 @@
     }
 
     public MVELAccumulatorFunctionExecutor(MVELCompilationUnit unit,
-                                           final AccumulateFunction function) {
+                                           final org.drools.runtime.rule.AccumulateFunction function) {
         super();
         this.unit = unit;
         this.function = function;
@@ -70,7 +70,7 @@
     public void readExternal(ObjectInput in) throws IOException,
                                             ClassNotFoundException {
         unit = (MVELCompilationUnit) in.readObject();
-        function = (AccumulateFunction) in.readObject();
+        function = (org.drools.runtime.rule.AccumulateFunction) in.readObject();
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/AfterEvaluatorDefinition.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/AfterEvaluatorDefinition.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/AfterEvaluatorDefinition.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -28,6 +28,7 @@
 import org.drools.RuntimeDroolsException;
 import org.drools.base.BaseEvaluator;
 import org.drools.base.ValueType;
+import org.drools.base.evaluators.EvaluatorDefinition.Target;
 import org.drools.common.EventFactHandle;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/EvaluatorDefinition.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/EvaluatorDefinition.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/EvaluatorDefinition.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -31,7 +31,7 @@
  *
  * @author etirelli
  */
-public interface EvaluatorDefinition extends Externalizable {
+public interface EvaluatorDefinition extends Externalizable, org.drools.runtime.rule.EvaluatorDefinition {
 
     /**
      * Returns the list of identifies this

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/Operator.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/Operator.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/Operator.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -12,7 +12,7 @@
 
 public class Operator
     implements
-    Externalizable {
+    Externalizable, org.drools.runtime.rule.Operator {
 
     private static final long                  serialVersionUID = 400L;
 
@@ -111,10 +111,16 @@
         return "Operator = '" + this.operator + "'";
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.evaluators.OperatorInterface#getOperatorString()
+     */
     public String getOperatorString() {
         return this.operator;
     }
 
+    /* (non-Javadoc)
+     * @see org.drools.base.evaluators.OperatorInterface#isNegated()
+     */
     public boolean isNegated() {
         return this.isNegated;
     }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CompositeObjectSinkAdapter.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CompositeObjectSinkAdapter.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/CompositeObjectSinkAdapter.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -14,8 +14,8 @@
 import org.drools.common.InternalWorkingMemory;
 import org.drools.common.RuleBasePartitionId;
 import org.drools.rule.LiteralConstraint;
+import org.drools.runtime.rule.Evaluator;
 import org.drools.spi.AlphaNodeFieldConstraint;
-import org.drools.spi.Evaluator;
 import org.drools.spi.FieldValue;
 import org.drools.spi.InternalReadAccessor;
 import org.drools.spi.PropagationContext;

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/ReturnValueConstraint.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -26,8 +26,8 @@
 import org.drools.common.InternalWorkingMemory;
 import org.drools.reteoo.LeftTuple;
 import org.drools.rule.ReturnValueRestriction.ReturnValueContextEntry;
+import org.drools.runtime.rule.Evaluator;
 import org.drools.spi.AcceptsReadAccessor;
-import org.drools.spi.Evaluator;
 import org.drools.spi.InternalReadAccessor;
 import org.drools.spi.ReturnValueExpression;
 

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/Evaluator.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/Evaluator.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/spi/Evaluator.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -19,10 +19,10 @@
 import java.io.Serializable;
 
 import org.drools.base.ValueType;
-import org.drools.base.evaluators.Operator;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.rule.VariableRestriction.VariableContextEntry;
+import org.drools.runtime.rule.Operator;
 import org.drools.time.Interval;
 
 /**
@@ -30,7 +30,7 @@
  */
 public interface Evaluator
     extends
-    Serializable {
+    Serializable, org.drools.runtime.rule.Evaluator {
 
     /**
      * Returns the type of the values this evaluator operates upon.

Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -325,7 +325,7 @@
             final Object[] row = data[i];
             boolean isNegated = ((String) row[1]).startsWith( "not " );
             String evaluatorStr = isNegated ? ((String) row[1]).substring( 4 ) : (String) row[1];
-            final Evaluator evaluator = registry.getEvaluatorDefinition( evaluatorStr ).getEvaluator( valueType,
+            final Evaluator evaluator = (Evaluator) registry.getEvaluatorDefinition( evaluatorStr ).getEvaluator( valueType,
                                                                                                       evaluatorStr,
                                                                                                       isNegated,
                                                                                                       null );

Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/AgendaEventSupportTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/AgendaEventSupportTest.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/AgendaEventSupportTest.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -26,8 +26,10 @@
 import junit.framework.TestCase;
 
 import org.drools.Cheese;
+import org.drools.FactHandle;
 import org.drools.RuleBase;
 import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
 import org.drools.base.ClassFieldAccessorCache;
 import org.drools.base.ClassFieldReader;
 import org.drools.base.ClassObjectType;
@@ -45,8 +47,6 @@
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;
 import org.drools.rule.Rule;
-import org.drools.FactHandle;
-import org.drools.WorkingMemory;
 import org.drools.spi.Consequence;
 import org.drools.spi.Evaluator;
 import org.drools.spi.FieldValue;

Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/RuleBaseEventSupportTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/RuleBaseEventSupportTest.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/RuleBaseEventSupportTest.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -17,39 +17,33 @@
  */
 package org.drools.event;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
 import junit.framework.TestCase;
 
 import org.drools.Cheese;
 import org.drools.RuleBase;
 import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
+import org.drools.base.ClassFieldAccessorCache;
 import org.drools.base.ClassFieldAccessorStore;
 import org.drools.base.ClassFieldReader;
-import org.drools.base.ClassFieldAccessorCache;
 import org.drools.base.ClassObjectType;
 import org.drools.base.FieldFactory;
 import org.drools.base.ValueType;
 import org.drools.base.evaluators.EqualityEvaluatorsDefinition;
 import org.drools.base.evaluators.Operator;
-import org.drools.event.AfterFunctionRemovedEvent;
-import org.drools.event.AfterRuleAddedEvent;
-import org.drools.event.AfterRuleRemovedEvent;
-import org.drools.event.BeforeFunctionRemovedEvent;
-import org.drools.event.BeforeRuleAddedEvent;
-import org.drools.event.BeforeRuleRemovedEvent;
 import org.drools.rule.LiteralConstraint;
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;
 import org.drools.rule.Rule;
-import org.drools.WorkingMemory;
 import org.drools.spi.Consequence;
 import org.drools.spi.Evaluator;
 import org.drools.spi.FieldValue;
 import org.drools.spi.KnowledgeHelper;
 
-import java.io.ObjectOutput;
-import java.io.IOException;
-import java.io.ObjectInput;
-
 /**
  * @author etirelli
  *

Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/rule/AgendaEventSupportTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/rule/AgendaEventSupportTest.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/event/rule/AgendaEventSupportTest.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -46,10 +46,8 @@
 import org.drools.rule.Package;
 import org.drools.rule.Pattern;
 import org.drools.rule.Rule;
-import org.drools.runtime.KnowledgeRuntime;
 import org.drools.runtime.StatefulKnowledgeSession;
 import org.drools.runtime.rule.FactHandle;
-import org.drools.runtime.rule.WorkingMemory;
 import org.drools.spi.Consequence;
 import org.drools.spi.Evaluator;
 import org.drools.spi.FieldValue;

Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/examples/manners/BaseMannersTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/examples/manners/BaseMannersTest.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/examples/manners/BaseMannersTest.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -34,6 +34,7 @@
 
 import junit.framework.TestCase;
 
+import org.drools.WorkingMemory;
 import org.drools.base.ClassFieldAccessorCache;
 import org.drools.base.ClassFieldAccessorStore;
 import org.drools.base.ClassObjectType;
@@ -52,7 +53,6 @@
 import org.drools.rule.Pattern;
 import org.drools.rule.Rule;
 import org.drools.rule.VariableConstraint;
-import org.drools.WorkingMemory;
 import org.drools.spi.AlphaNodeFieldConstraint;
 import org.drools.spi.BetaNodeFieldConstraint;
 import org.drools.spi.Consequence;

Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/QueryTerminalNodeTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/QueryTerminalNodeTest.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/reteoo/QueryTerminalNodeTest.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -23,9 +23,11 @@
 import junit.framework.Assert;
 import junit.framework.TestCase;
 
+import org.drools.FactHandle;
 import org.drools.QueryResult;
 import org.drools.QueryResults;
 import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
 import org.drools.base.ClassFieldAccessorCache;
 import org.drools.base.ClassFieldAccessorStore;
 import org.drools.base.ClassFieldReader;
@@ -40,8 +42,6 @@
 import org.drools.rule.Behavior;
 import org.drools.rule.LiteralConstraint;
 import org.drools.rule.Query;
-import org.drools.FactHandle;
-import org.drools.WorkingMemory;
 import org.drools.spi.Evaluator;
 import org.drools.spi.FieldValue;
 

Modified: labs/jbossrules/trunk/drools-core/src/test/java/org/drools/rule/FieldConstraintTest.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/test/java/org/drools/rule/FieldConstraintTest.java	2009-02-18 01:47:29 UTC (rev 25315)
+++ labs/jbossrules/trunk/drools-core/src/test/java/org/drools/rule/FieldConstraintTest.java	2009-02-18 02:41:07 UTC (rev 25316)
@@ -25,6 +25,7 @@
 
 import org.drools.Cheese;
 import org.drools.RuleBaseFactory;
+import org.drools.WorkingMemory;
 import org.drools.base.ClassFieldAccessorCache;
 import org.drools.base.ClassFieldAccessorStore;
 import org.drools.base.ClassFieldReader;
@@ -41,7 +42,6 @@
 import org.drools.reteoo.RightTuple;
 import org.drools.rule.PredicateConstraint.PredicateContextEntry;
 import org.drools.rule.ReturnValueRestriction.ReturnValueContextEntry;
-import org.drools.WorkingMemory;
 import org.drools.spi.Evaluator;
 import org.drools.spi.FieldValue;
 import org.drools.spi.InternalReadAccessor;




More information about the jboss-svn-commits mailing list