|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.jelly.impl.Embedded
public class Embedded
Embedded
provides easy means to embed JellyEngine
and use Jelly scripts within an application
Embedded embedded = new Embedded();
embedded.setOutputStream(new ByteArrayOutputStream());
embedded.setVariable("some-var","some-object");
.....
embedded.setScript(scriptAsString);
//or one can do.
//embedded.setScript(scriptAsInputStream);
boolean bStatus=embedded.execute();
if(!bStatus) //if error
{
String errorMsg=embedded.getErrorMsg();
}
Field Summary | |
---|---|
private static org.apache.commons.logging.Log |
log
The Log to which logging calls will be made. |
private JellyContext |
m_context
JellyContext |
private java.lang.String |
m_errorMsg
ErrorMsg |
private java.io.InputStream |
m_inputStream
Input script as stream |
(package private) Jelly |
m_jellyEngine
Jelly Engine |
private XMLOutput |
m_output
Output(default System.out) |
private java.io.OutputStream |
m_outputStream
Output Stream |
private Script |
m_script
Compiled Script Object |
(package private) java.lang.Exception |
m_scriptCompilationException
Exception thrown during compilation of script |
(package private) boolean |
m_scriptCompiled
boolean value indicating whether the script has been successfully compiled or NOT |
Constructor Summary | |
---|---|
Embedded()
Default Constructor |
Method Summary | |
---|---|
private void |
compileScriptAndKeep()
Compile the script |
boolean |
execute()
Execute the jelly script and capture the errors (ifany)within. |
JellyContext |
getContext()
Method getContext. |
java.lang.String |
getErrorMsg()
Returns the errorMsg. |
void |
registerTagLibrary(java.lang.String namespaceURI,
java.lang.String className)
Registers the given tag library class name against the given namespace URI. |
void |
registerTagLibrary(java.lang.String namespaceURI,
TagLibrary taglib)
Registers the given tag library against the given namespace URI. |
private java.net.URL |
resolveURL(java.lang.String name)
|
void |
setContext(JellyContext context)
Method setContext. |
private void |
setErrorMsg(java.lang.String errorMsg)
Sets the errorMsg. |
void |
setOutputStream(java.io.OutputStream outputStream)
Method setOutputStream. |
void |
setScript(java.io.InputStream scriptAsInputStream)
Set the input stream |
void |
setScript(java.lang.String scriptAsString)
Set the input script |
void |
setVariable(java.lang.String name,
java.lang.Object value)
Set a new variable within the context for the script to use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
Jelly m_jellyEngine
private JellyContext m_context
private Script m_script
private java.io.InputStream m_inputStream
private java.io.OutputStream m_outputStream
private XMLOutput m_output
java.lang.Exception m_scriptCompilationException
boolean m_scriptCompiled
private java.lang.String m_errorMsg
private static final org.apache.commons.logging.Log log
Constructor Detail |
---|
public Embedded()
Method Detail |
---|
public void setContext(JellyContext context)
context
- public JellyContext getContext()
public void setVariable(java.lang.String name, java.lang.Object value)
name
- value
- public void setScript(java.lang.String scriptAsString)
scriptAsString
- private java.net.URL resolveURL(java.lang.String name) throws java.net.MalformedURLException
java.net.MalformedURLException
public void setScript(java.io.InputStream scriptAsInputStream)
scriptAsInputStream
- private void compileScriptAndKeep()
public void setOutputStream(java.io.OutputStream outputStream)
outputStream
- public void registerTagLibrary(java.lang.String namespaceURI, java.lang.String className)
public void registerTagLibrary(java.lang.String namespaceURI, TagLibrary taglib)
public java.lang.String getErrorMsg()
private void setErrorMsg(java.lang.String errorMsg)
errorMsg
- The errorMsg to setpublic boolean execute()
JellyException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |