org.apache.commons.jelly.impl

## Class Embedded

- java.lang.Object
- - org.apache.commons.jelly.impl.Embedded

    public class Embedded
    extends Object

Author:
  Vinay Chandran

  `Embedded` provides easy means to embed JellyEngine
  and use Jelly scripts within an application

  A typical usage:
  `
  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();
  }
  `
  , Vinay Chandran

### Constructor Summary

Constructors
Constructor and Description
`Embedded()` Default Constructor

### Method Summary

Methods
`boolean` `execute()` Execute the jelly script and capture the errors (ifany)within.
`JellyContext` `getContext()` Method getContext.
`String` `getErrorMsg()` Returns the errorMsg.
`void` `registerTagLibrary(String namespaceURI, String className)` Registers the given tag library class name against the given namespace URI.
`void` `registerTagLibrary(String namespaceURI, TagLibrary taglib)` Registers the given tag library against the given namespace URI.
`void` `setContext(JellyContext context)` Method setContext.
`void` `setOutputStream(OutputStream outputStream)` Method setOutputStream.
`void` `setScript(InputStream scriptAsInputStream)` Set the input stream
`void` `setScript(String scriptAsString)` Set the input script
`void` `setVariable(String name, 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`

### Constructor Detail

#### Embedded

    public Embedded()

Default Constructor

### Method Detail

#### setContext

    public void setContext(JellyContext context)

Method setContext.

Parameters:
  `context` -

#### getContext

    public JellyContext getContext()

Method getContext.

Returns:
  JellyContext

#### setVariable

    public void setVariable(String name,
                   Object value)

Set a new variable within the context for the script to use.

Parameters:
  `name` -
  `value` -

#### setScript

    public void setScript(String scriptAsString)

Set the input script

Parameters:
  `scriptAsString` -

#### setScript

    public void setScript(InputStream scriptAsInputStream)

Set the input stream

Parameters:
  `scriptAsInputStream` -

#### setOutputStream

    public void setOutputStream(OutputStream outputStream)

Method setOutputStream.

Parameters:
  `outputStream` -

#### registerTagLibrary

    public void registerTagLibrary(String namespaceURI,
                          String className)

Registers the given tag library class name against the given namespace URI. The class will be loaded via the given ClassLoader This should be called before the parser is used.

#### registerTagLibrary

    public void registerTagLibrary(String namespaceURI,
                          TagLibrary taglib)

Registers the given tag library against the given namespace URI. This should be called before the parser is used.

#### getErrorMsg

    public String getErrorMsg()

Returns the errorMsg.

Returns:
  String

#### execute

    public boolean execute()

Execute the jelly script and capture the errors (ifany)within.

Throws:
  `JellyException`