[rules-users] tutorial movies

2009-11-27 Thread zubin
Hello, the tutorial movies available at the following link are not
working, only the Drools Expert Intro is valid.  The other movies are
invalid and not working, can these be reinstated?


http://www.jboss.org/drools/videos/index.html

Expert is working .mov file is fine.

Guvnor, Fusion, and Flow not available / .mov corrupt. 
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Knowledge Agent resource auto loading (.drl/java obj)

2009-11-27 Thread nadeem mehmood
hi friends,
I am working with Knowledge Agent to automatic loading of resources (.drl, 
.java objects) into the statefullKnowledgeSession KB, and then firing them 
automatically. The problem is although I have set true the scanDirectories 
and scanResources configurations of the knowledge agent, but it does't loads 
the files from the subdirectories.
suppose, if I set in my changeSet.xml as:  
and then put my rules package(including .drl/java objects) it does't loads that.
However if I put the simple drl file with a simple rule like, it loads it and 
fires also, successfully.rule "Rule 01"   when        eval (1==1)    then   
     System.out.println("Rule 01 Works");end
As we know that we can only reference java objects using packages in rule 
files. So I want to put a package carrying rules and referenced objects in the 
focused directory, into which the Knowledge agent is looking for the new 
resources. in my case it is rulerep.Am new to drools, any suggestions plz.
bst regards,nadeem 


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


Re: [rules-users] drools-solver NPE in DefaultSimpleScore

2009-11-27 Thread Andrew Waterman
Hi Geoffrey,

My bad; when I migrated to the new Score implementation I failed to  
update my code to properly clone scores in my cloneSolution()  
implementation.  Thanks for letting me know where to look!

best wishes,

Andrew

On Nov 26, 2009, at 12:16 PM, Geoffrey De Smet wrote:

> Hi Andrew,
>
> I can't reproduce your problem.
>
>> The BestSolution is not null although the best score is.
>
> The LocalSearchSolverScope cannot have a best solution and not a  
> best score.
> Could you debug to see where LocalSearchSolverScope.setBestSolution 
> () is
> called and why LocalSearchSolverScope.setBestScore() isn't called or  
> is
> called with a null argument?
>
> With kind regards,
> Geoffrey De Smet
>
>
> Andrew Waterman schreef:
>> Hi,
>>
>> I migrated some solver code that I had working on 5.0M4 to the 5.1.0
>> implementation.  I'm now seeing the following while running the  
>> solver:
>>
>> java.lang.NullPointerException
>>  at org.drools.solver.core.score.DefaultSimpleScore.compareTo
>> (DefaultSimpleScore.java:73)
>>  at org.drools.solver.core.score.DefaultSimpleScore.compareTo
>> (DefaultSimpleScore.java:13)
>>  at
>> org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller.stepTaken
>> (BestSolutionRecaller.java:56)
>>  at
>> org.drools.solver.core.localsearch.DefaultLocalSearchSolver.stepTaken
>> (DefaultLocalSearchSolver.java:171)
>>  at
>> org.drools.solver.core.localsearch.DefaultLocalSearchSolver.solveImplementation
>> (DefaultLocalSearchSolver.java:121)
>>  at org.drools.solver.core.AbstractSolver.solve(AbstractSolver.java: 
>> 41)
>>
>> I ran my test with a debugger attached, and this call is returning a
>> Null:
>>
>> Score bestScore = localSearchSolverScope.getBestScore();
>> < 
>> org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller:
>> 55>
>>
>> The BestSolution is not null although the best score is.
>>
>> Should I file an issue on this in JIRA?  Or perhaps this reflects  
>> some
>> change to the old code that I didn't migrate properly?
>>
>> best wishes,
>>
>> Andrew
>>
>>
>>
>> ___
>> 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] Updates with property change on facts. How???

2009-11-27 Thread Jason Smith
I think I've solved this.  You have to fire the property change event *AFTER* 
you change the underlying property.  As long as session.update() is called 
*AFTER* the value has changed, things seem to work correctly.

Does this sound like a reasonable solution?  I think I saw in the documentation 
(what little I could find on this particular subject) that the property event 
was triggered before the actual value changed.

Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 10:13 AM
To: Rules Users List
Subject: Re: [rules-users] Updates with property change on facts.  How???

The Update command appears to be processed in 
org.drools.process.commands.UpdateCommand.   It's doing the update the same way 
I am.

Why does this code work when Drools uses it, and it doesn't work for me?

package org.drools.process.command;
import org.drools.reteoo.ReteooWorkingMemory;
import org.drools.runtime.rule.FactHandle;
public class UpdateCommand
implements
Command {
private FactHandle handle;
private Object object;
public UpdateCommand(FactHandle handle,
 Object object) {
this.handle = handle;
this.object = object;
}
public Object execute(ReteooWorkingMemory session) {
session.update( handle,
object );
return null;
}
public String toString() {
return "session.update( " + handle + ", " + object + " );";
}
}


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 10:04 AM
To: Rules Users List
Subject: Re: [rules-users] Updates with property change on facts.  How???

Here is a twist.

If I call "update($fact)" explicitly in the rule, the rule is NOT called twice.

Can someone point me to the code used by "update($fact)"?  Maybe I can figure 
out what I did wrong to cause the rule to fire incorrectly a second time.


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 9:54 AM
To: Rules Users List
Subject: [rules-users] Updates with property change on facts.  How???

I implemented the following listener for my bean and I am calling .update() 
directly on the StatefulKnowledgeSession.

QUESTION 1:  Is there a better way?  The old API supported 
.insert(fact,boolean).  The new one does not.  I am not finding any 
documentation that explains the new API (version 5.0.1).

QUESTION 2: Why is this calling my rule twice?  The rule is getting called 
twice, and the second time it's called, the entry conditions are invalid!  That 
is, I changed the bean in a way that invalidates the WHEN condition.  The rule 
still gets called twice.

How do I even begin to go about troubleshooting this?  This same behavior was 
happening with Drools 4 and the old API as well.



private class InnerPropertyChangeListener implements PropertyChangeListener
{
 private final InternalFactHandle factHandle;
 private final Object fact;
 private final StatefulKnowledgeSession session;

 public InnerPropertyChangeListener(InternalFactHandle factHandle, Object 
fact, StatefulKnowledgeSession session)
 {
  this.factHandle = factHandle;
  this.fact = fact;
  this.session = session;
 }

  @Override
  public void propertyChange(PropertyChangeEvent evt)
  {
   System.out.println("** UPDATING " + evt.getPropertyName() + ": " +
 "\nNEW:" + 
StringUtil.indent(BeanUtil.printObject(evt.getNewValue()),16) +
 "\nOLD:" + 
StringUtil.indent(BeanUtil.printObject(evt.getOldValue()),16));
   if((evt.getNewValue() == null && evt.getOldValue() != null) || 
!evt.getNewValue().equals(evt.getOldValue()))
   {
session.update(factHandle, fact);
   }
  }
}





Jason Smith
___
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] Updates with property change on facts. How???

2009-11-27 Thread Jason Smith
The Update command appears to be processed in 
org.drools.process.commands.UpdateCommand.   It's doing the update the same way 
I am.  

Why does this code work when Drools uses it, and it doesn't work for me?

package org.drools.process.command;
import org.drools.reteoo.ReteooWorkingMemory;
import org.drools.runtime.rule.FactHandle;
public class UpdateCommand
implements
Command {
private FactHandle handle;
private Object object;
public UpdateCommand(FactHandle handle,
 Object object) {
this.handle = handle;
this.object = object;
}
public Object execute(ReteooWorkingMemory session) {
session.update( handle,
object );
return null;
}
public String toString() {
return "session.update( " + handle + ", " + object + " );";
}
}


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 10:04 AM
To: Rules Users List
Subject: Re: [rules-users] Updates with property change on facts.  How???

Here is a twist.

If I call "update($fact)" explicitly in the rule, the rule is NOT called twice.

Can someone point me to the code used by "update($fact)"?  Maybe I can figure 
out what I did wrong to cause the rule to fire incorrectly a second time.


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 9:54 AM
To: Rules Users List
Subject: [rules-users] Updates with property change on facts.  How???

I implemented the following listener for my bean and I am calling .update() 
directly on the StatefulKnowledgeSession.

QUESTION 1:  Is there a better way?  The old API supported 
.insert(fact,boolean).  The new one does not.  I am not finding any 
documentation that explains the new API (version 5.0.1).

QUESTION 2: Why is this calling my rule twice?  The rule is getting called 
twice, and the second time it's called, the entry conditions are invalid!  That 
is, I changed the bean in a way that invalidates the WHEN condition.  The rule 
still gets called twice.

How do I even begin to go about troubleshooting this?  This same behavior was 
happening with Drools 4 and the old API as well.



private class InnerPropertyChangeListener implements PropertyChangeListener
{
 private final InternalFactHandle factHandle;
 private final Object fact;
 private final StatefulKnowledgeSession session;

 public InnerPropertyChangeListener(InternalFactHandle factHandle, Object 
fact, StatefulKnowledgeSession session)
 {
  this.factHandle = factHandle;
  this.fact = fact;
  this.session = session;
 }

  @Override
  public void propertyChange(PropertyChangeEvent evt)
  {
   System.out.println("** UPDATING " + evt.getPropertyName() + ": " +
 "\nNEW:" + 
StringUtil.indent(BeanUtil.printObject(evt.getNewValue()),16) +
 "\nOLD:" + 
StringUtil.indent(BeanUtil.printObject(evt.getOldValue()),16));
   if((evt.getNewValue() == null && evt.getOldValue() != null) || 
!evt.getNewValue().equals(evt.getOldValue()))
   {
session.update(factHandle, fact);
   }
  }
}





Jason Smith
___
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] Updates with property change on facts. How???

2009-11-27 Thread Jason Smith
Here is a twist.

If I call "update($fact)" explicitly in the rule, the rule is NOT called twice.

Can someone point me to the code used by "update($fact)"?  Maybe I can figure 
out what I did wrong to cause the rule to fire incorrectly a second time.


Jason Smith

From: rules-users-boun...@lists.jboss.org [rules-users-boun...@lists.jboss.org] 
On Behalf Of Jason Smith [jsm...@infotrustgroup.com]
Sent: Friday, November 27, 2009 9:54 AM
To: Rules Users List
Subject: [rules-users] Updates with property change on facts.  How???

I implemented the following listener for my bean and I am calling .update() 
directly on the StatefulKnowledgeSession.

QUESTION 1:  Is there a better way?  The old API supported 
.insert(fact,boolean).  The new one does not.  I am not finding any 
documentation that explains the new API (version 5.0.1).

QUESTION 2: Why is this calling my rule twice?  The rule is getting called 
twice, and the second time it's called, the entry conditions are invalid!  That 
is, I changed the bean in a way that invalidates the WHEN condition.  The rule 
still gets called twice.

How do I even begin to go about troubleshooting this?  This same behavior was 
happening with Drools 4 and the old API as well.



private class InnerPropertyChangeListener implements PropertyChangeListener
{
 private final InternalFactHandle factHandle;
 private final Object fact;
 private final StatefulKnowledgeSession session;

 public InnerPropertyChangeListener(InternalFactHandle factHandle, Object 
fact, StatefulKnowledgeSession session)
 {
  this.factHandle = factHandle;
  this.fact = fact;
  this.session = session;
 }

  @Override
  public void propertyChange(PropertyChangeEvent evt)
  {
   System.out.println("** UPDATING " + evt.getPropertyName() + ": " +
 "\nNEW:" + 
StringUtil.indent(BeanUtil.printObject(evt.getNewValue()),16) +
 "\nOLD:" + 
StringUtil.indent(BeanUtil.printObject(evt.getOldValue()),16));
   if((evt.getNewValue() == null && evt.getOldValue() != null) || 
!evt.getNewValue().equals(evt.getOldValue()))
   {
session.update(factHandle, fact);
   }
  }
}





Jason Smith
___
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] Timer Node Period not firing repeatedly (running in active mode using fireUntilhalt())

2009-11-27 Thread Boardman, Paul

I 'm using Drools flow 5.1m1 and have created a simple Timer test flow.
It has a simple Action node after the timer that Prints out "Hello".

I have set the timer delay to 5000 and the Timer Period to 2000.  What I
expect to happen is I get Hello printed after 5 seconds, then followed
by Hello every 2 seconds until I call halt on the session. However I
just get the first Hello after 5 seconds and that's it.  

I am calling session.fireUntilHalt() in a separate thread and then
starting my process just after this thread has started. (basically
copying the code in section 3.9 Timers from the docs)


Thanks

Paul

___

Atos Origin and Atos Consulting are trading names used by the Atos Origin 
group.  The following trading entities are registered in England and Wales:  
Atos Origin IT Services UK Limited (registered number 01245534) and Atos 
Consulting Limited (registered number 04312380).  The registered office for 
each is at 4 Triton Square, Regents Place, London, NW1 3HG.The VAT No. for each 
is: GB232327983

This e-mail and the documents attached are confidential and intended solely for 
the addressee, and may contain confidential or privileged information.  If you 
receive this e-mail in error, you are not authorised to copy, disclose, use or 
retain it.  Please notify the sender immediately and delete this email from 
your systems.   As emails may be intercepted, amended or lost, they are not 
secure.  Atos Origin therefore can accept no liability for any errors or their 
content.  Although Atos Origin endeavours to maintain a virus-free network, we 
do not warrant that this transmission is virus-free and can accept no liability 
for any damages resulting from any virus transmitted.   The risks are deemed to 
be accepted by everyone who communicates with Atos Origin by email. 
___

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


Re: [rules-users] drools-solver NPE in DefaultSimpleScore

2009-11-27 Thread Andrew Waterman
Hi Geoffrey,

I'll check that out today for you and let you know what I find out  
with my case.  I'm using the following solver dependency:

 
 org.drools.solver
 drools-solver-core
 5.1.0.M1
 

best wishes,

Andrew

On Nov 26, 2009, at 12:16 PM, Geoffrey De Smet wrote:

> Hi Andrew,
>
> I can't reproduce your problem.
>
>> The BestSolution is not null although the best score is.
>
> The LocalSearchSolverScope cannot have a best solution and not a  
> best score.
> Could you debug to see where LocalSearchSolverScope.setBestSolution 
> () is
> called and why LocalSearchSolverScope.setBestScore() isn't called or  
> is
> called with a null argument?
>
> With kind regards,
> Geoffrey De Smet
>
>
> Andrew Waterman schreef:
>> Hi,
>>
>> I migrated some solver code that I had working on 5.0M4 to the 5.1.0
>> implementation.  I'm now seeing the following while running the  
>> solver:
>>
>> java.lang.NullPointerException
>>  at org.drools.solver.core.score.DefaultSimpleScore.compareTo
>> (DefaultSimpleScore.java:73)
>>  at org.drools.solver.core.score.DefaultSimpleScore.compareTo
>> (DefaultSimpleScore.java:13)
>>  at
>> org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller.stepTaken
>> (BestSolutionRecaller.java:56)
>>  at
>> org.drools.solver.core.localsearch.DefaultLocalSearchSolver.stepTaken
>> (DefaultLocalSearchSolver.java:171)
>>  at
>> org.drools.solver.core.localsearch.DefaultLocalSearchSolver.solveImplementation
>> (DefaultLocalSearchSolver.java:121)
>>  at org.drools.solver.core.AbstractSolver.solve(AbstractSolver.java: 
>> 41)
>>
>> I ran my test with a debugger attached, and this call is returning a
>> Null:
>>
>> Score bestScore = localSearchSolverScope.getBestScore();
>> < 
>> org.drools.solver.core.localsearch.bestsolution.BestSolutionRecaller:
>> 55>
>>
>> The BestSolution is not null although the best score is.
>>
>> Should I file an issue on this in JIRA?  Or perhaps this reflects  
>> some
>> change to the old code that I didn't migrate properly?
>>
>> best wishes,
>>
>> Andrew
>>
>>
>>
>> ___
>> 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] Updates with property change on facts. How???

2009-11-27 Thread Jason Smith
I implemented the following listener for my bean and I am calling .update() 
directly on the StatefulKnowledgeSession.

QUESTION 1:  Is there a better way?  The old API supported 
.insert(fact,boolean).  The new one does not.  I am not finding any 
documentation that explains the new API (version 5.0.1).

QUESTION 2: Why is this calling my rule twice?  The rule is getting called 
twice, and the second time it's called, the entry conditions are invalid!  That 
is, I changed the bean in a way that invalidates the WHEN condition.  The rule 
still gets called twice.  

How do I even begin to go about troubleshooting this?  This same behavior was 
happening with Drools 4 and the old API as well.



private class InnerPropertyChangeListener implements PropertyChangeListener
{
 private final InternalFactHandle factHandle;
 private final Object fact;
 private final StatefulKnowledgeSession session;
 
 public InnerPropertyChangeListener(InternalFactHandle factHandle, Object 
fact, StatefulKnowledgeSession session)
 {
  this.factHandle = factHandle;
  this.fact = fact;
  this.session = session;
 }
 
  @Override
  public void propertyChange(PropertyChangeEvent evt) 
  {
   System.out.println("** UPDATING " + evt.getPropertyName() + ": " + 
 "\nNEW:" + 
StringUtil.indent(BeanUtil.printObject(evt.getNewValue()),16) +
 "\nOLD:" + 
StringUtil.indent(BeanUtil.printObject(evt.getOldValue()),16));
   if((evt.getNewValue() == null && evt.getOldValue() != null) || 
!evt.getNewValue().equals(evt.getOldValue()))
   {
session.update(factHandle, fact);
   }
  }
}





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


Re: [rules-users] Drools with Web Application

2009-11-27 Thread সাহিদ
On Fri, Nov 27, 2009 at 9:45 AM, Jervisliu  wrote:
> [snipped..]
> Let me know if you have interest to explore this
> further, I can provide more information on this.
>
> [1].http://cwiki.apache.org/CXF20DOC/jax-rs.html
> [2]. http://www.jboss.org/resteasy/
>

Thank you Jervis for the pointers. These CXF and RestEasy web services
are pretty new to me. Let me gather some basics. I'll come back in the
list if I need anything.

Regards,

-- 
S.
Argue with idiots, and you become an idiot. - PG
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Import and Export at Package level

2009-11-27 Thread krishna.cj
Hi,

We are running Guvnor on two machines, out of which one is used for  
developing and testing rules, say test environment, and another is  
used for providing rules for production application. Our test  
environment typically contains more than one package and each in turn  
contains multiple snapshots. When we use Export  and Import  to  
provide updated rules to production environment,  all the packages and  
snapshots are imported to the production environment.
Is there any way to use Export and Import at package level so that we  
can export only the package we want and no other package or snapshot?

Any help would be a great help to us..

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


Re: [rules-users] unable to resolve Type Declaration class

2009-11-27 Thread richarda

Ok, i have looked at the drools source and I see the following:

TypeDeclaration lastType = null;
try {
// Add the type declarations to the RuleBase
if ( newPkg.getTypeDeclarations() != null ) {
// add type declarations
for ( TypeDeclaration type :
newPkg.getTypeDeclarations().values() ) {
lastType = type;
type.setTypeClass( this.rootClassLoader.loadClass(
pkg.getName() + "." + type.getTypeName() ) );
}
}
} catch ( ClassNotFoundException e ) {
throw new RuntimeDroolsException( "unable to resolve Type
Declaration class '" + lastType.getTypeName() + "'" );
}


If I debug this, I find that the  pkg.getName() + "." + type.getTypeName()
is resolved to

defaultPackage.Message

so, its trying to load a class called  "defaultPackage.Message"
which obviously isn't found..




richarda wrote:
> 
> Yeah, its in the classpath..  and to be doubly sure just before the code I
> do a 
> Message s=new Message();
> and that works.. so jvm can find the Message object.
> 
> I have created https://jira.jboss.org/jira/browse/JBRULES-2348
> I would love to know if any workarounds are possible, this has ground my
> project to a halt.
> 
> thanks
> Ric
> 
> 
> Edson Tirelli-4 wrote:
>> 
>>Kris just reminded me of something: do you have the actual Message
>> class
>> in the test program classpath?
>> 
>>When downloading the package from guvnor, I think it does not download
>> the model jar... only the actual rules, etc...
>> 
>>Edson
>> 
>> 2009/11/25 richarda 
>> 
>>>
>>> Also tried under 5.1.0M1 release.. same issue :(
>>> Am i doing something wrong by declaring the @role in the Configuration
>>> section?
>>>
>>>
>>> richarda wrote:
>>> >
>>> > Still trying to get this to work.
>>> > I have managed to create from a default (new) guvnor setup.
>>> >
>>> > Steps I do..
>>> > 1. Create fresh guvnor
>>> > 2. In eclipse create  Message.java file in package com.sample, and
>>> create
>>> > a jar file
>>> > 3. In guvnor import the model for the Message.jar file
>>> > 4. In guvnor create a category
>>> > 5. Create an import statement for  import com.sample.Message
>>> > 6. Create a simple technical rule,  something like   when, Message(),
>>> > then, System.out.println(".");
>>> > 7. Build the pkg
>>> > 8. download the pkg
>>> >
>>> > use the code from previous post to load the pkg...
>>> > it works fine..
>>> >
>>> > now, goto guvnor advanced view and change the Configuration from:
>>> > import com.sample.Message
>>> >
>>> > to:
>>> >
>>> > import com.sample.Message;
>>> >
>>> > declare Message
>>> >   @role( event )
>>> > end
>>> >
>>> >
>>> > build the pkg,
>>> > download the pkg,
>>> > run the test program...
>>> >
>>> > I get:
>>> > org.drools.RuntimeDroolsException: unable to resolve Type Declaration
>>> > class 'Message'
>>> >   at
>>> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
>>> >   at
>>> >
>>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
>>> >   at
>>> >
>>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>>> >   at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:69)
>>> >   at com.sample.DroolsTest.main(DroolsTest.java:27)
>>> >
>>> >
>>> > richarda wrote:
>>> >>
>>> >> So, my code is doing this:
>>> >>
>>> >>  KnowledgeBaseConfiguration conf =
>>> >> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
>>> >> conf.setOption(EventProcessingOption.STREAM);
>>> >> KnowledgeBuilder builder =
>>> >> KnowledgeBuilderFactory.newKnowledgeBuilder();
>>> >> try {
>>> >> File f = new File("/tmp/my.pkg");
>>> >> InputStream stream = new FileInputStream(f);
>>> >> if (stream == null) {
>>> >> jlog.fatal("Unable to find rule pkg");
>>> >> } else {
>>> >> jlog.info("adding pkg");
>>> >>
>>> >> builder.add(ResourceFactory.newInputStreamResource(stream),
>>> >> ResourceType.PKG);
>>> >> }
>>> >> } catch (Exception e) {
>>> >> e.printStackTrace();
>>> >> }
>>> >> KnowledgeBase kbase =
>>> >> KnowledgeBaseFactory.newKnowledgeBase(conf);
>>> >>
>>> kbase.addKnowledgePackages(builder.getKnowledgePackages());
>>> >> jlog.info("setup creating knowledge session");
>>> >> ksession = kbase.newStatefulKnowledgeSession();
>>> >> jlog.info(" setup ksession created");
>>> >>
>>> >>
>>> >> The pkg was created from Guvnor.
>>> >>
>>> >> If in the package declaration area in Guvnor,  (where you put the
>>> import
>>> >> statements)
>>> >> If I put
>>> >> declare Signature
>>> >>  @role ( event )
>>> >> end
>>> >>
>>> >> then build the package, save it to disk /tmp/my.pkg
>>> >> on startup I get:
>>> >>
>>> >>
>>> 

Re: [rules-users] unable to resolve Type Declaration class

2009-11-27 Thread richarda

Yeah, its in the classpath..  and to be doubly sure just before the code I do
a 
Message s=new Message();
and that works.. so jvm can find the Message object.

I have created https://jira.jboss.org/jira/browse/JBRULES-2348
I would love to know if any workarounds are possible, this has ground my
project to a halt.

thanks
Ric


Edson Tirelli-4 wrote:
> 
>Kris just reminded me of something: do you have the actual Message
> class
> in the test program classpath?
> 
>When downloading the package from guvnor, I think it does not download
> the model jar... only the actual rules, etc...
> 
>Edson
> 
> 2009/11/25 richarda 
> 
>>
>> Also tried under 5.1.0M1 release.. same issue :(
>> Am i doing something wrong by declaring the @role in the Configuration
>> section?
>>
>>
>> richarda wrote:
>> >
>> > Still trying to get this to work.
>> > I have managed to create from a default (new) guvnor setup.
>> >
>> > Steps I do..
>> > 1. Create fresh guvnor
>> > 2. In eclipse create  Message.java file in package com.sample, and
>> create
>> > a jar file
>> > 3. In guvnor import the model for the Message.jar file
>> > 4. In guvnor create a category
>> > 5. Create an import statement for  import com.sample.Message
>> > 6. Create a simple technical rule,  something like   when, Message(),
>> > then, System.out.println(".");
>> > 7. Build the pkg
>> > 8. download the pkg
>> >
>> > use the code from previous post to load the pkg...
>> > it works fine..
>> >
>> > now, goto guvnor advanced view and change the Configuration from:
>> > import com.sample.Message
>> >
>> > to:
>> >
>> > import com.sample.Message;
>> >
>> > declare Message
>> >   @role( event )
>> > end
>> >
>> >
>> > build the pkg,
>> > download the pkg,
>> > run the test program...
>> >
>> > I get:
>> > org.drools.RuntimeDroolsException: unable to resolve Type Declaration
>> > class 'Message'
>> >   at
>> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
>> >   at
>> >
>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
>> >   at
>> >
>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>> >   at com.sample.DroolsTest.readKnowledgeBase(DroolsTest.java:69)
>> >   at com.sample.DroolsTest.main(DroolsTest.java:27)
>> >
>> >
>> > richarda wrote:
>> >>
>> >> So, my code is doing this:
>> >>
>> >>  KnowledgeBaseConfiguration conf =
>> >> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
>> >> conf.setOption(EventProcessingOption.STREAM);
>> >> KnowledgeBuilder builder =
>> >> KnowledgeBuilderFactory.newKnowledgeBuilder();
>> >> try {
>> >> File f = new File("/tmp/my.pkg");
>> >> InputStream stream = new FileInputStream(f);
>> >> if (stream == null) {
>> >> jlog.fatal("Unable to find rule pkg");
>> >> } else {
>> >> jlog.info("adding pkg");
>> >>
>> >> builder.add(ResourceFactory.newInputStreamResource(stream),
>> >> ResourceType.PKG);
>> >> }
>> >> } catch (Exception e) {
>> >> e.printStackTrace();
>> >> }
>> >> KnowledgeBase kbase =
>> >> KnowledgeBaseFactory.newKnowledgeBase(conf);
>> >>
>> kbase.addKnowledgePackages(builder.getKnowledgePackages());
>> >> jlog.info("setup creating knowledge session");
>> >> ksession = kbase.newStatefulKnowledgeSession();
>> >> jlog.info(" setup ksession created");
>> >>
>> >>
>> >> The pkg was created from Guvnor.
>> >>
>> >> If in the package declaration area in Guvnor,  (where you put the
>> import
>> >> statements)
>> >> If I put
>> >> declare Signature
>> >>  @role ( event )
>> >> end
>> >>
>> >> then build the package, save it to disk /tmp/my.pkg
>> >> on startup I get:
>> >>
>> >>
>> [#|2009-11-24T14:50:38.944+|WARNING|sun-appserver2.1|javax.enterprise.system.stream.err|_ThreadID=12;_ThreadName=pool-1-thread-3;_RequestID=7c35064d-757e-4519-b5eb-433db89e168d;|org.drools.RuntimeDroolsException:
>> >> unable to resolve Type Declaration class 'Signature'
>> >>  at
>> >> org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:754)
>> >>  at
>> >>
>> org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:515)
>> >>  at
>> >>
>> org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:25)
>> >>
>> >>
>> >> I need to declare 'Signature' as an 'event'
>> >> Am I doing this wrong?
>> >>
>> >> If I do this all in Eclipse and load the DRL files manually it all
>> works.
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/unable-to-resolve-Type-Declaration-class-tp26497326p26519888.html
>> Sent from the drools - user mailing list archive at Nabble.com.
>>
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jbo

[rules-users] How to enforce dependecy rules

2009-11-27 Thread pdario

Hello,

I need some help to understand how to enforce dependency rules with Drools.
Suppose you have two objects - A and B - and two business rules that say:
"if A is selected, unselect B" and "if B is selected, unselect A".

How can I be sure that Drools unselects B when user selects A and viceversa?
How can avoid a loop or Drools resolving dependency unselecting what the
user just selected?

Should I use Solver or Fusion?

Or... Is Drools the wrong tool?

Thanks a lot!

Dario
-- 
View this message in context: 
http://old.nabble.com/How-to-enforce-dependecy-rules-tp26532016p26532016.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