public class OmeroContext
extends org.springframework.context.support.ClassPathXmlApplicationContext
getInstance(String)
or
ServiceFactory.ServiceFactory(String)
.
By passing a Properties
instance into the
getClientContext(Properties)
method, a non-static version is
created. Currently this is only supported for the client context.Modifier and Type | Class and Description |
---|---|
protected static class |
OmeroContext.Locator
provides access to the protected methods of
ContextSingletonBeanFactoryLocator
which cannot be used externally. |
Modifier and Type | Field and Description |
---|---|
static String |
CLIENT_CONTEXT
identifier for an OmeroContext configured in
classpath*:beanRefContext.xml for use by remote (via JNDI/RMI) clients.
|
static String |
MANAGED_CONTEXT
identifier for an OmeroContext configured in
classpath*:beanRefContext.xml for use by server-side processes.
|
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME
CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME
Constructor and Description |
---|
OmeroContext(String configLocation) |
OmeroContext(String[] configLocations) |
OmeroContext(String[] configLocations,
org.springframework.context.ApplicationContext parent) |
OmeroContext(String[] configLocations,
boolean refresh) |
OmeroContext(String[] configLocations,
boolean refresh,
org.springframework.context.ApplicationContext parent) |
Modifier and Type | Method and Description |
---|---|
void |
applyBeanPropertyValues(Object target,
Class<? extends ServiceInterface> beanInterface)
Uses the methods of this context's
BeanFactory to autowire any
Object based on the service class. |
void |
applyBeanPropertyValues(Object target,
String beanName)
Uses the methods of this context's
BeanFactory to autowire any
Object based on the given beanName. |
void |
closeAll()
closes all the nested OmeroContexts within this instance.
|
static OmeroContext |
getClientContext()
create (if necessary) and return the single default client OmeroContext.
|
static OmeroContext |
getClientContext(Properties props)
initialize a new client OmeroContext (named
CLIENT_CONTEXT ),
using the getContext(Properties, String) method. |
static OmeroContext |
getContext(Properties props,
String context)
initialize a new client OmeroContext using the
Properties
provided as values for property (e.g. |
static OmeroContext |
getInstance(String beanFactoryName)
create (if necessary) and return the single default OmeroContext named by
the beanFactoryName parameter.
|
static OmeroContext |
getManagedServerContext()
create (if necessary) and return the single default managed OmeroContext.
|
String |
getProperty(String propertyName) |
protected void |
onRefresh()
Template method which can be overridden to add context-specific refresh work.
|
void |
publishEvent(org.springframework.context.ApplicationEvent event)
Publish the given event to all listeners.
|
void |
publishMessage(InternalMessage msg)
Convenience method around
publishEvent(org.springframework.context.ApplicationEvent) which
catches all MessageException and unwraps the contained
Throwable instance and rethrows. |
void |
refreshAll()
refreshes all the nested OmeroContexts within this instance.
|
void |
refreshAllIfNecessary()
Calls #refreshAll() if {@link #isRunning()} throws an
{@link IllegalStateException}.
|
getConfigResources
initBeanDefinitionReader, loadBeanDefinitions, loadBeanDefinitions, setValidating
afterPropertiesSet, getConfigLocations, getDefaultConfigLocations, resolvePath, setBeanName, setConfigLocation, setConfigLocations, setId
cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferences
addApplicationListener, addBeanFactoryPostProcessor, addListener, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, postProcessBeanFactory, prepareBeanFactory, prepareRefresh, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, setParent, start, stop, toString
getClassLoader, getResource, getResourceByPath, setClassLoader
public static final String CLIENT_CONTEXT
public static final String MANAGED_CONTEXT
public OmeroContext(String configLocation) throws org.springframework.beans.BeansException
org.springframework.beans.BeansException
public OmeroContext(String[] configLocations) throws org.springframework.beans.BeansException
org.springframework.beans.BeansException
public OmeroContext(String[] configLocations, boolean refresh) throws org.springframework.beans.BeansException
org.springframework.beans.BeansException
public OmeroContext(String[] configLocations, org.springframework.context.ApplicationContext parent) throws org.springframework.beans.BeansException
org.springframework.beans.BeansException
public OmeroContext(String[] configLocations, boolean refresh, org.springframework.context.ApplicationContext parent) throws org.springframework.beans.BeansException
org.springframework.beans.BeansException
public static OmeroContext getClientContext()
CLIENT_CONTEXT
public static OmeroContext getClientContext(Properties props)
CLIENT_CONTEXT
),
using the getContext(Properties, String)
method.public static OmeroContext getContext(Properties props, String context)
Properties
provided as values for property (e.g. ${name}) replacement in Spring. Two
calls to this method with the same argument will return different ( =! )
contexts.props
- Non-null properties for replacement.context
- Non-null name of context to find in beanRefContext.xmlServiceFactory.ServiceFactory(Login)
,
ServiceFactory.ServiceFactory(Server)
,
ServiceFactory.ServiceFactory(Properties)
public static OmeroContext getManagedServerContext()
#INTERNAL_CONTEXT
public static OmeroContext getInstance(String beanFactoryName)
getClientContext()
,
#getInternalServerContext()
,
getManagedServerContext()
public void applyBeanPropertyValues(Object target, String beanName)
BeanFactory
to autowire any
Object based on the given beanName.AutowireCapableBeanFactory.applyBeanPropertyValues(java.lang.Object,
java.lang.String)
public void applyBeanPropertyValues(Object target, Class<? extends ServiceInterface> beanInterface)
BeanFactory
to autowire any
Object based on the service class. This is used by
SelfConfigurableService
instances to acquire dependencies.SelfConfigurableService
,
AutowireCapableBeanFactory.applyBeanPropertyValues(java.lang.Object,
java.lang.String)
public void refreshAll()
Properties
which were
pulled from System.getProperties()
have been changed.
If this is a server-side instance (MANAGED_CONTEXT
or OmeroContext#INTERNAL_CONTEXT
), this may take a significant
amount of time.ConfigurableApplicationContext.refresh()
public void refreshAllIfNecessary()
public void closeAll()
MANAGED_CONTEXT
or OmeroContext#INTERNAL_CONTEXT
), this may take a significant
amount of time.ConfigurableApplicationContext.close()
public void publishEvent(org.springframework.context.ApplicationEvent event)
org.springframework.context.support.AbstractApplicationContext
Note: Listeners get initialized after the MessageSource, to be able to access it within listener implementations. Thus, MessageSource implementations cannot publish events.
publishEvent
in interface org.springframework.context.ApplicationEventPublisher
publishEvent
in class org.springframework.context.support.AbstractApplicationContext
event
- the event to publish (may be application-specific or a
standard framework event)org.springframework.web.context.support.RequestHandledEvent
public void publishMessage(InternalMessage msg) throws Throwable
publishEvent(org.springframework.context.ApplicationEvent)
which
catches all MessageException
and unwraps the contained
Throwable
instance and rethrows.msg
- Throwable
protected void onRefresh() throws org.springframework.beans.BeansException
org.springframework.context.support.AbstractApplicationContext
This implementation is empty.
onRefresh
in class org.springframework.context.support.AbstractApplicationContext
org.springframework.beans.BeansException
- in case of errorsAbstractApplicationContext.refresh()
Version: 5.1.4-ice35-b55
Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.