com.ibm.commerce.command
Class CommandFactory

java.lang.Object
  |
  +--com.ibm.commerce.command.CommandFactory

public class CommandFactory
extends java.lang.Object

This is the CommandFactory for instantiating Commands


Field Summary
protected static java.util.Hashtable commandClassesCache
           
protected static CommandRegistry commandRegistry
           
protected static java.util.Hashtable viewCommandClassesCache
           
protected static ViewRegistry viewRegistry
           
 
Constructor Summary
CommandFactory()
          CommandFactory constructor.
 
Method Summary
static ECCommand createBusinessPolicyCommand(java.lang.Long policyId)
          This method searches the command registry for an entry correspnding to the specified command (interface) name and storeId.
static ECCommand createBusinessPolicyCommand(java.lang.Long policyId, java.lang.String interfaceName)
          This method searches the policy command registry for an entry correspnding to the specified command (interface) name and policy id.
static ECCommand createCommand(CommandRegistryEntry cmdEntry)
          This method instantiate an instance of a command based on the commandRegistryEntry information.
static ECCommand createCommand(java.lang.String cmdRefKey, java.lang.Integer storeId)
          This method searches the command registry for an entry correspnding to the specified command (interface) name and storeId.
static ECCommand createCommand(java.lang.String cmdRefKey, java.lang.Integer storeId, boolean exceptionNeeded)
          This method searches the command registry for an entry correspnding to the specified command (interface) name and storeId.
static ECCommand createViewCommand(ViewRegistryEntry cmdEntry)
           
static java.lang.String getCommandClassNameFromInterface(java.lang.String commandInterfaceName)
          This method returns the default implementation of an interface.
static CommandRegistryEntry locateCommandEntry(java.lang.String cmdRefKey, java.lang.Integer storeId)
           
static CommandRegistryEntry locateCommandEntry(java.lang.String cmdRefKey, java.lang.Integer storeId, boolean exceptionNeeded)
           
static ViewRegistryEntry locateViewCommandEntry(java.lang.String cmdRefKey, java.lang.Integer storeId, java.lang.Integer deviceFmt)
           
static ViewRegistryEntry locateViewCommandEntry(java.lang.String cmdRefKey, java.lang.Integer storeId, java.lang.Integer deviceFmt, boolean exceptionNeeded)
           
static ViewRegistryEntry locateViewCommandEntry(java.lang.String cmdRefKey, java.lang.Integer storeId, java.lang.Integer deviceFmt, java.lang.Integer dftDeviceFmt)
           
static ViewRegistryEntry locateViewCommandEntry(java.lang.String cmdRefKey, java.lang.Integer storeId, java.lang.Integer deviceFmt, java.lang.Integer dftDeviceFmt, boolean exceptionNeeded)
           
static void setCommandRegistry(CommandRegistry newValue)
          This method set the command registry to be used by the command factory to locate commands.
static void setViewRegistry(ViewRegistry newValue)
          This method set the view registry to be used by the command factory to locate commands.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandClassesCache

protected static java.util.Hashtable commandClassesCache

commandRegistry

protected static CommandRegistry commandRegistry

viewCommandClassesCache

protected static java.util.Hashtable viewCommandClassesCache

viewRegistry

protected static ViewRegistry viewRegistry
Constructor Detail

CommandFactory

public CommandFactory()
CommandFactory constructor.
Method Detail

createBusinessPolicyCommand

public static ECCommand createBusinessPolicyCommand(java.lang.Long policyId)
                                             throws ECException
This method searches the command registry for an entry correspnding to the specified command (interface) name and storeId. If one is found, this method will instantiate an object representing the command.
Parameters:
commandIf - String - command interface name
storeId - Integer - store Id
Returns:
ECCommand - an instance of a command
Throws:
ECException -  

createBusinessPolicyCommand

public static ECCommand createBusinessPolicyCommand(java.lang.Long policyId,
                                                    java.lang.String interfaceName)
                                             throws ECException
This method searches the policy command registry for an entry correspnding to the specified command (interface) name and policy id. If one is found, this method will instantiate an object representing the command.
Parameters:
commandIf - String - command interface name
policyId - Long - policy Id
Returns:
ECCommand - an instance of a command
Throws:
ECException -  

createCommand

public static ECCommand createCommand(CommandRegistryEntry cmdEntry)
                               throws ECException
This method instantiate an instance of a command based on the commandRegistryEntry information.

Parameters:
commandRegistryEntry - CommandRegistryEntry - command registry entry
Returns:
ECCommand - an instance of a command
Throws:
ECException -  

createCommand

public static ECCommand createCommand(java.lang.String cmdRefKey,
                                      java.lang.Integer storeId)
                               throws ECException
This method searches the command registry for an entry correspnding to the specified command (interface) name and storeId. If one is found, this method will instantiate an object representing the command.
Parameters:
commandIf - String - command interface name
storeId - Integer - store Id
Returns:
ECCommand - an instance of a command
Throws:
ECException -  

createCommand

public static ECCommand createCommand(java.lang.String cmdRefKey,
                                      java.lang.Integer storeId,
                                      boolean exceptionNeeded)
                               throws ECException
This method searches the command registry for an entry correspnding to the specified command (interface) name and storeId. If one is found, this method will instantiate an object representing the command.
Parameters:
commandIf - String - command interface name
storeId - Integer - store Id $param exceptionNeeded boolean - indicates whether exception should be thrown when command implementation cannot be found the default behaviour is to throw an exception
Returns:
ECCommand - an instance of a command
Throws:
ECException -  

createViewCommand

public static ECCommand createViewCommand(ViewRegistryEntry cmdEntry)
                                   throws ECException

getCommandClassNameFromInterface

public static java.lang.String getCommandClassNameFromInterface(java.lang.String commandInterfaceName)
This method returns the default implementation of an interface. The default implementation class name is defined by the field "defaultCommandClassName".

Returns:
String - default implementation class name if defined

locateCommandEntry

public static CommandRegistryEntry locateCommandEntry(java.lang.String cmdRefKey,
                                                      java.lang.Integer storeId)
                                               throws ECSystemException

locateCommandEntry

public static CommandRegistryEntry locateCommandEntry(java.lang.String cmdRefKey,
                                                      java.lang.Integer storeId,
                                                      boolean exceptionNeeded)
                                               throws ECSystemException

locateViewCommandEntry

public static ViewRegistryEntry locateViewCommandEntry(java.lang.String cmdRefKey,
                                                       java.lang.Integer storeId,
                                                       java.lang.Integer deviceFmt)
                                                throws ECException

locateViewCommandEntry

public static ViewRegistryEntry locateViewCommandEntry(java.lang.String cmdRefKey,
                                                       java.lang.Integer storeId,
                                                       java.lang.Integer deviceFmt,
                                                       boolean exceptionNeeded)
                                                throws ECException

locateViewCommandEntry

public static ViewRegistryEntry locateViewCommandEntry(java.lang.String cmdRefKey,
                                                       java.lang.Integer storeId,
                                                       java.lang.Integer deviceFmt,
                                                       java.lang.Integer dftDeviceFmt)
                                                throws ECException

locateViewCommandEntry

public static ViewRegistryEntry locateViewCommandEntry(java.lang.String cmdRefKey,
                                                       java.lang.Integer storeId,
                                                       java.lang.Integer deviceFmt,
                                                       java.lang.Integer dftDeviceFmt,
                                                       boolean exceptionNeeded)
                                                throws ECException

setCommandRegistry

public static void setCommandRegistry(CommandRegistry newValue)
This method set the command registry to be used by the command factory to locate commands.

Parameters:
- - viewRegistry ViewRegistry

setViewRegistry

public static void setViewRegistry(ViewRegistry newValue)
This method set the view registry to be used by the command factory to locate commands.

Parameters:
- - viewRegistry ViewRegistry