GigaSpaces XAP 9.7.2 API

org.openspaces.core.bean
Interface Bean

All Known Subinterfaces:
ScaleStrategyBean
All Known Implementing Classes:
AbstractCapacityScaleStrategyBean, AbstractScaleStrategyBean, AutomaticCapacityScaleStrategyBean, DiscoveredMachineProvisioningBean, EagerScaleStrategyBean, ElasticConfigBean, ManualCapacityPerZonesScaleStrategyBean, ManualCapacityScaleStrategyBean, UndeployScaleStrategyBean

public interface Bean

A simple bean construct with resemblance to a Spring bean (interfaces InitializingBean, DisposableBean).

The administrative Bean is configured by either a strongly typed API (see BeanConfig), or by a weakly typed String key-value pair property API (see BeanConfigPropertiesManager). These properties are supplied upon the bean's construction (see setProperties(Map)).

A request to set a bean's configuration (see BeanConfigManager.setBeanConfig(BeanConfig) ), will store the configuration properties at the server until the bean is enabled (or removed).

A request to enable a bean (see BeanConfigManager.enableBean(Class)), will be accepted by the bean factory - which initializes the bean, sets the properties and invokes a call to afterPropertiesSet().

A request to disable a bean (see BeanConfigManager.disableBean(Class)), will destroy the bean (destroy()). The configuration properties will remain at the server until the bean is completely removed (see BeanConfigManager.removeBeanConfig(Class)).

A request to set a bean with different properties (see BeanConfigManager.setBeanConfig(BeanConfig)), will destroy the bean if it is already enabled, and re-enable it with the new configuration properties. If the bean wasn't enabled, the properties are stored at the server until the bean is enabled (or removed).

Since:
8.0
Author:
Moran Avigdor, Itai Frenkel

Method Summary
 void afterPropertiesSet()
          Invoked by a bean factory after it has set all bean properties.
 void destroy()
          Invoked by a bean factory on destruction of a singleton.
 Map<String,String> getProperties()
           
 void setAdmin(Admin admin)
          Set the Admin instance to be used by this Bean.
 void setProperties(Map<String,String> properties)
          The bean properties supplied using a client side bean configuration object, or by plain String key-value pairs.
 

Method Detail

setAdmin

void setAdmin(Admin admin)
Set the Admin instance to be used by this Bean.

Parameters:
admin - an Admin instance.

setProperties

void setProperties(Map<String,String> properties)
The bean properties supplied using a client side bean configuration object, or by plain String key-value pairs.

Parameters:
properties - properties to configure this bean.

getProperties

Map<String,String> getProperties()
Returns:
properties used to configure this bean.

afterPropertiesSet

void afterPropertiesSet()
                        throws Exception
Invoked by a bean factory after it has set all bean properties. This method allows the bean instance to perform non-blocking initialization, which is only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

Throws:
Exception - in the event of misconfiguration (such as failure to set an essential property) or if initialization fails.
See Also:
BeanConfigurationException, BeanInitializationException

destroy

void destroy()
             throws Exception
Invoked by a bean factory on destruction of a singleton.

Throws:
Exception - in case of shutdown errors. Exceptions will get logged but not re-thrown to allow other beans to release their resources too.
See Also:
BeanConfigException

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.