Class MonitoredResourceManager
java.lang.Object
org.zeroturnaround.javarebel.integration.monitor.MonitoredResourceManager
This is a helper class that makes it easier to record and reproduce a complicated
configuration building process. It keeps track of resources that should trigger the
rebuilding of the configuration when updated.
The usage pattern follows those steps:
-
When the configuration building starts, call
beginConf(builder), providing the instance responsible for building the configuration as an argument. -
During the building process, call
registerConffor all the underlying configuration resources that you want to be monitored. (For example, if you are building a Hibernate'sSessionFactorywithAnnotationConfiguration, you'll be callingregisterConf(klass)for all classes containing JPA annotations). -
When the configuration building is done, call
endConf.
LocalSessionFactoryBeanCBP
in the Hibernate plugin for an example usage.- Author:
- Jevgeni Kabanov, Rein Raudjärv
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidWhen starting to build a configuration, the object that is doing the building has to be set here.static booleanconfRegistered(String url, Object builder) Find the MonitoredResourceManager instance that corresponds to that builder.static voidendConf()When the building of the configuration is done, be sure to callendConf()for safety.static ObjectgetConf()static Collection<File>static Collection<org.zeroturnaround.javarebel.RebelSource>Find the MonitoredResourceManager instance that corresponds to that builder.static voidregisterConf(Class<?> klass) static voidregisterConf(Class<?> klass, Object builder) static voidregisterConf(ClassLoader classLoader, String className) static voidregisterConf(ClassLoader classLoader, String className, Object builder) static voidregisterConf(String url) static voidregisterConf(String url, Object builder) static voidregisterConf(URL url) static voidregisterConf(URL url, Object builder) static voidregisterScannedDir(File dir) static voidregisterScannedRebelSource(org.zeroturnaround.javarebel.RebelSource rs)
-
Constructor Details
-
MonitoredResourceManager
public MonitoredResourceManager()
-
-
Method Details
-
beginConf
When starting to build a configuration, the object that is doing the building has to be set here. -
endConf
public static void endConf()When the building of the configuration is done, be sure to callendConf()for safety. -
getConf
-
modified
Find the MonitoredResourceManager instance that corresponds to that builder. Check for modifications to resources registered to that instance.- Returns:
- a set of modified resources
-
registerScannedRebelSource
public static void registerScannedRebelSource(org.zeroturnaround.javarebel.RebelSource rs) -
getScannedRebelSource
-
registerScannedDir
-
getScannedDir
-
registerConf
-
registerConf
-
registerConf
-
registerConf
-
registerConf
-
registerConf
-
registerConf
-
registerConf
-
confRegistered
Find the MonitoredResourceManager instance that corresponds to that builder. Checks if the url has already been registered to that instance.- Returns:
- if the builder has already registered this url.
-