Package org.apache.guacamole.net.auth
Class DelegatingDirectory<ObjectType extends Identifiable>
- java.lang.Object
-
- org.apache.guacamole.net.auth.DelegatingDirectory<ObjectType>
-
- Type Parameters:
ObjectType
- The type of objects stored within this Directory.
- All Implemented Interfaces:
Directory<ObjectType>
- Direct Known Subclasses:
DecoratingDirectory
public class DelegatingDirectory<ObjectType extends Identifiable> extends Object implements Directory<ObjectType>
Directory implementation which simply delegates all function calls to an underlying Directory.
-
-
Constructor Summary
Constructors Constructor Description DelegatingDirectory(Directory<ObjectType> directory)
Wraps the given Directory such that all function calls against this DelegatingDirectory will be delegated to it.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(ObjectType object)
Adds the given object to the overall set.ObjectType
get(String identifier)
Returns the object having the given identifier.Collection<ObjectType>
getAll(Collection<String> identifiers)
Returns the objects having the given identifiers.protected Directory<ObjectType>
getDelegateDirectory()
Returns the underlying Directory wrapped by this DelegatingDirectory.Set<String>
getIdentifiers()
Returns a Set containing all identifiers for all objects within this Directory.void
remove(String identifier)
Removes the object with the given identifier from the overall set.void
update(ObjectType object)
Updates the stored object with the data contained in the given object.
-
-
-
Constructor Detail
-
DelegatingDirectory
public DelegatingDirectory(Directory<ObjectType> directory)
Wraps the given Directory such that all function calls against this DelegatingDirectory will be delegated to it.- Parameters:
directory
- The directory to wrap.
-
-
Method Detail
-
getDelegateDirectory
protected Directory<ObjectType> getDelegateDirectory()
Returns the underlying Directory wrapped by this DelegatingDirectory.- Returns:
- The Directory wrapped by this DelegatingDirectory.
-
get
public ObjectType get(String identifier) throws org.apache.guacamole.GuacamoleException
Description copied from interface:Directory
Returns the object having the given identifier. Note that changes to the object returned will not necessarily affect the object stored within the Directory. To update an object stored within an Directory such that future calls to get() will return the updated object, you must call update() on the object after modification.- Specified by:
get
in interfaceDirectory<ObjectType extends Identifiable>
- Parameters:
identifier
- The identifier to use when locating the object to return.- Returns:
- The object having the given identifier, or null if no such object exists.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving the object, or if permission for retrieving the object is denied.
-
getAll
public Collection<ObjectType> getAll(Collection<String> identifiers) throws org.apache.guacamole.GuacamoleException
Description copied from interface:Directory
Returns the objects having the given identifiers. Note that changes to any object returned will not necessarily affect the object stored within the Directory. To update an object stored within a Directory such that future calls to get() will return the updated object, you must call update() on the object after modification.- Specified by:
getAll
in interfaceDirectory<ObjectType extends Identifiable>
- Parameters:
identifiers
- The identifiers to use when locating the objects to return.- Returns:
- The objects having the given identifiers. If any identifiers do not correspond to accessible objects, those identifiers will be ignored. If no objects correspond to any of the given identifiers, the returned collection will be empty.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving the objects, or if permission to retrieve the requested objects is denied.
-
getIdentifiers
public Set<String> getIdentifiers() throws org.apache.guacamole.GuacamoleException
Description copied from interface:Directory
Returns a Set containing all identifiers for all objects within this Directory.- Specified by:
getIdentifiers
in interfaceDirectory<ObjectType extends Identifiable>
- Returns:
- A Set of all identifiers.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving the identifiers.
-
add
public void add(ObjectType object) throws org.apache.guacamole.GuacamoleException
Description copied from interface:Directory
Adds the given object to the overall set. If a new identifier is created for the added object, that identifier will be automatically assigned via setIdentifier().- Specified by:
add
in interfaceDirectory<ObjectType extends Identifiable>
- Parameters:
object
- The object to add.- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while adding the object, or if adding the object is not allowed.
-
update
public void update(ObjectType object) throws org.apache.guacamole.GuacamoleException
Description copied from interface:Directory
Updates the stored object with the data contained in the given object.- Specified by:
update
in interfaceDirectory<ObjectType extends Identifiable>
- Parameters:
object
- The object which will supply the data for the update.- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while updating the object, or if updating the object is not allowed.
-
remove
public void remove(String identifier) throws org.apache.guacamole.GuacamoleException
Description copied from interface:Directory
Removes the object with the given identifier from the overall set.- Specified by:
remove
in interfaceDirectory<ObjectType extends Identifiable>
- Parameters:
identifier
- The identifier of the object to remove.- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while removing the object, or if removing object is not allowed.
-
-