Remote System Explorer DataStore
Release 1.0

org.eclipse.dstore.core.client
Class ClientCommandHandler

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.eclipse.dstore.core.model.Handler
          extended byorg.eclipse.dstore.core.model.CommandHandler
              extended byorg.eclipse.dstore.core.client.ClientCommandHandler
All Implemented Interfaces:
Runnable

public class ClientCommandHandler
extends CommandHandler

The ClientCommandHandler is reponsible for maintaining a queue of commands and periodically sending commands from the queue to the server side.


Field Summary
protected  DataElement _classDocumentElement
           
protected  DataElement _confirmKeepAliveDocumentElement
           
protected  DataElement _docDocumentElement
           
protected  DataElement _fileDocumentElement
           
protected  DataElement _keepAliveDocumentElement
           
protected  DataElement _pendingKeepAliveConfirmation
           
protected  DataElement _pendingKeepAliveRequest
           
protected  DataElement _requestClassDocumentElement
           
protected  DataElement _serializedDocumentElement
           
 
Fields inherited from class org.eclipse.dstore.core.model.CommandHandler
_classesToSend, _commands
 
Fields inherited from class org.eclipse.dstore.core.model.Handler
_dataStore, _keepRunning, _waitIncrement
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ClientCommandHandler(Sender sender)
          Constructor
 
Method Summary
 void addClassToSend(DataElement classElement)
          Adds a class to the queue of classes (represented by DataElements) to be sent to the server.
 void handle()
          Periodically called to send commands from the queue.
 void requestClass(String className)
          Implemented to provide the means by which classes are requested across the comm channel.
 void sendAppendFile(String fileName, byte[] bytes, int size, boolean binary)
          Appends bytes of a file from the client to the server
 void sendAppendFile(String fileName, byte[] bytes, int size, boolean binary, String byteStreamHandlerId)
          Appends bytes of a file from the client to the server
 void sendClass(String className)
          Implemented to provide the means by which classes are requested and sent across the comm channel.
 void sendClass(String className, String classbyteStreamHandlerId)
          Implemented to provide the means by which classes are sent across the comm channel.
 void sendClassInstance(IRemoteClassInstance runnable, String deserializebyteStreamHandlerId)
          Runs the specified class on the remote system
 void sendCommands()
          Called periodically to send the current queue of commands to the server
 void sendFile(String fileName, byte[] bytes, int size, boolean binary)
          Transmits the bytes of a file from the client to the server
 void sendFile(String fileName, byte[] bytes, int size, boolean binary, String byteStreamHandlerId)
          Transmits the bytes of a file from the client to the server
 void sendKeepAliveConfirmation()
           
 void sendKeepAliveRequest()
           
 void setDataStore(DataStore dataStore)
          Sets the associated DataStore
 void waitForInput()
          Causes the current thread to wait until this class request has been fulfilled.
 
Methods inherited from class org.eclipse.dstore.core.model.CommandHandler
addCommand, cancelAllCommands, command, command, command, command, command, getCommandGenerator, getDataStore
 
Methods inherited from class org.eclipse.dstore.core.model.Handler
finish, getWaitTime, isFinished, notifyInput, run, setWaitTime
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_requestClassDocumentElement

protected DataElement _requestClassDocumentElement

_keepAliveDocumentElement

protected DataElement _keepAliveDocumentElement

_confirmKeepAliveDocumentElement

protected DataElement _confirmKeepAliveDocumentElement

_pendingKeepAliveRequest

protected DataElement _pendingKeepAliveRequest

_pendingKeepAliveConfirmation

protected DataElement _pendingKeepAliveConfirmation

_fileDocumentElement

protected DataElement _fileDocumentElement

_docDocumentElement

protected DataElement _docDocumentElement

_classDocumentElement

protected DataElement _classDocumentElement

_serializedDocumentElement

protected DataElement _serializedDocumentElement
Constructor Detail

ClientCommandHandler

public ClientCommandHandler(Sender sender)
Constructor

Parameters:
sender - the Sender
Method Detail

setDataStore

public void setDataStore(DataStore dataStore)
Description copied from class: CommandHandler
Sets the associated DataStore

Overrides:
setDataStore in class CommandHandler

sendFile

public void sendFile(String fileName,
                     byte[] bytes,
                     int size,
                     boolean binary,
                     String byteStreamHandlerId)
Transmits the bytes of a file from the client to the server

Specified by:
sendFile in class CommandHandler
Parameters:
bytes - the bytes of a file to send
size - the number of bytes to send
binary - indicates whether to send the bytes as binary or unicode
byteStreamHandlerId - indicates wwhich byte stream handler should receive the bytes
fileName - the name of the file to send

sendFile

public void sendFile(String fileName,
                     byte[] bytes,
                     int size,
                     boolean binary)
Transmits the bytes of a file from the client to the server

Specified by:
sendFile in class CommandHandler
Parameters:
bytes - the bytes of a file to send
size - the number of bytes to send
binary - indicates whether to send the bytes as binary or unicode
fileName - the name of the file to send

sendAppendFile

public void sendAppendFile(String fileName,
                           byte[] bytes,
                           int size,
                           boolean binary,
                           String byteStreamHandlerId)
Appends bytes of a file from the client to the server

Specified by:
sendAppendFile in class CommandHandler
Parameters:
bytes - the bytes of a file to send
size - the number of bytes to send
binary - indicates whether to send the bytes as binary or unicode
byteStreamHandlerId - indicates which byte stream handler should receive the bytes
fileName - the name of the file to send

sendAppendFile

public void sendAppendFile(String fileName,
                           byte[] bytes,
                           int size,
                           boolean binary)
Appends bytes of a file from the client to the server

Specified by:
sendAppendFile in class CommandHandler
Parameters:
bytes - the bytes of a file to send
size - the number of bytes to send
binary - indicates whether to send the bytes as binary or unicode
fileName - the name of the file to send

sendCommands

public void sendCommands()
Called periodically to send the current queue of commands to the server

Specified by:
sendCommands in class CommandHandler

handle

public void handle()
Description copied from class: CommandHandler
Periodically called to send commands from the queue.

Overrides:
handle in class CommandHandler

sendClass

public void sendClass(String className,
                      String classbyteStreamHandlerId)
Implemented to provide the means by which classes are sent across the comm channel.

Specified by:
sendClass in class CommandHandler
Parameters:
className - the name of the class to send
classbyteStreamHandlerId - the name of the byte stream handler to use to receive the class

sendClass

public void sendClass(String className)
Implemented to provide the means by which classes are requested and sent across the comm channel.

Specified by:
sendClass in class CommandHandler
Parameters:
className - the name of the class to send

addClassToSend

public void addClassToSend(DataElement classElement)
Adds a class to the queue of classes (represented by DataElements) to be sent to the server.

Parameters:
classElement - the DataElement representing the class to be sent

sendClassInstance

public void sendClassInstance(IRemoteClassInstance runnable,
                              String deserializebyteStreamHandlerId)
Description copied from class: CommandHandler
Runs the specified class on the remote system

Specified by:
sendClassInstance in class CommandHandler

requestClass

public void requestClass(String className)
Implemented to provide the means by which classes are requested across the comm channel.

Specified by:
requestClass in class CommandHandler
Parameters:
className - the name of the class to request

sendKeepAliveConfirmation

public void sendKeepAliveConfirmation()
Specified by:
sendKeepAliveConfirmation in class CommandHandler

sendKeepAliveRequest

public void sendKeepAliveRequest()
Specified by:
sendKeepAliveRequest in class CommandHandler

waitForInput

public void waitForInput()
Description copied from class: CommandHandler
Causes the current thread to wait until this class request has been fulfilled.

Overrides:
waitForInput in class CommandHandler

Remote System Explorer DataStore
Release 1.0

Guidelines for using DataStore APIs.