The Meta-Environment API

toolbus.viewer
Class ScriptCodeStore

java.lang.Object
  extended by 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

Field Summary
private  toolbus.util.collections.ConcurrentHashMap<java.lang.String,byte[]> scriptCodeCache
           
private  ToolBus toolbus
           
 
Constructor Summary
ScriptCodeStore(ToolBus toolbus)
          Constructor.
 
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
 

Field Detail

toolbus

private final ToolBus toolbus

scriptCodeCache

private final toolbus.util.collections.ConcurrentHashMap<java.lang.String,byte[]> scriptCodeCache
Constructor Detail

ScriptCodeStore

public ScriptCodeStore(ToolBus toolbus)
Constructor.

Parameters:
toolbus - The ToolBus with which this store will be associated.
Method Detail

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).

The Meta-Environment API