public class Utility extends EacElement
Modifier and Type | Field and Description |
---|---|
protected static int |
EAC_MAX_TOKEN_LENGTH
Maximum token length that the EAC can handle
|
protected static 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
|
appName, dataPrefix, eacHost, eacPort, elementId, lockManager, logDir, sslEnabled, workingDir
Constructor and Description |
---|
Utility()
Empty constructor, for convenience in using utilities as beans.
|
Utility(String appName,
String eacHost,
int eacPort,
boolean sslEnabled)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
com.endeca.eac.client.RunUtilityType |
buildEacStub()
Builds a RunUtilityType object to send to the EAC.
|
Map<String,Boolean> |
getDirContents(String dir,
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(List<Utility> utilities)
Static method to run a set of utilities in parallel.
|
void |
setElementId(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.
|
getAppName, getDataPrefix, getEacHost, getEacPort, getElementId, getLockManager, getLogDir, getWorkingDir, isSslEnabled, setAppName, setDataPrefix, setEacHost, setEacPort, setLockManager, setLogDir, setSslEnabled, setWorkingDir
protected static final 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
public Utility(String appName, String eacHost, int eacPort, boolean sslEnabled) throws AppConfigurationException
AppConfigurationException
- If the application name or EAC host is null.public Utility()
public static void runInParallel(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 Map<String,Boolean> getDirContents(String dir, 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(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)
Copyright © 2014, Oracle and/or its affiliates. All rights reserved.