com.kedwards.swt.exp
Class ContextClassExporter

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

public class ContextClassExporter
extends ClassExporter

ContextClassExporter.java

This is a ClassExporter that exports any classes found in the context of the specified class loader. You can create your own classloader that will find the classes that will be exported, or--in its simplest use--don't specify *any* class loader. This will cause the ContextClassExporter to use the current context class loader.

WARNING: using the current context class loader will allow clients to download *any* class accessible on the classpath of your application. For debugging this is fine, but if you're concerned about revealing details of your implementation, then this may not be a good idea.

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

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

Author:
Keith Edwards

Fields inherited from class com.kedwards.swt.exp.ClassExporter
exporter
 
Constructor Summary
ContextClassExporter()
           
ContextClassExporter(java.lang.ClassLoader loader)
           
ContextClassExporter(int port, java.lang.ClassLoader loader)
           
 
Method Summary
 byte[] getByteCodes(java.lang.String classname)
          Subclasses implement this method to implement whatever semantics they want for fetching the bytecodes of exported classes.
static void main(java.lang.String[] args)
           
protected  void setClassLoader(java.lang.ClassLoader loader)
          Primarily used only by FSClassExporter, to set the loader after initialization time.
 
Methods inherited from class com.kedwards.swt.exp.ClassExporter
establishCodebase, getCodebase, run, shutdown, testHarness
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextClassExporter

public ContextClassExporter()
                     throws java.net.UnknownHostException,
                            java.io.IOException

ContextClassExporter

public ContextClassExporter(java.lang.ClassLoader loader)
                     throws java.net.UnknownHostException,
                            java.io.IOException

ContextClassExporter

public ContextClassExporter(int port,
                            java.lang.ClassLoader loader)
                     throws java.net.UnknownHostException,
                            java.io.IOException
Method Detail

setClassLoader

protected void setClassLoader(java.lang.ClassLoader loader)
Primarily used only by FSClassExporter, to set the loader after initialization time.

getByteCodes

public byte[] getByteCodes(java.lang.String classname)
                    throws java.lang.ClassNotFoundException
Description copied from class: ClassExporter
Subclasses implement this method to implement whatever semantics they want for fetching the bytecodes of exported classes.
Overrides:
getByteCodes in class ClassExporter

main

public static void main(java.lang.String[] args)