at.ofai.gate.scripting
Class LRScriptConsole

java.lang.Object
  extended by gate.util.AbstractFeatureBearer
      extended by gate.creole.AbstractResource
          extended by gate.creole.AbstractLanguageResource
              extended by at.ofai.gate.scripting.LRScriptConsole
All Implemented Interfaces:
gate.LanguageResource, gate.Resource, gate.util.FeatureBearer, gate.util.NameBearer, java.io.Serializable
Direct Known Subclasses:
LRScriptConsoleGroovy, LRScriptConsoleJavascript, LRScriptConsoleJRuby, LRScriptConsoleJython

public class LRScriptConsole
extends gate.creole.AbstractLanguageResource

See Also:
Serialized Form

Field Summary
protected  java.lang.String helpInfo
           
protected  java.io.File initDir
           
protected  javax.script.ScriptEngine scriptEngine
           
protected  java.lang.String scriptLanguage
           
protected  java.lang.String scriptText
           
protected  java.net.URL scriptUrl
           
 
Fields inherited from class gate.creole.AbstractLanguageResource
dataStore, lrPersistentId
 
Fields inherited from class gate.creole.AbstractResource
name
 
Fields inherited from class gate.util.AbstractFeatureBearer
features
 
Constructor Summary
LRScriptConsole()
           
 
Method Summary
static gate.Controller getController(java.lang.String name)
           
static gate.Corpus getCorpus(java.lang.String name)
           
 gate.DataStore getDataStore()
          Get the data store that this LR lives in.
static gate.Document getDocument(java.lang.String name)
           
 java.lang.String getHelpInfo()
           
 java.lang.Object getLRPersistenceId()
          Returns the persistence id of this LR, if it has been stored in a datastore.
static gate.Resource getNamed(java.lang.String name, java.lang.String classname)
           
 gate.LanguageResource getParent()
          Returns the parent LR of this LR.
 javax.script.ScriptEngine getScriptEngine()
           
 java.lang.String getScriptLanguage()
           
 java.lang.String getScriptText()
           
 java.net.URL getScriptUrl()
           
 gate.Resource init()
           
protected  void initEngine()
          Initialise this resource, and return it.
 boolean isModified()
          Returns true of an LR has been modified since the last sync.
 void setDataStore(gate.DataStore dataStore)
          Set the data store that this LR lives in.
 void setLRPersistenceId(java.lang.Object lrID)
          Sets the persistence id of this LR.
 void setParent(gate.LanguageResource parentLR)
          Sets the parent LR of this LR.
 void setScriptEngine(javax.script.ScriptEngine engine)
           
 void setScriptLanguage(java.lang.String scriptLanguage)
           
 void setScriptText(java.lang.String scriptText)
           
 void setScriptUrl(java.net.URL scriptUrl)
           
 void sync()
          Save: synchonise the in-memory image of the LR with the persistent image.
 
Methods inherited from class gate.creole.AbstractLanguageResource
cleanup
 
Methods inherited from class gate.creole.AbstractResource
checkParameterValues, getBeanInfo, getName, getParameterValue, getParameterValue, removeResourceListeners, setName, setParameterValue, setParameterValue, setParameterValues, setParameterValues, setResourceListeners
 
Methods inherited from class gate.util.AbstractFeatureBearer
getFeatures, setFeatures
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gate.Resource
getParameterValue, setParameterValue, setParameterValues
 
Methods inherited from interface gate.util.FeatureBearer
getFeatures, setFeatures
 
Methods inherited from interface gate.util.NameBearer
getName, setName
 

Field Detail

scriptUrl

protected java.net.URL scriptUrl

scriptText

protected java.lang.String scriptText

scriptLanguage

protected java.lang.String scriptLanguage

scriptEngine

protected javax.script.ScriptEngine scriptEngine

initDir

protected java.io.File initDir

helpInfo

protected java.lang.String helpInfo
Constructor Detail

LRScriptConsole

public LRScriptConsole()
Method Detail

setScriptUrl

public void setScriptUrl(java.net.URL scriptUrl)

getScriptUrl

public java.net.URL getScriptUrl()

setScriptText

public void setScriptText(java.lang.String scriptText)

getScriptText

public java.lang.String getScriptText()

setScriptLanguage

public void setScriptLanguage(java.lang.String scriptLanguage)

getScriptLanguage

public java.lang.String getScriptLanguage()

setScriptEngine

public void setScriptEngine(javax.script.ScriptEngine engine)

getScriptEngine

public javax.script.ScriptEngine getScriptEngine()

getHelpInfo

public java.lang.String getHelpInfo()

init

public gate.Resource init()
                   throws gate.creole.ResourceInstantiationException
Specified by:
init in interface gate.Resource
Overrides:
init in class gate.creole.AbstractResource
Throws:
gate.creole.ResourceInstantiationException

initEngine

protected void initEngine()
                   throws gate.creole.ResourceInstantiationException
Initialise this resource, and return it.

Throws:
gate.creole.ResourceInstantiationException

setParent

public void setParent(gate.LanguageResource parentLR)
               throws gate.persist.PersistenceException,
                      java.lang.SecurityException
Sets the parent LR of this LR. Only relevant for LRs that support shadowing. Most do not by default.

Specified by:
setParent in interface gate.LanguageResource
Overrides:
setParent in class gate.creole.AbstractLanguageResource
Throws:
gate.persist.PersistenceException
java.lang.SecurityException

getParent

public gate.LanguageResource getParent()
                                throws gate.persist.PersistenceException,
                                       java.lang.SecurityException
Returns the parent LR of this LR. Only relevant for LRs that support shadowing. Most do not by default.

Specified by:
getParent in interface gate.LanguageResource
Overrides:
getParent in class gate.creole.AbstractLanguageResource
Throws:
gate.persist.PersistenceException
java.lang.SecurityException

isModified

public boolean isModified()
Returns true of an LR has been modified since the last sync. Always returns false for transient LRs.

Specified by:
isModified in interface gate.LanguageResource
Overrides:
isModified in class gate.creole.AbstractLanguageResource

sync

public void sync()
          throws gate.persist.PersistenceException,
                 java.lang.SecurityException
Save: synchonise the in-memory image of the LR with the persistent image.

Specified by:
sync in interface gate.LanguageResource
Overrides:
sync in class gate.creole.AbstractLanguageResource
Throws:
gate.persist.PersistenceException
java.lang.SecurityException

setLRPersistenceId

public void setLRPersistenceId(java.lang.Object lrID)
Sets the persistence id of this LR. To be used only in the Factory and DataStore code.

Specified by:
setLRPersistenceId in interface gate.LanguageResource
Overrides:
setLRPersistenceId in class gate.creole.AbstractLanguageResource

getLRPersistenceId

public java.lang.Object getLRPersistenceId()
Returns the persistence id of this LR, if it has been stored in a datastore. Null otherwise.

Specified by:
getLRPersistenceId in interface gate.LanguageResource
Overrides:
getLRPersistenceId in class gate.creole.AbstractLanguageResource

getDataStore

public gate.DataStore getDataStore()
Get the data store that this LR lives in. Null for transient LRs.

Specified by:
getDataStore in interface gate.LanguageResource
Overrides:
getDataStore in class gate.creole.AbstractLanguageResource

setDataStore

public void setDataStore(gate.DataStore dataStore)
                  throws gate.persist.PersistenceException
Set the data store that this LR lives in.

Specified by:
setDataStore in interface gate.LanguageResource
Overrides:
setDataStore in class gate.creole.AbstractLanguageResource
Throws:
gate.persist.PersistenceException

getNamed

public static gate.Resource getNamed(java.lang.String name,
                                     java.lang.String classname)
                              throws gate.util.GateException
Throws:
gate.util.GateException

getDocument

public static gate.Document getDocument(java.lang.String name)
                                 throws gate.util.GateException
Throws:
gate.util.GateException

getCorpus

public static gate.Corpus getCorpus(java.lang.String name)
                             throws gate.util.GateException
Throws:
gate.util.GateException

getController

public static gate.Controller getController(java.lang.String name)
                                     throws gate.util.GateException
Throws:
gate.util.GateException