Package org.zeroturnaround.javarebel
Interface Configuration
-
public interface ConfigurationThis class manages JRebel configuration.
To manage the classes that will be instrumented use the filter methods
addExcludeManagedFilter(ClassFilter)andaddIncludeManagedFilter(ClassFilter). If you need to override the default behavior (e.g. you don't need class files to be managed) useclearManagedFilters()to disable the default filters. If you want to filter classes by packages you can usePackageClassFilter.The filter methods work as follows:
- If at least one exclude filter matches a class it will not be instrumented.
- If none of the exclude filters match a class and at least one of the include filters matches a class it will be instrumented.
For example, if you want all classes in a particular JAR to be instrumented you can use a following filter:
ConfigurationFactory.getInstance() .addIncludeManagedFilter(new ClassFilter() { public boolean matches(ClassLoader cl, String className, Resource classResource) { return classResource.toURL().getPath().contains("mylibrary.jar"); } });- Since:
- 1.2
- Author:
- Jevgeni Kabanov (ekabanov@zeroturnaround.com)
- See Also:
ConfigurationFactory,Integration,Reloader,Logger,Plugin
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddExcludeFilter(ClassLoader cl)Adds an exclude filter for the entire class loader (including plug-ins).voidaddExcludeFilter(String classLoaderClassName)Adds an exclude filter for the entire class loader (including plug-ins).voidaddExcludeFilter(ClassLoaderFilter classLoaderFilter)Adds an exclude filter for entire class loaders (including plug-ins).voidaddExcludeManagedFilter(ClassLoader cl)Adds an exclude filter for managed classes.voidaddExcludeManagedFilter(ClassFilter classFilter)Adds an exclude filter for managed classes.voidaddExcludeManagedFilter(ClassIdentityFilter classFilter)Adds an exclude filter for managed classes.voidaddIncludeManagedFilter(ClassLoader cl)Adds an include filter for managed classes.voidaddIncludeManagedFilter(ClassFilter classFilter)Adds an include filter for managed classes.voidaddIncludeManagedFilter(ClassIdentityFilter classFilter)Adds an include filter for managed classes.voidclearManagedFilters()Clears all currently used filters including the default ones.booleangetBoolean(String key)Gets the boolean value of a system property indicated by the specified key.booleangetBoolean(String key, boolean defaultValue)Gets the boolean value of a system property indicated by the specified key.intgetCheckInterval()Advisable time between checks for updates in framework specific configuration files.ResourcegetClassResource(ClassLoader cl, String classname)Returns a JRebel Resource exactly as JRebel will load it.StringgetProductName()StringgetProperty(String key)Gets the system property indicated by the specified key.booleanisClassLoaderExcluded(ClassLoader cl)Returns whether the filters will deny the given class loader.booleanisManagedClass(ClassLoader cl, String classname, Resource cr)Returns whether the filters will allow the given class to be managed.booleanisManagedClassExcluded(ClassLoader cl, String classname)Returns whether the filters will deny the given class to be managed.booleanisPluginEnabled(String id)Checks whether the given plugin is enabled.
-
-
-
Method Detail
-
getProperty
String getProperty(String key)
Gets the system property indicated by the specified key. If no system property is found with that key a property from file namedjrebel.propertiesis returned.- Parameters:
key- the name of the system property.- Returns:
- the string value of the property,
or
nullif there is no property with that key.
-
getBoolean
boolean getBoolean(String key)
Gets the boolean value of a system property indicated by the specified key. If no system property is found with that key a property from file namedjrebel.propertiesis returned.- Parameters:
key- the name of the system property.- Returns:
- the boolean value of the property,
falseif there is no property with that key.
-
getBoolean
boolean getBoolean(String key, boolean defaultValue)
Gets the boolean value of a system property indicated by the specified key. If no system property is found with that key a property from file namedjrebel.propertiesis returned.- Parameters:
key- the name of the system property.defaultValue- value to return if there is no property with that key- Returns:
- the boolean value of the property or
defaultValue.
-
getCheckInterval
int getCheckInterval()
Advisable time between checks for updates in framework specific configuration files.- Returns:
- time in ms.
-
getProductName
String getProductName()
- Returns:
- product name (JRebel).
-
isPluginEnabled
boolean isPluginEnabled(String id)
Checks whether the given plugin is enabled.- Parameters:
id- plugin id (seePlugin.getId()).- Returns:
trueif the given plugin is enabled.
-
clearManagedFilters
void clearManagedFilters()
Clears all currently used filters including the default ones. Use it if you need to override the default behavior (e.g. you don't need class files to be managed).
-
addExcludeFilter
void addExcludeFilter(ClassLoader cl)
Adds an exclude filter for the entire class loader (including plug-ins).
-
addExcludeFilter
void addExcludeFilter(String classLoaderClassName)
Adds an exclude filter for the entire class loader (including plug-ins).
-
addExcludeFilter
void addExcludeFilter(ClassLoaderFilter classLoaderFilter)
Adds an exclude filter for entire class loaders (including plug-ins).
-
isClassLoaderExcluded
boolean isClassLoaderExcluded(ClassLoader cl)
Returns whether the filters will deny the given class loader.
-
addIncludeManagedFilter
void addIncludeManagedFilter(ClassLoader cl)
Adds an include filter for managed classes.
-
addExcludeManagedFilter
void addExcludeManagedFilter(ClassLoader cl)
Adds an exclude filter for managed classes.
-
addIncludeManagedFilter
void addIncludeManagedFilter(ClassIdentityFilter classFilter)
Adds an include filter for managed classes.
-
addExcludeManagedFilter
void addExcludeManagedFilter(ClassIdentityFilter classFilter)
Adds an exclude filter for managed classes.
-
addIncludeManagedFilter
void addIncludeManagedFilter(ClassFilter classFilter)
Adds an include filter for managed classes. If none of the exclude filters match a class and at least one of the include filters matches a class it will be instrumented by JRebel.
-
addExcludeManagedFilter
void addExcludeManagedFilter(ClassFilter classFilter)
Adds an exclude filter for managed classes. If at least one exclude filter matches a class it will not be instrumented by JRebel.
-
isManagedClass
boolean isManagedClass(ClassLoader cl, String classname, Resource cr)
Returns whether the filters will allow the given class to be managed. This involves bothClassFilterandClassIdentityFilterrules.
-
isManagedClassExcluded
boolean isManagedClassExcluded(ClassLoader cl, String classname)
Returns whether the filters will deny the given class to be managed. This involves onlyClassIdentityFilterrules.
-
getClassResource
Resource getClassResource(ClassLoader cl, String classname)
Returns a JRebel Resource exactly as JRebel will load it. E.g. if the resource is in the monitored directory it will return that. Note that this already includes managed filtering, that is ifisManagedClass(ClassLoader, String, Resource)returns false then this method will return null.
-
-