[rules-dev] Drools running in Google App Engine

Mauricio Salatino salaboy at gmail.com
Mon Jan 17 16:24:01 EST 2011


cool.. did you notice a feature that is not working right now and is one
basic set of features?
I'm wondering if a simple start process will work or not.. in the app
engine..
Good work!


On Mon, Jan 17, 2011 at 6:11 PM, Paul Browne <paulb at firstpartners.net>wrote:

> @Mark
>
> Hope married life is treating you well (yep, it's been that long!)
>
> The code that I'm using to Package up the Drools Rules is at the link
> below. Pretty much just serializing the KnowledgeBase to a file, that is
> later read in via a URL when it is deployed on App Engine ; Encountered
> plenty of java.io.File restrictions, but no problems at all around the
> bytecode (at the moment the code is generated within Eclipse, using the GAE
> plugin, which modifies Java not Rule code after the normal compile) .
>
>
> http://code.google.com/p/red-piranha/source/browse/trunk/src/net/firstpartners/drools/PreCompileRuleBuilder.java
>
> Will try to package create a patch using GIT - give me a couple of days to
> figure that out!
>
> @salaboy
> It's a very basic feature set at the moment; Just rule load, insert facts,
> globals and get output.
>
> The online  sample loads a spreadsheet, rules fire that update the
> spreadsheet, marks the changed cells in Orange.  I have the simple sample
> deployed as of today (17th Jan '11) - might take down or modify later).
>
> Original Spreadsheet;
> http://red-piranha.appspot.com/spreadsheet/chocolate-data.xls
> Rules file;
> http://red-piranha.appspot.com/spreadsheet/log-then-modify-rules.drl
> Run the sample online; http://red-piranha.appspot.com/ - check out the
> 'log' tab in the spreadsheet to see what rules have fired.
>
> Red-Piranha project aim is to make the power of Drools available to Excel
> users *without* Java code. Number 1 complaint about my book was the 'techie
> setup bit' in Chapter 2 (remember the audience was Excel power users);
> Deploying online allows people to try without the setup.
>
> So, most of the features I want to add will be case-by-case as needed by
> the samples. It would be *cool* to compile the rules online; When I tried
> this 12 months ago there were problems with the Apache Mvel library so I may
> be brave enough to try again later, but current priority is to get the Core
> / Runtime  changes submitted as a JIRA patch.
>
> Paul
>
> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Mon, 17 Jan 2011 19:25:54 +0000
>> From: Paul Browne <paulb at firstpartners.net>
>> Subject: [rules-dev] Drools running in Google App Engine - list of
>>        changes made to code
>> To: rules-dev at lists.jboss.org
>> Message-ID:
>>        <AANLkTimAwC3nb2P0LRx40LBpUg3Jx+7dEuuyYQ7tbOTZ at mail.gmail.com<AANLkTimAwC3nb2P0LRx40LBpUg3Jx%2B7dEuuyYQ7tbOTZ at mail.gmail.com>
>> >
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> Folks,
>>
>> A little bit later than expected (!) I've managed to get Drools running
>> within Google App Engine.
>>
>> A list of the changes that I made to the Drools Core and Drools Util code
>> are below. A lot of these changes are NullPointer checks when reading
>> properties from a file (i.e. things that you might want in the codebase
>> anyway).
>>
>> Notes on the sample I used to try this out are at
>> http://code.google.com/p/red-piranha/wiki/ModifyDroolsRunInGoogleAppEngine
>> The sample (for the moment) is running a pre-built KnowledgeBase within
>> GAE
>> (i.e. no rule compilation, nor any of the advanced features).
>>
>> What is the best way of submitting the actual code changes for review and
>> possible inclusion as part of the Drools source code?
>>
>> Thanks
>>
>> Paul
>>
>> * Drools Core *
>>
>>  AbstractRuleBase.java // line 265 surrounded by try / catch
>>      this.config = (RuleBaseConfiguration) droolsStream.readObject();
>>
>>  RuleBaseConfiguration.java // - line 985 surround by try / catch
>>         this.classLoader = ClassLoaderUtil.getClassLoader
>>
>>  RuleBaseConfiguration.java // line 395  surround by try / catch
>>     this.chainedProperties = new ChainedProperties( "rulebase.conf",
>>
>>  RuleBaseConfiguration.java // line 457 surround by try / catch,
>> default Conflict Resolver
>>          setConflictResolver( determineConflictResolver(
>> this.chainedProperties.getProperty( "drools.conflictResolver",
>>
>> * Drools Util *
>>
>>  ChainedProperties.java // line 98 - exception check around
>> ClassLoader.getSystemClassLoader();
>>
>>  ChainedProperties.java // line 125 - exception check around
>> ClassLoader.getSystemClassLoader();
>>
>>  ChainedProperties.java // line 160
>>        - null check for properties /key and return default
>>
>>  ChainedProperties.java // line 240 - surround by try / catch for
>> securityaccessexception
>>    if ( file != null && file.exists() ) {
>>
>>  ChainedProperties.java // line 270 - surround by try / catch for
>> securityaccessexception
>>    if ( file != null && file.exists() ) {
>>
>>  ClassFieldInspector.java // line 166 -
>>         return "/" + clazz.getCanonicalName() + ".class";
>>
>>  ClassLoaderUtil.java // line 25 - surround by try / catch for
>> securityaccessexception
>>     ClassLoader systemClassLoader =
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://lists.jboss.org/pipermail/rules-dev/attachments/20110117/42248168/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Mon, 17 Jan 2011 19:32:15 +0000
>> From: Mark Proctor <mproctor at codehaus.org>
>> Subject: Re: [rules-dev] Drools running in Google App Engine - list of
>>        changes made to code
>> To: rules-dev at lists.jboss.org
>> Message-ID: <4D34993F.7070102 at codehaus.org>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> On 17/01/2011 19:25, Paul Browne wrote:
>> > Folks,
>> >
>> > A little bit later than expected (!) I've managed to get Drools
>> > running within Google App Engine.
>> I thought App Engine wouldn't work with runtime generated bytecode and
>> had classloader restrictions?
>>
>> Mark
>> >
>> > A list of the changes that I made to the Drools Core and Drools Util
>> > code are below. A lot of these changes are NullPointer checks when
>> > reading properties from a file (i.e. things that you might want in the
>> > codebase anyway).
>> >
>> > Notes on the sample I used to try this out are at
>> >
>> http://code.google.com/p/red-piranha/wiki/ModifyDroolsRunInGoogleAppEngine
>> > The sample (for the moment) is running a pre-built KnowledgeBase
>> > within GAE (i.e. no rule compilation, nor any of the advanced features).
>> >
>> > What is the best way of submitting the actual code changes for review
>> > and possible inclusion as part of the Drools source code?
>> A patch against trunk attached to a jira should suffice, don't forget
>> we've moved to GIT.
>>
>> Mark
>> >
>> > Thanks
>> >
>> > Paul
>> >
>> > *Drools Core *
>> >
>> >   AbstractRuleBase.java// line 265 surrounded by try / catch
>> >
>> >        this.config=  (RuleBaseConfiguration)  droolsStream.readObject();
>> >   RuleBaseConfiguration.java// - line 985 surround by try / catch
>> >
>> >           this.classLoader=  ClassLoaderUtil.getClassLoader
>> >   RuleBaseConfiguration.java// line 395  surround by try / catch
>> >
>> >       this.chainedProperties=  new  ChainedProperties(  "rulebase.conf",
>> >   RuleBaseConfiguration.java// line 457 surround by try / catch, default
>> Conflict Resolver
>> >
>> >            setConflictResolver(  determineConflictResolver(
>>  this.chainedProperties.getProperty(  "drools.conflictResolver",
>> >
>> > *Drools Util *
>> >
>> >   ChainedProperties.java// line 98 - exception check around
>> ClassLoader.getSystemClassLoader();
>> >   ChainedProperties.java// line 125 - exception check around
>> ClassLoader.getSystemClassLoader();
>> >   ChainedProperties.java// line 160
>> >          -  null  checkfor  properties/keyand  return  default
>> >   ChainedProperties.java// line 240 - surround by try / catch for
>> securityaccessexception
>> >
>> >      if  (  file!=  null  &&  file.exists()  )  {
>> >   ChainedProperties.java// line 270 - surround by try / catch for
>> securityaccessexception
>> >
>> >      if  (  file!=  null  &&  file.exists()  )  {
>> >   ClassFieldInspector.java// line 166 -
>> >           return  "/"  +  clazz.getCanonicalName()  +  ".class";
>> >   ClassLoaderUtil.java// line 25 - surround by try / catch for
>> securityaccessexception
>> >
>> >       ClassLoader  systemClassLoader=
>> >
>> >
>> > _______________________________________________
>> > rules-dev mailing list
>> > rules-dev at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://lists.jboss.org/pipermail/rules-dev/attachments/20110117/fca45461/attachment-0001.html
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Mon, 17 Jan 2011 17:33:57 -0300
>> From: Mauricio Salatino <salaboy at gmail.com>
>> Subject: Re: [rules-dev] Drools running in Google App Engine - list of
>>        changes made to code
>> To: Rules Dev List <rules-dev at lists.jboss.org>
>> Message-ID:
>>        <AANLkTi=e3wPiKAtGrDbe+p10KqxT-M-8DiKU4XYnLJ0e at mail.gmail.com<e3wPiKAtGrDbe%2Bp10KqxT-M-8DiKU4XYnLJ0e at mail.gmail.com>
>> >
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> That sounds really nice!
>> Can you mention the features that you get working? which are left out?
>>
>>
>> On Mon, Jan 17, 2011 at 4:32 PM, Mark Proctor <mproctor at codehaus.org>
>> wrote:
>>
>> >  On 17/01/2011 19:25, Paul Browne wrote:
>> >
>> > Folks,
>> >
>> > A little bit later than expected (!) I've managed to get Drools running
>> > within Google App Engine.
>> >
>> > I thought App Engine wouldn't work with runtime generated bytecode and
>> had
>> > classloader restrictions?
>> >
>> > Mark
>> >
>> >
>> > A list of the changes that I made to the Drools Core and Drools Util
>> code
>> > are below. A lot of these changes are NullPointer checks when reading
>> > properties from a file (i.e. things that you might want in the codebase
>> > anyway).
>> >
>> > Notes on the sample I used to try this out are at
>> >
>> http://code.google.com/p/red-piranha/wiki/ModifyDroolsRunInGoogleAppEngine
>> > The sample (for the moment) is running a pre-built KnowledgeBase within
>> GAE
>> > (i.e. no rule compilation, nor any of the advanced features).
>> >
>> > What is the best way of submitting the actual code changes for review
>> and
>> > possible inclusion as part of the Drools source code?
>> >
>> > A patch against trunk attached to a jira should suffice, don't forget
>> we've
>> > moved to GIT.
>> >
>> > Mark
>> >
>> >
>> > Thanks
>> >
>> > Paul
>> >
>> > * Drools Core *
>> >
>> >  AbstractRuleBase.java // line 265 surrounded by try / catch
>> >
>> >       this.config = (RuleBaseConfiguration) droolsStream.readObject();
>> >
>> >  RuleBaseConfiguration.java // - line 985 surround by try / catch
>> >
>> >          this.classLoader = ClassLoaderUtil.getClassLoader
>> >
>> >  RuleBaseConfiguration.java // line 395  surround by try / catch
>> >
>> >      this.chainedProperties = new ChainedProperties( "rulebase.conf",
>> >
>> >  RuleBaseConfiguration.java // line 457 surround by try / catch, default
>> Conflict Resolver
>> >
>> >           setConflictResolver( determineConflictResolver(
>> this.chainedProperties.getProperty( "drools.conflictResolver",
>> >
>> >  * Drools Util *
>> >
>> >  ChainedProperties.java // line 98 - exception check around
>> ClassLoader.getSystemClassLoader();
>> >
>> >  ChainedProperties.java // line 125 - exception check around
>> ClassLoader.getSystemClassLoader();
>> >
>> >  ChainedProperties.java // line 160
>> >         - null check for properties /key and return default
>> >
>> >  ChainedProperties.java // line 240 - surround by try / catch for
>> securityaccessexception
>> >
>> >     if ( file != null && file.exists() ) {
>> >
>> >  ChainedProperties.java // line 270 - surround by try / catch for
>> securityaccessexception
>> >
>> >     if ( file != null && file.exists() ) {
>> >
>> >  ClassFieldInspector.java // line 166 -
>> >          return "/" + clazz.getCanonicalName() + ".class";
>> >
>> >  ClassLoaderUtil.java // line 25 - surround by try / catch for
>> securityaccessexception
>> >
>> >      ClassLoader systemClassLoader =
>> >
>> >
>> >
>> > _______________________________________________
>> > rules-dev mailing listrules-dev at lists.jboss.orghttps://
>> lists.jboss.org/mailman/listinfo/rules-dev
>> >
>> >
>> >
>> > _______________________________________________
>> > rules-dev mailing list
>> > rules-dev at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-dev
>> >
>> >
>>
>>
>> --
>>  - CTO @ http://www.plugtree.com
>>  - MyJourney @ http://salaboy.wordpress.com
>>  - Co-Founder @ http://www.jbug.com.ar
>>
>>  - Salatino "Salaboy" Mauricio -
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL:
>> http://lists.jboss.org/pipermail/rules-dev/attachments/20110117/5b76097b/attachment.html
>>
>> ------------------------------
>>
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
>>
>> End of rules-dev Digest, Vol 49, Issue 11
>> *****************************************
>>
>
>
> _______________________________________________
> rules-dev mailing list
> rules-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>


-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20110117/3fc08e7a/attachment-0001.html 


More information about the rules-dev mailing list