Examples of MVELDialectRuntimeData


Examples of org.drools.rule.MVELDialectRuntimeData

            MVELSalienceExpression expr = new MVELSalienceExpression( unit,
                                                                      dialect.getId() );
            context.getRule().setSalience( expr );
           
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) context.getPkg().getDialectRuntimeRegistry().getDialectData( "mvel" );
            data.addCompileable( context.getRule(),
                                 expr );
           
            expr.compile( data );
        } catch ( final Exception e ) {
            copyErrorLocation(e, context.getRuleDescr());
View Full Code Here

Examples of org.drools.rule.MVELDialectRuntimeData

                                                                                              type.getTypeClass().getName(),
                                                                                              timestamp,
                                                                                              type.isTypesafe(),
                                                                                              results.getReturnType() );

                MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( "mvel" );
                data.addCompileable( (MVELCompileable) reader );
                ( (MVELCompileable) reader ).compile( data );
                type.setTimestampExtractor( reader );
            } else {
                this.results.add( new TypeDeclarationError( typeDescr,
                                                            "Error creating field accessors for timestamp field '" + timestamp +
                                                            "' for type '" +
                                                            type.getTypeName() +
                                                            "'" ) );
            }
        }

        annotationDescr = typeDescr.getAnnotation( TypeDeclaration.ATTR_DURATION );
        String duration = ( annotationDescr != null ) ? annotationDescr.getSingleValue() : null;
        if (duration != null) {
            type.setDurationAttribute( duration );
            Package pkg = pkgRegistry.getPackage();
           
            MVELDialect dialect = ( MVELDialect ) pkgRegistry.getDialectCompiletimeRegistry().getDialect( "mvel" );           
            PackageBuildContext context = new PackageBuildContext();           
            context.init( this, pkg, typeDescr, pkgRegistry.getDialectCompiletimeRegistry(), dialect, null );
            if ( !type.isTypesafe() ) {
                context.setTypesafe( false );
            }
           
            MVELAnalysisResult results = ( MVELAnalysisResult )
                                context.getDialect().analyzeExpression( context,
                                                                        typeDescr,
                                                                        duration,
                                                                        new BoundIdentifiers( Collections.EMPTY_MAP,
                                                                                              Collections.EMPTY_MAP,
                                                                                              Collections.EMPTY_MAP,
                                                                                              type.getTypeClass() ) );           

            if (results != null) {
                InternalReadAccessor reader = pkg.getClassFieldAccessorStore().getMVELReader( ClassUtils.getPackage( type.getTypeClass() ),
                                                                                              type.getTypeClass().getName(),
                                                                                              duration,
                                                                                              type.isTypesafe(),
                                                                                              results.getReturnType()  );

                MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( "mvel" );
                data.addCompileable( (MVELCompileable) reader );
                ( (MVELCompileable) reader ).compile( data );
                type.setDurationExtractor( reader );
            } else {
                this.results.add( new TypeDeclarationError(typeDescr,
                        "Error processing @duration for TypeDeclaration '" + type.getFullName() +
View Full Code Here

Examples of org.drools.rule.MVELDialectRuntimeData

                MVELDumper.MVELDumperContext mvelCtx = new MVELDumper.MVELDumperContext();
                String expr = context.getCompilerFactory().getExpressionProcessor().dump( bresult,
                                                                                          mvelCtx );
                try {
                    MVELDialectRuntimeData data = ( MVELDialectRuntimeData) context.getPkg().getDialectRuntimeRegistry().getDialectData( "mvel" );
                    ParserConfiguration conf = data.getParserConfiguration();
                    conf.setClassLoader( context.getPackageBuilder().getRootClassLoader() );

                    arguments.set( pos,
                            MVEL.executeExpression( MVEL.compileExpression( expr, new ParserContext( conf ) ) ) );
                } catch ( Exception e ) {
View Full Code Here

Examples of org.drools.rule.MVELDialectRuntimeData

            // it's an expression and thus an input
            MVELDumper.MVELDumperContext mvelCtx = new MVELDumper.MVELDumperContext();
            String rewrittenExpr = context.getCompilerFactory().getExpressionProcessor().dump( result, mvelCtx );

            try {
                MVELDialectRuntimeData data = ( MVELDialectRuntimeData) context.getPkg().getDialectRuntimeRegistry().getDialectData( "mvel" );
                ParserConfiguration conf = data.getParserConfiguration();
                conf.setClassLoader( context.getPackageBuilder().getRootClassLoader() );

                arguments.set( position,
                        MVEL.executeExpression( MVEL.compileExpression( rewrittenExpr, new ParserContext( conf ) ) ) );
            } catch ( Exception e ) {
View Full Code Here

Examples of org.drools.rule.MVELDialectRuntimeData

        return conditionEvaluator.evaluate(object, workingMemory, leftTuple);
    }

    protected void createMvelConditionEvaluator(InternalWorkingMemory workingMemory) {
        if (compilationUnit != null) {
            MVELDialectRuntimeData data = getMVELDialectRuntimeData(workingMemory);
            ExecutableStatement statement = (ExecutableStatement)compilationUnit.getCompiledExpression(data);
            ParserConfiguration configuration = statement instanceof CompiledExpression ?
                    ((CompiledExpression)statement).getParserConfiguration() :
                    data.getParserConfiguration();
            conditionEvaluator = new MvelConditionEvaluator(compilationUnit, configuration, statement, declarations);
        } else {
            conditionEvaluator = new MvelConditionEvaluator(getParserConfiguration(workingMemory), expression, declarations);
        }
    }
View Full Code Here

Examples of org.drools.rule.MVELDialectRuntimeData

                                                           rule, null, (LeftTuple)item.getTuple(), null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver() );
       
        // do we have any functions for this namespace?
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( this.id );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        return MVEL.executeExpression(this.expr,
                                      factory);
    }
View Full Code Here

Examples of org.drools.rule.MVELDialectRuntimeData

                                                           knowledgeHelper.getRule(), knowledgeHelper, (LeftTuple) knowledgeHelper.getTuple(), null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver()  );
       
        // do we have any functions for this namespace?
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( this.id );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        CompiledExpression compexpr = (CompiledExpression) this.expr;

        if ( MVELDebugHandler.isDebugMode() ) {
View Full Code Here

Examples of org.drools.rule.MVELDialectRuntimeData

        VariableResolverFactory factory = factoryContext.getInitFactory();
        initUnit.updateFactory( null, null, null, (LeftTuple) leftTuple, localVars, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver(), factory  );
       
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( "mvel" );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        MVEL.executeExpression( this.init,
                                null,
                                factory );
View Full Code Here

Examples of org.drools.rule.MVELDialectRuntimeData

                                                           rule, null, (LeftTuple) tuple, null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver()  );

        // do we have any functions for this namespace?
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( this.id );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        return ((Boolean) MVEL.executeExpression( this.expr,
                                                  null,
                                                  factory )).booleanValue();
View Full Code Here

Examples of org.drools.rule.MVELDialectRuntimeData

                                                           rule, null, (LeftTuple) khelper.getMatch().getTuple(), null, (InternalWorkingMemory) workingMemory, workingMemory.getGlobalResolver() );
       
        // do we have any functions for this namespace?
        Package pkg = workingMemory.getRuleBase().getPackage( "MAIN" );
        if ( pkg != null ) {
            MVELDialectRuntimeData data = (MVELDialectRuntimeData) pkg.getDialectRuntimeRegistry().getDialectData( this.id );
            factory.setNextFactory( data.getFunctionFactory() );
        }

        return ((Number) MVEL.executeExpression( this.expr,
                                                 factory )).intValue();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.