PackageDescr decisionTableToPackageDescr(Resource resource, ResourceConfiguration configuration) throws DroolsParserException, IOException { DecisionTableConfiguration dtableConfiguration = (DecisionTableConfiguration) configuration; String string = DecisionTableFactory.loadFromInputStream( resource.getInputStream(), dtableConfiguration ); DrlParser parser = new DrlParser(); PackageDescr pkg = parser.parse( new StringReader( string ) ); this.results.addAll( parser.getErrors() ); if (pkg == null) { this.results.add( new ParserError( resource, "Parser returned a null Package", 0, 0 ) ); } return parser.hasErrors() ? null : pkg; }
PackageDescr pmmlModelToPackageDescr( PMMLCompiler compiler, Resource resource ) throws DroolsParserException, IOException { String theory = compiler.compile(resource.getInputStream(), getPackageRegistry()); if ( ! compiler.getResults().isEmpty() ) { this.results.addAll( compiler.getResults() ); return null; } DrlParser parser = new DrlParser(); PackageDescr pkg = parser.parse( new StringReader( theory ) ); this.results.addAll( parser.getErrors() ); if ( pkg == null ) { this.results.add( new ParserError( resource, "Parser returned a null Package", 0, 0 ) ); return pkg; } else { return parser.hasErrors() ? null : pkg; } }
public PackageDescr parse(final boolean isEditor, final Resource resource) throws DroolsParserException, IOException { this.resource = resource; InputStream is = resource.getInputStream(); String encoding = null; if (resource instanceof ClassPathResource) { encoding = ((ClassPathResource) resource).getEncoding(); } if (resource instanceof ReaderResource) { encoding = ((ReaderResource) resource).getEncoding(); } if (resource instanceof InputStreamResource) { encoding = ((InputStreamResource) resource).getEncoding(); } final DRLParser parser = getParser( is, encoding ); return compile( isEditor, parser ); }
Collection<KnowledgePackage> kpkgs = null; try { is = resource.getInputStream(); ClassLoader classLoader = null; if ( this.isUseKBaseClassLoaderForCompiling() ) {
void addPackageFromInputStream(final Resource resource) throws IOException, ClassNotFoundException { InputStream is = resource.getInputStream(); Object object = DroolsStreamUtils.streamIn(is, this.configuration.getClassLoader()); is.close();