public class CDataSourceSuperTail extends java.lang.Object implements IDataSource
Modifier and Type | Class and Description |
---|---|
static interface |
CDataSourceSuperTail.Delegate |
Modifier and Type | Field and Description |
---|---|
protected boolean |
m_bConnectErrorIssued
This member represents an error flag set if the connection
to SuperTail cannot be established.
|
protected java.io.File |
m_bookmarkFile
This member represents the bookmark-file associated to the
file currently being processed.
|
protected java.io.RandomAccessFile |
m_bookmarkStream
This member represents the bookmark-stream opened on m_bookmarkFile.
|
protected int |
m_connectTimeout |
protected java.lang.String |
m_crtFile
This member represents the name of the file currently being
processed.
|
protected int |
m_crtIndexInLine
This is the current index in m_crtLine.
|
protected java.lang.String |
m_crtLine
This member represents the current line read from SuperTail.
|
protected int |
m_crtLineNumber
This member represents the current line number.
|
protected double |
m_daysToKeepCpt
This member represents the number of days for preserving
check-point files.
|
protected static int |
m_debugLevel |
protected CDataSourceSuperTail.Delegate |
m_delegate
This delegate is used to check if we need to wait or not.
|
protected java.lang.String |
m_fileHead |
protected java.io.FilenameFilter |
m_filenameFilter
This member is used to filter files to process.
|
protected java.lang.String |
m_hostName
This member represents the hostname.
|
protected ILogger |
m_iLogger
This member is used to report errors and warnings.
|
protected java.io.BufferedInputStream |
m_inputStream
This member represents the input stream from SuperTail.
|
protected java.io.PrintWriter |
m_out
This member is used to send messages from SuperTail.
|
protected int |
m_port
This member represents the port-number.
|
protected java.io.BufferedReader |
m_reader
This member is used to read characters from SuperTail.
|
protected int |
m_readTimeout |
protected java.lang.String |
m_remoteDir
This member represents the remote directory on SuperTail's host.
|
protected COSARReporter |
m_reporter
This member is used to send reports to.
|
protected java.lang.String |
m_scratchDir
This member represents the scratch directory.
|
protected java.net.Socket |
m_socket
This member represents the remote socket to access SuperTail.
|
EOF
Constructor and Description |
---|
CDataSourceSuperTail(java.net.InetAddress remoteIP,
int remotePort,
int localPort,
java.lang.String remoteDir,
java.lang.String scratchDir,
ILogger iLogger) |
CDataSourceSuperTail(java.net.InetAddress remoteIP,
int remotePort,
java.lang.String remoteDir,
java.lang.String scratchDir,
ILogger iLogger) |
CDataSourceSuperTail(java.lang.String remoteHost,
int remotePort,
int localPort,
java.lang.String remoteDir,
java.lang.String scratchDir,
ILogger iLogger) |
CDataSourceSuperTail(java.lang.String remoteHost,
int remotePort,
java.lang.String remoteDir,
java.lang.String scratchDir,
ILogger iLogger) |
Modifier and Type | Method and Description |
---|---|
protected void |
debug(java.lang.String fName,
java.lang.String msg) |
boolean |
end()
This function is called to end reading.
|
protected void |
error(java.lang.String fName,
java.lang.String msg) |
protected java.lang.String |
getBookmarkFileName(java.lang.String inputFile) |
int |
getConnectTimeout() |
double |
getDaysToKeepCpt() |
static int |
getDebugLevel() |
java.io.FilenameFilter |
getFilenameFilter() |
int |
getLocalPort() |
int |
getReadTimeout() |
java.lang.String |
getRemoteDir() |
java.net.InetAddress |
getRemoteInetAddress() |
int |
getRemotePort() |
COSARReporter |
getReporter() |
java.lang.String |
getScratchDir() |
java.lang.String |
getSourceName() |
boolean |
hasMoreData() |
boolean |
initialize()
This function is called to initiate the communication protocol
with SuperTail.
|
boolean |
isHealthy() |
char |
nextChar()
Function used to read a character from the input medium
|
protected void |
purgeCheckpointFiles()
This function is used to purge the checkpoint files that are older
than one week.
|
int |
read(char[] buf,
int len)
This function reads a given number of characters from the source.
|
java.lang.String |
recv() |
boolean |
send(java.lang.String msg) |
boolean |
setBookmark(int lineNo)
Function used to mark a position in the input medium
|
void |
setConnectTimeout(int connectTimeout) |
void |
setDaysToKeepCpt(double daysToKeepCpt) |
static void |
setDebugLevel(int debugLevel) |
void |
setDelegate(CDataSourceSuperTail.Delegate delegate) |
void |
setFilenameFilter(java.io.FilenameFilter filenameFilter) |
void |
setReadTimeout(int readTimeout) |
void |
setReporter(COSARReporter reporter) |
boolean |
start()
This function is called to start reading.
|
boolean |
start1()
This function is called to start reading.
|
boolean |
terminate()
Function used to end communication with SuperTail
|
protected final java.lang.String m_fileHead
protected static int m_debugLevel
protected ILogger m_iLogger
protected java.lang.String m_hostName
protected int m_port
protected java.net.Socket m_socket
protected java.lang.String m_remoteDir
protected java.lang.String m_scratchDir
protected double m_daysToKeepCpt
protected java.io.BufferedInputStream m_inputStream
protected java.io.BufferedReader m_reader
protected java.io.PrintWriter m_out
protected java.lang.String m_crtLine
protected int m_crtIndexInLine
protected int m_crtLineNumber
protected java.lang.String m_crtFile
protected java.io.File m_bookmarkFile
protected java.io.RandomAccessFile m_bookmarkStream
protected boolean m_bConnectErrorIssued
protected COSARReporter m_reporter
protected java.io.FilenameFilter m_filenameFilter
protected CDataSourceSuperTail.Delegate m_delegate
protected int m_connectTimeout
protected int m_readTimeout
public CDataSourceSuperTail(java.net.InetAddress remoteIP, int remotePort, java.lang.String remoteDir, java.lang.String scratchDir, ILogger iLogger) throws java.lang.Exception
remoteIP
- IP of the host to connect toremotePort
- Port number to connect toremoteDir
- Remote directory to get data fromscratchDir
- Work-directoryiLogger
- Interface used for logging messagesjava.lang.Exception
public CDataSourceSuperTail(java.lang.String remoteHost, int remotePort, java.lang.String remoteDir, java.lang.String scratchDir, ILogger iLogger) throws java.lang.Exception
remoteHost
- Name of host to connect toremotePort
- Port number to connect toremoteDir
- Remote directory to get data fromscratchDir
- Work-directoryiLogger
- Interface used for logging messagesjava.lang.Exception
public CDataSourceSuperTail(java.net.InetAddress remoteIP, int remotePort, int localPort, java.lang.String remoteDir, java.lang.String scratchDir, ILogger iLogger) throws java.lang.Exception
remoteIP
- IP of the host to connect toremotePort
- Port number to connect tolocalPort
- Local port number to use when connectingremoteDir
- Remote directory to get data fromscratchDir
- Work-directoryiLogger
- Interface used for logging messagesjava.lang.Exception
public CDataSourceSuperTail(java.lang.String remoteHost, int remotePort, int localPort, java.lang.String remoteDir, java.lang.String scratchDir, ILogger iLogger) throws java.lang.Exception
remoteHost
- Name of host to connect toremotePort
- Port number to connect tolocalPort
- Local port number to use when connectingremoteDir
- Remote directory to get data fromscratchDir
- Work-directoryiLogger
- Interface used for logging messagesjava.lang.Exception
public static int getDebugLevel()
public java.net.InetAddress getRemoteInetAddress()
public int getRemotePort()
public int getLocalPort()
public java.lang.String getRemoteDir()
public java.lang.String getScratchDir()
public double getDaysToKeepCpt()
public java.io.FilenameFilter getFilenameFilter()
public COSARReporter getReporter()
public int getReadTimeout()
public int getConnectTimeout()
public void setDaysToKeepCpt(double daysToKeepCpt)
public void setFilenameFilter(java.io.FilenameFilter filenameFilter)
public static void setDebugLevel(int debugLevel)
public void setReporter(COSARReporter reporter)
public final void setDelegate(CDataSourceSuperTail.Delegate delegate)
public void setReadTimeout(int readTimeout)
public void setConnectTimeout(int connectTimeout)
public java.lang.String getSourceName()
getSourceName
in interface IDataSource
public boolean hasMoreData()
hasMoreData
in interface IDataSource
public char nextChar() throws java.lang.Exception
If there is a current file to process, the character is retrieved from this file, otherwise the next file is selected for processing
nextChar
in interface IDataSource
java.lang.Exception
public int read(char[] buf, int len) throws java.lang.Exception
IDataSource
read
in interface IDataSource
java.lang.Exception
public boolean start1()
public boolean start()
IDataSource
start
in interface IDataSource
public boolean end()
end
in interface IDataSource
public boolean initialize()
The input and output streams are initialized. The initialization of communication with SuperTail requires following protocol on the part of CDataSourceSupertail:
initialize
in interface IDataSource
public boolean terminate()
terminate
in interface IDataSource
public boolean setBookmark(int lineNo)
setBookmark
in interface IDataSource
public boolean send(java.lang.String msg)
public java.lang.String recv()
public boolean isHealthy()
isHealthy
in interface IDataSource
protected void purgeCheckpointFiles()
protected java.lang.String getBookmarkFileName(java.lang.String inputFile)
protected void error(java.lang.String fName, java.lang.String msg)
protected void debug(java.lang.String fName, java.lang.String msg)