Package org.zeroturnaround.javarebel
Interface Plugin
public interface Plugin
Represents a JRebel plugin that can be used by a third-party
to configure or integrate with JRebel. Will be called before the
first class is loaded in the host classloader.
There are two ways to register a JRebel 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
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThis JAR MANIFEST.MF attribute should point to a class name that implements this interface.static final StringThis system property should point to a class name that implements this interface.static final StringThis system property should point to comma-separated list of 2.0 plugin jars that implement thecheckDependencies(ClassLoader, ClassResourceSource)method. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck that the plugin dependencies are present in the tested classloader.default StringThe name of the person/entity that contributed the plugin.default StringDescription of the plugin, a few lines about purpose and functionality of the plugin.getId()A Unix-like id, e.g.default StringgetName()Name of the plugin, optionally with a version, e.g.default StringThe URL to the website with information about the plugin.voidpreinit()Called before the first class in the host classloader is loaded.
-
Field Details
-
SYSPROP_PLUGIN
This system property should point to a class name that implements this interface. It can be used by applications to enable additional JRebel configuration.
For example-Drebel.plugin=com.mycompany.mypackage.MyJRebelPlugin.- See Also:
-
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 JRebel configuration or integration and also to create standalone JRebel plugin JARs.- See Also:
-
SYSPROP_PLUGINS
This system property should point to comma-separated list of 2.0 plugin jars that implement thecheckDependencies(ClassLoader, ClassResourceSource)method.
For example-Drebel.plugins=/path/to/plugin1.jar,/path/to/plugin2.jar.- Since:
- 2.0
- See Also:
-
-
Method Details
-
preinit
void preinit()Called before the first class in the host classloader is loaded. -
checkDependencies
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 useClassResourceSource.getClassResource(String)to test for class presence, e.g.return crs.getClassResourceSource("org.myframework.MyClass") != null;. To test whether the implementation is correct add your plugin jar to-Drebel.plugins. If your plugin is found it will be initialized by JRebel in correct classloader.- Parameters:
cl- the ClassLoader to be checkedcrs- the ClassResourceSource used for the ClassLoader resource lookups- Returns:
- if the plugin should be started
- Since:
- 2.0
-
getId
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!- Returns:
- the id for the plugin
- Since:
- 2.0
-
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.- Returns:
- the name for the plugin
- Since:
- 2.0
-
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. Can contain some basic XHTML, as described here: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fui%2Fforms%2Fwidgets%2FFormText.html Additionally,emanditags will use italic variant of the main font. Use these tags exactly as written here -- no upper-case, no spaces.- Returns:
- the description for the plugin
- Since:
- 2.0
-
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.- Returns:
- the author for the plugin
- Since:
- 2.0
-
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.- Returns:
- the website for the plugin
- Since:
- 2.0
-