|
EAC Toolkit 3.2.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.endeca.soleng.eac.toolkit.base.EacElement com.endeca.soleng.eac.toolkit.utility.Utility
public class Utility
The Utility class is the base class from which all utility implementations extend. This includes core utilities copy, backup, shell and rollback as well as custom extensions of those utilities that expose common utility invocations that may be used in deployments. This class provides methods for interacting with the EAC's utility web service, including starting, stopping and querying for the status of a utility invocation. Utility objects are designed for easy construction and initialization by other Java classes in the toolkit. To that end, constructors are provided that set the application name and EAC host and port (without which, no EAC interaction would be possible). Initializer methods are also provided, exposing single-method interfaces for other objects to set up common utilities for invocation. Utilities can also be defined in the app configuration document. To facilitate this, Utility objects are designed as simple, Spring-friendly Beans, providing empty constructors and getters and setters for all fields.
Field Summary | |
---|---|
protected static int |
EAC_MAX_TOKEN_LENGTH
Maximum token length that the EAC can handle |
protected static java.lang.String |
ENDECA_CONF
Holds the ENDECA_CONF environment variable |
protected static boolean |
IS_WINDOWS
Are we running on a Windows system? |
protected static int |
WINDOWS_MAX_PATH_LENGTH
Maximum absolute path allowed under the Windows filesystem |
Fields inherited from class com.endeca.soleng.eac.toolkit.base.EacElement |
---|
appName, dataPrefix, eacHost, eacPort, elementId, lockManager, logDir, sslEnabled, workingDir |
Constructor Summary | |
---|---|
Utility()
Empty constructor, for convenience in using utilities as beans. |
|
Utility(java.lang.String appName,
java.lang.String eacHost,
int eacPort,
boolean sslEnabled)
Default constructor. |
Method Summary | |
---|---|
com.endeca.eac.client.RunUtilityType |
buildEacStub()
Builds a RunUtilityType object to send to the EAC. |
java.util.Map<java.lang.String,java.lang.Boolean> |
getDirContents(java.lang.String dir,
java.lang.String host)
Retrieves the list of files found in the specified directory on the specified host. |
long |
getMaxMissedStatusChecksAllowed()
|
long |
getMaxWaitTimeSeconds()
|
long |
getMinWaitTimeSeconds()
|
long |
getNonNullPositiveLongValueOrDefault(long value,
long defaultValue)
|
int |
getNumMissedStatusChecks()
|
long |
getSlowPollingIntervalMs()
|
long |
getStandardPollingIntervalMs()
|
com.endeca.eac.client.StateType |
getStatus()
Retrieves the status of the utility. |
void |
incrementMissedStatusQueries()
|
protected void |
initializeEacStub(com.endeca.eac.client.RunUtilityType stub)
|
boolean |
isActive()
Returns true if the utility is active (i.e. |
boolean |
isFailed()
Returns true if the utility failed when it was run most recently. |
protected int |
maximumAllowedTokenLength()
|
void |
run()
Runs the utility synchronously. |
static void |
runInParallel(java.util.List<Utility> utilities)
Static method to run a set of utilities in parallel. |
void |
setElementId(java.lang.String elementId)
|
void |
setMaxMissedStatusQueriesAllowed(long maxMissedStatusQueriesAllowed)
|
void |
setMaxWaitSeconds(long maxWaitSeconds)
|
void |
setMinWaitSeconds(long minWaitSeconds)
|
void |
setNumMissedStatusChecks(int numMissedStatusQueries)
|
void |
setPollingIntervalMs(long pollingIntervalMs)
|
void |
setSlowPollingIntervalMs(long slowPollingIntervalMs)
|
void |
start()
Starts the utility. |
void |
stop()
Stops the utility. |
boolean |
waitForFinished()
Waits for the utility 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.EacElement |
---|
getAppName, getDataPrefix, getEacHost, getEacPort, getElementId, getLockManager, getLogDir, getWorkingDir, isSslEnabled, setAppName, setDataPrefix, setEacHost, setEacPort, setLockManager, setLogDir, setSslEnabled, setWorkingDir |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String ENDECA_CONF
protected static final int EAC_MAX_TOKEN_LENGTH
protected static final int WINDOWS_MAX_PATH_LENGTH
protected static final boolean IS_WINDOWS
Constructor Detail |
---|
public Utility(java.lang.String appName, java.lang.String eacHost, int eacPort, boolean sslEnabled) throws AppConfigurationException
AppConfigurationException
- If the application name or EAC host is null.public Utility()
Method Detail |
---|
public static void runInParallel(java.util.List<Utility> utilities) throws EacCommunicationException, EacComponentControlException
utilities
- List of utilities to execute.
EacCommunicationException
- If a communication error occurs while
requesting the status of a utility from the EAC.
EacComponentControlException
- If an error occurs while trying to
start a utility.public void run() throws EacCommunicationException, EacComponentControlException
EacCommunicationException
- If a communication error occurs while
requesting the status of the utility from the EAC.
EacComponentControlException
- If an error occurs while trying to
start the utility.public void start() throws EacCommunicationException, EacComponentControlException
EacCommunicationException
- If a communication error occurs while
requesting the status of the utility from the EAC.
EacComponentControlException
- If an error occurs while trying to
start the utility.public java.util.Map<java.lang.String,java.lang.Boolean> getDirContents(java.lang.String dir, java.lang.String host) throws EacCommunicationException
dir
- The absolute directory whose files are to be listed.host
- The target host on which the directory is found.
EacCommunicationException
public void stop() throws EacCommunicationException, EacComponentControlException
EacCommunicationException
- If a communication error occurs while
requesting the status of the utility from the EAC.
EacComponentControlException
- If an error occurs while trying to
stop the utility.public com.endeca.eac.client.StateType getStatus() throws EacCommunicationException, EacComponentControlException
EacCommunicationException
- If a communication error occurs while
requesting the status of the utility from the EAC.
EacComponentControlException
- If an error occurs while trying to
check the status of the utility.public boolean waitForFinished() throws EacCommunicationException, EacComponentControlException
EacCommunicationException
- If a communication error occurs while
requesting the status of the utility from the EAC.
EacComponentControlException
- If an error occurs while trying to
check the status of the utility.public boolean isActive() throws EacCommunicationException, EacComponentControlException
EacCommunicationException
- If a communication error occurs while
requesting the status of the utility from the EAC.
EacComponentControlException
- If an error occurs while trying to
check the status of the utility.public boolean isFailed() throws EacCommunicationException, EacComponentControlException
EacCommunicationException
- If a communication error occurs while
requesting the status of the utility from the EAC.
EacComponentControlException
- If an error occurs while trying to
check the status of the utility.public com.endeca.eac.client.RunUtilityType buildEacStub()
protected void initializeEacStub(com.endeca.eac.client.RunUtilityType stub)
protected int maximumAllowedTokenLength()
public void setElementId(java.lang.String elementId)
setElementId
in class EacElement
public long getNonNullPositiveLongValueOrDefault(long value, long defaultValue)
public long getMaxMissedStatusChecksAllowed()
public long getStandardPollingIntervalMs()
public long getSlowPollingIntervalMs()
public long getMinWaitTimeSeconds()
public long getMaxWaitTimeSeconds()
public int getNumMissedStatusChecks()
public void setNumMissedStatusChecks(int numMissedStatusQueries)
public void incrementMissedStatusQueries()
public void setMinWaitSeconds(long minWaitSeconds)
public void setMaxWaitSeconds(long maxWaitSeconds)
public void setMaxMissedStatusQueriesAllowed(long maxMissedStatusQueriesAllowed)
public void setPollingIntervalMs(long pollingIntervalMs)
public void setSlowPollingIntervalMs(long slowPollingIntervalMs)
|
EAC Toolkit 3.2.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@VERSION PRODUCT: EAC Toolkit (eacToolkit) VERSION: 3.2.1 BUILD: NONE ARCH_OS: n/a DATE: 2011-11-10T16:21:05-0500