SOURCE
- as SourceT
- public class ConfigurationSourceBackedSpringResource extends org.springframework.core.env.PropertySource<ConfigurationService> implements org.springframework.core.io.Resource, ChangeListener<AbstractConfiguration>, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware
Properties
and Resource
that wraps a ConfigurationSource
so it can be used in third party contexts like Spring;
additionally it also registers itself as a ChangeListener
with it.
updateSpringConfigs()
is not working as expected!Constructor and Description |
---|
ConfigurationSourceBackedSpringResource(String namespace) |
ConfigurationSourceBackedSpringResource(String namespace,
ConfigurationService source) |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
As soon as all init, then replace static configs with dynamic ones in Spring Context.
|
long |
contentLength() |
org.springframework.core.io.Resource |
createRelative(String relativePath) |
boolean |
exists() |
String |
getDescription() |
File |
getFile() |
String |
getFilename() |
InputStream |
getInputStream() |
String |
getNamespace()
The namespace from the
ConfigurationSource to fetch the property from |
String |
getProperty(String key) |
ConfigurationService<String,String,?> |
getSource()
The
ConfigurationService to fetches the configs from |
URI |
getURI() |
URL |
getURL() |
boolean |
isOpen() |
boolean |
isReadable() |
boolean |
isRecognizeFullPathKeys()
If true, it will also recognize property references that use <namespace>.<key> references.
|
long |
lastModified() |
void |
onChange(ChangeGenerator changeGenerator,
AbstractConfiguration config) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setNamespace(String namespace)
The namespace from the
ConfigurationSource to fetch the property from |
void |
setRecognizeFullPathKeys(boolean recognizeFullPathKeys)
If true, it will also recognize property references that use <namespace>.<key> references.
|
void |
setSource(ConfigurationService<String,String,AbstractConfiguration> source)
The
ConfigurationService to fetches the configs from |
protected void |
updateSpringConfigs() |
public ConfigurationSourceBackedSpringResource(String namespace, ConfigurationService source)
public ConfigurationSourceBackedSpringResource(String namespace)
public ConfigurationService<String,String,?> getSource()
ConfigurationService
to fetches the configs fromgetSource
in class org.springframework.core.env.PropertySource<ConfigurationService>
public void setSource(ConfigurationService<String,String,AbstractConfiguration> source)
ConfigurationService
to fetches the configs frompublic String getNamespace()
ConfigurationSource
to fetch the property frompublic void setNamespace(String namespace)
ConfigurationSource
to fetch the property frompublic String getProperty(String key)
getProperty
in class org.springframework.core.env.PropertySource<ConfigurationService>
public boolean isRecognizeFullPathKeys()
public void setRecognizeFullPathKeys(boolean recognizeFullPathKeys)
public InputStream getInputStream() throws IOException
getInputStream
in interface org.springframework.core.io.InputStreamSource
IOException
public boolean isReadable()
isReadable
in interface org.springframework.core.io.Resource
public boolean exists()
exists
in interface org.springframework.core.io.Resource
public boolean isOpen()
isOpen
in interface org.springframework.core.io.Resource
public URL getURL() throws IOException
getURL
in interface org.springframework.core.io.Resource
IOException
public URI getURI() throws IOException
getURI
in interface org.springframework.core.io.Resource
IOException
public File getFile() throws IOException
getFile
in interface org.springframework.core.io.Resource
IOException
public long contentLength() throws IOException
contentLength
in interface org.springframework.core.io.Resource
IOException
public long lastModified() throws IOException
lastModified
in interface org.springframework.core.io.Resource
IOException
public org.springframework.core.io.Resource createRelative(String relativePath) throws IOException
createRelative
in interface org.springframework.core.io.Resource
IOException
public String getFilename()
getFilename
in interface org.springframework.core.io.Resource
public String getDescription()
getDescription
in interface org.springframework.core.io.Resource
public void onChange(ChangeGenerator changeGenerator, AbstractConfiguration config)
onChange
in interface ChangeListener<AbstractConfiguration>
changeGenerator
- as the generator that caused the change. Specially useful if the Listener is subscribing to multiple ChangeGenerator
sconfig
- as the model change communicatedprotected void updateSpringConfigs()
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
Copyright © 2018. All rights reserved.