toolbus.viewer
Class ScriptCodeStore
java.lang.Object
toolbus.viewer.ScriptCodeStore
public class ScriptCodeStore
- extends java.lang.Object
This store provides access to all, for the ToolBus, reachable source code. Additionally it
caches the already loaded code.
- Author:
- Arnold Lankamp
Method Summary |
byte[] |
getCode(java.lang.String scriptPath)
Retrieves the source code of the script indicated by the given path. |
java.lang.String[] |
getScriptNames()
Returns the list of absolute paths to all, for the ToolBus, reachable scripts. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
toolbus
private final ToolBus toolbus
scriptCodeCache
private final toolbus.util.collections.ConcurrentHashMap<java.lang.String,byte[]> scriptCodeCache
ScriptCodeStore
public ScriptCodeStore(ToolBus toolbus)
- Constructor.
- Parameters:
toolbus
- The ToolBus with which this store will be associated.
getScriptNames
public java.lang.String[] getScriptNames()
- Returns the list of absolute paths to all, for the ToolBus, reachable scripts. Returns null
in case the scripts haven't been parsed yet.
- Returns:
- The list of absolute paths to all, for the ToolBus, reachable scripts; null in case
the scripts haven't been parsed yet.
getCode
public byte[] getCode(java.lang.String scriptPath)
throws java.io.IOException
- Retrieves the source code of the script indicated by the given path.
- Parameters:
scriptPath
- The path to the script we want to load.
- Returns:
- The retrieved source code of the script.
- Throws:
java.io.IOException
- Thrown when something I/O related goes wrong (obviously).