Remote System Explorer DataStore
Release 3.0

org.eclipse.dstore.core.model
Class UpdateHandler

java.lang.Object
  extended by java.lang.Thread
      extended by org.eclipse.dstore.core.server.SecuredThread
          extended by org.eclipse.dstore.core.model.Handler
              extended by org.eclipse.dstore.core.model.UpdateHandler
All Implemented Interfaces:
Runnable

public abstract class UpdateHandler
extends Handler

Abstract class for handling updates. A UpdateHandler is a Handler that contains a queue of data responses to be sent to the client. Each DataStore instance uses a single update handler that periodically sends it's data queue either to a client or directly to a domain listener on the client.

The UpdateHandler is the means by which the DataStore sends information or files from the remote tools to the client.


Field Summary
protected  ArrayList _classesToSend
           
protected  ArrayList _dataObjects
           
 
Fields inherited from class org.eclipse.dstore.core.model.Handler
_keepRunning, _waitIncrement
 
Fields inherited from class org.eclipse.dstore.core.server.SecuredThread
_dataStore
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
UpdateHandler()
          Constructor
 
Method Summary
protected  void clean(DataElement object)
           
protected  void clean(DataElement object, int depth)
           
protected  void cleanChildren(DataElement parent)
          Recursively clean children for deletion
 void handle()
          Periodically called on the handler thread to sends data updates.
abstract  void requestClass(String className)
          Implemented to provide the means by which classes are requested across the comm channel.
abstract  void sendClass(String className)
          Implemented to provide the means by which classes are sent across the comm channel.
abstract  void sendClass(String className, String classByteStreamHandlerId)
          Implemented to provide the means by which classes are sent across the comm channel.
abstract  void sendKeepAliveConfirmation()
          Implemented to provide the means by which keepalive confirmations are sent across the comm channel.
abstract  void sendKeepAliveRequest()
          Implemented to provide the means by which keepalive requests are sent across the comm channel.
abstract  void sendUpdates()
          Implemented to provide the means by which updates on the queue are sent.
 void update(ArrayList objects)
          Adds a set of data objects to the update queue
 void update(DataElement object)
          Adds an object to the update queue
 void update(DataElement object, boolean immediate)
          Adds an object to the update queue
abstract  void updateAppendFile(String path, byte[] bytes, int size, boolean binary)
          Implemented to provide the means by which files are sent and appended
abstract  void updateAppendFile(String path, byte[] bytes, int size, boolean binary, String byteStreamHandlerId)
          Implemented to provide the means by which files are sent and appended
abstract  void updateClassInstance(IRemoteClassInstance runnable, String deserializebyteStreamHandlerId)
          Impleted to provide the means by which a class on the host is updated on the client
abstract  void updateFile(String path, byte[] bytes, int size, boolean binary)
          Implemented to provide the means by which files are sent
abstract  void updateFile(String path, byte[] bytes, int size, boolean binary, String byteStreamHandlerId)
          Implemented to provide the means by which files are sent
 void waitForInput()
          Causes the current thread to wait until this class request has been fulfilled.
 
Methods inherited from class org.eclipse.dstore.core.model.Handler
finish, getWaitTime, isFinished, notifyInput, run, setDataStore, 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

_dataObjects

protected ArrayList _dataObjects

_classesToSend

protected ArrayList _classesToSend
Constructor Detail

UpdateHandler

public UpdateHandler()
Constructor

Method Detail

handle

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

Specified by:
handle in class Handler

clean

protected void clean(DataElement object)

clean

protected void clean(DataElement object,
                     int depth)

cleanChildren

protected void cleanChildren(DataElement parent)
Recursively clean children for deletion

Parameters:
parent -

update

public void update(ArrayList objects)
Adds a set of data objects to the update queue

Parameters:
objects - a set of objects to get updated

update

public void update(DataElement object)
Adds an object to the update queue

Parameters:
object - an object to get updated

update

public void update(DataElement object,
                   boolean immediate)
Adds an object to the update queue

Parameters:
object - an object to get updated
immediate - true indicates that this object should be first in the queue

waitForInput

public void waitForInput()
Causes the current thread to wait until this class request has been fulfilled.

Overrides:
waitForInput in class Handler

sendUpdates

public abstract void sendUpdates()
Implemented to provide the means by which updates on the queue are sent.


updateFile

public abstract void updateFile(String path,
                                byte[] bytes,
                                int size,
                                boolean binary)
Implemented to provide the means by which files are sent

Parameters:
path - the path of the file to send
bytes - the bytes to send
size - the number of bytes to send
binary - indicates whether to send the bytes as binary or text

updateAppendFile

public abstract void updateAppendFile(String path,
                                      byte[] bytes,
                                      int size,
                                      boolean binary)
Implemented to provide the means by which files are sent and appended

Parameters:
path - the path of the file to send
bytes - the bytes to send
size - the number of bytes to send
binary - indicates whether to send the bytes as binary or text

updateFile

public abstract void updateFile(String path,
                                byte[] bytes,
                                int size,
                                boolean binary,
                                String byteStreamHandlerId)
Implemented to provide the means by which files are sent

Parameters:
path - the path of the file to send
bytes - the bytes to send
size - the number of bytes to send
binary - indicates whether to send the bytes as binary or text
byteStreamHandlerId - indicates the byte stream handler to receive the bytes

updateAppendFile

public abstract void updateAppendFile(String path,
                                      byte[] bytes,
                                      int size,
                                      boolean binary,
                                      String byteStreamHandlerId)
Implemented to provide the means by which files are sent and appended

Parameters:
path - the path of the file to send
bytes - the bytes to send
size - the number of bytes to send
binary - indicates whether to send the bytes as binary or text
byteStreamHandlerId - indicates the byte stream handler to receive the bytes

requestClass

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

Parameters:
className - the name of the class to request

sendKeepAliveRequest

public abstract void sendKeepAliveRequest()
Implemented to provide the means by which keepalive requests are sent across the comm channel.


updateClassInstance

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

Parameters:
runnable -
deserializebyteStreamHandlerId -

sendClass

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

Parameters:
className - the name of the class to send

sendClass

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

Parameters:
className - the name of the class to send
classByteStreamHandlerId - indicates which class byte stream handler to receive the class with

sendKeepAliveConfirmation

public abstract void sendKeepAliveConfirmation()
Implemented to provide the means by which keepalive confirmations are sent across the comm channel.


Remote System Explorer DataStore
Release 3.0

Guidelines for using DataStore APIs.