The KIEFileSystem is an in-memory filesystem, so what you are doing is
correct.
You will have to set at least two more properties of the resource:
1) the sourcePath - e.g. "foo/myRule.drl" will eventually place the rule
"file" in the virtual
src/main/resources/foo folder, where it will be picked up by the builder
2) the resource type, e.g. ResourceType.DRL
Unfortunately, the API-based, incremental build process in 6.0 final has
a few issues
and may not always work as expected. It is being fixed even now, but you
may have
to rebuild and update your full virtual jar every time you want to
modify the
knowledge base. See the test class IncrementalCompilationTest in the
source code
and the drools examples, and feel free to ask for more clarifications
Best
Davide
On 12/03/2013 01:25 AM, pmander wrote:
I head previously read that but didn't spot the bit that mentions
creating
from a drl defined as a String. I take it this can be done from
KieFileSystem.
String rules = ...
KieFileSystem kfs = kieServices.newKieFileSystem();
kfs.write(kieServices.getResources().newReaderResource(new
StringReader(rules)));
This throws an exception complaining that the resource doesn't have a source
or target path set.
Is there a way to push a dynamically created drl into this without writing
it to disk first?
--
View this message in context:
http://drools.46999.n3.nabble.com/drools-6-equivalent-of-addKnowledgePack...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users