public class DistributorReader extends DistributorProcess
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
sResourceBundle
DEBUG_PREFIX, DEFAULT_FILE_BUFFER_SIZE, ERROR_PREFIX, FAILURE_FLAG, FILECHECK_CMD, INFO_PREFIX, MAX_RETRIES_FOR_FILE_ACCESS, MY_RESOURCE_NAME, PUT_CMD, SUCCESS_FLAG, WARNING_PREFIX
Constructor and Description |
---|
DistributorReader(java.net.Socket pConnection,
atg.distributor.DistributorReceiver pManager)
Constructs an instance of DistributorReader
|
DistributorReader(java.net.Socket pConnection,
atg.distributor.DistributorReceiver pManager,
atg.nucleus.logging.ApplicationLoggingSender pLogger)
Constructs an instance of DistributorReader
|
Modifier and Type | Method and Description |
---|---|
java.net.Socket |
getConnection()
Returns property Connection
|
protected java.lang.String |
localizeDirectoryPath(java.lang.String pDirectoryPath) |
void |
processConnection(java.net.Socket pConnection,
java.io.File pCache)
Handle processing a connection from a client.
|
protected void |
processFileCheckCommand(java.io.DataInputStream pInput,
java.io.DataOutputStream pOutput,
java.io.File pCache) |
protected void |
processPutCommand(java.io.DataInputStream pInput,
java.io.DataOutputStream pOutput,
java.io.File pCache)
Reads from the input stream the
PUT protocol and creates a file
in the local cache directory. |
void |
run()
Handle processing connections from clients
|
java.lang.String |
toString() |
protected void |
transmitFailureStatusCode(java.io.DataOutputStream pOutput)
Sends the failure status code to the remote client
|
protected void |
transmitSuccessStatusCode(java.io.DataOutputStream pOutput)
Sends the success status code to the remote client
|
protected boolean |
writeFile(java.io.File pFilePath,
long pFileSize,
java.io.DataInputStream pInput)
Reads the data from the supplied input stream and writes the data to the given file
|
getLogger, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingWarning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logWarning, logWarning, logWarning, setLogger, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingWarning
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
public DistributorReader(java.net.Socket pConnection, atg.distributor.DistributorReceiver pManager)
pConnection
- Socket connection which will be used to read datapManager
- Manager that helps receive datapublic DistributorReader(java.net.Socket pConnection, atg.distributor.DistributorReceiver pManager, atg.nucleus.logging.ApplicationLoggingSender pLogger)
pConnection
- Socket connection which will be used to read datapManager
- Manager that helps receive datapLogger
- Application loggerpublic java.net.Socket getConnection()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected void transmitSuccessStatusCode(java.io.DataOutputStream pOutput) throws java.io.IOException
pOutput
- the output stream to return a status to the clientIf
- an error occurs while sending the status codejava.io.IOException
protected void transmitFailureStatusCode(java.io.DataOutputStream pOutput) throws java.io.IOException
pOutput
- the output stream to return a status to the clientIf
- an error occurs while sending the status codejava.io.IOException
protected boolean writeFile(java.io.File pFilePath, long pFileSize, java.io.DataInputStream pInput) throws java.io.IOException
pFilePath
- the file to store the data sentpFileSize
- the total amount of bytes that are being sent from the clientpInput
- the input stream to read from the clientjava.io.IOException
protected java.lang.String localizeDirectoryPath(java.lang.String pDirectoryPath)
protected void processPutCommand(java.io.DataInputStream pInput, java.io.DataOutputStream pOutput, java.io.File pCache) throws java.io.IOException
PUT
protocol and creates a file
in the local cache directory. If this process was accomplished returns a success status
code to the remote client.pInput
- the input stream to read from the clientpOutput
- the output stream to return a status to the clientjava.io.IOException
- if an error occurs while processing the commandprotected void processFileCheckCommand(java.io.DataInputStream pInput, java.io.DataOutputStream pOutput, java.io.File pCache) throws java.io.IOException
java.io.IOException
public void processConnection(java.net.Socket pConnection, java.io.File pCache)
A single transaction consists of the following:
public java.lang.String toString()
toString
in class java.lang.Thread