Package org.openspaces.admin.bean
Interface BeanConfigManager<B extends BeanConfig>
- Type Parameters:
B- the bean configuration implementation class
public interface BeanConfigManager<B extends BeanConfig>
A strongly typed bean configuration manager using the strongly typed implementation of a
BeanConfig. It rides on top of the weakly typed bean configuration properties manager (see
BeanConfigPropertiesManager). Underneath this wrapper, the bean name ( BeanConfig.getBeanClassName()) and the configuration properties ( BeanConfig.getProperties()) are extracted and passed to the bean properties manager.- Since:
- 8.0
- Author:
- Moran Avigdor, Itai Frenkel
-
Method Summary
Modifier and TypeMethodDescription<T extends B>
voiddisableBean(Class<T> clazz) Disables a bean.<T extends B>
voidenableBean(Class<T> clazz) Enable a previously set bean configuration.<T extends B>
TgetBeanConfig(Class<T> clazz) Get the bean configuration represented by the specified configuration class.<T extends B>
booleanisBeanEnabled(Class<T> clazz) <T extends B>
booleanremoveBeanConfig(Class<T> clazz) Removes a bean configuration.voidsetBeanConfig(B config) Defines a configuration for the specified bean.
-
Method Details
-
setBeanConfig
Defines a configuration for the specified bean. Overrides all previously set properties for that bean. The configuration object internally holds String key-value pairs used to configure this bean.An exception is raised if the bean is enabled.
- Parameters:
config- the bean configuration- Throws:
EnabledBeanConfigCannotBeChangedException- The bean is enabled. Disable it first.
-
enableBean
<T extends B> void enableBean(Class<T> clazz) throws BeanConfigNotFoundException, BeanConfigurationException, BeanInitializationException Enable a previously set bean configuration. Creates the bean instance with the previously set bean configuration.If the bean is already enabled, the request is silently ignored.
- Type Parameters:
T- a bean configuration implementation (seeBeanConfig)- Parameters:
clazz- the class of the bean configuration- Throws:
BeanConfigNotFoundException- bean configuration cannot be found.BeanConfigurationException- in the event of misconfiguration (such as failure to set an essential property).BeanInitializationException- if bean initialization fails.
-
disableBean
Disables a bean. The bean object is discarded but it's configuration remains. The bean can be enabled at a later time.If the bean is already disabled, the request is silently ignored.
- Type Parameters:
T- a bean configuration implementation (seeBeanConfig)- Parameters:
clazz- the class of the bean configuration- Throws:
BeanConfigNotFoundException- bean configuration cannot be found.
-
isBeanEnabled
- Type Parameters:
T- a bean configuration implementation (seeBeanConfig)- Parameters:
clazz- the class of the bean configuration- Returns:
trueif the bean is enabled,falseif the bean is disabled.
-
removeBeanConfig
<T extends B> boolean removeBeanConfig(Class<T> clazz) throws EnabledBeanConfigCannotBeChangedException, BeanConfigNotFoundException Removes a bean configuration.An exception is raised if the bean is enabled.
- Type Parameters:
T- a bean configuration implementation (seeBeanConfig)- Parameters:
clazz- the class of the bean configuration- Returns:
trueif removed ,falseif it did not exist in the first place.- Throws:
EnabledBeanConfigCannotBeChangedException- The bean is enabled. Disable it first.BeanConfigNotFoundException- bean configuration cannot be found.
-
getBeanConfig
Get the bean configuration represented by the specified configuration class.- Type Parameters:
T- a bean configuration implementation (seeBeanConfig)- Parameters:
clazz- the class of the bean configuration- Returns:
- The bean configuration implementation object set with the configuration properties.
- Throws:
BeanConfigNotFoundException- bean configuration cannot be found. Need to set the configuration first.
-