01: package org.drools.base.mvel;
02:
03: import java.io.Serializable;
04:
05: import org.drools.rule.Declaration;
06: import org.drools.spi.KnowledgeHelper;
07: import org.mvel.integration.VariableResolver;
08:
09: public class DroolsMVELKnowledgeHelper implements VariableResolver,
10: Serializable {
11:
12: private DroolsMVELFactory factory;
13: public static final String DROOLS = "drools";
14:
15: public DroolsMVELKnowledgeHelper(final DroolsMVELFactory factory) {
16: this .factory = factory;
17: }
18:
19: public String getName() {
20: return DROOLS;
21: }
22:
23: public Class getKnownType() {
24: return KnowledgeHelper.class;
25: }
26:
27: public Object getValue() {
28: return this .factory.getKnowledgeHelper();
29: }
30:
31: public void setValue(final Object value) {
32: throw new UnsupportedOperationException(
33: "External Variable identifer='" + getName()
34: + "' type='" + getKnownType()
35: + "' is final, it cannot be set");
36: }
37:
38: public int getFlags() {
39: return 0;
40: }
41:
42: /**
43: * Not used in drools.
44: */
45: public Class getType() {
46: return KnowledgeHelper.class;
47: }
48:
49: /**
50: * Not used in drools.
51: */
52: public void setStaticType(Class arg0) {
53: }
54:
55: }
|