ElVis Java Interface

sv.graph
Class DataSource

java.lang.Object
  extended bysv.graph.DataSource

public class DataSource
extends java.lang.Object

An application that provides data for display must register with ElVis. The application only sends data to one copy of the program. The application does not know about any of the collaborators. The collaboration server will forward the data to collaborating programs. ElVis has a window where the user selects which data sources to receive.


Field Summary
static int DEFAULT_PORT
           
 
Constructor Summary
DataSource()
           
DataSource(java.lang.String sourceName, java.lang.String inUser, java.lang.String inID)
          Define the application that will send data to ElVis.
 
Method Summary
 boolean appendFile(java.lang.String filename)
          Append to a GraphWindow file.
 boolean closeFile()
          Close the currently open GraphWindow file.
 boolean closeFile(boolean poll)
          Close the currently open GraphWindow file and specify client polling.
 void closeWindows()
          Close all the GraphWindows being displayed.
 boolean createFile(java.lang.String filename)
          Create a GraphWindow file.
 void exit()
           
 boolean match(ElVisSource source)
           
 boolean matchExact(ElVisSource source)
           
 void read(java.io.DataInputStream in)
           
 boolean register()
          Register the application with ElVis on the local computer and the default port.
 boolean register(java.lang.String name, java.lang.String port)
          Register the application with ElVis.
 void sendData(java.lang.String host, int port, byte[] b)
           
 void write(GraphWindow gw)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values
Constructor Detail

DataSource

public DataSource()

DataSource

public DataSource(java.lang.String sourceName,
                  java.lang.String inUser,
                  java.lang.String inID)
Define the application that will send data to ElVis.

Parameters:
sourceName - - The name of the application.
inUser - - The name of user running the application.
inID - - A text string for identifying an aspect or password of the run of the application.
Method Detail

register

public boolean register()
Register the application with ElVis on the local computer and the default port. Use the Java system property elvis.host as the computer running ElVis. If elvis.host is not defined then use the local computer. Use the Java system property elvis.port. If elvis.port is not defined then use the default port.


register

public boolean register(java.lang.String name,
                        java.lang.String port)
Register the application with ElVis.

Parameters:
name - - The name of the computer running ElVis. If name is null then use the Java system property elvis.host as the computer running ElVis. If elvis.host is not defined then use the local computer.
port - - The "well-known" port number reserved for connecting to ElVis. If port is null then use the Java system property elvis.port. If elvis.port is not defined then use the default port.

sendData

public void sendData(java.lang.String host,
                     int port,
                     byte[] b)

closeWindows

public void closeWindows()
Close all the GraphWindows being displayed.


write

public void write(GraphWindow gw)

createFile

public boolean createFile(java.lang.String filename)
Create a GraphWindow file. Used for data monitoring. Only 1 GraphWindow file is open at a time. This enables writing GraphWindows to a file instead of sending them to an ElVis display program. Create this DataSource. Then bracket all the calls to ElVis methods between calls to createFile and closeFile. For example:
                DataSource dataSource = new DataSource();
                boolean gwStatus = dataSource.createFile("sample.gw");

                boolean status = dataSource.register();

                drawGraph();	// calls to ElVis methods to create graphs.

                dataSource.closeFile();
 

Parameters:
filename - - The name of the file to create.

appendFile

public boolean appendFile(java.lang.String filename)
Append to a GraphWindow file. Used for data monitoring.

Parameters:
filename - - The name of the file to append.

closeFile

public boolean closeFile()
Close the currently open GraphWindow file.


closeFile

public boolean closeFile(boolean poll)
Close the currently open GraphWindow file and specify client polling.


read

public void read(java.io.DataInputStream in)

exit

public void exit()

match

public boolean match(ElVisSource source)

matchExact

public boolean matchExact(ElVisSource source)

ElVis Java Interface