Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| jBPM distribution 6.2.0.CR2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.kie.api.runtime
Interface CommandExecutor

All Known Subinterfaces:
  org.kie.internal.task.api.InternalTaskService, KieSession, StatelessKieSession, TaskService, TaskServiceEJBLocal

All Known Implementing Classes:
  org.drools.core.command.impl.AbstractInterceptor, CommandBasedTaskService, GlobalTimerService.DisposableCommandService, StatefulProcessSession, SynchronizedTaskService, TaskCommandExecutorImpl, TaskInstanceServiceImpl, TaskServiceEJBImpl, TaskTransactionInterceptor, TransactionalCommandService, TransactionalCommandServiceEJBImpl

    public interface CommandExecutor

Batch Executor allows for the scripting of of a Knowledge session using Commands, both the StatelessKnowledgeSession and StatefulKnowledgeSession implement this interface.

Commands are created using the CommandFactory and executed using the "execute" method, such as the following insert Command:

     ksession.execute( CommandFactory.newInsert( person ) );

Typically though you will want to execute a batch of commands, this can be achieved via the composite Command BatchExecution. Further to this results are scoped to this execute call and return via the ExecutionResults:

     List<Command> cmds = new ArrayList<Command>();
     cmds.add( CommandFactory.newSetGlobal( "list1", new ArrayList(), true ) );
     cmds.add( CommandFactory.newInsert( new Person( "jon", 102 ), "person" ) );
     cmds.add( CommandFactory.newQuery( "Get People" "getPeople" );

     ExecutionResults results = ksession.execute( CommandFactory.newBatchExecution( cmds ) );
     results.getValue( "list1" ); // returns the ArrayList
     results.getValue( "person" ); // returns the inserted fact Person
     results.getValue( "Get People" );// returns the query as a QueryResults instance.

The CommandFactory details the supported commands, all of which can marshalled using XStream and the BatchExecutionHelper. BatchExecutionHelper provides details on the xml format as well as how to use Drools Pipeline to automate the marshalling of BatchExecution and ExecutionResults.

Method Summary
`
`<T> T`
` | `execute(Command<T> command)` Execute the command and return a ExecutionResults for the results of the Command.

Method Detail

### execute

    <T> T execute(Command<T> command)

  Execute the command and return a ExecutionResults for the results of the Command.

  Parameters:
    `command` -
  Returns:

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| jBPM distribution 6.2.0.CR2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.