de.jreality.reader
Class ReaderBSH

java.lang.Object
  extended by de.jreality.reader.ReaderBSH
All Implemented Interfaces:
SceneReader

public class ReaderBSH
extends Object
implements SceneReader

Reader for bsh script files. It creates an bsh.Interpreter instance, see www.beanshell.org for details. In this instance there is a SceneGraphComponent registered as "root", to which the script should attatch the scene parts. Example script:

 a=new Appearance();
 a.setAttribute("plogonShader.diffuseColor", new java.awt.Color(77,66,44,72));
 root.setAppearance(a);
 root.setGeometry(new CatenoidHelicoid(10));
 
For security reasons, this reader sets up a SecurityManager and a restricting Policy for the codebase of the bsh.jar URL. For this to work the bsh jar must NOT be in the classpath. Pass the location of the bsh.jar file as System property, i.e.:
 -Djreality.bsh.jar=file:///opt/jars/bsh-1.3b2.jar
 

Author:
weissman

Constructor Summary
ReaderBSH()
           
 
Method Summary
 void appendInput(Input input)
          process the given Input in the current Instance.
 SceneGraphComponent getComponent()
          provides the root component for the scene that was read.
 void processReader(Reader in, PrintStream out, PrintStream err)
           
 void setInput(Input input)
          set the input to read the scene from
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReaderBSH

public ReaderBSH()
          throws Exception
Throws:
Exception
Method Detail

setInput

public void setInput(Input input)
              throws IOException
Description copied from interface: SceneReader
set the input to read the scene from

Specified by:
setInput in interface SceneReader
Parameters:
input - the Input of the resource to read.
Throws:
IOException

appendInput

public void appendInput(Input input)
                 throws IOException
process the given Input in the current Instance.

Parameters:
input - the Input to process
Throws:
IOException

processReader

public void processReader(Reader in,
                          PrintStream out,
                          PrintStream err)
                   throws Exception
Throws:
Exception

getComponent

public SceneGraphComponent getComponent()
Description copied from interface: SceneReader
provides the root component for the scene that was read.

Specified by:
getComponent in interface SceneReader
Returns:
the root of the read scene.