Re: [rules-users] Simple DSL example

2010-10-21 Thread Wolfgang Laun
It seems that your DSL file is being parsed as a DRL file.

You don't have, by any chance, a newline after "likes" and before "{cheese}"?

-W

#some description
[when]There is a person with the name of {name} who likes
{cheese}=Person(name=="{name}", likes=="{cheese}")

On 21 October 2010 07:51, morge  wrote:
>
> Thanks.
>
> I am using the latest up-to-date Drools 5.1.
> I have  changed  DSL to DSLR.
>
> Whatever I include or not the expander in the DRL file, I have
> the following error message:
>
> [2,0]: [ERR 101] Line 2:0 no viable alternative at input '['
> [8,0]: [ERR 103] Line 8:0 rule 'rule_key' failed predicate:
> {(validateIdentifierKey(DroolsSoftKeywords.RULE))}? in rule
> 15,2]: [ERR 101] Line 15:2 no viable alternative at input 'There' in rule
> "my rule"
>
> This example is included in drools-compiler in (integrationtests), but it
> seems that I miss something.
>
> Your help will be appreciated on this.
>
> Best,
>
> MM.
>
> --
> View this message in context: 
> http://drools-java-rules-engine.46999.n3.nabble.com/Simple-DSL-example-tp1741029p1743732.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] Drools examples don't run

2010-10-21 Thread Michael Anstis
Are there any errors in addition to the NPE?

The context of the stack-trace suggests the process definition being loaded
is not on your classpath.

2010/10/21 赵侃侃 

> Thanks Bruno,
>
> I have now fixed the NoClassDefFoundError, any ideas about the NullPointer
> one?
>
> Best Regards,
> Kevin Zhao
>
> 2010/10/20 Bruno Freudensprung 
>
>>
>> Hello,
>>
>> I think you have to add the xstream jar to your classpath.
>> Here is the Maven dependency :
>>
>> 
>>   com.thoughtworks.xstream
>>   xstream
>>   1.3.1
>> 
>>
>> Best regards,
>>
>> Bruno.
>>
>>
>> 赵侃侃 a écrit :
>>
>> Hello,
>>
>>  I checked out the latest source from svn repository. It compiled OK and
>> imported the example projects to my eclipse workspace but the examples run
>> with error.
>> The two example projects are namely drools-examples-drl
>> & drools-examples-fusion.
>>
>>  org.drools.examples.pacman.Main gives the errors:
>>
>>  Exception in thread "main" java.lang.NoClassDefFoundError:
>> com/thoughtworks/xstream/XStream
>>  at
>> org.drools.audit.KnowledgeRuntimeLoggerProviderImpl.newThreadedFileLogger(KnowledgeRuntimeLoggerProviderImpl.java:34)
>>  at
>> org.drools.logger.KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(KnowledgeRuntimeLoggerFactory.java:69)
>>  at org.drools.examples.pacman.Main.initKsession(Main.java:88)
>>  at org.drools.examples.pacman.Main.main(Main.java:39)
>> Caused by: java.lang.ClassNotFoundException:
>> com.thoughtworks.xstream.XStream
>>  at java.net.URLClassLoader$1.run(Unknown Source)
>>  at java.security.AccessController.doPrivileged(Native Method)
>>  at java.net.URLClassLoader.findClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  ... 4 more
>>
>>
>>  org.drools.examples.broker.Main gives the errors:
>>
>>  java.lang.NullPointerException
>>  at
>> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>>  at
>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
>>  at
>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
>>  at org.drools.examples.broker.Broker.loadRuleBase(Broker.java:95)
>>  at org.drools.examples.broker.Broker.createSession(Broker.java:80)
>>  at org.drools.examples.broker.Broker.(Broker.java:57)
>>  at org.drools.examples.broker.Main.main(Main.java:53)
>>
>>  Does anyone experience the similar issues and know how to fix that?
>>
>>  Best Regards,
>> Kevin
>>
>> --
>>
>> ___
>> rules-users mailing 
>> listrules-us...@lists.jboss.orghttps://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] Use Knowledge Agent

2010-10-21 Thread Michael Anstis
Hi,

#2

You could try setting the basicAuthentication, Username and Password
properties on UrlResource before adding it to the builder:-


builder.add(ResourceFactory.newUrlResource(url), ResourceType.PKG);



UrlResource urlResource = ResourceFactory.newUrlResource(url);
urlResource.setBasicAuthentication("enabled");
urlResource.setUsername("Smurf");
urlResource.setPassword("Smurfy");
builder.add(urlResource, ResourceType.PKG);


When you shift to using change-sets you should be able to embed the basic
authentication in the change-set.xml file (as per my previous link) - your
example code isn't using KnowledgeAgent yet; simply a URL resource.


2010/10/21 developer researcher 

> Hello Michael and Subhas, thanks for your answers.
>
> Apparently the problem is due to permission. I am using the next
> configuration:
>
>  authenticate-method="#{defaultAuthenticator.authenticate}"/>
>  enable-role-based-authorization="true"/>
>
> I attached the class that use for my test, in this code not included code
> for authenticate. In that sense I have new questions:
>
> 1º What is the minimal configuration of Guvnor for use the Knowledge Agent?
>
> 2º What code should be included for authentication?
>
> Thanks and regards,
>
> 2010/10/20 Subhas 
>
> Give some more details like code and jars in build path. I use
>> KnowledgeBase and working fine for me.
>>
>> Thanks,
>> Subhas
>>
>>
>> On Wed, Oct 20, 2010 at 12:54 PM, java.developer.researcher <
>> java.developer.researc...@gmail.com> wrote:
>>
>>>
>>> Hello,
>>>
>>> I am trying of integrate Drools Guvnor with an java web application. I am
>>> using KnowledgeAgent, but occurs the next exception when execute the
>>> code:
>>>
>>> java.lang.RuntimeException: java.io.IOException: Server returned HTTP
>>> response code: 401 for URL:
>>>
>>> http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples
>>>at
>>>
>>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:559)
>>>at
>>>
>>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>>>at
>>>
>>> org.examples.test.TestKnowledgeAgent.getKnowledgeBase(TestKnowledgeAgent.java:63)
>>>at
>>> org.examples.test.TestKnowledgeAgent.main(TestKnowledgeAgent.java:28)
>>> Caused by: java.io.IOException: Server returned HTTP response code: 401
>>> for
>>> URL:
>>>
>>> http://localhost:8383/drools-guvnor/org.drools.guvnor.Guvnor/package/org.examples/org.examples
>>>at
>>> sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
>>> Source)
>>>at
>>> org.drools.io.impl.UrlResource.getInputStream(UrlResource.java:76)
>>>at
>>>
>>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:512)
>>>... 3 more
>>> Exception in thread "main" java.lang.NullPointerException
>>>at
>>> org.examples.test.TestKnowledgeAgent.main(TestKnowledgeAgent.java:37)
>>>
>>> What is the cause of this exception? How can I solved it?
>>>
>>> Any help is welcome.
>>>
>>> Regards,
>>> --
>>> View this message in context:
>>> http://drools-java-rules-engine.46999.n3.nabble.com/Use-Knowledge-Agent-tp1741354p1741354.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
>>
>>
>
> ___
> 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] Simple DSL example

2010-10-21 Thread morge

Thank you very much.

 
>It seems that your DSL file is being parsed as a DRL file.
Totally true.

The following piece of code works now perfectly:

kbuilder.add(ResourceFactory.newClassPathResource("test_expander.dsl"),ResourceType.DSL);
kbuilder.add(ResourceFactory.newClassPathResource("Sample.drl"),
ResourceType.DSLR);


-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Simple-DSL-example-tp1741029p1744130.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


Re: [rules-users] Drools examples don't run

2010-10-21 Thread 赵侃侃
No, the NPE is all I've got in the console output.

Can you detail what process definition that you are referring to? I saw all
the rules definition files are all copied over to the classpath after
conducting the compile.

Namely, those files are borker.drl, notify.drl, position.drl, position.rf
and stocktickstream.dat. All of them now exist under
project-root/target/classes

Best Regards,
Kevin Zhao


2010/10/21 Michael Anstis 

> Are there any errors in addition to the NPE?
>
> The context of the stack-trace suggests the process definition being loaded
> is not on your classpath.
>
> 2010/10/21 赵侃侃 
>
> Thanks Bruno,
>>
>> I have now fixed the NoClassDefFoundError, any ideas about the NullPointer
>> one?
>>
>> Best Regards,
>> Kevin Zhao
>>
>> 2010/10/20 Bruno Freudensprung 
>>
>>>
>>> Hello,
>>>
>>> I think you have to add the xstream jar to your classpath.
>>> Here is the Maven dependency :
>>>
>>> 
>>>   com.thoughtworks.xstream
>>>   xstream
>>>   1.3.1
>>> 
>>>
>>> Best regards,
>>>
>>> Bruno.
>>>
>>>
>>> 赵侃侃 a écrit :
>>>
>>> Hello,
>>>
>>>  I checked out the latest source from svn repository. It compiled OK and
>>> imported the example projects to my eclipse workspace but the examples run
>>> with error.
>>> The two example projects are namely drools-examples-drl
>>> & drools-examples-fusion.
>>>
>>>  org.drools.examples.pacman.Main gives the errors:
>>>
>>>  Exception in thread "main" java.lang.NoClassDefFoundError:
>>> com/thoughtworks/xstream/XStream
>>>  at
>>> org.drools.audit.KnowledgeRuntimeLoggerProviderImpl.newThreadedFileLogger(KnowledgeRuntimeLoggerProviderImpl.java:34)
>>>  at
>>> org.drools.logger.KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(KnowledgeRuntimeLoggerFactory.java:69)
>>>  at org.drools.examples.pacman.Main.initKsession(Main.java:88)
>>>  at org.drools.examples.pacman.Main.main(Main.java:39)
>>> Caused by: java.lang.ClassNotFoundException:
>>> com.thoughtworks.xstream.XStream
>>>  at java.net.URLClassLoader$1.run(Unknown Source)
>>>  at java.security.AccessController.doPrivileged(Native Method)
>>>  at java.net.URLClassLoader.findClass(Unknown Source)
>>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>>  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>>  ... 4 more
>>>
>>>
>>>  org.drools.examples.broker.Main gives the errors:
>>>
>>>  java.lang.NullPointerException
>>>  at
>>> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>>>  at
>>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
>>>  at
>>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
>>>  at org.drools.examples.broker.Broker.loadRuleBase(Broker.java:95)
>>>  at org.drools.examples.broker.Broker.createSession(Broker.java:80)
>>>  at org.drools.examples.broker.Broker.(Broker.java:57)
>>>  at org.drools.examples.broker.Main.main(Main.java:53)
>>>
>>>  Does anyone experience the similar issues and know how to fix that?
>>>
>>>  Best Regards,
>>> Kevin
>>>
>>> --
>>>
>>> ___
>>> rules-users mailing 
>>> listrules-us...@lists.jboss.orghttps://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
>
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools examples don't run

2010-10-21 Thread Michael Anstis
Your stack trace shows:-

at
org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)

So a process is being built from associated XML!

If I get time I'll have a look at the example (when I'm at home later). I
don't recall anything being copied anywhere as they're normally picked up
directly from the classpath.

2010/10/21 赵侃侃 

> No, the NPE is all I've got in the console output.
>
> Can you detail what process definition that you are referring to? I saw all
> the rules definition files are all copied over to the classpath after
> conducting the compile.
>
> Namely, those files are borker.drl, notify.drl, position.drl, position.rf
> and stocktickstream.dat. All of them now exist under
> project-root/target/classes
>
> Best Regards,
> Kevin Zhao
>
>
> 2010/10/21 Michael Anstis 
>
>> Are there any errors in addition to the NPE?
>>
>> The context of the stack-trace suggests the process definition being
>> loaded is not on your classpath.
>>
>> 2010/10/21 赵侃侃 
>>
>> Thanks Bruno,
>>>
>>> I have now fixed the NoClassDefFoundError, any ideas about the
>>> NullPointer one?
>>>
>>> Best Regards,
>>> Kevin Zhao
>>>
>>> 2010/10/20 Bruno Freudensprung 
>>>

 Hello,

 I think you have to add the xstream jar to your classpath.
 Here is the Maven dependency :

 
   com.thoughtworks.xstream
   xstream
   1.3.1
 

 Best regards,

 Bruno.


 赵侃侃 a écrit :

 Hello,

  I checked out the latest source from svn repository. It compiled OK
 and imported the example projects to my eclipse workspace but the examples
 run with error.
 The two example projects are namely drools-examples-drl
 & drools-examples-fusion.

  org.drools.examples.pacman.Main gives the errors:

  Exception in thread "main" java.lang.NoClassDefFoundError:
 com/thoughtworks/xstream/XStream
  at
 org.drools.audit.KnowledgeRuntimeLoggerProviderImpl.newThreadedFileLogger(KnowledgeRuntimeLoggerProviderImpl.java:34)
  at
 org.drools.logger.KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(KnowledgeRuntimeLoggerFactory.java:69)
  at org.drools.examples.pacman.Main.initKsession(Main.java:88)
  at org.drools.examples.pacman.Main.main(Main.java:39)
 Caused by: java.lang.ClassNotFoundException:
 com.thoughtworks.xstream.XStream
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  ... 4 more


  org.drools.examples.broker.Main gives the errors:

  java.lang.NullPointerException
  at
 org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
  at
 org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
  at
 org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
  at org.drools.examples.broker.Broker.loadRuleBase(Broker.java:95)
  at org.drools.examples.broker.Broker.createSession(Broker.java:80)
  at org.drools.examples.broker.Broker.(Broker.java:57)
  at org.drools.examples.broker.Main.main(Main.java:53)

  Does anyone experience the similar issues and know how to fix that?

  Best Regards,
 Kevin

 --

 ___
 rules-users mailing 
 listrules-us...@lists.jboss.orghttps://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
>>
>>
>
> ___
> 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] Alternative for using a regular expression

2010-10-21 Thread Swindells, Thomas
Or option 4 is you could write a custom operator (substring) to do it for you.

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Michael Anstis
Sent: 21 October 2010 08:43
To: Rules Users List
Subject: Re: [rules-users] Alternative for using a regular expression

Hi Dean,

Is the encoded value used elsewhere within your organisation from the same 
object model?

It'd make a compelling reason to suggest your model is enriched to expose the 
decoded flags if they are (e.g. reporting).

However all is not lost:-

(1) You can use "matches" regular expressions (as you identified):-

rule "one"
when
$c : Claim( claimStatus matches ^.{4}1324.{0,} )
then
//Something
end

(2) You can use "eval":-

rule "two"
when
Claim( $cs : claimStatus )
eval($cs.substring(3, 7).equals("1234"))
then
//Something
end

(3) You can use "from" and a global helper class:-

global MyDecoder myDecoder

rule "three"
when
Claim( $cs : claimStatus )
String( toString == "1234" ) from myDecoder.decodeClaimStatus($cs)
then
//Something
end

See attached example project for the last option.

You could then use DSL to "hide" the technical implementations for your users.

With kind regards,

Mike

2010/10/20 Dean Whisnant mailto:d...@basys.com>>
Hello,

In designing our rules system to allow users and analysts to create and edit 
rules (through Guvnor) we have a requirement that some of the fields be able to 
be evaluated for specific characters in specific positions of the string.  See 
the following examples:

Example 1: The string named "claimStatus" contains various flags all pushed 
together in a string.  It might look like "ABS1324BB7".  Together this field 
means about nothing, but position 4-7 (1324) is an important code that they 
want to evaluate. A business rule for this would be if position 4-7 in 
claimStatus = "1324" then we categorize that claims for some reason.

In loose java syntax I would likely use 'if claimStatus.substring(3,4) = "1324" 
then do something.

I could have the user program a formula using the substring method, but that 
would be quite inefficient and a lot of information for them to figure out.

I could have the user say claimStatus matches ^.{4}1324.{0,} but this regular 
expression is quite cryptic.

While at Rulesfest I ran the topic by a couple folks there and they thought 
that posing it to the community might be a good idea.  Is there another way you 
could see doing this?  Is there a DSL format that might get us to where we want?

Ideas that have been thought of included creating a variable that is already 
just the 4 characters we are after, but there are dozens of fields that could 
hold this info and that would increase our data model which is already quite 
verbose.  We also looked at allowing them to create a variable when they need 
it and then just reuse that in rules, but I'm not certain how we would do this 
with as many fields.

To add to it, the regular expression I listed is for one of the fields in these 
streams, we also have needs to pull out other positions as well.

Your thoughts and ideas on this are appreciated.

Thank you!

Dean Whisnant
basys, inc.

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




**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Alternative for using a regular expression

2010-10-21 Thread Wolfgang Laun
Another alternative (in addition to what Michael wrote) would be the
implementation of a new parameterized operator. Assuming that you
need (String) equals and not equals for a limited number of substrings,
known beforehand, this isn't too difficult to implement (and I can provide
an example).

This means that you could write, e.g., for the "code" in (4:7)

  Claim( status eq[code] 1324,... )

or, for another substring

  Claim( status not eq[priority] "A",... )

You could also define indivdual operators (codeEq, priorityEq,...) but this
seems excessive.

Maintenance is not as bad as it might appear; the class implementing
the operator can access properties defining the parameter names,
offsets and lengths; so it is easy to adjust for future development.

As Michael wrote, all of this can be layered by a Domain Specific
Language, but that's not the key issue here.

-W



2010/10/20 Dean Whisnant :
> Hello,
>
>
>
> In designing our rules system to allow users and analysts to create and edit
> rules (through Guvnor) we have a requirement that some of the fields be able
> to be evaluated for specific characters in specific positions of the
> string.  See the following examples:
>
>
>
> Example 1: The string named “claimStatus” contains various flags all pushed
> together in a string.  It might look like “ABS1324BB7”.  Together this field
> means about nothing, but position 4-7 (1324) is an important code that they
> want to evaluate. A business rule for this would be if position 4-7 in
> claimStatus = “1324” then we categorize that claims for some reason.
>
>
>
> In loose java syntax I would likely use ‘if claimStatus.substring(3,4) =
> “1324” then do something.
>
>
>
> I could have the user program a formula using the substring method, but that
> would be quite inefficient and a lot of information for them to figure out.
>
>
>
> I could have the user say claimStatus matches ^.{4}1324.{0,} but this
> regular expression is quite cryptic.
>
>
>
> While at Rulesfest I ran the topic by a couple folks there and they thought
> that posing it to the community might be a good idea.  Is there another way
> you could see doing this?  Is there a DSL format that might get us to where
> we want?
>
>
>
> Ideas that have been thought of included creating a variable that is already
> just the 4 characters we are after, but there are dozens of fields that
> could hold this info and that would increase our data model which is already
> quite verbose.  We also looked at allowing them to create a variable when
> they need it and then just reuse that in rules, but I’m not certain how we
> would do this with as many fields.
>
>
>
> To add to it, the regular expression I listed is for one of the fields in
> these streams, we also have needs to pull out other positions as well.
>
>
>
> Your thoughts and ideas on this are appreciated.
>
>
>
> Thank you!
>
>
>
> Dean Whisnant
>
> basys, inc.
>
> ___
> 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] Nested classes in the fact model in Guvnor

2010-10-21 Thread Chris Selwyn
Thanks Toni,

Hopefully a fix will be forthcoming :-)

Chris

On 21/10/2010 07:56, Toni Rikkola wrote:
> Hi,
>
> This is a bug. I reported it: https://jira.jboss.org/browse/GUVNOR-679
>
> Toni Rikkola
>
> On Oct 20, 2010, at 4:40 PM, Chris Selwyn wrote:
>
>> If I have nested classes in my Java model, I find that the Guvnor is
>> giving me the option to import classes using a "$" as the separator
>> between the containing class name and the nested classname.
>>
>> However, validation of rules always fails saying that the class name
>> with the "$" in it cannot be resolved.
>> If I change these into "." then the problem goes away.
>>
>> Is this a known problem or am I missing something?
>>
>> I am using Drools 5.1.1
>>
>> Chris Selwyn
>> ___
>> 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
>
>
> -
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1136 / Virus Database: 422/3209 - Release Date: 10/20/10
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Drools examples don't run

2010-10-21 Thread 赵侃侃
Thanks Michael, I couldn't find any XML files under the example project. It
will be a great help if you can take a look at yours when you have time.

Best Regards,
Kevin Zhao

2010/10/21 Michael Anstis 

> Your stack trace shows:-
>
> at
> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>
> So a process is being built from associated XML!
>
> If I get time I'll have a look at the example (when I'm at home later). I
> don't recall anything being copied anywhere as they're normally picked up
> directly from the classpath.
>
> 2010/10/21 赵侃侃 
>
>> No, the NPE is all I've got in the console output.
>>
>> Can you detail what process definition that you are referring to? I saw
>> all the rules definition files are all copied over to the classpath after
>> conducting the compile.
>>
>> Namely, those files are borker.drl, notify.drl, position.drl, position.rf
>> and stocktickstream.dat. All of them now exist under
>> project-root/target/classes
>>
>> Best Regards,
>> Kevin Zhao
>>
>>
>> 2010/10/21 Michael Anstis 
>>
>>> Are there any errors in addition to the NPE?
>>>
>>> The context of the stack-trace suggests the process definition being
>>> loaded is not on your classpath.
>>>
>>> 2010/10/21 赵侃侃 
>>>
>>> Thanks Bruno,

 I have now fixed the NoClassDefFoundError, any ideas about the
 NullPointer one?

 Best Regards,
 Kevin Zhao

 2010/10/20 Bruno Freudensprung 

>
> Hello,
>
> I think you have to add the xstream jar to your classpath.
> Here is the Maven dependency :
>
> 
>   com.thoughtworks.xstream
>   xstream
>   1.3.1
> 
>
> Best regards,
>
> Bruno.
>
>
> 赵侃侃 a écrit :
>
> Hello,
>
>  I checked out the latest source from svn repository. It compiled OK
> and imported the example projects to my eclipse workspace but the examples
> run with error.
> The two example projects are namely drools-examples-drl
> & drools-examples-fusion.
>
>  org.drools.examples.pacman.Main gives the errors:
>
>  Exception in thread "main" java.lang.NoClassDefFoundError:
> com/thoughtworks/xstream/XStream
>  at
> org.drools.audit.KnowledgeRuntimeLoggerProviderImpl.newThreadedFileLogger(KnowledgeRuntimeLoggerProviderImpl.java:34)
>  at
> org.drools.logger.KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(KnowledgeRuntimeLoggerFactory.java:69)
>  at org.drools.examples.pacman.Main.initKsession(Main.java:88)
>  at org.drools.examples.pacman.Main.main(Main.java:39)
> Caused by: java.lang.ClassNotFoundException:
> com.thoughtworks.xstream.XStream
>  at java.net.URLClassLoader$1.run(Unknown Source)
>  at java.security.AccessController.doPrivileged(Native Method)
>  at java.net.URLClassLoader.findClass(Unknown Source)
>  at java.lang.ClassLoader.loadClass(Unknown Source)
>  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>  at java.lang.ClassLoader.loadClass(Unknown Source)
>  ... 4 more
>
>
>  org.drools.examples.broker.Main gives the errors:
>
>  java.lang.NullPointerException
>  at
> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>  at
> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
>  at
> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
>  at org.drools.examples.broker.Broker.loadRuleBase(Broker.java:95)
>  at org.drools.examples.broker.Broker.createSession(Broker.java:80)
>  at org.drools.examples.broker.Broker.(Broker.java:57)
>  at org.drools.examples.broker.Main.main(Main.java:53)
>
>  Does anyone experience the similar issues and know how to fix that?
>
>  Best Regards,
> Kevin
>
> --
>
> ___
> rules-users mailing 
> listrules-us...@lists.jboss.orghttps://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
>>>
>>>
>>
>> ___
>> 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/list

[rules-users] xdrl, matches and nested method calls

2010-10-21 Thread Veit Guna
Hi.

We're using Drools 5.1.0 with .xdrl files. Now we encountered a strange
problem with the 'matches' behavior.

We have the following pattern that seems to have the problem:


  

  


Subject is a String with the content "my CRYPT subject".

The rule isn't fired as expected. If we ONLY change

field-name="subject"

to

field-name="subject.trim"

the rule fires.

Any pointers what that is?

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


[rules-users] How to synchronize the Guvnor repository and the displaying of Guvnor UI?

2010-10-21 Thread tim

Hi,
I have set up two instances of Guvnor in two separate Linux lab (lab1 and
lab2).
Each instance uses a separate MySQL database as its repository. 
Two MySQL instances are deployed on lab1 and lab2 respectively, and are
configured as a replication mate, master-master mode.
When I create a new category from lab1's Guvnor UI, the change of the
repository can be synchronized to lab2's MySQL database. But the new
category can't be displayed in the lab2's Guvnor UI unless I restart the
tomcat on lab2.
Can you tell me how can I see the changes synchronously from the lab2's
Guvnor UI? Any suggestion will be appreciated.
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/How-to-synchronize-the-Guvnor-repository-and-the-displaying-of-Guvnor-UI-tp1744411p1744411.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


Re: [rules-users] xdrl, matches and nested method calls

2010-10-21 Thread Wolfgang Laun
Unlikely... but do check the getSubject() method - does it return the
correct value?
-W

On 21 October 2010 10:52, Veit Guna  wrote:
> Hi.
>
> We're using Drools 5.1.0 with .xdrl files. Now we encountered a strange
> problem with the 'matches' behavior.
>
> We have the following pattern that seems to have the problem:
>
> 
>  
>    
>  
> 
>
> Subject is a String with the content "my CRYPT subject".
>
> The rule isn't fired as expected. If we ONLY change
>
> field-name="subject"
>
> to
>
> field-name="subject.trim"
>
> the rule fires.
>
> Any pointers what that is?
>
> Thanks
> Veit
> ___
> 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] Is drools ksession thread-safe?

2010-10-21 Thread jschmied

>What should be the ProcessInstance prc variable in your code?
>Also, did you have to create synchronized insert (and modify, update)
method in your wrapper class? 

This is beacuse the whole API has to be synchronized within one Object. This
means for me the KSession, the Process and WokItemManager. My object has a
filed what holds the KSession and has delegates for all the functions I use.
To synchronize the process and workitemmanager I do within the _same_ class:

public synchronized int getPrcState(ProcessInstance prc) {
return prc.getState();
}

so everthing is synchronized with the same class.

The class is:


public class DroolsWrapper {

private KnowledgeBase kbase;


public DroolsWrapper() throws FctyException {
kbase = .
}

public StatefulKnowledgeSessionWrapper newStatefulKnowledgeSession() {
return new StatefulKnowledgeSessionWrapper();
}

public class StatefulKnowledgeSessionWrapper {

private StatefulKnowledgeSession kSession;

public StatefulKnowledgeSessionWrapper(KnowledgeBase kbase, 
String bcn,
FctyFrame fctyFrame) {
kSession = kbase.newStatefulKnowledgeSession();
}

public synchronized void dispose() {
kSession.dispose();
}

public synchronized WorkItemManager getWorkItemManager() {
return kSession.getWorkItemManager();
}

public synchronized void setGlobal(String string, Object obj) {
kSession.setGlobal(string, obj);
}

public synchronized ProcessInstance startProcess(String string) 
{
return kSession.startProcess(string);
}

public synchronized FactHandle insert(Object obj) {
logger.debug(obj.toString());
return kSession.insert(obj);
}

public synchronized int fireAllRules() {
return kSession.fireAllRules();
}

public synchronized QueryResults getQueryResults(String string) 
{
return kSession.getQueryResults(string);
}

public synchronized Object getGlobal(String string) {
return kSession.getGlobal(string);
}

public synchronized void completeWorkItem(WorkItem workItem, 
Map results) {

kSession.getWorkItemManager().completeWorkItem(workItem.getId(),
results);
}

public synchronized void abortWorkItem(WorkItem workItem) {

kSession.getWorkItemManager().abortWorkItem(workItem.getId());
}

public synchronized int getPrcState(ProcessInstance prc) {
return prc.getState();
}

public synchronized void completeWorkItem(WorkItem workItem, 
Exception e)
{
// complete with a Exception
Map results = new HashMap();
results.put("Exception", e);

kSession.getWorkItemManager().completeWorkItem(workItem.getId(),
results);
}

}

}


juergen




-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Is-drools-ksession-thread-safe-tp1736738p1744436.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] DSL to multiline DRL?

2010-10-21 Thread Tim 4076
Is it possible to have a single line of DSL convert into multiple lines of DRL?

I want to hide the implementation of my rules from the user. So, using
my previous post as an example:

rule "group 1"
when
  $a : Trans( $groupValue : prodCat, $date : date )
  not Trans( this != $a, prodCat == $groupValue, date < $date )
  $b : LinkedList( size >= 1 ) from collect ( Trans( this != $a,
prodCat == $groupValue, date > $date ) )
then
  //do something
end

should become something like:

rule "group 1"
when
  There are mutliple transactions with the same value for prodCat
then
  //do something
end



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


Re: [rules-users] xdrl, matches and nested method calls

2010-10-21 Thread Veit Guna
Indeed. It returns "my CRYPT subject". Added a system out to its get method.

The funny thing is, tried it with

value=".*CRYPT.*"

and

field-name="subject"

and it matches.

I don't get it.



Am 21.10.2010 11:02, schrieb Wolfgang Laun:
> Unlikely... but do check the getSubject() method - does it return the
> correct value?
> -W
> 
> On 21 October 2010 10:52, Veit Guna  wrote:
>> Hi.
>>
>> We're using Drools 5.1.0 with .xdrl files. Now we encountered a strange
>> problem with the 'matches' behavior.
>>
>> We have the following pattern that seems to have the problem:
>>
>> 
>>  
>>
>>  
>> 
>>
>> Subject is a String with the content "my CRYPT subject".
>>
>> The rule isn't fired as expected. If we ONLY change
>>
>> field-name="subject"
>>
>> to
>>
>> field-name="subject.trim"
>>
>> the rule fires.
>>
>> Any pointers what that is?
>>
>> Thanks
>> Veit
>> ___
>> 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] access guvnor information from extern

2010-10-21 Thread Dominik Hüttner
Hi everyone, I work with the guvnor and want to use documentation
information externally. For example the description of a rule or the
description of a package, what is also posted in the documentation.pdf, that
is accessible through the url (f.e.:
http://192.168.1.192:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Tes
t/LATEST/documention.pdf), on the buttom of the package overview page is the
link. But I want to work with the data, so the pdf is not usable, is there a
way to access these information in the guvnor directly from outside for
example from a reporting-tool? 

 

Kind regards,

 

Dominik

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


Re: [rules-users] xdrl, matches and nested method calls

2010-10-21 Thread Wolfgang Laun
It seems that string escape processing by the Drools compiler and builder
either handles the control character escapes such as \t or \n, *or* the
pattern escapes \Q, \E, etc.

By default, control character escapes are handled correctly, but any '\'
not in front of rftnb'"\ is simply dropped.

To get the regex backslash escapes, you'll have to write them Java-style,
e.g. \\Q, \\E.

If you don't intend to use the aforementioned control escapes. you can do
KnowledgeBuilderConfiguration kbConfig =
KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
kbConfig.setOption(  ProcessStringEscapesOption.NO; );
KnowledgeBuilder kBuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder( kbConfig );
and then you can write the regexp's with a single '\', i.e.,
".*\QCRYPT\W.*". (This is documented
as reverting to Drools 4 behaviour.)

This contradicts the documentation, so I think it is a bug; but I
don't really know what
the intended behaviour with and without that builder option is.
Anyway, it contradicts
what is said in Expert, next to the "matches" operator. The javadoc of
ProcessStringEscapesOption
isn't mentioning regexp escapes.

@Edson: I think  it can be fixed easily in
org.drools.core.util.StringUtils; just emit the '\' if it isn't
followed by one of  rftnb'"\ .in line 915.

-W


On 21 October 2010 11:10, Veit Guna  wrote:
> Indeed. It returns "my CRYPT subject". Added a system out to its get method.
>
> The funny thing is, tried it with
>
> value=".*CRYPT.*"
>
> and
>
> field-name="subject"
>
> and it matches.
>
> I don't get it.
>
>
>
> Am 21.10.2010 11:02, schrieb Wolfgang Laun:
>> Unlikely... but do check the getSubject() method - does it return the
>> correct value?
>> -W
>>
>> On 21 October 2010 10:52, Veit Guna  wrote:
>>> Hi.
>>>
>>> We're using Drools 5.1.0 with .xdrl files. Now we encountered a strange
>>> problem with the 'matches' behavior.
>>>
>>> We have the following pattern that seems to have the problem:
>>>
>>> 
>>>  
>>>    
>>>  
>>> 
>>>
>>> Subject is a String with the content "my CRYPT subject".
>>>
>>> The rule isn't fired as expected. If we ONLY change
>>>
>>> field-name="subject"
>>>
>>> to
>>>
>>> field-name="subject.trim"
>>>
>>> the rule fires.
>>>
>>> Any pointers what that is?
>>>
>>> Thanks
>>> Veit
>>> ___
>>> 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] DSL to multiline DRL?

2010-10-21 Thread Wolfgang Laun
Newlines are ignored by the DRL parser.

You can pack any number of Conditional Expressions into the expansion
of a DSL phrase. Just make sure you put it all on a single line in
your DSL file:

# line 1
[when] There are mutliple transactions with the same value for
prodCat=$a : Trans( $groupValue : prodCat, $date : date )  not Trans(
this != $a, prodCat == $groupValue, date < $date )  $b : LinkedList(
size >= 1 ) from collect ( Trans( this != $a,  prodCat == $groupValue,
date > $date ) )
# line 3


On 21 October 2010 11:06, Tim 4076  wrote:
> Is it possible to have a single line of DSL convert into multiple lines of 
> DRL?
>
> I want to hide the implementation of my rules from the user. So, using
> my previous post as an example:
>
> rule "group 1"
> when
>  $a : Trans( $groupValue : prodCat, $date : date )
>  not Trans( this != $a, prodCat == $groupValue, date < $date )
>  $b : LinkedList( size >= 1 ) from collect ( Trans( this != $a,
> prodCat == $groupValue, date > $date ) )
> then
>  //do something
> end
>
> should become something like:
>
> rule "group 1"
> when
>  There are mutliple transactions with the same value for prodCat
> then
>  //do something
> end
>
>
>
> Thanks,
> Tim
> ___
> 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] xdrl, matches and nested method calls

2010-10-21 Thread Veit Guna
Hi.

Thanks for the detailed explanation!

Confirmed that both ways you mention do the trick. I'll stick with
ProcessStringEscapesOption.NO for now.

Thanks
Veit


Am 21.10.2010 14:07, schrieb Wolfgang Laun:
> It seems that string escape processing by the Drools compiler and builder
> either handles the control character escapes such as \t or \n, *or* the
> pattern escapes \Q, \E, etc.
> 
> By default, control character escapes are handled correctly, but any '\'
> not in front of rftnb'"\ is simply dropped.
> 
> To get the regex backslash escapes, you'll have to write them Java-style,
> e.g. \\Q, \\E.
> 
> If you don't intend to use the aforementioned control escapes. you can do
> KnowledgeBuilderConfiguration kbConfig =
> KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration();
> kbConfig.setOption(  ProcessStringEscapesOption.NO; );
> KnowledgeBuilder kBuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder( kbConfig );
> and then you can write the regexp's with a single '\', i.e.,
> ".*\QCRYPT\W.*". (This is documented
> as reverting to Drools 4 behaviour.)
> 
> This contradicts the documentation, so I think it is a bug; but I
> don't really know what
> the intended behaviour with and without that builder option is.
> Anyway, it contradicts
> what is said in Expert, next to the "matches" operator. The javadoc of
> ProcessStringEscapesOption
> isn't mentioning regexp escapes.
> 
> @Edson: I think  it can be fixed easily in
> org.drools.core.util.StringUtils; just emit the '\' if it isn't
> followed by one of  rftnb'"\ .in line 915.
> 
> -W
> 
> 
> On 21 October 2010 11:10, Veit Guna  wrote:
>> Indeed. It returns "my CRYPT subject". Added a system out to its get method.
>>
>> The funny thing is, tried it with
>>
>> value=".*CRYPT.*"
>>
>> and
>>
>> field-name="subject"
>>
>> and it matches.
>>
>> I don't get it.
>>
>>
>>
>> Am 21.10.2010 11:02, schrieb Wolfgang Laun:
>>> Unlikely... but do check the getSubject() method - does it return the
>>> correct value?
>>> -W
>>>
>>> On 21 October 2010 10:52, Veit Guna  wrote:
 Hi.

 We're using Drools 5.1.0 with .xdrl files. Now we encountered a strange
 problem with the 'matches' behavior.

 We have the following pattern that seems to have the problem:

 
  

  
 

 Subject is a String with the content "my CRYPT subject".

 The rule isn't fired as expected. If we ONLY change

 field-name="subject"

 to

 field-name="subject.trim"

 the rule fires.

 Any pointers what that is?

 Thanks
 Veit
 ___
 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
> 
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder

2010-10-21 Thread Jason van Zyl
Hi,

I have been following the documentation to create a RuleFlowProcess, and I went 
the route of creating the flow programmatically, but I can't find an example of 
adding this process to the knowledge builder. It seems to want an external 
resource of a given type. In my little code scenario below how would I add this 
programmatically created RuleFlowProcess?

DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();
RuleFlowProcess flow = flowGenerator.generateFlow( "flow" ); 
KnowledgeBuilder knowledgeBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add( flow.getResource() /* this is null */, null /* 
what do i put here*/ );

Do I have to serialize to an external form and deserialize?

Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

Three people can keep a secret provided two of them are dead.

 -- Unknown



Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

We know what we are, but know not what we may be.

  -- Shakespeare



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


Re: [rules-users] Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder

2010-10-21 Thread Diego López León
Jason,
once you have your RuleFlowProcess instance you can add it directly
into the KnowledgeBase as follows:

RuleFlowProcess process = new RuleFlowProcess();
// ruleflow definition
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
((AbstractRuleBase) ((InternalKnowledgeBase)
kbase).getRuleBase()).addProcess(process);

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();

Hope it helps.

Best.

2010/10/21 Jason van Zyl :
> Hi,
> I have been following the documentation to create a RuleFlowProcess, and I
> went the route of creating the flow programmatically, but I can't find an
> example of adding this process to the knowledge builder. It seems to want an
> external resource of a given type. In my little code scenario below how
> would I add this programmatically created RuleFlowProcess?
>         DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();
>
>         RuleFlowProcess flow = flowGenerator.generateFlow( "flow" );
>         KnowledgeBuilder knowledgeBuilder =
> KnowledgeBuilderFactory.newKnowledgeBuilder();
>         knowledgeBuilder.add( flow.getResource() /* this is null */, null /*
> what do i put here*/ );
> Do I have to serialize to an external form and deserialize?
> Thanks,
>
> Jason
>
> --
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> -
> Three people can keep a secret provided two of them are dead.
>
>  -- Unknown
>
>
>
> Thanks,
>
> Jason
>
> --
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> -
> We know what we are, but know not what we may be.
>
>   -- Shakespeare
>
>
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>



-- 
diego

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


[rules-users] Drools Sample Project Won't Execute on Spring STS IDE 2.3.2

2010-10-21 Thread Jason Mihalick

Versions involved:

IDE: Spring STS 2.3.2.RELEASE
Eclipse Drools Plugin: 5.1.1 (Includes JBoss Drools Core, JBoss Drools
Guvnor, JBoss Drools Task)
Java: JDK 1.6.0_11
Platform:  Windows XP

1) Create a sample Drools application using the New Project Wizard and
selecting "Drools Project"

2) Name it MyDroolsProject

3) Check all options on the add sample classes (e.g., 'Add a sample
HelloWorld rule file to this project', etc.)

4) Check to 'Use default Drools Runtime (currently Drools 5.1.0 runtime)'. 
Also choose to Generate code compatible with 'Drools 5.1.x'.  Click Finish.

5) In your newly created 'MyDroolsProject', drill down to
com.sample.DecisionTableTest.java, right click and choose to 'Run As | Java
Application'

The following stack trace ensues.  (Note, yes, I do have the STS Groovy
plugin installed)

Warning:  Cell at E21 not present - adding a blank
Build groovy files option has not been set one way or the other: use
'options.put(CompilerOptions.OPTIONG_BuildGroovyFiles,
CompilerOptions.ENABLED);'
java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Plugin
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
  at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
  at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
  at
org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:755)
  at
org.eclipse.jdt.internal.compiler.Compiler.(Compiler.java:312)
  at
org.eclipse.jdt.internal.compiler.Compiler.(Compiler.java:177)
  at
org.drools.commons.jci.compilers.EclipseJavaCompiler.compile(EclipseJavaCompiler.java:349)
  at
org.drools.commons.jci.compilers.AbstractJavaCompiler.compile(AbstractJavaCompiler.java:51)
  at
org.drools.rule.builder.dialect.java.JavaDialect.compileAll(JavaDialect.java:389)
  at
org.drools.compiler.DialectCompiletimeRegistry.compileAll(DialectCompiletimeRegistry.java:56)
  at
org.drools.compiler.PackageRegistry.compileAll(PackageRegistry.java:74)
  at
org.drools.compiler.PackageBuilder.compileAll(PackageBuilder.java:677)
  at
org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:640)
  at
org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:254)
  at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:484)
  at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:34)
  at
com.sample.DecisionTableTest.readKnowledgeBase(DecisionTableTest.java:44)
  at com.sample.DecisionTableTest.main(DecisionTableTest.java:25)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Plugin
  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
  ... 27 more
 


-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Sample-Project-Won-t-Execute-on-Spring-STS-IDE-2-3-2-tp1746156p1746156.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] Error Inserting events into drools fusion stream

2010-10-21 Thread Ayush

Hi All, 

I'm trying to implement drools fusion into my app. The scenario of my app is
as follows: 
- Facts will be received continuosly. 
- On receving fact I'm generating a new event and adding it into a new
working memory entry point stream. Also I'm adding facts into session coz
I'll be updating them. 
- I need to apply rules on continuous stream of events.
- I've not used any camel + spring or pipeline. Are these mandatory to use?

For 1st fact everything works fine but when I receive 2nd fact I'm getting
Now when I'm trying to get entry point on receive of 2nd alarm I'm getting
org.drools.RuntimeDroolsException: Unexpected exception executing action
org.drools.reteoo.propagationqueuingnode$propagateact...@9ff411  Caused by:
java.util.concurrent.RejectedExecutionException. 

On debug I found that the above exception is coming when I'm calling
session.getWorkingMemoryEntryPoint("MyStream"); Can anyone please help me
that how should I insert facts and events into working memory?

 I'd invested ample amount of time searching for this  but I'm empty handed.
Guys please help this is very urgent for me. Thanks in anticipation 
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Error-Inserting-events-into-drools-fusion-stream-tp1746213p1746213.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] Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder

2010-10-21 Thread Jason van Zyl
Hi,

I have been following the documentation to create a RuleFlowProcess, and I went 
the route of creating the flow programmatically, but I can't find an example of 
adding this process to the knowledge builder. It seems to want an external 
resource of a given type. In my little code scenario below how would I add this 
programmatically created RuleFlowProcess?

DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();
RuleFlowProcess flow = flowGenerator.generateFlow( "flow" ); 
KnowledgeBuilder knowledgeBuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();
knowledgeBuilder.add( flow.getResource() /* this is null */, null /* 
what do i put here*/ );

Do I have to serialize to an external form and deserialize?

Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

Three people can keep a secret provided two of them are dead.

 -- Unknown



Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

A language that doesn’t affect the way you think about programming is not worth 
knowing. 
 
 -— Alan Perlis



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


Re: [rules-users] Adding a programmatically created RuleFlowProcess to a KnowledgeBuilder

2010-10-21 Thread Jason van Zyl
Your Hudson instance with the latest documentation is down:

https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-flow/html/ch05.html

On Oct 21, 2010, at 11:17 AM, Jason van Zyl wrote:

> Hi,
> 
> I have been following the documentation to create a RuleFlowProcess, and I 
> went the route of creating the flow programmatically, but I can't find an 
> example of adding this process to the knowledge builder. It seems to want an 
> external resource of a given type. In my little code scenario below how would 
> I add this programmatically created RuleFlowProcess?
> 
> DefaultFlowGenerator flowGenerator = new DefaultFlowGenerator();  
>   
> RuleFlowProcess flow = flowGenerator.generateFlow( "flow" ); 
> KnowledgeBuilder knowledgeBuilder = 
> KnowledgeBuilderFactory.newKnowledgeBuilder();
> knowledgeBuilder.add( flow.getResource() /* this is null */, null /* 
> what do i put here*/ );
> 
> Do I have to serialize to an external form and deserialize?
> 
> Thanks,
> 
> Jason
> 
> --
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> -
> 
> Three people can keep a secret provided two of them are dead.
> 
>  -- Unknown
> 
> 
> 
> Thanks,
> 
> Jason
> 
> --
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> -
> 
> A language that doesn’t affect the way you think about programming is not 
> worth knowing. 
>  
>  -— Alan Perlis
> 
> 
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

We know what we are, but know not what we may be.

  -- Shakespeare





Thanks,

Jason

--
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
-

Simplex sigillum veri. (Simplicity is the seal of truth.)



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


Re: [rules-users] Drools examples don't run

2010-10-21 Thread Michael Anstis
Hi Kevin,

The problem is a dependancy missing on the broker example.

If you add the following to your maven dependancies you'll be OK:-


org.drools
drools-flow-compiler


If you had previously generated the Eclipse project files you'll need to
re-run mvn eclipse:eclipse to add the new dependancy (or add manually).

If you use M2Eclipse I suspect you'll have to re-import (or fix the missing
dependancy manually).

JIRA https://jira.jboss.org/browse/JBRULES-2748 created.

Cheers,

Mike

2010/10/21 赵侃侃 

> Thanks Michael, I couldn't find any XML files under the example project. It
> will be a great help if you can take a look at yours when you have time.
>
> Best Regards,
> Kevin Zhao
>
> 2010/10/21 Michael Anstis 
>
>> Your stack trace shows:-
>>
>> at
>> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>>
>> So a process is being built from associated XML!
>>
>> If I get time I'll have a look at the example (when I'm at home later). I
>> don't recall anything being copied anywhere as they're normally picked up
>> directly from the classpath.
>>
>> 2010/10/21 赵侃侃 
>>
>>> No, the NPE is all I've got in the console output.
>>>
>>> Can you detail what process definition that you are referring to? I saw
>>> all the rules definition files are all copied over to the classpath after
>>> conducting the compile.
>>>
>>> Namely, those files are borker.drl, notify.drl, position.drl, position.rf
>>> and stocktickstream.dat. All of them now exist under
>>> project-root/target/classes
>>>
>>> Best Regards,
>>> Kevin Zhao
>>>
>>>
>>> 2010/10/21 Michael Anstis 
>>>
 Are there any errors in addition to the NPE?

 The context of the stack-trace suggests the process definition being
 loaded is not on your classpath.

 2010/10/21 赵侃侃 

 Thanks Bruno,
>
> I have now fixed the NoClassDefFoundError, any ideas about the
> NullPointer one?
>
> Best Regards,
> Kevin Zhao
>
> 2010/10/20 Bruno Freudensprung 
>
>>
>> Hello,
>>
>> I think you have to add the xstream jar to your classpath.
>> Here is the Maven dependency :
>>
>> 
>>   com.thoughtworks.xstream
>>   xstream
>>   1.3.1
>> 
>>
>> Best regards,
>>
>> Bruno.
>>
>>
>> 赵侃侃 a écrit :
>>
>> Hello,
>>
>>  I checked out the latest source from svn repository. It compiled OK
>> and imported the example projects to my eclipse workspace but the 
>> examples
>> run with error.
>> The two example projects are namely drools-examples-drl
>> & drools-examples-fusion.
>>
>>  org.drools.examples.pacman.Main gives the errors:
>>
>>  Exception in thread "main" java.lang.NoClassDefFoundError:
>> com/thoughtworks/xstream/XStream
>>  at
>> org.drools.audit.KnowledgeRuntimeLoggerProviderImpl.newThreadedFileLogger(KnowledgeRuntimeLoggerProviderImpl.java:34)
>>  at
>> org.drools.logger.KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(KnowledgeRuntimeLoggerFactory.java:69)
>>  at org.drools.examples.pacman.Main.initKsession(Main.java:88)
>>  at org.drools.examples.pacman.Main.main(Main.java:39)
>> Caused by: java.lang.ClassNotFoundException:
>> com.thoughtworks.xstream.XStream
>>  at java.net.URLClassLoader$1.run(Unknown Source)
>>  at java.security.AccessController.doPrivileged(Native Method)
>>  at java.net.URLClassLoader.findClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  ... 4 more
>>
>>
>>  org.drools.examples.broker.Main gives the errors:
>>
>>  java.lang.NullPointerException
>>  at
>> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>>  at
>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
>>  at
>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
>>  at org.drools.examples.broker.Broker.loadRuleBase(Broker.java:95)
>>  at org.drools.examples.broker.Broker.createSession(Broker.java:80)
>>  at org.drools.examples.broker.Broker.(Broker.java:57)
>>  at org.drools.examples.broker.Main.main(Main.java:53)
>>
>>  Does anyone experience the similar issues and know how to fix that?
>>
>>  Best Regards,
>> Kevin
>>
>> --
>>
>> ___
>> rules-users mailing 
>> listrules-us...@lists.jboss.orghttps://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] Post XML requests to Drools Server 5.1

2010-10-21 Thread Jeffrey Miller
I am attempting to setup the latest version of Drools Server. The sample on
the website uses a jsp to forward an xml request to the same server the jsp
is running on (using a camel-client.xml.) I am unclear what the
camel-client.xml is actually responsible for doing.

Is this camel-client.xml configuration necessary if you want to send fully
formed requests in xml to the server?  I have tried to set this up, but, for
example, by doing something like this:

 curl --data " msg"
http://localhost:8080/drools-server/kservice/kservice/rest

but the tomcat log just shows this:

Oct 21, 2010 4:10:55 PM org.apache.cxf.jaxrs.utils.JAXRSUtils
findTargetMethod
WARNING: .No operation matching request path / is found, HTTP Method : POST,
ContentType : application/x-www-form-urlencoded, Accept : */*,.
Oct 21, 2010 4:10:55 PM
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: WebApplicationException has been caught : no cause is available

Does anyone know how to set this up properly?

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


Re: [rules-users] Drools server multiple knowledge sessions

2010-10-21 Thread Lucas Amador
Hi,
it's not possible create knowledge sessions dynamically at this moment. All
the ksessions should be previously defined in the knowledge-services.xml
file.

lucaz

On 19 October 2010 03:00, Ji Oh Yoo  wrote:

>
> Hi,
>
> How can I create knowledge sessions dynamically
> (for example, create and start a session according to a given schedule, of
> which content can be changed)
> using drools execution server?
>
>
> Thanks.
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Drools-server-multiple-knowledge-sessions-tp1730444p1730444.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


[rules-users] Using Declared types in Decision Tables

2010-10-21 Thread Uday Kodukula

Hello,

I have a question on how one can import declared types into a decision
table, that are declared in a separate DRL file. 

Take for instance the following declared type which is defined in an
isolated DRL file:

declare Offer
 id: String
 name: String
 isValid: boolean
end

This type can be used in Java code if we were to use the Knowledge base to
give us a FactType via code like:

FactType offerType = kbase.getFactType("package.to.model.offer", "Offer");

and then use them accordingly. However, i'm not sure if such an approach /
api exists for importing declared types from DRLs into decision tables.

How can something like this be done in Decision tables?

When I import the declared Offer, which isn't complied yet, the decision
table complains.

Thanks,
Uday
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Using-Declared-types-in-Decision-Tables-tp1748974p1748974.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] Drools Flow BAM

2010-10-21 Thread Prafull Kumar
Hi,

Now we have the extensive BAM requirement on the Drools Flow. From the 
documents 
I got a good understanding of the BAM support, but I would like to clarify the 
following points:

1. In the ProcessEventListener can we embed required data from the process, 
global variables?

Example I see the following in the file generated by 
KnowledgeRuntimeLoggerFactory log file:


  33
  Demo
  Demo
  0
  request
  request
  requestID SGH50801DV_20101021214848_0 status 
INTERMEDIATE


Its good, But I would like to log the variables as the workflow executes, so 
that I can generate the meaningful reports. e.g. If the flow takes one path I 
would like to log a variable of a object and for another maybe another part of 
the object.

It will help me to create the kind of report I am looking for. Please advice.

2. Any idea on the performance impact if we log these events in the database. 
Does the process waits till the event is written in database or this happens 
asynchronously as its a event? Please clarify.

Thanks in advance.

Regards, Prafull



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


Re: [rules-users] Drools examples don't run

2010-10-21 Thread 赵侃侃
Hi Michael,

It works now. Thanks very much for the help!

Best Regards,
Kevin Zhao

2010/10/22 Michael Anstis 

> Hi Kevin,
>
> The problem is a dependancy missing on the broker example.
>
> If you add the following to your maven dependancies you'll be OK:-
>
> 
> org.drools
> drools-flow-compiler
> 
>
> If you had previously generated the Eclipse project files you'll need to
> re-run mvn eclipse:eclipse to add the new dependancy (or add manually).
>
> If you use M2Eclipse I suspect you'll have to re-import (or fix the missing
> dependancy manually).
>
> JIRA https://jira.jboss.org/browse/JBRULES-2748 created.
>
> Cheers,
>
> Mike
>
>
> 2010/10/21 赵侃侃 
>
>> Thanks Michael, I couldn't find any XML files under the example project.
>> It will be a great help if you can take a look at yours when you have time.
>>
>> Best Regards,
>> Kevin Zhao
>>
>> 2010/10/21 Michael Anstis 
>>
>>> Your stack trace shows:-
>>>
>>> at
>>> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>>>
>>> So a process is being built from associated XML!
>>>
>>> If I get time I'll have a look at the example (when I'm at home later). I
>>> don't recall anything being copied anywhere as they're normally picked up
>>> directly from the classpath.
>>>
>>> 2010/10/21 赵侃侃 
>>>
 No, the NPE is all I've got in the console output.

 Can you detail what process definition that you are referring to? I saw
 all the rules definition files are all copied over to the classpath after
 conducting the compile.

 Namely, those files are borker.drl, notify.drl, position.drl,
 position.rf and stocktickstream.dat. All of them now exist under
 project-root/target/classes

 Best Regards,
 Kevin Zhao


 2010/10/21 Michael Anstis 

> Are there any errors in addition to the NPE?
>
> The context of the stack-trace suggests the process definition being
> loaded is not on your classpath.
>
> 2010/10/21 赵侃侃 
>
> Thanks Bruno,
>>
>> I have now fixed the NoClassDefFoundError, any ideas about the
>> NullPointer one?
>>
>> Best Regards,
>> Kevin Zhao
>>
>> 2010/10/20 Bruno Freudensprung 
>>
>>>
>>> Hello,
>>>
>>> I think you have to add the xstream jar to your classpath.
>>> Here is the Maven dependency :
>>>
>>> 
>>>   com.thoughtworks.xstream
>>>   xstream
>>>   1.3.1
>>> 
>>>
>>> Best regards,
>>>
>>> Bruno.
>>>
>>>
>>> 赵侃侃 a écrit :
>>>
>>> Hello,
>>>
>>>  I checked out the latest source from svn repository. It compiled OK
>>> and imported the example projects to my eclipse workspace but the 
>>> examples
>>> run with error.
>>> The two example projects are namely drools-examples-drl
>>> & drools-examples-fusion.
>>>
>>>  org.drools.examples.pacman.Main gives the errors:
>>>
>>>  Exception in thread "main" java.lang.NoClassDefFoundError:
>>> com/thoughtworks/xstream/XStream
>>>  at
>>> org.drools.audit.KnowledgeRuntimeLoggerProviderImpl.newThreadedFileLogger(KnowledgeRuntimeLoggerProviderImpl.java:34)
>>>  at
>>> org.drools.logger.KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(KnowledgeRuntimeLoggerFactory.java:69)
>>>  at org.drools.examples.pacman.Main.initKsession(Main.java:88)
>>>  at org.drools.examples.pacman.Main.main(Main.java:39)
>>> Caused by: java.lang.ClassNotFoundException:
>>> com.thoughtworks.xstream.XStream
>>>  at java.net.URLClassLoader$1.run(Unknown Source)
>>>  at java.security.AccessController.doPrivileged(Native Method)
>>>  at java.net.URLClassLoader.findClass(Unknown Source)
>>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>>  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>>  ... 4 more
>>>
>>>
>>>  org.drools.examples.broker.Main gives the errors:
>>>
>>>  java.lang.NullPointerException
>>>  at
>>> org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:432)
>>>  at
>>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:468)
>>>  at
>>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:28)
>>>  at org.drools.examples.broker.Broker.loadRuleBase(Broker.java:95)
>>>  at org.drools.examples.broker.Broker.createSession(Broker.java:80)
>>>  at org.drools.examples.broker.Broker.(Broker.java:57)
>>>  at org.drools.examples.broker.Main.main(Main.java:53)
>>>
>>>  Does anyone experience the similar issues and know how to fix that?
>>>
>>>  Best Regards,
>>> Kevin
>>>
>>> --
>>>
>>> ___
>>> rules-users mailing 
>>> listrules-us...@lists.jboss.org

Re: [rules-users] GWT Console and WSHT Rendering

2010-10-21 Thread geoff

Hi
Could you clarify this a little please?
>You can add your own forms by adding these to your application classpath 
(either in the same location or any other location which is included 
into the application classpath). 

Can I create these form templates in eclipse and then use the guvnor pluggin
to 'add' them?
or what is the easiest/best way to manage the templates (create, deploy)? 
Should I jar up all the ftl files and put them in the deploy folder?

What is 'Application classpath' in this context? Sorry if it's a dumbass
question...

thanks in advance
Geoff

-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/GWT-Console-and-WSHT-Rendering-tp1700905p1750235.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


Re: [rules-users] Error Inserting events into drools fusion stream

2010-10-21 Thread Pankaj Khattar

Hi,

I am facing the same problem, i have read somewhere that we can use the same
session throughout the application but I'm unable to figure it how?

Also how can we insert events from my application into the same working
memory entry-point?

Below is the code I'm using please let me know if this is the right way to
do it

static StatefulKnowledgeSession session;

session  = knowledgeBase.newStatefulKnowledgeSession();
WorkingMemoryEntryPoint entryPoint =
session.getWorkingMemoryEntryPoint("NotificationStream");
entryPoint.insert(new MyReceivedEvent());
session.fireAllRules();

I'm calling the above code every time a new event is received. Also in the
finally block I'm calling session.dispose();

While inserting the 2nd event in entry-point I'm getting
org.drools.RuntimeDroolsException: Unexpected exception executing action
org.drools.reteoo.propagationqueuingnode$propagateact...@9ff411  Caused by:
java.util.concurrent.RejectedExecutionException. 

Can anyone please let me know the right way to do it?
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Error-Inserting-events-into-drools-fusion-stream-tp1746213p1750434.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


Re: [rules-users] Error Inserting events into drools fusion stream

2010-10-21 Thread Wolfgang Laun
Normally a Fusion session is created once, possibly initialized with some
static facts,
and then you use the entry point to insert events, call fireAllRules, and
wait for the
next event to arrive from its source. Therefore, keep the session and the
entry point
for repeated use by the last two statements.
-W

On 22 October 2010 06:08, Pankaj Khattar  wrote:

>
> Hi,
>
> I am facing the same problem, i have read somewhere that we can use the
> same
> session throughout the application but I'm unable to figure it how?
>
> Also how can we insert events from my application into the same working
> memory entry-point?
>
> Below is the code I'm using please let me know if this is the right way to
> do it
>
> static StatefulKnowledgeSession session;
>
> session  = knowledgeBase.newStatefulKnowledgeSession();
> WorkingMemoryEntryPoint entryPoint =
> session.getWorkingMemoryEntryPoint("NotificationStream");
> entryPoint.insert(new MyReceivedEvent());
> session.fireAllRules();
>
> I'm calling the above code every time a new event is received. Also in the
> finally block I'm calling session.dispose();
>
> While inserting the 2nd event in entry-point I'm getting
> org.drools.RuntimeDroolsException: Unexpected exception executing action
> org.drools.reteoo.propagationqueuingnode$propagateact...@9ff411  Caused
> by:
> java.util.concurrent.RejectedExecutionException.
>
> Can anyone please let me know the right way to do it?
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Error-Inserting-events-into-drools-fusion-stream-tp1746213p1750434.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] Error Inserting events into drools fusion stream

2010-10-21 Thread Ayush

Thanks for the reply.

Can you please elaborate on it?

Well we are facing issues keeping same session and entry point alive through
out the application. 

As each event will be received as a new thread in my application so when I'm
calling the class which inserts into session and fire-all rules then it's
also called as new thread and when called it again initializes the session.
I tried to prevent it by not calling session.dispose() and making it static.
For the 1st thread it works fine but for the second thread when I insert
event into entry-point I get the exception due to concurrent modification.

How can I implement it so that the session and entry-point is initialized
only once and every new event, which is a new thread, will be inserted into
the same entry-point? Also I want that prevoius facts and events should be
in drools memory because I'm working on previous alarms as well?
-- 
View this message in context: 
http://drools-java-rules-engine.46999.n3.nabble.com/Error-Inserting-events-into-drools-fusion-stream-tp1746213p1750771.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