EAC Toolkit 3.2.1

com.endeca.soleng.eac.toolkit.component
Class ServerComponent

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.component.Component
              extended by com.endeca.soleng.eac.toolkit.component.ServerComponent

public class ServerComponent
extends Component

ServerComponent extends component to expose utilities for running server components (e.g. dgraph, logserver). This object implements methods to start a component synchronously, or to start multiple components synchronously and in parallel.

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
ServerComponent()
           
 
Method Summary
 void cycle()
          Cycles the server component.
 int getNumIdleSecondsAfterStop()
           
 Script getPostStartupScript()
           
 Script getPreShutdownScript()
           
 long getShutdownTimeout()
           
 long getStartupTimeout()
           
 boolean isRunning()
          Returns true if the component is running.
 boolean isStarting()
          Returns true if the component is starting.
 void setPostStartupScript(Script postStartupScript)
           
 void setPreShutdownScript(Script preShutdownScript)
           
 void setStartupTimeout(long startupTimeout)
           
 void start()
          Starts the component.
 void startAsynchronously()
          Starts the component asynchronously, without testing its status after sending the start command.
static void startInParallel(java.util.List<ServerComponent> components)
          Starts server components in parallel.
 void stop()
          Stops the component.
 void stopAsynchronously()
          Stops the component asynchronously, without testing its status after sending the stop command.
static void stopInParallel(java.util.List<ServerComponent> components)
          Stop server components in parallel.
 boolean waitForStarted()
          Waits for the component to start, by polling for its status every second, until the startup timeout has elapsed.
 boolean waitForStopped()
          Waits for the component to stop, by polling for its status every second, until the stop timeout has elapsed.
 
Methods inherited from class com.endeca.soleng.eac.toolkit.component.Component
archiveLogDir, buildEacStub, cleanDir, constructArchiveLogDir, constructCleanDir, getCustomDirectories, getDirProperties, getHost, getHostId, getLongPropertyValueOrDefault, getMaxMissedStatusChecksAllowed, getMaxWaitTimeSeconds, getMinWaitTimeSeconds, getNumLogBackups, getNumMissedStatusChecks, getProperties, getProperty, getSlowPollingIntervalMs, getStandardPollingIntervalMs, getStatus, incrementMissedStatusQueries, initializeEacStub, isActive, isDefined, isDefinitionChanged, isFailed, isHotUpdateDefinitionChange, isSkipTestingForFilesDuringCleanup, removeDefinition, setCustomDirectories, setDefinition, setDefinition, setHost, setHostId, setNumMissedStatusChecks, setProperties, updateDefinition, updateEacDefinition, updateEacDefinition, waitForFinished
 
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

ServerComponent

public ServerComponent()
Method Detail

startInParallel

public static void startInParallel(java.util.List<ServerComponent> components)
                            throws EacCommunicationException,
                                   EacComponentControlException
Starts server components in parallel. Starts each component, then polls for the status until each component is running or failed/stopped.

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

stopInParallel

public static void stopInParallel(java.util.List<ServerComponent> components)
                           throws EacCommunicationException,
                                  EacComponentControlException
Stop server components in parallel. Stops each component, then polls for the status until each component is failed/stopped.

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

start

public void start()
           throws EacCommunicationException,
                  EacComponentControlException
Description copied from class: Component
Starts the component.

Overrides:
start in class 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
Description copied from class: Component
Stops the component.

Overrides:
stop in class 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.

stopAsynchronously

public void stopAsynchronously()
                        throws EacCommunicationException,
                               EacComponentControlException
Stops the component asynchronously, without testing its status after sending the stop command.

Throws:
EacCommunicationException
EacComponentControlException

startAsynchronously

public void startAsynchronously()
                         throws EacCommunicationException,
                                EacComponentControlException
Starts the component asynchronously, without testing its status after sending the start command.

Throws:
EacCommunicationException
EacComponentControlException

waitForStarted

public boolean waitForStarted()
                       throws EacCommunicationException,
                              EacComponentControlException
Waits for the component to start, by polling for its status every second, until the startup timeout has elapsed. If the component is still starting after the startup timeout elapses, this method returns false.

Returns:
Returns true if the component starts 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.

waitForStopped

public boolean waitForStopped()
                       throws EacCommunicationException,
                              EacComponentControlException
Waits for the component to stop, by polling for its status every second, until the stop timeout has elapsed. If the component is still running after the stop timeout elapses, this method returns false.

Returns:
Returns true if the component stops 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.

isStarting

public boolean isStarting()
                   throws EacCommunicationException,
                          EacComponentControlException
Returns true if the component is starting.

Returns:
Returns true of the component is starting.
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.

isRunning

public boolean isRunning()
                  throws EacCommunicationException,
                         EacComponentControlException
Returns true if the component is running.

Returns:
Returns true of the component is running.
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.

cycle

public void cycle()
           throws EacCommunicationException,
                  EacComponentControlException,
                  java.lang.InterruptedException,
                  AppConfigurationException
Cycles the server component. If the component is active, it is stopped, then restarted. If the component is inactive, it is started. While the component is stopped, its logs are archived, if configured to keep more than one log backup.

Throws:
EacCommunicationException - If a communication error occurs while cycling the component.
EacComponentControlException - If an error occurs while trying to cycle the component.
java.lang.InterruptedException - If the thread is interrupted while waiting for a component to finish.
AppConfigurationException - If a utility fails to initialize because of insufficient configuration information.

getStartupTimeout

public long getStartupTimeout()

setStartupTimeout

public void setStartupTimeout(long startupTimeout)

getShutdownTimeout

public long getShutdownTimeout()

getNumIdleSecondsAfterStop

public int getNumIdleSecondsAfterStop()

getPreShutdownScript

public Script getPreShutdownScript()

setPreShutdownScript

public void setPreShutdownScript(Script preShutdownScript)

getPostStartupScript

public Script getPostStartupScript()

setPostStartupScript

public void setPostStartupScript(Script postStartupScript)

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