use of org.kie.internal.utils.ChainedProperties in project droolsjbpm-integration by kiegroup.
the class AbstractDMNValidationAwareMojo method computeDMNProfiles.
protected List<DMNProfile> computeDMNProfiles() throws MojoExecutionException {
ClassLoader classLoader = ClassLoaderUtil.findDefaultClassLoader();
ChainedProperties chainedProperties = ChainedProperties.getChainedProperties(classLoader);
List<KieModuleModel> kieModules = new ArrayList<>();
for (Path p : resourcesPaths()) {
try (Stream<Path> walk = Files.walk(p)) {
List<Path> collect = walk.filter(f -> f.toString().endsWith("kmodule.xml")).collect(Collectors.toList());
for (Path k : collect) {
kieModules.add(KieModuleModelImpl.fromXML(k.toFile()));
}
} catch (Exception e) {
throw new MojoExecutionException("Failed executing AbstractDMNValidationAwareMojo while computing DMNProfile(s)", e);
}
}
for (KieModuleModel kmm : kieModules) {
Properties ps = new Properties();
ps.putAll(kmm.getConfigurationProperties());
chainedProperties.addProperties(ps);
}
List<DMNProfile> dmnProfiles = new ArrayList<>();
dmnProfiles.addAll(DMNAssemblerService.getDefaultDMNProfiles(chainedProperties));
try {
Map<String, String> dmnProfileProperties = new HashMap<>();
chainedProperties.mapStartsWith(dmnProfileProperties, DMNAssemblerService.DMN_PROFILE_PREFIX, false);
for (Map.Entry<String, String> dmnProfileProperty : dmnProfileProperties.entrySet()) {
DMNProfile dmnProfile = (DMNProfile) classLoader.loadClass(dmnProfileProperty.getValue()).newInstance();
dmnProfiles.add(dmnProfile);
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new MojoExecutionException("Failed executing AbstractDMNValidationAwareMojo while computing DMNProfile(s)", e);
}
return dmnProfiles;
}
use of org.kie.internal.utils.ChainedProperties in project drools by kiegroup.
the class ClassLevel method findJavaVersion.
private static void findJavaVersion(ClassLoader classLoader) {
ChainedProperties chainedProperties = ChainedProperties.getChainedProperties(classLoader);
if (chainedProperties.getProperty("drools.dialect.java", null) == null) {
chainedProperties = ChainedProperties.getChainedProperties(ClassGenerator.class.getClassLoader());
}
javaVersion = findJavaVersion(chainedProperties);
}
use of org.kie.internal.utils.ChainedProperties in project drools by kiegroup.
the class DMNAssemblerService method getDMNProfiles.
protected List<DMNProfile> getDMNProfiles(KnowledgeBuilderImpl kbuilderImpl) {
ChainedProperties chainedProperties = kbuilderImpl.getBuilderConfiguration().getChainedProperties();
List<DMNProfile> dmnProfiles = new ArrayList<>();
dmnProfiles.addAll(getDefaultDMNProfiles(chainedProperties));
Map<String, String> dmnProfileProperties = new HashMap<>();
chainedProperties.mapStartsWith(dmnProfileProperties, DMN_PROFILE_PREFIX, false);
if (!dmnProfileProperties.isEmpty()) {
try {
for (Map.Entry<String, String> dmnProfileProperty : dmnProfileProperties.entrySet()) {
DMNProfile dmnProfile = (DMNProfile) kbuilderImpl.getRootClassLoader().loadClass(dmnProfileProperty.getValue()).newInstance();
dmnProfiles.add(dmnProfile);
}
return dmnProfiles;
} catch (Exception e) {
kbuilderImpl.addBuilderResult(new DMNKnowledgeBuilderError(ResultSeverity.WARNING, "Trying to load a non-existing Kie DMN profile " + e.getLocalizedMessage()));
logger.error("Trying to load a non-existing Kie DMN profile {}", e.getLocalizedMessage(), e);
kbuilderImpl.addBuilderResult(new DMNKnowledgeBuilderError(ResultSeverity.WARNING, "DMN Compiler configuration contained errors, will fall-back using empty-configuration compiler."));
logger.warn("DMN Compiler configuration contained errors, will fall-back using empty-configuration compiler.");
}
}
return dmnProfiles;
}
use of org.kie.internal.utils.ChainedProperties in project jbpm by kiegroup.
the class EmailDeadlinesBaseTest method setup.
public void setup() {
final ChainedProperties props = ChainedProperties.getChainedProperties("email.conf", ClassLoaderUtil.getClassLoader(null, getClass(), false));
wiser = new Wiser();
wiser.setHostname(props.getProperty("mail.smtp.host", "localhost"));
wiser.setPort(Integer.parseInt(props.getProperty("mail.smtp.port", "2345")));
wiser.start();
try {
Thread.sleep(1000);
} catch (Throwable t) {
// Do nothing
}
}
Aggregations