Constructor and Description |
---|
ClusterImpl(ClusterEntity clusterEntity,
com.google.inject.Injector injector) |
Modifier and Type | Method and Description |
---|---|
void |
addConfig(Config config)
Sets a specific config.
|
void |
addConfigGroup(ConfigGroup configGroup)
Add a new config group to the set of Config groups associated with this
cluster
|
boolean |
addDesiredConfig(String user,
Config config)
Adds and sets a DESIRED configuration to be applied to a cluster.
|
void |
addRequestExecution(RequestExecution requestExecution)
Add a @RequestExecution to the cluster
|
void |
addService(Service service)
Add a service to a cluster
|
Service |
addService(String serviceName)
Add service to the cluster
|
void |
addServiceComponentHost(ServiceComponentHost svcCompHost) |
boolean |
canBeRemoved()
Gets if the cluster can be deleted
|
ClusterResponse |
convertToResponse()
Creates a cluster response based on the current cluster definition
|
void |
debugDump(StringBuilder sb)
Creates a debug dump based on the current cluster state
|
void |
delete()
Delete the cluster
|
void |
deleteAllServices()
Delete all the services associated with this cluster
|
void |
deleteConfigGroup(Long id)
Delete this config group identified by the config group id
|
void |
deleteRequestExecution(Long id)
Delete a @RequestExecution associated with the cluster
|
void |
deleteService(String serviceName)
Delete the named service associated with this cluster
|
Collection<Config> |
getAllConfigs()
Gets all configurations defined for a cluster.
|
Map<String,Map<String,DesiredConfig>> |
getAllHostsDesiredConfigs()
Fetch desired configs for all hosts in cluster
|
Map<Long,RequestExecution> |
getAllRequestExecutions()
Get all @RequestExecution objects associated with the cluster
|
ReadWriteLock |
getClusterGlobalLock()
Get lock to control access to cluster structure
|
long |
getClusterId()
Get the cluster ID
|
String |
getClusterName()
Get the Cluster Name
|
Config |
getConfig(String configType,
String versionTag)
Gets the specific config that matches the specified type and tag.
|
Map<Long,ConfigGroup> |
getConfigGroups()
Get all config groups associated with this cluster
|
Map<Long,ConfigGroup> |
getConfigGroupsByHostname(String hostname)
Find all config groups associated with the give hostname
|
Map<String,Config> |
getConfigsByType(String configType)
Gets all configs that match the specified type.
|
StackId |
getCurrentStackVersion()
Get current stack version
|
Config |
getDesiredConfigByType(String configType)
Gets the desired (and selected) config by type.
|
Map<String,DesiredConfig> |
getDesiredConfigs()
Gets the desired configurations for the cluster.
|
StackId |
getDesiredStackVersion()
Get desired stack version
|
Map<String,Map<String,DesiredConfig>> |
getHostsDesiredConfigs(Collection<String> hostnames)
Fetch desired configs for list of hosts in cluster
|
Service |
getService(String serviceName)
Get a service
|
ServiceComponentHost |
getServiceComponentHost(String serviceName,
String serviceComponentName,
String hostname) |
List<ServiceComponentHost> |
getServiceComponentHosts(String hostname)
Get all ServiceComponentHosts on a given host
|
Map<String,Service> |
getServices()
Get all services
|
void |
loadServiceHostComponents()
Make sure we load all the service host components.
|
void |
refresh()
Refreshes the cluster details
|
protected void |
removeEntities() |
void |
removeServiceComponentHost(ServiceComponentHost svcCompHost)
Remove ServiceComponentHost from cluster
|
void |
setClusterName(String clusterName)
Set the Cluster Name
|
void |
setCurrentStackVersion(StackId stackVersion)
Set current stack version
|
void |
setDesiredStackVersion(StackId stackVersion)
Set desired stack version
|
@Inject public ClusterImpl(ClusterEntity clusterEntity, com.google.inject.Injector injector)
public ReadWriteLock getClusterGlobalLock()
Cluster
getClusterGlobalLock
in interface Cluster
public void loadServiceHostComponents()
public void addConfigGroup(ConfigGroup configGroup) throws AmbariException
Cluster
addConfigGroup
in interface Cluster
AmbariException
public Map<Long,ConfigGroup> getConfigGroups() throws AmbariException
Cluster
getConfigGroups
in interface Cluster
AmbariException
public Map<Long,ConfigGroup> getConfigGroupsByHostname(String hostname) throws AmbariException
Cluster
getConfigGroupsByHostname
in interface Cluster
AmbariException
public void addRequestExecution(RequestExecution requestExecution) throws AmbariException
Cluster
addRequestExecution
in interface Cluster
AmbariException
public Map<Long,RequestExecution> getAllRequestExecutions()
Cluster
getAllRequestExecutions
in interface Cluster
public void deleteRequestExecution(Long id) throws AmbariException
Cluster
deleteRequestExecution
in interface Cluster
AmbariException
public void deleteConfigGroup(Long id) throws AmbariException
Cluster
deleteConfigGroup
in interface Cluster
AmbariException
public ServiceComponentHost getServiceComponentHost(String serviceName, String serviceComponentName, String hostname) throws AmbariException
AmbariException
public String getClusterName()
Cluster
getClusterName
in interface Cluster
public void setClusterName(String clusterName)
Cluster
setClusterName
in interface Cluster
public void addServiceComponentHost(ServiceComponentHost svcCompHost) throws AmbariException
AmbariException
public void removeServiceComponentHost(ServiceComponentHost svcCompHost) throws AmbariException
Cluster
removeServiceComponentHost
in interface Cluster
AmbariException
public long getClusterId()
Cluster
getClusterId
in interface Cluster
public List<ServiceComponentHost> getServiceComponentHosts(String hostname)
Cluster
getServiceComponentHosts
in interface Cluster
public void addService(Service service) throws AmbariException
Cluster
addService
in interface Cluster
AmbariException
public Service addService(String serviceName) throws AmbariException
Cluster
addService
in interface Cluster
AmbariException
public Service getService(String serviceName) throws AmbariException
Cluster
getService
in interface Cluster
AmbariException
public Map<String,Service> getServices()
Cluster
getServices
in interface Cluster
public StackId getDesiredStackVersion()
Cluster
getDesiredStackVersion
in interface Cluster
public void setDesiredStackVersion(StackId stackVersion)
Cluster
setDesiredStackVersion
in interface Cluster
public StackId getCurrentStackVersion()
Cluster
getCurrentStackVersion
in interface Cluster
public void setCurrentStackVersion(StackId stackVersion) throws AmbariException
Cluster
setCurrentStackVersion
in interface Cluster
AmbariException
public Map<String,Config> getConfigsByType(String configType)
Cluster
getConfigsByType
in interface Cluster
configType
- the config type to returnpublic Config getConfig(String configType, String versionTag)
Cluster
public void addConfig(Config config)
Cluster
public Collection<Config> getAllConfigs()
Cluster
getAllConfigs
in interface Cluster
public ClusterResponse convertToResponse() throws AmbariException
Cluster
convertToResponse
in interface Cluster
AmbariException
public void debugDump(StringBuilder sb)
Cluster
public void refresh()
Cluster
public void deleteAllServices() throws AmbariException
Cluster
deleteAllServices
in interface Cluster
AmbariException
public void deleteService(String serviceName) throws AmbariException
Cluster
deleteService
in interface Cluster
AmbariException
public boolean canBeRemoved()
Cluster
canBeRemoved
in interface Cluster
public void delete() throws AmbariException
Cluster
delete
in interface Cluster
AmbariException
protected void removeEntities() throws AmbariException
AmbariException
public boolean addDesiredConfig(String user, Config config)
Cluster
addDesiredConfig
in interface Cluster
user
- the user making the change for audit purposesconfig
- the Config
object to set as desiredtrue
if the config was added, or false
if the config is already set as the currentpublic Map<String,DesiredConfig> getDesiredConfigs()
Cluster
getDesiredConfigs
in interface Cluster
public Config getDesiredConfigByType(String configType)
Cluster
getDesiredConfigByType
in interface Cluster
configType
- the type of configurationConfig
instance, or null
if the type has
not been set.public Map<String,Map<String,DesiredConfig>> getHostsDesiredConfigs(Collection<String> hostnames)
Cluster
getHostsDesiredConfigs
in interface Cluster
public Map<String,Map<String,DesiredConfig>> getAllHostsDesiredConfigs()
Cluster
getAllHostsDesiredConfigs
in interface Cluster
Copyright © 2014. All rights reserved.