ObjectType
- The type of objects stored within this SimpleDirectory.public class SimpleDirectory<ObjectType extends Identifiable> extends Object implements Directory<ObjectType>
Constructor and Description |
---|
SimpleDirectory()
Creates a new empty SimpleDirectory which does not provide access to
any objects.
|
SimpleDirectory(Collection<ObjectType> objects)
Creates a new SimpleDirectory which provides access to the
objects contained within the Collection.
|
SimpleDirectory(Map<String,ObjectType> objects)
Creates a new SimpleDirectory which provides access to the objects
contained within the given Map.
|
SimpleDirectory(ObjectType... objects)
Creates a new SimpleDirectory which provides access to the given
objects.
|
SimpleDirectory(ObjectType object)
Creates a new SimpleDirectory which provides access to the given object.
|
Modifier and Type | Method and Description |
---|---|
void |
add(ObjectType connection)
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.
|
Set<String> |
getIdentifiers()
Returns a Set containing all identifiers for all objects within this
Directory.
|
protected Map<String,ObjectType> |
getObjects()
Returns the Map which currently backs this SimpleDirectory.
|
void |
remove(String identifier)
Removes the object with the given identifier from the overall set.
|
protected void |
setObjects(Map<String,ObjectType> objects)
Sets the Map which backs this SimpleDirectory.
|
void |
update(ObjectType connection)
Updates the stored object with the data contained in the given object.
|
public SimpleDirectory()
public SimpleDirectory(Map<String,ObjectType> objects)
objects
- The Map of objects to provide access to.public SimpleDirectory(ObjectType object)
object
- The object to provide access to.@SafeVarargs public SimpleDirectory(ObjectType... objects)
SimpleDirectory(java.util.Map)
constructor.objects
- The objects that should be present in this directory.public SimpleDirectory(Collection<ObjectType> objects)
SimpleDirectory(java.util.Map)
constructor.objects
- A Collection of all objects that should be present in this directory.protected void setObjects(Map<String,ObjectType> objects)
objects
- The Map of objects to provide access to.protected Map<String,ObjectType> getObjects()
public ObjectType get(String identifier) throws org.apache.guacamole.GuacamoleException
Directory
get
in interface Directory<ObjectType extends Identifiable>
identifier
- The identifier to use when locating the object to
return.org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving the
object, or if permission for retrieving the
object is denied.public Collection<ObjectType> getAll(Collection<String> identifiers) throws org.apache.guacamole.GuacamoleException
Directory
getAll
in interface Directory<ObjectType extends Identifiable>
identifiers
- The identifiers to use when locating the objects to return.org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving the objects, or if permission
to retrieve the requested objects is denied.public Set<String> getIdentifiers() throws org.apache.guacamole.GuacamoleException
Directory
getIdentifiers
in interface Directory<ObjectType extends Identifiable>
org.apache.guacamole.GuacamoleException
- If an error occurs while retrieving
the identifiers.public void add(ObjectType connection) throws org.apache.guacamole.GuacamoleException
Directory
add
in interface Directory<ObjectType extends Identifiable>
connection
- The object to add.org.apache.guacamole.GuacamoleException
- If an error occurs while adding the object, or if adding the object
is not allowed.public void update(ObjectType connection) throws org.apache.guacamole.GuacamoleException
Directory
update
in interface Directory<ObjectType extends Identifiable>
connection
- The object which will supply the data for the update.org.apache.guacamole.GuacamoleException
- If an error occurs while updating the object,
or if updating the object is not allowed.public void remove(String identifier) throws org.apache.guacamole.GuacamoleException
Directory
remove
in interface Directory<ObjectType extends Identifiable>
identifier
- The identifier of the object to remove.org.apache.guacamole.GuacamoleException
- If an error occurs while removing the object,
or if removing object is not allowed.Copyright © 2018. All rights reserved.