EAC Components 3.2.2

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

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

public class LogServerComponent
extends com.endeca.soleng.eac.toolkit.component.ServerComponent


Field Summary
 
Fields inherited from class com.endeca.soleng.eac.toolkit.base.EacElement
appName, dataPrefix, eacHost, eacPort, elementId, lockManager, logDir, sslEnabled, workingDir
 
Constructor Summary
LogServerComponent()
           
 
Method Summary
 com.endeca.eac.client.ComponentType buildEacStub()
           
 void callLogserverRollUrl()
          Shells out to call curl on the logserver's /roll URL to trigger a log roll.
 void copyAllButLastLogFileToTargetDir()
          Copies all log files in the LogServer output to the target report gen directory, excluding the log file with the latest time stamp.
 void copyAllLogFilesToTargetDir()
          Copies all log files in the LogServer output to the target report gen directory.
 void copyLastWeekLogFilesToTargetDir()
          Copies the log files required for the "LastWeek" report to the target report gen directory.
 void copyLogFilesToTargetDir(java.util.Date startDate, java.util.Date endDate)
          Copies all log files in a specified date range from logserver output to target report gen directory.
 void copyWeekEndingYesterdayLogFilesToTargetDir()
          Copies the log files required for the week ending yesterday report to the target report gen directory.
 void copyYesterdayLogFilesToTargetDir()
          Copies the log files required for the "Yesterday" report to the target report gen directory.
 void cycle()
           
 boolean dateRangeIncludesLatestLogFile(java.util.Date startDate, java.util.Date endDate)
          Returns true if the requested date range would require the most recent log file.
 java.util.SortedMap<java.util.Date,java.lang.String> getLogFilesByStartDate()
          Returns a map of all logserver output files, keyed by the date object parsed from the file's timestamp.
 java.lang.String getOutputDir()
           
 int getPort()
           
 java.lang.String getTargetReportGenDir()
           
 java.lang.String getTargetReportGenHostId()
           
protected  void initializeEacStub(com.endeca.eac.client.LogServerComponentType stub)
           
 boolean isGzip()
           
 boolean lastWeekIncludesLatestLogFile()
          Returns true if the latest log file is included in the date range required for the "LastWeek" report.
 void setGzip(boolean gzip)
           
 void setOutputDir(java.lang.String outputDir)
           
 void setPort(int port)
           
 boolean weekEndingYesterdayIncludesLatestLogFile()
          Returns true if the latest log file is included in the date range required for the week ending yesterday report.
 boolean yesterdayIncludesLatestLogFile()
          Returns true if the latest log file is included in the date range required for the "Yesterday" report.
 
Methods inherited from class com.endeca.soleng.eac.toolkit.component.ServerComponent
getNumIdleSecondsAfterStop, getPostStartupScript, getPreShutdownScript, getShutdownTimeout, getStartupTimeout, isRunning, isStarting, setPostStartupScript, setPreShutdownScript, setStartupTimeout, start, startAsynchronously, startInParallel, stop, stopAsynchronously, stopInParallel, waitForStarted, waitForStopped
 
Methods inherited from class com.endeca.soleng.eac.toolkit.component.Component
archiveLogDir, 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

LogServerComponent

public LogServerComponent()
Method Detail

cycle

public void cycle()
           throws com.endeca.soleng.eac.toolkit.exception.EacCommunicationException,
                  com.endeca.soleng.eac.toolkit.exception.EacComponentControlException,
                  java.lang.InterruptedException,
                  com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
Overrides:
cycle in class com.endeca.soleng.eac.toolkit.component.ServerComponent
Throws:
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.exception.EacComponentControlException
java.lang.InterruptedException
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException

buildEacStub

public com.endeca.eac.client.ComponentType buildEacStub()
Overrides:
buildEacStub in class com.endeca.soleng.eac.toolkit.component.Component

initializeEacStub

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

callLogserverRollUrl

public void callLogserverRollUrl()
                          throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                 com.endeca.soleng.eac.toolkit.exception.EacCommunicationException,
                                 com.endeca.soleng.eac.toolkit.exception.EacComponentControlException,
                                 java.lang.InterruptedException
Shells out to call curl on the logserver's /roll URL to trigger a log roll.

Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.exception.EacComponentControlException
java.lang.InterruptedException

copyYesterdayLogFilesToTargetDir

public void copyYesterdayLogFilesToTargetDir()
                                      throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                             com.endeca.soleng.eac.toolkit.exception.EacCommunicationException,
                                             com.endeca.soleng.eac.toolkit.exception.EacComponentControlException
Copies the log files required for the "Yesterday" report to the target report gen directory.

Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.exception.EacComponentControlException

yesterdayIncludesLatestLogFile

public boolean yesterdayIncludesLatestLogFile()
                                       throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                              com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
Returns true if the latest log file is included in the date range required for the "Yesterday" report.

Returns:
Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException

copyLastWeekLogFilesToTargetDir

public void copyLastWeekLogFilesToTargetDir()
                                     throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                            com.endeca.soleng.eac.toolkit.exception.EacCommunicationException,
                                            com.endeca.soleng.eac.toolkit.exception.EacComponentControlException
Copies the log files required for the "LastWeek" report to the target report gen directory.

Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.exception.EacComponentControlException

lastWeekIncludesLatestLogFile

public boolean lastWeekIncludesLatestLogFile()
                                      throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                             com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
Returns true if the latest log file is included in the date range required for the "LastWeek" report.

Returns:
Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException

copyWeekEndingYesterdayLogFilesToTargetDir

public void copyWeekEndingYesterdayLogFilesToTargetDir()
                                                throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                                       com.endeca.soleng.eac.toolkit.exception.EacCommunicationException,
                                                       com.endeca.soleng.eac.toolkit.exception.EacComponentControlException
Copies the log files required for the week ending yesterday report to the target report gen directory.

Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.exception.EacComponentControlException

weekEndingYesterdayIncludesLatestLogFile

public boolean weekEndingYesterdayIncludesLatestLogFile()
                                                 throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                                        com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
Returns true if the latest log file is included in the date range required for the week ending yesterday report.

Returns:
Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException

dateRangeIncludesLatestLogFile

public boolean dateRangeIncludesLatestLogFile(java.util.Date startDate,
                                              java.util.Date endDate)
                                       throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                              com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
Returns true if the requested date range would require the most recent log file. This method can be used to test whether the logserver should be "rolled" to free up the latest log file for report generation.

Parameters:
startDate -
endDate -
Returns:
Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException

copyAllLogFilesToTargetDir

public void copyAllLogFilesToTargetDir()
                                throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                       com.endeca.soleng.eac.toolkit.exception.EacCommunicationException,
                                       com.endeca.soleng.eac.toolkit.exception.EacComponentControlException
Copies all log files in the LogServer output to the target report gen directory. Uses the date range-based log copier with date range starting at "start of epoch" (1/1/70) and ending 1 second from now.

Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.exception.EacComponentControlException

copyAllButLastLogFileToTargetDir

public void copyAllButLastLogFileToTargetDir()
                                      throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                             com.endeca.soleng.eac.toolkit.exception.EacCommunicationException,
                                             com.endeca.soleng.eac.toolkit.exception.EacComponentControlException
Copies all log files in the LogServer output to the target report gen directory, excluding the log file with the latest time stamp. Uses the date range-based log copier with date range starting at the "start of epoch" (1/1/70) and ending at the date of the last file in the directory. This method may be used if the latest log file is being used by the active LogServer and all "unlocked" files are desired.

Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.exception.EacComponentControlException

copyLogFilesToTargetDir

public void copyLogFilesToTargetDir(java.util.Date startDate,
                                    java.util.Date endDate)
                             throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                    com.endeca.soleng.eac.toolkit.exception.EacCommunicationException,
                                    com.endeca.soleng.eac.toolkit.exception.EacComponentControlException
Copies all log files in a specified date range from logserver output to target report gen directory.

Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.exception.EacComponentControlException

getLogFilesByStartDate

public java.util.SortedMap<java.util.Date,java.lang.String> getLogFilesByStartDate()
                                                                            throws com.endeca.soleng.eac.toolkit.exception.AppConfigurationException,
                                                                                   com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
Returns a map of all logserver output files, keyed by the date object parsed from the file's timestamp. This method retrieves a list of all files in the LogServer's output directory, matches them against a regex that looks for the pattern yyyy_MM_dd.HH_mm_ss and parses the matching timestamp into a date. If any files don't match or can't be parsed into a date, warnings are logged but ignored.

Returns:
Returns a sorted map of logserver output files, keyed by the date in the log's filename, containign the filename as a value.
Throws:
com.endeca.soleng.eac.toolkit.exception.AppConfigurationException
com.endeca.soleng.eac.toolkit.exception.EacCommunicationException

getTargetReportGenDir

public java.lang.String getTargetReportGenDir()

getTargetReportGenHostId

public java.lang.String getTargetReportGenHostId()

isGzip

public boolean isGzip()

setGzip

public void setGzip(boolean gzip)

getOutputDir

public java.lang.String getOutputDir()

setOutputDir

public void setOutputDir(java.lang.String outputDir)

getPort

public int getPort()

setPort

public void setPort(int port)

EAC Components 3.2.2

Copyright © 2006, 2012, Oracle and/or its affiliates. All rights reserved.
@VERSION
PRODUCT: EAC Components (eacComponents)
VERSION: 3.2.2
BUILD:   NONEDEV
ARCH_OS: n/a
DATE:    2012-02-28T13:13:23-0500