public abstract class AbstractResource extends AbstractDestructableInitializableComponent implements Resource
| Modifier and Type | Field and Description |
|---|---|
private String |
location
Location of the resource.
|
| Constructor and Description |
|---|
AbstractResource() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract boolean |
doExists()
Checks whether the resource exists.
|
protected abstract InputStream |
doGetInputStream()
Gets the input stream to the resource's data.
|
protected abstract long |
doGetLastModifiedTime()
Gets the time, in milliseconds since the epoch, when the resource was last modified.
|
protected void |
doValidate()
Performs the logic to validate this component.
|
boolean |
equals(Object obj)
Two resources are considered equal if they are of the same type and and have the same location.
|
boolean |
exists()
Checks whether the resource exists.
|
InputStream |
getInputStream()
Gets the input stream to the resource's data.
|
long |
getLastModifiedTime()
Gets the time, in milliseconds since the epoch, when the resource was last modified.
|
String |
getLocation()
Gets resource location information.
|
int |
hashCode() |
protected void |
setLocation(String resourceLocation)
Sets the resource location.
|
String |
toString() |
void |
validate()
Checks whether this component is valid and ready to be used.
|
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitializedclone, finalize, getClass, notify, notifyAll, wait, wait, waitdestroy, isDestroyedinitialize, isInitializedprivate String location
public final void validate()
throws ComponentValidationException
This method delegates to doValidate() if the component is not destroyed and is initialized.
validate in interface ValidatableComponentComponentValidationException - thrown if the component is not currently in a valid and usable state@Nonnull public final boolean exists() throws ResourceException
This method delegates to doExists() if this component is not destroyed and is initialized.
exists in interface ResourceResourceException - thrown if there is a problem determining if the resource exists@Nonnull public final InputStream getInputStream() throws ResourceException
This method delegates to doGetInputStream() if this component is not destroyed and is initialized.
getInputStream in interface ResourceResourceException - thrown if an input stream can not be created for the resource@Nonnull public final long getLastModifiedTime() throws ResourceException
This method delegates to doGetLastModifiedTime() if this component is not destroyed and is initialized.
getLastModifiedTime in interface ResourceResourceException - thrown if the last modified time can not be determined@Nonnull public final String getLocation()
getLocation in interface Resourcepublic boolean equals(@Nullable Object obj)
protected void setLocation(@Nullable String resourceLocation)
resourceLocation - the resource locationprotected void doValidate()
throws ComponentValidationException
This implementation checks that the resource exists via exists().
ComponentValidationException - thrown if the component is not valid@Nonnull protected abstract boolean doExists() throws ResourceException
ResourceException - thrown if there is a problem determining if the resource exists@Nonnull protected abstract InputStream doGetInputStream() throws ResourceException
ResourceException - thrown if an input stream can not be created for the resource@Nonnull protected abstract long doGetLastModifiedTime() throws ResourceException
ResourceException - thrown if the last modified time can not be determinedCopyright © 1999-2013. All Rights Reserved.