public class DefaultScriptingManager extends Object implements ScriptingManager
Modifier and Type | Class and Description |
---|---|
static class |
DefaultScriptingManager.RegisterSystemFolder |
Modifier and Type | Field and Description |
---|---|
protected ScriptEngineManager |
engineManager |
protected Map<String,ImageIcon> |
icons |
protected List<DefaultScriptingManager.RegisterSystemFolder> |
systemFolders |
DEFAULT_ISOLATION_GROUP, HELP_INSTALLER_PROVIDER_DESCRIPTION, HELP_INSTALLER_PROVIDER_NAME, INSTALLER_PROVIDER_DESCRIPTION, INSTALLER_PROVIDER_NAME, PYTHON_LANGUAGE_NAME, SCALA_LANGUAGE_NAME, UNIT_DIALOG, UNIT_EXTERNALFILE, UNIT_FOLDER, UNIT_SCRIPT
Constructor and Description |
---|
DefaultScriptingManager() |
DefaultScriptingManager(ClassLoader classLoader) |
protected List<DefaultScriptingManager.RegisterSystemFolder> systemFolders
protected ScriptEngineManager engineManager
public DefaultScriptingManager()
public DefaultScriptingManager(ClassLoader classLoader)
public Object getProperty(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(Object key, Object val)
ScriptingManager
setProperty
in interface ScriptingManager
key
- the key associated to the propertyval
- the propertyScriptingManager.getProperty(Object)
,
ScriptingManager.getExtendedProperties()
public Map getExtendedProperties()
ScriptingManager
getExtendedProperties
in interface ScriptingManager
ScriptingManager.getProperty(Object)
,
ScriptingManager.setProperty(Object, Object)
public File getHomeFolder()
getHomeFolder
in interface ScriptingManager
public void setHomeFolder(File home)
setHomeFolder
in interface ScriptingManager
protected ScriptEngineManager getEngineManager()
public void loadEngines()
ScriptingManager
loadEngines
in interface ScriptingManager
public String getEngineNameByLanguage(String langName)
getEngineNameByLanguage
in interface ScriptingManager
public ScriptEngine getEngineByLanguage(String langName)
public ScriptEngine getEngineByLanguage(String langName, String isolationGroup)
public Set<String> getEnginesIsolationGroups()
getEnginesIsolationGroups
in interface ScriptingManager
public ScriptEngineFactory getEngineFactoryByLanguage(String langName)
public boolean validateUnitId(ScriptingFolder folder, 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, String id)
public Script createScript(String name, String code, String languaje)
createScript
in interface ScriptManager
public ScriptingDialog createDialog(ScriptingFolder folder, String id)
public ScriptingFolder createFolder(ScriptingFolder folder, String id)
public ScriptingExternalFile createExternalFile(ScriptingFolder folder, String id)
public ScriptingBaseScript getScript(File file)
ScriptingManager
ScriptingBaseScript
associated with the file
specifiedgetScript
in interface ScriptingManager
file
- File where is contained the ScriptingBaseScript
's
informationScriptingBaseScript
public ScriptingFolder getFolder(File file)
ScriptingManager
ScriptingFolder
associated with the file specifiedgetFolder
in interface ScriptingManager
file
- File where is contained the ScriptingFolder
's
informationScriptingFolder
public ScriptingUnit getUnit(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(String name)
getScript
in interface ScriptingManager
public Script locateScript(String name)
locateScript
in interface ScriptManager
public File getRootUserFolder()
getRootUserFolder
in interface ScriptingManager
public void registerSystemFolder(String name, 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 List<DefaultScriptingManager.RegisterSystemFolder> getSystemFolders()
public List<ScriptingFolder> getAlternativeUserFolders()
getAlternativeUserFolders
in interface ScriptingManager
public void addAlternativeUserFolder(File f, String name, String description)
addAlternativeUserFolder
in interface ScriptingManager
public String getExtensionOfLanguage(String langName)
getExtensionOfLanguage
in interface ScriptingManager
public List<String> getSupportedLanguages()
getSupportedLanguages
in interface ScriptingManager
public Object get(String key)
ScriptingManager
get
in interface ScriptingManager
key
- The key whose value is to be returnedpublic void put(String key, Object value)
ScriptingManager
put
in interface ScriptingManager
key
- The name of named value to addvalue
- The value of named value to add.public ScriptingHelpManager getHelpManager()
ScriptingManager
getHelpManager
in interface ScriptingManager
ScriptingHelpManager
ScriptingHelpManager
public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id)
createUnit
in interface ScriptingManager
public ScriptingUnit createUnit(String unitType, ScriptingFolder folder, String id, String language)
createUnit
in interface ScriptingManager
public List<String> getUnitTypes()
getUnitTypes
in interface ScriptingManager
public void addLibFolder(File lib)
addLibFolder
in interface ScriptingManager
public List<File> getLibFolders()
getLibFolders
in interface ScriptingManager
public Map<String,String> getLibFoldersVersions()
ScriptingManager
getLibFoldersVersions
in interface ScriptingManager
public ProviderFactory getInstallerFactory()
getInstallerFactory
in interface ScriptingManager
public ProviderFactory getHelpInstallerFactory()
getHelpInstallerFactory
in interface ScriptingManager
public File getPackagesFolder()
ScriptingManager
getPackagesFolder
in interface ScriptingManager
public void setPackagesFolder(File folder)
ScriptingManager
setPackagesFolder
in interface ScriptingManager