org.apache.commons.jelly.avalon
Class JellyServiceImpl

java.lang.Object
  |
  +--org.apache.commons.jelly.avalon.JellyServiceImpl
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, JellyService

public class JellyServiceImpl
extends java.lang.Object
implements JellyService, org.apache.avalon.framework.configuration.Configurable

An Avalon based service for executing Jelly scripts. The service allows executing a script based on a name as well as by a URL.

Version:
$Revision: 1.4 $
Author:
Robert McIntosh

Constructor Summary
JellyServiceImpl()
          Constructor for JellyService.
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration config)
          Configures the Jelly Service with named scripts.
protected  org.apache.commons.jelly.JellyContext createJellyContext()
          Factory method to create a new JellyContext instance.
protected  org.apache.commons.jelly.XMLOutput createXMLOutput()
          Factory method to create a new XMLOutput to give to scripts as they run.
 java.util.Map runNamedScript(java.lang.String name, java.util.Map params)
          Executes a named script with the supplied Map of parameters.
 java.util.Map runNamedScript(java.lang.String name, java.util.Map params, java.io.OutputStream out)
          Executes a named script with the supplied Map of parameters and send the output of the script to the supplied output stream.
 java.util.Map runNamedScript(java.lang.String name, java.util.Map params, org.apache.commons.jelly.XMLOutput output)
          Executes a named script with the supplied Map of parameters.
 java.util.Map runScript(java.lang.String url, java.util.Map params)
          Runs a script from the supplied url
 java.util.Map runScript(java.lang.String url, java.util.Map params, java.io.OutputStream out)
          Runs a script from the supplied url and sends the output of the script to the supplied OutputStream.
 java.util.Map runScript(java.lang.String url, java.util.Map params, org.apache.commons.jelly.XMLOutput output)
          Runs a script from the supplied url
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JellyServiceImpl

public JellyServiceImpl()
Constructor for JellyService.
Method Detail

runNamedScript

public java.util.Map runNamedScript(java.lang.String name,
                                    java.util.Map params)
                             throws java.lang.Exception
Description copied from interface: JellyService
Executes a named script with the supplied Map of parameters.
Specified by:
runNamedScript in interface JellyService
See Also:
org.apache.commons.jelly.avalon.JellyService.runNamedScript(String, Map)

runNamedScript

public java.util.Map runNamedScript(java.lang.String name,
                                    java.util.Map params,
                                    org.apache.commons.jelly.XMLOutput output)
                             throws java.lang.Exception
Description copied from interface: JellyService
Executes a named script with the supplied Map of parameters.
Specified by:
runNamedScript in interface JellyService
See Also:
org.apache.commons.jelly.avalon.JellyService.runNamedScript(String, Map, XMLOutput)

runNamedScript

public java.util.Map runNamedScript(java.lang.String name,
                                    java.util.Map params,
                                    java.io.OutputStream out)
                             throws java.lang.Exception
Description copied from interface: JellyService
Executes a named script with the supplied Map of parameters and send the output of the script to the supplied output stream.
Specified by:
runNamedScript in interface JellyService
See Also:
org.apache.commons.jelly.avalon.JellyService.runNamedScript(String, Map, OutputStream)

runScript

public java.util.Map runScript(java.lang.String url,
                               java.util.Map params,
                               org.apache.commons.jelly.XMLOutput output)
                        throws java.lang.Exception
Description copied from interface: JellyService
Runs a script from the supplied url
Specified by:
runScript in interface JellyService
See Also:
org.apache.commons.jelly.avalon.JellyService.runScript(String, Map, XMLOutput)

runScript

public java.util.Map runScript(java.lang.String url,
                               java.util.Map params,
                               java.io.OutputStream out)
                        throws java.lang.Exception
Description copied from interface: JellyService
Runs a script from the supplied url and sends the output of the script to the supplied OutputStream.
Specified by:
runScript in interface JellyService
See Also:
org.apache.commons.jelly.avalon.JellyService.runScript(String, Map, OutputStream)

runScript

public java.util.Map runScript(java.lang.String url,
                               java.util.Map params)
                        throws java.lang.Exception
Description copied from interface: JellyService
Runs a script from the supplied url
Specified by:
runScript in interface JellyService
See Also:
org.apache.commons.jelly.avalon.JellyService.runScript(String, Map)

configure

public void configure(org.apache.avalon.framework.configuration.Configuration config)
               throws org.apache.avalon.framework.configuration.ConfigurationException

Configures the Jelly Service with named scripts.

The configuration looks like:

<jelly>
  <script>
    <name>script name</name>
    <url validate="false">url to script file</url>
  </script>
</jelly>

Where each <script> element defines a seperate script. The validate attribute on the url tag is optional and defaults to false.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
config - The configuration
Throws:
org.apache.avalon.framework.configuration.ConfigurationException -  

createJellyContext

protected org.apache.commons.jelly.JellyContext createJellyContext()
Factory method to create a new JellyContext instance. Derived classes could overload this method to provide a custom JellyContext instance.

createXMLOutput

protected org.apache.commons.jelly.XMLOutput createXMLOutput()
Factory method to create a new XMLOutput to give to scripts as they run. Derived classes could overload this method, such as to pipe output to some log file etc.


Copyright © 2002-2004 Apache Software Foundation. All Rights Reserved.