[jboss-svn-commits] JBL Code SVN: r9784 - in labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder: dialect/java and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Feb 26 19:23:25 EST 2007
Author: mark.proctor at jboss.com
Date: 2007-02-26 19:23:25 -0500 (Mon, 26 Feb 2007)
New Revision: 9784
Added:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/RuleClassBuilder.java
Removed:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/RuleClassBuilder.java
Modified:
labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/RuleBuilder.java
Log:
JBRULES-708 MVEL Integration
-More interface/implementation seperation for dialects
Deleted: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/RuleClassBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/RuleClassBuilder.java 2007-02-27 00:16:58 UTC (rev 9783)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/RuleClassBuilder.java 2007-02-27 00:23:25 UTC (rev 9784)
@@ -1,66 +0,0 @@
-/*
- * Copyright 2006 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.drools.rule.builder;
-
-import java.util.Iterator;
-
-import org.drools.lang.descr.RuleDescr;
-
-/**
- * @author etirelli
- *
- */
-public class RuleClassBuilder {
-
- public void buildRule(final BuildContext context,
- final BuildUtils utils,
- final RuleDescr ruleDescr) {
- // If there is no compiled code, return
- if ( context.getMethods().isEmpty() ) {
- context.setRuleClass( null );
- return;
- }
- final String lineSeparator = System.getProperty( "line.separator" );
-
- final StringBuffer buffer = new StringBuffer();
- buffer.append( "package " + context.getPkg().getName() + ";" + lineSeparator );
-
- for ( final Iterator it = context.getPkg().getImports().iterator(); it.hasNext(); ) {
- buffer.append( "import " + it.next() + ";" + lineSeparator );
- }
-
- for ( final Iterator it = context.getPkg().getStaticImports().iterator(); it.hasNext(); ) {
- buffer.append( "import static " + it.next() + ";" + lineSeparator );
- }
-
- buffer.append( "public class " + utils.ucFirst( ruleDescr.getClassName() ) + " {" + lineSeparator );
- buffer.append( " private static final long serialVersionUID = 320L;" + lineSeparator );
-
- for ( int i = 0, size = context.getMethods().size() - 1; i < size; i++ ) {
- buffer.append( context.getMethods().get( i ) + lineSeparator );
- }
-
- final String[] lines = buffer.toString().split( lineSeparator );
-
- ruleDescr.setConsequenceOffset( lines.length + 1 );
-
- buffer.append( context.getMethods().get( context.getMethods().size() - 1 ) + lineSeparator );
- buffer.append( "}" );
-
- context.setRuleClass( buffer.toString() );
- }
-}
Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/RuleBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/RuleBuilder.java 2007-02-27 00:16:58 UTC (rev 9783)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/RuleBuilder.java 2007-02-27 00:23:25 UTC (rev 9784)
@@ -49,7 +49,6 @@
import org.drools.rule.builder.ConsequenceBuilder;
import org.drools.rule.builder.ForallBuilder;
import org.drools.rule.builder.GroupElementBuilder;
-import org.drools.rule.builder.RuleClassBuilder;
import org.drools.rule.builder.dialect.mvel.MVELFromBuilder;
/**
Copied: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/RuleClassBuilder.java (from rev 9781, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/RuleClassBuilder.java)
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/RuleClassBuilder.java (rev 0)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/RuleClassBuilder.java 2007-02-27 00:23:25 UTC (rev 9784)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools.rule.builder.dialect.java;
+
+import java.util.Iterator;
+
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.builder.BuildContext;
+import org.drools.rule.builder.BuildUtils;
+
+/**
+ * @author etirelli
+ *
+ */
+public class RuleClassBuilder {
+
+ public void buildRule(final BuildContext context,
+ final BuildUtils utils,
+ final RuleDescr ruleDescr) {
+ // If there is no compiled code, return
+ if ( context.getMethods().isEmpty() ) {
+ context.setRuleClass( null );
+ return;
+ }
+ final String lineSeparator = System.getProperty( "line.separator" );
+
+ final StringBuffer buffer = new StringBuffer();
+ buffer.append( "package " + context.getPkg().getName() + ";" + lineSeparator );
+
+ for ( final Iterator it = context.getPkg().getImports().iterator(); it.hasNext(); ) {
+ buffer.append( "import " + it.next() + ";" + lineSeparator );
+ }
+
+ for ( final Iterator it = context.getPkg().getStaticImports().iterator(); it.hasNext(); ) {
+ buffer.append( "import static " + it.next() + ";" + lineSeparator );
+ }
+
+ buffer.append( "public class " + utils.ucFirst( ruleDescr.getClassName() ) + " {" + lineSeparator );
+ buffer.append( " private static final long serialVersionUID = 320L;" + lineSeparator );
+
+ for ( int i = 0, size = context.getMethods().size() - 1; i < size; i++ ) {
+ buffer.append( context.getMethods().get( i ) + lineSeparator );
+ }
+
+ final String[] lines = buffer.toString().split( lineSeparator );
+
+ ruleDescr.setConsequenceOffset( lines.length + 1 );
+
+ buffer.append( context.getMethods().get( context.getMethods().size() - 1 ) + lineSeparator );
+ buffer.append( "}" );
+
+ context.setRuleClass( buffer.toString() );
+ }
+}
More information about the jboss-svn-commits
mailing list