Class MonitoredResourceManager
- java.lang.Object
-
- org.zeroturnaround.javarebel.integration.monitor.MonitoredResourceManager
-
public class MonitoredResourceManager extends Object
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.
LocalSessionFactoryBeanCBPin the Hibernate plugin for an example usage.- Author:
- Jevgeni Kabanov, Rein Raudjärv
-
When the configuration building starts, call
-
-
Constructor Summary
Constructors Constructor Description MonitoredResourceManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidbeginConf(Object builder)When 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>getScannedDir()static Collection<org.zeroturnaround.javarebel.RebelSource>getScannedRebelSource()static Set<String>modified(Object builder)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)
-
-
-
Method Detail
-
beginConf
public static void beginConf(Object builder)
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
public static Object getConf()
-
modified
public static Set<String> modified(Object builder)
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
public static Collection<org.zeroturnaround.javarebel.RebelSource> getScannedRebelSource()
-
registerScannedDir
public static void registerScannedDir(File dir)
-
getScannedDir
public static Collection<File> getScannedDir()
-
registerConf
public static void registerConf(Class<?> klass)
-
registerConf
public static void registerConf(ClassLoader classLoader, String className)
-
registerConf
public static void registerConf(URL url)
-
registerConf
public static void registerConf(String url)
-
registerConf
public static void registerConf(ClassLoader classLoader, String className, Object builder)
-
-