Just look to Properties documentation. You can set property from java
too. Something like:
Properties properties = new Properties();
properties.load(new FileInputStream(module2PropertiesFilePath));
properties.setProperty("url", "http://MyURL...")
RuleAgent agent = RuleAgent.newRuleAgent(properties);
....
Pavel
On Wed, Jul 14, 2010 at 11:58 AM, Dinesh kumar <dinp87(a)gmail.com> wrote:
Hi,
Need help in integrating guvnor with my java application.
I have the set rules to executed for a particular module as individual
packages within guvnor. To fire these rules, I have separate properties file
specifying the URL of each package and mention it within the application as
below.
For module1:
Properties properties = new Properties();
properties.load(new FileInputStream(module1PropertiesFilePath));
RuleAgent agent = RuleAgent.newRuleAgent(properties);
RuleBase ruleBase = agent.getRuleBase();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.insert(module1Object);
workingMemory.fireAllRules();
For module2:
Properties properties = new Properties();
properties.load(new FileInputStream(module2PropertiesFilePath));
RuleAgent agent = RuleAgent.newRuleAgent(properties);
RuleBase ruleBase = agent.getRuleBase();
WorkingMemory workingMemory = ruleBase.newStatefulSession();
workingMemory.insert(module2Object);
workingMemory.fireAllRules();
My properties file looks like this. There will be one properties file for
each module.
##
## RuleAgent configuration file example
##
#setting this means the rulebase will be created fresh whenever there are
#changes
newInstance=true
#this points to a binary compiled rule package, you can have spaces
#seperating multiple files
#file=/foo/bar/boo.pkg /foo/bar/boo2.pkg
#this specifies that packages may appear in a directory
#it will pick up whatever files are dumped in there (.pkg files like above)
#dir=/my/dir
#this specifies a list of urls for packages - these urls
#are those that are exposed by the BRMS
url=
http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Modu...
#the following can be used with the urls to keep a local cache
#so if the runtime server is restarted, the BRMS does not need
#to be available
#localCacheDir=
#this specifies the frequency at which the sources will be checked for
#changes (in seconds). If you don't set this, it will mean that you have
#to manually poll
poll=30
#this specifies the name of this config, necessary in case logging is used.
name=MyConfig
Instead of specifying the url in the properties file, can i directly have
the url in my java..
How to directly specify the url in java instead of using properties file?
Any suggestions will be of great help..
Regards,
Dinesh
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Rules-integration-wit...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users