com.ibm.websphere.command.web

Class CacheableCommandImpl

  1. java.lang.Object
  2. extended byTargetableCommandImpl
  3. extended bycom.ibm.websphere.command.web.CacheableCommandImpl

  1. public abstract class CacheableCommandImpl
  2. extends TargetableCommandImpl
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.


Constructor Summary

Constructor and Description
CacheableCommandImpl()

Method Summary

Modifier and Type Method and Description
  1. void
execute()
This implements the method in the Command interface, overriding the implementation in TargetableCommandImpl.
  1. boolean
executeFromCache()
executeFromCache This method will check the cache to see if the given command is present.
  1. CommandCaller
getCaller()
Implements the CacheableCommand interface method.
  1. com.ibm.websphere.cache.EntryInfo
getEntryInfo()
The gets this command's EntryInfo object, which holds its caching metadata.
  1. java.lang.String
getId()
This is the method in the CacheableCommand interface.
  1. long
getObjectSize()
  1. int
getSharingPolicy()
This is the method in the CacheableCommand interface.
  1. void
postExecute()
Implements the CacheableCommand interface.
  1. boolean
preExecute()
This implements the CacheableCommand interface.
  1. void
reset()
Reset the command for reuse.
  1. void
setCaller(CommandCaller caller)
Implements the CacheableCommand interface method.
  1. void
setObjectSize(long objectSize)
  1. void
unionDependencies(com.ibm.websphere.cache.EntryInfo entryInfo)
This is called by the CommandCache to add dependencies to this command.
  1. void
updateCache()
This method will cause the current command to be placed into the cache.
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

CacheableCommandImpl

  1. public CacheableCommandImpl()

Method Detail

getId

  1. public final java.lang.String getId( )
This is the method in the CacheableCommand interface. This must be implemented by the command writer.
Returns:
The cache id.

getSharingPolicy

  1. public 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.
Returns:
The sharing policy id.

preExecute

  1. public 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.

postExecute

  1. public 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.

execute

  1. public void execute()
  2. throws CommandException
This 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.
Throws:
CommandException - The superclass for all command exceptions.

setCaller

  1. public void setCaller(CommandCaller caller)
Implements the CacheableCommand interface method.
Parameters:
caller - The command that called this command.

getCaller

  1. public CommandCaller getCaller( )
Implements the CacheableCommand interface method.
Returns:
The caller of the command.

unionDependencies

  1. public void unionDependencies(com.ibm.websphere.cache.EntryInfo entryInfo)
This is called by the CommandCache to add dependencies to this command.
Parameters:
entryInfo - This command's entryInfo.

getEntryInfo

  1. public com.ibm.websphere.cache.EntryInfo getEntryInfo( )
The gets this command's EntryInfo object, which holds its caching metadata.
Returns:
The EntryInfo object.

reset

  1. public void reset()
Reset the command for reuse.

executeFromCache

  1. public boolean executeFromCache( )
  2. throws CommandException
executeFromCache 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.
Returns:
true if the command was retrieved from cache
Throws:
CommandException

updateCache

  1. public 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.

getObjectSize

  1. public long getObjectSize()

setObjectSize

  1. public void setObjectSize(long objectSize)