Class: PHXDirectoryLibrarian
Last update: 16.07.2025Package: com.phoenix_int.aserver.library
Class Hierarchy
↳ java.lang.Object
↳ com.phoenix_int.aserver.library.PHXDirectoryLibrarian
Implemented Interfaces
Declaration
public class PHXDirectoryLibrarian
extends java.lang.Object
implements IPHXLibrarian
This class implements a librarian that uses a directory on disk to store and retrieve files. It provides methods for adding, removing, and finding files in the directory, as well as for managing categories and associations.
Field Summary
| Modifier and Type | Field and Description |
|---|---|
private java.io.File |
directoryThe directory used by this librarian. |
private java.util.Map |
categoriesMap of categories managed by this librarian. |
Constructor Summary
| Constructor and Description |
|---|
PHXDirectoryLibrarian(java.io.File directory) |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
void |
addFile(java.io.File file)Adds a file to the directory. |
void |
removeFile(java.io.File file)Removes a file from the directory. |
java.io.File |
findFile(java.lang.String name)Finds a file by name. |
void |
addCategory(java.lang.String category)Adds a category. |
void |
removeCategory(java.lang.String category)Removes a category. |
java.util.List |
listCategories()Lists all categories. |
void |
addAssociation(java.lang.String key, java.lang.String value)Adds an association. |
void |
removeAssociation(java.lang.String key)Removes an association. |
java.lang.String |
findAssociation(java.lang.String key)Finds an association by key. |
Field Detail
directory
private java.io.File directory
The directory used by this librarian.
categories
private java.util.Map categories
Map of categories managed by this librarian.
Constructor Detail
PHXDirectoryLibrarian
public PHXDirectoryLibrarian(java.io.File directory)
Parameters:
directory- The directory to be used by this librarian.
Method Detail
addFile
public void addFile(java.io.File file)
Adds a file to the directory.
Parameters:
file- The file to add.
removeFile
public void removeFile(java.io.File file)
Removes a file from the directory.
Parameters:
file- The file to remove.
findFile
public java.io.File findFile(java.lang.String name)
Finds a file by name.
Parameters:
name- The name of the file to find.
Returns:
- The file if found, or null otherwise.
addCategory
public void addCategory(java.lang.String category)
Adds a category.
Parameters:
category- The category to add.
removeCategory
public void removeCategory(java.lang.String category)
Removes a category.
Parameters:
category- The category to remove.
listCategories
public java.util.List listCategories()
Lists all categories.
Returns:
- A list of all categories.
addAssociation
public void addAssociation(java.lang.String key,
java.lang.String value)
Adds an association.
Parameters:
key- The key for the association.value- The value for the association.
removeAssociation
public void removeAssociation(java.lang.String key)
Removes an association.
Parameters:
key- The key for the association to remove.
findAssociation
public java.lang.String findAssociation(java.lang.String key)
Finds an association by key.
Parameters:
key- The key for the association to find.
Returns:
- The value associated with the key, or null if not found.