Class StaticConfigurableScriptBinding
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.core.ui.script.StaticConfigurableScriptBinding
- All Implemented Interfaces:
ScriptBinding
,LogEnabled
,PluginAware
,Configurable
,Contextualizable
,Serviceable
- Direct Known Subclasses:
CmsScriptBinding
,RepositoryScriptBinding
,RuntimeScriptBinding
,WebScriptBinding
public class StaticConfigurableScriptBinding
extends AbstractLogEnabled
implements ScriptBinding, Configurable, Serviceable, PluginAware, Contextualizable
Static implementation of the ScriptBinding that can read the functions from an xml file
-
Field Summary
Modifier and TypeFieldDescriptionprotected Context
The avalon contextList of functions per configuration fileprotected Map<String,
ScriptBindingDocumentation> List of function descriptionsprotected String
The plugin nameprotected SourceResolver
Source Resolverprotected Map<I18nizableText,
ScriptBindingDocumentation> List of tutorialsprotected Map<String,
ScriptBindingDocumentation> List of variable descriptionsList of variables per configuration fileprotected Pattern
The pattern corresponding to the script binding -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_configureFunctions
(String pluginName, String filePath, Configuration configuration) Configure the function partprotected void
_configureTutorials
(String pluginName, String filePath, Configuration configuration) Configure the tutorial partprotected void
_configureVariables
(String pluginName, String filePath, Configuration configuration) Configure the variable partvoid
cleanVariables
(Map<String, Object> variables) Allows clean up of variables created during the getVariables call.void
configure
(Configuration configuration) void
contextualize
(Context context) Returns the JavaScript functions to inject at the start of the script, in the form of a single String prepended to the script.Returns the list of functions descriptions, mapped by function name.Returns the list of tutorialsgetVariables
(ScriptExecArguments execArgs) Returns the list of variables this ScriptBinding provides, mapped by variable name.Returns the list of variables descriptions, mapped by variable name.Returns the JavaScript variables script to inject at the start of the script, in the form of a single String prepended to the script.Return the pattern of the workspace corresponding to this script binding.void
service
(ServiceManager manager) void
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.Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
_sourceResolver
Source Resolver -
_variablesScripts
List of variables per configuration file -
_functions
List of functions per configuration file -
_functionsDescriptions
List of function descriptions -
_variablesDescriptions
List of variable descriptions -
_pluginName
The plugin name -
_workspacePattern
The pattern corresponding to the script binding -
_context
The avalon context -
_tutorials
List of tutorials
-
-
Constructor Details
-
StaticConfigurableScriptBinding
public StaticConfigurableScriptBinding()
-
-
Method Details
-
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
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
_configureFunctions
protected void _configureFunctions(String pluginName, String filePath, Configuration configuration) throws ConfigurationException, IOException Configure the function part- Parameters:
pluginName
- Current pluginfilePath
- The conf file pathconfiguration
- the function- Throws:
IOException
- If an error occurredConfigurationException
- If an error occurred
-
_configureVariables
protected void _configureVariables(String pluginName, String filePath, Configuration configuration) throws ConfigurationException, IOException Configure the variable part- Parameters:
pluginName
- Current pluginfilePath
- The conf file pathconfiguration
- the variable- Throws:
IOException
- If an error occurredConfigurationException
- If an error occurred
-
_configureTutorials
protected void _configureTutorials(String pluginName, String filePath, Configuration configuration) throws ConfigurationException, IOException Configure the tutorial part- Parameters:
pluginName
- Current pluginfilePath
- The conf file pathconfiguration
- the tutorial- Throws:
IOException
- If an error occurredConfigurationException
- If an error occurred
-
getWorkspacePattern
Description copied from interface:ScriptBinding
Return the pattern of the workspace corresponding to this script binding.- Specified by:
getWorkspacePattern
in interfaceScriptBinding
- Returns:
- The pattern to match
-
getFunctions
Description copied from interface:ScriptBinding
Returns the JavaScript functions to inject at the start of the script, in the form of a single String prepended to the script.- Specified by:
getFunctions
in interfaceScriptBinding
- Returns:
- The functions text, or null if no function is provided.
-
getVariablesScripts
Description copied from interface:ScriptBinding
Returns the JavaScript variables script to inject at the start of the script, in the form of a single String prepended to the script.- Specified by:
getVariablesScripts
in interfaceScriptBinding
- Returns:
- The functions text, or null if no function is provided.
-
getFunctionsDescriptions
Description copied from interface:ScriptBinding
Returns the list of functions descriptions, mapped by function name. This list does not have to match the functions returned by getFunctions, but the description is used to inform the user of the existence and usability of each function.- Specified by:
getFunctionsDescriptions
in interfaceScriptBinding
- Returns:
- The list of functions descriptions, or null if no description is provided.
-
getTutorials
Description copied from interface:ScriptBinding
Returns the list of tutorials- Specified by:
getTutorials
in interfaceScriptBinding
- Returns:
- The list of tutorials, or null if no tutorial is provided.
-
getVariables
Description copied from interface:ScriptBinding
Returns the list of variables this ScriptBinding provides, mapped by variable name.- Specified by:
getVariables
in interfaceScriptBinding
- Parameters:
execArgs
- The The arguments for script execution- Returns:
- The list of variables, or null if no variable is provided.
-
getVariablesDescriptions
Description copied from interface:ScriptBinding
Returns the list of variables descriptions, mapped by variable name. This list does not have to match the getVariables return value, but the description is used to inform the user of the existence and usability of each variable.- Specified by:
getVariablesDescriptions
in interfaceScriptBinding
- Returns:
- The list of variables descriptions, or null if no description is provided.
-
cleanVariables
Description copied from interface:ScriptBinding
Allows clean up of variables created during the getVariables call.- Specified by:
cleanVariables
in interfaceScriptBinding
- Parameters:
variables
- The map of variables.
-