Class Configuration
- java.lang.Object
-
- org.springframework.core.io.DefaultResourceLoader
-
- org.springframework.context.support.AbstractApplicationContext
-
- org.springframework.context.support.AbstractRefreshableApplicationContext
-
- org.springframework.context.support.AbstractRefreshableConfigApplicationContext
-
- org.springframework.context.support.AbstractXmlApplicationContext
-
- org.springframework.context.support.ClassPathXmlApplicationContext
-
- nl.nn.adapterframework.configuration.Configuration
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IConfigurable
,IConfigurationAware
,INamedObject
,IScopeProvider
,ConfigurableLifecycle
,org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactory
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.HierarchicalBeanFactory
,org.springframework.beans.factory.InitializingBean
,org.springframework.beans.factory.ListableBeanFactory
,org.springframework.context.ApplicationContext
,org.springframework.context.ApplicationContextAware
,org.springframework.context.ApplicationEventPublisher
,org.springframework.context.ConfigurableApplicationContext
,org.springframework.context.Lifecycle
,org.springframework.context.MessageSource
,org.springframework.core.env.EnvironmentCapable
,org.springframework.core.io.ResourceLoader
,org.springframework.core.io.support.ResourcePatternResolver
public class Configuration extends org.springframework.context.support.ClassPathXmlApplicationContext implements IConfigurable, org.springframework.context.ApplicationContextAware, ConfigurableLifecycle
Container ofAdapters
that belong together. A configuration may be deployed independently from other configurations. Names of nested elements likeAdapters
,Receivers
, listeners and senders can be reused in other configurations.
Configurations are shown in the Frank!Console along with theirAdapters
,Receivers
, listeners and senders. The Adapter Status page of the Frank!Console has a tab for each configuration that only shows information about that configuration. See the Frank!Manual for details.- Author:
- Johan Verrips
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.logging.log4j.Logger
log
-
Fields inherited from class org.springframework.context.support.AbstractApplicationContext
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME
-
Fields inherited from interface org.springframework.context.ConfigurableApplicationContext
APPLICATION_STARTUP_BEAN_NAME, CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAME
-
-
Constructor Summary
Constructors Constructor Description Configuration()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addStartAdapterThread(Runnable runnable)
void
addStopAdapterThread(Runnable runnable)
void
afterPropertiesSet()
Spring's configure method.void
close()
void
configure()
Digest the configuration and generate flow diagram.AdapterManager
getAdapterManager()
org.springframework.context.ApplicationContext
getApplicationContext()
String[]
getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)
String
getClassLoaderType()
If no ClassLoader has been set it tries to fall back on the `configurations.xxx.classLoaderType` property.ClassLoader
getConfigurationClassLoader()
This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.ConfigurationException
getConfigurationException()
ConfigurationWarnings
getConfigurationWarnings()
IbisManager
getIbisManager()
String
getLoadedConfiguration()
String
getName()
String
getOriginalConfiguration()
Adapter
getRegisteredAdapter(String name)
Get a registered adapter by its name throughAdapterManager.getAdapter(String)
List<Adapter>
getRegisteredAdapters()
IJob
getScheduledJob(String name)
List<IJob>
getScheduledJobs()
ScheduleManager
getScheduleManager()
RunState
getState()
String
getVersion()
void
initMetrics()
boolean
isAutoStart()
boolean
isConfigured()
boolean
isRunning()
boolean
isStubbed()
boolean
isUnloadInProgressOrDone()
void
log(String message)
Log a message to the MessageKeeper that corresponds to this configurationvoid
log(String message, Exception e)
Log a message to the MessageKeeper that corresponds to this configurationvoid
log(String message, MessageKeeper.MessageKeeperLevel level)
Log a message to the MessageKeeper that corresponds to this configurationvoid
publishEvent(org.springframework.context.ApplicationEvent event)
void
refresh()
Don't manually call this method.void
registerAdapter(Adapter adapter)
Add adapter.void
registerInclude(Include module)
Include the referenced Module in this configurationvoid
registerJmsRealm(JmsRealm realm)
Deprecated.void
registerMonitoring(MonitorManager factory)
Deprecated.void
registerScheduledJob(IJob jobdef)
Deprecated.void
removeStartAdapterThread(Runnable runnable)
void
removeStopAdapterThread(Runnable runnable)
protected void
runMigrator()
Execute any database changes before callingconfigure()
.void
setAdapterManager(AdapterManager adapterManager)
void
setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
void
setAutoStart(boolean autoStart)
If the Configuration should automatically start allAdapters
andScheduled Jobs
.void
setBeanName(String name)
Overwrite the DisplayName created by the super.setBeanName which prepends 'ApplicationContext'.void
setConfigurationException(ConfigurationException exception)
void
setIbisManager(IbisManager ibisManager)
void
setJmsRealms(JmsRealmFactory realm)
void
setLoadedConfiguration(String loadedConfiguration)
The loaded (with resolved properties) configurationvoid
setMonitoring(MonitorManager monitorManager)
Container for monitor objectsvoid
setName(String name)
Configurations should be wired through Spring, which in turn should callsetBeanName(String)
.void
setOriginalConfiguration(String originalConfiguration)
The entire (raw) configurationvoid
setSapSystems(SapSystems sapSystems)
void
setScheduleManager(ScheduleManager scheduleManager)
Container for jobs scheduled for periodic execution.void
setSharedResources(SharedResources resource)
void
setVersion(String version)
The version of the Configuration, typically provided by the BuildInfo.properties file.void
start()
Spring method which starts the ApplicationContext.-
Methods inherited from class org.springframework.context.support.ClassPathXmlApplicationContext
getConfigResources
-
Methods inherited from class org.springframework.context.support.AbstractXmlApplicationContext
initBeanDefinitionReader, loadBeanDefinitions, loadBeanDefinitions, setValidating
-
Methods inherited from class org.springframework.context.support.AbstractRefreshableConfigApplicationContext
getConfigLocations, getDefaultConfigLocations, resolvePath, setConfigLocation, setConfigLocations, setId
-
Methods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext
assertBeanFactoryActive, cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferences
-
Methods inherited from class org.springframework.context.support.AbstractApplicationContext
addApplicationListener, addBeanFactoryPostProcessor, containsBean, containsBeanDefinition, containsLocalBean, createEnvironment, destroy, destroyBeans, doClose, findAnnotationOnBean, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationName, getApplicationStartup, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResourcePatternResolver, getResources, getStartupDate, getType, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, initPropertySources, invokeBeanFactoryPostProcessors, isActive, isPrototype, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, onRefresh, postProcessBeanFactory, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, registerBeanPostProcessors, registerListeners, registerShutdownHook, resetCommonCaches, setApplicationStartup, setDisplayName, setEnvironment, setParent, stop, toString
-
Methods inherited from class org.springframework.core.io.DefaultResourceLoader
addProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResource, getResourceByPath, getResourceCache, setClassLoader
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
initMetrics
public void initMetrics() throws ConfigurationException
- Throws:
ConfigurationException
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
- Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
getApplicationContext
public org.springframework.context.ApplicationContext getApplicationContext()
- Specified by:
getApplicationContext
in interfaceIConfigurationAware
-
afterPropertiesSet
public void afterPropertiesSet()
Spring's configure method. Only called when the Configuration has been added through a parent context!- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in classorg.springframework.context.support.AbstractRefreshableConfigApplicationContext
-
refresh
public void refresh() throws org.springframework.beans.BeansException, IllegalStateException
Don't manually call this method. Spring should automatically trigger this when super.afterPropertiesSet(); is called.- Specified by:
refresh
in interfaceorg.springframework.context.ConfigurableApplicationContext
- Overrides:
refresh
in classorg.springframework.context.support.AbstractApplicationContext
- Throws:
org.springframework.beans.BeansException
IllegalStateException
-
getBeanNamesForType
public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit)
- Specified by:
getBeanNamesForType
in interfaceorg.springframework.beans.factory.ListableBeanFactory
- Overrides:
getBeanNamesForType
in classorg.springframework.context.support.AbstractApplicationContext
-
start
public void start()
Spring method which starts the ApplicationContext. Loads + digests the configuration and calls start() in all registered beans that implement the SpringLifecycle
interface.- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
- Overrides:
start
in classorg.springframework.context.support.AbstractApplicationContext
-
configure
public void configure() throws ConfigurationException
Digest the configuration and generate flow diagram.- Specified by:
configure
in interfaceConfigurableLifecycle
- Specified by:
configure
in interfaceIConfigurable
- Throws:
ConfigurationException
- in case it was not able to configure the component.
-
runMigrator
protected void runMigrator()
Execute any database changes before callingconfigure()
.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceorg.springframework.context.ConfigurableApplicationContext
- Overrides:
close
in classorg.springframework.context.support.AbstractApplicationContext
-
publishEvent
public void publishEvent(org.springframework.context.ApplicationEvent event)
- Specified by:
publishEvent
in interfaceorg.springframework.context.ApplicationEventPublisher
- Overrides:
publishEvent
in classorg.springframework.context.support.AbstractApplicationContext
-
log
public void log(String message)
Log a message to the MessageKeeper that corresponds to this configuration
-
log
public void log(String message, MessageKeeper.MessageKeeperLevel level)
Log a message to the MessageKeeper that corresponds to this configuration
-
log
public void log(String message, Exception e)
Log a message to the MessageKeeper that corresponds to this configuration
-
isUnloadInProgressOrDone
public boolean isUnloadInProgressOrDone()
-
isRunning
public boolean isRunning()
- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
- Overrides:
isRunning
in classorg.springframework.context.support.AbstractApplicationContext
-
setAutoStart
public void setAutoStart(boolean autoStart)
If the Configuration should automatically start allAdapters
andScheduled Jobs
.
-
isAutoStart
public boolean isAutoStart()
-
isStubbed
public boolean isStubbed()
-
getRegisteredAdapter
public Adapter getRegisteredAdapter(String name)
Get a registered adapter by its name throughAdapterManager.getAdapter(String)
- Parameters:
name
- the adapter to retrieve- Returns:
- IAdapter
-
addStartAdapterThread
public void addStartAdapterThread(Runnable runnable)
-
removeStartAdapterThread
public void removeStartAdapterThread(Runnable runnable)
-
addStopAdapterThread
public void addStopAdapterThread(Runnable runnable)
-
removeStopAdapterThread
public void removeStopAdapterThread(Runnable runnable)
-
registerInclude
public void registerInclude(Include module)
Include the referenced Module in this configuration
-
registerAdapter
public void registerAdapter(Adapter adapter)
Add adapter.
-
setScheduleManager
public void setScheduleManager(ScheduleManager scheduleManager)
Container for jobs scheduled for periodic execution.
-
registerScheduledJob
@Deprecated public void registerScheduledJob(IJob jobdef)
Deprecated.Register anjob
for scheduling at the configuration. The configuration will create anAdapterJob
instance and a JobDetail with the information from the parameters, after checking the parameters of the job. (basically, it checks whether the adapter and the receiver are registered.See the Quartz scheduler documentation
- Parameters:
jobdef
- a JobDef object- Since:
- 4.0
- See Also:
for a description of Cron triggers
-
setName
public void setName(String name)
Configurations should be wired through Spring, which in turn should callsetBeanName(String)
. Once the ConfigurationContext has a name it should not be changed anymore, hencesuper.setBeanName(String)
only sets the name once. If not created by Spring, the setIdCalled flag in AbstractRefreshableConfigApplicationContext wont be set, allowing the name to be updated. The DisplayName will always be updated, which is purely used for logging purposes.- Specified by:
setName
in interfaceINamedObject
-
getName
public String getName()
- Specified by:
getName
in interfaceIConfigurationAware
- Specified by:
getName
in interfaceINamedObject
-
setVersion
@Protected public void setVersion(String version)
The version of the Configuration, typically provided by the BuildInfo.properties file.
-
getClassLoaderType
public String getClassLoaderType()
If no ClassLoader has been set it tries to fall back on the `configurations.xxx.classLoaderType` property. Because of this, it may not always represent the correct or accurate type.
-
setIbisManager
public void setIbisManager(IbisManager ibisManager)
-
setOriginalConfiguration
@Protected public void setOriginalConfiguration(String originalConfiguration)
The entire (raw) configuration
-
setLoadedConfiguration
@Protected public void setLoadedConfiguration(String loadedConfiguration)
The loaded (with resolved properties) configuration
-
setConfigurationException
public void setConfigurationException(ConfigurationException exception)
-
getConfigurationWarnings
public ConfigurationWarnings getConfigurationWarnings()
-
getConfigurationClassLoader
public ClassLoader getConfigurationClassLoader()
Description copied from interface:IScopeProvider
This ClassLoader is set upon creation of the object, used to retrieve resources configured by the Ibis application.- Specified by:
getConfigurationClassLoader
in interfaceIScopeProvider
- Returns:
- returns the ClassLoader created by the
ClassLoaderManager
.
-
setSapSystems
public void setSapSystems(SapSystems sapSystems)
-
setJmsRealms
public void setJmsRealms(JmsRealmFactory realm)
-
registerJmsRealm
@Deprecated public void registerJmsRealm(JmsRealm realm)
Deprecated.
-
setMonitoring
public void setMonitoring(MonitorManager monitorManager)
Container for monitor objects
-
registerMonitoring
@Deprecated public void registerMonitoring(MonitorManager factory)
Deprecated.
-
setSharedResources
public void setSharedResources(SharedResources resource)
-
setBeanName
@Protected public void setBeanName(String name)
Overwrite the DisplayName created by the super.setBeanName which prepends 'ApplicationContext'. The BeanName can only be set once, after which it only updates the DisplayName.- Specified by:
setBeanName
in interfaceorg.springframework.beans.factory.BeanNameAware
- Overrides:
setBeanName
in classorg.springframework.context.support.AbstractRefreshableConfigApplicationContext
-
getAdapterManager
public AdapterManager getAdapterManager()
-
setAdapterManager
public void setAdapterManager(AdapterManager adapterManager)
-
getScheduleManager
public ScheduleManager getScheduleManager()
-
getState
public RunState getState()
-
getVersion
public String getVersion()
-
getIbisManager
public IbisManager getIbisManager()
-
getOriginalConfiguration
public String getOriginalConfiguration()
-
getLoadedConfiguration
public String getLoadedConfiguration()
-
isConfigured
public boolean isConfigured()
-
getConfigurationException
public ConfigurationException getConfigurationException()
-
-