[rules-users] Dynamic Loading of Rules from BRMS

Esteban Aliverti esteban.aliverti at gmail.com
Sun Jun 27 18:24:54 EDT 2010


Can I just point the URL to my package in the jboss-brms which I need to
access instead of specifying each rule?
Yes you can. If you are accessing the binary representation of your package,
you need to use PKG resource type.

And if I end up adding a new rule at runtime without modifying an existing
rule it should also be detected right?
Yes. Always that Knowledge Agent is working as expected :P

Best,

2010/6/27 Mahalakshmi <mr2809 at nyu.edu>

> Hi,
>
> Thanks for the quick response.
>
> Can I just point the URL to my package in the jboss-brms which I need to
> access instead of specifying each rule?
>
> And if I end up adding a new rule at runtime without modifying an existing
> rule it should also be detected right?
>
> thank you.
> Jill
>
>
> 2010/6/27 Esteban Aliverti <esteban.aliverti at gmail.com>
>
> Hi,
>> When you execute:
>> kagent.applyChangeSet( ResourceFactory.newUrlResource("
>> http://localhost:8280/jboss-brms/org.drools.guvnor.Guvnor/Guvnor.html"));
>>
>> you need to point to your change-set.xml file and not to guvnor.
>>
>> Inside you change-set you need to point to each resource you want the
>> agent take care of. In your example the first two resources have the same
>> URL. It doesn't look right.
>>
>> Best,
>>
>> 2010/6/27 jillika iyer <jillika at gmail.com>
>>
>>>  hi guys,
>>>
>>> I am trying to upload my rules from jboss-brms to my eclipse in order to
>>> run it against the working memory.
>>> The following is my code and change-set.xml file and I am getting the
>>> following error stack ( which is a java error but just attaching it for
>>> giving more info).
>>>
>>>
>>> I have started the jboss-server and it is connected correctly.
>>>
>>> I am getting a java based error which says that it is unable to parse
>>> change-set.xml and unable to connect to the server.
>>>
>>> I just want to know if I am not the right path for creating the required
>>> change-set.xml file due to which I am getting the java connection error.
>>>
>>>
>>> I have just specified the url path in my change-set file and the types of
>>> files it should be looking out for.
>>>
>>> What else do I need to incorporate for it to connect to the server???
>>>
>>> Please help me. I am relatively new to Drools.
>>>
>>> Code in my Runner class:
>>>
>>> KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
>>>         ResourceFactory.getResourceChangeScannerService().start();
>>>         ResourceFactory.getResourceChangeNotifierService().start();
>>>
>>>         // creating a knowledge agent
>>>         KnowledgeAgentConfiguration aconf =
>>> KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
>>>
>>>         KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent(
>>> "MyAgent", kbase,aconf );
>>>         kagent.applyChangeSet( ResourceFactory.newUrlResource("
>>> http://localhost:8280/jboss-brms/org.drools.guvnor.Guvnor/Guvnor.html
>>> "));
>>>         StatefulKnowledgeSession ksession =
>>> kagent.getKnowledgeBase().newStatefulKnowledgeSession();
>>>
>>>   //      StatelessSession workingMemory =
>>> ruleBase.newStatelessSession();
>>>         ArrayList<Ip> ipList = new ArrayList<Ip>();
>>>
>>>         ksession.setGlobal("ipList", ipList);
>>>         ksession.insert(al);
>>>         ksession.fireAllRules();
>>>         ksession.dispose();
>>>
>>>
>>>
>>> my change-set.xml file:
>>>
>>>  <change-set xmlns='http://drools.org/drools-5.0/change-set'
>>>              xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
>>>              xs:schemaLocation='
>>> http://drools.org/drools-5.0/change-set.xsd' >
>>>    <add>
>>>    <!-- Add for specifying URLs-->
>>>        <resource source='http://localhost:8280/jboss-brms' type='DRL' />
>>>        <resource source='http://localhost:8280/jboss-brms' type='DSLR'
>>> />
>>>        <resource source='
>>> http://localhost:8280/jboss-brmss/sample-dsl.dsl' type='DSL' />";
>>>        <resource source='http://localhost:8280/jboss-brms' type='BRL' />
>>>    </add>
>>>  </change-set>
>>>
>>>
>>>
>>>
>>> error stack:
>>>
>>> java.lang.RuntimeException: Unable to parse ChangeSet
>>>     at
>>> org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:223)
>>>     at
>>> org.drools.agent.impl.KnowledgeAgentImpl.applyChangeSet(KnowledgeAgentImpl.java:109)
>>>     at com.org.RuleRunner.runStatelessRules(RuleRunner.java:156)
>>>     at com.org.RulesTest.main(RulesTest.java:38)
>>> Caused by: java.net.SocketException: Network is unreachable: connect
>>>     at java.net.PlainSocketImpl.socketConnect(Native Method)
>>>     at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
>>>     at
>>> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
>>>     at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
>>>     at java.net.Socket.connect(Socket.java:524)
>>>     at java.net.Socket.connect(Socket.java:474)
>>>     at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
>>>     at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
>>>     at sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
>>>     at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
>>>     at sun.net.www.http.HttpClient.New(HttpClient.java:304)
>>>     at sun.net.www.http.HttpClient.New(HttpClient.java:321)
>>>     at
>>> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:839)
>>>     at
>>> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:791)
>>>     at
>>> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:716)
>>>     at
>>> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:960)
>>>     at
>>> com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:973)
>>>     at
>>> com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:905)
>>>     at
>>> com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:872)
>>>     at
>>> com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:282)
>>>     at
>>> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XMLDocumentScannerImpl.java:1021)
>>>     at
>>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>>>     at
>>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>>>     at
>>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>>>     at
>>> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>>>     at
>>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>>>     at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>>>     at
>>> org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:255)
>>>     at
>>> org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:170)
>>>     at org.drools.xml.XmlChangeSetReader.read(XmlChangeSetReader.java:48)
>>>     at
>>> org.drools.agent.impl.KnowledgeAgentImpl.getChangeSet(KnowledgeAgentImpl.java:221)
>>>     ... 3 more
>>>
>>> Please help me.
>>>
>>> Thank you
>>> Jill
>>>
>>>
>>> _______________________________________________
>>> rules-users mailing list
>>> rules-users at lists.jboss.org
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>
>>
>> --
>> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>>
>> Esteban Aliverti
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100627/d8eccd93/attachment.html 


More information about the rules-users mailing list