org.zeroturnaround.javarebel
Interface Plugin


public interface Plugin

Represents a JavaRebel plugin that can be used by a third-party to configure or integrate with JavaRebel. Will be called before the first class is loaded in the host classloader. There are two ways to register a JavaRebel plugin. One is by creating a JAR file with a custom manifest entry MANIFEST_ATTRIBUTE_PLUGIN and putting it in the classpath. The other is by setting a system property SYSPROP_PLUGIN to the plugin class.

Since:
1.2
Author:
Jevgeni Kabanov (ekabanov@zeroturnaround.com)
See Also:
Integration, Configuration, Reloader, Logger

Field Summary
static java.lang.String MANIFEST_ATTRIBUTE_PLUGIN
          This JAR MANIFEST.MF attribute should point to a class name that implements this interface.
static java.lang.String SYSPROP_PLUGIN
          This system property should point to a class name that implements this interface.
static java.lang.String SYSPROP_PLUGINS
          This system property should point to comma-separated list of 2.0 plugin jars that implement the checkDependencies(ClassLoader, ClassResourceSource) method.
 
Method Summary
 boolean checkDependencies(java.lang.ClassLoader cl, ClassResourceSource crs)
          This method is necessary to embed the plugin into JavaRebel distribution, it is not necessary for the plugins in the classpath.
 java.lang.String getAuthor()
          The name of the person/entity that contributed the plugin.
 java.lang.String getDescription()
          Description of the plugin, a few lines about purpose and functionality of the plugin.
 java.lang.String getId()
          A Unix-like id, e.g.
 java.lang.String getName()
          Name of the plugin, optionally with a version, e.g.
 java.lang.String getWebsite()
          The URL to the website with information about the plugin.
 void preinit()
          Called before the first class in the host classloader is loaded.
 

Field Detail

SYSPROP_PLUGIN

static final java.lang.String SYSPROP_PLUGIN
This system property should point to a class name that implements this interface. It can be used by applications to enable additional JavaRebel configuration.
For example -Drebel.plugin=com.mycompany.mypackage.MyJavaRebelPlugin.

See Also:
Constant Field Values

MANIFEST_ATTRIBUTE_PLUGIN

static final java.lang.String MANIFEST_ATTRIBUTE_PLUGIN
This JAR MANIFEST.MF attribute should point to a class name that implements this interface. It can be used by third-party libraries to enable additional JavaRebel configuration or integration and also to create standalone JavaRebel plugin JARs.

See Also:
Constant Field Values

SYSPROP_PLUGINS

static final java.lang.String SYSPROP_PLUGINS
This system property should point to comma-separated list of 2.0 plugin jars that implement the checkDependencies(ClassLoader, ClassResourceSource) method.
For example -Drebel.plugins=/path/to/plugin1.jar,/path/to/plugin2.jar.

Since:
2.0
See Also:
Constant Field Values
Method Detail

preinit

void preinit()
Called before the first class in the host classloader is loaded.


checkDependencies

boolean checkDependencies(java.lang.ClassLoader cl,
                          ClassResourceSource crs)
This method is necessary to embed the plugin into JavaRebel distribution, it is not necessary for the plugins in the classpath. It should check that the plugin dependencies are present in the tested classloader. Please don't try to load classes as this will cause them to be loaded and your postprocessing won't take place. Instead use ClassResourceSource.getClassResource(String) to test for class presense, e.g. return crs.getClassResourceSource("org.myframework.MyClass") != null;. To test whether the implementation is correct add your plugin jar to -Drebel.plugins and remove it from the classpath. If your plugin is found it will be initialized by JavaRebel in correct classloader.

Since:
2.0

getId

java.lang.String getId()
A Unix-like id, e.g. "spring_plugin". Mainly used for internal handling and creating the system property. Cannot be null for embedded plugins!

Since:
2.0

getName

java.lang.String getName()
Name of the plugin, optionally with a version, e.g. "Spring Framework Plugin 1.0 M4". Can be null if you don't want the plugin to be visible to the user.

Since:
2.0

getDescription

java.lang.String getDescription()
Description of the plugin, a few lines about purpose and functionality of the plugin. Can be null if you don't want the plugin to be visible to the user.

Since:
2.0

getAuthor

java.lang.String getAuthor()
The name of the person/entity that contributed the plugin. Please include contact e-mail if possible. Can be null if you don't want the plugin to be visible to the user.

Since:
2.0

getWebsite

java.lang.String getWebsite()
The URL to the website with information about the plugin. Can be null if you don't want the plugin to be visible to the user.

Since:
2.0


Copyright © 2009. All Rights Reserved.