public class GetRemoteImageRequest extends java.lang.Object implements ITelesalesRequestHandler
The following are supported refresh types:
Constructor and Description |
---|
GetRemoteImageRequest() |
Modifier and Type | Method and Description |
---|---|
protected java.util.Map | getCacheControls(java.net.URLConnection connection)
This method builds a key-value map with the values available within the Cache-control header value.
|
com.ibm.commerce.telesales.core.IErrorHandler | getErrorHandler()
Returns the error handler associated with the request class.
|
protected java.lang.String | getImagePath()
This method returns the image's path.
|
protected static IRemoteImageDatabase | getLocalDatabase(org.eclipse.core.runtime.IPath localStorePath)
This method returns the local database used to store image metadata.
|
protected org.eclipse.swt.graphics.Image | getLocalImage(org.eclipse.core.runtime.IPath localPath)
This method returns the locally stored image.
|
protected long | getLocalStoreDiskSpace()
This method returns the local store's maximum capacity.
|
protected org.eclipse.core.runtime.IPath | getLocalStorePath()
This method returns the images' local store path.
|
protected long | getNextPollingTime()
This method returns the image's next polling time.
|
protected int | getPollingInterval()
This method returns the image's polling interval.
|
protected int | getRefreshType()
This method returns the image's refresh type.
|
protected org.eclipse.swt.graphics.Image | getRemoteImage(java.net.URLConnection connection)
This method returns the remotely stored image.
|
java.lang.Object | getRequest()
This method returns the image path.
|
ServiceContext | getServiceContext()
This method gets the service context.
|
protected org.eclipse.swt.graphics.Image | handleAlwaysRefresh(java.net.URLConnection connection)
This method handles retrieving the image when the refresh type is set to "Always".
|
protected org.eclipse.swt.graphics.Image | handleAutomaticallyRefresh(java.net.URLConnection connection)
This method handles retrieving the image when the refresh type is set to "Automatically".
|
TelesalesRequestStatus | handleError(TelesalesServicesException ex)
This method handles the exception that is thrown.
|
protected org.eclipse.swt.graphics.Image | handleNeverRefresh(java.net.URLConnection connection)
This method handles retrieving the image when the refresh type is set to "Never".
|
TelesalesRequestStatus | handleResponse(java.lang.Object response)
This method returns the remote image of type org.eclipse.swt.graphics.Image.
|
protected boolean | hasExpired(java.net.URLConnection connection)
This method returns whether the local image has expired and a new copy might exist on the server.
|
protected boolean | hasLocalImage(org.eclipse.core.runtime.IPath localPath)
This method returns whether a local image copy exists.
|
void | init(TelesalesServiceRequest serviceRequest)
This method initializes the request handler.
|
protected boolean | isLocalStoreFull(org.eclipse.core.runtime.IPath localStorePath, long limit)
This method checks if the local store has reached capacity.
|
protected void | removeOldestLastUsedLocalImage(org.eclipse.core.runtime.IPath localStorePath)
This method removes the image with the oldest last used date.
|
void | setErrorHandler(com.ibm.commerce.telesales.core.IErrorHandler errorHandler)
Set the error handler associated with a request class.
|
protected void | setLocalDatabase(IRemoteImageDatabase database)
This method sets the local database used to store image metadata.
|
protected void | storeImage(java.net.URLConnection connection, org.eclipse.core.runtime.IPath localStorePath, org.eclipse.core.runtime.IPath imagePath)
This method downloads the remote image and stores it in the given localStorePath.
|
protected void | storeImageMetaData(java.lang.String imagePath, long expires, long lastModified, java.lang.String etag, long lastUsed, long lastUpdated, long lastUpdateCheck)
This method stores the image's metadata using the local database.
|
public void init(TelesalesServiceRequest serviceRequest)
public java.lang.Object getRequest()
public ServiceContext getServiceContext()
public TelesalesRequestStatus handleResponse(java.lang.Object response)
protected org.eclipse.swt.graphics.Image handleNeverRefresh(java.net.URLConnection connection)
protected org.eclipse.swt.graphics.Image handleAlwaysRefresh(java.net.URLConnection connection)
protected org.eclipse.swt.graphics.Image handleAutomaticallyRefresh(java.net.URLConnection connection)
protected java.lang.String getImagePath()
protected org.eclipse.core.runtime.IPath getLocalStorePath()
protected int getRefreshType()
protected int getPollingInterval()
protected long getNextPollingTime()
protected long getLocalStoreDiskSpace()
protected org.eclipse.swt.graphics.Image getLocalImage(org.eclipse.core.runtime.IPath localPath)
protected static IRemoteImageDatabase getLocalDatabase(org.eclipse.core.runtime.IPath localStorePath)
protected void setLocalDatabase(IRemoteImageDatabase database)
protected org.eclipse.swt.graphics.Image getRemoteImage(java.net.URLConnection connection)
protected void storeImage(java.net.URLConnection connection, org.eclipse.core.runtime.IPath localStorePath, org.eclipse.core.runtime.IPath imagePath)
Note: When the image is stored locally, the modified timestamp will be set to the remote copies last modified timestamp. This will allow the request class to identify more easily when a new copy is available.
protected void storeImageMetaData(java.lang.String imagePath, long expires, long lastModified, java.lang.String etag, long lastUsed, long lastUpdated, long lastUpdateCheck)
protected void removeOldestLastUsedLocalImage(org.eclipse.core.runtime.IPath localStorePath)
protected boolean hasExpired(java.net.URLConnection connection)
protected boolean hasLocalImage(org.eclipse.core.runtime.IPath localPath)
protected boolean isLocalStoreFull(org.eclipse.core.runtime.IPath localStorePath, long limit)
protected java.util.Map getCacheControls(java.net.URLConnection connection)
The following values are mapped: must-revalidate no-store no-cache max-age s-maxage
public com.ibm.commerce.telesales.core.IErrorHandler getErrorHandler()
public void setErrorHandler(com.ibm.commerce.telesales.core.IErrorHandler errorHandler)
public TelesalesRequestStatus handleError(TelesalesServicesException ex)