Skip navigation links


com.essbase.eas.framework.defs.command
Class DefaultCommandManager

java.lang.Object
  extended by com.essbase.eas.framework.defs.command.DefaultCommandManager

All Implemented Interfaces:
CommandManager
Direct Known Subclasses:
UICommandManager

public class DefaultCommandManager
extends java.lang.Object
implements CommandManager

Default implementation of a CommandManager interface. For compatibility with previous versions of the framework, many of the methods implemented in this class are static "pass-through" methods to an instance of the default (or registered) command manager. This class also implements the set of methods that permit chaining of command managers. In most circumstances, a single command manager should be sufficient; however, plug-ins might have the rare need to provide additional command managers.

When this class is loaded by the Java Runtime Engine, it will use the manifest file utilities to search for all classes that implement the CommandResultListener interface.

Since:
7.0.0
Version:
7.1.0
Author:
Hank Cox

Field Summary
protected static java.lang.String BAD_CLASS_ARGUMENT
           
protected static java.lang.String COMMAND_IS_NULL
           
protected static java.lang.String LISTENER_IS_NULL
           
protected static java.lang.String MANIFEST_CMDMGR_KEY
           
protected static java.lang.String MANIFEST_LISTENER_KEY
           
protected static java.lang.String MANIFEST_VALUE
           
protected static java.lang.String NULL_CLASS_ARGUMENT
           
protected static java.lang.String NULL_CM_ARGUMENT
           
protected static java.lang.String REQUEST_IS_NULL
           
protected  CommandRequestor requestor
           
protected  java.util.ResourceBundle resources
           

 

Constructor Summary
protected DefaultCommandManager()
          creates a DefaultCommandManager object with the default properties.

 

Method Summary
static boolean addCommandManager(CommandManager value, boolean front)
          adds a specific command manager to the chain of command managers.
static void addResultListener(CommandResultListener l)
          adds a result listener to the set of result listeners.
protected  void cachePropertyObject(java.util.Properties p)
           
protected  java.util.Properties getCachedPropertyObject()
           
protected  CommandManager getCommandManagerFor(java.lang.String command)
           
static CommandManager[] getCommandManagers()
          returns an array of all command managers that have been added to the set of command managers.
static CommandManager getFirstCommandManager()
          returns the first command manager in the set of command managers.
 CommandRequestor getRequestor()
          returns the command requestor associated with the command manager.
 java.lang.String[] getReservedCommands()
          Implementation of the getReservedCommands method from the CommandManager interface.
 boolean performLogin()
          Implementation of the performLogin() method from the CommandManager interface.
 boolean performLogin(boolean reuseSession)
          cause the command manager to connect to a server but use an existing session instead of initiating a new one
static CommandManager[] removeAllCommandManagers(java.lang.Class value)
          removes all command managers of a certain class from the chain of command managers.
static CommandManager removeCommandManager(java.lang.Class value)
          removes the first command manager of a certain class from the chain of command managers.
static boolean removeCommandManager(CommandManager value)
          removes a specific command manager from the chain of command managers.
static void removeResultListener(CommandResultListener l)
          removes a result listener from the set of result listeners.
 CommandResult routeCommand(java.lang.Object component, CommandRequest request)
          routes a command to the correct place.
 boolean routeResultsToListeners(CommandRequest request, CommandResult results, int counter)
          routes the results of a command to the registered listeners, if there are any
 void routeThreadedCommand(CommandRequest request)
          routes a threaded command to the correct place.
 CommandResult sendCommand(java.lang.Object component, CommandRequest request)
          sends a command to the server.
 BinaryMessage sendCommandGetBinary(java.lang.String command, java.util.Properties params, java.lang.Class resultClass, byte[] data, boolean background, boolean secure)
          sends the requested command to the appropriate EAS mid-tier server.
 java.io.InputStream sendCommandGetInputStream(java.lang.String command, java.util.Properties params, java.lang.Class resultClass, boolean background)
           
 CommandResult sendCommandGetResult(java.lang.String command, java.util.Properties params, byte[] data, boolean background, boolean secure)
           
 CommandResult sendCommandGetResult(java.lang.String command, java.util.Properties params, java.lang.Class resultClass, byte[] data, boolean background, boolean secure)
           
 java.lang.String sendCommandGetString(java.lang.String command, java.util.Properties params, byte[] data, boolean background, boolean secure)
          sends the requested command to the appropriate EAS mid-tier server.
 java.lang.String sendCommandGetString(java.lang.String command, java.util.Properties params, byte[] data, int offset, int len, boolean background, boolean secure)
          sends the requested command to the appropriate EAS mid-tier server.
 void sendThreadedCommand(CommandRequest request)
          sends a command to the server.
 void setRequestor(CommandRequestor value)
          sets the command requestor associated with the command manager.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

NULL_CM_ARGUMENT

protected static final java.lang.String NULL_CM_ARGUMENT
See Also:
Constant Field Values

NULL_CLASS_ARGUMENT

protected static final java.lang.String NULL_CLASS_ARGUMENT
See Also:
Constant Field Values

BAD_CLASS_ARGUMENT

protected static final java.lang.String BAD_CLASS_ARGUMENT
See Also:
Constant Field Values

REQUEST_IS_NULL

protected static final java.lang.String REQUEST_IS_NULL
See Also:
Constant Field Values

COMMAND_IS_NULL

protected static final java.lang.String COMMAND_IS_NULL
See Also:
Constant Field Values

LISTENER_IS_NULL

protected static final java.lang.String LISTENER_IS_NULL
See Also:
Constant Field Values

MANIFEST_LISTENER_KEY

protected static final java.lang.String MANIFEST_LISTENER_KEY
See Also:
Constant Field Values

MANIFEST_CMDMGR_KEY

protected static final java.lang.String MANIFEST_CMDMGR_KEY
See Also:
Constant Field Values

MANIFEST_VALUE

protected static final java.lang.String MANIFEST_VALUE
See Also:
Constant Field Values

requestor

protected CommandRequestor requestor

resources

protected java.util.ResourceBundle resources

Constructor Detail

DefaultCommandManager

protected DefaultCommandManager()
creates a DefaultCommandManager object with the default properties.

Method Detail

addResultListener

public static final void addResultListener(CommandResultListener l)
adds a result listener to the set of result listeners.
Parameters:
l - the command result listener.

removeResultListener

public static final void removeResultListener(CommandResultListener l)
removes a result listener from the set of result listeners.
Parameters:
l - the command result listener.

getFirstCommandManager

public static final CommandManager getFirstCommandManager()
returns the first command manager in the set of command managers. If no command managers have been added yet, this method will instantiate an instance of a <DefaultCommandManager, add it to the set, and return that instance.
Returns:
the first CommandManager object in this JRE.

getCommandManagers

public static final CommandManager[] getCommandManagers()
returns an array of all command managers that have been added to the set of command managers.
Returns:
all command managers for this JRE.

addCommandManager

public static final boolean addCommandManager(CommandManager value,
                                              boolean front)
                                       throws java.lang.IllegalArgumentException
adds a specific command manager to the chain of command managers. Does not modify the chain if the requested object already is in the chain and returns false in this case.
Parameters:
value - the CommandManager object to add to the chain of comand managers.
front - true to add at the front of the chain; false to add at the back of the chain.
Returns:
true if the command manager was added; false otherwise.
Throws:
java.lang.IllegalArgumentException - if the value to be added is null

removeCommandManager

public static final boolean removeCommandManager(CommandManager value)
                                          throws java.lang.IllegalArgumentException
removes a specific command manager from the chain of command managers.
Parameters:
value - the CommandManager object to remove from the chain of command managers.
Returns:
true if the object was not in the chain or if it was successfully removed; false, otherwise.
Throws:
java.lang.IllegalArgumentException - if the value to be removed is null

removeCommandManager

public static final CommandManager removeCommandManager(java.lang.Class value)
                                                 throws java.lang.IllegalArgumentException
removes the first command manager of a certain class from the chain of command managers.
Parameters:
value - the class of the command manager being removed.
Returns:
the command manager removed from the chain; null if no objects were removed from the chain.
Throws:
java.lang.IllegalArgumentException - if the class value is null or is not assignment compatible with the CommandManager interface.

removeAllCommandManagers

public static final CommandManager[] removeAllCommandManagers(java.lang.Class value)
                                                       throws java.lang.IllegalArgumentException
removes all command managers of a certain class from the chain of command managers.
Parameters:
value - the class of the command managers being removed.
Returns:
an array of command managers that were removed; an array of zero length if none were removed.
Throws:
java.lang.IllegalArgumentException - if the class value is null or is not assignment compatible with the CommandManager interface.

getCachedPropertyObject

protected final java.util.Properties getCachedPropertyObject()

cachePropertyObject

protected final void cachePropertyObject(java.util.Properties p)

getCommandManagerFor

protected final CommandManager getCommandManagerFor(java.lang.String command)

routeResultsToListeners

public boolean routeResultsToListeners(CommandRequest request,
                                       CommandResult results,
                                       int counter)
routes the results of a command to the registered listeners, if there are any
Specified by:
routeResultsToListeners in interface CommandManager
Parameters:
request - the command request
results - the command results
counter - tracks how many times this command has been attempted. The command result listener can use this to determine if it is worth retrying the command again.
Returns:
true if the command should be retried; false if it shouldn't.

routeCommand

public CommandResult routeCommand(java.lang.Object component,
                                  CommandRequest request)
                           throws CommandRequestException,
                                  java.io.IOException
Description copied from interface: CommandManager
routes a command to the correct place. This method should not be called by classes outside the inheritance hierarchy of the CommandManager interface.
Specified by:
routeCommand in interface CommandManager
Parameters:
component - a supplemental component that the implementing class can act upon; for instance, if the implementing class is on a UI-based platform, then this component could be a Swing-based component for which setting the wait cursor would be appropriate.
request - the command being requested
Returns:
the results of the command.
Throws:
CommandRequestException - if the request isn't properly formatted.
java.io.IOException

sendCommand

public CommandResult sendCommand(java.lang.Object component,
                                 CommandRequest request)
                          throws CommandRequestException,
                                 java.io.IOException
sends a command to the server.
Specified by:
sendCommand in interface CommandManager
Parameters:
request - the request to send.
component - a supplemental component that the instantiater of this interface will know what to do with; for instance, a UICommandManager would expect this object to be a Swing Component and would set the wait cursor.
Returns:
an object containing the results of the request
Throws:
CommandRequestException - if the request isn't properly formatted.
java.io.IOException

routeThreadedCommand

public void routeThreadedCommand(CommandRequest request)
                          throws CommandRequestException,
                                 java.io.IOException
Description copied from interface: CommandManager
routes a threaded command to the correct place. This method should not be called by classes outside the inheritance hierarchy of the CommandManager interface.
Specified by:
routeThreadedCommand in interface CommandManager
Parameters:
request - the command being requested
Throws:
CommandRequestException - if the request isn't properly formatted.
java.io.IOException

sendThreadedCommand

public void sendThreadedCommand(CommandRequest request)
                         throws CommandRequestException,
                                java.io.IOException
sends a command to the server.
Specified by:
sendThreadedCommand in interface CommandManager
Parameters:
request - the command being requested
Throws:
CommandRequestException - when the command request doesn't make sense.
java.io.IOException

performLogin

public boolean performLogin()
                     throws FrameworkException
Implementation of the performLogin() method from the CommandManager interface. This method will always throw a FrameworkException. The class should be overridden by a platform specific command manager and the subclass should then implement the appropriate actions for connecting to the server.
Specified by:
performLogin in interface CommandManager
Returns:
true if the login action was successful; false otherwise.
Throws:
FrameworkException - if any exception is thrown by underlying code.

performLogin

public boolean performLogin(boolean reuseSession)
                     throws FrameworkException
Description copied from interface: CommandManager
cause the command manager to connect to a server but use an existing session instead of initiating a new one
Specified by:
performLogin in interface CommandManager
Parameters:
reuseSession -
Returns:
Throws:
FrameworkException

getRequestor

public CommandRequestor getRequestor()
Description copied from interface: CommandManager
returns the command requestor associated with the command manager.
Specified by:
getRequestor in interface CommandManager
Returns:
the command requestor object associated with this command manager.

setRequestor

public void setRequestor(CommandRequestor value)
Description copied from interface: CommandManager
sets the command requestor associated with the command manager.
Specified by:
setRequestor in interface CommandManager
Parameters:
value - the command requestor.

getReservedCommands

public java.lang.String[] getReservedCommands()
Implementation of the getReservedCommands method from the CommandManager interface. This method should be overridden by any derived classes that wish to reserve certain commands for themselves.
Specified by:
getReservedCommands in interface CommandManager
Returns:
an array of Strings that can be used as keys in a hashtable. This return value cannot be null, and must be an array of length 0 if the command manager doesn't want to reserve commands.

sendCommandGetString

public java.lang.String sendCommandGetString(java.lang.String command,
                                             java.util.Properties params,
                                             byte[] data,
                                             boolean background,
                                             boolean secure)
                                      throws java.io.IOException
sends the requested command to the appropriate EAS mid-tier server. This method is provided for backwards compatibility with the original command manager methodology. It will eventually be deprecated. Warning: Using this method causes the XML to be parsed twice. It is intended that this method be overridden by platform specific command managers.
Specified by:
sendCommandGetString in interface CommandManager
Parameters:
command - the command to send
params - the parameters for the command
data - binary data to send to the mid-tier as part of the command.
background - whether to use background processing for this command
secure - whether to send this command in a secure mode.
Returns:
a String object representing the results.
Throws:
java.io.IOException

sendCommandGetString

public java.lang.String sendCommandGetString(java.lang.String command,
                                             java.util.Properties params,
                                             byte[] data,
                                             int offset,
                                             int len,
                                             boolean background,
                                             boolean secure)
                                      throws java.io.IOException
sends the requested command to the appropriate EAS mid-tier server. This method is provided for backwards compatibility with the original command manager methodology. It will eventually be deprecated. Warning: Using this method causes the XML to be parsed twice. It is intended that this method be overridden by platform specific command managers.
Specified by:
sendCommandGetString in interface CommandManager
Parameters:
command - the command to send
params - the parameters for the command
data - binary data to send to the mid-tier as part of the command.
background - whether to use background processing for this command
offset - offset of the data
len - length of data
secure - whether to send this command in a secure mode.
Returns:
a String object representing the results.
Throws:
java.io.IOException

sendCommandGetResult

public CommandResult sendCommandGetResult(java.lang.String command,
                                          java.util.Properties params,
                                          byte[] data,
                                          boolean background,
                                          boolean secure)
                                   throws java.io.IOException
Specified by:
sendCommandGetResult in interface CommandManager
Throws:
java.io.IOException

sendCommandGetResult

public CommandResult sendCommandGetResult(java.lang.String command,
                                          java.util.Properties params,
                                          java.lang.Class resultClass,
                                          byte[] data,
                                          boolean background,
                                          boolean secure)
                                   throws java.io.IOException
Specified by:
sendCommandGetResult in interface CommandManager
Throws:
java.io.IOException

sendCommandGetBinary

public BinaryMessage sendCommandGetBinary(java.lang.String command,
                                          java.util.Properties params,
                                          java.lang.Class resultClass,
                                          byte[] data,
                                          boolean background,
                                          boolean secure)
                                   throws java.io.IOException
sends the requested command to the appropriate EAS mid-tier server. This method is provided for backwards compatibility with the original command manager methodology. It will eventually be deprecated. Warning: Using this method causes the XML to be parsed twice. It is intended that this method be overridden by platform specific command managers.
Specified by:
sendCommandGetBinary in interface CommandManager
Parameters:
command - the command to send
params - the parameters for the command
resultClass - the class of the expected BinaryMessage object. this can be used to receive results for object types that the CommandManager doesn't know about.
background - whether to use background processing for this command
data - byte array to be sent as part of this command.
secure - whether to send this command in a secure mode.
Returns:
a BinaryMessage object that can be cast the resultClass.
Throws:
java.io.IOException

sendCommandGetInputStream

public java.io.InputStream sendCommandGetInputStream(java.lang.String command,
                                                     java.util.Properties params,
                                                     java.lang.Class resultClass,
                                                     boolean background)
                                              throws java.io.IOException
Specified by:
sendCommandGetInputStream in interface CommandManager
Throws:
java.io.IOException

Skip navigation links


Copyright © 2001, 2012, Oracle. All rights reserved.