public class IdPPropertiesApplicationContextInitializer extends Object implements org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>
ApplicationContextInitializer which appends properties to the application context's environment.
Properties are loaded from IDP_PROPERTIES as well as additional property files specified by
IDP_ADDITIONAL_PROPERTY.
The IDP_PROPERTIES file is searched for in the well known locations returned by
getSearchLocations().
The IDP_HOME_PROPERTY will be set to the first search location in which the IDP_PROPERTIES file is
found if not already set.
A ConstraintViolationException will be thrown if the property files can not be found or loaded and
isFailFast(ConfigurableApplicationContext) returns true.| Modifier and Type | Field and Description |
|---|---|
static String |
FAILFAST_PROPERTY
Property controlling whether to fail fast.
|
static String |
IDP_ADDITIONAL_PROPERTY
Property that points to more property sources.
|
static String |
IDP_HOME_PROPERTY
IdP home property.
|
static String |
IDP_PROPERTIES
Target resource to be searched for.
|
private org.slf4j.Logger |
log
Class logger.
|
static String |
SEARCH_LOCATION
Well known search location.
|
static String[] |
SEARCH_LOCATIONS
Deprecated.
|
| Constructor and Description |
|---|
IdPPropertiesApplicationContextInitializer() |
| Modifier and Type | Method and Description |
|---|---|
void |
appendPropertySource(org.springframework.context.ConfigurableApplicationContext applicationContext,
String name,
Properties properties)
Add property source to the application context environment with lowest precedence.
|
String[] |
getSearchLocations()
Deprecated.
In a future version a similar method will return one value
|
String |
getSearchTarget()
Get the target resource to be searched for.
|
void |
initialize(org.springframework.context.ConfigurableApplicationContext applicationContext) |
boolean |
isFailFast(org.springframework.context.ConfigurableApplicationContext applicationContext)
Whether we fail immediately if the config is bogus.
|
void |
loadAdditionalPropertySources(org.springframework.context.ConfigurableApplicationContext applicationContext,
String searchLocation,
Properties properties)
Load additional property sources.
|
Properties |
loadProperties(Properties sink,
org.springframework.core.io.Resource resource)
Load properties from the resource.
|
void |
logProperties(Properties properties)
Log property names and values at debug level, suppressing properties whose name matches 'password'.
|
String |
normalizePath(String path)
Deprecated.
|
String[] |
selectSearchLocations(org.springframework.context.ConfigurableApplicationContext applicationContext)
Deprecated.
in future versions there will only be one location returned. This method is not available yet since
the code cannot coexist with the legacy. See IDP-999 and IDP-991
|
void |
setIdPHomeProperty(String path,
Properties properties)
Set the
IDP_HOME_PROPERTY property to the given path if not already set. |
@Nonnull @NotEmpty public static final String IDP_HOME_PROPERTY
@Nonnull @NotEmpty public static final String IDP_ADDITIONAL_PROPERTY
@Nonnull public static final String IDP_PROPERTIES
@Nonnull public static final String SEARCH_LOCATION
@Nonnull @Deprecated public static final String[] SEARCH_LOCATIONS
@Nonnull public static final String FAILFAST_PROPERTY
@Nonnull private final org.slf4j.Logger log
public IdPPropertiesApplicationContextInitializer()
public void initialize(@Nonnull org.springframework.context.ConfigurableApplicationContext applicationContext)
initialize in interface org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>@Nonnull public String getSearchTarget()
IDP_PROPERTIES.@Nonnull @Deprecated public String[] getSearchLocations()
SEARCH_LOCATIONS.@Nonnull @Deprecated public String[] selectSearchLocations(@Nonnull org.springframework.context.ConfigurableApplicationContext applicationContext)
IDP_HOME_PROPERTY in the application context. Defaults to the well-known search locations returned from
getSearchLocations().applicationContext - the application contextConstraintViolationException - if the user-defined search location is empty or ends with '/' and
isFailFast(ConfigurableApplicationContext) is true@Nullable public Properties loadProperties(@Nullable Properties sink, @Nonnull org.springframework.core.io.Resource resource)
sink - if non-null use this instance as the targetresource - the resourcenull if loading failedpublic void loadAdditionalPropertySources(@Nonnull org.springframework.context.ConfigurableApplicationContext applicationContext, @Nonnull String searchLocation, @Nonnull Properties properties)
IDP_ADDITIONAL_PROPERTY, and are resolved
relative to the given search location.applicationContext - the application contextsearchLocation - the location from which additional property sources are resolvedproperties - the properties to be filled with additional property sourcesConstraintViolationException - if an error occurs loading the additional property sources and
isFailFast(ConfigurableApplicationContext) is truepublic void logProperties(@Nonnull Properties properties)
properties - the properties to logpublic void appendPropertySource(@Nonnull org.springframework.context.ConfigurableApplicationContext applicationContext, @Nonnull String name, @Nonnull Properties properties)
applicationContext - the application contextname - the name of the property source to be added to the application contextproperties - the properties added to the application context@Deprecated @Nonnull public String normalizePath(@Nonnull String path)
StringUtils.cleanPath(String).path - the input pathpublic void setIdPHomeProperty(@Nonnull String path, @Nonnull Properties properties)
IDP_HOME_PROPERTY property to the given path if not already set.path - the property valueproperties - the propertiespublic boolean isFailFast(@Nonnull org.springframework.context.ConfigurableApplicationContext applicationContext)
FAILFAST_PROPERTY.applicationContext - the application contextCopyright © 1999–2018 Shibboleth Consortium. All rights reserved.