com.kedwards.swt.exp
Class ClassExporter

java.lang.Object
  |
  +--com.kedwards.swt.exp.ClassExporter
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
ContextClassExporter

public abstract class ClassExporter
extends java.lang.Object
implements java.lang.Runnable

ClassExporter.java

An abstract class to serve bytecodes; concrete subclasses determine where the bytecodes come from.

See http://www.kedwards.com/jini

No warranty expressed or implied; use at your own risk; for educational purposes only.

Author:
Keith Edwards

Field Summary
static ClassExporter exporter
          Some test harness code.
 
Constructor Summary
ClassExporter()
          Construct a new class exporter, using any port.
ClassExporter(int port)
          Construct a new class exporter on the specified port.
 
Method Summary
 void establishCodebase()
          This adds the codebase for this exporter to the list of codebases stored under the java.rmi.server.codebase property.
abstract  byte[] getByteCodes(java.lang.String path)
          Subclasses implement this method to implement whatever semantics they want for fetching the bytecodes of exported classes.
 java.lang.String getCodebase()
          Return the codebase URL that identifies this exporter.
 void run()
          Services a socket returned by the server socket
 void shutdown()
          Shuts down the server socket.
static void testHarness()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

exporter

public static ClassExporter exporter
Some test harness code. Subclass main() testers can set the exporter and then call testHarness().
Constructor Detail

ClassExporter

public ClassExporter()
              throws java.io.IOException
Construct a new class exporter, using any port.

ClassExporter

public ClassExporter(int port)
              throws java.io.IOException,
                     java.net.UnknownHostException
Construct a new class exporter on the specified port.
Parameters:
port - The port on which to run the exporter. Passing 0 here indicates that a "random" available port should be used.
Method Detail

getCodebase

public java.lang.String getCodebase()
                             throws java.net.UnknownHostException
Return the codebase URL that identifies this exporter.

establishCodebase

public void establishCodebase()
                       throws java.net.UnknownHostException
This adds the codebase for this exporter to the list of codebases stored under the java.rmi.server.codebase property. It will not remove any preexisting codebases.

shutdown

public void shutdown()
Shuts down the server socket. This is done in a separate thread, as it may take a while...

run

public void run()
Services a socket returned by the server socket
Specified by:
run in interface java.lang.Runnable

getByteCodes

public abstract byte[] getByteCodes(java.lang.String path)
                             throws java.lang.ClassNotFoundException
Subclasses implement this method to implement whatever semantics they want for fetching the bytecodes of exported classes.

testHarness

public static void testHarness()