com.ibm.commerce.scheduler.commands
Class RefreshLocalRegistryCmdImpl

java.lang.Object
  |
  +--CacheableCommandImpl
        |
        +--com.ibm.commerce.command.AbstractECTargetableCommand
              |
              +--com.ibm.commerce.command.ControllerCommandImpl
                    |
                    +--com.ibm.commerce.command.AsyncControllerCommandImpl
                          |
                          +--com.ibm.commerce.scheduler.commands.RefreshLocalRegistryCmdImpl
All Implemented Interfaces:
AccCommand, AsyncCommand, ControllerCommand, ECCommand, ECTargetableCommand, RefreshLocalRegistryCmd, java.lang.Runnable

public class RefreshLocalRegistryCmdImpl
extends AsyncControllerCommandImpl
implements java.lang.Runnable, AsyncCommand, RefreshLocalRegistryCmd

Refresh the local copy of all registries or the specified registry. This command can only be involved by the scheduler and must be a broadcast job. This is because it has a dependency to update the job state.

The command has the following parameters:

Retrieves the registries to update from the Registry Manager and updates them. Then updates the schedule status.

See Also:
Serialized Form

Field Summary
protected  SchedulerBroadcastAccessBean abBroadcast
           
protected  SchedulerConfigAccessBean abConfig
           
protected  SchedulerStatusAccessBean abStatus
           
static java.lang.String COPYRIGHT
          IBM Copyright notice field.
protected  boolean isBroadcast
           
 
Fields inherited from class com.ibm.commerce.command. AsyncControllerCommandImpl
jobInstanceId, jobReferenceId
 
Fields inherited from class com.ibm.commerce.command. ControllerCommandImpl
requestProperties, responseProperties, retriable, viewReqProperties
 
Fields inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
commandContext
 
Fields inherited from interface com.ibm.commerce.scheduler.commands. RefreshLocalRegistryCmd
defaultCommandClassName, NAME, URLNAME
 
Constructor Summary
RefreshLocalRegistryCmdImpl()
          Creates the RefreshLocalRegistry command object.
 
Method Summary
protected  java.lang.String getRegistryName()
          Gets the name of the registry to be refreshed.
protected  java.lang.String getUrl()
          Gets the URL to be redirected to at the end of the command.
 void performExecute()
          This method contains the main business logic of this command.
 void refreshRegistry()
          This method calls the RegistryManager to refresh one all all registries.
 void run()
          This method is required by the runnable interface.
 void setRegistryName(java.lang.String name)
          Sets the name of the registry to be refreshed.
 void setRequestProperties( TypedProperty reqParms)
          This method extracts the required parameters from the request properties and sets it locally in the command.
 void setUrl(java.lang.String url)
          Sets the URL to be redirected to at the end of the command.
 boolean updateState(java.lang.String newState, java.lang.String excepCode)
          Update the state of the broadcast job corresponding to the command.
 
Methods inherited from class com.ibm.commerce.command. AsyncControllerCommandImpl
getJobInstanceId, getJobReferenceId, setJobInstanceId, setJobReferenceId
 
Methods inherited from class com.ibm.commerce.command. ControllerCommandImpl
checkPermission, fulfills, getForUserId, getGeneric, getOwner, getRequestProperties, getResolvedRequestProperties, getResourceOwners, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setForUserId, setGeneric, setOwner, setResponseProperties, setRetriable, setViewInputProperties
 
Methods inherited from class com.ibm.commerce.command. AbstractECTargetableCommand
accessControlCheck, checkIsAllowed, checkParameters, checkResourcePermission, createCommandExecutionEvent, execute, finalize, getAccCheck, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, isReadyToCallExecute, reset, setAccCheck, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.commerce.command. AsyncCommand
getJobInstanceId, getJobReferenceId, setJobInstanceId, setJobReferenceId
 
Methods inherited from interface com.ibm.commerce.command. ControllerCommand
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRetriable, setViewInputProperties
 
Methods inherited from interface com.ibm.commerce.command. AccCommand
accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
 
Methods inherited from interface com.ibm.commerce.command. ECCommand
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getResources, getStoreId, getUser, getUserId, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
 

Field Detail
public static final java.lang.String COPYRIGHT
IBM Copyright notice field.
See Also:
Constant Field Values

abConfig

protected SchedulerConfigAccessBean abConfig

abBroadcast

protected SchedulerBroadcastAccessBean abBroadcast

abStatus

protected SchedulerStatusAccessBean abStatus

isBroadcast

protected boolean isBroadcast
Constructor Detail

RefreshLocalRegistryCmdImpl

public RefreshLocalRegistryCmdImpl()
Creates the RefreshLocalRegistry command object.
Method Detail

getRegistryName

protected java.lang.String getRegistryName()
Gets the name of the registry to be refreshed.
Returns:
The name of the registry to refresh. null will be returned if all registries will be refreshed.

getUrl

protected java.lang.String getUrl()
Gets the URL to be redirected to at the end of the command.
Returns:
the URL to redirect to.

performExecute

public void performExecute()
                    throws ECException
This method contains the main business logic of this command. If a scheduler exists, then it will schedule another thread to perform the registry update.
Specified by:
performExecute in interface ECCommand
Overrides:
performExecute in class AbstractECTargetableCommand
Throws:
ECException - If there is an exception when refreshing the registry.

refreshRegistry

public void refreshRegistry()
This method calls the RegistryManager to refresh one all all registries. The command is executed within a transaction. At the end of the refresh, the corresponding entry in the SCHBRDCST table will be updated.

run

public void run()
This method is required by the runnable interface. This is where the RefreshRegistry method is invoked.
Specified by:
run in interface java.lang.Runnable

setRegistryName

public void setRegistryName(java.lang.String name)
Sets the name of the registry to be refreshed.
Specified by:
setRegistryName in interface RefreshLocalRegistryCmd
Parameters:
name - the registry name. If null is specified, then all registries will be updated.

setRequestProperties

public void setRequestProperties(TypedProperty reqParms)
                          throws ECApplicationException
This method extracts the required parameters from the request properties and sets it locally in the command. It throws an ECApplicationException if a required parameter is missing.
Specified by:
setRequestProperties in interface ControllerCommand
Overrides:
setRequestProperties in class ControllerCommandImpl
Parameters:
reqParms - the command parameters.
Throws:
ECApplicationException - if there was a problem updating the registry.

setUrl

public void setUrl(java.lang.String url)
Sets the URL to be redirected to at the end of the command.
Parameters:
url - the URL to redirect to.

updateState

public boolean updateState(java.lang.String newState,
                           java.lang.String excepCode)
Update the state of the broadcast job corresponding to the command.
Parameters:
newState - the status of the job
excepCode - the exception code correspond to an error state
Returns:
true if there was no problems updating the state and false if there was an exception when trying to update the state.