ERXFileRepository Class Reference

Collaboration diagram for ERXFileRepository:

Collaboration graph
[legend]

List of all members.

Classes

class  DefaultFactory
interface  Factory

Public Member Functions

File createFile ()
File getFile (String id)
File getRoot ()
boolean hasFile (String id)

Static Public Member Functions

static ERXFileRepository addRepository (String name, ERXFileRepository repository)
static ERXFileRepository addRepository (String name, File root, Factory factory)
static ERXFileRepository addRepository (String name, File root)
static ERXFileRepository respository (String name)

Protected Member Functions

 ERXFileRepository (File root, Factory factory)

Protected Attributes

final Factory _factory
File _root

Static Private Attributes

static final NSMutableDictionary _repositories = ERXMutableDictionary.synchronizedDictionary()


Detailed Description

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.
It uses a factory to create the folder structure under the root directory. With the default factory 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)

Constructor & Destructor Documentation

ERXFileRepository ( File  root,
Factory  factory 
) [protected]

Private constructor, as we use the factory methods to create instances.

Parameters:
root 
factory 


Member Function Documentation

static ERXFileRepository addRepository ( String  name,
ERXFileRepository  repository 
) [static]

Adds an existing repository under the given name.

Parameters:
name the name under which the repository should be added
repository the repository to register
Returns:
the repository

static ERXFileRepository addRepository ( String  name,
File  root,
Factory  factory 
) [static]

Adds a repository under the given name and the given root directory that uses the given factory.

Parameters:
name the name under which the repository should be added
root the root directory of the repository
factory the factory to determine the directory from the id for this repository
Returns:
the new repository

static ERXFileRepository addRepository ( String  name,
File  root 
) [static]

Adds a repository under the given name and the given root directory that uses the default factory.

Parameters:
name the name under which the repository should be added
root the root directory of the repository
Returns:
the new repository

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.

Returns:
the new file

File getFile ( String  id  ) 

Returns a file for a given id

Parameters:
id the id of the file
Returns:
a file for the given id

File getRoot (  ) 

Returns the root directory for the repository.

Returns:
the root directory for the repository

boolean hasFile ( String  id  ) 

Returns true if the file is present in the repository and also exists.

Parameters:
id the id of the file
Returns:
true if the file exists in the repository

static ERXFileRepository respository ( String  name  )  [static]

Returns the repository that is registered under the given name.

Parameters:
name the name under which the respository is registered
Returns:
the repository that is registered under the given name or null


Member Data Documentation

final Factory _factory [protected]

final NSMutableDictionary _repositories = ERXMutableDictionary.synchronizedDictionary() [static, private]

Holds the repositories.

File _root [protected]


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:43:13 2012 for Project Wonder by  doxygen 1.5.8