GUAC-1429: Modify Directory API to set identifier on added object, and update javascript to use new models.

This commit is contained in:
James Muehlner
2015-12-09 22:59:08 -08:00
parent 86841ebfe3
commit b0ac9e8d52
6 changed files with 26 additions and 16 deletions

View File

@@ -28,16 +28,15 @@ import org.glyptodon.guacamole.GuacamoleException;
/**
* Provides access to a collection of all objects with associated identifiers,
* and allows user manipulation and removal. Objects stored within a
* Directory are not necessarily returned to the use as references to
* the stored objects, thus updating an object requires calling an update
* function.
* 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.
*
* @author Michael Jumper
* @param <ObjectType>
* The type of objects stored within this Directory.
*/
public interface Directory<ObjectType> {
public interface Directory<ObjectType extends Identifiable> {
/**
* Returns the object having the given identifier. Note that changes to
@@ -91,12 +90,16 @@ public interface Directory<ObjectType> {
Set<String> getIdentifiers() throws GuacamoleException;
/**
* Adds the given object to the overall set.
* 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().
*
* @param object The object to add.
* @param object
* The object to add.
*
* @throws GuacamoleException If an error occurs while adding the object , or
* if adding the object is not allowed.
* @throws GuacamoleException
* If an error occurs while adding the object, or if adding the object
* is not allowed.
*/
void add(ObjectType object)
throws GuacamoleException;

View File

@@ -30,6 +30,7 @@ import java.util.Set;
import org.glyptodon.guacamole.GuacamoleException;
import org.glyptodon.guacamole.GuacamoleSecurityException;
import org.glyptodon.guacamole.net.auth.Directory;
import org.glyptodon.guacamole.net.auth.Identifiable;
/**
* An extremely simple read-only implementation of a Directory which provides
@@ -40,7 +41,8 @@ import org.glyptodon.guacamole.net.auth.Directory;
* @param <ObjectType>
* The type of objects stored within this SimpleDirectory.
*/
public class SimpleDirectory<ObjectType> implements Directory<ObjectType> {
public class SimpleDirectory<ObjectType extends Identifiable>
implements Directory<ObjectType> {
/**
* The Map of objects to provide access to.