Project Wonder 5.0.0.8795

er.extensions.foundation
Class ERXFileRepository

java.lang.Object
  extended by er.extensions.foundation.ERXFileRepository

public class ERXFileRepository
extends Object

Allows you to store a large amount of files and folders without the hassles of directory size limitations. The files are stored by an abstract "key" which is by default a ERXRandomGUID. Under the root directory, there will be directories for the first two characters and under these again directories for the next two characters of the GUID.

Author:
ak (original version by Dominik Westner)

Field Summary
protected  File _root
           
 
Constructor Summary
protected ERXFileRepository(File root)
          Private constructor, as we use the factory methods to create instances.
 
Method Summary
static ERXFileRepository addRepository(String name, ERXFileRepository repository)
          Adds a repository under the given name and the given root directory.
static ERXFileRepository addRepository(String name, File root)
          Adds a repository under the given name and the given root directory.
 File createFile()
          Returns a new file in the repository.
 File getFile(String id)
          Returns a file for a
 File getRoot()
          Returns the root directory for the repository.
 boolean hasFile(String id)
          Returns true if the file is present in the repository and also exists.
static ERXFileRepository respository(String name)
          Returns the repository that is registered under the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_root

protected File _root
Constructor Detail

ERXFileRepository

protected ERXFileRepository(File root)
Private constructor, as we use the factory methods to create instances.

Parameters:
root -
Method Detail

createFile

public File createFile()
Returns a new file in the repository. As you can also create directories it does not really create the file, only the path to the file. You can use file.getName() to get at the GUID which is the key to the file.


getFile

public File getFile(String id)
Returns a file for a

Parameters:
id -

hasFile

public boolean hasFile(String id)
Returns true if the file is present in the repository and also exists.

Parameters:
id -

getRoot

public File getRoot()
Returns the root directory for the repository.


respository

public static ERXFileRepository respository(String name)
Returns the repository that is registered under the given name.

Parameters:
name -

addRepository

public static ERXFileRepository addRepository(String name,
                                              File root)
Adds a repository under the given name and the given root directory.

Parameters:
name -
root -

addRepository

public static ERXFileRepository addRepository(String name,
                                              ERXFileRepository repository)
Adds a repository under the given name and the given root directory.

Parameters:
name -
repository -

Last updated: Fri, Jan 9, 2009 • 04:35 AM EST

Copyright © 2002 – 2007 Project Wonder.