map.put(kBaseQualifier, list);
}
}
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
CompositeKnowledgeBuilder ckbuilder = kbuilder.batch();
for ( Map.Entry<Class, List<String>> entry : map.entrySet() ) {
Class cls = entry.getKey();
List<String> files = entry.getValue();
if ( !files.isEmpty() ) {
for ( String file : files ) {
if ( file.endsWith(".drl" ) ) {
ckbuilder.add( ResourceFactory.newUrlResource( cls.getResource("/" + file.trim()) ), ResourceType.DRL );
}
}
}
}
ckbuilder.build();
if ( kbuilder.hasErrors() ) {
throw new RuntimeException( "Unable to compile " + kBaseQualifiers[0].getName() + ":\n" + kbuilder.getErrors() );
}