Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.gjt.sp.jedit
Class EditServer  view EditServer download EditServer.java

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.gjt.sp.jedit.EditServer
All Implemented Interfaces:
java.lang.Runnable

public class EditServer
extends java.lang.Thread

Inter-process communication.

The edit server protocol is very simple. $HOME/.jedit/server is an ASCII file containing two lines, the first being the port number, the second being the authorization key.

You connect to that port on the local machine, sending the authorization key as four bytes in network byte order, followed by the length of the BeanShell script as two bytes in network byte order, followed by the script in UTF8 encoding. After the socked is closed, the BeanShell script will be executed by jEdit.

The snippet is executed in the AWT thread. None of the usual BeanShell variables (view, buffer, textArea, editPane) are set so the script has to figure things out by itself.

In most cases, the script will call the static handleClient(boolean,String,String[]) 55 method, but of course more complicated stuff can be done too.

Version:
$Id: EditServer.java,v 1.19 2003/05/05 23:11:47 spestov Exp $

Nested Class Summary
 
Nested classes inherited from class java.lang.Thread
java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  boolean abort
           
private  int authKey
           
private  boolean ok
           
private  java.lang.String portFile
           
private  java.net.ServerSocket socket
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
(package private) EditServer(java.lang.String portFile)
           
 
Method Summary
static Buffer handleClient(boolean restore, boolean newView, boolean newPlainView, java.lang.String parent, java.lang.String[] args)
           
static void handleClient(boolean restore, java.lang.String parent, java.lang.String[] args)
           
private  boolean handleClient(java.net.Socket client, java.io.DataInputStream in)
           
(package private)  boolean isOK()
           
 void run()
          The method of Thread that will be run if there is no Runnable object associated with the Thread.
(package private)  void stopServer()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

portFile

private java.lang.String portFile

socket

private java.net.ServerSocket socket

authKey

private int authKey

ok

private boolean ok

abort

private boolean abort
Constructor Detail

EditServer

EditServer(java.lang.String portFile)
Method Detail

run

public void run()
Description copied from class: java.lang.Thread
The method of Thread that will be run if there is no Runnable object associated with the Thread. Thread's implementation does nothing at all.


handleClient

public static void handleClient(boolean restore,
                                java.lang.String parent,
                                java.lang.String[] args)
Since:
jEdit 3.2pre7

handleClient

public static Buffer handleClient(boolean restore,
                                  boolean newView,
                                  boolean newPlainView,
                                  java.lang.String parent,
                                  java.lang.String[] args)
Since:
jEdit 4.2pre1

isOK

boolean isOK()

stopServer

void stopServer()

handleClient

private boolean handleClient(java.net.Socket client,
                             java.io.DataInputStream in)
                      throws java.lang.Exception