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 ServiceComponentHost
public void setState(State state)
setState
in interface ServiceComponentHost
public String getVersion()
ServiceComponentHost
getVersion
in interface ServiceComponentHost
public void setVersion(String version) throws org.apache.ambari.server.AmbariException
ServiceComponentHost
setVersion
in interface ServiceComponentHost
version
- component version (e.g. 2.2.0.0-2041)org.apache.ambari.server.AmbariException
public void setUpgradeState(UpgradeState upgradeState)
setUpgradeState
in interface ServiceComponentHost
upgradeState
- the upgrade statepublic UpgradeState getUpgradeState()
getUpgradeState
in interface ServiceComponentHost
public void handleEvent(ServiceComponentHostEvent event) throws InvalidStateTransitionException
ServiceComponentHost
handleEvent
in interface ServiceComponentHost
event
- Event to handleInvalidStateTransitionException
public String getServiceComponentName()
ServiceComponentHost
getServiceComponentName
in interface ServiceComponentHost
public String getHostName()
ServiceComponentHost
getHostName
in interface ServiceComponentHost
public String getPublicHostName()
ServiceComponentHost
getPublicHostName
in interface ServiceComponentHost
public Host getHost()
ServiceComponentHost
getHost
in interface ServiceComponentHost
public 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()
ServiceComponentHost
getClusterId
in interface ServiceComponentHost
public String getServiceName()
ServiceComponentHost
getServiceName
in interface ServiceComponentHost
public boolean isClientComponent()
isClientComponent
in interface ServiceComponentHost
public State getDesiredState()
getDesiredState
in interface ServiceComponentHost
public void setDesiredState(State state)
setDesiredState
in interface ServiceComponentHost
public HostComponentAdminState getComponentAdminState()
getComponentAdminState
in interface ServiceComponentHost
public void setComponentAdminState(HostComponentAdminState attribute)
setComponentAdminState
in interface ServiceComponentHost
public ServiceComponentHostResponse convertToResponse(Map<String,DesiredConfig> desiredConfigs)
ServiceComponentHost
ServiceComponentHostResponse
.convertToResponse
in interface ServiceComponentHost
desiredConfigs
- 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 ServiceComponentHost
public String getClusterName()
ServiceComponentHost
getClusterName
in interface ServiceComponentHost
public void debugDump(StringBuilder sb)
debugDump
in interface ServiceComponentHost
public boolean canBeRemoved()
canBeRemoved
in interface ServiceComponentHost
public void delete(DeleteHostComponentStatusMetaData deleteMetaData)
delete
in interface ServiceComponentHost
protected void removeEntities()
public Map<String,HostConfig> getActualConfigs()
ServiceComponentHost
getActualConfigs
in interface ServiceComponentHost
public HostState getHostState()
getHostState
in interface ServiceComponentHost
public boolean isRecoveryEnabled()
ServiceComponentHost
isRecoveryEnabled
in interface ServiceComponentHost
public void setMaintenanceState(MaintenanceState state)
setMaintenanceState
in interface ServiceComponentHost
state
- the maintenance statepublic MaintenanceState getMaintenanceState()
getMaintenanceState
in interface ServiceComponentHost
public void setProcesses(List<Map<String,String>> procs)
setProcesses
in interface ServiceComponentHost
procs
- a list containing a map describing each processpublic List<Map<String,String>> getProcesses()
getProcesses
in interface ServiceComponentHost
public boolean isRestartRequired()
isRestartRequired
in interface ServiceComponentHost
public boolean isRestartRequired(HostComponentDesiredStateEntity hostComponentDesiredStateEntity)
isRestartRequired
in interface ServiceComponentHost
public void setRestartRequired(boolean restartRequired)
setRestartRequired
in interface ServiceComponentHost
restartRequired
- the restartRequired flagpublic boolean setRestartRequiredWithoutEventPublishing(boolean restartRequired)
ServiceComponentHost
setRestartRequiredWithoutEventPublishing
in interface ServiceComponentHost
restartRequired
- 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 ServiceComponentHost
org.apache.ambari.server.AmbariException
public HostComponentDesiredStateEntity getDesiredStateEntity()
ServiceComponentHost
.getDesiredStateEntity
in interface ServiceComponentHost
public ServiceComponent getServiceComponent()
getServiceComponent
in interface ServiceComponentHost
null
).public StackId getDesiredStackId()
getDesiredStackId
in interface ServiceComponentHost
Copyright © 2022 Apache Software Foundation. All rights reserved.