[rules-users] Basic questions about rule deployment

Fermion henss at physik.uni-wuppertal.de
Wed Oct 10 11:40:47 EDT 2007


Hi,

I've finished my first small application using JBoss Rules. My current
deployment "strategy" is that I want to have a single executable .jar file
containing my application and an external (not included in the .jar) folder
that contains the rules that should be used.

Unfortunately, this seems to be harder, than I thought, as my application
refuses to use .drl or .dsl files that are outside of the package.

I'm quite sure that it's just my misunderstanding of the manual that leads
to the problem, as this seems to be one of the most basic deployment
approaches, as stated by the manual:

"
Chapter 7. Deployment and Testing
7.1. Deployment options

Once you have rules integrated in your application (or ideally before) you
will need to plan how to deploy rules along with your application. Typically
rules are used to allow changes to application business logic without
re-deploying the whole application. This means that the rules must be
provided to the application as data, not as part of the application (eg
embedded in the classpath).
"

Unfortunately I have quite some problems understanding the rest of the
chapter. So I just used and modified on of the given examples.

CODE/*

//read in the source
Reader source = new
InputStreamReader(JBossRules.class.getResourceAsStream(KNOWLEDGE_FILE));
			
//read in the DSL
Reader dsl = new
InputStreamReader(JBossRules.class.getResourceAsStream(DOMAINSPECIFICLANGUAGE_FILE));
		
//Use package builder to build up a rule package.
//An alternative lower level class called "DrlParser" can also be used...
PackageBuilder builder = new PackageBuilder();
	
//Use the following instead of above if you are using a DSL:
builder.addPackageFromDrl(source, dsl);

*/CODE

If I use

KNOWLEDGE_FILE = "/Rules_withDsl.drl";
DOMAINSPECIFICLANGUAGE_FILE = "/Rules_withDsl.dsl";

it all works wonderfully... but then the rules are within my .jar :-(

So I tried to change this into a folder outside the package:

KNOWLEDGE_FILE = "C:/test/Rules_withDsl.drl";
DOMAINSPECIFICLANGUAGE_FILE = "C:/test/Rules_withDsl.dsl";

Now, it doesn't work any more, because the "getResourceAsStream" returns
null pointers...

Any idea?

Thanks
-- 
View this message in context: http://www.nabble.com/Basic-questions-about-rule-deployment-tf4601653.html#a13138467
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list