Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| EAC Toolkit 3.2.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.endeca.soleng.eac.toolkit.component
Class Component

    java.lang.Object
      com.endeca.soleng.eac.toolkit.base.EacElement
          com.endeca.soleng.eac.toolkit.base.Provisionable
              com.endeca.soleng.eac.toolkit.component.Component

Direct Known Subclasses:
  BatchComponent, ServerComponent

    public class Component

extends Provisionable

Component is the provisionable object from which all components inherit. This object exposes methods for interacting with the EAC's component control web service to start, stop and request the status of components.

Field Summary

Fields inherited from class com.endeca.soleng.eac.toolkit.base.EacElement
`appName, dataPrefix, eacHost, eacPort, elementId, lockManager, logDir, sslEnabled, workingDir`

Constructor Summary
`Component()`

Method Summary
`void` | `archiveLogDir()` Creates a backup of the components log directory (i.e.
`com.endeca.eac.client.ComponentType` | `buildEacStub()` Builds a ComponentType object to send to the EAC.
`void` | `cleanDir(java.lang.String dir)` Cleans all contents for the target directory, if the specified path is not null or empty.
`Utility` | `constructArchiveLogDir()` Construct utility for archiving the log directory or, if number of archives is configured to be "-1" (indicating the user wants to clear the log directory, but not archive the logs), this method constructs a utility to clean the log directory.
`CleanDirUtility` | `constructCleanDir(java.lang.String dir)` Construct utility for cleaning the specified directory.
`java.util.Map<java.lang.String,java.lang.String>` | `getCustomDirectories()`
`protected java.util.List<java.lang.String>` | `getDirProperties()` Retrieves a list of properties assumed to be custom directory definitions, based on the convention that the property name ends with "dir" or "Dir."
`Host` | `getHost()`
`java.lang.String` | `getHostId()`
`long` | `getLongPropertyValueOrDefault(java.lang.String propName, long defaultValue)`
`long` | `getMaxMissedStatusChecksAllowed()`
`long` | `getMaxWaitTimeSeconds()`
`long` | `getMinWaitTimeSeconds()`
`int` | `getNumLogBackups()` Retrieves the number of log archives configured as a property in the app configuration.
`int` | `getNumMissedStatusChecks()`
`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 component.
`long` | `getSlowPollingIntervalMs()`
`long` | `getStandardPollingIntervalMs()`
`com.endeca.eac.client.StateType` | `getStatus()` Retrieves the status of the component.
`void` | `incrementMissedStatusQueries()`
`protected void` | `initializeEacStub(com.endeca.eac.client.ComponentType stub)`
`boolean` | `isActive()` Returns true if the component is active (i.e.
`boolean` | `isDefined()` Checks whether the component is defined in the EAC.
`boolean` | `isDefinitionChanged()` Compares the definition of the component in the EAC to the local definition.
`boolean` | `isFailed()` Returns true if the component failed when it was run most recently.
`boolean` | `isHotUpdateDefinitionChange()` Method to test whether a definition change requires stopping the component or whether it can be performed as a "hot update." This implementation assumes that the only hot update that's possible is a change to the properties.
`boolean` | `isSkipTestingForFilesDuringCleanup()` Retrieves the boolean indicating whether directory cleanup should use the default behavior of first testing for non-empty directory contents, or if that test should be skipped.
`void` | `removeDefinition()` Removes the EAC provisioning of this component.
`void` | `setCustomDirectories(java.util.Map<java.lang.String,java.lang.String> customDirectories)`
`void` | `setDefinition()` Sets the EAC provisioning of this component, building the definition from the information in this object.
`void` | `setDefinition(com.endeca.eac.client.ComponentType componentType)` Sets the EAC provisioning of this component to the ComponentType WSDL stub object passed as a parameter.
`void` | `setHost(Host host)`
`void` | `setHostId(java.lang.String hostId)`
`void` | `setNumMissedStatusChecks(int numMissedStatusQueries)`
`void` | `setProperties(java.util.Map<java.lang.String,java.lang.String> properties)`
`void` | `start()` Starts the component.
`void` | `stop()` Stops the component.
`void` | `updateDefinition()` Updates the EAC provisioning of this component.
`void` | `updateEacDefinition()` Updates the EAC provisioning of this component, building the definition from this object.
`void` | `updateEacDefinition(com.endeca.eac.client.ComponentType componentType)` Updates the EAC provisioning of this component with the specified component type.
`boolean` | `waitForFinished()` Waits for the component to finish, by polling for its status every second, until the maximum wait time has elapsed.

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

### Component

    public Component()

Method Detail

### start

    public void start()
               throws EacCommunicationException,
                      EacComponentControlException

  Starts the component.

  Throws:
    `EacCommunicationException` - If a communication error occurs while requesting the status of the component from the EAC.
    `EacComponentControlException` - If an error occurs while trying to start the component.

### stop

    public void stop()
              throws EacCommunicationException,
                     EacComponentControlException

  Stops the component.

  Throws:
    `EacCommunicationException` - If a communication error occurs while requesting the status of the component from the EAC.
    `EacComponentControlException` - If an error occurs while trying to stop the component.

### getStatus

    public com.endeca.eac.client.StateType getStatus()
                                              throws EacCommunicationException,
                                                     EacComponentControlException

  Retrieves the status of the component.

  Returns:
    Returns a String representation of the component's status.
  Throws:
    `EacCommunicationException` - If a communication error occurs while requesting the status of the component from the EAC.
    `EacComponentControlException` - If an error occurs while trying to check the status of the component.

### waitForFinished

    public boolean waitForFinished()
                            throws EacCommunicationException,
                                   EacComponentControlException

  Waits for the component to finish, by polling for its status every second, until the maximum wait time has elapsed. If the component hasn't stopped after the maximum wait time elapses, this method returns false. If a minimum wait time has been specified, this method will poll once per minute until the minimum wait time has been reached and then will begin polling once per second until the component finishes or the maximum wait time has elapsed.

  Returns:
    Returns true if the component finished within the allotted wait time.
  Throws:
    `EacCommunicationException` - If a communication error occurs while requesting the status of the component from the EAC.
    `EacComponentControlException` - If an error occurs while trying to check the status of the component.

### isActive

    public boolean isActive()
                     throws EacCommunicationException,
                            EacComponentControlException

  Returns true if the component is active (i.e. not failed or stopped).

  Returns:
    Returns true of the component is active.
  Throws:
    `EacCommunicationException` - If a communication error occurs while requesting the status of the component from the EAC.
    `EacComponentControlException` - If an error occurs while trying to check the status of the component.

### isFailed

    public boolean isFailed()
                     throws EacCommunicationException,
                            EacComponentControlException

  Returns true if the component failed when it was run most recently.

  Returns:
    Returns true of the component failed.
  Throws:
    `EacCommunicationException` - If a communication error occurs while requesting the status of the component from the EAC.
    `EacComponentControlException` - If an error occurs while trying to check the status of the component.

### archiveLogDir

    public void archiveLogDir()
                       throws AppConfigurationException,
                              EacCommunicationException,
                              EacComponentControlException,
                              java.lang.InterruptedException

  Creates a backup of the components log directory (i.e. the directory in which the log file is being saved). If numLogBackups is "-1", this call will clear the log directory instead of archiving it. This setting is useful during development for ensuring logs don't append indefinitely, but saving space by not creating unwanted archives. If numLogBackups is less than -1 or zero, no action is taken.

  Throws:
    `AppConfigurationException` - If there is insufficient or invalid configuration for the utility..
    `EacCommunicationException` - If a communication error occurs while running the backup.
    `EacComponentControlException` - If an error occurs while running the backup.
    `java.lang.InterruptedException` - If the thread is interrupted while waiting for the backup to finish.

### constructArchiveLogDir

    public Utility constructArchiveLogDir()
                                   throws AppConfigurationException

  Construct utility for archiving the log directory or, if number of archives is configured to be "-1" (indicating the user wants to clear the log directory, but not archive the logs), this method constructs a utility to clean the log directory.

  Returns:
    Null if log directory is null/empty or if numLogBackups is invalid (less than -1 or 0). CleanDirUtility to clean the log dir if numLogBackups is "-1". BackupUtility to archive the log directory, if numLogBackups is greater than zero.
  Throws:
    `AppConfigurationException`

### cleanDir

    public void cleanDir(java.lang.String dir)
                  throws AppConfigurationException,
                         EacCommunicationException,
                         EacComponentControlException

  Cleans all contents for the target directory, if the specified path is not null or empty. Path is not resolved or made absolute, so must be absolute or must be relative to the component's working dir. All dir contents/subdirs are removed. In fact, the implementation will remove the directroy and all its contents recursively, then re-create the empty directory.

  Parameters:
    `dir` - Directory to clean.
  Throws:
    `AppConfigurationException`
    `EacCommunicationException`
    `EacComponentControlException`

### constructCleanDir

    public CleanDirUtility constructCleanDir(java.lang.String dir)
                                      throws AppConfigurationException

  Construct utility for cleaning the specified directory. Does not resolve or try to make the path absolute, just checks that it is not a null or empty string. This will typically mean that the directory needs to be an absolute path, or is relative to this component's working directory.

  Parameters:
    `dir` - Directory to clean.
  Returns:
    CleanDirUtility for cleaning the target directory, or null if dir argument is null/empty.
  Throws:
    `AppConfigurationException`

### getDirProperties

    protected java.util.List<java.lang.String> getDirProperties()

  Retrieves a list of properties assumed to be custom directory definitions, based on the convention that the property name ends with "dir" or "Dir."

  Returns:
    Returns a list of directory properties or an empty list if no properties are defined that match the directory naming convention.

### getProperty

    public java.lang.String getProperty(java.lang.String propName)

  Retrieves the value of the property with the specified name from the provisioned component. 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.

### isDefinitionChanged

    public boolean isDefinitionChanged()
                                throws EacCommunicationException,
                                       EacProvisioningException

  Compares the definition of the component in the EAC to the local definition.

  Specified by:
    `isDefinitionChanged` in class `Provisionable`
  Returns:
    Returns true if the component 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 component definition from the EAC.

### isDefined

    public boolean isDefined()
                      throws EacCommunicationException,
                             EacProvisioningException

  Checks whether the component is defined in the EAC.

  Specified by:
    `isDefined` in class `Provisionable`
  Returns:
    Returns true if the component 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

  Updates the EAC provisioning of this component. If the component is active, this method will stop it, re-define it and attempt to re-start it. If the update can be performed without stopping the component, this method will do so. If a stopped component fails to restart, a warning is logged, but execution continues. This is a likely scenario for changes like a component moving to a new host. For example, a dgraph will not restart on a new host until its index is moved to the new host.

  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.
    `EacProvisioningException`

### isHotUpdateDefinitionChange

    public boolean isHotUpdateDefinitionChange()
                                        throws EacCommunicationException,
                                               EacProvisioningException

  Method to test whether a definition change requires stopping the component or whether it can be performed as a "hot update." This implementation assumes that the only hot update that's possible is a change to the properties.

  Returns:
    Returns true if the definition can be updated while the component is active.
  Throws:
    `EacProvisioningException`
    `EacCommunicationException`

### removeDefinition

    public void removeDefinition()
                          throws EacCommunicationException,
                                 EacComponentControlException

  Removes the EAC provisioning of this component. If the component is active, this method will stop it.

  Specified by:
    `removeDefinition` in class `Provisionable`
  Throws:
    `EacComponentControlException` - If an error occurs while trying to stop the component.
    `EacCommunicationException` - If a communication error occurs while retrieving the provisioning port.

### setDefinition

    public void setDefinition()
                       throws EacCommunicationException

  Sets the EAC provisioning of this component, building the definition from the information in this object.

  Specified by:
    `setDefinition` in class `Provisionable`
  Throws:
    `EacCommunicationException` - If a communication error occurs while removing the component.

### setDefinition

    public void setDefinition(com.endeca.eac.client.ComponentType componentType)
                       throws EacCommunicationException

  Sets the EAC provisioning of this component to the ComponentType WSDL stub object passed as a parameter.

  Parameters:
    `componentType` - Definition to set in the EAC.
  Throws:
    `EacCommunicationException` - If a communication error occurs while removing the component.

### updateEacDefinition

    public void updateEacDefinition()
                             throws EacCommunicationException,
                                    EacProvisioningException

  Updates the EAC provisioning of this component, building the definition from this object.

  Throws:
    `EacCommunicationException`
    `EacProvisioningException`

### updateEacDefinition

    public void updateEacDefinition(com.endeca.eac.client.ComponentType componentType)
                             throws EacCommunicationException,
                                    EacProvisioningException

  Updates the EAC provisioning of this component with the specified component type. This action will not be forced, as it should only occur when the component is inactive or when the component is active but the change can be applied as a hot update.

  Throws:
    `EacCommunicationException`
    `EacProvisioningException`

### buildEacStub

    public com.endeca.eac.client.ComponentType buildEacStub()

  Builds a ComponentType object to send to the EAC. If necessary, translates or transforms fields to match the EAC's requirements.

  Returns:
    Returns the ComponentType WSDL stub object for this Component.

### initializeEacStub

    protected void initializeEacStub(com.endeca.eac.client.ComponentType stub)

### getNumLogBackups

    public int getNumLogBackups()

  Retrieves the number of log archives configured as a property in the app configuration. If no value exists or if the value is not a number, returns 0.

  Returns:
    Returns the number of log archives to keep or zero.

### isSkipTestingForFilesDuringCleanup

    public boolean isSkipTestingForFilesDuringCleanup()

  Retrieves the boolean indicating whether directory cleanup should use the default behavior of first testing for non-empty directory contents, or if that test should be skipped. If no value exists or if the value does not parse as a boolean, the default value of "false" is returned. If "true" is specified, CleanDirUtility invocations will skip the test and will attempt to clean directories even if they are empty.

  Returns:
    Returns boolean indicator of whether cleanup should skip checking directory contents, as configured in property "skipTestingForFilesDuringCleanup."

### 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)

### getHostId

    public java.lang.String getHostId()

### setHostId

    public void setHostId(java.lang.String hostId)

### getHost

    public Host getHost()

### setHost

    public void setHost(Host host)

### getLongPropertyValueOrDefault

    public long getLongPropertyValueOrDefault(java.lang.String propName,
                                              long defaultValue)

### getMaxMissedStatusChecksAllowed

    public long getMaxMissedStatusChecksAllowed()

### getStandardPollingIntervalMs

    public long getStandardPollingIntervalMs()

### getSlowPollingIntervalMs

    public long getSlowPollingIntervalMs()

### getMinWaitTimeSeconds

    public long getMinWaitTimeSeconds()

### getMaxWaitTimeSeconds

    public long getMaxWaitTimeSeconds()

### getNumMissedStatusChecks

    public int getNumMissedStatusChecks()

### setNumMissedStatusChecks

    public void setNumMissedStatusChecks(int numMissedStatusQueries)

### incrementMissedStatusQueries

    public void incrementMissedStatusQueries()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| EAC Toolkit 3.2.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006, 2012, Oracle and/or its affiliates. All rights reserved.

    @VERSION
    PRODUCT: EAC Toolkit (eacToolkit)
    VERSION: 3.2.2
    BUILD:   NONEDEV
    ARCH_OS: n/a
    DATE:    2012-02-28T13:13:15-0500