Package org.ametys.core.source
Class StaticOptionalSourceFallback
java.lang.Object
org.ametys.core.source.StaticOptionalSourceFallback
- All Implemented Interfaces:
OptionalSourceFallback
,PluginAware
,Component
,Configurable
public class StaticOptionalSourceFallback
extends Object
implements OptionalSourceFallback, Component, Configurable, PluginAware
A configurable static fallback for optional sources
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
A fallback static configuration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
applyFallbacks
(String uri, StaticOptionalSourceFallback.Fallbacks fallbacks) Apply the given fallbacks to an urivoid
configure
(Configuration configuration) configureFallbacks
(Configuration configuration, String baseUri) Configure fallbacks based upon a static xml configurationFallback to a default value if the uri is not supportedvoid
setPluginInfo
(String pluginName, String featureName, String id) Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.
-
Constructor Details
-
StaticOptionalSourceFallback
public StaticOptionalSourceFallback()
-
-
Method Details
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
setPluginInfo
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
configureFallbacks
public static StaticOptionalSourceFallback.Fallbacks configureFallbacks(Configuration configuration, String baseUri) throws ConfigurationException Configure fallbacks based upon a static xml configuration- Parameters:
configuration
- The configurationbaseUri
- The uri of the configuration. For example, if the configuration is in a plugin, should be the root of the plugin- Returns:
- The fallbacks configured
- Throws:
ConfigurationException
- If the configuration has issues
-
fallback
Description copied from interface:OptionalSourceFallback
Fallback to a default value if the uri is not supported- Specified by:
fallback
in interfaceOptionalSourceFallback
- Parameters:
uri
- The uri that is not supported- Returns:
- The fallback url if any or null otherwise
-
applyFallbacks
Apply the given fallbacks to an uri- Parameters:
uri
- The uri to considerfallbacks
- The fallbacks to applu- Returns:
- The fallback or null if no one apply
-