Re: [rules-users] Drools Govnor DB configuration
by Pardeep.Ruhil@lntinfotech.com
Hi,
Thanks Jarek for your reply.
Still I have one doubt in my mind, how can I see the data for a newly
registered user (i.e name & permission )
created through Drools Guvnor administrator functionality. Where should
I find the new user data(i.e. name & permission assigned) , so that
I can write synch service to synch data from Drools Guvnor table to OFBiz
table.
Please help me to through out from this problem.
Thanks & Regards
Pardeep Ruhil
L&T Infotech Ltd
Mumbai
Ph: +919820283884
Pardeep.Ruhil(a)lntinfotech.com wrote:
>
> Hi,
> I am using Apache OFBiz and had successfully integrated Drools Guvnor
> war file with OFBiz.
> By default Drools Guvnor supports Embedded derby, but in OFBiz i am
> using MYSql , so i changed
> the default embedded derby to MySql using repository.xml file by the
> following code.
>
> <PersistenceManager
>
class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
>
> <param name="url"
> value="jdbc:mysql://localhost:3306/drools"/>
> <param name="user" value="root" />
> <param name="password" value="Newuser123" />
> <param name="schema" value="mysql"/>
> <param name="schemaObjectPrefix"
value="${wsp.name}_"/>
> </PersistenceManager>
>
> Using this I successfully integrated Drools guvnor with same database as
> I am using for OFBiz(MySql).
>
> Now I have created a new user in Drools guvnor to create permission for
> that user, but I am not able to see
> where that username is stored in the database and in which entity or
> table of MySql.
>
> Also if i want to use the users available in OFBiz MySql database
> entity say 'Userlogin' where i am storing all the list of userlogins,
> how can
> I retrieve the same and use this table data in drools Guvnor.
This can be done via JAAS - you just need to configure it to use a
particular table in mysql for retrieving user logins/passwords.
Keep in mind that this is just for authentication (to login).
Here's a list of all available login modules:
http://www.jboss.org/community/wiki/LoginModule
http://www.jboss.org/community/wiki/DatabaseServerLoginModule
> Also when
> I make a new user in Drools Govnor through
> administrator, my data of new user should go to table 'UserLogin'.
AFAICT that's not possible and you need to synch your Guvnor user list
with the OFBiz user list by yourself.
Cheers,
Jarek
>
> Please help me how this can be achieved in Drools Guvnor.
>
> Thanks & Regards
>
> Pardeep Ruhil
> L&T Infotech Ltd
> Mumbai
> Ph: +919820283884
> *
> Larsen & Toubro Infotech Ltd.*_
> __www.Lntinfotech.com_ <http://www.lntinfotech.com/>
>
> This Document is classified as:
>
> L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech
> Internal Use Only L&T Infotech General Business
>
> This Email may contain confidential or privileged information for the
> intended recipient (s) If you are not the intended recipient, please do
> not use or disseminate the information, notify the sender and delete it
> from your system.
______________________________________________________________________
15 years, 5 months
Getting hold of the Evaluator Registry
by Asif Iqbal
Hi,
What I need to do is modify one of the evaluator classes specifically '<=', so that it can handle strings. Now I know I need to create a class similar to ComparableEvaluatorDefinition. But what I want to do is replace the existing one in the evaluator registry with my implementation which will include the additional String capability.
>From my understanding that should be all that is required. Unless im missing something... now all I need to know is how do I get hold of the evaluator registry?
Cheers
I
15 years, 5 months
Visu Nageswaran is out of the office.
by Viswanathan Nageswaran
I will be out of the office starting 17/07/2009 and will not return until
18/07/2009.
I am in a training today. Response to emails would be delayed. For anything
urgent, please call at +91-9884702390.
15 years, 5 months
Using variables as map keys in MVEL in LHS
by Steve Ronderos
Hello,
Again, I'm working on converting my project that used Drools 4.0.7 to
5.0.1.
I've run across a problem with a rule that accesses a map in the LHS using
a variable as the key. When MVEL tries to resolve this, it appears that
it is not evaluating the variable before accessing the map. I've modified
the Shopping example from the Drools 5.0.1 Examples to recreate the issue
in a simpler setting.
This is the rule (I removed all the other rules for this example)
rule "Cart notification"
salience 10
when
$p : Product( $productName : name)
$c : Customer( cart[$productName] == $p)
then
System.out.println( "Customer " + $c.name + " has " + $p.name + "
in cart");
end
I added the following to the Customer class:
private Map<String,Product> cart = new HashMap<String, Product>();
public Map<String, Product> getCart() {
return cart;
}
and I modified the main method to be:
public static final void main(String[] args) throws Exception {
final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.
newKnowledgeBuilder();
kbuilder.add( ResourceFactory.newClassPathResource( "Shopping.drl",
ShoppingExample.class ),
ResourceType.DRL );
final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
final StatefulKnowledgeSession ksession =
kbase.newStatefulKnowledgeSession();
Customer mark = new Customer( "mark",
0 );
ksession.insert( mark );
Product shoes = new Product( "shoes",
60 );
ksession.insert( shoes );
mark.getCart().put("shoes", shoes);
ksession.fireAllRules();
}
So basically, I added a map to Customer, inserted one item and made a rule
that will use a variable as a key for that map.
What I would expect to happen is:
the Product pattern would match the shoes Product that is inserted into
the ksession, the $productName variable would contain the value "shoes"
the Customer fact, mark, would be matched with the second pattern in the
rule because cart["shoes"] should resolve to the shoes fact which is $p in
the rule
The message should print
What actually happens is an error message:
Exception in thread "main" org.drools.RuntimeDroolsException: Exception
executing predicate cart[$productName] == $p
at org.drools.rule.PredicateConstraint.isAllowedCachedLeft(
PredicateConstraint.java:302)
at org.drools.common.SingleBetaConstraints.isAllowedCachedLeft(
SingleBetaConstraints.java:138)
at org.drools.reteoo.JoinNode.assertLeftTuple(JoinNode.java:114)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.doPropagateAssertLeftTuple(
SingleLeftTupleSinkAdapter.java:117)
at
org.drools.reteoo.SingleLeftTupleSinkAdapter.createAndPropagateAssertLeftTuple(
SingleLeftTupleSinkAdapter.java:78)
at org.drools.reteoo.LeftInputAdapterNode.assertObject(
LeftInputAdapterNode.java:142)
at
org.drools.reteoo.SingleObjectSinkAdapter.propagateAssertObject(
SingleObjectSinkAdapter.java:42)
at org.drools.reteoo.ObjectTypeNode.assertObject(
ObjectTypeNode.java:185)
at org.drools.reteoo.EntryPointNode.assertObject(
EntryPointNode.java:146)
at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:1046)
at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:1001)
at org.drools.common.AbstractWorkingMemory.insert(
AbstractWorkingMemory.java:788)
at org.drools.impl.StatefulKnowledgeSessionImpl.insert(
StatefulKnowledgeSessionImpl.java:216)
at org.drools.examples.ShoppingExample.main(
ShoppingExample.java:32)
Caused by: [Error: unable to resolve method:
java.util.HashMap.$productName() [arglength=0]]
[Near : {... Unknown ....}]
^
[Line: 1, Column: 0]
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getMethod(
ReflectiveAccessorOptimizer.java:906)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(
ReflectiveAccessorOptimizer.java:585)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(
ReflectiveAccessorOptimizer.java:313)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(
ReflectiveAccessorOptimizer.java:138)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(
ASTNode.java:133)
at org.mvel2.compiler.ExecutableAccessor.getValue(
ExecutableAccessor.java:37)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getCollectionProperty(
ReflectiveAccessorOptimizer.java:633)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(
ReflectiveAccessorOptimizer.java:319)
at
org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(
ReflectiveAccessorOptimizer.java:138)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(
ASTNode.java:133)
at org.mvel2.ast.BinaryOperation.getReducedValueAccelerated(
BinaryOperation.java:102)
at org.mvel2.MVELRuntime.execute(MVELRuntime.java:85)
at org.mvel2.compiler.CompiledExpression.getValue(
CompiledExpression.java:104)
at org.mvel2.MVEL.executeExpression(MVEL.java:978)
at org.drools.base.mvel.MVELPredicateExpression.evaluate(
MVELPredicateExpression.java:75)
at org.drools.rule.PredicateConstraint.isAllowedCachedLeft(
PredicateConstraint.java:295)
... 13 more
Is this a bug in MVEL or Drools, or am I using the map access incorrectly?
Thanks,
Steve Ronderos
15 years, 5 months
Re: [rules-users] StatefulKnowledgeSession leaves threads running
by Greg Barton
I have seen similar behavior, though at the time I didn't have the opportunity to investigate the cause. (Sorry about not reporting it at the time.) Unlike the code below it was while calling session.fireUntilHalt(). (In a seperate thread.) After calling session.halt() from another thread the fireUntilHalt() would exit, but the VM would not exit due to a non-daemon thread persisting.
--- On Thu, 7/16/09, Rafael Ribeiro <rafaelri(a)gmail.com> wrote:
> From: Rafael Ribeiro <rafaelri(a)gmail.com>
> Subject: Re: [rules-users] StatefulKnowledgeSession leaves threads running
> To: "Rules Users List" <rules-users(a)lists.jboss.org>
> Date: Thursday, July 16, 2009, 12:10 PM
> Hi Edson!
>
> as I've already mentioned I've modified the
> sample so, if you get the StockTick sample and replace the
> Main class this will run fine.
> The sample shuts down fine but as I saw it sets the
> JFrame uses frame.setDefaultCloseOperation(
> WindowConstants.EXIT_ON_CLOSE ); which in turn makes the
> trick.
>
>
> Below the code of my modified main class:
>
> package org.drools.examples.broker;
>
>
> import org.drools.KnowledgeBase;
> import org.drools.KnowledgeBaseConfiguration;
> import org.drools.KnowledgeBaseFactory;
>
> import org.drools.builder.KnowledgeBuilder;
> import org.drools.builder.KnowledgeBuilderFactory;
> import org.drools.builder.ResourceType;
> import org.drools.conf.EventProcessingOption;
> import org.drools.examples.broker.model.Company;
>
> import org.drools.examples.broker.model.CompanyRegistry;
> import org.drools.examples.broker.model.StockTick;
> import org.drools.io.ResourceFactory;
> import org.drools.runtime.StatefulKnowledgeSession;
> import org.drools.runtime.rule.WorkingMemoryEntryPoint;
>
>
> public class Main {
> private static final String RULES_FILE =
> "/broker.drl";
> static StatefulKnowledgeSession session;
> static WorkingMemoryEntryPoint tickStream;
>
> /**
> * @param args
>
> */
> public static void main(String[] args) throws
> Exception {
> // set up and show main window
>
> CompanyRegistry companies = new
> CompanyRegistry();
>
> KnowledgeBuilder builder =
> KnowledgeBuilderFactory.newKnowledgeBuilder();
>
> try {
> builder.add(
> ResourceFactory.newInputStreamResource(
> Main.class.getResourceAsStream( RULES_FILE ) ),
>
> ResourceType.DRL);
> } catch ( Exception e ) {
> e.printStackTrace();
>
> }
> if( builder.hasErrors() ) {
>
> System.err.println(builder.getErrors());
> System.exit( 0 );
> }
>
> KnowledgeBaseConfiguration conf =
> KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
>
> conf.setOption( EventProcessingOption.STREAM
> );
> KnowledgeBase kbase =
> KnowledgeBaseFactory.newKnowledgeBase( conf );
> kbase.addKnowledgePackages(
> builder.getKnowledgePackages() );
>
>
> session =
> kbase.newStatefulKnowledgeSession();
>
> session.setGlobal( "services", new
> BrokerServices() {
> public void log(String message) {
>
> System.out.println(message);
>
> }
> });
>
> for( Company company :
> companies.getCompanies() ) {
> session.insert( company );
> }
> session.fireAllRules();
>
> tickStream =
> session.getWorkingMemoryEntryPoint( "StockTick
> stream" );
>
>
> for (int i=10;i>0;i--) {
> tickStream.insert(new
> StockTick("RHT", i*10,
> System.currentTimeMillis()));
> session.getAgenda().getAgendaGroup(
> "evaluation" ).setFocus();
>
> session.fireAllRules();
> }
> session.dispose();
> session.halt();
> System.out.println("Still
> running...");
> }
>
> }
>
>
> regards,
> Rafael Ribeiro
>
>
> 2009/7/16 Edson Tirelli <tirelli(a)post.com>
>
>
> Hi Rafael,
>
> Are you setting the MultithreadEvaluation option or is
> this using default options? Do you have an example code that
> shows this behavior?
>
> Thanks,
> Edson
>
>
>
> 2009/7/16 Rafael Ribeiro <rafaelri(a)gmail.com>
>
>
>
>
> Hi all,
>
>
>
> I've downloaded Drools fusion sample and started to
> make some changes to
>
> the code (first of all wipe out the UI so I can test it
> easier).
>
> I tried to get to a minimal set so I can run a console
> main class and see
>
> what happens but I am facing a strange behaviour.
>
> As soon as I start pushing events into the
> WorkingMemoryEntryPoint
>
> ("StockTick stream") a Thread - not daemonized
> since it blocks shutdown from
>
> ending - is spawned and this prevents my JVM from shutting
> down (obviously
>
> if I call System.exit(0) it will but I am avoiding this).
>
> I've tried both to halt and dispose the session that
> this entry point
>
> belongs but with no success. Does anyone know how could I
> get rid of this
>
> thread?
>
>
>
> best regards,
>
> --
>
>
>
>
> _______________________________________________
>
> rules-users mailing list
>
> rules-users(a)lists.jboss.org
>
> http://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> http://lists.jboss.org/mailman/listinfo/rules-users
>
15 years, 5 months
Drools Govnor DB configuration
by Pardeep.Ruhil@lntinfotech.com
Hi,
I am using Apache OFBiz and had successfully integrated Drools Guvnor war
file with OFBiz.
By default Drools Guvnor supports Embedded derby, but in OFBiz i am using
MYSql , so i changed
the default embedded derby to MySql using repository.xml file by the
following code.
<PersistenceManager
class="org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager">
<param name="url"
value="jdbc:mysql://localhost:3306/drools"/>
<param name="user" value="root" />
<param name="password" value="Newuser123" />
<param name="schema" value="mysql"/>
<param name="schemaObjectPrefix" value="${wsp.name}_"/>
</PersistenceManager>
Using this I successfully integrated Drools guvnor with same database as I
am using for OFBiz(MySql).
Now I have created a new user in Drools guvnor to create permission for
that user, but I am not able to see
where that username is stored in the database and in which entity or table
of MySql.
Also if i want to use the users available in OFBiz MySql database entity
say 'Userlogin' where i am storing all the list of userlogins, how can
I retrieve the same and use this table data in drools Guvnor. Also when I
make a new user in Drools Govnor through
administrator, my data of new user should go to table 'UserLogin'.
Please help me how this can be achieved in Drools Guvnor.
Thanks & Regards
Pardeep Ruhil
L&T Infotech Ltd
Mumbai
Ph: +919820283884
Larsen & Toubro Infotech Ltd.
www.Lntinfotech.com
This Document is classified as:
L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech
Internal Use Only L&T Infotech General Business
This Email may contain confidential or privileged information for the
intended recipient (s) If you are not the intended recipient, please do
not use or disseminate the information, notify the sender and delete it
from your system.
______________________________________________________________________
15 years, 5 months
Question regarding Release 5.1
by McDonald, Daniel
Hi,
Does anyone know if there is a roadmap for the next Drools release, an
anticipated, forecast, or suspected date, for Release 5.1?
Thank you,
Dan
Office phone: (972) 691-6593
Mobile phone (214) 697-8163
_____________
The information contained in this message is proprietary and/or confidential. If you are not the
intended recipient, please: (i) delete the message and all copies; (ii) do not disclose,
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition,
please be aware that any message addressed to our domain is subject to archiving and review by
persons other than the intended recipient. Thank you.
_____________
15 years, 5 months
looking for more information on drools expert
by Gab Aldian
Hi everybody
I have read with attention the drools expert documentation, which was
very interesting, but a little 'too simple". For example, most
examples don't present rules with the keyword "forall". I also met big
difficulties mixing the references on the objects to my javacode. This
is why I would need some more documentation with examples that go
deeper into drools capacities.
To give you clues about my plan, here is an example (which works
perfectly in drools 5) that I have developed:
java code - http://drools.pastebin.com/m1a705614
rule code - http://drools.pastebin.com/m3f30cbdc
As you can see I am studying the case where drools is used for the
monitoring of a network of equipments that send alarms about their
problems. But I have big difficulties, because I would like to get
references on the objects of the "forall", and to execute javacode
such as $toto.method($titi, $tata), but such things seems impossible
(systematic failed of compilation)
Could you please help me?
Thank you very much!
Aldian
15 years, 5 months
Updating a Boolean object in the WM
by skasab2s
Hi guys,
I've been desperately trying to update a Boolean object, which is in the
working memory.
I have an initial rule that first inserts it:
rule "Insert initial weanable value" salience 100
when
then
Boolean $weanable = false;
insert($weanable);
end
and then I try to update it:
...
when
$weanable: Boolean( )
...
then
$weanable=true;
update($weanable);
end
Which results to this exception : org.drools.FactException: Update error:
handle not found for object: true. Is it in the working memory?
I checked in the working memory and the Boolean-object was there!
Is it possible to update a boolean that is in the working memory? If not, do
you know some other Java class with setters and getters (behaving as a
drools-fact) that I don't have to create myself and which I can use instead
of Bboolean for this case ?
Thanks in advance!
Svetlomir
--
View this message in context: http://www.nabble.com/Updating-a-Boolean-object-in-the-WM-tp24513225p2451...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
OFBiz entity engine compatibility with Jackrabbit
by Pardeep.Ruhil@lntinfotech.com
Hi,
I am using apache OFBiz which uses Entity engine as a persistence layer.
To know more about Entity engine refer this link
http://ofbiz.apache.org/docs/entity.html
Drools Guvnor uses Jackrabbit as a persistence layaer.
So my question is there a way i can use OFbiz entity engine persistence
layer in Drools guvnor in place of
Jackrabbit.
Is it feasible to do this and if possible how much effort is needed?
Thanks & Regards
Pardeep Ruhil
L&T Infotech Ltd
Mumbai
Ph: +919820283884
Larsen & Toubro Infotech Ltd.
www.Lntinfotech.com
This Document is classified as:
L&T Infotech Proprietary L&T Infotech Confidential L&T Infotech
Internal Use Only L&T Infotech General Business
This Email may contain confidential or privileged information for the
intended recipient (s) If you are not the intended recipient, please do
not use or disseminate the information, notify the sender and delete it
from your system.
______________________________________________________________________
15 years, 5 months