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

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Feb 19 21:11:35 EST 2009


Author: tirelli
Date: 2009-02-19 21:11:35 -0500 (Thu, 19 Feb 2009)
New Revision: 25355

Added:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/KnowledgeBuilderOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/KnowledgeBuilderOptionsConfiguration.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/AssertBehaviorOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/IndexLeftBetaMemoryOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/IndexRightBetaMemoryOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/KnowledgeBaseOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/KnowledgeBaseOptionsConfiguration.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/LogicalOverrideOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/MaintainTMSOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/RemoveIdentitiesOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/SequentialAgendaOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/SequentialOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/ShareAlphaNodesOption.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/ShareBetaNodesOption.java
Removed:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/OptionsConfiguration.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-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/Option.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java
Log:
Working on the typesafe configuration

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-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseConfiguration.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -1,6 +1,6 @@
 package org.drools;
 
-import org.drools.conf.OptionsConfiguration;
+import org.drools.conf.KnowledgeBaseOptionsConfiguration;
 
 /**
  *<p>
@@ -28,19 +28,18 @@
  * <p>
  * The following properties are supported:
  * <ul>
- * <li>drools.maintainTms = &lt;true|false&gt;</li>
- * <li>drools.assertBehaviour = &lt;identity|equality&gt;</li>
- * <li>drools.logicalOverride = &lt;discard|preserve&gt;</li>
- * <li>drools.sequential = &lt;true|false&gt;</li>
- * <li>drools.sequential.agenda = &lt;sequential|dynamic&gt;</li>
- * <li>drools.removeIdentities = &lt;true|false&gt;</li>
- * <li>drools.shareAlphaNodes  = &lt;true|false&gt;</li>
- * <li>drools.shareBetaNodes = &lt;true|false&gt;</li>
- * <li>drools.alphaMemory = &lt;true/false&gt;</li>
+ * X<li>drools.maintainTms = &lt;true|false&gt;</li>
+ * X<li>drools.assertBehaviour = &lt;identity|equality&gt;</li>
+ * X<li>drools.logicalOverride = &lt;discard|preserve&gt;</li>
+ * X<li>drools.sequential = &lt;true|false&gt;</li>
+ * X<li>drools.sequential.agenda = &lt;sequential|dynamic&gt;</li>
+ * X<li>drools.removeIdentities = &lt;true|false&gt;</li>
+ * X<li>drools.shareAlphaNodes  = &lt;true|false&gt;</li>
+ * X<li>drools.shareBetaNodes = &lt;true|false&gt;</li>
  * <li>drools.alphaNodeHashingThreshold = &lt;1...n&gt;</li>
  * <li>drools.compositeKeyDepth  = &lt;1..3&gt;</li>
- * <li>drools.indexLeftBetaMemory = &lt;true/false&gt;</li>
- * <li>drools.indexRightBetaMemory = &lt;true/false&gt;</li>
+ * X<li>drools.indexLeftBetaMemory = &lt;true/false&gt;</li>
+ * X<li>drools.indexRightBetaMemory = &lt;true/false&gt;</li>
  * <li>drools.consequenceExceptionHandler = &lt;qualified class name&gt;</li>
  * </ul>
  * </p>
@@ -57,6 +56,7 @@
  */
 public interface KnowledgeBaseConfiguration
     extends
-    PropertiesConfiguration {
+    PropertiesConfiguration,
+    KnowledgeBaseOptionsConfiguration {
 
 }

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-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/KnowledgeBuilderConfiguration.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -1,7 +1,7 @@
 package org.drools.builder;
 
 import org.drools.PropertiesConfiguration;
-import org.drools.conf.OptionsConfiguration;
+import org.drools.builder.conf.KnowledgeBuilderOptionsConfiguration;
 
 /**
  * <p>
@@ -33,6 +33,7 @@
  * <li>drools.accumulate.function.&lt;function name&gt; = &lt;qualified class&gt;</li>
  * <li>drools.evaluator.<ident> = &lt;qualified class&gt;</li>
  * <li>drools.dump.dir = &lt;String&gt;</li>
+ * <li>drools.parser.processStringEscapes = $lt;true|false&gt;</li>
  * </ul>
  * </p>
  * 
@@ -51,6 +52,6 @@
 public interface KnowledgeBuilderConfiguration
     extends
     PropertiesConfiguration,
-    OptionsConfiguration {
+    KnowledgeBuilderOptionsConfiguration {
 
 }

Modified: 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	2009-02-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/AccumulateFunctionOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -16,7 +16,6 @@
  */
 package org.drools.builder.conf;
 
-import org.drools.conf.Option;
 import org.drools.runtime.rule.AccumulateFunction;
 
 /**
@@ -24,7 +23,7 @@
  * 
  * @author etirelli
  */
-public class AccumulateFunctionOption implements Option {
+public class AccumulateFunctionOption implements KnowledgeBuilderOption {
 
     private static final long serialVersionUID = -8461267995706982981L;
 

Modified: 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	2009-02-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DefaultDialectOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -16,14 +16,13 @@
  */
 package org.drools.builder.conf;
 
-import org.drools.conf.Option;
 
 /**
  * A class for the default dialect configuration.
  * 
  * @author etirelli
  */
-public class DefaultDialectOption implements Option {
+public class DefaultDialectOption implements KnowledgeBuilderOption {
 
     private static final long serialVersionUID = -8461267995706982981L;
 

Modified: 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	2009-02-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/DumpDirOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -18,8 +18,6 @@
 
 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
@@ -27,7 +25,7 @@
  * 
  * @author etirelli
  */
-public class DumpDirOption implements Option {
+public class DumpDirOption implements KnowledgeBuilderOption {
 
     private static final long serialVersionUID = -8461267995706982981L;
 

Modified: 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	2009-02-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/EvaluatorOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -16,7 +16,6 @@
  */
 package org.drools.builder.conf;
 
-import org.drools.conf.Option;
 import org.drools.runtime.rule.EvaluatorDefinition;
 
 /**
@@ -27,7 +26,7 @@
  * 
  * @author etirelli
  */
-public class EvaluatorOption implements Option {
+public class EvaluatorOption implements KnowledgeBuilderOption {
 
     private static final long serialVersionUID = -8461267995706982981L;
 

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/KnowledgeBuilderOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/KnowledgeBuilderOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/KnowledgeBuilderOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,30 @@
+/*
+ * 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 markup interface for KnowledgeBuilderConfiguration options
+ * 
+ * @author etirelli
+ */
+public interface KnowledgeBuilderOption
+    extends
+    Option {
+
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/KnowledgeBuilderOptionsConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/KnowledgeBuilderOptionsConfiguration.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/KnowledgeBuilderOptionsConfiguration.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,60 @@
+/*
+ * 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;
+
+/**
+ * A base interface for type safe configurations
+ * 
+ * @author etirelli
+ */
+public interface KnowledgeBuilderOptionsConfiguration {
+    
+    /**
+     * 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 KnowledgeBuilderOption> 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 KnowledgeBuilderOption> 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 KnowledgeBuilderOption> T getOption( Class<T> option, String key );
+    
+
+}


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

Modified: 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	2009-02-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/builder/conf/ProcessStringEscapesOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -16,28 +16,52 @@
  */
 package org.drools.builder.conf;
 
-import org.drools.conf.Option;
 
 /**
- * An enum for ProcessStringEscapes option.
+ * An Enum for ProcessStringEscapes option.
  * 
+ * drools.parser.processStringEscapes = &lt;true|false&gt; 
+ * 
+ * DEFAULT = true
+ * 
+ * When parsing a DRL file, drools will by default process the String escapes and
+ * convert them into the appropriate character. For instance, if drools find a
+ * "\n" inside a String, drools will convert that into a single new line character.
+ * If you want that to show up as the two characters BACK_SLASH+N, you need to escape
+ * the SLASH: "\\n", the same way you do in Java files.
+ * 
+ * This is different, though, from what happened in Drools 4. Drools 4 never processed
+ * String escapes, making it impossible to encode special characters into Strings. But,
+ * if for any reason, you need the Drools 4 behaviour when parsing files, just set this
+ * option to NO (false).
+ * 
  * @author etirelli
  */
-public enum ProcessStringEscapesOption implements Option {
+public enum ProcessStringEscapesOption implements KnowledgeBuilderOption {
     
-    YES,
-    NO;
+    YES(true),
+    NO(false);
 
     /**
      * The property name for the process string escapes option
      */
     public static final String PROPERTY_NAME = "drools.parser.processStringEscapes";
     
+    private boolean value;
+    
+    ProcessStringEscapesOption( final boolean value ) {
+        this.value = value;
+    }
+    
     /**
      * {@inheritDoc}
      */
     public String getPropertyName() {
         return PROPERTY_NAME;
     }
+    
+    public boolean isProcessStringEscapes() {
+        return this.value;
+    }
 
 }

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/AssertBehaviorOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/AssertBehaviorOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/AssertBehaviorOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for AssertBehavior option.
+ * 
+ * drools.assertBehaviour = &lt;identity|equality&gt;
+ * 
+ * DEFAULT = identity
+ * 
+ * @author etirelli
+ */
+public enum AssertBehaviorOption implements KnowledgeBaseOption {
+    
+    IDENTITY,
+    EQUALITY;
+
+    /**
+     * The property name for the sequential mode option
+     */
+    public static final String PROPERTY_NAME = "drools.assertBehaviour";
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/IndexLeftBetaMemoryOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/IndexLeftBetaMemoryOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/IndexLeftBetaMemoryOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for indexLeftBetaMemory option.
+ * 
+ * drools.indexLeftBetaMemory = &lt;true|false&gt; 
+ * 
+ * DEFAULT = true
+ * 
+ * @author etirelli
+ */
+public enum IndexLeftBetaMemoryOption implements KnowledgeBaseOption {
+    
+    YES(true),
+    NO(false);
+
+    /**
+     * The property name for the share beta nodes option
+     */
+    public static final String PROPERTY_NAME = "drools.indexLeftBetaMemory";
+    
+    private boolean value;
+    
+    IndexLeftBetaMemoryOption( final boolean value ) {
+        this.value = value;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    public boolean isIndexLeftBetaMemory() {
+        return this.value;
+    }
+
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/IndexRightBetaMemoryOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/IndexRightBetaMemoryOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/IndexRightBetaMemoryOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for indexRightBetaMemory option.
+ * 
+ * drools.indexRightBetaMemory = &lt;true|false&gt; 
+ * 
+ * DEFAULT = true
+ * 
+ * @author etirelli
+ */
+public enum IndexRightBetaMemoryOption implements KnowledgeBaseOption {
+    
+    YES(true),
+    NO(false);
+
+    /**
+     * The property name for the share beta nodes option
+     */
+    public static final String PROPERTY_NAME = "drools.indexRightBetaMemory";
+    
+    private boolean value;
+    
+    IndexRightBetaMemoryOption( final boolean value ) {
+        this.value = value;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    public boolean isIndexRightBetaMemory() {
+        return this.value;
+    }
+
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/KnowledgeBaseOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/KnowledgeBaseOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/KnowledgeBaseOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,30 @@
+/*
+ * 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 org.drools.conf.Option;
+
+/**
+ * A markup interface for KnowledgeBaseConfiguration options
+ * 
+ * @author etirelli
+ */
+public interface KnowledgeBaseOption
+    extends
+    Option {
+
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/KnowledgeBaseOptionsConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/KnowledgeBaseOptionsConfiguration.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/KnowledgeBaseOptionsConfiguration.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,60 @@
+/*
+ * 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 KnowledgeBaseOptionsConfiguration {
+    
+    /**
+     * 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 KnowledgeBaseOption> 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 KnowledgeBaseOption> 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 KnowledgeBaseOption> T getOption( Class<T> option, String key );
+    
+
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/LogicalOverrideOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/LogicalOverrideOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/LogicalOverrideOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for LogicalOverride option.
+ * 
+ * drools.logicalOverride = &lt;discard|preserve&gt;
+ * 
+ * DEFAULT = discard
+ * 
+ * @author etirelli
+ */
+public enum LogicalOverrideOption implements KnowledgeBaseOption {
+    
+    DISCARD,
+    PRESERVE;
+
+    /**
+     * The property name for the sequential mode option
+     */
+    public static final String PROPERTY_NAME = "drools.logicalOverride";
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/MaintainTMSOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/MaintainTMSOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/MaintainTMSOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for MaintainTMS option.
+ * 
+ * drools.maintainTms = &lt;true|false&gt; 
+ * 
+ * DEFAULT = true
+ * 
+ * @author etirelli
+ */
+public enum MaintainTMSOption implements KnowledgeBaseOption {
+    
+    YES(true),
+    NO(false);
+
+    /**
+     * The property name for the maintain TMS option
+     */
+    public static final String PROPERTY_NAME = "drools.maintainTms";
+    
+    private boolean value;
+    
+    MaintainTMSOption( final boolean value ) {
+        this.value = value;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    public boolean isMaintainTMS() {
+        return this.value;
+    }
+
+}


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

Modified: 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	2009-02-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/Option.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -19,7 +19,7 @@
 import java.io.Serializable;
 
 /**
- * A base interface for type safe options
+ * A base interface for type safe options in configuration objects
  * 
  * @author etirelli
  */

Deleted: 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	2009-02-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/OptionsConfiguration.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -1,61 +0,0 @@
-/*
- * 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 );
-    
-
-}

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/RemoveIdentitiesOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/RemoveIdentitiesOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/RemoveIdentitiesOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for Remove Identities option.
+ * 
+ * drools.removeIdentities = &lt;true|false&gt; 
+ * 
+ * DEFAULT = false
+ * 
+ * @author etirelli
+ */
+public enum RemoveIdentitiesOption implements KnowledgeBaseOption {
+    
+    YES(true),
+    NO(false);
+
+    /**
+     * The property name for the remove identities option
+     */
+    public static final String PROPERTY_NAME = "drools.removeIdentities";
+    
+    private boolean value;
+    
+    RemoveIdentitiesOption( final boolean value ) {
+        this.value = value;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    public boolean isRemoveIdentities() {
+        return this.value;
+    }
+
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/SequentialAgendaOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/SequentialAgendaOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/SequentialAgendaOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for SequentialAgenda option.
+ * 
+ * drools.sequential.agenda = &lt;sequential|dynamic&gt;
+ * 
+ * DEFAULT = sequential
+ * 
+ * @author etirelli
+ */
+public enum SequentialAgendaOption implements KnowledgeBaseOption {
+    
+    SEQUENTIAL,
+    DYNAMIC;
+
+    /**
+     * The property name for the sequential mode option
+     */
+    public static final String PROPERTY_NAME = "drools.sequential.agenda";
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/SequentialOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/SequentialOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/SequentialOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for Sequential option.
+ * 
+ * drools.sequential = &lt;true|false&gt; 
+ * 
+ * DEFAULT = false
+ * 
+ * @author etirelli
+ */
+public enum SequentialOption implements KnowledgeBaseOption {
+    
+    YES(true),
+    NO(false);
+
+    /**
+     * The property name for the sequential mode option
+     */
+    public static final String PROPERTY_NAME = "drools.sequential";
+    
+    private boolean value;
+    
+    SequentialOption( final boolean value ) {
+        this.value = value;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    public boolean isSequential() {
+        return this.value;
+    }
+
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/ShareAlphaNodesOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/ShareAlphaNodesOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/ShareAlphaNodesOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for ShareAlphaNodes option.
+ * 
+ * drools.shareAlphaNodes = &lt;true|false&gt; 
+ * 
+ * DEFAULT = true
+ * 
+ * @author etirelli
+ */
+public enum ShareAlphaNodesOption implements KnowledgeBaseOption {
+    
+    YES(true),
+    NO(false);
+
+    /**
+     * The property name for the sequential mode option
+     */
+    public static final String PROPERTY_NAME = "drools.shareAlphaNodes";
+    
+    private boolean value;
+    
+    ShareAlphaNodesOption( final boolean value ) {
+        this.value = value;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    public boolean isShareAlphaNodes() {
+        return this.value;
+    }
+
+}


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

Added: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/ShareBetaNodesOption.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/ShareBetaNodesOption.java	                        (rev 0)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/conf/ShareBetaNodesOption.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -0,0 +1,56 @@
+/*
+ * 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;
+
+
+/**
+ * An Enum for ShareBetaNodes option.
+ * 
+ * drools.shareBetaNodes = &lt;true|false&gt; 
+ * 
+ * DEFAULT = true
+ * 
+ * @author etirelli
+ */
+public enum ShareBetaNodesOption implements KnowledgeBaseOption {
+    
+    YES(true),
+    NO(false);
+
+    /**
+     * The property name for the share beta nodes option
+     */
+    public static final String PROPERTY_NAME = "drools.shareBetaNodes";
+    
+    private boolean value;
+    
+    ShareBetaNodesOption( final boolean value ) {
+        this.value = value;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String getPropertyName() {
+        return PROPERTY_NAME;
+    }
+    
+    public boolean isShareBetaNodes() {
+        return this.value;
+    }
+
+}


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

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-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -33,8 +33,8 @@
 import org.drools.builder.conf.DefaultDialectOption;
 import org.drools.builder.conf.DumpDirOption;
 import org.drools.builder.conf.EvaluatorOption;
+import org.drools.builder.conf.KnowledgeBuilderOption;
 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;
@@ -610,7 +610,7 @@
     }
 
     @SuppressWarnings("unchecked")
-    public <T extends Option> T getOption(Class<T> option) {
+    public <T extends KnowledgeBuilderOption> T getOption(Class<T> option) {
         if ( DefaultDialectOption.class.equals( option ) ) {
             return (T) this.defaultDialect;
         } else if ( DumpDirOption.class.equals( option ) ) {
@@ -622,7 +622,7 @@
     }
 
     @SuppressWarnings("unchecked")
-    public <T extends Option> T getOption(Class<T> option,
+    public <T extends KnowledgeBuilderOption> T getOption(Class<T> option,
                                           String key) {
         if ( AccumulateFunctionOption.class.equals( option ) ) {
             return (T) AccumulateFunctionOption.get( key,
@@ -634,7 +634,7 @@
         return null;
     }
 
-    public <T extends Option> void setOption(T option) {
+    public <T extends KnowledgeBuilderOption> void setOption(T option) {
         if ( option instanceof DefaultDialectOption ) {
             this.defaultDialect = (DefaultDialectOption) option;
         } else if ( option instanceof AccumulateFunctionOption ) {
@@ -645,7 +645,7 @@
         } else if ( option instanceof EvaluatorOption ) {
             this.evaluatorRegistry.addEvaluatorDefinition( (EvaluatorDefinition) ((EvaluatorOption)option).getEvaluatorDefinition() );
         } else if ( option instanceof ProcessStringEscapesOption ) {
-            this.processStringEscapes = ( option == ProcessStringEscapesOption.YES );
+            this.processStringEscapes = ((ProcessStringEscapesOption) option).isProcessStringEscapes();
         }
     }
 }
\ No newline at end of file

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java	2009-02-20 01:57:33 UTC (rev 25354)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseConfiguration.java	2009-02-20 02:11:35 UTC (rev 25355)
@@ -31,6 +31,17 @@
 import org.drools.common.AgendaGroupFactory;
 import org.drools.common.ArrayAgendaGroupFactory;
 import org.drools.common.PriorityQueueAgendaGroupFactory;
+import org.drools.conf.AssertBehaviorOption;
+import org.drools.conf.IndexLeftBetaMemoryOption;
+import org.drools.conf.IndexRightBetaMemoryOption;
+import org.drools.conf.KnowledgeBaseOption;
+import org.drools.conf.LogicalOverrideOption;
+import org.drools.conf.MaintainTMSOption;
+import org.drools.conf.RemoveIdentitiesOption;
+import org.drools.conf.SequentialAgendaOption;
+import org.drools.conf.SequentialOption;
+import org.drools.conf.ShareAlphaNodesOption;
+import org.drools.conf.ShareBetaNodesOption;
 import org.drools.definition.process.Process;
 import org.drools.process.core.Context;
 import org.drools.process.core.ParameterDefinition;
@@ -40,12 +51,8 @@
 import org.drools.process.core.impl.WorkDefinitionExtensionImpl;
 import org.drools.process.instance.ProcessInstanceFactory;
 import org.drools.process.instance.ProcessInstanceFactoryRegistry;
-import org.drools.process.instance.ProcessInstanceManagerFactory;
-import org.drools.process.instance.WorkItemManagerFactory;
-import org.drools.process.instance.event.SignalManagerFactory;
 import org.drools.process.instance.impl.ContextInstanceFactory;
 import org.drools.process.instance.impl.ContextInstanceFactoryRegistry;
-import org.drools.runtime.process.WorkItemHandler;
 import org.drools.spi.ConflictResolver;
 import org.drools.util.ChainedProperties;
 import org.drools.util.ConfFileUtils;
@@ -77,7 +84,6 @@
  * drools.removeIdentities = <true|false>
  * drools.shareAlphaNodes  = <true|false>
  * drools.shareBetaNodes = <true|false>
- * drools.alphaMemory <true/false>
  * drools.alphaNodeHashingThreshold = <1...n>
  * drools.compositeKeyDepth  =<1..3>
  * drools.indexLeftBetaMemory = <true/false>
@@ -230,7 +236,6 @@
               null );
     }
 
-
     public void setProperty(String name,
                             String value) {
         name = name.trim();
@@ -240,27 +245,27 @@
 
         if ( name.equals( "drools.sequential.agenda" ) ) {
             setSequentialAgenda( SequentialAgenda.determineSequentialAgenda( StringUtils.isEmpty( value ) ? "sequential" : value ) );
-        } else if ( name.equals( "drools.sequential" ) ) {
+        } else if ( name.equals( SequentialOption.PROPERTY_NAME ) ) {
             setSequential( StringUtils.isEmpty( value ) ? false : Boolean.valueOf( value ) );
-        } else if ( name.equals( "drools.maintainTms" ) ) {
+        } else if ( name.equals( MaintainTMSOption.PROPERTY_NAME ) ) {
             setMaintainTms( StringUtils.isEmpty( value ) ? false : Boolean.valueOf( value ) );
-        } else if ( name.equals( "drools.removeIdentities" ) ) {
+        } else if ( name.equals( RemoveIdentitiesOption.PROPERTY_NAME ) ) {
             setRemoveIdentities( StringUtils.isEmpty( value ) ? false : Boolean.valueOf( value ) );
-        } else if ( name.equals( "drools.shareAlphaNodes" ) ) {
+        } else if ( name.equals( ShareAlphaNodesOption.PROPERTY_NAME ) ) {
             setShareAlphaNodes( StringUtils.isEmpty( value ) ? false : Boolean.valueOf( value ) );
-        } else if ( name.equals( "drools.shareBetaNodes" ) ) {
+        } else if ( name.equals( ShareBetaNodesOption.PROPERTY_NAME ) ) {
             setShareBetaNodes( StringUtils.isEmpty( value ) ? false : Boolean.valueOf( value ) );
         } else if ( name.equals( "drools.alphaNodeHashingThreshold" ) ) {
             setAlphaNodeHashingThreshold( StringUtils.isEmpty( value ) ? 3 : Integer.parseInt( value ) );
         } else if ( name.equals( "drools.compositeKeyDepth" ) ) {
             setCompositeKeyDepth( StringUtils.isEmpty( value ) ? 3 : Integer.parseInt( value ) );
-        } else if ( name.equals( "drools.indexLeftBetaMemory" ) ) {
+        } else if ( name.equals( IndexLeftBetaMemoryOption.PROPERTY_NAME ) ) {
             setIndexLeftBetaMemory( StringUtils.isEmpty( value ) ? true : Boolean.valueOf( value ) );
-        } else if ( name.equals( "drools.indexRightBetaMemory" ) ) {
+        } else if ( name.equals( IndexRightBetaMemoryOption.PROPERTY_NAME ) ) {
             setIndexRightBetaMemory( StringUtils.isEmpty( value ) ? true : Boolean.valueOf( value ) );
-        } else if ( name.equals( "drools.assertBehaviour" ) ) {
+        } else if ( name.equals( AssertBehaviorOption.PROPERTY_NAME ) ) {
             setAssertBehaviour( AssertBehaviour.determineAssertBehaviour( StringUtils.isEmpty( value ) ? "identity" : value ) );
-        } else if ( name.equals( "drools.logicalOverride" ) ) {
+        } else if ( name.equals( LogicalOverrideOption.PROPERTY_NAME ) ) {
             setLogicalOverride( LogicalOverride.determineLogicalOverride( StringUtils.isEmpty( value ) ? "discard" : value ) );
         } else if ( name.equals( "drools.executorService" ) ) {
             setExecutorService( StringUtils.isEmpty( value ) ? "org.drools.concurrent.DefaultExecutorService" : value );
@@ -821,7 +826,7 @@
             System.err.println( "Error occured while loading work definitions " + location );
             System.err.println( "Continuing without reading these work definitions" );
             t.printStackTrace();
-            throw new RuntimeException("Could not parse work definitions " + location + ": " + t.getMessage());
+            throw new RuntimeException( "Could not parse work definitions " + location + ": " + t.getMessage() );
         }
     }
 
@@ -1149,8 +1154,9 @@
      */
     public static enum EventProcessingMode {
 
-        CLOUD("cloud"), 
-        STREAM("stream");
+        CLOUD(
+                "cloud"), STREAM(
+                "stream");
 
         private String string;
 
@@ -1180,4 +1186,61 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
+    public <T extends KnowledgeBaseOption> T getOption(Class<T> option) {
+        if ( MaintainTMSOption.class.equals( option ) ) {
+            return (T) (this.maintainTms ? MaintainTMSOption.YES : MaintainTMSOption.NO);
+        } else if ( SequentialOption.class.equals( option ) ) {
+            return (T) (this.sequential ? SequentialOption.YES : SequentialOption.NO);
+        } else if ( RemoveIdentitiesOption.class.equals( option ) ) {
+            return (T) (this.removeIdentities ? RemoveIdentitiesOption.YES : RemoveIdentitiesOption.NO);
+        } else if ( ShareAlphaNodesOption.class.equals( option ) ) {
+            return (T) (this.shareAlphaNodes ? ShareAlphaNodesOption.YES : ShareAlphaNodesOption.NO);
+        } else if ( ShareBetaNodesOption.class.equals( option ) ) {
+            return (T) (this.shareBetaNodes ? ShareBetaNodesOption.YES : ShareBetaNodesOption.NO);
+        } else if ( IndexLeftBetaMemoryOption.class.equals( option ) ) {
+            return (T) (this.indexLeftBetaMemory ? IndexLeftBetaMemoryOption.YES : IndexLeftBetaMemoryOption.NO);
+        } else if ( IndexRightBetaMemoryOption.class.equals( option ) ) {
+            return (T) (this.indexRightBetaMemory ? IndexRightBetaMemoryOption.YES : IndexRightBetaMemoryOption.NO);
+        } else if ( AssertBehaviorOption.class.equals( option ) ) {
+            return (T) ( ( this.assertBehaviour == AssertBehaviour.IDENTITY ) ? AssertBehaviorOption.IDENTITY : AssertBehaviorOption.EQUALITY);
+        } else if ( LogicalOverrideOption.class.equals( option ) ) {
+            return (T) ( ( this.logicalOverride == LogicalOverride.DISCARD ) ? LogicalOverrideOption.DISCARD : LogicalOverrideOption.PRESERVE);
+        } else if ( SequentialAgendaOption.class.equals( option ) ) {
+            return (T) ( ( this.sequentialAgenda == SequentialAgenda.SEQUENTIAL ) ? SequentialAgendaOption.SEQUENTIAL : SequentialAgendaOption.DYNAMIC);
+        }
+        return null;
+        
+    }
+
+    public <T extends KnowledgeBaseOption> T getOption(Class<T> option,
+                                          String key) {
+        return null;
+    }
+
+    public <T extends KnowledgeBaseOption> void setOption(T option) {
+        if ( option instanceof MaintainTMSOption ) {
+            this.maintainTms = ((MaintainTMSOption) option).isMaintainTMS();
+        } else if ( option instanceof SequentialOption ) {
+            this.sequential = ((SequentialOption) option).isSequential();
+        } else if ( option instanceof RemoveIdentitiesOption ) {
+            this.removeIdentities = ((RemoveIdentitiesOption) option).isRemoveIdentities();
+        } else if ( option instanceof ShareAlphaNodesOption ) {
+            this.shareAlphaNodes = ((ShareAlphaNodesOption) option).isShareAlphaNodes();
+        } else if ( option instanceof ShareBetaNodesOption ) {
+            this.shareBetaNodes = ((ShareBetaNodesOption) option).isShareBetaNodes();
+        } else if ( option instanceof IndexLeftBetaMemoryOption ) {
+            this.indexLeftBetaMemory = ((IndexLeftBetaMemoryOption) option).isIndexLeftBetaMemory();
+        } else if ( option instanceof IndexRightBetaMemoryOption ) {
+            this.indexRightBetaMemory = ((IndexRightBetaMemoryOption) option).isIndexRightBetaMemory();
+        } else if ( option instanceof AssertBehaviorOption ) {
+            this.assertBehaviour = ( option == AssertBehaviorOption.IDENTITY ) ? AssertBehaviour.IDENTITY : AssertBehaviour.EQUALITY;
+        } else if ( option instanceof LogicalOverrideOption ) {
+            this.logicalOverride = ( option == LogicalOverrideOption.DISCARD ) ? LogicalOverride.DISCARD : LogicalOverride.PRESERVE;
+        } else if ( option instanceof SequentialAgendaOption ) {
+            this.sequentialAgenda = ( option == SequentialAgendaOption.SEQUENTIAL ) ? SequentialAgenda.SEQUENTIAL : SequentialAgenda.DYNAMIC;
+        }
+
+    }
+
 }




More information about the jboss-svn-commits mailing list