public class DefaultBeanServer<T extends Bean> extends Object implements BeanServer<T>
Constructor and Description |
---|
DefaultBeanServer(Admin admin) |
DefaultBeanServer(BeanFactory<T> beanFactory) |
Modifier and Type | Method and Description |
---|---|
void |
destroy() |
void |
disableAllBeans()
Disable all currently enabled beans.
|
void |
disableAllBeansAssignableTo(Class<?> interfaceClass)
Disables all beans that implement the specified interface.
|
void |
disableBean(String beanClassName)
Disables a bean.
|
void |
enableBean(String beanClassName)
Disables a bean.
|
Map<String,String> |
getBeanConfig(String beanClassName)
Get the bean configuration.
|
String[] |
getBeansClassNames()
Lists the class names of configured beans.
|
T |
getEnabledBean(String beanClassName) |
List<T> |
getEnabledBeansAssignableTo(Class<?>[] interfaceClasses) |
String[] |
getEnabledBeansClassNames()
Lists the class names of enabled beans.
|
List<String> |
getEnabledBeansClassNamesAssignableTo(Class<?>[] interfaceClasses) |
boolean |
isBeanEnabled(String beanClassName) |
boolean |
removeBeanConfig(String beanClassName)
Removes a bean configuration.
|
boolean |
replaceBeanAssignableTo(Class<?>[] interfaceClasses,
String newBeanClassName,
Map<String,String> newBeanProperties)
Assuming there is at most one enabled bean that implements one of the specified interfaces,
puts the specified configuration and enables a new bean in its place.
|
void |
setBeanConfig(String beanClassName,
Map<String,String> properties)
Defines a configuration for the specified bean.
|
public DefaultBeanServer(Admin admin)
public DefaultBeanServer(BeanFactory<T> beanFactory)
public void setBeanConfig(String beanClassName, Map<String,String> properties) throws EnabledBeanConfigCannotBeChangedException
BeanConfigPropertiesManager
An exception is raised if the bean is enabled.
setBeanConfig
in interface BeanConfigPropertiesManager
beanClassName
- the bean class nameproperties
- the String key-value pairs used to configure this bean.EnabledBeanConfigCannotBeChangedException
- The bean is enabled. Disable it first.public void enableBean(String beanClassName) throws BeanConfigNotFoundException, BeanConfigurationException, BeanInitializationException
BeanConfigPropertiesManager
If the bean is already disabled, the request is silently ignored.
enableBean
in interface BeanConfigPropertiesManager
beanClassName
- the bean class nameBeanConfigNotFoundException
- bean configuration cannot be found.BeanConfigurationException
- in the event of misconfiguration (such as failure to set
an essential property).BeanInitializationException
- if bean initialization fails.public void disableBean(String beanClassName) throws BeanConfigNotFoundException
BeanConfigPropertiesManager
If the bean is already disabled, the request is silently ignored.
disableBean
in interface BeanConfigPropertiesManager
beanClassName
- the bean class nameBeanConfigNotFoundException
- bean configuration cannot be found.public boolean removeBeanConfig(String beanClassName) throws BeanConfigNotFoundException
BeanConfigPropertiesManager
An exception is raised if the bean is enabled.
removeBeanConfig
in interface BeanConfigPropertiesManager
beanClassName
- the bean class nametrue
if removed ,false
if it did not exist in the first
place.BeanConfigNotFoundException
- bean configuration cannot be found.public boolean isBeanEnabled(String beanClassName)
isBeanEnabled
in interface BeanConfigPropertiesManager
beanClassName
- the bean class nametrue
if the bean is enabled, false
if the bean is disabled.public Map<String,String> getBeanConfig(String beanClassName) throws BeanConfigNotFoundException
BeanConfigPropertiesManager
getBeanConfig
in interface BeanConfigPropertiesManager
beanClassName
- the bean class nameBeanConfigNotFoundException
- bean configuration cannot be found. Put the configuration
first.public String[] getBeansClassNames()
BeanConfigPropertiesManager
getBeansClassNames
in interface BeanConfigPropertiesManager
public String[] getEnabledBeansClassNames()
BeanConfigPropertiesManager
getEnabledBeansClassNames
in interface BeanConfigPropertiesManager
BeanConfigPropertiesManager.enableBean(String)
public void disableAllBeans()
BeanConfigPropertiesManager
disableAllBeans
in interface BeanConfigPropertiesManager
BeanConfigPropertiesManager.disableBean(String)
public T getEnabledBean(String beanClassName)
getEnabledBean
in interface BeanServer<T extends Bean>
public void disableAllBeansAssignableTo(Class<?> interfaceClass)
BeanServer
disableAllBeansAssignableTo
in interface BeanServer<T extends Bean>
public boolean replaceBeanAssignableTo(Class<?>[] interfaceClasses, String newBeanClassName, Map<String,String> newBeanProperties) throws BeanInitializationException
BeanServer
replaceBeanAssignableTo
in interface BeanServer<T extends Bean>
interfaceClasses
- - the interface that the new and old bean need to implementnewBeanClassName
- - the class name of the beannewBeanProperties
- - the new bean configuration that is to replace the existing
specified interface implementation.BeanInitializationException
public List<String> getEnabledBeansClassNamesAssignableTo(Class<?>[] interfaceClasses) throws ClassNotFoundException
getEnabledBeansClassNamesAssignableTo
in interface BeanServer<T extends Bean>
interfaceClasses
- - the interface that the bean we are looking for needs to implementClassNotFoundException
public void destroy()
destroy
in interface BeanServer<T extends Bean>
public List<T> getEnabledBeansAssignableTo(Class<?>[] interfaceClasses)
getEnabledBeansAssignableTo
in interface BeanServer<T extends Bean>
interfaceClasses
- - the interface that the bean we are looking for needs to implementCopyright © GigaSpaces.