EAC Toolkit 3.2.1

com.endeca.soleng.eac.toolkit.host
Class Host

java.lang.Object
  extended by com.endeca.soleng.eac.toolkit.base.EacElement
      extended by com.endeca.soleng.eac.toolkit.base.Provisionable
          extended by com.endeca.soleng.eac.toolkit.host.Host

public class Host
extends Provisionable

This class represents a host provisioned in the EAC, implementing provisioning methods.

Author:
sshusteff

Field Summary
 
Fields inherited from class com.endeca.soleng.eac.toolkit.base.EacElement
appName, dataPrefix, eacHost, eacPort, elementId, lockManager, logDir, sslEnabled, workingDir
 
Constructor Summary
Host()
          Default constructor.
Host(java.lang.String appName, java.lang.String eacHost, int eacPort, java.lang.String hostId, boolean sslEnabled, java.lang.String dataPrefix, java.lang.String workingDir)
          Constructor to initialize the host object from its EAC definition, by retrieving the definition associated with the specified hostId.
 
Method Summary
 com.endeca.eac.client.HostType buildEacStub()
          Builds a HostType object to send to the EAC.
 void constructFromEacStub(com.endeca.eac.client.HostType hostType)
          Populates the fields in this object from associated values in the HostType WSDL stub object.
 java.util.Map<java.lang.String,java.lang.String> getCustomDirectories()
           
 java.lang.String getDirectory(java.lang.String dirName)
          Retrieves the value of the directory with the specified name from the provisioned host.
 java.lang.String getHostName()
           
 int getPort()
           
 java.util.Map<java.lang.String,java.lang.String> getProperties()
           
 java.lang.String getProperty(java.lang.String propName)
          Retrieves the value of the property with the specified name from the provisioned host.
 com.endeca.eac.client.HostType instantiateEacStub()
           
 boolean isDefined()
          Checks whether the host is defined in the EAC.
 boolean isDefinitionChanged()
          Compares the definition of the host in the EAC to the local definition.
 void removeDefinition()
          Removes the EAC provisioning of this host.
 void setCustomDirectories(java.util.Map<java.lang.String,java.lang.String> customDirectories)
           
 void setDefinition()
          Sets the EAC provisioning of this host.
 void setHostName(java.lang.String hostName)
           
 void setPort(int port)
           
 void setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
           
 void updateDefinition()
          Updates the EAC provisioning of this host.
 void updateEacDefinition()
           
 
Methods inherited from class com.endeca.soleng.eac.toolkit.base.Provisionable
getAppDefinitionFromEac, getCachedAppDefinition, getProvisioningPort, invalidateCachedAppDefinition, setCachedAppDefinition
 
Methods inherited from class com.endeca.soleng.eac.toolkit.base.EacElement
getAppName, getDataPrefix, getEacHost, getEacPort, getElementId, getLockManager, getLogDir, getWorkingDir, isSslEnabled, setAppName, setDataPrefix, setEacHost, setEacPort, setElementId, setLockManager, setLogDir, setSslEnabled, setWorkingDir
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Host

public Host()
Default constructor.


Host

public Host(java.lang.String appName,
            java.lang.String eacHost,
            int eacPort,
            java.lang.String hostId,
            boolean sslEnabled,
            java.lang.String dataPrefix,
            java.lang.String workingDir)
     throws EacCommunicationException,
            EacProvisioningException,
            AppConfigurationException
Constructor to initialize the host object from its EAC definition, by retrieving the definition associated with the specified hostId.

Parameters:
hostId - ID of the provisioned host to retrieve from the EAC.
Throws:
EacCommunicationException
EacProvisioningException
AppConfigurationException
Method Detail

getProperty

public java.lang.String getProperty(java.lang.String propName)
Retrieves the value of the property with the specified name from the provisioned host. Properties are arbitrary key/value pairs defined for provisioned hosts and components.

Parameters:
propName - Name of the property whose value will be retrieved.
Returns:
Returns the property value or null, if the property is not found.

getDirectory

public java.lang.String getDirectory(java.lang.String dirName)
Retrieves the value of the directory with the specified name from the provisioned host.

Parameters:
dirName - Name of the provisioned directory whose value will be retrieved.
Returns:
Returns the property value or null, if the property is not found.

isDefinitionChanged

public boolean isDefinitionChanged()
                            throws EacCommunicationException,
                                   EacProvisioningException
Compares the definition of the host in the EAC to the local definition.

Specified by:
isDefinitionChanged in class Provisionable
Returns:
Returns true if the host definition has changed.
Throws:
EacCommunicationException - If a communication error occurs while retrieving the provisioning port.
EacProvisioningException - If an error occurs while trying to retrieve the host definition from the EAC.

isDefined

public boolean isDefined()
                  throws EacCommunicationException,
                         EacProvisioningException
Checks whether the host is defined in the EAC.

Specified by:
isDefined in class Provisionable
Returns:
Returns true if the host is provisioned.
Throws:
EacCommunicationException - If a communication error occurs while retrieving the provisioning port.
EacProvisioningException - If an error occurs while trying to retrieve the component definition from the EAC.

updateDefinition

public void updateDefinition()
                      throws EacCommunicationException,
                             EacComponentControlException,
                             EacProvisioningException,
                             AppConfigurationException
Updates the EAC provisioning of this host. If the host has active components defined on it, they will be stopped and this method will attempt to re-start them. If the hostname of the host changed, this method will log a warning, stop all active components, remove the definitions of all components on that host and will not attempt to re-define or restart the components. Provisioning will automatically re-define the components, but any active components will need to be restarted. This is done to ensure that components have the appropriate directories created for them on their new host and that failures don't occur as a result of, for example, dgraphs trying to start on a new host where there is no index at provisioning time.

Specified by:
updateDefinition in class Provisionable
Throws:
EacComponentControlException - If an error occurs while trying to start, stop or check the status of the component.
EacCommunicationException - If a communication error occurs while retrieving the provisioning port.
AppConfigurationException - If a component configuration is invalid.
EacProvisioningException - If an error occurs while provisioning the host or its associated components.

removeDefinition

public void removeDefinition()
                      throws EacCommunicationException
Removes the EAC provisioning of this host. If the host has components associated with it, the components are (stopped and) removed by the EAC.

Specified by:
removeDefinition in class Provisionable
Throws:
EacCommunicationException - If a communication error occurs while retrieving the provisioning port.

setDefinition

public void setDefinition()
                   throws EacCommunicationException
Sets the EAC provisioning of this host.

Specified by:
setDefinition in class Provisionable
Throws:
EacCommunicationException - If a communication error occurs while setting the host definition.

updateEacDefinition

public void updateEacDefinition()
                         throws EacCommunicationException,
                                EacProvisioningException
Throws:
EacCommunicationException
EacProvisioningException

constructFromEacStub

public void constructFromEacStub(com.endeca.eac.client.HostType hostType)
Populates the fields in this object from associated values in the HostType WSDL stub object.

Parameters:
hostType - The HostType WSDL stub object from which to retrieve host definition.

buildEacStub

public com.endeca.eac.client.HostType buildEacStub()
Builds a HostType object to send to the EAC. If necessary, translates or transforms fields to match the EAC's requirements.

Returns:
Returns the HostType WSDL stub object for this Host.

instantiateEacStub

public com.endeca.eac.client.HostType instantiateEacStub()

getCustomDirectories

public java.util.Map<java.lang.String,java.lang.String> getCustomDirectories()

setCustomDirectories

public void setCustomDirectories(java.util.Map<java.lang.String,java.lang.String> customDirectories)

getProperties

public java.util.Map<java.lang.String,java.lang.String> getProperties()

setProperties

public void setProperties(java.util.Map<java.lang.String,java.lang.String> properties)

getHostName

public java.lang.String getHostName()

setHostName

public void setHostName(java.lang.String hostName)

getPort

public int getPort()

setPort

public void setPort(int port)

EAC Toolkit 3.2.1

Copyright © 2011 Endeca Technologies, Inc. All Rights Reserved.
@VERSION
PRODUCT: EAC Toolkit (eacToolkit)
VERSION: 3.2.1
BUILD:   NONE
ARCH_OS: n/a
DATE:    2011-11-10T16:21:05-0500