So I'm playing with Drools in Equinox OSGi, and so far it's behaving quite
nicely - one bit of weirdness though.
What I'm trying to do:
I have a bundle with a 'flow manager' that listens for instances of
WorkItemHandler in the service broker (well, really my own subinterface that
has a getName method). It also listens for new bundles with a
META-INF/drools directory with *.rf files in them, and parses the .rf files
it finds there.
The Flow Manager is itself published as an OSGI Service with a 'perform'
method. It encapsulates all of its Drools calls within the perform method
though - they aren't exposed to clients.
My test involves a simple start->work item->end workflow.
I pass in an instance of a class "Tablex" that can be saved to hibernate. I
also pass in a String that has the table name, and an empty List to get the
results.
My .rf file tries to import Tablex. It declares the three values I mention
above, and maps them to the work item in the work item definition.
<p>
<imports>
<import name="my.pkg.Tablex" />
</imports>
...
<variable name="my.pkg.newrecord" >
<type
name="org.drools.process.core.datatype.impl.type.ObjectDataType"
className="my.pkg.Tablex"/>
</variable>
...
<workItem id="2" name="DBWorkItem" x="165"
y="374" width="80"
height="40" >
<work name="DBWorkItem" >
</work>
<mapping type="in" from="my.pkg.tablename"
to="my.pkg.tablename" />
<mapping type="in" from="my.pkg.newrecord"
to="my.pkg.newrecord"/>
<mapping type="in" from="my.pkg.outlist"
to="my.pkg.outlist"/>
</workItem>
</p>
In my manifest for my .rf file and for the flow manager (where the parsing
occurs) I Import-Package Tablex's package.
When my flow manager tries parsing the rule, it gives an error saying the
the import failed. BUT, everything still works, and my WorkItemHandler works
correctly (the WorkItemHandler imports Tablex itself, since it needs to
manipulate it).
If I declare my Tablex variable as a java.util.Object in the ruleflow then I
don't get the error and things also still work.
If I declare my Tablex as Tablex in the rule flow AND import it in the class
that does the parsing (it's already 'OSGI' imported to the parsing bundle,
but now I'm doing a plain old Java import on it) then everything works fine
with no error message.
Kind of a hybrid question but I figured I'd start with the Drools folks.
Any ideas would be appreciated.
Thanks,
Mike
--
View this message in context:
http://www.nabble.com/OSGI%2C-classloading%2C-and-imports-in-KnowledgeBui...
Sent from the drools - user mailing list archive at
Nabble.com.