Package com.ibm.websphere.command
Class CacheableCommandImpl
- java.lang.Object
- 
- com.ibm.websphere.command.TargetableCommandImpl
- 
- com.ibm.websphere.command.CacheableCommandImpl
 
 
- 
- All Implemented Interfaces:
- com.ibm.websphere.cache.Sizeable,- CacheableCommand,- Command,- CommandCaller,- TargetableCommand,- java.io.Serializable
 - Direct Known Subclasses:
- CacheableCommandImpl
 
 public abstract class CacheableCommandImpl extends TargetableCommandImpl implements CacheableCommand, com.ibm.websphere.cache.Sizeable This CacheableCommandImpl abstract class provides an implementation for all CacheableCommand interface methods except those that the command writer must write. This class provides a runtime for command execution that interacts with the CommandCache. It also provides the contract between this command runtime and the command writer.CacheableCommandImpl is a super class of all CacheableCommands. - See Also:
- Serialized Form
 
- 
- 
Field Summary- 
Fields inherited from class com.ibm.websphere.command.TargetableCommandImplLOCAL
 - 
Fields inherited from interface com.ibm.websphere.command.CommandserialVersionUID
 
- 
 - 
Constructor SummaryConstructors Constructor Description CacheableCommandImpl()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()This implements the method in the Command interface, overriding the implementation in TargetableCommandImpl.booleanexecuteFromCache()executeFromCache This method will check the cache to see if the given command is present.CommandCallergetCaller()Implements the CacheableCommand interface method.com.ibm.websphere.cache.EntryInfogetEntryInfo()The gets this command's EntryInfo object, which holds its caching metadata.java.lang.StringgetId()This is the method in the CacheableCommand interface.longgetObjectSize()intgetSharingPolicy()This is the method in the CacheableCommand interface.voidpostExecute()Implements the CacheableCommand interface.booleanpreExecute()This implements the CacheableCommand interface.voidreset()Reset the command for reuse.voidsetCaller(CommandCaller caller)Implements the CacheableCommand interface method.voidsetObjectSize(long objectSize)voidunionDependencies(com.ibm.websphere.cache.EntryInfo entryInfo)This is called by the CommandCache to add dependencies to this command.voidupdateCache()This method will cause the current command to be placed into the cache.- 
Methods inherited from class com.ibm.websphere.command.TargetableCommandImplgetCommandTarget, getCommandTargetName, getTargetPolicy, hasOutputProperties, isReadyToCallExecute, performExecute, setCommandTarget, setCommandTargetName, setHasOutputProperties, setOutputProperties, setTargetPolicy
 - 
Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface com.ibm.websphere.command.CommandisReadyToCallExecute
 - 
Methods inherited from interface com.ibm.websphere.command.TargetableCommandgetCommandTarget, getCommandTargetName, hasOutputProperties, performExecute, setCommandTarget, setCommandTargetName, setOutputProperties
 
- 
 
- 
- 
- 
Method Detail- 
getIdpublic final java.lang.String getId() This is the method in the CacheableCommand interface. This must be implemented by the command writer.- Specified by:
- getIdin interface- CacheableCommand
- Returns:
- The cache id.
 
 - 
getSharingPolicypublic final int getSharingPolicy() This is the method in the CacheableCommand interface. This should be implemented by the command writer only if the default of EntryInfo.SHARED_PULL is not desired.- Specified by:
- getSharingPolicyin interface- CacheableCommand
- Returns:
- The sharing policy id.
 
 - 
preExecutepublic boolean preExecute() This implements the CacheableCommand interface. This should be implemented by the command writer only if there is something that needs to be done prior to executing the command on the server.- Specified by:
- preExecutein interface- CacheableCommand
- Returns:
- True implies that the command's execution should be terminated, so the performExecute, postExecute and setCommand will not happen.
 
 - 
postExecutepublic void postExecute() Implements the CacheableCommand interface. This should be implemented by the command writer only if there is something that needs to be done after executing the command on the server.- Specified by:
- postExecutein interface- CacheableCommand
 
 - 
executepublic void execute() throws CommandExceptionThis implements the method in the Command interface, overriding the implementation in TargetableCommandImpl.It does the following: - Throws an UnsetInputPropertiesException if this command's isReadyToCallExecute method returns false.
- Get the CommandTarget for this command from the targetPolicy.
- If it is cached, return the cached command. The command may be cached locally or in the coordinator for the command.
- If it is not cached, call the CommandTargetProxy.executeCommand method to execute the command, which calls the TargetableCommand.performExecute method, and cache it. The command may be run locally or in the coordinator for the command. The command may be cached after execution, depending on the sharing policy.
- If the hasOutputProperties method returns true and the returned command is not the same instance as this command, it calls the setOutputProperties method so that the results will be copied into this command.
- Set the time of execution of the command.
 - Specified by:
- executein interface- Command
- Overrides:
- executein class- TargetableCommandImpl
- Throws:
- CommandException- The superclass for all command exceptions.
 
 - 
setCallerpublic void setCaller(CommandCaller caller) Implements the CacheableCommand interface method.- Specified by:
- setCallerin interface- CacheableCommand
- Parameters:
- caller- The command that called this command.
 
 - 
getCallerpublic CommandCaller getCaller() Implements the CacheableCommand interface method.- Specified by:
- getCallerin interface- CacheableCommand
- Returns:
- The caller of the command.
 
 - 
unionDependenciespublic void unionDependencies(com.ibm.websphere.cache.EntryInfo entryInfo) This is called by the CommandCache to add dependencies to this command.- Specified by:
- unionDependenciesin interface- CommandCaller
- Parameters:
- entryInfo- This command's entryInfo.
 
 - 
getEntryInfopublic com.ibm.websphere.cache.EntryInfo getEntryInfo() The gets this command's EntryInfo object, which holds its caching metadata.- Specified by:
- getEntryInfoin interface- CacheableCommand
- Returns:
- The EntryInfo object.
 
 - 
resetpublic void reset() Reset the command for reuse.- Specified by:
- resetin interface- Command
- Specified by:
- resetin class- TargetableCommandImpl
 
 - 
executeFromCachepublic boolean executeFromCache() throws CommandExceptionexecuteFromCache This method will check the cache to see if the given command is present. If so then the command is populated with the cached results and true is returned. If the command is not cached, then false is returned and no change is made to the state of the command.- Specified by:
- executeFromCachein interface- CacheableCommand
- Returns:
- true if the command was retrieved from cache
- Throws:
- CommandException
 
 - 
updateCachepublic void updateCache() This method will cause the current command to be placed into the cache. Any existing entry with the same cache id will be replaced.- Specified by:
- updateCachein interface- CacheableCommand
 
 - 
getObjectSizepublic long getObjectSize() - Specified by:
- getObjectSizein interface- com.ibm.websphere.cache.Sizeable
 
 - 
setObjectSizepublic void setObjectSize(long objectSize) 
 
- 
 
-