public class ScriptProcessorRegistry extends Object
If no processors are registered, the default script processor is the javascript processor.
| Constructor and Description |
|---|
ScriptProcessorRegistry() |
| Modifier and Type | Method and Description |
|---|---|
String |
findValidScriptPath(String path)
Returns a variation on the provided path that exists and
is processable by one of the processors in this registry.
|
protected ScriptProcessor |
getDefaultScriptProcessor()
Gets the default script processor.
|
String |
getExtensionForProcessor(ScriptProcessor scriptProcessor)
Gets the extension for given processor.
|
String[] |
getRegisteredExtensions()
Returns the extensions with registered processors
|
ScriptProcessor |
getScriptProcessor(ScriptContent scriptContent)
Returns the best fit script processor for the given script
content object.
|
ScriptProcessor |
getScriptProcessor(String path)
Returns the script processor that matches the file
extension for the given path.
|
ScriptProcessor |
getScriptProcessorByExtension(String extension)
Gets the script processor registered for the given extension
|
void |
registerScriptProcessor(ScriptProcessor scriptProcessor)
Registers a script processor
|
void |
registerScriptProcessor(ScriptProcessor scriptProcessor,
String extension,
String name)
Registers a script processor
|
void |
reset()
Resets all of the registered script processors
|
void |
setDefaultScriptProcessor(String defaultScriptProcessorName)
Sets the name of the default script processor
|
public void setDefaultScriptProcessor(String defaultScriptProcessorName)
defaultScriptProcessorName - the name of the default script processorpublic void registerScriptProcessor(ScriptProcessor scriptProcessor)
scriptProcessor - the script processor to registerpublic void registerScriptProcessor(ScriptProcessor scriptProcessor, String extension, String name)
scriptProcessor - the script processor to registerextension - Stringname - Stringprotected ScriptProcessor getDefaultScriptProcessor()
public ScriptProcessor getScriptProcessor(String path)
path - the pathpublic ScriptProcessor getScriptProcessor(ScriptContent scriptContent)
scriptContent - ScriptContentpublic ScriptProcessor getScriptProcessorByExtension(String extension)
extension - the extensionpublic String findValidScriptPath(String path)
First attempts to find a script processor that contains the content located at the given path (using extension information, if available).
If no match is found, iterates over the file extensions and attempts to find a match.
Path can therefore be values like:
testfile.js
- matches to file testfile.js using javascript procesor
testfile
- matches for all extensions, potentially looking at
testfile.js, testfile.groovy, etc.
The extension annotated path is returned which will correctly
dispatch to the discovered processor.path - the pathpublic String[] getRegisteredExtensions()
public String getExtensionForProcessor(ScriptProcessor scriptProcessor)
scriptProcessor - the script processorpublic void reset()
Copyright © 2005–2018 Alfresco Software. All rights reserved.