Package gda.jython

Class ScriptPaths

java.lang.Object
gda.jython.ScriptPaths

public class ScriptPaths extends Object
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 Details

    • ScriptPaths

      public ScriptPaths()
      Default constructor provides an empty list of paths.
    • ScriptPaths

      public ScriptPaths(List<ScriptProject> projects)
      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

      public void setProjects(List<ScriptProject> projects)
      Provide a new list of projects for this object to search.
      Parameters:
      projects - A java.util.List of Jython script projects.
    • getProjects

      public List<ScriptProject> getProjects()
    • setStartupScript

      public void setStartupScript(String startupScript)
      Set the script to be used on launch to initialise the Jython namespace.
      Parameters:
      startupScript - The full path to a Jython script.
    • pathToScript

      public String pathToScript(String script)
      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

      public String description()
      Build a description containing the paths searched by this object.
      Returns:
      A comma-separated list of the paths used by this object.
    • toString

      public String toString()
      A debugging description.
      Overrides:
      toString in class Object
    • addProject

      public void addProject(ScriptProject scriptProject)
      Add the incoming ScriptProject object to the projects collection if it's not already present
      Parameters:
      scriptProject -