[jboss-svn-commits] JBL Code SVN: r13263 - in labs/jbossrules/branches/mvel-tooling-2007-06-30: drools-compiler/src/main/java/org/drools/compiler and 10 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Jul 9 12:00:34 EDT 2007
Author: pombredanne
Date: 2007-07-09 12:00:34 -0400 (Mon, 09 Jul 2007)
New Revision: 13263
Added:
labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/AssetEditor.png
Modified:
labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/Section-UserGuide.xml
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/lang/descr/RuleDescr.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/Dialect.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/PatternBuilder.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDebugger.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzer.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELFromBuilder.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELRuleClassBuilder.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilder.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/base/mvel/MVELConsequence.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/base/mvel/MVELDebugHandler.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/rule/PackageCompilationData.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-jbrms/src/test/resources/RepoBinPackage.pkg
labs/jbossrules/branches/mvel-tooling-2007-06-30/m2_repo/org/mvel/mvel14/1.2pre1/mvel14-1.2pre1.jar
Log:
Ported r13262 from trunk to branch mvel-tooling-2007-06-30, plus some comments tags on compiler/core
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/AssetEditor.png (from rev 13262, labs/jbossrules/trunk/documentation/manual/en/Chapter-BRMS/AssetEditor.png)
===================================================================
(Binary files differ)
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/Section-UserGuide.xml
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/Section-UserGuide.xml 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/Section-UserGuide.xml 2007-07-09 16:00:34 UTC (rev 13263)
@@ -11,40 +11,46 @@
involved (but does not go through the concepts in detail). This assumes
you have installed the repository correctly, and are able to access the
main login screen.</para>
-
+
<figure>
- <title>Main feature areas of BRMS</title>
+ <title>Main feature areas of BRMS</title>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="BRMSFeatures.png" format="PNG"
- scalefit="1" />
- </imageobject>
- </mediaobject>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="BRMSFeatures.png" format="PNG"
+ scalefit="1" />
+ </imageobject>
+ </mediaobject>
</figure>
-
- <para>
- The above picture shows the main feature areas of the BRMS.
- <itemizedlist>
- <listitem><para>
- Info: This is the initial screen, with links to resources.</para>
- </listitem>
- <listitem><para>
- Rules: This is the category and business user perspective.</para>
- </listitem>
- <listitem><para>
- Package: This is where packages are configured and managed.</para>
- </listitem>
- <listitem><para>
- Deployment: this is where deployment snapshots are managed.</para>
- </listitem>
- <listitem><para>
- Admin: Administrative functions (categories, statuses, import and export)</para>
- </listitem>
-
- </itemizedlist>
- </para>
+ <para>The above picture shows the main feature areas of the BRMS.
+ <itemizedlist>
+ <listitem>
+ <para>Info: This is the initial screen, with links to
+ resources.</para>
+ </listitem>
+
+ <listitem>
+ <para>Rules: This is the category and business user
+ perspective.</para>
+ </listitem>
+
+ <listitem>
+ <para>Package: This is where packages are configured and
+ managed.</para>
+ </listitem>
+
+ <listitem>
+ <para>Deployment: this is where deployment snapshots are
+ managed.</para>
+ </listitem>
+
+ <listitem>
+ <para>Admin: Administrative functions (categories, statuses, import
+ and export)</para>
+ </listitem>
+ </itemizedlist></para>
+
<para>You can also consult the wiki:
http://wiki.jboss.org/wiki/Wiki.jsp?page=RulesRepository for some
tutorials and user tips (it IS a wiki, so you can even contribute your own
@@ -202,7 +208,7 @@
<title>Rules are assets</title>
<para>As the BRMS can manage many different types of rules (and more),
- they are all classes as "assets". An asset is anything that can be
+ they are all classed as "assets". An asset is anything that can be
stored as a version in the repository. This includes decision tables,
models, DSLs and more. Sometimes the word "rule" will be used to really
mean "asset" (ie the things you can do also apply to the other asset
@@ -274,7 +280,7 @@
effect on its execution.</para>
<para><figure>
- <title>Assets can have multiple categories</title>
+ <title>Creating categories</title>
<mediaobject>
<imageobject>
@@ -297,13 +303,100 @@
change categories as you go.</para>
</section>
- <section>
- <title>The asset editor</title>
- <para>
- [shots on overall asset editor - annotated]
- </para>
- </section>
+ <section>
+ <title>The asset editor</title>
+ <para><figure>
+ <title>The Asset editor view</title>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="AssetEditor.png" format="PNG"
+ scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </figure> The above diagram shows the "asset editor" with some
+ annotated areas. The asset editor is where all rule changes are made.
+ Below is a list which describes the different parts of the editor.
+ <itemizedlist>
+ <listitem>
+ <para>A</para>
+
+ <para>This is where the "editor widget" lives - exactly what form
+ the editor takes depends on the asset or rule type.</para>
+ </listitem>
+
+ <listitem>
+ <para>B</para>
+
+ <para>This is the documentation area - a free text area where
+ descriptions of the rule can live. It is encouraged to write a
+ plain description in the rule here before editing.</para>
+ </listitem>
+
+ <listitem>
+ <para>C</para>
+
+ <para>These are the actions - for saving, archiving, changing
+ status etc. Archiving is the equivalent of deleting an
+ asset.</para>
+ </listitem>
+
+ <listitem>
+ <para>D</para>
+
+ <para>This has the asset name, as well as the list of categories
+ that the asset belongs to.</para>
+ </listitem>
+
+ <listitem>
+ <para>E</para>
+
+ <para>This section contains read-only meta data, including when
+ changes were made, and by whom.</para>
+
+ <para>"Modified on:" - this is the last modified date.</para>
+
+ <para>"By:" - who made the last change.</para>
+
+ <para>"Note:" - this is the comment made when the asset was last
+ updated (ie why a change was made)</para>
+
+ <para>"Version:" - this is a number which is incremented by 1 each
+ time a change is checked in (saved).</para>
+
+ <para>"Created on:" - the date and time the asset was
+ created.</para>
+
+ <para>"Created by:" - this initial author of the asset.</para>
+
+ <para>"Format:" - the short format name of the type of
+ asset.</para>
+ </listitem>
+
+ <listitem>
+ <para>F</para>
+
+ <para>This shows what package the asset belong to (you can also
+ change it from here).</para>
+ </listitem>
+
+ <listitem>
+ <para>G</para>
+
+ <para>This is some more (optional) meta data (taken from the
+ Dublin Core meta data standard)</para>
+ </listitem>
+
+ <listitem>
+ <para>H</para>
+
+ <para>This will show the version history list when
+ requested.</para>
+ </listitem>
+ </itemizedlist></para>
+ </section>
+
<section>
<title>Rule types and formats</title>
@@ -322,82 +415,76 @@
<section>
<title>Status management</title>
-
- <para>
- Each asset (and also package) in the BRMS has a status flag set.
- The values of the status flag are set in the Administration section of the BRMS.
- (you can add your own status names).
- Similar to Categories, Statuses do NOT effect the execution in any way, and are purely informational.
- Unlike categories, assets only have one status AT A TIME.
- </para>
-
- <para>
- Using statuses is completely optional. You can use it to manage the lifecycle of assets
- (which you can also do with categories if you like).
- </para>
-
- <para>
- <figure>
+
+ <para>Each asset (and also package) in the BRMS has a status flag set.
+ The values of the status flag are set in the Administration section of
+ the BRMS. (you can add your own status names). Similar to Categories,
+ Statuses do NOT effect the execution in any way, and are purely
+ informational. Unlike categories, assets only have one status AT A
+ TIME.</para>
+
+ <para>Using statuses is completely optional. You can use it to manage
+ the lifecycle of assets (which you can alternatively do with categories
+ if you like).</para>
+
+ <para><figure>
<title>Asset status</title>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="AssetChangeStatus.png" format="PNG"
- scalefit="1" />
+ <imagedata align="center" fileref="AssetChangeStatus.png"
+ format="PNG" scalefit="1" />
</imageobject>
</mediaobject>
- </figure>
- You can change the status of an individual asset (like in the diagram above).
- Its change takes effect immediately, no seperate save is needed.
- </para>
+ </figure> You can change the status of an individual asset (like in
+ the diagram above). Its change takes effect immediately, no seperate
+ save is needed.</para>
-
- <para>
- <figure>
+ <para><figure>
<title>Asset status</title>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="PackageChangeStatus.png" format="PNG"
- scalefit="1" />
+ <imagedata align="center" fileref="PackageChangeStatus.png"
+ format="PNG" scalefit="1" />
</imageobject>
</mediaobject>
- </figure>
- You can change the status of a whole package - this sets the status flag on the package itself,
- but it ALSO changes the statuses on ALL the assets that belong to this package in one hit (to be the same as what you set the package to).
- </para>
-
-
+ </figure> You can change the status of a whole package - this sets the
+ status flag on the package itself, but it ALSO changes the statuses on
+ ALL the assets that belong to this package in one hit (to be the same as
+ what you set the package to).</para>
</section>
<section>
<title>Package management</title>
-
+
<para>[pix on package editor, talk about models etc]</para>
</section>
<section>
<title>Version management</title>
- <para>Both assets and whole packages of assets are "versioned" in the BRMS, but the mechanism is slightly different. Individual assets are saved a bit like a version of a file in a source control system. However, packages of assets are versioned "on demand" by taking a snapshot (typically which is used for deployment).
- The next section talks about deployment management and snapshots.</para>
+ <para>Both assets and whole packages of assets are "versioned" in the
+ BRMS, but the mechanism is slightly different. Individual assets are
+ saved a bit like a version of a file in a source control system.
+ However, packages of assets are versioned "on demand" by taking a
+ snapshot (typically which is used for deployment). The next section
+ talks about deployment management and snapshots.</para>
- <para>
- <figure>
+ <para><figure>
<title>Asset versions</title>
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="AssetVersionHistory.png" format="PNG"
- scalefit="1" />
+ <imagedata align="center" fileref="AssetVersionHistory.png"
+ format="PNG" scalefit="1" />
</imageobject>
</mediaobject>
- </figure>
- Each time you make a change to an asset, it creates a new item in the version history.
- This is a bit like having an unlimited undo. You can look back through the history
- of an individual asset like the list above, and view it (and restore it) from that point in time.
-
- </para>
+ </figure> Each time you make a change to an asset, it creates a new
+ item in the version history. This is a bit like having an unlimited
+ undo. You can look back through the history of an individual asset like
+ the list above, and view it (and restore it) from that point in
+ time.</para>
</section>
<section>
@@ -421,7 +508,7 @@
stored in the database, and also seperates rules into packages (name
spaces) and their type (format, as rules can be in many different
formats).</para>
-
+
<para>[picture of rules explorer list, and package explorer]</para>
</section>
</section>
@@ -431,10 +518,36 @@
<para>[detail on guided editor, how to use DSLs, dsl editor, upload rf +
dt etc]</para>
+
+ <para>[also mention possibility of creating templates to copy etc]</para>
</section>
<section>
<title>The business user perspective</title>
+
+ <para>You can see from this manual, that some expertise and practice is
+ required to use the BRMS. In fact any software system in some sense
+ requires that people be "technical" even if it has a nice looking GUI.
+ Having said that, in the right hands the BRMS can be setup to provide a
+ sutiable environment for non technical users.</para>
+
+ <para>The most appropriate rule formats for this use are using the Guided
+ editor, Decision tables and DSL rules. You can use some DSL expressions
+ also in the guided editor (so it provides "forms" for people to enter
+ values).</para>
+
+ <para>You can use categories to isolate rules and assets from non
+ technical users. Only assets which have a category assigned will appear in
+ the "rules" feature.</para>
+
+ <para>The initial setup of the BRMS will need to be done by a
+ developer/technical person who will set the foundations for all the rules.
+ They may also create "templates" which are rules which may be copied (they
+ would typically live in a "dummy" package, and have a category of
+ "template" - this can also help ease the way). </para>
+
+ <para>Deployment should also not be done by non technical users (as
+ mentioned previously this happens from the "Package" feature).</para>
</section>
<section>
@@ -467,7 +580,7 @@
<para>IMPORTANT: You should only have one instance of the RuleAgent per
rulebase you are using. This means you should (for example) keep the
- RuleBase in JNDI.</para>
+ RuleBase in JNDI (or similar).</para>
<para>This assumes that there is a MyRules.properties in the root of
your classpath. You can also pass in a Properties object with the
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/PackageBuilderConfiguration.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -153,6 +153,7 @@
registry.addDialect( dialectName,
(Dialect) cons.newInstance( new Object[]{packageBuilder} ) );
} catch ( Exception e ) {
+ //MVEL: Compiler change
e.printStackTrace();
throw new RuntimeDroolsException( "Unable to load dialect '" + dialectClass + ":" + dialectName + "'" );
}
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/lang/descr/RuleDescr.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/lang/descr/RuleDescr.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/lang/descr/RuleDescr.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -40,6 +40,7 @@
private String className;
+ //MVEL: Compiler change
private Dialect dialect;
public RuleDescr(final String name) {
@@ -130,13 +131,13 @@
public int getConsequencePattern() {
return this.consequencePattern;
}
-
-
+
+ //MVEL: Compiler change
public void setDialect(Dialect dialect) {
this.dialect = dialect;
}
-
+ //MVEL: Compiler change
public Dialect getDialect() {
return this.dialect;
}
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/Dialect.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/Dialect.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/Dialect.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -11,7 +11,7 @@
import org.drools.rule.Package;
public interface Dialect {
-
+ //MVEL: Compiler change
String getId();
// this is needed because some dialects use other dialects
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/PatternBuilder.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/PatternBuilder.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/PatternBuilder.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -161,16 +161,17 @@
object,
null );
}
-
- if( patternDescr.getSource() != null ) {
+
+ if ( patternDescr.getSource() != null ) {
// we have a pattern source, so build it
RuleConditionBuilder builder = context.getDialect().getBuilder( patternDescr.getSource().getClass() );
-
- PatternSource source = (PatternSource) builder.build( context, patternDescr.getSource() );
-
+
+ PatternSource source = (PatternSource) builder.build( context,
+ patternDescr.getSource() );
+
pattern.setSource( source );
}
-
+
// poping the pattern
context.getBuildStack().pop();
return pattern;
@@ -319,10 +320,10 @@
dumper.visitFieldConstraintDescr( fieldConstraintDescr );
predicateDescr.setContent( dumper.getTemplate() );
- this.build( context,
- pattern,
- predicateDescr,
- container );
+ build( context,
+ pattern,
+ predicateDescr,
+ container );
// fall back to original dialect
context.setDialect( dialect );
@@ -474,9 +475,9 @@
for ( int i = 0, size = unboundIdentifiers.size(); i < size; i++ ) {
final String identifier = (String) unboundIdentifiers.get( i );
- Declaration declaration = this.createDeclarationObject( context,
- identifier,
- pattern );
+ Declaration declaration = createDeclarationObject( context,
+ identifier,
+ pattern );
if ( declaration != null ) {
factDeclarations.add( declaration );
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -8,7 +8,6 @@
import java.util.Map;
import java.util.Set;
-import org.drools.RuntimeDroolsException;
import org.drools.base.ClassFieldExtractorCache;
import org.drools.base.TypeResolver;
import org.drools.commons.jci.compilers.CompilationResult;
@@ -60,6 +59,7 @@
import org.drools.rule.builder.SalienceBuilder;
import org.drools.rule.builder.dialect.mvel.MVELFromBuilder;
import org.drools.rule.builder.dialect.mvel.MVELSalienceBuilder;
+import org.drools.util.StringUtils;
public class JavaDialect
implements
@@ -187,7 +187,9 @@
this.packageStoreWrapper = new PackageStore( pkg.getPackageCompilationData(),
this.results );
-
+//MVEL: Compiler change
+// this.lineMappings = new HashMap();
+// pkg.getPackageCompilationData().setLineMappings( this.lineMappings );
}
public void init(final RuleDescr ruleDescr) {
@@ -195,7 +197,8 @@
ruleDescr.getName(),
"java",
this.src );
- ruleDescr.setClassName( ucFirst( ruleClassName ) );
+ ruleDescr.setClassName( StringUtils.ucFirst( ruleClassName ) );
+ //MVEL: Compiler change
ruleDescr.setDialect( this );
}
@@ -332,6 +335,7 @@
final String[] classes = new String[this.generatedClassList.size()];
this.generatedClassList.toArray( classes );
+ System.out.println("MVEL: JavaDialect compilation");
final CompilationResult result = this.compiler.compile( classes,
this.src,
this.packageStoreWrapper,
@@ -343,11 +347,12 @@
final CompilationProblem err = result.getErrors()[i];
final ErrorHandler handler = (ErrorHandler) this.errorHandlers.get( err.getFileName() );
- //MVEL: core java change
-// if ( handler instanceof RuleErrorHandler ) {
-// final RuleErrorHandler rh = (RuleErrorHandler) handler;
-// }
+ //MVEL: Compiler change (was commented?)
+ if ( handler instanceof RuleErrorHandler ) {
+ final RuleErrorHandler rh = (RuleErrorHandler) handler;
+ }
handler.addError( err );
+ System.out.println("MVEL: JavaDialect compilation error:"+ err.getMessage());
}
final Collection errors = this.errorHandlers.values();
@@ -417,7 +422,7 @@
}
// setup the line mappins for this rule
- final String name = this.pkg.getName() + "." + ucFirst( ruleDescr.getClassName() );
+ final String name = this.pkg.getName() + "." + StringUtils.ucFirst( ruleDescr.getClassName() );
final LineMappings mapping = new LineMappings( name );
mapping.setStartLine( ruleDescr.getConsequenceLine() );
mapping.setOffset( ruleDescr.getConsequenceOffset() );
@@ -428,7 +433,7 @@
public void addFunction(final FunctionDescr functionDescr,
final TypeResolver typeResolver) {
- final String functionClassName = this.pkg.getName() + "." + ucFirst( functionDescr.getName() );
+ final String functionClassName = this.pkg.getName() + "." + StringUtils.ucFirst( functionDescr.getName() );
this.pkg.addStaticImport( functionClassName + "." + functionDescr.getName() );
functionDescr.setClassName( functionClassName );
@@ -530,6 +535,7 @@
* @param ext
* @return
*/
+ //MVEL: Compiler change
public static String getUniqueLegalName(final String packageName,
final String name,
final String ext,
@@ -557,18 +563,8 @@
return newName;
}
- /**
- * MVEL: Consider "move" up to Dialect refactoring
- *
- * @param name
- * @return
- */
- public static String ucFirst(final String name) {
- return name.toUpperCase().charAt( 0 ) + name.substring( 1 );
- }
-
+ //MVEL: Compiler change
public String getId() {
return ID;
}
-
}
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -79,9 +79,12 @@
MacroProcessor macroProcessor = new MacroProcessor();
macroProcessor.setMacros( macros );
+//MVEL: Compiler change
+// final Serializable expr = MVEL.compileExpression( macroProcessor.parse( delimitExpressions( (String) context.getRuleDescr().getConsequence() )),
+// ((MVELDialect) context.getDialect()).getClassImportResolverFactory().getImportedClasses(), this.interceptors );
String pkg = "";
- if (context.getPkg()!= null && context.getPkg().getName()!= null
+ if (context.getPkg()!= null && context.getPkg().getName()!= null
&& context.getPkg().getName().length()>0) {
pkg = context.getPkg().getName()+".";
}
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDebugger.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDebugger.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDebugger.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -3,6 +3,7 @@
import java.util.HashMap;
import java.util.Map;
+//MVEL: Compiler change: note this cannot work and is never used
public class MVELDebugger {
public Map frameLocalVars = new HashMap();
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -1,8 +1,10 @@
package org.drools.rule.builder.dialect.mvel;
+import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -28,7 +30,6 @@
import org.drools.lang.descr.RuleDescr;
import org.drools.rule.LineMappings;
import org.drools.rule.Package;
-import org.drools.rule.Rule;
import org.drools.rule.builder.AccumulateBuilder;
import org.drools.rule.builder.ConsequenceBuilder;
import org.drools.rule.builder.Dialect;
@@ -42,21 +43,12 @@
import org.drools.rule.builder.RuleClassBuilder;
import org.drools.rule.builder.RuleConditionBuilder;
import org.drools.rule.builder.SalienceBuilder;
-import org.drools.rule.builder.dialect.java.DeclarationTypeFixer;
-import org.drools.rule.builder.dialect.java.JavaAccumulateBuilder;
-import org.drools.rule.builder.dialect.java.JavaConsequenceBuilder;
import org.drools.rule.builder.dialect.java.JavaDialect;
-import org.drools.rule.builder.dialect.java.JavaEvalBuilder;
-import org.drools.rule.builder.dialect.java.JavaExprAnalyzer;
-import org.drools.rule.builder.dialect.java.JavaFunctionBuilder;
-import org.drools.rule.builder.dialect.java.JavaPredicateBuilder;
-import org.drools.rule.builder.dialect.java.JavaReturnValueBuilder;
-import org.drools.rule.builder.dialect.java.JavaRuleClassBuilder;
-import org.drools.rule.builder.dialect.java.KnowledgeHelperFixer;
-import org.drools.rule.builder.dialect.java.PackageStore;
+import org.drools.spi.DeclarationScopeResolver;
+import org.drools.util.StringUtils;
import org.mvel.AbstractParser;
-import org.mvel.AbstractParser;
-import org.mvel.AbstractParser;
+import org.mvel.ExpressionCompiler;
+import org.mvel.ParserContext;
import org.mvel.integration.impl.ClassImportResolverFactory;
import org.mvel.integration.impl.StaticMethodImportResolverFactory;
@@ -168,6 +160,7 @@
public void init(Package pkg) {
this.pkg = pkg;
this.results = new ArrayList();
+ //MVEL: Compiler change
this.src = new MemoryResourceReader();
if ( pkg != null ) {
this.lineMappings = pkg.getPackageCompilationData().getLineMappings();
@@ -175,12 +168,13 @@
}
public void init(RuleDescr ruleDescr) {
+ //MVEL: Compiler change
System.out.println("MVEL: MVELDialect.init with ruleDescr:" + ruleDescr);
final String ruleClassName = JavaDialect.getUniqueLegalName( this.pkg.getName(),
ruleDescr.getName(),
"mvel",
this.src );
- ruleDescr.setClassName( JavaDialect.ucFirst( ruleClassName ) );
+ ruleDescr.setClassName( StringUtils.ucFirst( ruleClassName ) );
ruleDescr.setDialect( this );
}
@@ -189,10 +183,11 @@
}
public void addRule(RuleBuildContext context) {
+ //MVEL: Compiler change
final RuleDescr ruleDescr = context.getRuleDescr();
// setup the line mappins for this rule
- final String name = this.pkg.getName() + "." + JavaDialect.ucFirst( ruleDescr.getClassName() );
+ final String name = this.pkg.getName() + "." + StringUtils.ucFirst( ruleDescr.getClassName() );
final LineMappings mapping = new LineMappings( name );
mapping.setStartLine( ruleDescr.getConsequenceLine() );
mapping.setOffset( ruleDescr.getConsequenceOffset() );
@@ -255,7 +250,8 @@
Object content) {
Dialect.AnalysisResult result = null;
try {
- result = this.analyzer.analyzeExpression( (String) content,
+ result = this.analyzer.analyzeExpression( context,
+ (String) content,
new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
} catch ( final Exception e ) {
context.getErrors().add( new RuleError( context.getRule(),
@@ -271,7 +267,8 @@
String text) {
Dialect.AnalysisResult result = null;
try {
- result = this.analyzer.analyzeExpression( text,
+ result = this.analyzer.analyzeExpression( context,
+ text,
new Set[]{context.getDeclarationResolver().getDeclarations().keySet(), context.getPkg().getGlobals().keySet()} );
} catch ( final Exception e ) {
context.getErrors().add( new RuleError( context.getRule(),
@@ -282,6 +279,28 @@
return result;
}
+ public Serializable compile(final String text, final Dialect.AnalysisResult analysis, final RuleBuildContext context) {
+ final ParserContext parserContext = new ParserContext( getClassImportResolverFactory().getImportedClasses(), null, null);
+ parserContext.setStrictTypeEnforcement( true );
+
+ List list[] = analysis.getBoundIdentifiers();
+ DeclarationScopeResolver resolver = context.getDeclarationResolver();
+ for ( Iterator it = list[0].iterator(); it.hasNext(); ) {
+ String identifier = (String) it.next();
+ Class cls = resolver.getDeclaration( identifier ).getExtractor().getExtractToClass();
+ parserContext.addInput( identifier, cls );
+ }
+
+ Map globalTypes = context.getPkg().getGlobals();
+ for ( Iterator it = list[1].iterator(); it.hasNext(); ) {
+ String identifier = (String) it.next();
+ parserContext.addInput( identifier, ( Class ) globalTypes.get( identifier ) );
+ }
+
+ ExpressionCompiler compiler = new ExpressionCompiler( text );
+ return compiler.compile( parserContext );
+ }
+
public RuleConditionBuilder getBuilder(final Class clazz) {
return (RuleConditionBuilder) this.builders.get( clazz );
}
@@ -339,6 +358,7 @@
}
public RuleClassBuilder getRuleClassBuilder() {
+ //MVEL: Compiler change
return rule;
}
@@ -347,6 +367,7 @@
}
public String getId() {
+ //MVEL: Compiler change
return ID;
}
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilder.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -17,7 +17,9 @@
package org.drools.rule.builder.dialect.mvel;
import java.io.Serializable;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.drools.base.mvel.DroolsMVELFactory;
import org.drools.base.mvel.MVELEvalExpression;
@@ -31,7 +33,11 @@
import org.drools.rule.builder.Dialect;
import org.drools.rule.builder.RuleBuildContext;
import org.drools.rule.builder.RuleConditionBuilder;
+import org.drools.spi.DeclarationScopeResolver;
+import org.mvel.ExpressionCompiler;
import org.mvel.MVEL;
+import org.mvel.ParserContext;
+import org.mvel.util.ParseTools;
/**
* @author etirelli
@@ -80,9 +86,9 @@
declarations[i] = context.getDeclarationResolver().getDeclaration( (String) usedIdentifiers[0].get( i ) );
}
- final EvalCondition eval = new EvalCondition( declarations );
- final Serializable expr = MVEL.compileExpression( (String) evalDescr.getContent(),
- ((MVELDialect) context.getDialect()).getClassImportResolverFactory().getImportedClasses() );
+ final EvalCondition eval = new EvalCondition( declarations );
+
+ Serializable expr = ((MVELDialect) context.getDialect()).compile( (String) evalDescr.getContent(), analysis, context );
eval.setEvalExpression( new MVELEvalExpression( expr,
factory ) );
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzer.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzer.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELExprAnalyzer.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -23,6 +23,7 @@
import java.util.Set;
import org.antlr.runtime.RecognitionException;
+import org.drools.rule.builder.RuleBuildContext;
import org.mvel.ExpressionCompiler;
import org.mvel.ParserContext;
@@ -52,11 +53,17 @@
* @throws RecognitionException
* If an error occurs in the parser.
*/
- public MVELAnalysisResult analyzeExpression(final String expr,
- final Set[] availableIdentifiers) throws RecognitionException {
+ public MVELAnalysisResult analyzeExpression(final RuleBuildContext context,
+ final String expr,
+ final Set[] availableIdentifiers) throws RecognitionException {
ExpressionCompiler compiler = new ExpressionCompiler( expr);
- compiler.compile();
+ ParserContext parserContext = new ParserContext();
+ parserContext.setStrictTypeEnforcement( false );
+ MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
+ parserContext.setImports( dialect.getClassImportResolverFactory().getImportedClasses() );
+ compiler.compile(parserContext);
+
return analyze( compiler.getParserContextState().getInputs().keySet(),
availableIdentifiers );
}
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELFromBuilder.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELFromBuilder.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELFromBuilder.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -27,10 +27,13 @@
import org.drools.rule.From;
import org.drools.rule.Pattern;
import org.drools.rule.RuleConditionElement;
+import org.drools.rule.builder.Dialect;
import org.drools.rule.builder.FromBuilder;
import org.drools.rule.builder.RuleBuildContext;
import org.drools.spi.DataProvider;
+import org.mvel.ExpressionCompiler;
import org.mvel.MVEL;
+import org.mvel.ParserContext;
import org.mvel.integration.impl.ClassImportResolverFactory;
/**
@@ -62,14 +65,21 @@
context.getPkg().getGlobals() );
// This builder is re-usable in other dialects, so specify by name
- final ClassImportResolverFactory classImportResolverFactory = ((MVELDialect) context.getDialect( "mvel" )).getClassImportResolverFactory();
+ MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
+
+ final ClassImportResolverFactory classImportResolverFactory = dialect.getClassImportResolverFactory();
factory.setNextFactory( classImportResolverFactory );
- //parser.setValueHandlerFactory( factory );
- final Serializable compiled = MVEL.compileExpression( accessor.toString(),
- classImportResolverFactory.getImportedClasses() );
+ String text = (String) accessor.toString();
+ Dialect.AnalysisResult analysis = dialect.analyzeExpression( context,
+ descr,
+ text );
- dataProvider = new MVELDataProvider( compiled,
+ final Serializable expr = dialect.compile( text,
+ analysis,
+ context );
+
+ dataProvider = new MVELDataProvider( expr,
factory );
} catch ( final Exception e ) {
context.getErrors().add( new RuleError( context.getRule(),
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilder.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -27,9 +27,12 @@
import org.drools.lang.descr.PredicateDescr;
import org.drools.rule.Declaration;
import org.drools.rule.PredicateConstraint;
+import org.drools.rule.builder.Dialect;
import org.drools.rule.builder.PredicateBuilder;
import org.drools.rule.builder.RuleBuildContext;
+import org.mvel.ExpressionCompiler;
import org.mvel.MVEL;
+import org.mvel.ParserContext;
/**
* @author etirelli
@@ -62,9 +65,16 @@
localMap,
context.getPkg().getGlobals() );
factory.setNextFactory( ((MVELDialect) context.getDialect()).getClassImportResolverFactory() );
-
- final Serializable expr = MVEL.compileExpression( (String) predicateDescr.getContent(),
- ((MVELDialect) context.getDialect()).getClassImportResolverFactory().getImportedClasses() );
+
+ final ParserContext parserContext = new ParserContext(((MVELDialect) context.getDialect()).getClassImportResolverFactory().getImportedClasses(), null, null);
+ parserContext.setStrictTypeEnforcement( true );
+
+ Dialect.AnalysisResult analysis = context.getDialect().analyzeExpression( context,
+ predicateDescr,
+ predicateDescr.getContent() );
+
+ final Serializable expr = ((MVELDialect) context.getDialect()).compile( (String) predicateDescr.getContent(), analysis, context );
+
predicate.setPredicateExpression( new MVELPredicateExpression( expr,
factory ) );
} catch ( final Exception e ) {
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilder.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -26,9 +26,12 @@
import org.drools.lang.descr.ReturnValueRestrictionDescr;
import org.drools.rule.Declaration;
import org.drools.rule.ReturnValueRestriction;
+import org.drools.rule.builder.Dialect;
import org.drools.rule.builder.ReturnValueBuilder;
import org.drools.rule.builder.RuleBuildContext;
+import org.mvel.ExpressionCompiler;
import org.mvel.MVEL;
+import org.mvel.ParserContext;
/**
* @author etirelli
@@ -60,7 +63,18 @@
final DroolsMVELFactory factory = new DroolsMVELFactory(previousMap, localMap, context.getPkg().getGlobals() );
factory.setNextFactory( ((MVELDialect)context.getDialect()).getClassImportResolverFactory() );
- final Serializable expr = MVEL.compileExpression( (String) returnValueRestrictionDescr.getContent(), ((MVELDialect)context.getDialect()).getClassImportResolverFactory().getImportedClasses() );
+ final ParserContext parserContext = new ParserContext(((MVELDialect) context.getDialect()).getClassImportResolverFactory().getImportedClasses(), null, null);
+ parserContext.setStrictTypeEnforcement( true );
+
+// ExpressionCompiler compiler = new ExpressionCompiler( (String) returnValueRestrictionDescr.getContent() );
+// final Serializable expr = compiler.compile( parserContext );
+
+ Dialect.AnalysisResult analysis = context.getDialect().analyzeExpression( context,
+ returnValueRestrictionDescr,
+ returnValueRestrictionDescr.getContent() );
+
+ final Serializable expr = ((MVELDialect) context.getDialect()).compile( (String) returnValueRestrictionDescr.getContent(), analysis, context );
+
returnValueRestriction.setReturnValueExpression( new MVELReturnValueExpression( expr,
factory ) );
}
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELRuleClassBuilder.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELRuleClassBuilder.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELRuleClassBuilder.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -3,7 +3,7 @@
import org.drools.lang.descr.RuleDescr;
import org.drools.rule.builder.RuleBuildContext;
import org.drools.rule.builder.RuleClassBuilder;
-
+//MVEL: Compiler change
public class MVELRuleClassBuilder
implements
RuleClassBuilder {
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilder.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilder.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELSalienceBuilder.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -5,9 +5,12 @@
import org.drools.base.mvel.DroolsMVELFactory;
import org.drools.base.mvel.MVELSalienceExpression;
import org.drools.compiler.RuleError;
+import org.drools.rule.builder.Dialect;
import org.drools.rule.builder.RuleBuildContext;
import org.drools.rule.builder.SalienceBuilder;
+import org.mvel.ExpressionCompiler;
import org.mvel.MVEL;
+import org.mvel.ParserContext;
import org.mvel.integration.impl.ClassImportResolverFactory;
public class MVELSalienceBuilder
@@ -22,13 +25,19 @@
final DroolsMVELFactory factory = new DroolsMVELFactory( context.getDeclarationResolver().getDeclarations(),
null,
context.getPkg().getGlobals() );
+ MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" );
// This builder is re-usable in other dialects, so specify by name
- final ClassImportResolverFactory classImportResolverFactory = ((MVELDialect) context.getDialect( "mvel" )).getClassImportResolverFactory();
+ final ClassImportResolverFactory classImportResolverFactory = dialect.getClassImportResolverFactory();
factory.setNextFactory( classImportResolverFactory );
- final Serializable expr = MVEL.compileExpression( (String) context.getRuleDescr().getSalience(),
- classImportResolverFactory.getImportedClasses() );
+ Dialect.AnalysisResult analysis = dialect.analyzeExpression( context,
+ context.getRuleDescr(),
+ (String) context.getRuleDescr().getSalience() );
+ final Serializable expr = dialect.compile( (String) context.getRuleDescr().getSalience(),
+ analysis,
+ context );
+
MVELSalienceExpression salience = new MVELSalienceExpression( expr,
factory );
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELEvalBuilderTest.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -35,7 +35,7 @@
MVELDialect mvelDialect = new MVELDialect( new PackageBuilder( pkg ) );
DialectRegistry registry = new DialectRegistry();
- registry.addDialect( "default",
+ registry.addDialect( "mvel",
mvelDialect );
final PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELPredicateBuilderTest.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -38,7 +38,7 @@
MVELDialect mvelDialect = new MVELDialect( new PackageBuilder( pkg ) );
DialectRegistry registry = new DialectRegistry();
- registry.addDialect( "default",
+ registry.addDialect( "mvel",
mvelDialect );
final PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELReturnValueBuilderTest.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -40,7 +40,7 @@
MVELDialect mvelDialect = new MVELDialect( new PackageBuilder( pkg ) );
DialectRegistry registry = new DialectRegistry();
- registry.addDialect( "default",
+ registry.addDialect( "mvel",
mvelDialect );
final PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
@@ -116,9 +116,6 @@
tuple = new ReteTuple( tuple,
f1 );
- final PredicateContextEntry predicateContext = new PredicateContextEntry();
- predicateContext.leftTuple = tuple;
-
final Cheese brie = new Cheese( "brie",
20 );
assertTrue( returnValue.isAllowed( extractor,
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/base/mvel/MVELConsequence.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/base/mvel/MVELConsequence.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/base/mvel/MVELConsequence.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -30,17 +30,18 @@
knowledgeHelper,
null,
workingMemory );
+ //MVEL: Core change
+ System.out.println("MVEL:Executing expression " + ((CompiledExpression)expr).getSourceName());
- System.out.println("Executing expression "+((CompiledExpression)expr).getSourceName());
-
CompiledExpression compexpr = (CompiledExpression)this.expr;
- //for testing, we'll have at least one breakpoint
+ //MVEL:for testing, we'll have at least one breakpoint
MVELRuntime.registerBreakpoint( compexpr.getSourceName(), 1 );
- //Receive breakpoints from debugger
+ //MVEL: Receive breakpoints from debugger
MVELDebugHandler.receiveBreakpoints();
+ //MVEL: we are always debugging for now, but we should either debug or run
MVEL.executeDebugger( compexpr, null, this.factory);
/*MVEL.executeExpression( this.expr,
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/base/mvel/MVELDebugHandler.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/base/mvel/MVELDebugHandler.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/base/mvel/MVELDebugHandler.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -6,6 +6,7 @@
public class MVELDebugHandler {
+ //MVEL: Core change
static {
MVELRuntime.setThreadDebugger(new MVELDebugger());
}
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/rule/PackageCompilationData.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/rule/PackageCompilationData.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/rule/PackageCompilationData.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -89,6 +89,7 @@
initClassLoader( parentClassLoader );
this.invokerLookups = new HashMap();
this.store = new HashMap();
+ //MVEL: Core change
//this.lineMappings = Collections.EMPTY_MAP;
}
@@ -279,11 +280,13 @@
}
public Map getLineMappings() {
+ //MVEL: Core change
if (this.lineMappings==null) {
this.lineMappings = new HashMap();
}
return this.lineMappings;
}
+ //MVEL: Core change
/*
public void setLineMappings(final Map lineMappings) {
this.lineMappings = lineMappings;
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java 2007-07-09 12:51:50 UTC (rev 13262)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java 2007-07-09 16:00:34 UTC (rev 13263)
@@ -57,7 +57,8 @@
int depth = oldSize;
for (int i = newFrames - 1; i >= 0; i--) {
StackFrame currentFrame = (StackFrame) frames.get(i);
- //MVEL: create an mvel stack frame when the declraing type is our debugger?
+ //MVEL: create an mvel stack frame when the declaring type is our debugger?
+ //MVEL: this cannot work: org.drools.rule.builder.dialect.mvel.MVELDebugger is never instantiated
Location loc = currentFrame.location();
System.out.println("MVEL: In DroolsThread.computeStackFrames with declaringType:" + loc.declaringType().name());
if ( loc.declaringType().name().equals( "org.drools.rule.builder.dialect.mvel.MVELDebugger" )
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-jbrms/src/test/resources/RepoBinPackage.pkg
===================================================================
(Binary files differ)
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/m2_repo/org/mvel/mvel14/1.2pre1/mvel14-1.2pre1.jar
===================================================================
(Binary files differ)
More information about the jboss-svn-commits
mailing list