KnowledgePackageImp and org.drools.rulePackage are not in the
"stable" part of the API, but this is how:

KnowledgePackage kPackage = ...;
KnowledgePackageImp kPackageImp = (KnowledgePackageImp)kPackage;
org.drools.rule.Package package_ = kPackageImp.pkg;

// globals: key is name, value is type name
Map<String, String> name2global = package_.getGlobals();

I have frequently urged for everything that can be written in DRL to be
accessible though the "stable" API. It can't be "unstable" if it is in the
DRL language, right?

-W


2011/2/9 Michael Anstis <michael.anstis@gmail.com>
Mark, Edson, (Wolfgang?)

Any public API to ascertain whether a DRL package needs a global to be inserted?

E.G. a DRL has global defined within it, the DRL is loaded into a KnowledgePackage, can you introspect the package to find out if it contains a global, it's datatype and name?

With kind regards,

Mike

On 9 February 2011 17:10, gs76pl <gstasica@pacemetrics.com> wrote:

yeah,,, thats exactly what i need
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/how-to-check-if-a-global-has-been-declared-in-a-rule-tp2459143p2459883.html
Sent from the Drools - User mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users