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.
|
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.List<java.lang.String> |
getGroupIds() |
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.
|
java.util.Collection<Group> |
getGroupsByIds(java.util.List<java.lang.String> ids)
Get all groups in the topology specified in a list of Service IDs
|
java.util.Collection<Group> |
getGroupsForHost(java.lang.String hostID,
Topology.ServiceType serviceType)
For a host get the groups (of certain service type) that run on it.
|
Host |
getHost(java.lang.String id)
Get a host.
|
Host |
getHostByName(java.lang.String name)
Get a host.
|
java.util.List<java.lang.String> |
getHostIds() |
java.util.Collection<Host> |
getHosts()
Get all the hosts in the topology.
|
java.util.Collection<Host> |
getHostsByIds(java.util.List<java.lang.String> ids)
Get all hosts in the topology specified in a list of Service IDs
|
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.List<java.lang.String> |
getServiceIds() |
java.util.List<java.lang.String> |
getServiceIds(Topology.ServiceType serviceType) |
java.util.Collection<Service> |
getServices()
Get all services in the topology
|
java.util.Collection<Service> |
getServices(Topology.ServiceType serviceType)
Get all services in the topology of a certain type.
|
java.util.Collection<Service> |
getServices(Topology.ServiceType serviceType,
java.lang.String tagname,
java.lang.String tagvalue)
Return all services of certain type with tag and value.
|
java.util.Collection<Service> |
getServicesByIds(java.util.List<java.lang.String> ids)
Get all services in the topology specified in a list of Service IDs
|
java.util.Collection<Service> |
getServicesOnHost(java.lang.String hostID)
Get a list of all services of that run on a particular host.
|
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.
|
static Topology.ServiceType |
getServiceType(java.lang.String serviceID) |
long |
getTimestamp()
Get the time at which the topology was last updated.
|
com.vordel.api.topology.model.TopologyVersion |
getTopologyVersion()
Return a TopologyVersion object which has the topology version and timestamp
|
java.util.Map<Topology.EntityType,java.lang.Integer> |
getUniqueIdCounters()
Get current values for id counters.
|
int |
getVersion()
Get the version of the topology.
|
boolean |
hasGroup(java.lang.String groupId)
Returns true if a Group with the given ID is in the topology
|
boolean |
isFips() |
static boolean |
isTaggedAsAdminNodeManager(Service service)
Checks if the service is the Admin Node Manager.
|
java.util.List<Service> |
nonLocalTaggedAdminNodeManagers()
Get all Admin Node Manager excluding local Admin Node Manager (if it is Admin).
|
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 |
reserveId(Topology.EntityType type,
java.lang.String idStr)
Called when upgrading topology as want to reuse the same ids in upgraded install.
|
void |
setFips(boolean fips) |
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.util.List<Service> |
taggedAdminNodeManagers()
Get all the Admin Node Managers.
|
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 com.vordel.api.topology.model.TopologyVersion getTopologyVersion()
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 boolean isFips()
public void setFips(boolean fips)
public java.util.Collection<Host> getHosts()
public java.util.Collection<Host> getHostsByIds(java.util.List<java.lang.String> ids)
ids
- a List of Service IDspublic 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 java.util.Collection<Group> getGroupsByIds(java.util.List<java.lang.String> ids)
ids
- A List of Service IDspublic 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)
uniqueIdCounters
- Map of managed entity 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 boolean hasGroup(java.lang.String groupId)
groupId
- The ID of the Group to query.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 java.util.Collection<Service> getServices()
public java.util.Collection<Service> getServicesByIds(java.util.List<java.lang.String> ids)
ids
- A List of service IDspublic 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 java.util.Collection<Service> getServices(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> getServicesOnHost(java.lang.String hostID)
hostID
- The host idpublic 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 java.util.Collection<Group> getGroupsForHost(java.lang.String hostID, Topology.ServiceType serviceType)
hostID
- A specific Host.serviceType
- The type of service we are searching for.public static boolean isTaggedAsAdminNodeManager(Service service)
service
- The service to checkpublic java.util.List<Service> taggedAdminNodeManagers()
public java.util.List<Service> nonLocalTaggedAdminNodeManagers()
public java.lang.String generateID(Topology.EntityType type)
type
- The topology entity typepublic static Topology.ServiceType getServiceType(java.lang.String serviceID)
public void reserveId(Topology.EntityType type, java.lang.String idStr)
type
- The id typeidStr
- The id string e.g. host-1public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.List<java.lang.String> getHostIds()
public java.util.List<java.lang.String> getServiceIds()
public java.util.List<java.lang.String> getServiceIds(Topology.ServiceType serviceType)
public java.util.List<java.lang.String> getGroupIds()
This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel