Package net.shibboleth.profile.module
Class PropertyDrivenModule
java.lang.Object
net.shibboleth.profile.module.AbstractModule
net.shibboleth.profile.module.PropertyDrivenModule
- All Implemented Interfaces:
Module,Component,IdentifiedComponent
Implementation of
Module relying on Java Properties.- Since:
- 9.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from class net.shibboleth.profile.module.AbstractModule
AbstractModule.BasicModuleResourceNested classes/interfaces inherited from interface net.shibboleth.profile.module.Module
Module.ModuleResource, Module.ResourceResult -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault name of module properties resource.Available message locales.private org.slf4j.LoggerClass logger.static final StringSuffix of property for module description.static final StringSuffix of property for resource destination.static final StringSuffix of property for resource executability.static final StringSuffix of property for module languages.static final StringSuffix of property for module name.static final StringSuffix of property for resource non-Windows applicability.static final StringSuffix of property for resource optionality.static final StringSuffix of property for module plugin owner.static final StringSuffix of property for module post-disable message.static final StringSuffix of property for module post-enable message.static final StringSuffix of property for resource replacement.static final StringSuffix of property for resource source.static final StringSuffix of property for module URL.static final StringSuffix of property for resource Windows applicability.private StringModule ID.private StringModule name.private final PropertiesProperties describing module.private StringModule URL.private StringPlugin ID.private booleanWhether to require an HTTP client. -
Constructor Summary
ConstructorsConstructorDescriptionPropertyDrivenModule(String version, InputStream inputStream) Constructor.PropertyDrivenModule(String version, Class<? extends Module> claz) Constructor.PropertyDrivenModule(String version, Properties properties) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondisable(ModuleContext moduleContext, boolean clean) Disable the module.enable(ModuleContext moduleContext) Enable the module.getDescription(ModuleContext moduleContext) Gets module description.getId()getName(ModuleContext moduleContext) Gets module name.Gets the plugin name of the module's owner, if the module is provided by a plugin.getURL()Gets module URL.booleanGets whether module enablement requires access to anHttpClient.protected voidload()Load module information from properties.voidSet the module URL.Methods inherited from class net.shibboleth.profile.module.AbstractModule
equals, getResources, hashCode, isEnabled, setResources, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.shibboleth.profile.module.Module
getNewExtension, getResources, getSaveExtension, isEnabled
-
Field Details
-
DEFAULT_RESOURCE
Default name of module properties resource.- See Also:
-
MODULE_NAME_PROPERTY
Suffix of property for module name.- See Also:
-
MODULE_DESC_PROPERTY
Suffix of property for module description.- See Also:
-
MODULE_URL_PROPERTY
Suffix of property for module URL.- See Also:
-
MODULE_PLUGIN_PROPERTY
Suffix of property for module plugin owner.- See Also:
-
MODULE_SRC_PROPERTY
Suffix of property for resource source.- See Also:
-
MODULE_DEST_PROPERTY
Suffix of property for resource destination.- See Also:
-
MODULE_REPLACE_PROPERTY
Suffix of property for resource replacement.- See Also:
-
MODULE_OPTIONAL_PROPERTY
Suffix of property for resource optionality.- See Also:
-
MODULE_EXEC_PROPERTY
Suffix of property for resource executability.- See Also:
-
MODULE_WINDOWS_PROPERTY
Suffix of property for resource Windows applicability.- See Also:
-
MODULE_NONWINDOWS_PROPERTY
Suffix of property for resource non-Windows applicability.- See Also:
-
MODULE_POSTENABLE_PROPERTY
Suffix of property for module post-enable message.- See Also:
-
MODULE_POSTDISABLE_PROPERTY
Suffix of property for module post-disable message.- See Also:
-
MODULE_LANGS_PROPERTY
Suffix of property for module languages.- See Also:
-
log
@Nonnull private org.slf4j.Logger logClass logger. -
moduleProperties
Properties describing module. -
moduleId
Module ID. -
moduleName
Module name. -
moduleURL
Module URL. -
pluginId
Plugin ID. -
locales
Available message locales. -
requireHttpClient
private boolean requireHttpClientWhether to require an HTTP client.
-
-
Constructor Details
-
PropertyDrivenModule
public PropertyDrivenModule(@Nullable String version, @Nonnull Class<? extends Module> claz) throws IOException, ModuleException Constructor.- Parameters:
claz- type of object used to locate default module.properties resourceversion- version of the containing application (or null if none available)- Throws:
IOException- if unable to read fileModuleException- if the module is not in a valid state
-
PropertyDrivenModule
public PropertyDrivenModule(@Nullable String version, @Nonnull InputStream inputStream) throws IOException, ModuleException Constructor.- Parameters:
inputStream- property streamversion- version of the containing application (or null if none available)- Throws:
IOException- if unable to read fileModuleException- if the module is not in a valid state
-
PropertyDrivenModule
public PropertyDrivenModule(@Nullable String version, @Nonnull Properties properties) throws ModuleException Constructor.- Parameters:
properties- property setversion- version of the containing application (or null if none available)- Throws:
ModuleException- if the module is not in a valid state
-
-
Method Details
-
load
Load module information from properties.- Throws:
ModuleException- on errors
-
getId
- Specified by:
getIdin interfaceIdentifiedComponent
-
getName
Gets module name. -
getDescription
Gets module description.- Specified by:
getDescriptionin interfaceModule- Parameters:
moduleContext- optional context for supplying i18n input- Returns:
- a human-readable description for the module
-
getURL
Gets module URL. -
setURL
Set the module URL.- Parameters:
url- URL to set
-
getOwnerId
Gets the plugin name of the module's owner, if the module is provided by a plugin.- Specified by:
getOwnerIdin interfaceModule- Returns:
- plugin ID, if any
-
isHttpClientRequired
public boolean isHttpClientRequired()Gets whether module enablement requires access to anHttpClient.- Specified by:
isHttpClientRequiredin interfaceModule- Returns:
- true iff enabling the module requires HTTP client
-
enable
@Nonnull @Unmodifiable @NotLive public Map<Module.ModuleResource,Module.ResourceResult> enable(@Nonnull ModuleContext moduleContext) throws ModuleException Enable the module.This operation MUST be idempotent.
- Specified by:
enablein interfaceModule- Overrides:
enablein classAbstractModule- Parameters:
moduleContext- module context- Returns:
- summary of resource results
- Throws:
ModuleException- if not successful
-
disable
@Nonnull @Unmodifiable @NotLive public Map<Module.ModuleResource,Module.ResourceResult> disable(@Nonnull ModuleContext moduleContext, boolean clean) throws ModuleException Disable the module.This operation MUST be idempotent with respect to the value of the input parameter.
- Specified by:
disablein interfaceModule- Overrides:
disablein classAbstractModule- Parameters:
moduleContext- module contextclean- if true, the module should attempt to fully remove traces of previous use in a potentially destructive fashion- Returns:
- summary of resource results
- Throws:
ModuleException- if not successful
-