Object ruleScript = description.getRuleSource();
Map<String, Object> properties = PropertyDescriptionEvaluator.evaluate(
description.getCreationProperties());
InputStream in = ObjectToStreamConverter.toInputStream(ruleScript, properties);
if (in == null) {
throw new LoggedRuntimeException("The input stream form rule script is null.",
log);
}
ResourceTypeDetectionStrategy strategy = new DefaultResourceTypeDetectionStrategy();
ResourceType resourceType = strategy.getResourceType(properties);
knowledgeBuilder.add(ResourceFactory.newInputStreamResource(in), resourceType);
if (knowledgeBuilder.hasErrors()) {
throw new LoggedRuntimeException("Error during creating rule set: " +
knowledgeBuilder.getErrors(), log);
}
Collection<KnowledgePackage> pkgs = knowledgeBuilder.getKnowledgePackages();
knowledgeBase.addKnowledgePackages(pkgs);