[jboss-svn-commits] JBL Code SVN: r13300 - in labs/jbossrules/branches/mvel-tooling-2007-06-30: drools-compiler/src/main/java/org/drools/compiler and 13 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Jul 10 11:27:44 EDT 2007
Author: pombredanne
Date: 2007-07-10 11:27:43 -0400 (Tue, 10 Jul 2007)
New Revision: 13300
Added:
labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/PackageBuild.png
labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/PackageConfig.png
labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/PackageExplorer.png
labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/PackageNewItemTooltip.png
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.classpath
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.project
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/cache/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Approve.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Driver.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Policy.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Rejection.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/repository_export.xml.zip
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/drools-core-4.0.0.SNAPSHOT.jar
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/insuranceModel.jar
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/mvel14-1.2pre1.jar
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/resources/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/resources/org.acme.insurance.pkg
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/brmsdeployedrules.properties
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/InsuranceBusiness.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/MainClass.java
Removed:
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.classpath
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.project
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/cache/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Approve.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Driver.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Policy.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Rejection.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/repository_export.xml.zip
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/drools-core-4.0.0.SNAPSHOT.jar
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/insuranceModel.jar
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/mvel14-1.2pre1.jar
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/resources/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/resources/org.acme.insurance.pkg
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/brmsdeployedrules.properties
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/InsuranceBusiness.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/MainClass.java
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/DialectRegistry.java
labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.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/MVELDialect.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/editors/completion/RuleCompletionProcessor.java
Log:
Ported r13299 from trunk to branch mvel-tooling-2007-06-30
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/PackageBuild.png (from rev 13299, labs/jbossrules/trunk/documentation/manual/en/Chapter-BRMS/PackageBuild.png)
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/PackageConfig.png (from rev 13299, labs/jbossrules/trunk/documentation/manual/en/Chapter-BRMS/PackageConfig.png)
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/PackageExplorer.png (from rev 13299, labs/jbossrules/trunk/documentation/manual/en/Chapter-BRMS/PackageExplorer.png)
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/PackageNewItemTooltip.png (from rev 13299, labs/jbossrules/trunk/documentation/manual/en/Chapter-BRMS/PackageNewItemTooltip.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-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/documentation/manual/en/Chapter-BRMS/Section-UserGuide.xml 2007-07-10 15:27:43 UTC (rev 13300)
@@ -2,8 +2,8 @@
<!DOCTYPE section PUBLIC "-//OASIS//DTD Simplified DocBook XML V1.0//EN"
"http://www.oasis-open.org/docbook/xml/simple/1.0/sdocbook.dtd">
<section>
+ <title>Quick start guide</title>
- <title>Quick start guide</title>
<section>
<title>Quick start guide</title>
@@ -26,32 +26,33 @@
</figure>
<para>The above picture shows the main feature areas of the BRMS.</para>
+
<itemizedlist>
- <listitem>
- <para>Info: This is the initial screen, with links to
- resources.</para>
- </listitem>
+ <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>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>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>Deployment: this is where deployment snapshots are
+ managed.</para>
+ </listitem>
- <listitem>
- <para>Admin: Administrative functions (categories, statuses, import
- and export)</para>
- </listitem>
- </itemizedlist>
+ <listitem>
+ <para>Admin: Administrative functions (categories, statuses, import
+ and export)</para>
+ </listitem>
+ </itemizedlist>
<para>You can also consult the wiki:
http://wiki.jboss.org/wiki/Wiki.jsp?page=RulesRepository for some
@@ -282,16 +283,18 @@
effect on its execution.</para>
<figure>
- <title>Creating categories</title>
+ <title>Creating categories</title>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="AdminCats.png" format="PNG"
- scalefit="1" />
- </imageobject>
- </mediaobject>
- </figure> <para> The above view shows the administration screen for setting
- up categories (there) are no categories in the system by default. As the
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="AdminCats.png" format="PNG"
+ scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>The above view shows the administration screen for setting up
+ categories (there) are no categories in the system by default. As the
categories can be hierachical you chose the "parent" category that you
want to create a sub-category for. From here categories can also be
removed (but only if they are not in use by any current versions of
@@ -309,94 +312,94 @@
<title>The asset editor</title>
<figure>
- <title>The Asset editor view</title>
+ <title>The Asset editor view</title>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="AssetEditor.png" format="PNG"
- scalefit="1" />
- </imageobject>
- </mediaobject>
- </figure> <para> 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.</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="AssetEditor.png" format="PNG"
+ scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>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.</para>
+
<itemizedlist>
- <listitem>
- <para>A</para>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <listitem>
+ <para>D</para>
- <para>This has the asset name, as well as the list of categories
- that the asset belongs to.</para>
- </listitem>
+ <para>This has the asset name, as well as the list of categories
+ that the asset belongs to.</para>
+ </listitem>
- <listitem>
- <para>E</para>
+ <listitem>
+ <para>E</para>
- <para>This section contains read-only meta data, including when
- changes were made, and by whom.</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>"Modified on:" - this is the last modified date.</para>
- <para>"By:" - who made the last change.</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>"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>"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 on:" - the date and time the asset was
+ created.</para>
- <para>"Created by:" - this initial author of the asset.</para>
+ <para>"Created by:" - this initial author of the asset.</para>
- <para>"Format:" - the short format name of the type of
- asset.</para>
- </listitem>
+ <para>"Format:" - the short format name of the type of asset.</para>
+ </listitem>
- <listitem>
- <para>F</para>
+ <listitem>
+ <para>F</para>
- <para>This shows what package the asset belong to (you can also
- change it from here).</para>
- </listitem>
+ <para>This shows what package the asset belong to (you can also
+ change it from here).</para>
+ </listitem>
- <listitem>
- <para>G</para>
+ <listitem>
+ <para>G</para>
- <para>This is some more (optional) meta data (taken from the
- Dublin Core meta data standard)</para>
- </listitem>
+ <para>This is some more (optional) meta data (taken from the Dublin
+ Core meta data standard)</para>
+ </listitem>
- <listitem>
- <para>H</para>
+ <listitem>
+ <para>H</para>
- <para>This will show the version history list when
- requested.</para>
- </listitem>
- </itemizedlist>
+ <para>This will show the version history list when requested.</para>
+ </listitem>
+ </itemizedlist>
</section>
<section>
@@ -430,37 +433,152 @@
if you like).</para>
<figure>
- <title>Asset status</title>
+ <title>Asset status</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="AssetChangeStatus.png"
+ format="PNG" scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>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>
+ <title>Asset status</title>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="PackageChangeStatus.png"
+ format="PNG" scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>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>Configuring packages is generally something that is done once, and
+ by someone with some experience with rules/models. Generally speaking,
+ very few people will need to configure packages, and once they are
+ setup, they can be copied over and over if needed. Package configuration
+ is most definately a technical task that requires the appropriate
+ expertise.</para>
+
+ <para>All assets live in "packages" in the BRMS - a package is like a
+ folder (it also serves as a "namespace"). A home folder for rule assets
+ to live in. Rules in particular need to know what the fact model is,
+ what the namespace is etc.</para>
+
+ <para><figure>
+ <title>The package explorer</title>
+
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="AssetChangeStatus.png"
+ <imagedata align="center" fileref="PackageExplorer.png"
format="PNG" scalefit="1" />
</imageobject>
</mediaobject>
- </figure><para> 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>The above picture shows the package explorer. Clicking on an
+ asset type will show a list of matches (for packages with thousands of
+ rules, showing the list may take several seconds - hence the importance
+ of using categories to help you find your way around).</para>
- <figure>
- <title>Asset status</title>
+ <para>So whilst rules (and assets in general) can appear in any number
+ of categories, they only live in one package. If you think of the BRMS
+ as a file system, then each package is a folder, and the assets live in
+ that folder - as one big happy list of files. When you create a
+ deployment snapshot of a package, you are effectively copying all the
+ assets in that "folder" into another special "folder".</para>
+ <para>The package management feature allows you to see a list of
+ packages, and then "expand" them, to show lists of each "type" of asset
+ (there are many assets, so some of them are grouped together):</para>
+
+ <para>The asset types: <itemizedlist>
+ <listitem>
+ <para>Business rule assets: this shows a list of all "business
+ rule" types, which include decision tables, business rules
+ etc.</para>
+ </listitem>
+
+ <listitem>
+ <para>Technical rule assets: this is a list of rules that would be
+ considered technical (eg DRL files).</para>
+ </listitem>
+
+ <listitem>
+ <para>Functions: In the BRMS you can also have functions defined
+ (optionally of course).</para>
+ </listitem>
+
+ <listitem>
+ <para>DSL: Domain Specific Lanaguages can also be stored as an
+ asset. If they exist (generally there is only one), then they will
+ be used in the appropriate editor GUIs.</para>
+ </listitem>
+
+ <listitem>
+ <para>Model: A package requires at least one model - for the
+ rules.</para>
+ </listitem>
+ </itemizedlist></para>
+
+ <para><figure>
+ <title>Creating new assets</title>
+
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="PackageChangeStatus.png"
+ <imagedata align="center" fileref="PackageNewItemTooltip.png"
format="PNG" scalefit="1" />
</imageobject>
</mediaobject>
- </figure><para> 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>
+ </figure> From the package explorer you can create new rules, or new
+ assets. Some assets you can only create from the package explorer. The
+ above picture shows the icons which launch wizards for this purpose. If
+ you hover the mouse over them, a tooltip will tell you what they
+ do.</para>
- <section>
- <title>Package management</title>
+ <para><figure>
+ <title>Package configuration</title>
- <para>[pix on package editor, talk about models etc]</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="PackageConfig.png"
+ format="PNG" scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </figure>One of the most critical things you need to do is configure
+ packages. This is mostly importing the classes used by the rules, and
+ globals variables. Once you make a change, you need to save it, and that
+ package is then configured and ready to be built. For example, you may
+ add a model which has a class called "com.something.Hello", you would
+ then add "import com.something.Hello" in your package configuration and
+ save the change.</para>
+
+ <para><figure>
+ <title>Package building</title>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="PackageBuild.png"
+ format="PNG" scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </figure>Finally you would "build" a package. Any errors caught are
+ then shown at this point. If the build was successful, then you will
+ have the option to create a snapshot for deployment. You can also view
+ the "drl" that this package results in. WARNING: in cases of large
+ numbers of rules, all these operations can take some time.</para>
</section>
<section>
@@ -474,19 +592,20 @@
talks about deployment management and snapshots.</para>
<figure>
- <title>Asset versions</title>
+ <title>Asset versions</title>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="AssetVersionHistory.png"
- format="PNG" scalefit="1" />
- </imageobject>
- </mediaobject>
- </figure> <para> 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>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="AssetVersionHistory.png"
+ format="PNG" scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>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>
@@ -546,7 +665,7 @@
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>
+ "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>
@@ -574,7 +693,7 @@
<para>To use the rule agent, you will use a call in your applications
code like:</para>
- <programlisting>RuleAgent agent = RuleAgent.newInstance("/MyRules.properties");
+ <programlisting>RuleAgent agent = RuleAgent.newRuleAgent("/MyRules.properties");
RuleBase rb = agent.getRuleBase();
rb.newStatefulSession....
//now assert your facts into the session and away you go !
@@ -588,7 +707,8 @@
your classpath. You can also pass in a Properties object with the
parameters set up (the parameters are discussed next).</para>
- <para>The following shows the content of MyRules.properties: </para>
+ <para>The following shows the content of MyRules.properties:</para>
+
<programlisting>##
## RuleAgent configuration file example
##
@@ -607,84 +727,87 @@
one "file", "dir" etc - even though you can specify multiple items by
space separating them).</para>
- <para>Referring to the above example, the "keys" in the properties are:</para>
+ <para>Referring to the above example, the "keys" in the properties
+ are:</para>
+
<itemizedlist>
- <listitem>
- <para>newInstance</para>
+ <listitem>
+ <para>newInstance</para>
- <para>Setting this to "true" means that the RuleBase instance will
- be created fresh each time there is a change. this means you need
- to do agent.getRuleBase() to get the new updated rulebase (any
- existing ones in use will be untouched). The default is false,
- which means rulebases are updated "in place" - ie you don't need
- to keep calling getRuleBase() to make sure you have the latest
- rules (also any StatefulSessions will be updated automatically
- with rule changes).</para>
- </listitem>
+ <para>Setting this to "true" means that the RuleBase instance will
+ be created fresh each time there is a change. this means you need to
+ do agent.getRuleBase() to get the new updated rulebase (any existing
+ ones in use will be untouched). The default is false, which means
+ rulebases are updated "in place" - ie you don't need to keep calling
+ getRuleBase() to make sure you have the latest rules (also any
+ StatefulSessions will be updated automatically with rule
+ changes).</para>
+ </listitem>
- <listitem>
- <para>file</para>
+ <listitem>
+ <para>file</para>
- <para>This is a space-separated list of files - each file is a
- binary package as exported by the BRMS. You can have one or many.
- The name of the file is not important. Each package must be in its
- own file.</para>
- </listitem>
+ <para>This is a space-separated list of files - each file is a
+ binary package as exported by the BRMS. You can have one or many.
+ The name of the file is not important. Each package must be in its
+ own file.</para>
+ </listitem>
- <listitem>
- <para>dir</para>
+ <listitem>
+ <para>dir</para>
- <para>This is similar to file, except that instead of specifying a
- list of files you specify a directory, and it will pick up all the
- files in there (each one is a package) and add them to the
- rulebase. Each package must be in its own file.</para>
- </listitem>
+ <para>This is similar to file, except that instead of specifying a
+ list of files you specify a directory, and it will pick up all the
+ files in there (each one is a package) and add them to the rulebase.
+ Each package must be in its own file.</para>
+ </listitem>
- <listitem>
- <para>url</para>
+ <listitem>
+ <para>url</para>
- <para>This is a space separated list of URLs to the BRMS which is
- exposing the packages (see below for more details).</para>
- </listitem>
+ <para>This is a space separated list of URLs to the BRMS which is
+ exposing the packages (see below for more details).</para>
+ </listitem>
- <listitem>
- <para>localCacheDir</para>
+ <listitem>
+ <para>localCacheDir</para>
- <para>This is used in conjunction with the url above, so that if
- the BRMS is down (the url is not accessable) then if the runtime
- has to start up, it can start up with the last known "good"
- versions of the packages.</para>
- </listitem>
+ <para>This is used in conjunction with the url above, so that if the
+ BRMS is down (the url is not accessable) then if the runtime has to
+ start up, it can start up with the last known "good" versions of the
+ packages.</para>
+ </listitem>
- <listitem>
- <para>poll</para>
+ <listitem>
+ <para>poll</para>
- <para>This is set to the number of seconds to check for changes to
- the resources (a timer is used).</para>
- </listitem>
+ <para>This is set to the number of seconds to check for changes to
+ the resources (a timer is used).</para>
+ </listitem>
- <listitem>
- <para>name</para>
+ <listitem>
+ <para>name</para>
- <para>This is used to specify the name of the agent which is used
- when logging events (as typically you would have multiple agents
- in a system).</para>
- </listitem>
- </itemizedlist>
+ <para>This is used to specify the name of the agent which is used
+ when logging events (as typically you would have multiple agents in
+ a system).</para>
+ </listitem>
+ </itemizedlist>
<para>Following shows the deployment screen of the BRMS, which provides
- URLs and downloads of packages. </para>
- <figure>
- <title>Snapshot deployment</title>
+ URLs and downloads of packages.</para>
- <mediaobject>
- <imageobject>
- <imagedata align="center" fileref="SnapshotDeploy.png"
- format="PNG" scalefit="1" />
- </imageobject>
- </mediaobject>
- </figure>
+ <figure>
+ <title>Snapshot deployment</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata align="center" fileref="SnapshotDeploy.png"
+ format="PNG" scalefit="1" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
<para>You can see the "Package URI" - this is the URL that you would
copy and paste into the agent .properties file to specify that you want
this package. It specifies an exact version (in this case to a snapshot)
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/DialectRegistry.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/DialectRegistry.java 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/DialectRegistry.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -32,6 +32,10 @@
}
}
+ public Iterator iterator() {
+ return this.map.values().iterator();
+ }
+
public List addResults(List list) {
if ( list == null ) {
list = new ArrayList();
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/compiler/PackageBuilder.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -305,7 +305,10 @@
final Package pkg = new Package( packageDescr.getName(),
this.configuration.getClassLoader() );
- this.dialect.init( pkg );
+ for ( Iterator it = this.dialects.iterator(); it.hasNext(); ) {
+ Dialect dialect = ( Dialect ) it.next();
+ dialect.init( pkg );
+ }
mergePackage( pkg,
packageDescr );
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-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/java/JavaDialect.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -177,19 +177,13 @@
this.results = new ArrayList();
this.src = new MemoryResourceReader();
- if ( pkg != null ) {
- this.packageStoreWrapper = new PackageStore( pkg.getPackageCompilationData(),
- this.results );
- this.lineMappings = pkg.getPackageCompilationData().getLineMappings();
- }
this.generatedClassList = new ArrayList();
this.packageStoreWrapper = new PackageStore( pkg.getPackageCompilationData(),
this.results );
-//MVEL: Compiler change
-// this.lineMappings = new HashMap();
-// pkg.getPackageCompilationData().setLineMappings( this.lineMappings );
+
+ this.lineMappings = pkg.getPackageCompilationData().getLineMappings();
}
public void init(final RuleDescr ruleDescr) {
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-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -335,7 +335,8 @@
parserContext.addInput( "drools", KnowledgeHelper.class );
ExpressionCompiler compiler = new ExpressionCompiler( text );
- return compiler.compile( parserContext );
+ Serializable expr = compiler.compile( parserContext );
+ return expr;
}
public RuleConditionBuilder getBuilder(final Class clazz) {
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-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-core/src/main/java/org/drools/rule/PackageCompilationData.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -91,6 +91,7 @@
this.store = new HashMap();
//MVEL: Core change
//this.lineMappings = Collections.EMPTY_MAP;
+ this.lineMappings = new HashMap();
}
private void initClassLoader(ClassLoader parentClassLoader) {
@@ -130,7 +131,7 @@
DroolsObjectInputStream droolsStream = ( DroolsObjectInputStream ) stream;
initClassLoader( droolsStream.getClassLoader() );
} else {
- initClassLoader( Thread.currentThread().getContextClassLoader() );
+ initClassLoader( Thread.currentThread().getContextClassLoader() );
}
this.store = (Map) stream.readObject();
@@ -288,9 +289,9 @@
}
//MVEL: Core change
/*
- public void setLineMappings(final Map lineMappings) {
- this.lineMappings = lineMappings;
- }
+// public void setLineMappings(final Map lineMappings) {
+// this.lineMappings = lineMappings;
+// }
*/
public LineMappings getLineMappings(final String className) {
return (LineMappings) getLineMappings().get( className );
Modified: labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/RuleCompletionProcessor.java
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/RuleCompletionProcessor.java 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/RuleCompletionProcessor.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -28,6 +28,7 @@
import org.drools.lang.descr.PackageDescr;
import org.drools.lang.descr.PatternDescr;
import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.builder.Dialect;
import org.drools.util.asm.ClassFieldInspector;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextViewer;
@@ -40,11 +41,11 @@
*/
public class RuleCompletionProcessor extends DefaultCompletionProcessor {
- private static final Image DROOLS_ICON =
- DroolsPluginImages.getImage(DroolsPluginImages.DROOLS);
+ private static final Image DROOLS_ICON = DroolsPluginImages
+ .getImage(DroolsPluginImages.DROOLS);
- private static final Image CLASS_ICON =
- DroolsPluginImages.getImage(DroolsPluginImages.CLASS);
+ private static final Image CLASS_ICON = DroolsPluginImages
+ .getImage(DroolsPluginImages.CLASS);
public RuleCompletionProcessor(AbstractRuleEditor editor) {
super(editor);
@@ -63,12 +64,15 @@
}
Location location = LocationDeterminator.getLocation(backText);
+ Dialect dialect = DialectDeterminator.getDialect(backText);
if (location.getType() == Location.LOCATION_RULE_HEADER) {
addRuleHeaderProposals(list, prefix, backText);
} else if (location.getType() == Location.LOCATION_RHS) {
addRHSCompletionProposals(list, prefix, backText,
- (String) location.getProperty(Location.LOCATION_LHS_CONTENT),
- (String) location.getProperty(Location.LOCATION_RHS_CONTENT));
+ (String) location
+ .getProperty(Location.LOCATION_LHS_CONTENT),
+ (String) location
+ .getProperty(Location.LOCATION_RHS_CONTENT));
} else {
addLHSCompletionProposals(list, location, prefix, backText);
}
@@ -81,29 +85,31 @@
return null;
}
- protected void addRHSCompletionProposals(List list, String prefix, String backText,
- String conditions, String consequence) {
+ protected void addRHSCompletionProposals(List list, String prefix,
+ String backText, String conditions, String consequence) {
// only add functions and keywords if at the beginning of a
// new statement
- String consequenceWithoutPrefix = consequence.substring(0,
- consequence.length() - prefix.length());
+ String consequenceWithoutPrefix = consequence.substring(0, consequence
+ .length()
+ - prefix.length());
if (isStartOfJavaExpression(consequenceWithoutPrefix)) {
addRHSKeywordCompletionProposals(list, prefix);
addRHSFunctionCompletionProposals(list, prefix);
}
- addRHSJavaCompletionProposals(list, prefix, backText, conditions, consequence);
+ addRHSJavaCompletionProposals(list, prefix, backText, conditions,
+ consequence);
}
- protected void addLHSCompletionProposals(List list,
- Location location, String prefix, String backText) {
+ protected void addLHSCompletionProposals(List list, Location location,
+ String prefix, String backText) {
switch (location.getType()) {
case Location.LOCATION_LHS_BEGIN_OF_CONDITION:
// if we are at the beginning of a new condition
// add drools keywords
- list.add(new RuleCompletionProposal(prefix.length(), "and",
- "and ", DROOLS_ICON));
- list.add(new RuleCompletionProposal(prefix.length(), "or",
- "or ", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "and", "and ",
+ DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "or", "or ",
+ DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), "from",
"from ", DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), "forall",
@@ -112,15 +118,15 @@
.length(), "eval", "eval( )", 6);
prop.setImage(DROOLS_ICON);
list.add(prop);
- prop = new RuleCompletionProposal(prefix.length(), "then",
- "then" + System.getProperty("line.separator") + "\t");
+ prop = new RuleCompletionProposal(prefix.length(), "then", "then"
+ + System.getProperty("line.separator") + "\t");
prop.setImage(DROOLS_ICON);
list.add(prop);
// we do not break but also add all elements that are needed for
// and/or
case Location.LOCATION_LHS_BEGIN_OF_CONDITION_AND_OR:
- list.add(new RuleCompletionProposal(prefix.length(), "not",
- "not ", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "not", "not ",
+ DROOLS_ICON));
// we do not break but also add all elements that are needed for
// not
case Location.LOCATION_LHS_BEGIN_OF_CONDITION_NOT:
@@ -163,9 +169,8 @@
iterator = getTemplates().iterator();
while (iterator.hasNext()) {
String name = (String) iterator.next();
- RuleCompletionProposal p = new RuleCompletionProposal(
- prefix.length(), name, name + "( )",
- name.length() + 2);
+ RuleCompletionProposal p = new RuleCompletionProposal(prefix
+ .length(), name, name + "( )", name.length() + 2);
p.setPriority(-1);
p.setImage(CLASS_ICON);
list.add(p);
@@ -177,8 +182,8 @@
String propertyName = (String) location
.getProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME);
if (className != null) {
- boolean isTemplate = addFactTemplatePropertyProposals(
- prefix, className, list);
+ boolean isTemplate = addFactTemplatePropertyProposals(prefix,
+ className, list);
if (!isTemplate) {
ClassTypeResolver resolver = new ClassTypeResolver(
getImports(), ProjectClassLoader
@@ -186,42 +191,49 @@
try {
String currentClass = className;
if (propertyName != null) {
- String[] nestedProperties = propertyName.split("\\.");
+ String[] nestedProperties = propertyName
+ .split("\\.");
int nbSuperProperties = nestedProperties.length - 1;
if (propertyName.endsWith(".")) {
nbSuperProperties++;
}
for (int i = 0; i < nbSuperProperties; i++) {
String simplePropertyName = nestedProperties[i];
- currentClass = getSimplePropertyClass(currentClass, simplePropertyName);
+ currentClass = getSimplePropertyClass(
+ currentClass, simplePropertyName);
currentClass = convertToNonPrimitiveClass(currentClass);
}
}
- RuleCompletionProposal p = new RuleCompletionProposal(prefix.length(), "this");
- p.setImage(METHOD_ICON);
- list.add(p);
+ RuleCompletionProposal p = new RuleCompletionProposal(
+ prefix.length(), "this");
+ p.setImage(METHOD_ICON);
+ list.add(p);
Class clazz = resolver.resolveType(currentClass);
if (clazz != null) {
if (Map.class.isAssignableFrom(clazz)) {
- p = new RuleCompletionProposal(
- prefix.length(), "this['']", "this['']", 6);
+ p = new RuleCompletionProposal(prefix.length(),
+ "this['']", "this['']", 6);
p.setImage(METHOD_ICON);
list.add(p);
}
- ClassFieldInspector inspector = new ClassFieldInspector(clazz);
+ ClassFieldInspector inspector = new ClassFieldInspector(
+ clazz);
Map types = inspector.getFieldTypes();
- Iterator iterator2 = inspector.getFieldNames().keySet().iterator();
+ Iterator iterator2 = inspector.getFieldNames()
+ .keySet().iterator();
while (iterator2.hasNext()) {
String name = (String) iterator2.next();
- p = new RuleCompletionProposal(
- prefix.length(), name, name + " ");
+ p = new RuleCompletionProposal(prefix.length(),
+ name, name + " ");
p.setImage(METHOD_ICON);
list.add(p);
Class type = (Class) types.get(name);
- if (type != null && Map.class.isAssignableFrom(type)) {
+ if (type != null
+ && Map.class.isAssignableFrom(type)) {
name += "['']";
- p = new RuleCompletionProposal(
- prefix.length(), name, name, name.length() - 2);
+ p = new RuleCompletionProposal(prefix
+ .length(), name, name, name
+ .length() - 2);
p.setImage(METHOD_ICON);
list.add(p);
}
@@ -242,36 +254,36 @@
.getProperty(Location.LOCATION_PROPERTY_PROPERTY_NAME);
String type = getPropertyClass(className, property);
- list.add(new RuleCompletionProposal(prefix.length(), "==",
- "== ", DROOLS_ICON));
- list.add(new RuleCompletionProposal(prefix.length(), "!=",
- "!= ", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "==", "== ",
+ DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "!=", "!= ",
+ DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), ":", ": ",
DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), "->",
"-> ( )", 5, DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), "memberOf",
"memberOf ", DROOLS_ICON));
- list.add(new RuleCompletionProposal(prefix.length(), "not memberOf",
- "not memberOf ", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(),
+ "not memberOf", "not memberOf ", DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), "in",
"in ( )", 5, DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), "not in",
"not in ( )", 9, DROOLS_ICON));
if (isComparable(type)) {
- list.add(new RuleCompletionProposal(prefix.length(), "<",
- "< ", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "<", "< ",
+ DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), "<=",
"<= ", DROOLS_ICON));
- list.add(new RuleCompletionProposal(prefix.length(), ">",
- "> ", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), ">", "> ",
+ DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), ">=",
">= ", DROOLS_ICON));
}
if (type.equals("java.lang.String")) {
- list.add(new RuleCompletionProposal(prefix.length(),
- "matches", "matches \"\"", 9, DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "matches",
+ "matches \"\"", 9, DROOLS_ICON));
}
if (isSubtypeOf(type, "java.util.Collection")) {
list.add(new RuleCompletionProposal(prefix.length(),
@@ -292,7 +304,7 @@
if ("in".equals(operator)) {
list.add(new RuleCompletionProposal(prefix.length(), "()",
- "( )", 2, DROOLS_ICON));
+ "( )", 2, DROOLS_ICON));
break;
}
@@ -312,23 +324,21 @@
list.add(new RuleCompletionProposal(prefix.length(), "null",
"null ", DROOLS_ICON));
if ("boolean".equals(type)) {
- list.add(new RuleCompletionProposal(prefix.length(),
- "true", "true ", DROOLS_ICON));
- list.add(new RuleCompletionProposal(prefix.length(),
- "false", "false ", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "true",
+ "true ", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "false",
+ "false ", DROOLS_ICON));
}
if (isObject || "java.lang.String".equals(type)) {
- list.add(new RuleCompletionProposal(prefix.length(),
- "\"\"", "\"\"", 1, DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "\"\"",
+ "\"\"", 1, DROOLS_ICON));
}
if (isObject || "java.util.Date".equals(type)) {
- list
- .add(new RuleCompletionProposal(prefix.length(),
- "\"dd-mmm-yyyy\"", "\"dd-mmm-yyyy\"", 1,
- DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(),
+ "\"dd-mmm-yyyy\"", "\"dd-mmm-yyyy\"", 1, DROOLS_ICON));
}
- list.add(new RuleCompletionProposal(prefix.length(), "()",
- "( )", 2, DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "()", "( )",
+ 2, DROOLS_ICON));
// add parameters with possibly matching type
DrlParser parser = new DrlParser();
try {
@@ -358,11 +368,11 @@
// add globals with possibly matching type
List globals = getGlobals();
if (globals != null) {
- for (iterator = globals.iterator(); iterator.hasNext(); ) {
+ for (iterator = globals.iterator(); iterator.hasNext();) {
GlobalDescr global = (GlobalDescr) iterator.next();
if (isSubtypeOf(global.getType(), type)) {
RuleCompletionProposal proposal = new RuleCompletionProposal(
- prefix.length(), global.getIdentifier());
+ prefix.length(), global.getIdentifier());
proposal.setPriority(-1);
proposal.setImage(VARIABLE_ICON);
list.add(proposal);
@@ -397,18 +407,19 @@
"accumulate ( , init ( ), action ( ), result ( ) )",
13, DROOLS_ICON));
PackageBuilderConfiguration config = new PackageBuilderConfiguration(
- ProjectClassLoader.getProjectClassLoader(getEditor()), null);
+ ProjectClassLoader.getProjectClassLoader(getEditor()),
+ null);
Map accumulateFunctions = config.getAccumulateFunctionsMap();
- for (Iterator iterator2 = accumulateFunctions.keySet().iterator(); iterator2.hasNext(); ) {
+ for (Iterator iterator2 = accumulateFunctions.keySet()
+ .iterator(); iterator2.hasNext();) {
String accumulateFunction = (String) iterator2.next();
- list.add(new RuleCompletionProposal(
- prefix.length(),
+ list.add(new RuleCompletionProposal(prefix.length(),
"accumulate " + accumulateFunction,
"accumulate ( , " + accumulateFunction + "( ) )",
13, DROOLS_ICON));
}
- list.add(new RuleCompletionProposal(prefix.length(),
- "collect", "collect ( )", 10, DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "collect",
+ "collect ( )", 10, DROOLS_ICON));
// add all functions
if ("".equals(fromText)) {
List functions = getFunctions();
@@ -486,7 +497,8 @@
String currentClass = className;
for (int i = 0; i < nestedProperties.length; i++) {
String simplePropertyName = nestedProperties[i];
- currentClass = getSimplePropertyClass(currentClass, simplePropertyName);
+ currentClass = getSimplePropertyClass(currentClass,
+ simplePropertyName);
}
return currentClass;
}
@@ -502,9 +514,8 @@
// TODO can we take advantage of generics here?
return "java.lang.Object";
}
- ClassTypeResolver resolver = new ClassTypeResolver(
- getImports(), ProjectClassLoader
- .getProjectClassLoader(getEditor()));
+ ClassTypeResolver resolver = new ClassTypeResolver(getImports(),
+ ProjectClassLoader.getProjectClassLoader(getEditor()));
try {
Class clazz = resolver.resolveType(className);
if (clazz != null) {
@@ -527,7 +538,7 @@
// add globals
List globals = getGlobals();
if (globals != null) {
- for (Iterator iterator = globals.iterator(); iterator.hasNext(); ) {
+ for (Iterator iterator = globals.iterator(); iterator.hasNext();) {
GlobalDescr global = (GlobalDescr) iterator.next();
result.put(global.getIdentifier(), global.getType());
}
@@ -598,8 +609,8 @@
class1 = convertToNonPrimitiveClass(class1);
class2 = convertToNonPrimitiveClass(class2);
// TODO add code to take primitive types into account
- ClassTypeResolver resolver = new ClassTypeResolver(getImports(), ProjectClassLoader
- .getProjectClassLoader(getEditor()));
+ ClassTypeResolver resolver = new ClassTypeResolver(getImports(),
+ ProjectClassLoader.getProjectClassLoader(getEditor()));
try {
Class clazz1 = resolver.resolveType(class1);
Class clazz2 = resolver.resolveType(class2);
@@ -652,8 +663,7 @@
}
}
- private void addRHSKeywordCompletionProposals(
- List list, String prefix) {
+ private void addRHSKeywordCompletionProposals(List list, String prefix) {
RuleCompletionProposal prop = new RuleCompletionProposal(prefix
.length(), "update", "update();", 7);
prop.setImage(DROOLS_ICON);
@@ -672,8 +682,8 @@
list.add(prop);
}
- private void addRHSJavaCompletionProposals(List list, String prefix, String backText,
- String conditions, String consequence) {
+ private void addRHSJavaCompletionProposals(List list, String prefix,
+ String backText, String conditions, String consequence) {
list.addAll(getJavaCompletionProposals(consequence, prefix,
getRuleParameters(backText)));
}
@@ -730,7 +740,8 @@
}
}
- private void addRuleHeaderProposals(List list, String prefix, String backText) {
+ private void addRuleHeaderProposals(List list, String prefix,
+ String backText) {
list.add(new RuleCompletionProposal(prefix.length(), "salience",
"salience ", DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), "no-loop",
@@ -753,12 +764,12 @@
"enabled false", DROOLS_ICON));
list.add(new RuleCompletionProposal(prefix.length(), "ruleflow-group",
"ruleflow-group \"\"", 16, DROOLS_ICON));
- list.add(new RuleCompletionProposal(prefix.length(), "lock-on-active",
- "lock-on-active ", DROOLS_ICON));
- list.add(new RuleCompletionProposal(prefix.length(), "dialect \"java\"",
- "dialect \"java\"", DROOLS_ICON));
- list.add(new RuleCompletionProposal(prefix.length(), "dialect \"mvel\"",
- "dialect \"mvel\"", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(), "lock-on-active",
+ "lock-on-active ", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(),
+ "dialect \"java\"", "dialect \"java\"", DROOLS_ICON));
+ list.add(new RuleCompletionProposal(prefix.length(),
+ "dialect \"mvel\"", "dialect \"mvel\"", DROOLS_ICON));
}
private boolean addFactTemplatePropertyProposals(String prefix,
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples)
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.classpath
===================================================================
--- labs/jbossrules/trunk/experimental/drools-brms-examples/.classpath 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.classpath 2007-07-10 15:27:43 UTC (rev 13300)
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="lib/insuranceModel.jar"/>
- <classpathentry kind="lib" path="lib/drools-core-4.0.0.SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/mvel14-1.2pre1.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.classpath (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/.classpath)
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.classpath (rev 0)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.classpath 2007-07-10 15:27:43 UTC (rev 13300)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/insuranceModel.jar"/>
+ <classpathentry kind="lib" path="lib/drools-core-4.0.0.SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="lib/mvel14-1.2pre1.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.project
===================================================================
--- labs/jbossrules/trunk/experimental/drools-brms-examples/.project 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.project 2007-07-10 15:27:43 UTC (rev 13300)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>drools-example-brms</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.project (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/.project)
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.project (rev 0)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/.project 2007-07-10 15:27:43 UTC (rev 13300)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>drools-example-brms</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/cache (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/cache)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/files)
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Approve.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-brms-examples/files/Approve.java 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Approve.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -1,24 +0,0 @@
-package org.acme.insurance;
-
-/**
- * This is a simple fact class to mark something as approved.
- * @author Michael Neale
- *
- */
-public class Approve {
-
- private String reason;
-
- public Approve(String reason) {
- this.reason = reason;
- }
-
- public String getReason() {
- return reason;
- }
-
- public void setReason(String reason) {
- this.reason = reason;
- }
-
-}
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Approve.java (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/files/Approve.java)
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Approve.java (rev 0)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Approve.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -0,0 +1,24 @@
+package org.acme.insurance;
+
+/**
+ * This is a simple fact class to mark something as approved.
+ * @author Michael Neale
+ *
+ */
+public class Approve {
+
+ private String reason;
+
+ public Approve(String reason) {
+ this.reason = reason;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+}
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Driver.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-brms-examples/files/Driver.java 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Driver.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -1,41 +0,0 @@
-package org.acme.insurance;
-
-/**
- * This represents obviously a driver who is applying for an insurance Policy.
- * @author Michael Neale
- *
- */
-public class Driver {
-
- private String name = "Mr Joe Blogs";
- private Integer age = new Integer(30);
- private Integer priorClaims = new Integer(0);
- private String locationRiskProfile = "LOW";
-
- public Integer getAge() {
- return age;
- }
- public void setAge(Integer age) {
- this.age = age;
- }
- public String getLocationRiskProfile() {
- return locationRiskProfile;
- }
- public void setLocationRiskProfile(String locationRiskProfile) {
- this.locationRiskProfile = locationRiskProfile;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public Integer getPriorClaims() {
- return priorClaims;
- }
- public void setPriorClaims(Integer priorClaims) {
- this.priorClaims = priorClaims;
- }
-
-
-}
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Driver.java (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/files/Driver.java)
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Driver.java (rev 0)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Driver.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -0,0 +1,41 @@
+package org.acme.insurance;
+
+/**
+ * This represents obviously a driver who is applying for an insurance Policy.
+ * @author Michael Neale
+ *
+ */
+public class Driver {
+
+ private String name = "Mr Joe Blogs";
+ private Integer age = new Integer(30);
+ private Integer priorClaims = new Integer(0);
+ private String locationRiskProfile = "LOW";
+
+ public Integer getAge() {
+ return age;
+ }
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+ public String getLocationRiskProfile() {
+ return locationRiskProfile;
+ }
+ public void setLocationRiskProfile(String locationRiskProfile) {
+ this.locationRiskProfile = locationRiskProfile;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public Integer getPriorClaims() {
+ return priorClaims;
+ }
+ public void setPriorClaims(Integer priorClaims) {
+ this.priorClaims = priorClaims;
+ }
+
+
+}
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Policy.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-brms-examples/files/Policy.java 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Policy.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -1,49 +0,0 @@
-package org.acme.insurance;
-
-/**
- * This represents a policy that a driver is applying for.
- *
- * Obviously in the real world, there are actuaries to mess things up, but lets just pretend there is
- * some simple base price and discount that we can calculate with relatively simple rules !
- *
- * @author Michael Neale
- */
-public class Policy {
-
- private String type = "COMPREHENSIVE";
- private boolean approved = false;
- private int discountPercent = 0;
- private int basePrice;
-
- public boolean isApproved() {
- return approved;
- }
- public void setApproved(boolean approved) {
- this.approved = approved;
- }
- public int getDiscountPercent() {
- return discountPercent;
- }
- public void setDiscountPercent(int discountPercent) {
- this.discountPercent = discountPercent;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public void applyDiscount(int discount) {
- discountPercent += discount;
- }
- public int getBasePrice() {
- return basePrice;
- }
- public void setBasePrice(int basePrice) {
- this.basePrice = basePrice;
- }
-
-}
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Policy.java (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/files/Policy.java)
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Policy.java (rev 0)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Policy.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -0,0 +1,49 @@
+package org.acme.insurance;
+
+/**
+ * This represents a policy that a driver is applying for.
+ *
+ * Obviously in the real world, there are actuaries to mess things up, but lets just pretend there is
+ * some simple base price and discount that we can calculate with relatively simple rules !
+ *
+ * @author Michael Neale
+ */
+public class Policy {
+
+ private String type = "COMPREHENSIVE";
+ private boolean approved = false;
+ private int discountPercent = 0;
+ private int basePrice;
+
+ public boolean isApproved() {
+ return approved;
+ }
+ public void setApproved(boolean approved) {
+ this.approved = approved;
+ }
+ public int getDiscountPercent() {
+ return discountPercent;
+ }
+ public void setDiscountPercent(int discountPercent) {
+ this.discountPercent = discountPercent;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void applyDiscount(int discount) {
+ discountPercent += discount;
+ }
+ public int getBasePrice() {
+ return basePrice;
+ }
+ public void setBasePrice(int basePrice) {
+ this.basePrice = basePrice;
+ }
+
+}
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Rejection.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-brms-examples/files/Rejection.java 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Rejection.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -1,23 +0,0 @@
-package org.acme.insurance;
-
-/**
- *
- * @author Michael Neale
- */
-public class Rejection {
-
- private String reason;
-
- public Rejection(String reason) {
- this.reason = reason;
- }
-
- public String getReason() {
- return reason;
- }
-
- public void setReason(String reason) {
- this.reason = reason;
- }
-
-}
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Rejection.java (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/files/Rejection.java)
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Rejection.java (rev 0)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/Rejection.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -0,0 +1,23 @@
+package org.acme.insurance;
+
+/**
+ *
+ * @author Michael Neale
+ */
+public class Rejection {
+
+ private String reason;
+
+ public Rejection(String reason) {
+ this.reason = reason;
+ }
+
+ public String getReason() {
+ return reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+}
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/repository_export.xml.zip
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/files/repository_export.xml.zip (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/files/repository_export.xml.zip)
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/lib)
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/drools-core-4.0.0.SNAPSHOT.jar
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/drools-core-4.0.0.SNAPSHOT.jar (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/lib/drools-core-4.0.0.SNAPSHOT.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/insuranceModel.jar
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/insuranceModel.jar (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/lib/insuranceModel.jar)
===================================================================
(Binary files differ)
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/mvel14-1.2pre1.jar
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/lib/mvel14-1.2pre1.jar (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/lib/mvel14-1.2pre1.jar)
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/resources (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/resources)
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/resources/org.acme.insurance.pkg
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/resources/org.acme.insurance.pkg (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/resources/org.acme.insurance.pkg)
===================================================================
(Binary files differ)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/src)
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/brmsdeployedrules.properties
===================================================================
--- labs/jbossrules/trunk/experimental/drools-brms-examples/src/brmsdeployedrules.properties 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/brmsdeployedrules.properties 2007-07-10 15:27:43 UTC (rev 13300)
@@ -1,5 +0,0 @@
-newInstance=true
-dir=/Users/fernandomeyer/projects/jbossrules/experimental/drools-brms-examples/resources
-localCacheDir=/Users/fernandomeyer/projects/jbossrules/experimental/drools-brms-examples/cache
-poll=30
-name=insuranceconfig
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/brmsdeployedrules.properties (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/src/brmsdeployedrules.properties)
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/brmsdeployedrules.properties (rev 0)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/brmsdeployedrules.properties 2007-07-10 15:27:43 UTC (rev 13300)
@@ -0,0 +1,5 @@
+newInstance=true
+dir=/Users/fernandomeyer/projects/jbossrules/experimental/drools-brms-examples/resources
+localCacheDir=/Users/fernandomeyer/projects/jbossrules/experimental/drools-brms-examples/cache
+poll=30
+name=insuranceconfig
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/src/org)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/src/org/acme)
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/src/org/acme/insurance)
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/InsuranceBusiness.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-brms-examples/src/org/acme/insurance/InsuranceBusiness.java 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/InsuranceBusiness.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -1,85 +0,0 @@
-package org.acme.insurance;
-
-import java.io.IOException;
-
-import org.drools.RuleBase;
-import org.drools.StatefulSession;
-import org.drools.agent.RuleAgent;
-import org.drools.concurrent.Future;
-
-public class InsuranceBusiness {
-
- public void executeExample() throws Exception {
- RuleBase ruleBase = loadRuleBase();
-
- testUnsafeDriver(ruleBase);
- testSafeMature(ruleBase);
- testUnsafeAreaAndPriors(ruleBase);
- }
-
- /**
- * This shows how rules are loaded up from a deployed package.
- */
- private RuleBase loadRuleBase() throws IOException, Exception {
-
- RuleAgent agent = RuleAgent.newRuleAgent("/brmsdeployedrules.properties");
- RuleBase rb = agent.getRuleBase();
-
- return rb;
- }
-
- private void testUnsafeDriver(RuleBase ruleBase) {
- StatefulSession session = ruleBase.newStatefulSession();
-
- Driver driver = new Driver();
- driver.setPriorClaims(new Integer(4));
- Policy policy = new Policy();
- policy.setType("COMPREHENSIVE");
- policy.setApproved(false);
-
-
- Future futureAssertDrv = session.asyncInsert( driver );
- Future futureAssertPol = session.asyncInsert( policy );
- Future futureFireAllRules = session.asyncFireAllRules();
-
- System.out.println("Policy approved: " + policy.isApproved());
- }
-
- private void testSafeMature(RuleBase ruleBase) {
- StatefulSession session = ruleBase.newStatefulSession();
-
- Driver driver = new Driver();
- driver.setPriorClaims(new Integer(0));
- driver.setAge(new Integer(45));
-
- Policy policy = new Policy();
- policy.setType("COMPREHENSIVE");
- policy.setApproved(false);
-
- Future futureAssertDrv = session.asyncInsert( driver );
- Future futureAssertPol = session.asyncInsert( policy );
- Future futureFireAllRules = session.asyncFireAllRules();
-
- System.out.println("Policy approved: " + policy.isApproved());
- }
-
- private void testUnsafeAreaAndPriors(RuleBase ruleBase) {
- StatefulSession session = ruleBase.newStatefulSession();
-
- Driver driver = new Driver();
- driver.setPriorClaims(new Integer(2));
- driver.setAge(new Integer(55));
- driver.setLocationRiskProfile("LOW");
-
- Policy policy = new Policy();
- policy.setType("COMPREHENSIVE");
- policy.setApproved(false);
-
- Future futureAssertDrv = session.asyncInsert( driver );
- Future futureAssertPol = session.asyncInsert( policy );
- Future futureFireAllRules = session.asyncFireAllRules();
-
- System.out.println("Policy approved: " + policy.isApproved());
- }
-
-}
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/InsuranceBusiness.java (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/src/org/acme/insurance/InsuranceBusiness.java)
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/InsuranceBusiness.java (rev 0)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/InsuranceBusiness.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -0,0 +1,85 @@
+package org.acme.insurance;
+
+import java.io.IOException;
+
+import org.drools.RuleBase;
+import org.drools.StatefulSession;
+import org.drools.agent.RuleAgent;
+import org.drools.concurrent.Future;
+
+public class InsuranceBusiness {
+
+ public void executeExample() throws Exception {
+ RuleBase ruleBase = loadRuleBase();
+
+ testUnsafeDriver(ruleBase);
+ testSafeMature(ruleBase);
+ testUnsafeAreaAndPriors(ruleBase);
+ }
+
+ /**
+ * This shows how rules are loaded up from a deployed package.
+ */
+ private RuleBase loadRuleBase() throws IOException, Exception {
+
+ RuleAgent agent = RuleAgent.newRuleAgent("/brmsdeployedrules.properties");
+ RuleBase rb = agent.getRuleBase();
+
+ return rb;
+ }
+
+ private void testUnsafeDriver(RuleBase ruleBase) {
+ StatefulSession session = ruleBase.newStatefulSession();
+
+ Driver driver = new Driver();
+ driver.setPriorClaims(new Integer(4));
+ Policy policy = new Policy();
+ policy.setType("COMPREHENSIVE");
+ policy.setApproved(false);
+
+
+ Future futureAssertDrv = session.asyncInsert( driver );
+ Future futureAssertPol = session.asyncInsert( policy );
+ Future futureFireAllRules = session.asyncFireAllRules();
+
+ System.out.println("Policy approved: " + policy.isApproved());
+ }
+
+ private void testSafeMature(RuleBase ruleBase) {
+ StatefulSession session = ruleBase.newStatefulSession();
+
+ Driver driver = new Driver();
+ driver.setPriorClaims(new Integer(0));
+ driver.setAge(new Integer(45));
+
+ Policy policy = new Policy();
+ policy.setType("COMPREHENSIVE");
+ policy.setApproved(false);
+
+ Future futureAssertDrv = session.asyncInsert( driver );
+ Future futureAssertPol = session.asyncInsert( policy );
+ Future futureFireAllRules = session.asyncFireAllRules();
+
+ System.out.println("Policy approved: " + policy.isApproved());
+ }
+
+ private void testUnsafeAreaAndPriors(RuleBase ruleBase) {
+ StatefulSession session = ruleBase.newStatefulSession();
+
+ Driver driver = new Driver();
+ driver.setPriorClaims(new Integer(2));
+ driver.setAge(new Integer(55));
+ driver.setLocationRiskProfile("LOW");
+
+ Policy policy = new Policy();
+ policy.setType("COMPREHENSIVE");
+ policy.setApproved(false);
+
+ Future futureAssertDrv = session.asyncInsert( driver );
+ Future futureAssertPol = session.asyncInsert( policy );
+ Future futureFireAllRules = session.asyncFireAllRules();
+
+ System.out.println("Policy approved: " + policy.isApproved());
+ }
+
+}
Deleted: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/MainClass.java
===================================================================
--- labs/jbossrules/trunk/experimental/drools-brms-examples/src/org/acme/insurance/MainClass.java 2007-07-10 13:24:20 UTC (rev 13299)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/MainClass.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -1,14 +0,0 @@
-package org.acme.insurance;
-
-
-public class MainClass {
- public static void main(String[] args) {
-
- InsuranceBusiness launcher = new InsuranceBusiness();
- try {
- launcher.executeExample();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
Copied: labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/MainClass.java (from rev 13299, labs/jbossrules/trunk/experimental/drools-brms-examples/src/org/acme/insurance/MainClass.java)
===================================================================
--- labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/MainClass.java (rev 0)
+++ labs/jbossrules/branches/mvel-tooling-2007-06-30/experimental/drools-brms-examples/src/org/acme/insurance/MainClass.java 2007-07-10 15:27:43 UTC (rev 13300)
@@ -0,0 +1,14 @@
+package org.acme.insurance;
+
+
+public class MainClass {
+ public static void main(String[] args) {
+
+ InsuranceBusiness launcher = new InsuranceBusiness();
+ try {
+ launcher.executeExample();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
More information about the jboss-svn-commits
mailing list