Interface Directory<ObjectType extends Identifiable>

Type Parameters:
ObjectType - The type of objects stored within this Directory.
All Known Implementing Classes:
DecoratingDirectory, DelegatingDirectory, SimpleConnectionDirectory, SimpleConnectionGroupDirectory, SimpleDirectory, SimpleUserDirectory

public interface Directory<ObjectType extends Identifiable>
Provides access to a collection of all objects with associated identifiers, and allows user manipulation and removal. Objects returned by a Directory are not necessarily backed by the stored objects, thus updating an object always requires calling the update() function.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    All Directory types that may be found on the UserContext interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(ObjectType object)
    Adds the given object to the overall set.
    get(String identifier)
    Returns the object having the given identifier.
    getAll(Collection<String> identifiers)
    Returns the objects having the given identifiers.
    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.
    default void
    Attempt to perform the provided operation atomically if possible.
    void
    Updates the stored object with the data contained in the given object.
  • Method Details

    • get

      ObjectType get(String identifier) throws org.apache.guacamole.GuacamoleException
      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.
      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

      Collection<ObjectType> getAll(Collection<String> identifiers) throws org.apache.guacamole.GuacamoleException
      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.
      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

      Set<String> getIdentifiers() throws org.apache.guacamole.GuacamoleException
      Returns a Set containing all identifiers for all objects within this Directory.
      Returns:
      A Set of all identifiers.
      Throws:
      org.apache.guacamole.GuacamoleException - If an error occurs while retrieving the identifiers.
    • add

      void add(ObjectType object) throws org.apache.guacamole.GuacamoleException
      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().
      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

      void update(ObjectType object) throws org.apache.guacamole.GuacamoleException
      Updates the stored object with the data contained in the given object.
      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

      void remove(String identifier) throws org.apache.guacamole.GuacamoleException
      Removes the object with the given identifier from the overall set.
      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 the object is not allowed.
    • tryAtomically

      default void tryAtomically(AtomicDirectoryOperation<ObjectType> operation) throws org.apache.guacamole.GuacamoleException
      Attempt to perform the provided operation atomically if possible. If the operation can be performed atomically, the atomic flag will be set to true, and the directory passed to the provided operation callback will peform directory operations atomically within the operation callback.
      Parameters:
      operation - The directory operation that should be performed atomically.
      Throws:
      org.apache.guacamole.GuacamoleException - If an error occurs during execution of the provided operation.