com.norbl.cbp.ppe
Class NetworkInfo

java.lang.Object
  extended by com.norbl.cbp.ppe.NetworkInfo
All Implemented Interfaces:
java.lang.Comparable

public class NetworkInfo
extends java.lang.Object
implements java.lang.Comparable

Holds information that identifies an ppe network. Each network has a network ID and name, both of which are unique within a user's ec2 space. The name and ID are attached to instances as aws tags.

Each NetworkInfo holds a an instance of Services which is used to monitor and control services run on the network.


Nested Class Summary
static class NetworkInfo.State
          Instance states per aws InstanceState.getState().getName().
 
Field Summary
 java.util.List<InstanceStatus> instances
           
 
Constructor Summary
NetworkInfo(java.lang.String ID, java.lang.String name)
           
 
Method Summary
 void add(InstanceStatus s)
           
 void clearInstances()
           
 int compareTo(java.lang.Object other)
          Sort by name.
 long getLaunchTime()
          Gets the earliest instance launch time.
 java.lang.String getMastersPublicDnsName()
           
 int getNActiveInstances()
           
 java.lang.String getNetworkID()
           
 java.lang.String getNetworkName()
           
 Services getServices()
           
 java.lang.String getStateDescription()
          A description of the network's state.
 boolean isNil()
           
 boolean isPending()
           
 boolean isRunning()
           
 boolean isShuttingDown()
           
 boolean isShuttingDownOrTerminated()
           
 boolean isTerminated()
           
 void pingAllInstances()
          Blocks until all instances in the network respond to Ssh#waitForPingsFromAllHosts(java.lang.String, long).
 void setEndogeous(boolean isEndog)
           
 void setServices(Services services)
           
 void setState()
           
 void setState(NetworkInfo.State state)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

instances

public java.util.List<InstanceStatus> instances
Constructor Detail

NetworkInfo

public NetworkInfo(java.lang.String ID,
                   java.lang.String name)
Method Detail

setEndogeous

public void setEndogeous(boolean isEndog)

setState

public void setState(NetworkInfo.State state)

setState

public void setState()

getServices

public Services getServices()

isPending

public boolean isPending()

isRunning

public boolean isRunning()

isShuttingDown

public boolean isShuttingDown()

isTerminated

public boolean isTerminated()

isShuttingDownOrTerminated

public boolean isShuttingDownOrTerminated()

isNil

public boolean isNil()

setServices

public void setServices(Services services)

getStateDescription

public java.lang.String getStateDescription()
A description of the network's state. If the networks instances are running, this method checks the state of its services. If services are pending, not running, or in the 'nil' state, the state of the services is returned. Otherwise the state of the network is returned. This guarantees that 'running' is only returned of the instances and services are up and running.

Returns:

add

public void add(InstanceStatus s)

clearInstances

public void clearInstances()

getNetworkName

public java.lang.String getNetworkName()

getNetworkID

public java.lang.String getNetworkID()

getNActiveInstances

public int getNActiveInstances()

getMastersPublicDnsName

public java.lang.String getMastersPublicDnsName()

compareTo

public int compareTo(java.lang.Object other)
Sort by name.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
other -
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLaunchTime

public long getLaunchTime()
Gets the earliest instance launch time.

Returns:

pingAllInstances

public void pingAllInstances()
                      throws NoSuchNetworkException,
                             SshPingFailureException
Blocks until all instances in the network respond to Ssh#waitForPingsFromAllHosts(java.lang.String, long). The max wait time for each instance is 4 minutes.

Throws:
NoSuchNetworkException
SshPingFailureException