[rules-users] knowledge agent unable to update rule/flow upon changes

2011-09-07 Thread James
Hi all,

I follow the last reply in
"http://drools.46999.n3.nabble.com/KnowledgeAgent-not-reloading-KnowledgeBase-td121401.html";
and use the static method in following class to obtain knowledge base:
public class DroolsCore {
private static KnowledgeAgent kagent = null;
private static KnowledgeBase knowledgeBase = null;

public static KnowledgeBase createKnowledgeBase() {
if(kagent == null && knowledgeBase == null) {
ResourceChangeScannerConfiguration sconf = 

ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
  
sconf.setProperty("drools.resource.scanner.interval", 
"10");

ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();

kagent = KnowledgeAgentFactory.newKnowledgeAgent("myagent");
   
kagent.applyChangeSet(ResourceFactory.newClassPathResource("resource/changeSet.xml"));

knowledgeBase = kagent.getKnowledgeBase();
}
return knowledgeBase;
}
}

I have the my changeSet.xml as follows:








After deploying the application as webapp, I can run the flow + rule all
right.
However, when I switch the execution order in my flow file on the fly and
run the app again (by cliking a link), I get the same result as the flow has
never been changed.
Moreover, I get the following error message when I uninstall the webapp from
my application server (WASCE/geronimo 2.1):
Exception in thread "Thread-44" java.lang.RuntimeException: This Resource
cannot
 be listed, or is not a directory
at
org.drools.io.impl.ClassPathResource.listResources(ClassPathResource.
java:191)
at
org.drools.io.impl.ResourceChangeScannerImpl.scan(ResourceChangeScann
erImpl.java:130)
at
org.drools.io.impl.ResourceChangeScannerImpl$ProcessChangeSet.run(Res
ourceChangeScannerImpl.java:311)
at java.lang.Thread.run(Thread.java:735)

Any help is appreciated.


--
View this message in context: 
http://drools.46999.n3.nabble.com/knowledge-agent-unable-to-update-rule-flow-upon-changes-tp3318638p3318638.html
Sent from the Drools: User forum 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] Alternative to instanceof when matching against multiple concrete types under the same hiearchy?

2011-09-07 Thread lhorton
if you write

when
$type : Interface()


then $type will pick up both your ConcreteType1 and ConcreteType2



--
View this message in context: 
http://drools.46999.n3.nabble.com/Alternative-to-instanceof-when-matching-against-multiple-concrete-types-under-the-same-hiearchy-tp3314751p3318562.html
Sent from the Drools: User forum 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] Unable to get WebDav Access, unless modify JackRabbit Config

2011-09-07 Thread john@oa
Relates to webdav management of rules under: guvnor-5.2.0.Final-tomcat-6.0

Hi

For rapid development, I wish to directly manage the repository through
WebDav.

I can successfully navigate the repository using BitKinex 3.2.3 or Windows 7
web folders.  However, I cannot create or edit .drl files.  When I do this I
receive an ERROR in the Tomcat console (see error below this post).

 I have tried to authenticate with:

-no authentication details
- with the 'guest' user
- the 'anonymous' user
- and the 'admin' user.

I have managed to enable WebDav editing of the repository .drl file's by
updating the JackRabbit configuration of the Tomcat server and changing the
anonymous user to have an id of 'guest' (in Tomcat's repository.xml file -
see below).

*However*, when I do this Drools Guvnor can no longer edit or view Rules. 
Any help much appreciated!


ERROR received on edit:
*
 
at java.lang.Thread.run(Thread.java:662)
ERROR 07-09 18:41:29,280 (WebDavServletBean.java:service:154)Exception:
org.
drools.repository.RulesRepositoryException: javax.jcr.AccessDeniedException:
Acc
ess denied
at
org.drools.repository.VersionableItem.checkout(VersionableItem.java:5
61)
at
org.drools.repository.VersionableItem.checkout(VersionableItem.java:5
31)
at
org.drools.repository.AssetItem.updateBinaryContentAttachment(AssetIt
em.java:405)
at
org.drools.guvnor.server.files.WebDAVImpl.setResourceContent(WebDAVIm
pl.java:712)
at net.sf.webdav.methods.DoPut.execute(DoPut.java:152)
at
net.sf.webdav.WebDavServletBean.service(WebDavServletBean.java:128)
at
org.drools.guvnor.server.files.WebdavServlet.service(WebdavServlet.ja
va:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
at
org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHtt
pServletRequest.java:53)
at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j



JackRabbit configuration with guest user:
***


   

   
   
   


--


--
View this message in context: 
http://drools.46999.n3.nabble.com/Unable-to-get-WebDav-Access-unless-modify-JackRabbit-Config-tp3317488p3317488.html
Sent from the Drools: User forum 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] Function and return value

2011-09-07 Thread snehils
I have made a function in drl file. This function is calling another function
from java file. This java file function returns an object, that I am not
able to get.

function SomeObject testFinction(SomeObject obj1) {
String str;

// Some calculations
// ...
str = "something after calculation";

// this function will return SomeObject based on str value
SomeObject obj2 = Util.getSomeObject(str); // problem is here. obj2 is
updated with same value of obj1. Expected value is diffrent from obj1.
Checked getSomeObject(). It is working fine.

// Some other calculations...
// ...

return anotherSomeObject;
}

rule "Check SomeObject"
when
//eval(tlvID == "57")
someObj:SomeObject(id == "123")
then
testFinction(someObj);
end

I am using drool version 5.1.0.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Function-and-return-value-tp3317132p3317132.html
Sent from the Drools: User forum 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] Override JPAWorkItemManager

2011-09-07 Thread Amin Mohammed-Coleman
Hi 

Thanks for your reply. I am trying to replace the JPAWorkItemFactory so I can 
do some custom work. There is supposed to be some API that you can use but I 
can't find this. 

Cheers
Amin

Sent from my iPhone

On 7 Sep 2011, at 14:56, Alexander Egger  wrote:

> Hi,
> 
> I am working on the same problem currently. You can use your own
> PersistenceContext using the following code.
> 
> TransactionManager transactionManager =
>new TransactionManagerFIVE();
>Environment env = KnowledgeBaseFactory.newEnvironment();
>env.set(EnvironmentName.TRANSACTION_MANAGER, transactionManager);
>env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER,
>new ProcessPersistenceContextManagerFIVE());
>return env;
> 
> Having my own PersistenceContext is enough for me as you have access
> to all persistence methods and I am implementing my own persistence
> layer from there.
> 
> This is not exactly an answer to your question but maybe it helps.
> 
> Alexander
> 
> 2011/9/7 Amin Mohammed-Coleman :
>> Hi
>> Thought it would make sense to show some code:
>> Properties prop = new Properties();
>> ...
>> prop.put("drools.workItemManagerFactory",
>> CustomJPAWorkItemManagerFactory.class.getName());
>> KnowledgeSessionConfiguration config = KnowledgeBaseFa
>> ctory.newKnowledgeSessionConfiguration(prop);
>> JPAKnowledgeService.newStatefulKnowledgeSession(..,config,..);
>> 
>> The default JPAWorkItemManager factory is picked up every time. This is due
>> to the session configuration containing 2 factories and the default is being
>> pickedup.
>> Any help would be appreciated.
>> Cheers
>> 
>> Sent from my iPhone
>> On 7 Sep 2011, at 04:58, Mauricio Salatino  wrote:
>> 
>> are you sure that the property is being set in the right place? I always
>> have troubles doing that. Did you try setting it up using the APIs? Just to
>> see if your work item works?
>> Cheers
>> 
>> 2011/9/6 Amin Mohammed-Coleman 
>>> 
>>> Hi
>>> 
>>> 
>>> 
>>> I am trying to set a custom jpa work item manager and setting it on the
>>> properties object before i create a knowledgesessionconfiguration with
>>> property "drools.workItemManagerFactory" but it seems as though the default
>>> JPAWorkItemManager is used every time.  Is there a way to override this?
>>> 
>>> 
>>> 
>>> Cheers
>>> ___
>>> rules-users mailing list
>>> rules-users@lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>> 
>> 
>> 
>> 
>> --
>>  - CTO @ http://www.plugtree.com
>>  - MyJourney @ http://salaboy.wordpress.com
>> - Co-Founder @ http://www.jugargentina.org
>>  - Co-Founder @ http://www.jbug.com.ar
>> 
>>  - Salatino "Salaboy" Mauricio -
>> 
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> 
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>> 
>> 
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

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


Re: [rules-users] Override JPAWorkItemManager

2011-09-07 Thread Alexander Egger
Hi,

I am working on the same problem currently. You can use your own
PersistenceContext using the following code.

TransactionManager transactionManager =
new TransactionManagerFIVE();
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.TRANSACTION_MANAGER, transactionManager);
env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER,
new ProcessPersistenceContextManagerFIVE());
return env;

Having my own PersistenceContext is enough for me as you have access
to all persistence methods and I am implementing my own persistence
layer from there.

This is not exactly an answer to your question but maybe it helps.

Alexander

2011/9/7 Amin Mohammed-Coleman :
> Hi
> Thought it would make sense to show some code:
> Properties prop = new Properties();
> ...
> prop.put("drools.workItemManagerFactory",
> CustomJPAWorkItemManagerFactory.class.getName());
> KnowledgeSessionConfiguration config = KnowledgeBaseFa
> ctory.newKnowledgeSessionConfiguration(prop);
> JPAKnowledgeService.newStatefulKnowledgeSession(..,config,..);
>
> The default JPAWorkItemManager factory is picked up every time. This is due
> to the session configuration containing 2 factories and the default is being
> pickedup.
> Any help would be appreciated.
> Cheers
>
> Sent from my iPhone
> On 7 Sep 2011, at 04:58, Mauricio Salatino  wrote:
>
> are you sure that the property is being set in the right place? I always
> have troubles doing that. Did you try setting it up using the APIs? Just to
> see if your work item works?
> Cheers
>
> 2011/9/6 Amin Mohammed-Coleman 
>>
>> Hi
>>
>>
>>
>> I am trying to set a custom jpa work item manager and setting it on the
>> properties object before i create a knowledgesessionconfiguration with
>> property "drools.workItemManagerFactory" but it seems as though the default
>> JPAWorkItemManager is used every time.  Is there a way to override this?
>>
>>
>>
>> Cheers
>> ___
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
> --
>  - CTO @ http://www.plugtree.com
>  - MyJourney @ http://salaboy.wordpress.com
> - Co-Founder @ http://www.jugargentina.org
>  - Co-Founder @ http://www.jbug.com.ar
>
>  - Salatino "Salaboy" Mauricio -
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>

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


Re: [rules-users] Decision table empty action cell

2011-09-07 Thread Bruno Freudensprung


Thanks for your answer. Merging the cells is a good idea!

Bruno.

Le 07/09/2011 14:09, Swindells, Thomas a écrit :


There's no easy option.

One solution is to merge the cell across from your condition column -- 
if someone duplicates a row they'll still have the value merged and it 
looks nicer than having a column of N/A


The other approach I tend to use is just to set the column heading to 
be "must be N/A" rather than retract the person.


Thomas




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


Re: [rules-users] Decision table empty action cell

2011-09-07 Thread Swindells, Thomas
There's no easy option.
One solution is to merge the cell across from your condition column - if 
someone duplicates a row they'll still have the value merged and it looks nicer 
than having a column of N/A
The other approach I tend to use is just to set the column heading to be "must 
be N/A" rather than retract the person.

Thomas

From: rules-users-boun...@lists.jboss.org 
[mailto:rules-users-boun...@lists.jboss.org] On Behalf Of Bruno Freudensprung
Sent: 07 September 2011 12:19
To: Rules Users List
Subject: [rules-users] Decision table empty action cell

Hi,

I am implementing a decision table that looks like:
CONDITION

ACTION

$p : Person

name == "$1"

retract($p);

Person name

Retract the person

Fred

N/A

Kenny

N/A


The problem is generated rules have an empty RHS unless I put a string (here 
N/A) on each line of the Action column, and I'd like to hide this column in my 
final spreadsheet.

Does anyone know a way to instruct Drools to generate the LHS even if the cell 
is empty?
If it is not possible, do you know any Excel trick to automatically fill the 
Action cell with an arbitrary value (here N/A) when a new line is inserted in 
my table?

Many thanks in advance for your help,
Best regards,

Bruno.



**
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


[rules-users] "From" in decision table

2011-09-07 Thread Bruno Freudensprung

Hi guys,

As you have probably noticed, today is my "decision tables day" :-).
Before telling you what is going wrong, let me show you what kind of 
rule I try to put in my Drools 5.1 decision table:


# for each window
$window : Window($elements : elements) from $windows
# for each manual annotation
$an1 : ManualAnnotation( this inside $window && text == 
*"ToMatch"*)

# if there is another manual annotation
exists ManualAnnotation( this inside $window && text == 
*"ToMatch2"*)


The only things I would like to parametrize are strings in bold.
My decision table looks like this:

CONDITION   CONDITION   CONDITION
CONDITION   CONDITION

$an1 : ManualAnnotation 
exists ManualAnnotation 
$window : Window($elements...   this inside $window
text == "$1"
this inside $window text == "$1"
for each window
annotation inside window
Textannotation inside windowText
N/A N/A ToMatch
N/A ToMatch2
N/A N/A ToMatch3N/A ToMatch4


Here are the problems (in bold) with the generated rule:

$an1 : ManualAnnotation( *this inside $window == "N/A"* && text 
== *"*ToMatch*"*)
exists ManualAnnotation( *this inside $window == "N/A"* && text 
== *"*ToMatch2*"*)

*$window : Window($elements : elements) from $windows*

   * The order of the LHS "fact lines" of the generated rules is the
 not same as the order of appearance in the spreadsheet
   * The "this inside $window" is considered as a field name

Do you know if I can solve those problems?
I have tried to find a way to tell the decision table to extend another 
rule but I haven't found a keyword for that in the documentation.


Maybe do I have to use rule templates?

Many thanks,
Best regards,

Bruno.

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


[rules-users] Decision table empty action cell

2011-09-07 Thread Bruno Freudensprung

Hi,

I am implementing a decision table that looks like:

*CONDITION*
*ACTION*
*$p : Person*

*name == "$1"*
*retract($p);*
*Person name*
*Retract the person*
Fred
N/A
Kenny
N/A


The problem is generated rules have an empty RHS unless I put a string 
(here N/A) on each line of the Action column, and I'd like to hide this 
column in my final spreadsheet.


Does anyone know a way to instruct Drools to generate the LHS even if 
the cell is empty?
If it is not possible, do you know any Excel trick to automatically fill 
the Action cell with an arbitrary value (here N/A) when a new line is 
inserted in my table?


Many thanks in advance for your help,
Best regards,

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


Re: [rules-users] Classloading error with AspectJ and Drools 5.2.0.Final

2011-09-07 Thread Steven Williams
FYI - https://issues.jboss.org/browse/JBRULES-3122 was raised for this.

cheers
Steve

2011/8/31 Wolfgang Laun 

> This should be fixed by now on the way to 5.3.0, returning an empty
> collection -  I've seen a confirming email from Mark Proctor.
> -W
>
>
> On 30 August 2011 13:27, Sammi  wrote:
>
>> We got exactly the same issue, but I think it could just return empty
>> enumeration rather than null?
>>
>> Cited from the javadoc *Enumberation getResources(String name)*
>> /An enumeration of URL objects for the resource. If no resources could be
>> found, the enumeration will be empty. Resources that the class loader
>> doesn't have access to will not be in the enumeration./
>>
>> stevearoonie wrote:
>> >
>> > Clarification to this - it does also happen when we run our server. So
>> > this
>> > is preventing us from upgrading to 5.2
>> >
>> > My guess is that getResources should return getParent().getResources()
>> > rather than null.
>> >
>> > regards
>> > Steve
>> >
>> >
>>
>>
>> --
>> View this message in context:
>> http://drools.46999.n3.nabble.com/rules-users-Classloading-error-with-AspectJ-and-Drools-5-2-0-Final-tp3143394p3295236.html
>> Sent from the Drools: User forum 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


Re: [rules-users] Override JPAWorkItemManager

2011-09-07 Thread Amin Mohammed-Coleman
Hi 

Thought it would make sense to show some code:

Properties prop = new Properties();
...
prop.put("drools.workItemManagerFactory", 
CustomJPAWorkItemManagerFactory.class.getName());
KnowledgeSessionConfiguration config = KnowledgeBaseFa 
ctory.newKnowledgeSessionConfiguration(prop);
JPAKnowledgeService.newStatefulKnowledgeSession(..,config,..);


The default JPAWorkItemManager factory is picked up every time. This is due to 
the session configuration containing 2 factories and the default is being 
pickedup. 

Any help would be appreciated. 

Cheers


Sent from my iPhone

On 7 Sep 2011, at 04:58, Mauricio Salatino  wrote:

> are you sure that the property is being set in the right place? I always have 
> troubles doing that. Did you try setting it up using the APIs? Just to see if 
> your work item works?
> Cheers
> 
> 2011/9/6 Amin Mohammed-Coleman 
> Hi
>  
> I am trying to set a custom jpa work item manager and setting it on the 
> properties object before i create a knowledgesessionconfiguration with 
> property "drools.workItemManagerFactory" but it seems as though the default 
> JPAWorkItemManager is used every time.  Is there a way to override this? 
> 
>  
> Cheers
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> 
> 
> -- 
>  - CTO @ http://www.plugtree.com  
>  - MyJourney @ http://salaboy.wordpress.com
> - Co-Founder @ http://www.jugargentina.org
>  - Co-Founder @ http://www.jbug.com.ar
>  
>  - Salatino "Salaboy" Mauricio -
> 
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] [rules-dev] Building a (semantic) application

2011-09-07 Thread Wolfgang Laun
This list is dedicated to the communication between Drools developers.

For general questions about Drools and rules, please use the "Rules Users
List" , which has a much wider audience.

-W

On 7 September 2011 03:56, Sebastian Samaruga  wrote:

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