org.azuki.framework.command
Class Command

java.lang.Object
  extended by org.azuki.framework.command.Command

public final class Command
extends Object

This class is an implementation of the Command Design Pattern. This implmentation adds support for : - Asynchronous processing - Callback - Queuing

Author:
Robert Bakic (robert.bakic@gmail.com)

Nested Class Summary
static interface Command.Impl
           
 
Constructor Summary
Command()
           
 
Method Summary
static Object call(ICommand icmd)
          Direct call to the process method of the ICommand object.
static IQueue getQueue(String qname)
           
static Object invoke(ICommand icmd)
          Deferred synchronous call to the process method of the command object.
static Object invokeQueued(ICommand icmd, IQueue queue, ICommand.Priority pty)
          Deferred synchronous call to the process method of the command object.
static IQueue mainQueue()
           
static void send(ICommand icmd)
          Asynchronous call to the process method of the ICommand object.
static void sendCallback(ICommand icmd, ICallback cback)
          Asynchronous call to the process method of the command object.
static void sendQueued(ICommand icmd, IQueue queue, ICommand.Priority pty)
          Asynchronous call to the process method of the command object.
static void sendQueuedCallback(ICommand icmd, IQueue queue, ICommand.Priority pty, ICallback cback)
          Asynchronous call to the process method of the command object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command()
Method Detail

mainQueue

public static final IQueue mainQueue()

getQueue

public static final IQueue getQueue(String qname)

call

public static final Object call(ICommand icmd)
                         throws Exception
Direct call to the process method of the ICommand object. Invocation is synchronous and performed by the same thread using the same thread context.

Parameters:
icmd - The command pattern object containing the method to process.
Returns:
The ICommand's process method return.
Throws:
Exception

invoke

public static final Object invoke(ICommand icmd)
                           throws Exception
Deferred synchronous call to the process method of the command object. Invocation is synchronous but performed by another thread using a different thread context.

Parameters:
icmd - The command pattern object containing the method to process.
Returns:
The ICommand's process method return.
Throws:
Exception

invokeQueued

public static final Object invokeQueued(ICommand icmd,
                                        IQueue queue,
                                        ICommand.Priority pty)
                                 throws Exception
Deferred synchronous call to the process method of the command object. Invocation is synchronous but performed by another thread using a different thread context. The caller has specified a queue name and a priority for the command object processing.

Parameters:
icmd - The command pattern object containing the method to process.
queue - The queue object
pty - The priority
Returns:
The ICommand's process method return.
Throws:
Exception

send

public static final void send(ICommand icmd)
Asynchronous call to the process method of the ICommand object. Invocation is asynchronous and performed by another thread using a different thread context.

Parameters:
icmd - The command pattern object containing the method to process.

sendQueued

public static final void sendQueued(ICommand icmd,
                                    IQueue queue,
                                    ICommand.Priority pty)
Asynchronous call to the process method of the command object. Invocation is asynchronous and performed by another thread using a different thread context. The caller has specified a queue name and a priority for the command object processing.

Parameters:
icmd - The command pattern object containing the method to process.
queue - The queue object
pty - The priority

sendCallback

public static final void sendCallback(ICommand icmd,
                                      ICallback cback)
Asynchronous call to the process method of the command object. Invocation is asynchronous and performed by another thread using a different thread context. The caller has specified a ICallback object that will be called by the framework at the completion of the ICommand's process method execution.

Parameters:
icmd - The command pattern object containing the method to process.
cback - The object that will be call by the framework at the completion of the ICommand's process method execution.

sendQueuedCallback

public static final void sendQueuedCallback(ICommand icmd,
                                            IQueue queue,
                                            ICommand.Priority pty,
                                            ICallback cback)
Asynchronous call to the process method of the command object. Invocation is asynchronous and performed by another thread using a different thread context. The caller has specified a queue name and a priority for the command object processing. The caller has also specified a ICallback object that will be called by the framework at the completion of the ICommand's process method execution.

Parameters:
icmd - The command pattern object containing the method to process.
queue - The queue object
pty - The priority
cback - The object that will be call by the framework at the completion of the ICommand's process method execution.


Azuki Framework Copyright © 2006 the original author or authors.