public abstract class AbstractFileRepository extends Object implements Repository, Configurable, LogEnabled
| Modifier and Type | Field and Description |
|---|---|
protected static int |
BYTE_MASK |
protected static boolean |
DEBUG |
protected static char[] |
HEX_DIGITS |
protected File |
m_baseDirectory |
protected String |
m_extension |
protected FilenameFilter |
m_filter |
protected String |
m_name |
| Constructor and Description |
|---|
AbstractFileRepository() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(org.apache.commons.configuration.HierarchicalConfiguration configuration)
Configure the object.
|
boolean |
containsKey(String key)
Indicates if the given key is associated to a contained object
|
protected AbstractFileRepository |
createChildRepository()
Return a new instance of this class
|
protected String |
decode(String filename)
Inverse of encode exept it do not use path.
|
protected String |
encode(String key)
Returns a String that uniquely identifies the object.
|
Repository |
getChildRepository(String childName) |
protected abstract String |
getExtensionDecorator() |
protected File |
getFile(String key)
Return the File Object which belongs to the given key
|
protected InputStream |
getInputStream(String key)
Return the InputStream which belongs to the given key
|
protected org.slf4j.Logger |
getLogger() |
protected OutputStream |
getOutputStream(String key)
Return the OutputStream which belongs to the given key
|
void |
init() |
Iterator<String> |
list()
Returns the list of used keys.
|
void |
remove(String key)
Remove the object associated to the given key.
|
protected void |
setDestination(String destination)
Set the destination for the repository
|
void |
setFileSystem(FileSystem fileSystem) |
void |
setLog(org.slf4j.Logger logger)
Sets the service log.
|
protected static final boolean DEBUG
protected static final int BYTE_MASK
protected static final char[] HEX_DIGITS
protected String m_extension
protected String m_name
protected FilenameFilter m_filter
protected File m_baseDirectory
public void configure(org.apache.commons.configuration.HierarchicalConfiguration configuration)
throws org.apache.commons.configuration.ConfigurationException
Configurableconfigure in interface Configurableorg.apache.commons.configuration.ConfigurationExceptionpublic void setFileSystem(FileSystem fileSystem)
public void setLog(org.slf4j.Logger logger)
LogEnabledsetLog in interface LogEnabledlogger - not nullprotected org.slf4j.Logger getLogger()
protected abstract String getExtensionDecorator()
@PostConstruct public void init() throws Exception
Exceptionprotected void setDestination(String destination) throws org.apache.commons.configuration.ConfigurationException
destination - the destination under which the repository get storedorg.apache.commons.configuration.ConfigurationExceptionorg.apache.commons.configuration.ConfigurationException - get thrown on invalid destintion syntaxprotected AbstractFileRepository createChildRepository() throws Exception
Exception - get thrown if an error is detected while create the new
instancepublic Repository getChildRepository(String childName)
getChildRepository in interface RepositoryRepository.getChildRepository(java.lang.String)protected File getFile(String key) throws IOException
key - the key for which the File get returnedIOException - get thrown on IO errorprotected InputStream getInputStream(String key) throws IOException
key - the key for which the InputStream get returnedIOException - get thrown on IO errorprotected OutputStream getOutputStream(String key) throws IOException
key - the key for which the OutputStream get returnedIOException - get thrown on IO errorpublic void remove(String key)
key - the key to removepublic boolean containsKey(String key)
key - the key which checked forprotected String encode(String key)
key - the key for which the Object should be searchedprotected String decode(String filename)
filename - the filename for which the key should generatedCopyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.