use of org.drools.compiler.lang.dsl.DSLMappingFile in project drools-wb by kiegroup.
the class GuidedRuleDslrFileIndexer method getDSLExpander.
/**
* Returns an expander for DSLs (only if there is a DSL configured for this package).
* @param path The {@link Path} of the resource to index
* @return a {@link Expander} used to produce a DRL of the file
*/
public Expander getDSLExpander(final Path path) {
final Expander expander = new DefaultExpander();
final List<DSLMappingFile> dsls = getDSLMappingFiles(path);
for (DSLMappingFile dsl : dsls) {
expander.addDSLMapping(dsl.getMapping());
}
return expander;
}
use of org.drools.compiler.lang.dsl.DSLMappingFile in project drools-wb by kiegroup.
the class GuidedRuleTemplateSourceService method getDSLMappingFiles.
private List<DSLMappingFile> getDSLMappingFiles(final Path path) {
final List<DSLMappingFile> dsls = new ArrayList<DSLMappingFile>();
final org.uberfire.backend.vfs.Path vfsPath = Paths.convert(path);
final org.uberfire.backend.vfs.Path packagePath = moduleService.resolvePackage(vfsPath).getPackageMainResourcesPath();
final org.uberfire.java.nio.file.Path nioPackagePath = Paths.convert(packagePath);
final Collection<Path> dslPaths = fileDiscoveryService.discoverFiles(nioPackagePath, FILTER_DSLS);
for (final org.uberfire.java.nio.file.Path dslPath : dslPaths) {
final String dslDefinition = ioService.readAllString(dslPath);
final DSLTokenizedMappingFile dslFile = new DSLTokenizedMappingFile();
try {
if (dslFile.parseAndLoad(new StringReader(dslDefinition))) {
dsls.add(dslFile);
} else {
logger.error("Unable to parse DSL definition: " + dslDefinition);
}
} catch (IOException ioe) {
logger.error(ioe.getMessage());
}
}
return dsls;
}
use of org.drools.compiler.lang.dsl.DSLMappingFile in project drools-wb by kiegroup.
the class GuidedDecisionTableSourceService method getDSLExpander.
/**
* Returns an expander for DSLs (only if there is a DSL configured for this package).
*/
private Expander getDSLExpander(final Path path) {
final Expander expander = new DefaultExpander();
final List<DSLMappingFile> dsls = getDSLMappingFiles(path);
for (DSLMappingFile dsl : dsls) {
expander.addDSLMapping(dsl.getMapping());
}
return expander;
}
use of org.drools.compiler.lang.dsl.DSLMappingFile in project drools-wb by kiegroup.
the class GuidedRuleDslrFileIndexer method getDSLMappingFiles.
private List<DSLMappingFile> getDSLMappingFiles(final Path path) {
final List<DSLMappingFile> dsls = new ArrayList<DSLMappingFile>();
final org.uberfire.backend.vfs.Path vfsPath = Paths.convert(path);
final org.uberfire.backend.vfs.Path packagePath = moduleService.resolvePackage(vfsPath).getPackageMainResourcesPath();
final Path nioPackagePath = Paths.convert(packagePath);
final Collection<Path> dslPaths = fileDiscoveryService.discoverFiles(nioPackagePath, FILTER_DSLS);
for (final Path dslPath : dslPaths) {
final String dslDefinition = ioService.readAllString(dslPath);
final DSLTokenizedMappingFile dslFile = new DSLTokenizedMappingFile();
try {
if (dslFile.parseAndLoad(new StringReader(dslDefinition))) {
dsls.add(dslFile);
} else {
logger.error("Unable to parse DSL definition: " + dslDefinition);
}
} catch (IOException ioe) {
logger.error(ioe.getMessage());
}
}
return dsls;
}
use of org.drools.compiler.lang.dsl.DSLMappingFile in project drools-wb by kiegroup.
the class GuidedRuleTemplateSourceService method getDSLExpander.
/**
* Returns an expander for DSLs (only if there is a DSL configured for this package).
*/
private Expander getDSLExpander(final Path path) {
final Expander expander = new DefaultExpander();
final List<DSLMappingFile> dsls = getDSLMappingFiles(path);
for (DSLMappingFile dsl : dsls) {
expander.addDSLMapping(dsl.getMapping());
}
return expander;
}
Aggregations