Package org.drools.lang.descr

Examples of org.drools.lang.descr.PackageDescr


            fillSuperType( typeDescr,
                           packageDescr );

            if ( !typeDescr.getNamespace().equals( packageDescr.getNamespace() ) ) {
                // If the type declaration is for a different namespace, process that separately.
                PackageDescr altDescr = new PackageDescr( typeDescr.getNamespace() );
                altDescr.addTypeDeclaration( typeDescr );
                for ( ImportDescr imp : packageDescr.getImports() ) {
                    altDescr.addImport( imp );
                }
                if ( getPackageRegistry().containsKey( altDescr.getNamespace() ) ) {
                    mergePackage( altDescr );
                } else {
                    newPackage( altDescr );
                }
            }
View Full Code Here


        String packageName = compiler.getPackageName();

        PackageRegistry pkgReg = pkgBuilder.getPackageRegistry(packageName);
        if (pkgReg == null) {
            pkgBuilder.addPackage(new PackageDescr(packageName));
            pkgReg = pkgBuilder.getPackageRegistry(packageName);
        }

        String source = compiler.generateSource();
        String generatedSourceName = compiler.getName();
View Full Code Here

       
       
        functionDescr.setText( ((org.w3c.dom.Text)list.item( 0 ).getChildNodes().item( 0 )).getWholeText() );

        final PackageDescr packageDescr = (PackageDescr) parser.getData();

        packageDescr.addFunction( functionDescr );

        return functionDescr;
    }
View Full Code Here

    private Resource resource;

    private PackageDescrBuilderImpl() {
        super( null,
               new PackageDescr() );
    }
View Full Code Here

     * @throws IOException
     */
    public void addPackageFromDrl( final Reader reader, final Resource sourceResource ) throws DroolsParserException, IOException {
        this.resource = sourceResource;
        final DrlParser parser = new DrlParser();
        final PackageDescr pkg = parser.parse( reader );
        this.results.addAll( parser.getErrors() );
        if (pkg == null) {
            this.results.add( new ParserError( sourceResource, "Parser returned a null Package", 0, 0 ) );
        }

View Full Code Here

    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;
View Full Code Here

        addPackage( drlToPackageDescr(resource) );
        this.resource = null;
    }

    PackageDescr drlToPackageDescr(Resource resource) throws DroolsParserException, IOException {
        PackageDescr pkg;
        boolean hasErrors = false;
        if (resource instanceof DescrResource) {
            pkg = (PackageDescr) ( (DescrResource) resource ).getDescr();
        } else {
            final DrlParser parser = new DrlParser();
View Full Code Here

     */
    public void addPackageFromDrl( final Reader source, final Reader dsl ) throws DroolsParserException, IOException {
        this.resource = new ReaderResource( source, ResourceType.DSLR );

        final DrlParser parser = new DrlParser();
        final PackageDescr pkg = parser.parse( source, dsl );
        this.results.addAll( parser.getErrors() );
        if (!parser.hasErrors()) {
            addPackage( pkg );
        }
        this.resource = null;
View Full Code Here

        this.resource = null;
    }

    PackageDescr dslrToPackageDescr(Resource resource) throws DroolsParserException {
        boolean hasErrors;
        PackageDescr pkg;

        DrlParser parser = new DrlParser();
        DefaultExpander expander = getDslExpander();

        Reader reader = null;
View Full Code Here

                if (expander.hasErrors())
                    this.results.addAll( expander.getErrors() );
            }
        }

        PackageDescr pkg = parser.parse( knowledge );
        if (parser.hasErrors()) {
            this.results.addAll( parser.getErrors() );
            return null;
        }
        return pkg;
View Full Code Here

TOP

Related Classes of org.drools.lang.descr.PackageDescr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.