|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread atg.distributor.DistributorProcess atg.distributor.DistributorReader
public class DistributorReader
The DistributorReader is a thread process which handles the communication protocol from the DistributorReceiver.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string |
Fields inherited from class atg.distributor.DistributorProcess |
---|
sResourceBundle |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Fields inherited from interface atg.distributor.DistributorConstants |
---|
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 Summary | |
---|---|
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 |
Method Summary | |
---|---|
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 |
Methods inherited from class atg.distributor.DistributorProcess |
---|
getLogger, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingWarning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logWarning, logWarning, logWarning, setLogger, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingWarning |
Methods inherited from class java.lang.Thread |
---|
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 |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.lang.String CLASS_VERSION
Constructor Detail |
---|
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 loggerMethod Detail |
---|
public 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 client
If
- an error occurs while sending the status code
java.io.IOException
protected void transmitFailureStatusCode(java.io.DataOutputStream pOutput) throws java.io.IOException
pOutput
- the output stream to return a status to the client
If
- an error occurs while sending the status code
java.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 client
java.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 client
java.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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |