|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FileContentRepository
Defines an abstraction layer on top of a physical repository of files.
| Method Summary | |
|---|---|
void |
attachProperties(byte[] hashKey,
Map<String,String> properties)
Attaches the specified properites to the file identified by the hash. |
byte[] |
createTemporaryHashKey()
Creates a temporary hash key for the given file. |
byte[] |
decodeFromInternalURI(URI internalURI)
Decodes the hash key from a sharable network or machine internal URI. |
byte[] |
decodeHashKey(String hashKey)
Decodes the hash key from string. |
String |
encodeHashKey(byte[] hashKey)
Encodes the hash key to string. |
URI |
encodeToInternalURI(byte[] hashKey)
Encodes the hash key to a sharable network or machine internal URI. |
String |
getHashKeyAlgorithm()
Returns the name of the MessageDigest algorithm used for creating hashKeys. |
Date |
getLastModified(byte[] hashKey)
Returns the time of the last modification. |
boolean |
isExisting(byte[] hashKey)
Returns true if the file exists inside the underlying repository. |
MessageDigest |
newHashKeyDigest()
Returns a new instance of the MessageDigest used for creating hashKeys. |
InputStream |
openForRead(byte[] hashKey)
Returns true if the file exists inside the underlying repository. |
DigestOutputStream |
openForWrite(byte[] hashKey)
Opens the specified file for writing. |
Map<String,String> |
readProperties(byte[] hashKey)
Reads previously attached properties. |
void |
rename(byte[] fromHashKey,
byte[] toHashKey)
Renames the specified resource, if possible. |
| Method Detail |
|---|
String getHashKeyAlgorithm()
MessageDigest newHashKeyDigest()
boolean isExisting(byte[] hashKey)
hashKey - the hash key identifying the file.
Date getLastModified(byte[] hashKey)
hashKey - the hash key identifying the file.
DigestOutputStream openForWrite(byte[] hashKey)
throws FileNotFoundException,
IllegalStateException
out.getMessageDigest().digest() can be used to retrieve the final hashKey for a resource stored with
a temporary key.
hashKey - the hash key identifying the file.
FileNotFoundException - if the file exists but is a directory rather than a regular file, does
not exist but cannot be created, or cannot be opened for any other reason
IllegalStateException - In case of the repository doesn't allow to write to the specified resource.
May happen in write once repositories, when an attempt is made to overwrite
a resource)
void attachProperties(byte[] hashKey,
Map<String,String> properties)
throws IOException
hashKey - the hash key identifying the file.properties - the properties to attach to the file.
IOException - in case of attaching the properties failed.
InputStream openForRead(byte[] hashKey)
throws FileNotFoundException
hashKey - the hash key identifying the file.
FileNotFoundException - In case of the file, identified by the hashKey does not exist.
Map<String,String> readProperties(byte[] hashKey)
throws IOException
hashKey - the hash key identifying the file.
FileNotFoundException - In case of the file, identified by the hashKey does not exist.
IOException
void rename(byte[] fromHashKey,
byte[] toHashKey)
throws FileNotFoundException,
IllegalArgumentException
fromHashKey - The key identifying the resource to be renamed,toHashKey - The new name of the resource.
IllegalArgumentException - In case of a resource is renamed to a name that
is considered invalid by the repository.
FileNotFoundException - In case of the file,
identified by the hashKey does not exist.byte[] createTemporaryHashKey()
URI encodeToInternalURI(byte[] hashKey)
hashKey - the hash key identifying the file.
byte[] decodeFromInternalURI(URI internalURI)
internalURI - a sharable network or machine internal URI.
String encodeHashKey(byte[] hashKey)
hashKey - the hash key identifying the file.
byte[] decodeHashKey(String hashKey)
hashKey - the hash key string.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||