public class OmeroContext
extends org.springframework.context.support.ClassPathXmlApplicationContext
getInstance(String) or
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 java.lang.String |
CLIENT_CONTEXT
identifier for an OmeroContext configured in
classpath*:beanRefContext.xml for use by remote (via JNDI/RMI) clients.
|
static java.lang.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_NAMECONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME| Constructor and Description |
|---|
OmeroContext(java.lang.String configLocation) |
OmeroContext(java.lang.String[] configLocations) |
OmeroContext(java.lang.String[] configLocations,
org.springframework.context.ApplicationContext parent) |
OmeroContext(java.lang.String[] configLocations,
boolean refresh) |
OmeroContext(java.lang.String[] configLocations,
boolean refresh,
org.springframework.context.ApplicationContext parent) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyBeanPropertyValues(java.lang.Object target,
java.lang.Class<? extends ServiceInterface> beanInterface)
Uses the methods of this context's
BeanFactory to autowire any
Object based on the service class. |
void |
applyBeanPropertyValues(java.lang.Object target,
java.lang.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(java.util.Properties props)
initialize a new client OmeroContext (named
CLIENT_CONTEXT),
using the getContext(Properties, String) method. |
static OmeroContext |
getContext(java.util.Properties props,
java.lang.String context)
initialize a new client OmeroContext using the
Properties
provided as values for property (e.g. |
static OmeroContext |
getInstance(java.lang.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.
|
java.lang.String |
getProperty(java.lang.String propertyName) |
protected void |
onRefresh() |
void |
publishEvent(org.springframework.context.ApplicationEvent event) |
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()
|
getConfigResourcesinitBeanDefinitionReader, loadBeanDefinitions, loadBeanDefinitions, setValidatingafterPropertiesSet, getConfigLocations, getDefaultConfigLocations, resolvePath, setBeanName, setConfigLocation, setConfigLocations, setIdassertBeanFactoryActive, cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferencesaddApplicationListener, addBeanFactoryPostProcessor, close, containsBean, containsBeanDefinition, containsLocalBean, createEnvironment, destroy, destroyBeans, doClose, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationName, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, initPropertySources, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, postProcessBeanFactory, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, resetCommonCaches, setDisplayName, setEnvironment, setParent, start, stop, toStringaddProtocolResolver, getClassLoader, getProtocolResolvers, getResource, getResourceByPath, setClassLoaderclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic static final java.lang.String CLIENT_CONTEXT
public static final java.lang.String MANAGED_CONTEXT
public OmeroContext(java.lang.String configLocation)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionpublic OmeroContext(java.lang.String[] configLocations)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionpublic OmeroContext(java.lang.String[] configLocations,
boolean refresh)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionpublic OmeroContext(java.lang.String[] configLocations,
org.springframework.context.ApplicationContext parent)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionpublic OmeroContext(java.lang.String[] configLocations,
boolean refresh,
org.springframework.context.ApplicationContext parent)
throws org.springframework.beans.BeansException
org.springframework.beans.BeansExceptionpublic static OmeroContext getClientContext()
CLIENT_CONTEXTpublic static OmeroContext getClientContext(java.util.Properties props)
CLIENT_CONTEXT),
using the getContext(Properties, String) method.public static OmeroContext getContext(java.util.Properties props, java.lang.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(Login),
ServiceFactory(Server),
ServiceFactory(Properties)public static OmeroContext getManagedServerContext()
MANAGED_CONTEXTpublic static OmeroContext getInstance(java.lang.String beanFactoryName)
getClientContext(),
getManagedServerContext()public void applyBeanPropertyValues(java.lang.Object target,
java.lang.String beanName)
BeanFactory to autowire any
Object based on the given beanName.AutowireCapableBeanFactory.applyBeanPropertyValues(java.lang.Object,
java.lang.String)public void applyBeanPropertyValues(java.lang.Object target,
java.lang.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), this may
take a significant amount of time.ConfigurableApplicationContext.refresh()public void refreshAllIfNecessary()
public void closeAll()
MANAGED_CONTEXT), this may
take a significant amount of time.ConfigurableApplicationContext.close()public java.lang.String getProperty(java.lang.String propertyName)
public void publishEvent(org.springframework.context.ApplicationEvent event)
publishEvent in interface org.springframework.context.ApplicationEventPublisherpublishEvent in class org.springframework.context.support.AbstractApplicationContextpublic void publishMessage(InternalMessage msg) throws java.lang.Throwable
publishEvent(org.springframework.context.ApplicationEvent) which
catches all MessageException and unwraps the contained
Throwable instance and rethrows.msg - java.lang.Throwableprotected void onRefresh()
throws org.springframework.beans.BeansException
onRefresh in class org.springframework.context.support.AbstractApplicationContextorg.springframework.beans.BeansException