public class Topology
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
Topology.EntityType
Topology entity types.
|
static class |
Topology.ServiceType
Type of service.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ADMIN_NODE_MANAGER_TAG |
Constructor and Description |
---|
Topology() |
Modifier and Type | Method and Description |
---|---|
void |
addGroup(Group group)
Add a group to the topology.
|
void |
addHost(Host host)
Add a host to the topology.
|
Service |
adminNodeManager()
Get the Admin Node Manager.
|
java.lang.Object |
clone() |
boolean |
doesServiceRunOnHost(java.lang.String hostID)
Checks to see if any services are running on a host.
|
Topology |
filteredTopology(java.util.List<Topology.ServiceType> serviceTypes)
Get a filtered version of the topology that contains
only services of a certain type.
|
java.lang.String |
generateID(Topology.EntityType type)
Generate a unique id for a topology entity, e.g host, service etc.
|
Group |
getGroup(java.lang.String id)
Get a group from the topology.
|
Group |
getGroupByName(java.lang.String name)
Get a group from the topology.
|
Group |
getGroupForService(java.lang.String serviceID)
Get the group for a service
|
java.util.Collection<Group> |
getGroups()
Get all the groups in the topology.
|
java.util.Collection<Group> |
getGroups(Topology.ServiceType serviceType)
Get all the groups in the topology that contain services of a certain type.
|
Host |
getHost(java.lang.String id)
Get a host.
|
Host |
getHostByName(java.lang.String name)
Get a host.
|
java.util.Collection<Host> |
getHosts()
Get all the hosts in the topology.
|
java.util.Set<java.lang.String> |
getHostsForGroup(java.lang.String groupID)
For a group, get the list of host ids on which the group runs.
|
java.lang.String |
getId()
Get the domain id.
|
java.lang.String |
getProductVersion()
Get the product version.
|
Service |
getService(java.lang.String serviceID)
Get a service.
|
Service |
getService(Topology.ServiceType serviceType,
java.lang.String tagname,
java.lang.String tagvalue)
Return first service of certain type with tag and value.
|
java.util.Collection<Service> |
getServices(Topology.ServiceType serviceType)
Get all services in the topology of a certain type.
|
java.util.Collection<Service> |
getServicesOnHost(java.lang.String hostID,
Topology.ServiceType serviceType)
Get a list of services of a certain type that run on a
particular host.
|
java.util.Collection<Service> |
getServicesOnHostInGroup(java.lang.String hostID,
java.lang.String groupID,
Topology.ServiceType serviceType)
Get a list of services in a group of a certain type that run on a
particular host.
|
long |
getTimestamp()
Get the time at which the topology was last updated.
|
java.util.Map<Topology.EntityType,java.lang.Integer> |
getUniqueIdCounters()
Get current values for id counters.
|
int |
getVersion()
Get the version of the topology.
|
static boolean |
isAdminNodeManager(Service service)
Checks if the service is the Adnmin Node Manager
|
Service |
portUsedBy(java.lang.String hostID,
int port)
On a host get the service that uses a certain port.
|
void |
removeGroup(Group group)
Remove a group from the topology.
|
void |
removeHost(Host host)
Delete a host from the topology.
|
void |
removeHost(java.lang.String id)
Remove a host from the topology.
|
void |
setGroups(java.util.Collection<Group> groups)
Set the groups in the topology.
|
void |
setHosts(java.util.Collection<Host> hosts)
Set the hosts.
|
void |
setId(java.lang.String id)
Set the domain id.
|
void |
setProductVersion(java.lang.String productVersion)
Set the product version
|
void |
setTimestamp(long timestamp)
Set the time at which the topology was last updated.
|
void |
setUniqueIdCounters(java.util.Map<Topology.EntityType,java.lang.Integer> uniqueIdCounters)
Set current values for id counters.
|
void |
setVersion(int version)
Set the version of the topology.
|
java.lang.String |
toString() |
public static final java.lang.String ADMIN_NODE_MANAGER_TAG
public java.lang.String getId()
public void setId(java.lang.String id)
id
- The idpublic int getVersion()
public void setVersion(int version)
version
- The versionpublic long getTimestamp()
public void setTimestamp(long timestamp)
timestamp
- The timestamppublic java.lang.String getProductVersion()
public void setProductVersion(java.lang.String productVersion)
productVersion
- The product versionpublic java.util.Collection<Host> getHosts()
public void setHosts(java.util.Collection<Host> hosts)
hosts
- List of hostspublic void addHost(Host host)
host
- The host to addpublic void removeHost(Host host)
host
- The host to deletepublic java.util.Collection<Group> getGroups()
public void setGroups(java.util.Collection<Group> groups)
groups
- List of groupspublic java.util.Map<Topology.EntityType,java.lang.Integer> getUniqueIdCounters()
public void setUniqueIdCounters(java.util.Map<Topology.EntityType,java.lang.Integer> uniqueIdCounters)
Map
- of type to current id valuepublic void addGroup(Group group)
group
- The group to addpublic void removeGroup(Group group)
group
- The group to remove.public Group getGroup(java.lang.String id)
id
- The id of the group.public Group getGroupByName(java.lang.String name)
name
- The group namepublic Group getGroupForService(java.lang.String serviceID)
serviceID
- The id of the service, e.g. instance-1
public Host getHost(java.lang.String id)
id
- The host id, e.g. host-1
public Host getHostByName(java.lang.String name)
name
- The host namepublic void removeHost(java.lang.String id)
id
- The id of the hostpublic Service portUsedBy(java.lang.String hostID, int port)
hostID
- The id of the hostport
- The portpublic java.util.Collection<Group> getGroups(Topology.ServiceType serviceType)
serviceType
- Set to gateway
or nodemanager
public java.util.Collection<Service> getServices(Topology.ServiceType serviceType)
serviceType
- Set to gateway
or nodemanager
public Service getService(java.lang.String serviceID)
serviceID
- The id of the service, e.g. instance-1
public Service getService(Topology.ServiceType serviceType, java.lang.String tagname, java.lang.String tagvalue)
serviceType
- Set to gateway
or nodemanager
tagname
- Tag nametagvalue
- Tag valuepublic Topology filteredTopology(java.util.List<Topology.ServiceType> serviceTypes)
serviceTypes
- Set to gateway
or nodemanager
public java.util.Collection<Service> getServicesOnHost(java.lang.String hostID, Topology.ServiceType serviceType)
hostID
- The host idserviceType
- Set to gateway
or nodemanager
public java.util.Collection<Service> getServicesOnHostInGroup(java.lang.String hostID, java.lang.String groupID, Topology.ServiceType serviceType)
hostID
- The host idgroupID
- The group idserviceType
- Set to gateway
or nodemanager
public boolean doesServiceRunOnHost(java.lang.String hostID)
hostID
- The hostpublic java.util.Set<java.lang.String> getHostsForGroup(java.lang.String groupID)
groupID
- The group idpublic static boolean isAdminNodeManager(Service service)
service
- The service to checkpublic Service adminNodeManager()
public java.lang.String generateID(Topology.EntityType type)
type
- The topology entity typepublic java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel