Author: bdonlan
Date: 2005-05-23 22:35:54 -0400 (Mon, 23 May 2005)
New Revision: 727
Modified:
trunk/clients/Javer2/src/org/haverdev/haver/server/Channel.java
trunk/clients/Javer2/src/org/haverdev/haver/server/ChannelBase.java
trunk/clients/Javer2/src/org/haverdev/haver/server/Entity.java
Log:
Documentation
Modified: trunk/clients/Javer2/src/org/haverdev/haver/server/Channel.java
===================================================================
--- trunk/clients/Javer2/src/org/haverdev/haver/server/Channel.java
2005-05-24 02:26:23 UTC (rev 726)
+++ trunk/clients/Javer2/src/org/haverdev/haver/server/Channel.java
2005-05-24 02:35:54 UTC (rev 727)
@@ -7,22 +7,80 @@
package org.haverdev.haver.server;
/**
- *
+ * A representation of a Haver channel
* @author bdonlan
*/
public interface Channel extends Entity {
+ /**
+ * Determine whether a named entity is in the channel
+ * @param namespace Namespace of the entity
+ * @param name Name of the entity
+ * @return whether the entity is in the channel
+ */
public boolean contains(String namespace, String name);
+ /**
+ * Determine if a given entity is in the channel
+ * @param what The entity to check
+ * @return Whether the entity is in the channel
+ */
public boolean contains(Entity what);
+ /**
+ * Silently adds an entity to the channel
+ * @param e The entity to add
+ */
public void register(Entity e);
+ /**
+ * Silently removes an entity from the channel
+ * @param e The entity to remove
+ */
public void unregister(Entity e);
+ /**
+ * Retrieves an array of all entities in the channel.
+ * @return The contents of the channel
+ */
public Entity[] getContents();
+ /**
+ * Returns an array of all entites of a given namespace in the channel
+ * @param namespace Namespace to filter by
+ * @return The entities of that namespace in the channel
+ */
public Entity[] filterContents(String namespace);
+ /**
+ * Returns the names of entities with the given namespace in the channel
+ * @param namespace Namespace to filter by
+ * @return Names of matching entities
+ */
public String[] getNames(String namespace);
+ /**
+ * Returns an array of all Users interested in knowing when an entity in
the channel quits
+ * @return The array of all Users interested in knowing when an entity in
the channelquits
+ */
public User[] quitListeners();
+ /**
+ * Distribute a public message through the channel
+ * @param from Entity originating the message
+ * @param args The message itself
+ */
public void distributePublicMessage(Entity from, String[] args);
+ /**
+ * Notify all interested members of the channel about a join event
+ * @param who The entity that has joined
+ */
public void distributeJoin(Entity who);
+ /**
+ * Notify all interested members of the channel about a part event
+ * @param who The entity that left
+ */
public void distributePart(Entity who);
+
+ /**
+ * Find an entity with the given name and namespace in the channel
+ * @param namespace Namespace of the target entity
+ * @param name Name of the target entity
+ * @return The entity if found, or <code>null</code> if not found.
+ */
+ public Entity lookup(String namespace, String name);
}
Modified: trunk/clients/Javer2/src/org/haverdev/haver/server/ChannelBase.java
===================================================================
--- trunk/clients/Javer2/src/org/haverdev/haver/server/ChannelBase.java
2005-05-24 02:26:23 UTC (rev 726)
+++ trunk/clients/Javer2/src/org/haverdev/haver/server/ChannelBase.java
2005-05-24 02:35:54 UTC (rev 727)
@@ -16,7 +16,7 @@
HashSet everything = new HashSet();
HashMap namespaces = new HashMap();
- public static final String[] emptyArray = {};
+ static final String[] emptyArray = {};
public synchronized String[] getNames(String namespace) {
HashMap subset = (HashMap)namespaces.get(namespace.toLowerCase());
Modified: trunk/clients/Javer2/src/org/haverdev/haver/server/Entity.java
===================================================================
--- trunk/clients/Javer2/src/org/haverdev/haver/server/Entity.java
2005-05-24 02:26:23 UTC (rev 726)
+++ trunk/clients/Javer2/src/org/haverdev/haver/server/Entity.java
2005-05-24 02:35:54 UTC (rev 727)
@@ -7,10 +7,18 @@
package org.haverdev.haver.server;
/**
- *
+ * A represention of a Haver entity
* @author bdonlan
*/
public interface Entity {
+ /**
+ *
+ * @return The namespace of the entity
+ */
public String getNamespace();
+ /**
+ *
+ * @return The name of the entity
+ */
public String getName();
}