org.starhope.appius.via
Class RemoteZone

java.lang.Object
  extended by org.starhope.appius.via.RemoteZone
All Implemented Interfaces:
AbstractZone, ViaMunita<AbstractZone>

public class RemoteZone
extends Object
implements AbstractZone, ViaMunita<AbstractZone>

TODO: The documentation for this type (RemoteZone) is incomplete. (brpocock, Nov 5, 2009)

Author:
brpocock

Field Summary
private static ConcurrentHashMap<String,AbstractZone> knownZones
          WRITEME: document this field (brpocock, Jan 11, 2010) knownZones (RemoteZone)
private  int remotePort
          The port number of the remote Appius server
private  String remoteServer
          The hostname of the remote Appius server
private  String remoteZone
          The zone to which this one is a peer
 
Constructor Summary
RemoteZone(String url)
           
 
Method Summary
 void activate()
          This is an overriding method.
 void add(AbstractRoom room)
          This is an overriding method.
 void clearAllBadges()
           
 void clearAllBadges(AbstractRoom roomByName)
           
 void clearBadge(String badgeName)
           
 int compareTo(AbstractZone other)
           
 void destroy()
          This is an overriding method.
 void destroyRoom(AbstractRoom room)
          This is an overriding method.
 Collection<Integer> getAllUsersIDsInZone()
           
 Collection<AbstractUser> getAllUsersInZone()
          This is an overriding method.
static AbstractZone getByName(String remoteZoneName)
          TODO: document this method (brpocock, Jan 11, 2010)
 String getHost()
          This is an overriding method.
 int getMaxUsers()
          This is an overriding method.
 String getName()
          This is an overriding method.
 AbstractRoom getNextLobby()
           
 int getPort()
          This is an overriding method.
 AbstractRoom getRoom(Integer room)
          This is an overriding method.
 AbstractRoom getRoomByName(String string)
          This is an overriding method.
 Collection<AbstractRoom> getRoomList()
          This is an overriding method.
 String getRoomListSFSXML()
          This is an overriding method.
 int getRoomMaxUsers()
          This is an overriding method.
 String getURL()
          This is an overriding method.
 AbstractUser getUserByName(String buddy)
          This is an overriding method.
 AbstractRoom getUserRoom(AbstractUser user)
          This is an overriding method.
 String getViaAppiaHostname()
          This is an overriding method.
 String getViaAppiaRemoteEndpointID()
          This is an overriding method.
 int getViaAppiaServerPort()
          This is an overriding method.
 Class<AbstractZone> getViaPeerClass()
           
 org.json.JSONObject getZoneData_JSON(AbstractUser user)
          This is an overriding method.
 org.json.JSONObject getZoneList_JSON(AbstractUser u)
           
 void handleSpeak(int roomNumber, AbstractUser user, String speech)
          This is an overriding method.
 void init()
          This is an overriding method.
 void remove(AbstractUser user)
          This is an overriding method.
 void retire()
           
 void set(org.json.JSONObject o)
           
 void setAutoJoinRoom(int id)
          This is an overriding method.
 void setBadge(String string, AbstractRoom room)
           
 String spawnNewZone()
          This is an overriding method.
 void spawnZone(String newZone)
           
 void tellEaves(AbstractUser user, AbstractRoom room, String verb, String note)
          This is an overriding method.
 org.json.JSONObject toJSON()
           
 void trace(String string)
          This is an overriding method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

knownZones

private static ConcurrentHashMap<String,AbstractZone> knownZones
WRITEME: document this field (brpocock, Jan 11, 2010) knownZones (RemoteZone)


remotePort

private final int remotePort
The port number of the remote Appius server


remoteServer

private final String remoteServer
The hostname of the remote Appius server


remoteZone

private final String remoteZone
The zone to which this one is a peer

Constructor Detail

RemoteZone

public RemoteZone(String url)
Parameters:
url - The URL of the remote Zone
Method Detail

getByName

public static AbstractZone getByName(String remoteZoneName)
TODO: document this method (brpocock, Jan 11, 2010)

Parameters:
remoteZoneName - WRITEME
Returns:
WRITEME

activate

public void activate()
This is an overriding method.

Specified by:
activate in interface AbstractZone
See Also:
AbstractZone.activate()

add

public void add(AbstractRoom room)
This is an overriding method.

Specified by:
add in interface AbstractZone
Parameters:
room - The room to be added.
See Also:
AbstractZone.add(org.starhope.appius.game.AbstractRoom)

clearAllBadges

public void clearAllBadges()
Specified by:
clearAllBadges in interface AbstractZone
See Also:
AbstractZone.clearAllBadges()

clearAllBadges

public void clearAllBadges(AbstractRoom roomByName)
Specified by:
clearAllBadges in interface AbstractZone
See Also:
AbstractZone.clearAllBadges(org.starhope.appius.game.AbstractRoom)

clearBadge

public void clearBadge(String badgeName)
                throws GameLogicException
Specified by:
clearBadge in interface AbstractZone
Throws:
GameLogicException
See Also:
AbstractZone.clearBadge(java.lang.String)

compareTo

public int compareTo(AbstractZone other)
Specified by:
compareTo in interface AbstractZone
Returns:
See Also:
AbstractZone.compareTo(org.starhope.appius.types.AbstractZone)

destroy

public void destroy()
This is an overriding method.

Specified by:
destroy in interface AbstractZone
See Also:
AbstractZone.destroy()

destroyRoom

public void destroyRoom(AbstractRoom room)
This is an overriding method.

Specified by:
destroyRoom in interface AbstractZone
Parameters:
room - WRITEME
See Also:
AbstractZone.destroyRoom(org.starhope.appius.game.AbstractRoom)

getAllUsersIDsInZone

public Collection<Integer> getAllUsersIDsInZone()
Specified by:
getAllUsersIDsInZone in interface AbstractZone
Returns:
See Also:
AbstractZone.getAllUsersIDsInZone()

getAllUsersInZone

public Collection<AbstractUser> getAllUsersInZone()
This is an overriding method.

Specified by:
getAllUsersInZone in interface AbstractZone
Returns:
A Collection of all users currently in the Zone
See Also:
AbstractZone.getAllUsersInZone()

getHost

public String getHost()
This is an overriding method.

Specified by:
getHost in interface AbstractZone
Returns:
See Also:
AbstractZone.getHost()

getMaxUsers

public int getMaxUsers()
This is an overriding method.

Specified by:
getMaxUsers in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.getMaxUsers()

getName

public String getName()
This is an overriding method.

Specified by:
getName in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.getName()

getNextLobby

public AbstractRoom getNextLobby()
Specified by:
getNextLobby in interface AbstractZone
Returns:
See Also:
AbstractZone.getNextLobby()

getPort

public int getPort()
This is an overriding method.

Specified by:
getPort in interface AbstractZone
Returns:
See Also:
AbstractZone.getPort()

getRoom

public AbstractRoom getRoom(Integer room)
This is an overriding method.

Specified by:
getRoom in interface AbstractZone
Parameters:
room - WRITEME
Returns:
WRITEME
See Also:
AbstractZone.getRoom(java.lang.Integer)

getRoomByName

public AbstractRoom getRoomByName(String string)
This is an overriding method.

Specified by:
getRoomByName in interface AbstractZone
Parameters:
string - WRITEME
Returns:
WRITEME
See Also:
AbstractZone.getRoomByName(java.lang.String)

getRoomList

public Collection<AbstractRoom> getRoomList()
This is an overriding method.

Specified by:
getRoomList in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.getRoomList()

getRoomListSFSXML

public String getRoomListSFSXML()
This is an overriding method.

Specified by:
getRoomListSFSXML in interface AbstractZone
Returns:
a string of the SFS - XML format
See Also:
AbstractZone.getRoomListSFSXML()

getRoomMaxUsers

public int getRoomMaxUsers()
This is an overriding method.

Specified by:
getRoomMaxUsers in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.getRoomMaxUsers()

getURL

public String getURL()
This is an overriding method.

Specified by:
getURL in interface AbstractZone
Returns:
a URL
See Also:
AbstractZone.getURL()

getUserByName

public AbstractUser getUserByName(String buddy)
This is an overriding method.

Specified by:
getUserByName in interface AbstractZone
Parameters:
buddy - WRITEME
Returns:
WRITEME
See Also:
AbstractZone.getUserByName(java.lang.String)

getUserRoom

public AbstractRoom getUserRoom(AbstractUser user)
This is an overriding method.

Specified by:
getUserRoom in interface AbstractZone
Parameters:
user - WRITEME
Returns:
where the user is according to me
See Also:
AbstractZone.getUserRoom(AbstractUser)

getViaAppiaHostname

public String getViaAppiaHostname()
This is an overriding method.

Specified by:
getViaAppiaHostname in interface ViaMunita<AbstractZone>
Returns:
The hostname of the Via Appia peer (Appius server) on which the remote object is actually located
See Also:
ViaMunita.getViaAppiaHostname()

getViaAppiaRemoteEndpointID

public String getViaAppiaRemoteEndpointID()
This is an overriding method.

Specified by:
getViaAppiaRemoteEndpointID in interface ViaMunita<AbstractZone>
Returns:
The object endpoint code of the Via Appia peer (Appius server) on which the remote object is actually located
See Also:
ViaMunita.getViaAppiaRemoteEndpointID()

getViaAppiaServerPort

public int getViaAppiaServerPort()
This is an overriding method.

Specified by:
getViaAppiaServerPort in interface ViaMunita<AbstractZone>
Returns:
The port number of the Via Appia peer (Appius server) on which the remote object is actually located
See Also:
ViaMunita.getViaAppiaServerPort()

getViaPeerClass

public Class<AbstractZone> getViaPeerClass()
Specified by:
getViaPeerClass in interface ViaMunita<AbstractZone>
Returns:
the class of the ViaAppia peer. This is a hack to obtain the generic type equivalences stuff for the implementers, and can probably be factored out if I get smarter about reflection and generics.
See Also:
ViaMunita.getViaPeerClass()

getZoneData_JSON

public org.json.JSONObject getZoneData_JSON(AbstractUser user)
                                     throws org.json.JSONException
This is an overriding method.

Specified by:
getZoneData_JSON in interface AbstractZone
Parameters:
user - WRITEME
Returns:
WRITEME
Throws:
org.json.JSONException - if I can't do it right
See Also:
AbstractZone.getZoneData_JSON(AbstractUser)

getZoneList_JSON

public org.json.JSONObject getZoneList_JSON(AbstractUser u)
Specified by:
getZoneList_JSON in interface AbstractZone
Returns:
See Also:
AbstractZone.getZoneList_JSON(org.starhope.appius.user.AbstractUser)

handleSpeak

public void handleSpeak(int roomNumber,
                        AbstractUser user,
                        String speech)
This is an overriding method.

Specified by:
handleSpeak in interface AbstractZone
Parameters:
roomNumber - the room in which the user is speaking
user - the user speaking
speech - the speech to be spoken
See Also:
AbstractZone.handleSpeak(int, AbstractUser, String)

init

public void init()
This is an overriding method.

Specified by:
init in interface AbstractZone
See Also:
AbstractZone.init()

remove

public void remove(AbstractUser user)
This is an overriding method.

Specified by:
remove in interface AbstractZone
Parameters:
user - WRITEME
See Also:
AbstractZone.remove(AbstractUser)

retire

public void retire()
Specified by:
retire in interface AbstractZone
See Also:
AbstractZone.retire()

set

public void set(org.json.JSONObject o)
Parameters:
o - WRITEME
See Also:
CastsToJSON.set(org.json.JSONObject)

setAutoJoinRoom

public void setAutoJoinRoom(int id)
This is an overriding method.

Specified by:
setAutoJoinRoom in interface AbstractZone
Parameters:
id - WRITEME
See Also:
AbstractZone.setAutoJoinRoom(int)

setBadge

public void setBadge(String string,
                     AbstractRoom room)
Specified by:
setBadge in interface AbstractZone
See Also:
AbstractZone.setBadge(java.lang.String, org.starhope.appius.game.AbstractRoom)

spawnNewZone

public String spawnNewZone()
This is an overriding method.

Specified by:
spawnNewZone in interface AbstractZone
Returns:
WRITEME
See Also:
AbstractZone.spawnNewZone()

spawnZone

public void spawnZone(String newZone)
Specified by:
spawnZone in interface AbstractZone
See Also:
AbstractZone.spawnZone(java.lang.String)

tellEaves

public void tellEaves(AbstractUser user,
                      AbstractRoom room,
                      String verb,
                      String note)
This is an overriding method.

Specified by:
tellEaves in interface AbstractZone
Parameters:
user - The user who has acted
room - The room in which s/he has acted
verb - The action s/he has taken
note - Note(s) about the action
See Also:
AbstractZone.tellEaves(AbstractUser, AbstractRoom, String, String)

toJSON

public org.json.JSONObject toJSON()
Returns:
WRITEME
See Also:
CastsToJSON.toJSON()

trace

public void trace(String string)
This is an overriding method.

Specified by:
trace in interface AbstractZone
Parameters:
string - WRITEME
See Also:
AbstractZone.trace(java.lang.String)