public class ServiceComponentHostImpl extends Object implements ServiceComponentHost
| Constructor and Description |
|---|
ServiceComponentHostImpl(ServiceComponent serviceComponent,
HostComponentStateEntity stateEntity,
HostComponentDesiredStateEntity desiredStateEntity,
Clusters clusters,
StackDAO stackDAO,
HostDAO hostDAO,
ServiceComponentDesiredStateDAO serviceComponentDesiredStateDAO,
HostComponentStateDAO hostComponentStateDAO,
HostComponentDesiredStateDAO hostComponentDesiredStateDAO,
AmbariEventPublisher eventPublisher) |
ServiceComponentHostImpl(ServiceComponent serviceComponent,
String hostName,
Clusters clusters,
StackDAO stackDAO,
HostDAO hostDAO,
ServiceComponentDesiredStateDAO serviceComponentDesiredStateDAO,
HostComponentStateDAO hostComponentStateDAO,
HostComponentDesiredStateDAO hostComponentDesiredStateDAO,
AmbariEventPublisher eventPublisher) |
ServiceComponentHostImpl(ServiceComponent serviceComponent,
String hostName,
ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntity,
Clusters clusters,
StackDAO stackDAO,
HostDAO hostDAO,
ServiceComponentDesiredStateDAO serviceComponentDesiredStateDAO,
HostComponentStateDAO hostComponentStateDAO,
HostComponentDesiredStateDAO hostComponentDesiredStateDAO,
AmbariEventPublisher eventPublisher) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canBeRemoved() |
ServiceComponentHostResponse |
convertToResponse(Map<String,DesiredConfig> desiredConfigs)
Builds a
ServiceComponentHostResponse. |
ServiceComponentHostResponse |
convertToResponseStatusOnly(Map<String,DesiredConfig> desiredConfigs,
boolean collectStaleConfigsStatus) |
void |
debugDump(StringBuilder sb) |
void |
delete(DeleteHostComponentStatusMetaData deleteMetaData) |
Map<String,HostConfig> |
getActualConfigs()
Gets the actual config tags, if known.
|
long |
getClusterId()
Get the Cluster that this object maps to
|
String |
getClusterName()
Get the Cluster that this object maps to
|
HostComponentAdminState |
getComponentAdminState() |
StackId |
getDesiredStackId()
Convenience method to get the desired stack id from the service component
|
State |
getDesiredState() |
HostComponentDesiredStateEntity |
getDesiredStateEntity()
Gets the desired state entity for this
ServiceComponentHost. |
Host |
getHost()
Get the Host this object maps to
|
String |
getHostName()
Get the Host this object maps to
|
HostState |
getHostState() |
long |
getLastOpEndTime() |
long |
getLastOpLastUpdateTime() |
long |
getLastOpStartTime() |
MaintenanceState |
getMaintenanceState() |
List<Map<String,String>> |
getProcesses() |
String |
getPublicHostName()
Get the public host name this object maps to
|
ServiceComponent |
getServiceComponent()
Gets the service component.
|
String |
getServiceComponentName()
Get the ServiceComponent this object maps to
|
String |
getServiceName()
Get the Service this object maps to
|
State |
getState() |
UpgradeState |
getUpgradeState() |
String |
getVersion()
Gets the version of the component.
|
void |
handleEvent(ServiceComponentHostEvent event)
Send a ServiceComponentHostState event to the StateMachine
|
boolean |
isClientComponent() |
boolean |
isRecoveryEnabled()
Get whether recovery is enabled for
this component or not.
|
boolean |
isRestartRequired() |
boolean |
isRestartRequired(HostComponentDesiredStateEntity hostComponentDesiredStateEntity) |
HostVersionEntity |
recalculateHostVersionState()
Updates an existing
HostVersionEntity for the desired repository of
this component, or create one if it doesn't exist. |
protected void |
removeEntities() |
void |
setComponentAdminState(HostComponentAdminState attribute) |
void |
setDesiredState(State state) |
void |
setLastOpEndTime(long lastOpEndTime) |
void |
setLastOpLastUpdateTime(long lastOpLastUpdateTime) |
void |
setLastOpStartTime(long lastOpStartTime) |
void |
setMaintenanceState(MaintenanceState state) |
void |
setProcesses(List<Map<String,String>> procs) |
void |
setRestartRequired(boolean restartRequired) |
boolean |
setRestartRequiredWithoutEventPublishing(boolean restartRequired)
Set restartRequired flag for appropriate HostComponentDesiredStateEntity
|
void |
setState(State state) |
void |
setUpgradeState(UpgradeState upgradeState)
To be called during the upgrade of a specific Component in a host.
|
void |
setVersion(String version)
Sets the version of the component from the stack.
|
public ServiceComponentHostImpl(ServiceComponent serviceComponent, String hostName, ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntity, Clusters clusters, StackDAO stackDAO, HostDAO hostDAO, ServiceComponentDesiredStateDAO serviceComponentDesiredStateDAO, HostComponentStateDAO hostComponentStateDAO, HostComponentDesiredStateDAO hostComponentDesiredStateDAO, AmbariEventPublisher eventPublisher)
public ServiceComponentHostImpl(ServiceComponent serviceComponent, String hostName, Clusters clusters, StackDAO stackDAO, HostDAO hostDAO, ServiceComponentDesiredStateDAO serviceComponentDesiredStateDAO, HostComponentStateDAO hostComponentStateDAO, HostComponentDesiredStateDAO hostComponentDesiredStateDAO, AmbariEventPublisher eventPublisher)
public ServiceComponentHostImpl(ServiceComponent serviceComponent, HostComponentStateEntity stateEntity, HostComponentDesiredStateEntity desiredStateEntity, Clusters clusters, StackDAO stackDAO, HostDAO hostDAO, ServiceComponentDesiredStateDAO serviceComponentDesiredStateDAO, HostComponentStateDAO hostComponentStateDAO, HostComponentDesiredStateDAO hostComponentDesiredStateDAO, AmbariEventPublisher eventPublisher)
public State getState()
getState in interface ServiceComponentHostpublic void setState(State state)
setState in interface ServiceComponentHostpublic String getVersion()
ServiceComponentHostgetVersion in interface ServiceComponentHostpublic void setVersion(String version) throws org.apache.ambari.server.AmbariException
ServiceComponentHostsetVersion in interface ServiceComponentHostversion - component version (e.g. 2.2.0.0-2041)org.apache.ambari.server.AmbariExceptionpublic void setUpgradeState(UpgradeState upgradeState)
setUpgradeState in interface ServiceComponentHostupgradeState - the upgrade statepublic UpgradeState getUpgradeState()
getUpgradeState in interface ServiceComponentHostpublic void handleEvent(ServiceComponentHostEvent event) throws InvalidStateTransitionException
ServiceComponentHosthandleEvent in interface ServiceComponentHostevent - Event to handleInvalidStateTransitionExceptionpublic String getServiceComponentName()
ServiceComponentHostgetServiceComponentName in interface ServiceComponentHostpublic String getHostName()
ServiceComponentHostgetHostName in interface ServiceComponentHostpublic String getPublicHostName()
ServiceComponentHostgetPublicHostName in interface ServiceComponentHostpublic Host getHost()
ServiceComponentHostgetHost in interface ServiceComponentHostpublic long getLastOpStartTime()
public void setLastOpStartTime(long lastOpStartTime)
lastOpStartTime - the lastOpStartTime to setpublic long getLastOpEndTime()
public void setLastOpEndTime(long lastOpEndTime)
lastOpEndTime - the lastOpEndTime to setpublic long getLastOpLastUpdateTime()
public void setLastOpLastUpdateTime(long lastOpLastUpdateTime)
lastOpLastUpdateTime - the lastOpLastUpdateTime to setpublic long getClusterId()
ServiceComponentHostgetClusterId in interface ServiceComponentHostpublic String getServiceName()
ServiceComponentHostgetServiceName in interface ServiceComponentHostpublic boolean isClientComponent()
isClientComponent in interface ServiceComponentHostpublic State getDesiredState()
getDesiredState in interface ServiceComponentHostpublic void setDesiredState(State state)
setDesiredState in interface ServiceComponentHostpublic HostComponentAdminState getComponentAdminState()
getComponentAdminState in interface ServiceComponentHostpublic void setComponentAdminState(HostComponentAdminState attribute)
setComponentAdminState in interface ServiceComponentHostpublic ServiceComponentHostResponse convertToResponse(Map<String,DesiredConfig> desiredConfigs)
ServiceComponentHostServiceComponentHostResponse.convertToResponse in interface ServiceComponentHostdesiredConfigs - the desired configurations for the cluster. Obtaining these can be
expensive and since this method operates on SCH's, it could be
called 10,000's of times when generating cluster/host responses.
Therefore, the caller should build these once and pass them in. If
null, then this method will retrieve them at runtime,
incurring a performance penality.public ServiceComponentHostResponse convertToResponseStatusOnly(Map<String,DesiredConfig> desiredConfigs, boolean collectStaleConfigsStatus)
convertToResponseStatusOnly in interface ServiceComponentHostpublic String getClusterName()
ServiceComponentHostgetClusterName in interface ServiceComponentHostpublic void debugDump(StringBuilder sb)
debugDump in interface ServiceComponentHostpublic boolean canBeRemoved()
canBeRemoved in interface ServiceComponentHostpublic void delete(DeleteHostComponentStatusMetaData deleteMetaData)
delete in interface ServiceComponentHostprotected void removeEntities()
public Map<String,HostConfig> getActualConfigs()
ServiceComponentHostgetActualConfigs in interface ServiceComponentHostpublic HostState getHostState()
getHostState in interface ServiceComponentHostpublic boolean isRecoveryEnabled()
ServiceComponentHostisRecoveryEnabled in interface ServiceComponentHostpublic void setMaintenanceState(MaintenanceState state)
setMaintenanceState in interface ServiceComponentHoststate - the maintenance statepublic MaintenanceState getMaintenanceState()
getMaintenanceState in interface ServiceComponentHostpublic void setProcesses(List<Map<String,String>> procs)
setProcesses in interface ServiceComponentHostprocs - a list containing a map describing each processpublic List<Map<String,String>> getProcesses()
getProcesses in interface ServiceComponentHostpublic boolean isRestartRequired()
isRestartRequired in interface ServiceComponentHostpublic boolean isRestartRequired(HostComponentDesiredStateEntity hostComponentDesiredStateEntity)
isRestartRequired in interface ServiceComponentHostpublic void setRestartRequired(boolean restartRequired)
setRestartRequired in interface ServiceComponentHostrestartRequired - the restartRequired flagpublic boolean setRestartRequiredWithoutEventPublishing(boolean restartRequired)
ServiceComponentHostsetRestartRequiredWithoutEventPublishing in interface ServiceComponentHostrestartRequired - the restartRequired flag.public HostVersionEntity recalculateHostVersionState() throws org.apache.ambari.server.AmbariException
HostVersionEntity for the desired repository of
this component, or create one if it doesn't exist.recalculateHostVersionState in interface ServiceComponentHostorg.apache.ambari.server.AmbariExceptionpublic HostComponentDesiredStateEntity getDesiredStateEntity()
ServiceComponentHost.getDesiredStateEntity in interface ServiceComponentHostpublic ServiceComponent getServiceComponent()
getServiceComponent in interface ServiceComponentHostnull).public StackId getDesiredStackId()
getDesiredStackId in interface ServiceComponentHostCopyright © 2022 Apache Software Foundation. All rights reserved.