-
-
Save pmuir/579397 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Drools(kbuilderConfigFile = "kbuilderconfig.properties", | |
kbaseConfigFile = "kbaseconfig.properties", | |
}) | |
@Produces | |
@ApplicationScoped | |
RuleResouces configureRules() { | |
// Here the RuleResource guesses at being a DRL based on extension (not sure if this is valid) | |
// I also compressed the URL back to a normal syntax | |
return new RuleResources().add(new RuleResource("classpath:/kbasetest.drl", "forkbasetest")).add(...); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Generic(Drools.class) | |
public class KnowledgeProducer | |
{ | |
private static final Logger log = LoggerFactory.getLogger(KnowledgeSessionProducer.class); | |
@Inject | |
BeanManager manager; | |
@Inject | |
DroolsExtension droolsExtension; | |
@Inject | |
ResourceProvider resourceProvider; | |
@Inject | |
SeamDelegate delegate; | |
@Inject | |
DroolsConfig config; | |
@Inject | |
DroolsConfigUtil configUtils; | |
@Inject @GenericProduct | |
RuleResources ruleResources; | |
private KnowledgeBase kbase; | |
@PostConstruct | |
public void init() { | |
this.kbase = initKbase(); | |
} | |
@Produces | |
@RequestScoped | |
public StatefulKnowledgeSession produceStatefulSession() throws Exception | |
{...} | |
@Produces | |
public KnowledgeBase produceKnowledgeBase() throws Exception | |
{ | |
return kbase; | |
} | |
...} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Generic(Drools.class) | |
class RuleResources { | |
Iterator<RuleResource> iterator() {...} | |
RuleResources add(RuleResource ruleResource) {...} | |
RuleResources addAll(RuleResource... ruleResources) {...} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment