Interface Configuration


public interface Configuration

This class manages JRebel configuration.

To manage the classes that will be instrumented use the filter methods addExcludeManagedFilter(ClassFilter) and addIncludeManagedFilter(ClassFilter). If you need to override the default behavior (e.g. you don't need class files to be managed) use clearManagedFilters() to disable the default filters. If you want to filter classes by packages you can use PackageClassFilter.

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:
  • Method Details

    • 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 named jrebel.properties is returned.
      Parameters:
      key - the name of the system property.
      Returns:
      the string value of the property, or null if 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 named jrebel.properties is returned.
      Parameters:
      key - the name of the system property.
      Returns:
      the boolean value of the property, false if 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 named jrebel.properties is 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 (see Plugin.getId()).
      Returns:
      true if 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 both ClassFilter and ClassIdentityFilter rules.
    • isManagedClassExcluded

      boolean isManagedClassExcluded(ClassLoader cl, String classname)
      Returns whether the filters will deny the given class to be managed. This involves only ClassIdentityFilter rules.
    • 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 if isManagedClass(ClassLoader, String, Resource) returns false then this method will return null.