org.rosuda.javaGD
Class XGDserver

java.lang.Object
  extended by java.lang.Thread
      extended by org.rosuda.javaGD.XGDserver
All Implemented Interfaces:
java.lang.Runnable

public class XGDserver
extends java.lang.Thread

XGDserver is a sample implementation of a server understanding the XGD1 protocol using GDCanvas for drawing. It is meant rather as a template for projects that wish to use R graphics device remotely via the xGD package. The main customization for other projects can be done for Open (1) and Close (2) commands.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static byte CMD_Activate
           
static byte CMD_Circle
           
static byte CMD_Clip
           
static byte CMD_Close
           
static byte CMD_Deactivate
           
static byte CMD_GetSize
           
static byte CMD_Hold
           
static byte CMD_Line
           
static byte CMD_Locator
           
static byte CMD_MetricInfo
           
static byte CMD_Mode
           
static byte CMD_NewPage
           
static byte CMD_Open
           
static byte CMD_Polygon
           
static byte CMD_Polyline
           
static byte CMD_Rect
           
static byte CMD_SetColor
           
static byte CMD_SetFill
           
static byte CMD_SetFont
           
static byte CMD_SetLinePar
           
static byte CMD_StrWidth
           
static byte CMD_Text
           
static int XGD_Port
          default TCP port used by XGD
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
XGDserver()
          start a new XGD server on the default port
XGDserver(int port)
          start a new XGD server on a specific port
 
Method Summary
static void main(java.lang.String[] args)
          main method - calls startServer()
 void run()
          main server method listening on port 1427 and serving clients.
static XGDserver startServer()
          starts a new XGD server.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XGD_Port

public static final int XGD_Port
default TCP port used by XGD

See Also:
Constant Field Values

CMD_Open

public static final byte CMD_Open
See Also:
Constant Field Values

CMD_Close

public static final byte CMD_Close
See Also:
Constant Field Values

CMD_Activate

public static final byte CMD_Activate
See Also:
Constant Field Values

CMD_Deactivate

public static final byte CMD_Deactivate
See Also:
Constant Field Values

CMD_Circle

public static final byte CMD_Circle
See Also:
Constant Field Values

CMD_Clip

public static final byte CMD_Clip
See Also:
Constant Field Values

CMD_Hold

public static final byte CMD_Hold
See Also:
Constant Field Values

CMD_Locator

public static final byte CMD_Locator
See Also:
Constant Field Values

CMD_Line

public static final byte CMD_Line
See Also:
Constant Field Values

CMD_MetricInfo

public static final byte CMD_MetricInfo
See Also:
Constant Field Values

CMD_Mode

public static final byte CMD_Mode
See Also:
Constant Field Values

CMD_NewPage

public static final byte CMD_NewPage
See Also:
Constant Field Values

CMD_Polygon

public static final byte CMD_Polygon
See Also:
Constant Field Values

CMD_Polyline

public static final byte CMD_Polyline
See Also:
Constant Field Values

CMD_Rect

public static final byte CMD_Rect
See Also:
Constant Field Values

CMD_GetSize

public static final byte CMD_GetSize
See Also:
Constant Field Values

CMD_StrWidth

public static final byte CMD_StrWidth
See Also:
Constant Field Values

CMD_Text

public static final byte CMD_Text
See Also:
Constant Field Values

CMD_SetColor

public static final byte CMD_SetColor
See Also:
Constant Field Values

CMD_SetFill

public static final byte CMD_SetFill
See Also:
Constant Field Values

CMD_SetFont

public static final byte CMD_SetFont
See Also:
Constant Field Values

CMD_SetLinePar

public static final byte CMD_SetLinePar
See Also:
Constant Field Values
Constructor Detail

XGDserver

public XGDserver(int port)
start a new XGD server on a specific port

Parameters:
port - TCP port to listen on

XGDserver

public XGDserver()
start a new XGD server on the default port

Method Detail

run

public void run()
main server method listening on port 1427 and serving clients. It dispatches new worker threads for each accepted connection.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

startServer

public static XGDserver startServer()
starts a new XGD server. Note that there can only be one active server at the time unless the TCP port number is changed.

Returns:
new XGD server instance

main

public static void main(java.lang.String[] args)
main method - calls startServer()

Parameters:
args - command line arguments (currently ignored)