org.apache.maven.jelly
Class JellyUtils

java.lang.Object
  extended byorg.apache.maven.jelly.JellyUtils

public class JellyUtils
extends java.lang.Object

Utilities for Jelly.

Version:
$Id: JellyUtils.java 517014 2007-03-11 21:15:50Z ltheussl $
Author:
bob mcwhirter, Jason van Zyl
See Also:
commons-jelly

Constructor Summary
JellyUtils()
           
 
Method Summary
static void compareContexts(MavenJellyContext ctx1, MavenJellyContext ctx2)
          Debugging function to show the differences between two Jelly contexts.
static Script compileScript(java.io.File scriptFile, JellyContext context)
          Compile a jelly script.
static Script compileScript(java.io.InputStream scriptInputStream, JellyContext context)
          Compile a jelly script.
static Script compileScript(java.io.InputStream scriptInputStream, java.lang.String systemId, JellyContext context)
          Compile a jelly script.
static Script compileScript(java.io.InputStream scriptInputStream, java.lang.String systemId, JellyContext context, java.lang.String encoding)
          Compile a jelly script.
static Expression decomposeExpression(java.lang.String text, JellyContext context)
          Recursively evaluate a string representation of a jelly expression.
static void populateVariables(JellyContext destContext, JellyContext sourceContext)
          Populate a context with variables, including parent variables if inheritance is enabled.
static void runScript(java.io.File scriptFile, java.net.URL rootUrl, JellyContext context, XMLOutput output)
          Run a jelly script.
static void runScript(java.io.InputStream scriptInputStream, java.lang.String systemId, java.net.URL rootUrl, JellyContext context, XMLOutput output)
          Run a jelly script.
static void runScript(java.io.InputStream scriptInputStream, java.net.URL rootUrl, JellyContext context, XMLOutput output)
          Run a jelly script.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JellyUtils

public JellyUtils()
Method Detail

runScript

public static void runScript(java.io.InputStream scriptInputStream,
                             java.net.URL rootUrl,
                             JellyContext context,
                             XMLOutput output)
                      throws java.lang.Exception
Run a jelly script.

Parameters:
scriptInputStream - Script input stream.
rootUrl - Root explicit context of the script.
context - Jelly context.
output - Output sink.
Throws:
java.lang.Exception - If an error occurs while locating, compiling or executing the script.

runScript

public static void runScript(java.io.InputStream scriptInputStream,
                             java.lang.String systemId,
                             java.net.URL rootUrl,
                             JellyContext context,
                             XMLOutput output)
                      throws java.lang.Exception
Run a jelly script.

Parameters:
scriptInputStream - Script input stream.
systemId - the system identifier to help resolve relative URLs
rootUrl - Root explicit context of the script.
context - Jelly context.
output - Output sink.
Throws:
java.lang.Exception - If an error occurs while locating, compiling or executing the script.

runScript

public static void runScript(java.io.File scriptFile,
                             java.net.URL rootUrl,
                             JellyContext context,
                             XMLOutput output)
                      throws java.lang.Exception
Run a jelly script.

Parameters:
scriptFile - Location of the script to run.
rootUrl - Root explicit context of the script.
context - Jelly context.
output - Output sink.
Throws:
java.lang.Exception - If an error occurs while locating, compiling or executing the script.

compileScript

public static Script compileScript(java.io.File scriptFile,
                                   JellyContext context)
                            throws java.lang.Exception
Compile a jelly script.

Parameters:
scriptFile - Location of the script to run.
context - Jelly context.
Returns:
The compiled script.
Throws:
java.lang.Exception - If an error occurs while locating or compiling the script.

compileScript

public static Script compileScript(java.io.InputStream scriptInputStream,
                                   JellyContext context)
                            throws java.lang.Exception
Compile a jelly script.

Parameters:
scriptInputStream - Script input stream.
context - Jelly context.
Returns:
The compiled script.
Throws:
java.lang.Exception - If an error occurs while locating or compiling the script.

compileScript

public static Script compileScript(java.io.InputStream scriptInputStream,
                                   java.lang.String systemId,
                                   JellyContext context)
                            throws java.lang.Exception
Compile a jelly script.

Parameters:
scriptInputStream - Script input stream.
systemId - the system identifier to help resolve relative URLs
context - Jelly context.
Returns:
The compiled script.
Throws:
java.lang.Exception - If an error occurs while locating or compiling the script.

compileScript

public static Script compileScript(java.io.InputStream scriptInputStream,
                                   java.lang.String systemId,
                                   JellyContext context,
                                   java.lang.String encoding)
                            throws java.lang.Exception
Compile a jelly script.

Parameters:
scriptInputStream - Script input stream.
systemId - the system identifier to help resolve relative URLs
context - Jelly context.
encoding - To use when reading XML.
Returns:
The compiled script.
Throws:
java.lang.Exception - If an error occurs while locating or compiling the script.
To Do:
throw something else

decomposeExpression

public static Expression decomposeExpression(java.lang.String text,
                                             JellyContext context)
Recursively evaluate a string representation of a jelly expression.

Parameters:
text - String representation of the a Jelly expression.
context - The Jelly context to compute the expression against.
Returns:
The recursively evaluated Jelly expression.

compareContexts

public static void compareContexts(MavenJellyContext ctx1,
                                   MavenJellyContext ctx2)
Debugging function to show the differences between two Jelly contexts.

Parameters:
ctx1 - first context
ctx2 - second context

populateVariables

public static void populateVariables(JellyContext destContext,
                                     JellyContext sourceContext)
Populate a context with variables, including parent variables if inheritance is enabled.

Parameters:
destContext - the destination context
sourceContext - the source context


Copyright © 2001-2008 Apache Software Foundation. All Rights Reserved.