net.sourceforge.sconman
Interface IRepository

All Superinterfaces:
IXMLSerializable
All Known Implementing Classes:
FSBasicRepository, FSQuotedRepository

public interface IRepository
extends IXMLSerializable

File repository interface

Author:
mikeshadow

Nested Class Summary
static interface IRepository.IVisitor
          Visitor for repository entries
 
Field Summary
static int STORE_OK
          Store code with ok result
 
Method Summary
 java.lang.String add(java.lang.String basePath, java.lang.String fileName)
          Given a filename, return a valid path to store it calling getOutputStream(java.lang.String)
 java.lang.String addNonamed(java.lang.String basePath, java.lang.String fileExtension)
          Given a file extension, return a valid path to store it calling getOutputStream(java.lang.String)
 boolean exists(java.lang.String path)
          Checks if 'path' points to a valid entry
 Category getCategory()
          Gets the category of the repository
 java.io.InputStream getInputStream(java.lang.String path)
          Returns an input channel to read contents
 java.util.Date getLastModified(java.lang.String path)
          Returns the last lastAccessed time for the pointed entry
 java.io.OutputStream getOutputStream(java.lang.String path)
          Returns an output channel to store contents
 void initialize()
          Initialize the repository
 void remove(java.lang.String path)
          Removes the stored file, given its path
 void setCategory(Category category)
          Sets the category to the repository
 long size(java.lang.String path)
          Gets the size of the file
 int store(java.io.InputStream is, java.lang.String path)
          Store an InputStream in the repository
 void visit(java.lang.String rootPath, IRepository.IVisitor visitor)
          Visitor pattern for the repository.
 
Methods inherited from interface net.sourceforge.sconman.IXMLSerializable
deserializeXML, serializeXML
 

Field Detail

STORE_OK

static final int STORE_OK
Store code with ok result

See Also:
Constant Field Values
Method Detail

exists

boolean exists(java.lang.String path)
Checks if 'path' points to a valid entry

Parameters:
path - The path to check
Returns:
True if 'path' points to a valid entry

getLastModified

java.util.Date getLastModified(java.lang.String path)
Returns the last lastAccessed time for the pointed entry

Parameters:
path - The path to the entry
Returns:
Java time as long

getOutputStream

java.io.OutputStream getOutputStream(java.lang.String path)
                                     throws java.io.IOException
Returns an output channel to store contents

Parameters:
path - The path to the file
Returns:
The output stream to store data
Throws:
java.io.IOException

getInputStream

java.io.InputStream getInputStream(java.lang.String path)
                                   throws java.io.IOException
Returns an input channel to read contents

Parameters:
path - The path to the file
Returns:
The input stream to read data from
Throws:
java.io.IOException

store

int store(java.io.InputStream is,
          java.lang.String path)
          throws java.io.IOException
Store an InputStream in the repository

Parameters:
is - The InputStream
path - The path to the file
Returns:
Error code
Throws:
java.io.IOException

remove

void remove(java.lang.String path)
            throws java.io.IOException
Removes the stored file, given its path

Parameters:
path -
Throws:
java.io.IOException

add

java.lang.String add(java.lang.String basePath,
                     java.lang.String fileName)
                     throws java.io.IOException
Given a filename, return a valid path to store it calling getOutputStream(java.lang.String)

Parameters:
fileName - The file id
Returns:
The path pointing to a valid storage entry within the repository
Throws:
java.io.IOException

addNonamed

java.lang.String addNonamed(java.lang.String basePath,
                            java.lang.String fileExtension)
                            throws java.io.IOException
Given a file extension, return a valid path to store it calling getOutputStream(java.lang.String)

Parameters:
fileExtension - The file extension
Returns:
The path pointing to a valid storage entry within the repository
Throws:
java.io.IOException

visit

void visit(java.lang.String rootPath,
           IRepository.IVisitor visitor)
Visitor pattern for the repository. This method will traverse all the repository entries from the specified root path, calling the visitor for each entry

Parameters:
rootPath - The root path where the visits should begin at
visitor - The visitor that will traverse the repository

initialize

void initialize()
                throws java.io.IOException
Initialize the repository

Throws:
java.io.IOException

size

long size(java.lang.String path)
Gets the size of the file

Parameters:
path - The path to the file
Returns:
The size of the file

setCategory

void setCategory(Category category)
Sets the category to the repository

Parameters:
category - The category

getCategory

Category getCategory()
Gets the category of the repository

Returns:
The category


Copyright null null. All Rights Reserved.