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
BeanConfigPropertiesManagerAn exception is raised if the bean is enabled.
setBeanConfig in interface BeanConfigPropertiesManagerbeanClassName - 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
BeanConfigPropertiesManagerIf the bean is already disabled, the request is silently ignored.
enableBean in interface BeanConfigPropertiesManagerbeanClassName - 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
BeanConfigPropertiesManagerIf the bean is already disabled, the request is silently ignored.
disableBean in interface BeanConfigPropertiesManagerbeanClassName - the bean class nameBeanConfigNotFoundException - bean configuration cannot be found.public boolean removeBeanConfig(String beanClassName) throws BeanConfigNotFoundException
BeanConfigPropertiesManagerAn exception is raised if the bean is enabled.
removeBeanConfig in interface BeanConfigPropertiesManagerbeanClassName - 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 BeanConfigPropertiesManagerbeanClassName - the bean class nametrue if the bean is enabled, false if the bean is disabled.public Map<String,String> getBeanConfig(String beanClassName) throws BeanConfigNotFoundException
BeanConfigPropertiesManagergetBeanConfig in interface BeanConfigPropertiesManagerbeanClassName - the bean class nameBeanConfigNotFoundException - bean configuration cannot be found. Put the configuration
first.public String[] getBeansClassNames()
BeanConfigPropertiesManagergetBeansClassNames in interface BeanConfigPropertiesManagerpublic String[] getEnabledBeansClassNames()
BeanConfigPropertiesManagergetEnabledBeansClassNames in interface BeanConfigPropertiesManagerBeanConfigPropertiesManager.enableBean(String)public void disableAllBeans()
BeanConfigPropertiesManagerdisableAllBeans in interface BeanConfigPropertiesManagerBeanConfigPropertiesManager.disableBean(String)public T getEnabledBean(String beanClassName)
getEnabledBean in interface BeanServer<T extends Bean>public void disableAllBeansAssignableTo(Class<?> interfaceClass)
BeanServerdisableAllBeansAssignableTo in interface BeanServer<T extends Bean>public boolean replaceBeanAssignableTo(Class<?>[] interfaceClasses, String newBeanClassName, Map<String,String> newBeanProperties) throws BeanInitializationException
BeanServerreplaceBeanAssignableTo 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.BeanInitializationExceptionpublic 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 implementClassNotFoundExceptionpublic 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.