public class DefaultScriptingManager extends java.lang.Object implements ScriptingManager
Modifier and Type | Class and Description |
---|---|
static class |
DefaultScriptingManager.RegisterSystemFolder |
Modifier and Type | Field and Description |
---|---|
protected javax.script.ScriptEngineManager |
engineManager |
protected java.util.Map<java.lang.String,javax.swing.ImageIcon> |
icons |
protected java.util.List<DefaultScriptingManager.RegisterSystemFolder> |
systemFolders |
DEFAULT_ISOLATION_GROUP, INSTALLER_PROVIDER_DESCRIPTION, INSTALLER_PROVIDER_NAME, PYTHON_LANGUAGE_NAME, UNIT_DIALOG, UNIT_EXTERNALFILE, UNIT_FOLDER, UNIT_SCRIPT
Constructor and Description |
---|
DefaultScriptingManager() |
DefaultScriptingManager(java.lang.ClassLoader classLoader) |
Modifier and Type | Method and Description |
---|---|
void |
addAlternativeUserFolder(java.io.File f,
java.lang.String name,
java.lang.String description) |
void |
addLibFolder(java.io.File lib) |
void |
addLink(java.io.File source,
java.io.File target) |
ScriptingDialog |
createDialog(ScriptingFolder folder,
java.lang.String id) |
Evaluator |
createEvaluator(java.lang.String expression) |
ScriptingExternalFile |
createExternalFile(ScriptingFolder folder,
java.lang.String id) |
ScriptingFolder |
createFolder(ScriptingFolder folder,
java.lang.String id) |
ScriptingFolder |
createLink(java.lang.String name,
java.io.File link,
java.lang.String targetPathName) |
ScriptingFolder |
createLink(java.lang.String name,
ScriptingFolder link,
java.lang.String targetPathName) |
ScriptingScript |
createScript(ScriptingFolder folder,
java.lang.String id) |
Script |
createScript(java.lang.String name,
java.lang.String code,
java.lang.String languaje) |
ScriptingUnit |
createUnit(java.lang.String unitType,
ScriptingFolder folder,
java.lang.String id) |
ScriptingUnit |
createUnit(java.lang.String unitType,
ScriptingFolder folder,
java.lang.String id,
java.lang.String language) |
java.lang.Object |
get(java.lang.String key)
Retrieves a value set in the state of this ScriptingManager
|
java.util.List<ScriptingFolder> |
getAlternativeUserFolders() |
java.io.File |
getDataFolder(java.lang.String id) |
javax.script.ScriptEngine |
getEngineByLanguage(java.lang.String langName) |
javax.script.ScriptEngine |
getEngineByLanguage(java.lang.String langName,
java.lang.String isolationGroup) |
javax.script.ScriptEngineFactory |
getEngineFactoryByLanguage(java.lang.String langName) |
protected javax.script.ScriptEngineManager |
getEngineManager() |
java.lang.String |
getEngineNameByLanguage(java.lang.String langName) |
java.util.Set<java.lang.String> |
getEnginesIsolationGroups() |
java.util.Map |
getExtendedProperties()
Returns a hash map with all new properties associated to this layer.
|
java.lang.String |
getExtensionOfLanguage(java.lang.String langName) |
ScriptingFolder |
getFolder(java.io.File file)
Returns the
ScriptingFolder associated with the file specified |
java.io.File |
getHomeFolder() |
javax.swing.ImageIcon |
getIcon(java.lang.String name) |
ProviderFactory |
getInstallerFactory() |
java.lang.String |
getLanguageOfExtension(java.lang.String extension) |
java.util.List<java.io.File> |
getLibFolders() |
java.util.Map<java.lang.String,java.lang.String> |
getLibFoldersVersions()
Return a map with the label and suffix of the library versions.
|
java.io.File |
getLinkSource(java.io.File target) |
java.io.File |
getPackagesFolder()
Devuelbe la carpeta en la que se encuentran los paquetes
de la aplicacion.
|
java.lang.Object |
getProperty(java.lang.Object key)
Returns a reference to an object (property) associated to this layer.
|
java.io.File |
getRootUserFolder() |
ScriptingBaseScript |
getScript(java.io.File file)
Returns the
ScriptingBaseScript associated with the file
specified |
ScriptingBaseScript |
getScript(java.lang.String name) |
java.util.List<java.lang.String> |
getSupportedLanguages() |
ScriptingFolder |
getSystemFolder()
Returns the System's Folder
|
java.util.List<DefaultScriptingManager.RegisterSystemFolder> |
getSystemFolders() |
ScriptingUnit |
getUnit(java.io.File file) |
ScriptingUnit |
getUnit(java.lang.String pathName)
Return the
ScriptingUnit associated with the path specified. |
java.util.List<java.lang.String> |
getUnitTypes() |
ScriptingFolder |
getUserFolder()
Returns the User's Folder
|
boolean |
isInUserFolder(java.io.File f) |
void |
loadEngines()
Search the available engines and initialize the manager.
|
Script |
loadScript(ResourcesStorage storage,
java.lang.String name) |
Script |
loadScript(java.net.URI uri) |
Script |
locateScript(java.lang.String name) |
void |
put(java.lang.String key,
java.lang.Object value)
Sets a key/value pair in the state of the ScriptingManager that may
either create a Java Language Binding to be used in the execution of
scripts
|
void |
registerDataFolder(ScriptingFolder folderScript,
java.lang.String id) |
void |
registerSystemFolder(java.lang.String name,
java.io.File folder)
Registers a File System with
ScriptingUnit s in the SystemFolder |
java.util.List<DataFolderFound> |
searchOldVersions(Version currentVersion,
FolderSet folder) |
void |
setHomeFolder(java.io.File home) |
void |
setPackagesFolder(java.io.File folder)
Establece la carpeta en la que se encuentran los paquetes
de la aplicacion.
|
void |
setProperty(java.lang.Object key,
java.lang.Object val)
Inserts an object as a property to this layer.
|
boolean |
validateUnitId(ScriptingFolder folder,
java.lang.String id)
Checks if an id is unique in a determinate folder
|
protected java.util.Map<java.lang.String,javax.swing.ImageIcon> icons
protected java.util.List<DefaultScriptingManager.RegisterSystemFolder> systemFolders
protected javax.script.ScriptEngineManager engineManager
public DefaultScriptingManager()
public DefaultScriptingManager(java.lang.ClassLoader classLoader)
public java.lang.Object getProperty(java.lang.Object key)
ScriptingManager
Returns a reference to an object (property) associated to this layer.
For example, you can attach a network definition to key "network" and check if a layer has a network loaded using getAssociatedObject("network") and that it's not null.
getProperty
in interface ScriptingManager
key
- the key associated to the propertynull
if key is not foundScriptingManager.getExtendedProperties()
,
ScriptingManager.setProperty(Object, Object)
public void setProperty(java.lang.Object key, java.lang.Object val)
ScriptingManager
setProperty
in interface ScriptingManager
key
- the key associated to the propertyval
- the propertyScriptingManager.getProperty(Object)
,
ScriptingManager.getExtendedProperties()
public java.util.Map getExtendedProperties()
ScriptingManager
getExtendedProperties
in interface ScriptingManager
ScriptingManager.getProperty(Object)
,
ScriptingManager.setProperty(Object, Object)
public java.io.File getHomeFolder()
getHomeFolder
in interface ScriptingManager
public void setHomeFolder(java.io.File home)
setHomeFolder
in interface ScriptingManager
public java.io.File getDataFolder(java.lang.String id)
getDataFolder
in interface ScriptingManager
public void registerDataFolder(ScriptingFolder folderScript, java.lang.String id)
registerDataFolder
in interface ScriptingManager
public java.util.List<DataFolderFound> searchOldVersions(Version currentVersion, FolderSet folder)
searchOldVersions
in interface ScriptingManager
protected javax.script.ScriptEngineManager getEngineManager()
public void loadEngines()
ScriptingManager
loadEngines
in interface ScriptingManager
public javax.swing.ImageIcon getIcon(java.lang.String name)
public java.lang.String getEngineNameByLanguage(java.lang.String langName)
getEngineNameByLanguage
in interface ScriptingManager
public javax.script.ScriptEngine getEngineByLanguage(java.lang.String langName)
public javax.script.ScriptEngine getEngineByLanguage(java.lang.String langName, java.lang.String isolationGroup)
public java.util.Set<java.lang.String> getEnginesIsolationGroups()
getEnginesIsolationGroups
in interface ScriptingManager
public javax.script.ScriptEngineFactory getEngineFactoryByLanguage(java.lang.String langName)
public boolean validateUnitId(ScriptingFolder folder, java.lang.String id)
ScriptingManager
validateUnitId
in interface ScriptingManager
folder
- {id
- String with the id to validateScriptingUnit
with the same
id, and false in the other casepublic ScriptingScript createScript(ScriptingFolder folder, java.lang.String id)
public Script createScript(java.lang.String name, java.lang.String code, java.lang.String languaje)
createScript
in interface ScriptManager
public ScriptingDialog createDialog(ScriptingFolder folder, java.lang.String id)
public ScriptingFolder createFolder(ScriptingFolder folder, java.lang.String id)
public ScriptingExternalFile createExternalFile(ScriptingFolder folder, java.lang.String id)
public ScriptingBaseScript getScript(java.io.File file)
ScriptingManager
ScriptingBaseScript
associated with the file
specifiedgetScript
in interface ScriptingManager
file
- File where is contained the ScriptingBaseScript
's
informationScriptingBaseScript
public Script loadScript(java.net.URI uri)
loadScript
in interface ScriptManager
public Script loadScript(ResourcesStorage storage, java.lang.String name)
loadScript
in interface ScriptManager
public ScriptingFolder getFolder(java.io.File file)
ScriptingManager
ScriptingFolder
associated with the file specifiedgetFolder
in interface ScriptingManager
file
- File where is contained the ScriptingFolder
's
informationScriptingFolder
public ScriptingUnit getUnit(java.lang.String pathName)
ScriptingManager
ScriptingUnit
associated with the path specified.
the path should start with "User" or "System".getUnit
in interface ScriptingManager
ScriptingUnit
public ScriptingUnit getUnit(java.io.File file)
public ScriptingFolder getSystemFolder()
ScriptingManager
getSystemFolder
in interface ScriptingManager
ScriptingFolder
with the System's Folder.public ScriptingFolder getUserFolder()
ScriptingManager
getUserFolder
in interface ScriptingManager
ScriptingFolder
with the User's Folder.public ScriptingBaseScript getScript(java.lang.String name)
getScript
in interface ScriptingManager
public Script locateScript(java.lang.String name)
locateScript
in interface ScriptManager
public java.io.File getRootUserFolder()
getRootUserFolder
in interface ScriptingManager
public void registerSystemFolder(java.lang.String name, java.io.File folder)
ScriptingManager
ScriptingUnit
s in the SystemFolderregisterSystemFolder
in interface ScriptingManager
name
- String with the identificator name of the File System
registeredfolder
- File with the root of the File System to registerpublic java.util.List<DefaultScriptingManager.RegisterSystemFolder> getSystemFolders()
public java.util.List<ScriptingFolder> getAlternativeUserFolders()
getAlternativeUserFolders
in interface ScriptingManager
public void addAlternativeUserFolder(java.io.File f, java.lang.String name, java.lang.String description)
addAlternativeUserFolder
in interface ScriptingManager
public java.lang.String getExtensionOfLanguage(java.lang.String langName)
getExtensionOfLanguage
in interface ScriptingManager
public java.util.List<java.lang.String> getSupportedLanguages()
getSupportedLanguages
in interface ScriptingManager
public java.lang.String getLanguageOfExtension(java.lang.String extension)
public java.lang.Object get(java.lang.String key)
ScriptingManager
get
in interface ScriptingManager
key
- The key whose value is to be returnedpublic void put(java.lang.String key, java.lang.Object value)
ScriptingManager
put
in interface ScriptingManager
key
- The name of named value to addvalue
- The value of named value to add.public ScriptingUnit createUnit(java.lang.String unitType, ScriptingFolder folder, java.lang.String id)
createUnit
in interface ScriptingManager
public ScriptingUnit createUnit(java.lang.String unitType, ScriptingFolder folder, java.lang.String id, java.lang.String language)
createUnit
in interface ScriptingManager
public java.util.List<java.lang.String> getUnitTypes()
getUnitTypes
in interface ScriptingManager
public void addLibFolder(java.io.File lib)
addLibFolder
in interface ScriptingManager
public java.util.List<java.io.File> getLibFolders()
getLibFolders
in interface ScriptingManager
public java.util.Map<java.lang.String,java.lang.String> getLibFoldersVersions()
ScriptingManager
getLibFoldersVersions
in interface ScriptingManager
public ProviderFactory getInstallerFactory()
getInstallerFactory
in interface ScriptingManager
public java.io.File getPackagesFolder()
ScriptingManager
getPackagesFolder
in interface ScriptingManager
public void setPackagesFolder(java.io.File folder)
ScriptingManager
setPackagesFolder
in interface ScriptingManager
public ScriptingFolder createLink(java.lang.String name, java.io.File link, java.lang.String targetPathName)
createLink
in interface ScriptingManager
public ScriptingFolder createLink(java.lang.String name, ScriptingFolder link, java.lang.String targetPathName)
createLink
in interface ScriptingManager
public void addLink(java.io.File source, java.io.File target)
public java.io.File getLinkSource(java.io.File target)
public boolean isInUserFolder(java.io.File f)
public Evaluator createEvaluator(java.lang.String expression)
createEvaluator
in interface ScriptManager