T - The precise service being implemented.@ThreadSafe public class ReloadableSpringService<T> extends AbstractReloadableService<T> implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.BeanNameAware, org.springframework.context.Lifecycle
ServiceableComponent via Spring.
This class extends Lifecycle. and thus
It acts as the bridge between this interface and
InitializableComponent and
DestructableComponentAbstractReloadableService.ServiceReloadTask| Modifier and Type | Field and Description |
|---|---|
private String |
beanName
The bean name.
|
private Collection<String> |
beanProfiles
Bean profiles to enable.
|
private ServiceableComponent<T> |
cachedComponent
The last known good component.
|
private org.springframework.core.convert.ConversionService |
conversionService
Conversion service to use.
|
private List<org.springframework.beans.factory.config.BeanFactoryPostProcessor> |
factoryPostProcessors
List of bean factory post processors for this service's content.
|
private boolean |
lastLoadFailed
Did the last load fail? An optimization only.
|
private org.slf4j.Logger |
log
Class logger.
|
private org.springframework.context.ApplicationContext |
parentContext
Application context owning this engine.
|
private List<org.springframework.beans.factory.config.BeanPostProcessor> |
postProcessors
List of bean post processors for this service's content.
|
private long[] |
resourceLastModifiedTimes
Time, in milliseconds, when the service configuration for the given index was last observed to have changed.
|
private List<org.springframework.core.io.Resource> |
serviceConfigurations
List of configuration resources for this service.
|
private com.google.common.base.Function<org.springframework.context.ApplicationContext,ServiceableComponent<T>> |
serviceStrategy
How to summon up the
ServiceableComponent from the ApplicationContext. |
private Class<T> |
theClaz
The class we are looking for.
|
| Constructor and Description |
|---|
ReloadableSpringService(Class<T> claz)
Constructor.
|
ReloadableSpringService(Class<T> claz,
com.google.common.base.Function<org.springframework.context.ApplicationContext,ServiceableComponent<T>> strategy)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doDestroy() |
protected void |
doInitialize() |
protected void |
doReload() |
org.springframework.context.ApplicationContext |
getParentContext()
Gets the application context that is the parent to this service's context.
|
ServiceableComponent<T> |
getServiceableComponent()
Get the serviceable component.
|
List<org.springframework.core.io.Resource> |
getServiceConfigurations()
Gets an unmodifiable list of configurations for this service.
|
boolean |
isRunning()
.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setBeanFactoryPostProcessors(List<org.springframework.beans.factory.config.BeanFactoryPostProcessor> processors)
Set the list of bean factory post processors for this service.
|
void |
setBeanName(String name) |
void |
setBeanPostProcessors(List<org.springframework.beans.factory.config.BeanPostProcessor> processors)
Set the list of bean post processors for this service.
|
void |
setBeanProfiles(Collection<String> profiles)
Set the bean profiles for this service.
|
void |
setConversionService(org.springframework.core.convert.ConversionService service)
Set a conversion service to use.
|
void |
setParentContext(org.springframework.context.ApplicationContext context)
Sets the application context that is the parent to this service's context.
|
void |
setServiceConfigurations(List<org.springframework.core.io.Resource> configs)
Set the list of configurations for this service.
|
void |
setServiceConfigurationStrategy(com.google.common.base.Function<?,List<org.springframework.core.io.Resource>> strategy)
Set the strategy by which the Service can locate the resources it needs to know about.
|
protected boolean |
shouldReload() |
void |
start() |
void |
stop() |
getLastReloadAttemptInstant, getLastSuccessfulReloadInstant, getLogPrefix, getReloadCheckDelay, getReloadFailureCause, getReloadTaskTimer, isFailFast, reload, setFailFast, setReloadCheckDelay, setReloadTaskTimersetIdgetIddestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitialize, isInitializedgetId@Nonnull private final org.slf4j.Logger log
@Nullable @NonnullElements private List<org.springframework.core.io.Resource> serviceConfigurations
@Nonnull @NonnullElements private List<org.springframework.beans.factory.config.BeanFactoryPostProcessor> factoryPostProcessors
@Nonnull @NonnullElements private List<org.springframework.beans.factory.config.BeanPostProcessor> postProcessors
@Nonnull @NonnullElements private Collection<String> beanProfiles
@Nullable private org.springframework.core.convert.ConversionService conversionService
@Nonnull private final com.google.common.base.Function<org.springframework.context.ApplicationContext,ServiceableComponent<T>> serviceStrategy
ServiceableComponent from the ApplicationContext.@Nullable private org.springframework.context.ApplicationContext parentContext
@Nullable private ServiceableComponent<T> cachedComponent
private boolean lastLoadFailed
@Nullable private long[] resourceLastModifiedTimes
public ReloadableSpringService(@Nonnull @ParameterName(name="claz") Class<T> claz)
claz - The interface being implemented.public ReloadableSpringService(@Nonnull @ParameterName(name="claz") Class<T> claz, @Nonnull @ParameterName(name="strategy") com.google.common.base.Function<org.springframework.context.ApplicationContext,ServiceableComponent<T>> strategy)
claz - The interface being implemented.strategy - the strategy to use to look up servicable component to look for.@Nullable public org.springframework.context.ApplicationContext getParentContext()
public void setParentContext(@Nullable org.springframework.context.ApplicationContext context)
context - context that is the parent to this service's context, may be null@Nonnull public List<org.springframework.core.io.Resource> getServiceConfigurations()
public void setServiceConfigurations(@Nonnull @NonnullElements List<org.springframework.core.io.Resource> configs)
configs - list of configurations for this servicepublic void setServiceConfigurationStrategy(@Nonnull com.google.common.base.Function<?,List<org.springframework.core.io.Resource>> strategy)
strategy - the way to get the resources. Precise details are tbd.public void setBeanFactoryPostProcessors(@Nonnull @NonnullElements List<org.springframework.beans.factory.config.BeanFactoryPostProcessor> processors)
processors - bean factory post processors to applypublic void setBeanPostProcessors(@Nonnull @NonnullElements List<org.springframework.beans.factory.config.BeanPostProcessor> processors)
processors - bean post processors to applypublic void setBeanProfiles(@Nonnull @NonnullElements Collection<String> profiles)
profiles - bean profiles to applypublic void setConversionService(@Nullable org.springframework.core.convert.ConversionService service)
service - conversion servicepublic final void start()
start in interface org.springframework.context.Lifecyclepublic final void stop()
stop in interface org.springframework.context.Lifecyclepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecycleprotected boolean shouldReload()
shouldReload in class AbstractReloadableService<T>protected void doReload()
doReload in class AbstractReloadableService<T>protected void doDestroy()
doDestroy in class AbstractReloadableService<T>public ServiceableComponent<T> getServiceableComponent()
getServiceableComponent in interface ReloadableService<T>public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext in interface org.springframework.context.ApplicationContextAwarepublic void setBeanName(@Nonnull @NotEmpty String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwareprotected void doInitialize()
throws ComponentInitializationException
doInitialize in class AbstractReloadableService<T>ComponentInitializationExceptionCopyright © 1999–2019 Shibboleth Consortium. All rights reserved.