[rules-users] Upload Rules to BRMS at runtime
David Sinclair
dsinclair at chariotsolutions.com
Fri Oct 3 09:52:29 EDT 2008
Micheal is right in that using RMI more tightly couples you to the
underlying asset object model, but it also gives you a lot of flexibility.
For instance, every time our object model changes, as part of the build
process, the package is created/updated to include the updated JARS, updated
header section, and updated code for the enumerations. It will then validate
the package, build it, and create a new snapshot with the version of the
model.
To Micheal's point, I had to update my code to handle the change in the way
header is stored in BRMS vs. Guvnor. In BRMS it was a property on the
PackageItem, but now it is an AssetItem in the package.
Here is a sample of connecting to the JCR, then using said session with the
Drools API
// THIS first part is JackRabbit's RMI code
ClientRepositoryFactory factory = new ClientRepositoryFactory();
Repository repository = factory.getRepository(rmiURL);
Session session = repository.login(new SimpleCredentials(username,
password.toCharArray()));
// THIS IS DROOLS API
RulesRepository rulesRepository = new RulesRepository(session);
With the rulesRepository, you can than get packages out
PackageIterator iterator = rulesRepository.listPackages();
Create a new package
rulesPackage = rulesRepository.createPackage(packageName, packageName);
and so on...
On Fri, Oct 3, 2008 at 6:13 AM, Asif Akram <asif.akram at imperial.ac.uk>wrote:
> Hi Dave,
>
> Is it possible to share the code snippet with us. I don't have any
> experience of Jackrabbit and RMI. Any concrete example will be helpful.
>
> Cheers
> Asif
>
> David Sinclair wrote:
>
>> Hi Leo,
>>
>> I use the Drools API to interact with the JCR with I expose over RMI. I
>> have the security on Jackrabbit, so I log into the JCR, not BRMS. But once
>> the session is established I use the org.drools.repository.RulesRepository
>> to work with BRMS artifcacts as opposed to JCR ones.
>>
>> hope that makes sense,
>>
>> dave
>>
>> On Thu, Oct 2, 2008 at 3:48 PM, Leonardo Figueiredo <leo.lists at gmail.com<mailto:
>> leo.lists at gmail.com>> wrote:
>>
>> Hi David,
>>
>> You mean going around Drools Api and acessing the JCR directly?
>>
>> I really wanted the BRMS to expose an interface to add things.
>> That would provide more security on upgrading versions without
>> breaking functionality.
>>
>> Regards,
>> Leo
>>
>> On Thu, Oct 2, 2008 at 11:58 AM, David Sinclair
>> <dsinclair at chariotsolutions.com
>> <mailto:dsinclair at chariotsolutions.com>> wrote:
>>
>> Guys,
>>
>> I use the Drools API over RMI. Jackrbait provides an RMI
>> implementation to manipulate the JCR, and the Drools
>> RulesRepository class works with an open JCR session object.
>> Really is a pieice of cake; that is if an RMI solution is ok
>> with you. You can always go RMI over HTTP too.
>>
>> dave
>>
>>
>> On Thu, Oct 2, 2008 at 2:43 AM, Asif Akram
>> <asif.akram at imperial.ac.uk <mailto:asif.akram at imperial.ac.uk>>
>> wrote:
>>
>> Hi Leo,
>>
>> Thanks for your reply. You are absolutely correct, I
>> was talking about API to upload rules, either using
>> Restlet API or WebDav Client API or Drools API. I have
>> read the article mentioning the support for Restlet Web
>> Services and Webdav but haven't seen any such example yet.
>> If only Drools Guvnor supports such features, I am fine
>> with Drools 5.0.
>>
>> Leo, it will be be nice of you if you can share your
>> homemade customized Servlet. Your sharing of ideas and
>> experience will be appreciated.
>>
>> Cheers
>> Asif
>>
>>
>> Leonardo Figueiredo wrote:
>>
>> Hi,
>>
>> You mean using an api to add rules to the BRMS? If so
>> i have the same problem. I am using an "homemade"
>> build that have a custom Servlet that allows me to
>> pass an DRL to be added to the BRMS.
>>
>> I am still searching for a better solution.
>>
>>
>> Regards,
>> Leo
>>
>>
>>
>> On Wed, Oct 1, 2008 at 7:00 AM, Asif Akram
>> <asif.akram at imperial.ac.uk
>> <mailto:asif.akram at imperial.ac.uk>
>> <mailto:asif.akram at imperial.ac.uk
>> <mailto:asif.akram at imperial.ac.uk>>> wrote:
>>
>> Hi,
>>
>> I was wondering if it is possible to create and
>> upload rules at
>> runtime to BRMS to be accessed by other users. I
>> have only seen
>> the examples where existing packages/rules are
>> loaded from the
>> BRMS. Any help and suggestion will be appreciated.
>>
>> Cheers
>> Asif
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> <mailto:rules-users at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> -- This message has been scanned for viruses and
>> dangerous content by WATEEN TELECOM, and is
>> believed to be clean.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org
>> <mailto:rules-users at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users at lists.jboss.org <mailto: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
>>
>>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by WATEEN TELECOM, and is
> believed to be clean.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081003/4943baa1/attachment.html
More information about the rules-users
mailing list