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 |
HELP_INSTALLER_PROVIDER_DESCRIPTION, HELP_INSTALLER_PROVIDER_NAME, INSTALLER_PROVIDER_DESCRIPTION, INSTALLER_PROVIDER_NAME, UNIT_DIALOG, UNIT_EXTERNALFILE, UNIT_FOLDER, UNIT_SCRIPT
Constructor and Description |
---|
DefaultScriptingManager() |
DefaultScriptingManager(ClassLoader classLoader) |
Modifier and Type | Method and Description |
---|---|
void |
addAlternativeUserFolder(File f,
String name,
String description) |
void |
addLibFolder(File lib) |
ScriptingDialog |
createDialog(ScriptingFolder folder,
String id) |
ScriptEngine |
createEngineByLanguage(String langName) |
ScriptingExternalFile |
createExternalFile(ScriptingFolder folder,
String id) |
ScriptingFolder |
createFolder(ScriptingFolder folder,
String id) |
ScriptingScript |
createScript(ScriptingFolder folder,
String id) |
Script |
createScript(String name,
String code,
String languaje) |
ScriptingUnit |
createUnit(String unitType,
ScriptingFolder folder,
String id) |
ScriptingUnit |
createUnit(String unitType,
ScriptingFolder folder,
String id,
String language) |
Object |
get(String key)
Retrieves a value set in the state of this ScriptingManager
|
List<ScriptingFolder> |
getAlternativeUserFolders() |
ScriptEngine |
getEngineByLanguage(String langName) |
ScriptEngineFactory |
getEngineFactoryByLanguage(String langName) |
protected ScriptEngineManager |
getEngineManager() |
String |
getEngineNameByLanguage(String langName) |
Map |
getExtendedProperties()
Returns a hash map with all new properties associated to this layer.
|
String |
getExtensionOfLanguage(String langName) |
ScriptingFolder |
getFolder(File file)
Returns the
ScriptingFolder associated with the file specified |
ProviderFactory |
getHelpInstallerFactory() |
ScriptingHelpManager |
getHelpManager()
Gets the Help manager
|
File |
getHomeFolder() |
ImageIcon |
getIcon(String name) |
ProviderFactory |
getInstallerFactory() |
String |
getLanguageOfExtension(String extension) |
List<File> |
getLibFolders() |
Map<String,String> |
getLibFoldersVersions()
Return a map with the label and suffix of the library versions.
|
File |
getPackagesFolder()
Devuelbe la carpeta en la que se encuentran los paquetes
de la aplicacion.
|
Object |
getProperty(Object key)
Returns a reference to an object (property) associated to this layer.
|
File |
getRootUserFolder() |
ScriptingBaseScript |
getScript(File file)
Returns the
ScriptingBaseScript associated with the file
specified |
ScriptingBaseScript |
getScript(String name) |
List<String> |
getSupportedLanguages() |
ScriptingFolder |
getSystemFolder()
Returns the System's Folder
|
List<DefaultScriptingManager.RegisterSystemFolder> |
getSystemFolders() |
ScriptingUnit |
getUnit(File file) |
List<String> |
getUnitTypes() |
ScriptingFolder |
getUserFolder()
Returns the User's Folder
|
void |
loadEngines()
Search the available engines and initializa the manager.
|
void |
put(String key,
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 |
registerSystemFolder(String name,
File folder)
Registers a File System with
ScriptingUnit s in the SystemFolder |
void |
setHomeFolder(File home) |
void |
setPackagesFolder(File folder)
Establece la carpeta en la que se encuentran los paquetes
de la aplicacion.
|
void |
setProperty(Object key,
Object val)
Inserts an object as a property to this layer.
|
boolean |
validateUnitId(ScriptingFolder folder,
String id)
Checks if an id is unique in a determinate folder
|
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 createEngineByLanguage(String langName)
public ScriptEngine getEngineByLanguage(String langName)
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 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