|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The CacheHandler interface defines the contract for classes capable of supporting the cache management aspects of a transit system. Cache management encompasses the retreval of resources based on artifact identifiers. A cache manager implementations may provide varying levels of quality-of-services. Selection of a cache manager is defined under the transit cache configuration properties.
Method Summary | |
OutputStream |
createOutputStream(Artifact artifact)
Creates an output stream to where the artifact content can be written to. |
File |
getCacheDirectory()
Return the current cache directory. |
Layout |
getLayout()
Return the layout used by the cache. |
LayoutRegistry |
getLayoutRegistry()
Return the layout registry. |
File |
getLocalFile(Artifact artifact)
Return the cache directory. |
InputStream |
getResource(Artifact artifact)
Attempts to download and cache a remote artifact using a set of remote repositories. |
InputStream |
getResource(Artifact artifact,
String internalReference)
Attempts to download and cache a remote artifact using a set of remote repositories. |
void |
initialize()
Initialization of the cache handler. |
Method Detail |
public File getLocalFile(Artifact artifact) throws IOException
artifact
- the artifact to resolve
IOException
- if an IO error occurspublic void initialize() throws IOException
IOException
- if an IO error occurspublic InputStream getResource(Artifact artifact) throws IOException, TransitException
artifact
- the artifact to retrieve and cache
IOException
- if an IO error occurs
TransitException
- is a transit system error occurspublic InputStream getResource(Artifact artifact, String internalReference) throws IOException, TransitException
This method allows an internal reference to be passed to the cache handler and it is expected to return the InputStream of the internal item inside Jar/Zip files. If this method is called, the implementation can assume that the artifact is a Zip file.
artifact
- the artifact to retrieve and cacheinternalReference
- referencing a item within the artifact. This
argument may start with "!" or "!/", which should be ignored.
IOException
- if an IO error occurs
TransitException
- is a transit system error occurspublic OutputStream createOutputStream(Artifact artifact) throws NullArgumentException, ArtifactAlreadyExistsException, IOException
If the artifact already exists, a ArtifactAlreadyExistsException
will be thrown. If the directory doesn't exists, it will be created.
The CacheHandler is responsible to recognize the completion of the
writes through the close()
method in the output stream,
and do any post-processing there.
artifact
- the artifact
NullArgumentException
- if the artifact argument is null.
ArtifactAlreadyExistsException
- if the artifact already exists in the cache.
IOException
- if an IO error occurspublic Layout getLayout()
public LayoutRegistry getLayoutRegistry()
public File getCacheDirectory()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |