visad.data
Class SocketDataSource

java.lang.Object
  extended by visad.data.LinkedDataSource
      extended by visad.data.SocketDataSource

public class SocketDataSource
extends LinkedDataSource

A class for linking a socket stream to a DataReference. Whenever the source data changes, the source presumably sends the change through the linked socket, and the DataReference is set to point at the new data.


Field Summary
protected  Runnable comm
          Code for monitoring socket for incoming source data changes.
protected  ObjectInputStream in
          The input stream for the socket connection.
protected  ObjectOutputStream out
          The output stream for the socket connection.
protected  Socket socket
          The socket connection for this SocketDataSource.
 
Fields inherited from class visad.data.LinkedDataSource
DEBUG, name
 
Constructor Summary
SocketDataSource(String name)
          Construct a SocketDataSource with the given name.
 
Method Summary
 Socket getSocket()
          Return the socket connection for this SocketDataSource.
 void open(String id)
          Link to the given socket, updating the local data whenever an update event is sent through that socket.
 void writeObject(Object o)
          Writes the specified object out to the socket.
 
Methods inherited from class visad.data.LinkedDataSource
dataChanged, getName, getReference, isAlive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

protected Socket socket
The socket connection for this SocketDataSource.


out

protected ObjectOutputStream out
The output stream for the socket connection.


in

protected ObjectInputStream in
The input stream for the socket connection.


comm

protected Runnable comm
Code for monitoring socket for incoming source data changes.

Constructor Detail

SocketDataSource

public SocketDataSource(String name)
Construct a SocketDataSource with the given name.

Method Detail

open

public void open(String id)
          throws IOException,
                 VisADException,
                 RemoteException
Link to the given socket, updating the local data whenever an update event is sent through that socket.

Specified by:
open in class LinkedDataSource
Throws:
IOException
VisADException
RemoteException

getSocket

public Socket getSocket()
Return the socket connection for this SocketDataSource.


writeObject

public void writeObject(Object o)
Writes the specified object out to the socket.