org.starhope.appius.sys.admin
Class TheZones

java.lang.Object
  extended by org.starhope.appius.sys.admin.TheZones
All Implemented Interfaces:
Iterable<Zone>, Collection<Zone>

public class TheZones
extends Object
implements Collection<Zone>

WRITEME: The documentation for this type (TheZones) is incomplete. (brpocock@star-hope.org, Feb 25, 2010)

Author:
brpocock@star-hope.org

Field Summary
static String clusterLeader
          The hostname of the cluster leader
private static TheZones dude
          WRITEME: document this field (brpocock@star-hope.org, Feb 25, 2010) dude (TheZones)
static Zone loginZone
          Users logging in are directed first the this landing zone, and then choose a Zone server to which they wish to connect (if multiple Zones have been established).
private  HashSet<Zone> theZones
          all zones active around here, known to exist to the cluster
 
Constructor Summary
TheZones()
           
 
Method Summary
static boolean activateInDB(String zoneName)
           mark a zone as being active in the database, and running on this host
 boolean add(Zone arg0)
          This is an overriding method.
 boolean addAll(Collection<? extends Zone> arg0)
          This is an overriding method.
 Collection<Zone> all()
           
static boolean claimInDB(String zoneName)
          mark a zone as being claimed in the database, and running on this host
 void clear()
          This is an overriding method.
 boolean contains(Object arg0)
          This is an overriding method.
 boolean containsAll(Collection<?> arg0)
          This is an overriding method.
static String findClaimedZoneName()
          Find a zone name that has been claimed
static AbstractZone findLightZone()
          Returns a zone rated as being “light” traffic.
static String findUnclaimedZoneName()
          find a zone name that isn't claimed by any zone server
 AbstractZone get(String zoneName)
          get a zone by its name
 TheZones getInstance()
          WRITEME: document this method (brpocock@star-hope.org, Feb 25, 2010)
 Collection<Zone> getZonesOn(String serverHostname)
          Get all zones found on a given server
 boolean isEmpty()
          This is an overriding method.
 Iterator<Zone> iterator()
          This is an overriding method.
static TheZones local()
          Get the TheZones object referring to the local cluster
static boolean releaseZoneInDB(String zoneName)
          WRITEME: Document this method brpocock@star-hope.org
 boolean remove(AbstractZone whichZone)
          Remove a zone from the server
 boolean remove(Object arg0)
          This is an overriding method.
 boolean removeAll(Collection<?> arg0)
          This is an overriding method.
 boolean retainAll(Collection<?> arg0)
          This is an overriding method.
 int size()
          This is an overriding method.
 Object[] toArray()
          This is an overriding method.
<T> T[]
toArray(T[] arg0)
          This is an overriding method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

dude

private static final TheZones dude
WRITEME: document this field (brpocock@star-hope.org, Feb 25, 2010) dude (TheZones)


theZones

private final HashSet<Zone> theZones
all zones active around here, known to exist to the cluster


loginZone

public static Zone loginZone
Users logging in are directed first the this landing zone, and then choose a Zone server to which they wish to connect (if multiple Zones have been established).


clusterLeader

public static String clusterLeader
The hostname of the cluster leader

Constructor Detail

TheZones

public TheZones()
Method Detail

local

public static TheZones local()
Get the TheZones object referring to the local cluster

Returns:
the local cluster instance

activateInDB

public static boolean activateInDB(String zoneName)

mark a zone as being active in the database, and running on this host

XXX: contains SQL

Parameters:
zoneName - the new zone's name
Returns:
true, if successful.

claimInDB

public static boolean claimInDB(String zoneName)
mark a zone as being claimed in the database, and running on this host

XXX: contains SQL

Parameters:
zoneName - the new zone's name
Returns:
true, if successful.

findClaimedZoneName

public static String findClaimedZoneName()
Find a zone name that has been claimed

XXX: contains SQL

Returns:
a claimed Zone name

findLightZone

public static AbstractZone findLightZone()
Returns a zone rated as being “light” traffic. If there are no light traffic zones, attempt to spawn one. If that fails, then resort to finding the least-busy zone of all zones visible.

Returns:
a zone with relatively light traffic.

findUnclaimedZoneName

public static String findUnclaimedZoneName()
find a zone name that isn't claimed by any zone server

XXX: contains SQL

Returns:
an unclaimed zone name or a null string if all zone names are claimed

releaseZoneInDB

public static boolean releaseZoneInDB(String zoneName)
WRITEME: Document this method brpocock@star-hope.org

Parameters:
zoneName - WRITEME
Returns:
WRITEME

add

public boolean add(Zone arg0)
This is an overriding method.

Specified by:
add in interface Collection<Zone>
See Also:
Collection.add(java.lang.Object)

addAll

public boolean addAll(Collection<? extends Zone> arg0)
This is an overriding method.

Specified by:
addAll in interface Collection<Zone>
See Also:
Collection.addAll(java.util.Collection)

all

public Collection<Zone> all()
Returns:
all zones known to exist

clear

public void clear()
This is an overriding method.

Specified by:
clear in interface Collection<Zone>
See Also:
Collection.clear()

contains

public boolean contains(Object arg0)
This is an overriding method.

Specified by:
contains in interface Collection<Zone>
See Also:
Collection.contains(java.lang.Object)

containsAll

public boolean containsAll(Collection<?> arg0)
This is an overriding method.

Specified by:
containsAll in interface Collection<Zone>
See Also:
Collection.containsAll(java.util.Collection)

get

public AbstractZone get(String zoneName)
                 throws NotFoundException
get a zone by its name

Parameters:
zoneName - the name of the zone
Returns:
the zone
Throws:
NotFoundException - if the zone is not in this cluster

getInstance

public TheZones getInstance()
WRITEME: document this method (brpocock@star-hope.org, Feb 25, 2010)

Returns:
WRITEME

getZonesOn

public Collection<Zone> getZonesOn(String serverHostname)
Get all zones found on a given server

Parameters:
serverHostname - the server's host name
Returns:
the set of any/all zones for that server

isEmpty

public boolean isEmpty()
This is an overriding method.

Specified by:
isEmpty in interface Collection<Zone>
See Also:
Collection.isEmpty()

iterator

public Iterator<Zone> iterator()
This is an overriding method.

Specified by:
iterator in interface Iterable<Zone>
Specified by:
iterator in interface Collection<Zone>
See Also:
Collection.iterator()

remove

public boolean remove(AbstractZone whichZone)
Remove a zone from the server

Parameters:
whichZone - The zone to be removed
Returns:
true, if it was found and removed

remove

public boolean remove(Object arg0)
This is an overriding method.

Specified by:
remove in interface Collection<Zone>
See Also:
Collection.remove(java.lang.Object)

removeAll

public boolean removeAll(Collection<?> arg0)
This is an overriding method.

Specified by:
removeAll in interface Collection<Zone>
See Also:
Collection.removeAll(java.util.Collection)

retainAll

public boolean retainAll(Collection<?> arg0)
This is an overriding method.

Specified by:
retainAll in interface Collection<Zone>
See Also:
Collection.retainAll(java.util.Collection)

size

public int size()
This is an overriding method.

Specified by:
size in interface Collection<Zone>
See Also:
Collection.size()

toArray

public Object[] toArray()
This is an overriding method.

Specified by:
toArray in interface Collection<Zone>
See Also:
Collection.toArray()

toArray

public <T> T[] toArray(T[] arg0)
This is an overriding method.

Specified by:
toArray in interface Collection<Zone>
See Also:
java.util.Collection#toArray(T[])