|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openspaces.core.space.mode.SpaceModeContextLoader
public class SpaceModeContextLoader
A Space mode based Spring context loader allows to load Spring application context if the Space
is in PRIMARY
mode.
The space mode context loader allows to assemble beans that only operate when a space is in a
PRIMARY
mode which basically applies when directly working with cluster members
and not a clustered space proxy (since in such cases it will always be PRIMARY
).
The new Spring application context created will have the current context as its parent, allowing to use any beans defined within the current context within the loaded context.
The context loader accepts a Spring Resource
as the location.
A flag called setActiveWhenPrimary(boolean)
which defaults to true
allows
to control if the context will be loaded only when the cluster member moves to
PRIMARY
mode.
Field Summary | |
---|---|
protected ResourceApplicationContext |
applicationContext
|
protected String |
beanName
|
protected Log |
logger
|
Constructor Summary | |
---|---|
SpaceModeContextLoader()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
protected void |
closeApplicationContext()
Closes the application context. |
void |
destroy()
|
protected void |
loadApplicationContext()
Loads the application context and adding specific bean factory and bean post processors. |
void |
onApplicationEvent(ApplicationEvent applicationEvent)
If setActiveWhenPrimary(boolean) is set to true (the default) will
listens for AfterSpaceModeChangeEvent and load an application context if received. |
protected void |
publishEvent(ApplicationEvent applicationEvent)
A hack to only send the application event on the child application context we are loading, without propogating it to the parent application context (when using ApplicationEventPublisher.publishEvent(org.springframework.context.ApplicationEvent)
which will create a recursive event calling. |
void |
setActiveWhenPrimary(boolean activeWhenPrimary)
Controls if the Spring context will be loaded when the space cluster member moves to PRIMARY mode. |
void |
setApplicationContext(ApplicationContext applicationContext)
Injected by Spring and used as the parent application context for the newly created application context. |
void |
setBeanLevelProperties(BeanLevelProperties beanLevelProperties)
Used to pass the BeanLevelProperties to the newly created application context. |
void |
setBeanName(String name)
|
void |
setClusterInfo(ClusterInfo clusterInfo)
Used to pass ClusterInfo to the newly created application context. |
void |
setGigaSpace(GigaSpace gigaSpace)
Allows to set the GigaSpace instance that will control (based on its Space mode - PRIMARY or BACKUP) if the context will be loaded or not. |
void |
setLocation(Resource location)
The location of the Spring xml context application to be loaded. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Log logger
protected String beanName
protected volatile ResourceApplicationContext applicationContext
Constructor Detail |
---|
public SpaceModeContextLoader()
Method Detail |
---|
public void setLocation(Resource location)
public void setGigaSpace(GigaSpace gigaSpace)
public void setActiveWhenPrimary(boolean activeWhenPrimary)
PRIMARY
mode. Defaults to true
.
public void setBeanLevelProperties(BeanLevelProperties beanLevelProperties)
BeanLevelProperties
to the newly created application context.
setBeanLevelProperties
in interface BeanLevelPropertiesAware
public void setClusterInfo(ClusterInfo clusterInfo)
ClusterInfo
to the newly created application context.
setClusterInfo
in interface ClusterInfoAware
clusterInfo
- The cluster information to be injectedpublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
public void setBeanName(String name)
setBeanName
in interface BeanNameAware
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public void destroy() throws Exception
destroy
in interface DisposableBean
Exception
public void onApplicationEvent(ApplicationEvent applicationEvent)
setActiveWhenPrimary(boolean)
is set to true
(the default) will
listens for AfterSpaceModeChangeEvent
and load an application context if received.
onApplicationEvent
in interface ApplicationListener
protected void loadApplicationContext() throws Exception
Exception
protected void closeApplicationContext()
protected void publishEvent(ApplicationEvent applicationEvent)
ApplicationEventPublisher.publishEvent(org.springframework.context.ApplicationEvent)
which will create a recursive event calling.
|
GigaSpaces XAP 9.7.2 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |