Package gda.jython
Class ScriptPaths
java.lang.Object
gda.jython.ScriptPaths
Implements a search path for Jython scripts, so the server and script
commands can find scripts without knowing whether they belong to the user,
the beamline or something else and without needing to know paths to the
script folders.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor provides an empty list of paths.ScriptPaths(List<ScriptProject> projects) Take a list of the script folder projects. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProject(ScriptProject scriptProject) Add the incomingScriptProjectobject to the projects collection if it's not already presentBuild a description containing the paths searched by this object.pathToScript(String script) Find a Jython script in this object's list of folders.voidsetProjects(List<ScriptProject> projects) Provide a new list of projects for this object to search.voidsetStartupScript(String startupScript) Set the script to be used on launch to initialise the Jython namespace.toString()A debugging description.
-
Constructor Details
-
ScriptPaths
public ScriptPaths()Default constructor provides an empty list of paths. -
ScriptPaths
Take a list of the script folder projects.- Parameters:
projects- The list of paths to script folders, with names and project types..
-
-
Method Details
-
setProjects
Provide a new list of projects for this object to search.- Parameters:
projects- A java.util.List of Jython script projects.
-
getProjects
-
setStartupScript
Set the script to be used on launch to initialise the Jython namespace.- Parameters:
startupScript- The full path to a Jython script.
-
pathToScript
Find a Jython script in this object's list of folders.- Parameters:
script- The name of the script, optionally without the ".py" extension.- Returns:
- The path to the script if it exists in one of this object's folders, or null if the script can't be found.
-
description
Build a description containing the paths searched by this object.- Returns:
- A comma-separated list of the paths used by this object.
-
toString
A debugging description. -
addProject
Add the incomingScriptProjectobject to the projects collection if it's not already present- Parameters:
scriptProject-
-