org.red5.server.script.rhino
Class RhinoScriptFactory

java.lang.Object
  extended by org.red5.server.script.rhino.RhinoScriptFactory
All Implemented Interfaces:
ScriptFactory

public class RhinoScriptFactory
extends Object
implements ScriptFactory

ScriptFactory implementation for a Rhino / Javascript script.

Typically used in combination with a ScriptFactoryPostProcessor; see the latter's Javadoc for a configuration example.

Since:
0.6
Author:
Paul Gregoire
See Also:
ScriptFactoryPostProcessor, RhinoScriptUtils

Constructor Summary
RhinoScriptFactory(String scriptSourceLocator)
           
RhinoScriptFactory(String scriptSourceLocator, Class scriptInterface)
           
RhinoScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces)
          Create a new RhinoScriptFactory for the given script source.
RhinoScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces, Class extendedClass)
           
 
Method Summary
 Object getScriptedObject(ScriptSource actualScriptSource, Class[] actualInterfaces)
          Load and parse the Rhino script via RhinoScriptUtils.
 Class getScriptedObjectType(ScriptSource src)
           
 Class[] getScriptInterfaces()
          
 String getScriptSourceLocator()
          
 boolean requiresConfigInterface()
          Rhino scripts do not require a config interface.
 boolean requiresScriptedObjectRefresh(ScriptSource src)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RhinoScriptFactory

public RhinoScriptFactory(String scriptSourceLocator)

RhinoScriptFactory

public RhinoScriptFactory(String scriptSourceLocator,
                          Class scriptInterface)

RhinoScriptFactory

public RhinoScriptFactory(String scriptSourceLocator,
                          Class[] scriptInterfaces)
Create a new RhinoScriptFactory for the given script source.

Parameters:
scriptSourceLocator - a locator that points to the source of the script. Interpreted by the post-processor that actually creates the script.
scriptInterfaces - the Java interfaces that the scripted object is supposed to implement
Throws:
IllegalArgumentException - if either of the supplied arguments is null; or the supplied scriptSourceLocator argument is composed wholly of whitespace; or if the supplied scriptInterfaces argument array has no elements

RhinoScriptFactory

public RhinoScriptFactory(String scriptSourceLocator,
                          Class[] scriptInterfaces,
                          Class extendedClass)
Method Detail

getScriptSourceLocator

public String getScriptSourceLocator()

Specified by:
getScriptSourceLocator in interface ScriptFactory

getScriptInterfaces

public Class[] getScriptInterfaces()

Specified by:
getScriptInterfaces in interface ScriptFactory

requiresConfigInterface

public boolean requiresConfigInterface()
Rhino scripts do not require a config interface.

Specified by:
requiresConfigInterface in interface ScriptFactory
Returns:
false always

getScriptedObject

public Object getScriptedObject(ScriptSource actualScriptSource,
                                Class[] actualInterfaces)
                         throws IOException,
                                ScriptCompilationException
Load and parse the Rhino script via RhinoScriptUtils.

Specified by:
getScriptedObject in interface ScriptFactory
Throws:
IOException
ScriptCompilationException

getScriptedObjectType

public Class getScriptedObjectType(ScriptSource src)
                            throws IOException,
                                   ScriptCompilationException
Specified by:
getScriptedObjectType in interface ScriptFactory
Throws:
IOException
ScriptCompilationException

requiresScriptedObjectRefresh

public boolean requiresScriptedObjectRefresh(ScriptSource src)
Specified by:
requiresScriptedObjectRefresh in interface ScriptFactory


Copyright © 2006-2012 The Red5 Project