net.sf.sdedit.server
Class DiagramServer

java.lang.Object
  extended by java.lang.Thread
      extended by net.sf.sdedit.server.DiagramServer
All Implemented Interfaces:
Runnable

public class DiagramServer
extends Thread

This class implements a simple server that uses a TCP socket to receive a diagram source text and to send an image of the resulting diagram.

The exchange must follow this simple protocol:

  1. The client sends the mimetype of the image he would like to receive.
  2. The client sends the diagram source text.
  3. The client sends 'END'
There are currently two mime-types supported:
  1. image/png
  2. image/svg+xml (requires the SVG plugin)

Author:
Markus Strauch

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DiagramServer(int port)
          Creates and starts a new DiagramServer listening at the given port.
 
Method Summary
 void run()
          Blocks until a connection is made, then creates a socket for the connection and blocks again, waiting for the next connection.
 
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
 

Constructor Detail

DiagramServer

public DiagramServer(int port)
              throws IOException
Creates and starts a new DiagramServer listening at the given port.

Parameters:
port - the TCP port where the diagram server listens
Throws:
IOException - if no DiagramServer listening at that port could be created
Method Detail

run

public void run()
Blocks until a connection is made, then creates a socket for the connection and blocks again, waiting for the next connection.

Specified by:
run in interface Runnable
Overrides:
run in class Thread


Copyright © 2011. All Rights Reserved.