Package org.drools.command.impl

Examples of org.drools.command.impl.KnowledgeCommandContext


    }

    public <T> T execute(Context context,
                         Command<T> command) {
        if ( !( command instanceof BatchExecutionCommand ) ) {
            return (T) ((GenericCommand) command).execute( new KnowledgeCommandContext( context,
                                                                             null,
                                                                             this.kbase,
                                                                             this,
                                                                             null ) ) ;           
        }
       
        ExecutionResultImpl results = null;
        if ( context != null ) {
            results = (ExecutionResultImpl) ((KnowledgeCommandContext) context).getExecutionResults();
        }

        if ( results == null ) {
            results = new ExecutionResultImpl();
        }

        try {
            session.startBatchExecution( results );
            ((GenericCommand) command).execute( new KnowledgeCommandContext( context,
                                                                             null,
                                                                             this.kbase,
                                                                             this,
                                                                             results ) );
            ExecutionResults result = session.getExecutionResult();
View Full Code Here


        this(command, kbuilderIdentifier, kbaseIdentifier, statefulKsessionName, kresults);
        this.workingMemoryEntryPointName = workingMemoryEntryPointName;
    }

    public Object execute(Context context) {
        KnowledgeCommandContext kcContext = new KnowledgeCommandContext( context,
                                                                         (KnowledgeBuilder) context.get( this.kbuilderIdentifier ),
                                                                         (KnowledgeBase) context.get( this.kbaseIdentifier ),
                                                                         (StatefulKnowledgeSession) context.get( this.statefulKsessionName ),
                                                                         (WorkingMemoryEntryPoint) context.get(this.workingMemoryEntryPointName),
                                                                         (ExecutionResultImpl) context.get( this.kresults ) );
View Full Code Here

        if ( results == null ) {
            results = new ExecutionResultImpl();
        }

        if ( !(command instanceof BatchExecutionCommandImpl) ) {
            return (T) ((GenericCommand) command).execute( new KnowledgeCommandContext( context,
                                                                                        null,
                                                                                        this.kbase,
                                                                                        this,
                                                                                        results ) );
        }

       

        try {
            session.startBatchExecution( results );
            ((GenericCommand) command).execute( new KnowledgeCommandContext( context,
                                                                             null,
                                                                             this.kbase,
                                                                             this,
                                                                             results ) );
            ExecutionResults result = session.getExecutionResult();
View Full Code Here

    }

    public <T> T execute(Command<T> command) {
        StatefulKnowledgeSession ksession = newWorkingMemory();

        KnowledgeCommandContext context = new KnowledgeCommandContext( new ContextImpl( "ksession",
                                                                                        null ),
                                                                       null,
                                                                       null,
                                                                       ksession,
                                                                       null );
View Full Code Here

        this(command, kbuilderIdentifier, kbaseIdentifier, statefulKsessionName, kresults);
        this.workingMemoryEntryPointName = workingMemoryEntryPointName;
    }

    public Object execute(Context context) {
        KnowledgeCommandContext kcContext = new KnowledgeCommandContext( context,
                                                                         (KnowledgeBuilder) context.get( this.kbuilderIdentifier ),
                                                                         (KnowledgeBase) context.get( this.kbaseIdentifier ),
                                                                         (StatefulKnowledgeSession) context.get( this.statefulKsessionName ),
                                                                         (WorkingMemoryEntryPoint) context.get(this.workingMemoryEntryPointName),
                                                                         (ExecutionResultImpl) context.get( this.kresults ) );
View Full Code Here

    ReteooStatefulSession session = (ReteooStatefulSession)
        ((KnowledgeBaseImpl) kbase).ruleBase.newStatefulSession((SessionConfiguration) conf, this.env);
    this.ksession = new StatefulKnowledgeSessionImpl(session, kbase);

    this.kContext = new KnowledgeCommandContext(new ContextImpl("ksession", null), null, null, this.ksession, null);
    ((JPASignalManager) ((StatefulKnowledgeSessionImpl) ksession).session.getSignalManager())
        .setCommandService(this);

    this.marshallingHelper = new JPASessionMarshallingHelper(this.ksession, conf);
View Full Code Here

              marshallingHelper = new JPASessionMarshallingHelper(sessionInfo, kbase, localConf,
                  SpringSingleSessionCommandService.this.env);

              sessionInfo.setJPASessionMashallingHelper(marshallingHelper);
              ksession = marshallingHelper.getObject();
              kContext = new KnowledgeCommandContext(new ContextImpl("ksession", null), null, null,
                  ksession, null);
              ((JPASignalManager) ((StatefulKnowledgeSessionImpl) ksession).session.getSignalManager())
                  .setCommandService(SpringSingleSessionCommandService.this);

              // update the session id to be the same as the
View Full Code Here

        if ( results == null ) {
            results = new ExecutionResultImpl();
        }

        if ( !(command instanceof BatchExecutionCommandImpl) ) {
            return (T) ((GenericCommand) command).execute( new KnowledgeCommandContext( context,
                                                                                        null,
                                                                                        this.kbase,
                                                                                        this,
                                                                                        results ) );
        }

       

        try {
            session.startBatchExecution( results );
            ((GenericCommand) command).execute( new KnowledgeCommandContext( context,
                                                                             null,
                                                                             this.kbase,
                                                                             this,
                                                                             results ) );
            ExecutionResults result = session.getExecutionResult();
View Full Code Here

        initTransactionManager( this.env );
       
        // create session but bypass command service
        this.ksession = kbase.newStatefulKnowledgeSession(conf, this.env);
       
        this.kContext = new KnowledgeCommandContext( new ContextImpl( "ksession",
                                                                      null ),
                                                     null,
                                                     null,
                                                     this.ksession,
                                                     null );
View Full Code Here

        ((JpaJDKTimerService) ((InternalKnowledgeRuntime) ksession).getTimerService()).setCommandService( this );
       
        if ( this.kContext == null ) {
            // this should only happen when this class is first constructed
            this.kContext = new KnowledgeCommandContext( new ContextImpl( "ksession",
                                                                          null ),
                                                         null,
                                                         null,
                                                         this.ksession,
                                                         null );
View Full Code Here

TOP

Related Classes of org.drools.command.impl.KnowledgeCommandContext

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.