Remote System Explorer DataStore
Release 1.0

org.eclipse.dstore.core.server
Class ServerUpdateHandler

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.eclipse.dstore.core.model.Handler
          extended byorg.eclipse.dstore.core.model.UpdateHandler
              extended byorg.eclipse.dstore.core.server.ServerUpdateHandler
All Implemented Interfaces:
Runnable

public class ServerUpdateHandler
extends UpdateHandler

The ServerUpdateHandler is contains a queue of data update requests and periodically transmits it's queue to the client


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.UpdateHandler
_classesToSend, _dataObjects
 
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
ServerUpdateHandler()
          Constructor
 
Method Summary
 void addClassToSend(DataElement classElement)
          Adds a class to the queue of classes (represented by DataElements) to be sent to the client.
 void addSender(Sender sender)
          Add a sender to the list of senders.
 void handle()
          Periodically called on the handler thread to sends data updates.
 void removeSender(Sender sender)
          Remove a sender from the list of senders.
 void removeSenderWith(Socket socket)
          Removes the sender that is associated with the specified socket.
 void requestClass(String className)
          Implemented to provide the means by which classes are sent across the comm channel.
 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 sendKeepAliveConfirmation()
          Implemented to provide the means by which keepalive confirmations are sent across the comm channel.
 void sendKeepAliveRequest()
          Implemented to provide the means by which keepalive requests are sent across the comm channel.
 void sendUpdates()
          Periodically called to send data in the queue from the server to the client
 void setDataStore(DataStore dataStore)
          Sets the associated DataStore
 void updateAppendFile(String path, byte[] bytes, int size, boolean binary)
          Appends bytes to the specified file on the client.
 void updateAppendFile(String path, byte[] bytes, int size, boolean binary, String byteStreamHandlerId)
          Appends bytes to the specified file on the client.
 void updateClassInstance(IRemoteClassInstance runnable, String deserializebyteStreamHandlerId)
          Impleted to provide the means by which a class on the host is updated on the client
 void updateFile(String path, byte[] bytes, int size, boolean binary)
          Sends bytes to the specified file on the client.
 void updateFile(String path, byte[] bytes, int size, boolean binary, String byteStreamHandlerId)
          Sends bytes to the specified file on the client.
 void waitForInput()
          Causes the current thread to wait until this class request has been fulfilled.
 
Methods inherited from class org.eclipse.dstore.core.model.UpdateHandler
clean, clean, update, update, update
 
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

_classDocumentElement

protected DataElement _classDocumentElement

_keepAliveDocumentElement

protected DataElement _keepAliveDocumentElement

_confirmKeepAliveDocumentElement

protected DataElement _confirmKeepAliveDocumentElement

_pendingKeepAliveRequest

protected DataElement _pendingKeepAliveRequest

_pendingKeepAliveConfirmation

protected DataElement _pendingKeepAliveConfirmation

_fileDocumentElement

protected DataElement _fileDocumentElement

_docDocumentElement

protected DataElement _docDocumentElement

_requestClassDocumentElement

protected DataElement _requestClassDocumentElement

_serializedDocumentElement

protected DataElement _serializedDocumentElement
Constructor Detail

ServerUpdateHandler

public ServerUpdateHandler()
Constructor

Method Detail

setDataStore

public void setDataStore(DataStore dataStore)
Sets the associated DataStore

Overrides:
setDataStore in class Handler
Parameters:
dataStore -

addSender

public void addSender(Sender sender)
Add a sender to the list of senders. Normally there is only one client for the server, which requires one Sender. If there are more than one clients, then this is how senders are added.

Parameters:
sender - a sender connected to a socket

removeSender

public void removeSender(Sender sender)
Remove a sender from the list of senders.

Parameters:
sender - the sender to remove

updateFile

public void updateFile(String path,
                       byte[] bytes,
                       int size,
                       boolean binary)
Sends bytes to the specified file on the client.

Specified by:
updateFile in class UpdateHandler
Parameters:
path - the name of the file on the client
bytes - the bytes to send
size - the number of bytes to send
binary - indicates whether to send the bytes and binary or text

updateFile

public void updateFile(String path,
                       byte[] bytes,
                       int size,
                       boolean binary,
                       String byteStreamHandlerId)
Sends bytes to the specified file on the client.

Specified by:
updateFile in class UpdateHandler
Parameters:
path - the name of the file on the client
bytes - the bytes to send
size - the number of bytes to send
binary - indicates whether to send the bytes and binary or text
byteStreamHandlerId - indicates the byte stream handler to receive the bytes

updateAppendFile

public void updateAppendFile(String path,
                             byte[] bytes,
                             int size,
                             boolean binary)
Appends bytes to the specified file on the client.

Specified by:
updateAppendFile in class UpdateHandler
Parameters:
path - the name of the file on the client
bytes - the bytes to send
size - the number of bytes to send
binary - indicates whether to send the bytes and binary or text

updateAppendFile

public void updateAppendFile(String path,
                             byte[] bytes,
                             int size,
                             boolean binary,
                             String byteStreamHandlerId)
Appends bytes to the specified file on the client.

Specified by:
updateAppendFile in class UpdateHandler
Parameters:
path - the name of the file on the client
bytes - the bytes to send
size - the number of bytes to send
binary - indicates whether to send the bytes and binary or text
byteStreamHandlerId - indicates the byte stream handler to receive the bytes

handle

public void handle()
Periodically called on the handler thread to sends data updates.

Overrides:
handle in class UpdateHandler

sendUpdates

public void sendUpdates()
Periodically called to send data in the queue from the server to the client

Specified by:
sendUpdates in class UpdateHandler

removeSenderWith

public void removeSenderWith(Socket socket)
Removes the sender that is associated with the specified socket. This causes A disconnect for the client that is associated with this socket.

Parameters:
socket - the socket on which a sender communicates

requestClass

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

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

updateClassInstance

public void updateClassInstance(IRemoteClassInstance runnable,
                                String deserializebyteStreamHandlerId)
Description copied from class: UpdateHandler
Impleted to provide the means by which a class on the host is updated on the client

Specified by:
updateClassInstance in class UpdateHandler
Parameters:
runnable -
deserializebyteStreamHandlerId -

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 UpdateHandler
Parameters:
className - the name of the class to send
classByteStreamHandlerId - the name of the byte stream handler to use to receive the class

addClassToSend

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

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

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 UpdateHandler
Parameters:
className - the name of the class to send

sendKeepAliveRequest

public void sendKeepAliveRequest()
Description copied from class: UpdateHandler
Implemented to provide the means by which keepalive requests are sent across the comm channel.

Specified by:
sendKeepAliveRequest in class UpdateHandler

sendKeepAliveConfirmation

public void sendKeepAliveConfirmation()
Description copied from class: UpdateHandler
Implemented to provide the means by which keepalive confirmations are sent across the comm channel.

Specified by:
sendKeepAliveConfirmation in class UpdateHandler

waitForInput

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

Overrides:
waitForInput in class UpdateHandler

Remote System Explorer DataStore
Release 1.0

Guidelines for using DataStore APIs.