Re: [rules-users] Drools + Spring without internet

2010-12-01 Thread Jason Davidson
I had the same issue at startup (i.e. not connected to the internet).
 Anyway, I used the XSD files are bundled in the drools-spring-5.1.1.jar.  I
simply changed my application context schema location to "
http://drools.org/schema/drools-spring
http://drools.org/schema/drools-spring.xsd"; and the XSD files are loaded
from the jar file at startup.

On Wed, Dec 1, 2010 at 8:21 AM, Corneil du Plessis wrote:

> change schema location to that is only contains filenames like
>
> http://www.springframework.org/schema/beans";
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>xmlns:drools="http://drools.org/schema/drools-spring";
>xmlns:camel="http://camel.apache.org/schema/spring";
> 
> xsi:schemaLocation="http://www.springframework.org/schema/beansspring-beans-2.5.xsd
> http://drools.org/schema/drools-spring drools-spring-1.0.0.xsd
> http://camel.apache.org/schema/spring camel-spring.xsd">
>
> Then put the xsd files in same folder as applicationContext.xml
>
>
> On 01/12/2010 17:15, Geoffrey De Smet wrote:
> > IIRC, there's something in drools-spring we can do, so the xsd's don't
> > have to be downloaded from the internet but can be used directly from
> > the jar.
> > It might be a properties file or something in the jar, which says urlX =
> > pathYinTheJar.
> >
> > Op 01-12-10 15:59, Anderson Rocha schreef:
> >> Thank you for your replay.
> >>
> >> I downloaded the schemas and configured the applicationContext.xml
> >> like this, consider "path to my" the path to the file.
> >>
> >> http://www.springframework.org/schema/beans";
> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >> xmlns:drools="http://drools.org/schema/drools-spring";
> >> xmlns:camel="http://camel.apache.org/schema/spring";
> >> xsi:schemaLocation="http://www.springframework.org/schema/beans
> >> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >> *http://drools.org/schema/drools-spring
> >> file:///path/to/my/drools-spring-1.0.0.xsd*
> >> *http://camel.apache.org/schema/spring
> >> file:///path/to/my/camel-spring.xsd"*>
> >>
> >> I have a web application, and when I execute it works =) but I have
> >> some unit tests and I initialize the spring with the code
> >>
> >> ApplicationContext applicationContext = new
> >> ClassPathXmlApplicationContext(new String[] {"applicationContext.xml"});
> >>
> >> In this case I get the same error I had before. Any ideia?
> >>
> >> Anderson
> >>
> >> 2010/12/1 Mauricio Salatinomailto:sala...@gmail.com
> >>
> >>
> >>  yes you can download the schemas to your hard drive and point the
> >>  applicationContext.xml to them.
> >>
> >>
> >>  2010/12/1 Anderson Rocha >>  >
> >>
> >>  Hi all,
> >>
> >>  I realized that to use Drools with Spring I need to be
> >>  conected to the internet, but sometimes I am not. There is a
> >>  way to download the tags of Drools and configure the
> >>  applicationContext.xml to seek for them localy?
> >>
> >>  Regards,
> >>  Anderson
> >>
> >>  ___
> >>  rules-users mailing list
> >>  rules-users@lists.jboss.org >
> >>  https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >>
> >>
> >>
> >>  --
> >>   - CTO @ http://www.plugtree.com
> >>   - MyJourney @ http://salaboy.wordpress.com
> >>   - Co-Founder @ http://www.jbug.com.ar
> >>
> >>   - Salatino "Salaboy" Mauricio -
> >>
> >>  ___
> >>  rules-users mailing list
> >>  rules-users@lists.jboss.org
> >>  https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >>
> >>
> >> ___
> >> rules-users mailing list
> >> rules-users@lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] KnowledgeAgent ChangeSet failing to reload resources

2010-11-10 Thread Jason Davidson
Eric,

Thanks for your help.  I was never able to get the Drools Spring Resource
Scanner to work.  Instead I changed my Spring beans to use a KnowledgeAgent
similar to the code you've outlined below and it's working.

Jason

On Thu, Nov 4, 2010 at 9:50 AM, etfink123  wrote:

>
> Jason,
>
> Your's sound slightly different in that you have not been able to
> successfully fire up your KnowledgeBase at all.
>
> Mine works, but fails once an invalid DRL file is read.
>
> In any case, I am not use PKG for my ChangeSet resources:
>
> xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
>xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
>
>
>
>
> 
>
> I am creating the KA as follows:
>
>KnowledgeAgentConfiguration agentConfig =
> KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
>agentConfig.setProperty("drools.agent.newInstance", "false");
>
>agent = KnowledgeAgentFactory.newKnowledgeAgent("MyAgent",
> agentConfig);
>kaListener = new KnowledgeAgentEventListenerImpl();
>agent.addEventListener(kaListener);
>
>
> agent.applyChangeSet(ResourceFactory.newClassPathResource("rules/ChangeSet.xml"));
>agent.monitorResourceChangeEvents(true);
>
>ResourceChangeScannerConfiguration scannerConfig =
>
> ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
>scannerConfig.setProperty("drools.resource.scanner.interval", "5");
>
>
> ResourceFactory.getResourceChangeScannerService().configure(scannerConfig);
>ResourceFactory.getResourceChangeNotifierService().start();
>ResourceFactory.getResourceChangeScannerService().start();
>
> I'll keep you posted if I hear anything.
>
> - Eric
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/KnowledgeAgent-ChangeSet-failing-to-reload-resources-tp1842033p1842540.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] KnowledgeAgent ChangeSet failing to reload resources

2010-11-04 Thread Jason Davidson
Eric,

I've been fighting something similar to your problem as posted
here.


I'm interested in what your KnowledgeAgent setup because I can't get the
agent to detect changes to rule PKG files.  Are you using Spring?

Thanks!
Jason

On Thu, Nov 4, 2010 at 8:41 AM, Fink, Eric [USA]  wrote:

> Greetings.  I am using Drools 5.1.1's KnowledgeAgent ChangeSet
> functionality and have come across an issue.
>
> here is the use case:
>
> Fire up the application with a valid DRL file. Works as designed.
> Update the DRL file. ChangeSet senses updated file, KnowledgeBase is
> updated with updated rules, yadda, yadda. Works as designed.
> Update the DRL file and introduce errors in the LHS of the rule. For
> example, I changed Sensor to Sccensor in the example below and $masterId is
> not defined. The following is reported as expected:
>
> KnowledgeAgent rebuilding KnowledgeBase using ChangeSet
> [2010:11:308 09:11:515:info] KnowledgeAgent performing an incremental build
> of the ChangeSet
> [2010:11:308 09:11:843:debug] KnowledgeAgent has KnowledgeBuilder errors
>  object=Unable to resolve ObjectType 'Sccensor' : [Rule name='18)
> sensorCount derived variable']
> Rule Compilation error : [Rule name='18) sensorCount derived variable']
>bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (7:590)
> : $masterID cannot be resolved
>bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (8:624)
> : $masterID cannot be resolved
>bass/enrichment/Rule_18__sensorCount_derived_variable_0.java (9:769)
> : $masterID cannot be resolved
>
> Update the DRL file to the previously working version. The ChangeSet never
> senses that the file has been updated. It just runs along checking every x
> seconds.
>
> Has anyone experienced this? Is there a listener that should be firing
> somewhere?
>
> Thanks is advance.
>
> - Eric
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Starting resource change scanner and notifier in drools-server.

2010-11-04 Thread Jason Davidson
I've move both the changeset.xml and my PKG files to a file location (not on
the class path).  It still doesn't detect when the PKG files have been
updated.

changeset.xml:





  

  

  

  

  

  

  

  

  





Spring config:

  

  

  

  



 



  


 Could it be because I'm using PKGs instead of DRL files?

Thanks!!
Jason

2010/11/3 Mark Proctor 

>  It won't detect changes on the classpath. Needs to be file or http.
>
> Mark
>
> On 03/11/2010 21:49, Jason Davidson wrote:
>
> Hello,
>
>  Any tips on this?  I'm seeing this same behavior using Drools 5.1.1:
>
>  Spring Beans:
>
>   
>
>   
>
>   
>
>   
>
>   
>
> 
>
>   "classpath:drools-changeset.xml"/>
>
> 
>
>   
>
>  Changeset:
>
> 
> xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
>
> xs:schemaLocation='http://drools.org/drools-5.0/change-set
> http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd
> ' >
>
> 
>
>   http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
> "
>
>type='PKG' basicAuthentication="enabled" username="admin"
> password="admin" />
>
> 
>
> 
>
>
>
>  At startup I see that the KnowledgeAgent registers a listener but never
> detects changes:
>
> [2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
> interval=60
>
> [2010:11:307 15:11:506:info] ResourceChangeScanner created with default
> interval=60
>
> [2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
> interval=10
>
> [2010:11:307 15:11:528:info] ResourceChangeNotification created
>
> [2010:11:307 15:11:528:debug] ResourceChangeNotification monitor added
> monitor=org.drools.io.impl.resourcechangescanneri...@616181be
>
> [2010:11:307 15:11:529:debug] KnowledgeAgent building resource map
>
> [2010:11:307 15:11:529:info] KnowledegAgent has started listening for
> ChangeSet notifications
>
> [2010:11:307 15:11:529:info] KnowledgeAgent created, with configuration:
>
> monitorChangeSetEvents=true scanResources=true scanDirectories=true
> newInstance=true
>
> [2010:11:307 15:11:530:info] KnowledgeAgent applying ChangeSet
>
> [2010:11:307 15:11:531:debug] KnowledgeAgent processing sub
> ChangeSet=[ClassPathResource path='drools-changeset.xml']
>
> [2010:11:307 15:11:919:debug] KnowledgeAgent notifier subscribing to
> resource=[UrlResource path='
> http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
> ']
>
> [2010:11:307 15:11:920:debug] ResourceChangeNotification subscribing
> listener=org.drools.agent.impl.knowledgeagenti...@d2a7c1e to
> resource=[UrlResource path='
> http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
> ']
>
> [2010:11:307 15:11:920:debug] ResourceChangeScanner subcribing
> notifier=org.drools.io.impl.resourcechangenotifieri...@603a9c52 to
> resource=[UrlResource path='
> http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
> ']
>
> [2010:11:307 15:11:920:debug] KnowledgeAgent rebuilding KnowledgeBase using
> ChangeSet
>
>
>  Thanks!
>
> Jason
>
>
>   2010/9/23 Clandes Tino 
>
>>   Hi,
>> I've also faced the same problem.
>> Hope somebody could give a hint.
>>
>> thanks & best,
>> milan
>>
>> --- On *Mon, 20/9/10, Graham Thomson * wrote:
>>
>>
>> From: Graham Thomson 
>> Subject: [rules-users] Starting resource change scanner and notifier in
>> drools-server.
>> To: rules-users@lists.jboss.org
>> Date: Monday, 20 September, 2010, 15:24
>>
>>
>>
>> Hi,
>>
>> I would like to ask for help with setting up drools-server with Guvnor. I
>> am using version 5.1.1 of both.
>>
>> I am trying to set up an instance of drools-server in Tomcat that
>> periodically loads new updates of packages published in Guvnor (both
>> drools-server and Guvnor run in the same instance of Tomcat).
>>
>> My change set definition is as follows:
>>
>> 
>> > xmlns='http://drools.org/drools-5.0/change-set'<http://drools.org/drools-5.0/change-set%27>
>>   
>> xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'<http://www.w3.org/2001/XMLSchema-instan

Re: [rules-users] Starting resource change scanner and notifier in drools-server.

2010-11-03 Thread Jason Davidson
Hello,

Any tips on this?  I'm seeing this same behavior using Drools 5.1.1:

Spring Beans:

  

  

  

  

  



 



  

Changeset:





  http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
"

   type='PKG' basicAuthentication="enabled" username="admin"
password="admin" />







At startup I see that the KnowledgeAgent registers a listener but never
detects changes:

[2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
interval=60

[2010:11:307 15:11:506:info] ResourceChangeScanner created with default
interval=60

[2010:11:307 15:11:506:info] ResourceChangeScanner reconfigured with
interval=10

[2010:11:307 15:11:528:info] ResourceChangeNotification created

[2010:11:307 15:11:528:debug] ResourceChangeNotification monitor added
monitor=org.drools.io.impl.resourcechangescanneri...@616181be

[2010:11:307 15:11:529:debug] KnowledgeAgent building resource map

[2010:11:307 15:11:529:info] KnowledegAgent has started listening for
ChangeSet notifications

[2010:11:307 15:11:529:info] KnowledgeAgent created, with configuration:

monitorChangeSetEvents=true scanResources=true scanDirectories=true
newInstance=true

[2010:11:307 15:11:530:info] KnowledgeAgent applying ChangeSet

[2010:11:307 15:11:531:debug] KnowledgeAgent processing sub
ChangeSet=[ClassPathResource path='drools-changeset.xml']

[2010:11:307 15:11:919:debug] KnowledgeAgent notifier subscribing to
resource=[UrlResource path='
http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
']

[2010:11:307 15:11:920:debug] ResourceChangeNotification subscribing
listener=org.drools.agent.impl.knowledgeagenti...@d2a7c1e to
resource=[UrlResource path='
http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
']

[2010:11:307 15:11:920:debug] ResourceChangeScanner subcribing
notifier=org.drools.io.impl.resourcechangenotifieri...@603a9c52 to
resource=[UrlResource path='
http://10.1.109.54:8080/drools-5.1.1-guvnor/org.drools.guvnor.Guvnor/package/com.cjs.jworks.rules.cases/LATEST
']

[2010:11:307 15:11:920:debug] KnowledgeAgent rebuilding KnowledgeBase using
ChangeSet


Thanks!

Jason


2010/9/23 Clandes Tino 

> Hi,
> I've also faced the same problem.
> Hope somebody could give a hint.
>
> thanks & best,
> milan
>
> --- On *Mon, 20/9/10, Graham Thomson * wrote:
>
>
> From: Graham Thomson 
> Subject: [rules-users] Starting resource change scanner and notifier in
> drools-server.
> To: rules-users@lists.jboss.org
> Date: Monday, 20 September, 2010, 15:24
>
>
>
> Hi,
>
> I would like to ask for help with setting up drools-server with Guvnor. I
> am using version 5.1.1 of both.
>
> I am trying to set up an instance of drools-server in Tomcat that
> periodically loads new updates of packages published in Guvnor (both
> drools-server and Guvnor run in the same instance of Tomcat).
>
> My change set definition is as follows:
>
> 
>xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
>   xs:schemaLocation='http://drools.org/drools-5.0/change-set
>
> http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'
> >
>   
>type='PKG' basicAuthentication="enabled" username=""
> password="" />
> http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/ of my packages>/LATEST"
>   type="PKG" basicAuthentication="enabled" username=""
> password="" />
>   
> 
>
> My knowledge-services.xml configuration is as follows (based on the unit
> test examples highlighted in
> http://article.gmane.org/gmane.comp.java.drools.user/20992/match=drools+spring
> ):
>
> 
> http://www.springframework.org/schema/beans";
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>xmlns:drools="http://drools.org/schema/drools-spring";
>xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
>http://drools.org/schema/drools-spring
> http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-container/drools-spring/src/main/resources/org/drools/container/spring/drools-spring-1.0.0.xsd
> ">
>
>   
>
>   
>
>node="node1"/>
>
>   
>
>   
> 
>/>
> 
>   
>
> 
>
> On loading drools-server, the resources listed in the change set are loaded
> and available.
>
> The problem is that when a new package built and published in Guvnor,
> drools-server does not detect this and update itself. The effect is the same
> as if a KnowledgeAgent were used locally and
>
>   ResourceFactory.getResourceChangeNotifierService().start();
>   ResourceFactory.getResourceChangeScannerService().start();
>
> were not called. This leads me to the assumption that drools-server does
> not start these services by default.
>
> My question is then can/how do I configure drools-server to start 

[rules-users] Reusing Rules in a Rule Flow?

2010-08-03 Thread Jason Davidson
Is it possible to use a rule in a rule flow without a "ruleflow-group"?

Here's our use case:  We have a base set of rules that are not part of
a ruleflow-group.  But we want to allow the administrators of the
system to build custom rule flows that reuse these existing base
rules.  In most instances the "base" rules will be fired but in some
instances the ruleflow will be executed too.

What's the best way to reuse a rule in this case?

Thanks!
Jason

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools and OSGi

2010-04-05 Thread Jason Davidson
I don't know if this helps, but I had to turn the MVEL JIT compiler off in
the Equinox OSGi container:
OptimizerFactory.setDefaultOptimizer("reflective");

Also, we used pre-compiled packages instead of compiling the DRL files at
runtime.  For example:


RuleBaseConfiguration ruleBaseConfig = new
RuleBaseConfiguration();

ruleBaseConfig.setClassLoader(this.getClass().getClassLoader());

//MVEL in OSGi is a complete CF - this turns off the MVEL JIT -
potential resource hog but that's the nature of OSGi classloading
//and Drools...
OptimizerFactory.setDefaultOptimizer("reflective");

RuleBase ruleBase =
RuleBaseFactory.newRuleBase(ruleBaseConfig);

InputStream pkgIs =
this.getClass().getResourceAsStream("/com/cjs/hazel/rules/com.cjs.hazel.rules.pkg");
addPackage(ruleBase,pkgIs);
.

On Fri, Apr 2, 2010 at 4:42 PM, AervTerrh wrote:

>
> Hey,
>
> Okay. I know this problem can be found all over. But I can't seem to figure
> out a solution to it. Somehow I must be doing something wrong. I've created
> a simple application that evaluates some rules and changes some objects
> based on that. Everything worked fine, not a single problem there. All
> libraries could be easily found etc.
>
> Now I wanted to convert this to a Felix OSGi bundle.
>
> So, what I did, was creating a bundle (new plugin project based on existing
> jars) with the drools jars (core, compiler, api, jsr) and tried the next
> code in the RuleEngine class:
>
> Properties props = new Properties();
> props.setProperty("drools.dialect.java.compiler", "JANINO");
> KnowledgeBuilderConfiguration config =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(props, null);
> (here's where it fails)
> KnowledgeBuilder kbuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder(config);
> kbuilder.add(ResourceFactory.newClassPathResource(fileName,
> RuleEngine.class), ResourceType.DRL);
>
> This is pretty much the loading of the rule file. The RuleEngine is started
> in an Activator. The file is found and everything. But I keep getting the
> same error when starting the bundle.
>
> org.drools.RuntimeDroolsException: Unable to load dialect
> 'org.drools.rule.builder.dialect.mvel.MVELDialectConfigurati on:mvel:null'
> at org.drools.compiler.PackageBuilderConfiguration.addDialect(P
> ackageBuilderConfiguration.java:274)
> at org.drools.compiler.PackageBuilderConfiguration.buildDialect
> ConfigurationMap(PackageBuilderConfiguration.java:259)
> at org.drools.compiler.PackageBuilderConfiguration.init(Package
> BuilderConfiguration.java:176)
> at
>
> org.drools.compiler.PackageBuilderConfiguration.(PackageBuilderConfiguration.java:148)
> at org.drools.builder.impl.KnowledgeBuilderProviderImpl.newKnow
> ledgeBuilderConfiguration(KnowledgeBuilderProviderImpl.java: 21)
> at org.drools.builder.KnowledgeBuilderFactory.newKnowledgeBuild
> erConfiguration(KnowledgeBuilderFactory.java:68)
> at test.Activator$RuleCreator.createRule(Activator.java:52)
> at test.Activator.start(Activator.java:32)
> at org.apache.felix.framework.util.SecureAction.startActivator(
> SecureAction.java:639)
> at org.apache.felix.framework.Felix.activateBundle(Felix.java:1 700)
> at org.apache.felix.framework.Felix.startBundle(Felix.java:1622 )
> at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.j ava:1077)
> at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl .java:264)
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.ClassNotFoundException:
> org.drools.rule.builder.dialect.mvel.MVELDialectConfiguratio n
> at java.net.URLClassLoader$1.run(Unknown Source)
>
>
> The packages I import in the manifest:
> Import-Package: org.codehaus.janino;version="2.4.3",
> org.drools,
> org.drools.builder,
> org.drools.compiler,
> org.drools.io,
> org.drools.rule,
> org.drools.rule.builder.dialect.java,
> org.drools.rule.builder.dialect.mvel,
> org.osgi.framework;version="1.3.0"
>
> In my target platform I add the the drools project I created (with
> drools-xx.jar (the necessary ones), I also added the following:
> -ant
> -antlr-runtime
> -janino
> -jsr94
> -xstream
>
> But I can't seem to get it working... Does anyone know what can be done
> about this? Or a working example of Drools in Felix OSGi would also be
> helpful.
>
> Any help is very much appreciated, I've been looking into this for days.
>
> Thanks!
>
> Kind regards,
>
> Aerv
> --
> View this message in context:
> http://n3.nabble.com/Drools-and-OSGi-tp694011p694011.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rule Reuse Best Practice

2009-12-15 Thread Jason Davidson
Thanks for the reply.  I was hoping to avoid refactoring the fact objects.

2009/12/15 Edson Tirelli 

>
>2 ways:
>
> 1. If you have a common superclass/interface for your objects and the
> superclass/interface has the method to return your dln, just make use of
> inheritance:
>
> when
> MyDTOInterface( dln not matches "^.{5,15}$")
> then
>// do something
>
> 2. If you want to use composition instead, make dln a top level fact:
>
> when
>DLN( id not matches "^.{5,15}$")
> then
>// do something
>
>Edson
>
> 2009/12/15 Jason Davidson 
>
>> Hello,
>>
>> What is the best practice for reusing rules?  I've got a license number
>> validation rule that I need to reuse for different fact types.  For example,
>> the first rule uses the license number in a CitationDTO fact:
>> rule "Citation DL Number"
>>ruleflow-group "CitationEntryValidationFlow"
>> when
>> CitationDTO($dln :
>> citationSubject.driverLicense.driverAuthorizationId not matches "^.{5,15}$")
>> then
>> resultHolder.setMessage(GenericCitationFieldIds.DLN,"DLN [{0}]
>> must be at least 5 characters long and no more than 15 characters long.",
>> new Object[]{$dln});
>> end
>>
>> Then I have another rule that uses the license number from the
>> InCourtSearchDTO:
>> rule "InCourt DL Number"
>> ruleflow-group "InCourtSearchValidationGroup"
>> when
>> InCourtSearchDTO( $d : dln not matches "^.{5,15}$")
>> then
>> resultHolder.setMessage(UserLogonFieldIds.END_DT,"DLN [{0}] must
>> be at least 5 characters long and no more than 15 characters long.", new
>> Object[]{$d});
>> end
>>
>> Obviously this is a poor implementation because the license number check
>> 'not matches "^.{5,15}$"' is duplicated.  Is there a way I can reuse this
>> rule?
>>
>> Thanks!
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
>  Edson Tirelli
>  JBoss Drools Core Development
>  JBoss by Red Hat @ www.jboss.com
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Rule Reuse Best Practice

2009-12-15 Thread Jason Davidson
Hello,

What is the best practice for reusing rules?  I've got a license number
validation rule that I need to reuse for different fact types.  For example,
the first rule uses the license number in a CitationDTO fact:
rule "Citation DL Number"
   ruleflow-group "CitationEntryValidationFlow"
when
CitationDTO($dln :
citationSubject.driverLicense.driverAuthorizationId not matches "^.{5,15}$")
then
resultHolder.setMessage(GenericCitationFieldIds.DLN,"DLN [{0}] must
be at least 5 characters long and no more than 15 characters long.", new
Object[]{$dln});
end

Then I have another rule that uses the license number from the
InCourtSearchDTO:
rule "InCourt DL Number"
ruleflow-group "InCourtSearchValidationGroup"
when
InCourtSearchDTO( $d : dln not matches "^.{5,15}$")
then
resultHolder.setMessage(UserLogonFieldIds.END_DT,"DLN [{0}] must be
at least 5 characters long and no more than 15 characters long.", new
Object[]{$d});
end

Obviously this is a poor implementation because the license number check
'not matches "^.{5,15}$"' is duplicated.  Is there a way I can reuse this
rule?

Thanks!
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Test for Empty String?

2009-11-04 Thread Jason Davidson
Hello,

Is there an easy way to test if a String value is empty?  I've been doing
this (Drools 4.0.7):
when CitationDTO
(
charge != null   &&
charge.drivingIncidentLegalSpeedRate != null   &&
charge.drivingIncidentLegalSpeedRate != ""
)
then ..

It seems like there has to be a better method.

Thanks,
Jason
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] classLoader issue...

2009-07-13 Thread Jason Davidson
I'm getting this error message too.  I'm running Drools 5.0.1 as a  
bundle within an OSGi container.  Like the parent post indicates it  
worked with Drools 4.0.7 and it only happens when I put constraints on  
fact fields.


Here's my stack:
Root exception:
java.lang.NoClassDefFoundError: org/drools/base/extractors/ 
BaseObjectClassFieldReader

at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
	at org.drools.base.ClassFieldAccessorCache 
$ByteArrayClassLoader.defineClass(ClassFieldAccessorCache.java:367)
	at  
org 
.drools 
.base 
.ClassFieldAccessorFactory 
.getClassFieldReader(ClassFieldAccessorFactory.java:135)
	at org.drools.base.ClassFieldAccessorCache 
$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java:315)
	at  
org 
.drools 
.base 
.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java: 
245)
	at  
org 
.drools.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java: 
379)
	at  
org 
.drools 
.base.ClassFieldAccessorStore.merge(ClassFieldAccessorStore.java:270)
	at  
org.drools.common.AbstractRuleBase.addPackages(AbstractRuleBase.java: 
466)

at org.drools.reteoo.ReteooRuleBase.addPackage(ReteooRuleBase.java:388)
at com.cjs.core.rules.RulesEngine.startEngine(RulesEngine.java:102)
at com.cjs.core.rules.RulesEngine.(RulesEngine.java:44)
at com.cjs.core.rules.RulesEngine.getInstance(RulesEngine.java:58)
	at  
com 
.cjs 
.core 
.rules 
.RulesEngineServiceFactory.getEngine(RulesEngineServiceFactory.java:22)

at com.cjs.hazel.rules.test.Activator.start(Activator.java:21)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl 
$1.run(BundleContextImpl.java:782)

at java.security.AccessController.doPrivileged(Native Method)
	at  
org 
.eclipse 
.osgi 
.framework 
.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java: 
773)
	at  
org 
.eclipse 
.osgi 
.framework 
.internal.core.BundleContextImpl.start(BundleContextImpl.java:754)
	at  
org 
.eclipse 
.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java: 
352)
	at  
org 
.eclipse 
.osgi 
.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370)
	at  
org 
.eclipse 
.osgi.framework.internal.core.Framework.resumeBundle(Framework.java: 
1068)
	at  
org 
.eclipse 
.osgi 
.framework 
.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java: 
557)
	at  
org 
.eclipse 
.osgi 
.framework 
.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:464)
	at  
org 
.eclipse 
.osgi 
.framework 
.internal 
.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:248)
	at  
org 
.eclipse 
.osgi 
.framework 
.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java: 
445)
	at  
org 
.eclipse 
.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java: 
220)
	at org.eclipse.osgi.framework.eventmgr.EventManager 
$EventThread.run(EventManager.java:330)



Thanks for your answer !

My configuration seems correct to me, I have all new jars in the
classpath (the ones indicated in the file README-DEPENDENCIES.txt at  
the

SVN trunk). I checked them all looking after another
BaseObjectClassFieldReader class, but only drools-core contains it.

By the way, rules are well compiled and executed, this issue only
happens when I put constraints on fields. So I think if drools-core  
was

not in the classpath, nothing would work at all...

Le mercredi 01 juillet 2009 à 08:46 -0400, Edson Tirelli a écrit :
>
>It seems to me that the problem is not with the classloader of  
your

> classes, but the classpath of the drools jars. Are you sure you
> updated and have all the required new jars in your classpath?  
Drools 5
> has a few new jars, like drools-api, that need to be available.  
Also,
> check if there are any older jar still in the classpath that might  
be

> clashing with the new jars.
>
>[]s
>Edson
>
> 2009/7/1 Julien Nicoulaud 
> Hi, I'm migrating my system from Drools 4.0.7 to Drools  
5.1.0.
> Now when I try to compile rules that check fact fields, I  
get

> the
> following exception:
>
>ERROR: EventDispatcher: Error during dispatch.
>(java.lang.NoClassDefFoundError:
>org/drools/base/extractors/ 
BaseObjectClassFieldReader)

>java.lang.NoClassDefFoundError:
>org/drools/base/extractors/BaseObjectClassFieldReader
>
>( http://paste2.org/p/296380 )
>
>
> It seems the classloaders I pass to the configurations are  
not

> taken in
> account... I get exactly the same error if I do not specify
> the
> classloaders. Here is the code:
>KnowledgeBuilderConfiguration kBuilderCfg =
>
>   
KnowledgeBuilderFactory 
.newKnowledgeBuilderConfiguration(null,classLoader);

>KnowledgeBuilder knowledgeBuilder =
>
>  Knowle