Java Doc for JellyContext.java in  » Library » Apache-commons-jelly-1.0-src » org » apache » commons » jelly » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache commons jelly 1.0 src » org.apache.commons.jelly 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.jelly.JellyContext

All known Subclasses:   org.apache.commons.jelly.servlet.JellyServletContext,
JellyContext
public class JellyContext (Code)

JellyContext represents the Jelly context.


author:
   James Strachan
version:
   $Revision: 165507 $


Field Summary
protected  ClassLoaderclassLoader
     The class loader to use for instantiating application objects.
protected  booleanuseContextClassLoader
     Do we want to use the Context ClassLoader when loading classes for instantiating new objects? Default is false.

Constructor Summary
public  JellyContext()
    
public  JellyContext(URL rootURL)
     Create a new context with the given rootURL
Parameters:
  rootURL - the root URL used in resolving absolute resources i.e.
public  JellyContext(URL rootURL, URL currentURL)
     Create a new context with the given rootURL and currentURL
Parameters:
  rootURL - the root URL used in resolving absolute resources i.e.
public  JellyContext(JellyContext parent)
     Create a new context with the given parent context.
public  JellyContext(JellyContext parentJellyContext, URL currentURL)
     Create a new context with the given parent context.
public  JellyContext(JellyContext parentJellyContext, URL rootURL, URL currentURL)
     Create a new context with the given parent context. The parent's variables are available in the child context under the name parentScope.
Parameters:
  parentJellyContext - the parent context for the newly created context.
Parameters:
  rootURL - the root URL used in resolving absolute resources i.e.

Method Summary
public  voidclear()
     Clears variables set by Tags.
protected  voidclearVariables()
    
public  ScriptcompileScript(String uri)
     Attempts to parse the script from the given uri using the JellyContext.getResource method then returns the compiled script.
public  ScriptcompileScript(URL url)
     Attempts to parse the script from the given URL using the JellyContext.getResource method then returns the compiled script.
public  ScriptcompileScript(InputSource source)
     Attempts to parse the script from the given InputSource using the JellyContext.getResource method then returns the compiled script.
protected  JellyContextcreateChildContext()
    
protected  URLcreateRelativeURL(URL rootURL, String relativeURI)
    
protected  XMLParsercreateXMLParser()
     Factory method to allow JellyContext implementations to overload how an XMLParser is created - such as to overload what the default ExpressionFactory should be.
public  ObjectfindVariable(String name)
     Finds the variable value of the given name in this context or in any other parent context.
public  ClassLoadergetClassLoader()
     Return the class loader to be used for instantiating application objects when required.
public  URLgetCurrentURL()
    
protected  URLgetJellyContextURL(URL url)
    
protected  URLgetJellyContextURL(InputSource source)
    
public  JellyContextgetParent()
    
public  URLgetResource(String uri)
     Returns a URL for the given resource from the specified path.
public  InputStreamgetResourceAsStream(String uri)
     Attempts to open an InputStream to the given resource at the specified path. If the uri starts with "/" then the path is taken as relative to the current context root.
public  URLgetRootURL()
     the current root context URL from which all absolute resource URIswill be relative to.
public  JellyContextgetScope(String name)
    
public  TagLibrarygetTagLibrary(String namespaceURI)
    
public  booleangetUseContextClassLoader()
     Return the boolean as to whether the context classloader should be used.
public  ObjectgetVariable(String name)
    
public  ObjectgetVariable(String name, String scopeName)
     the value of the given variable name in the given variable scope
Parameters:
  name - is the name of the variable
Parameters:
  scopeName - is the optional scope name such as 'parent'.
public  IteratorgetVariableNames()
    
public  MapgetVariables()
    
protected  XMLParsergetXMLParser()
    
public  booleanisExport()
    
public  booleanisExportLibraries()
    
public  booleanisInherit()
    
public  booleanisTagLibraryRegistered(String namespaceURI)
    
public  JellyContextnewJellyContext(Map newVariables)
     A factory method to create a new child context of the current context.
public  JellyContextnewJellyContext()
     A factory method to create a new child context of the current context.
public  voidregisterTagLibrary(String namespaceURI, TagLibrary taglib)
     Registers the given tag library against the given namespace URI.
public  voidregisterTagLibrary(String namespaceURI, String className)
     Registers the given tag library class name against the given namespace URI.
public  voidremoveVariable(String name)
    
public  voidremoveVariable(String name, String scopeName)
     Removes the given variable in the specified scope.
Parameters:
  name - is the name of the variable
Parameters:
  scopeName - is the optional scope name such as 'parent'.
public  JellyContextrunScript(File file, XMLOutput output)
     Parses the script from the given File then compiles it and runs it.
public  JellyContextrunScript(URL url, XMLOutput output)
     Parses the script from the given URL then compiles it and runs it.
public  JellyContextrunScript(InputSource source, XMLOutput output)
     Parses the script from the given InputSource then compiles it and runs it.
public  JellyContextrunScript(String uri, XMLOutput output)
     Parses the script from the given uri using the JellyContext.getResource() API then compiles it and runs it.
public  JellyContextrunScript(String uri, XMLOutput output, boolean export, boolean inherit)
     Parses the script from the given uri using the JellyContext.getResource() API then compiles it and runs it.
public  JellyContextrunScript(File file, XMLOutput output, boolean export, boolean inherit)
     Parses the script from the given file then compiles it and runs it.
public  JellyContextrunScript(URL url, XMLOutput output, boolean export, boolean inherit)
     Parses the script from the given URL then compiles it and runs it.
public  JellyContextrunScript(InputSource source, XMLOutput output, boolean export, boolean inherit)
     Parses the script from the given InputSource then compiles it and runs it.
public  voidsetClassLoader(ClassLoader classLoader)
     Set the class loader to be used for instantiating application objects when required.
public  voidsetCurrentURL(URL currentURL)
     Sets the current URL context of the current script that is executing.
public  voidsetExport(boolean export)
    
public  voidsetExportLibraries(boolean exportLibraries)
    
public  voidsetInherit(boolean inherit)
    
protected  voidsetParent(JellyContext context)
    
public  voidsetRootURL(URL rootURL)
     Sets the current root context URL from which all absolute resource URIs will be relative to.
public  voidsetUseContextClassLoader(boolean use)
     Determine whether to use the Context ClassLoader (the one found by calling Thread.currentThread().getContextClassLoader()) to resolve/load classes.
public  voidsetVariable(String name, Object value)
    
public  voidsetVariable(String name, String scopeName, Object value)
     Sets the value of the given variable name in the given variable scope
Parameters:
  name - is the name of the variable
Parameters:
  scopeName - is the optional scope name such as 'parent'.
public  voidsetVariables(Map variables)
    

Field Detail
classLoader
protected ClassLoader classLoader(Code)
The class loader to use for instantiating application objects. If not specified, the context class loader, or the class loader used to load this class itself, is used, based on the value of the useContextClassLoader variable.



useContextClassLoader
protected boolean useContextClassLoader(Code)
Do we want to use the Context ClassLoader when loading classes for instantiating new objects? Default is false.




Constructor Detail
JellyContext
public JellyContext()(Code)
Create a new context with the currentURL set to the rootURL



JellyContext
public JellyContext(URL rootURL)(Code)
Create a new context with the given rootURL
Parameters:
  rootURL - the root URL used in resolving absolute resources i.e. those starting with '/'



JellyContext
public JellyContext(URL rootURL, URL currentURL)(Code)
Create a new context with the given rootURL and currentURL
Parameters:
  rootURL - the root URL used in resolving absolute resources i.e. those starting with '/'
Parameters:
  currentURL - the root URL used in resolving relative resources



JellyContext
public JellyContext(JellyContext parent)(Code)
Create a new context with the given parent context. The parent's rootURL and currentURL are set on the child, and the parent's variables are available in the child context under the name parentScope.
Parameters:
  parent - the parent context for the newly created context.



JellyContext
public JellyContext(JellyContext parentJellyContext, URL currentURL)(Code)
Create a new context with the given parent context. The parent's rootURL are set on the child, and the parent's variables are available in the child context under the name parentScope.
Parameters:
  parentJellyContext - the parent context for the newly created context.
Parameters:
  currentURL - the root URL used in resolving relative resources



JellyContext
public JellyContext(JellyContext parentJellyContext, URL rootURL, URL currentURL)(Code)
Create a new context with the given parent context. The parent's variables are available in the child context under the name parentScope.
Parameters:
  parentJellyContext - the parent context for the newly created context.
Parameters:
  rootURL - the root URL used in resolving absolute resources i.e. those starting with '/'
Parameters:
  currentURL - the root URL used in resolving relative resources




Method Detail
clear
public void clear()(Code)
Clears variables set by Tags.
See Also:   JellyContext.clearVariables()



clearVariables
protected void clearVariables()(Code)
Clears variables set by Tags (variables set while running a Jelly script)
See Also:   JellyContext.clear()



compileScript
public Script compileScript(String uri) throws JellyException(Code)
Attempts to parse the script from the given uri using the JellyContext.getResource method then returns the compiled script.



compileScript
public Script compileScript(URL url) throws JellyException(Code)
Attempts to parse the script from the given URL using the JellyContext.getResource method then returns the compiled script.



compileScript
public Script compileScript(InputSource source) throws JellyException(Code)
Attempts to parse the script from the given InputSource using the JellyContext.getResource method then returns the compiled script.



createChildContext
protected JellyContext createChildContext()(Code)
Factory method to create a new child of this context



createRelativeURL
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException(Code)
a new relative URL from the given root and with the addition of theextra relative URI
Parameters:
  rootURL - is the root context from which the relative URI will be applied
Parameters:
  relativeURI - is the relative URI (without a leading "/")
throws:
  MalformedURLException - if the URL is invalid.



createXMLParser
protected XMLParser createXMLParser()(Code)
Factory method to allow JellyContext implementations to overload how an XMLParser is created - such as to overload what the default ExpressionFactory should be.



findVariable
public Object findVariable(String name)(Code)
Finds the variable value of the given name in this context or in any other parent context. If this context does not contain the variable, then its parent is used and then its parent and so forth until the context with no parent is found. the value of the variable in this or one of its descendant contexts or nullif the variable could not be found.



getClassLoader
public ClassLoader getClassLoader()(Code)
Return the class loader to be used for instantiating application objects when required. This is determined based upon the following rules:
  • The class loader set by setClassLoader(), if any
  • The thread context class loader, if it exists and the useContextClassLoader property is set to true
  • The class loader used to load the XMLParser class itself.



getCurrentURL
public URL getCurrentURL()(Code)
the current URL context of the current script that is executing.This URL context is used to deduce relative scripts when relative URIs areused in calls to JellyContext.getResource to process relative scripts.



getJellyContextURL
protected URL getJellyContextURL(URL url) throws MalformedURLException(Code)
Strips off the name of a script to create a new context URL



getJellyContextURL
protected URL getJellyContextURL(InputSource source) throws MalformedURLException(Code)
Strips off the name of a script to create a new context URL



getParent
public JellyContext getParent()(Code)
the parent context for this context



getResource
public URL getResource(String uri) throws MalformedURLException(Code)
Returns a URL for the given resource from the specified path. If the uri starts with "/" then the path is taken as relative to the current context root. If the uri is a well formed URL then it is used. If the uri is a file that exists and can be read then it is used. Otherwise the uri is interpreted as relative to the current context (the location of the current script).



getResourceAsStream
public InputStream getResourceAsStream(String uri)(Code)
Attempts to open an InputStream to the given resource at the specified path. If the uri starts with "/" then the path is taken as relative to the current context root. If the uri is a well formed URL then it is used. Otherwise the uri is interpreted as relative to the current context (the location of the current script). null if this resource could not be loaded, otherwise the resourcesinput stream is returned.



getRootURL
public URL getRootURL()(Code)
the current root context URL from which all absolute resource URIswill be relative to. For example in a web application the root URL willmap to the web directory which contains the WEB-INF directory.



getScope
public JellyContext getScope(String name)(Code)
the scope of the given name, such as the 'parent' scope.If Jelly is used in a Servlet situation then 'request', 'session' and 'application' are other namesfor scopes



getTagLibrary
public TagLibrary getTagLibrary(String namespaceURI)(Code)
the TagLibrary for the given namespace URI or null if one could not be found



getUseContextClassLoader
public boolean getUseContextClassLoader()(Code)
Return the boolean as to whether the context classloader should be used.



getVariable
public Object getVariable(String name)(Code)
the value of the given variable name



getVariable
public Object getVariable(String name, String scopeName)(Code)
the value of the given variable name in the given variable scope
Parameters:
  name - is the name of the variable
Parameters:
  scopeName - is the optional scope name such as 'parent'. For servlet environmentsthis could be 'application', 'session' or 'request'.



getVariableNames
public Iterator getVariableNames()(Code)
an Iterator over the current variable names in thiscontext



getVariables
public Map getVariables()(Code)
the Map of variables in this scope



getXMLParser
protected XMLParser getXMLParser()(Code)
a thread pooled XMLParser to avoid the startup overheadof the XMLParser



isExport
public boolean isExport()(Code)
whether we should export variable definitions to our parent context



isExportLibraries
public boolean isExportLibraries()(Code)
Returns whether we export tag libraries to our parents context boolean



isInherit
public boolean isInherit()(Code)
whether we should inherit variables from our parent context



isTagLibraryRegistered
public boolean isTagLibraryRegistered(String namespaceURI)(Code)



newJellyContext
public JellyContext newJellyContext(Map newVariables)(Code)
A factory method to create a new child context of the current context.



newJellyContext
public JellyContext newJellyContext()(Code)
A factory method to create a new child context of the current context.



registerTagLibrary
public void registerTagLibrary(String namespaceURI, TagLibrary taglib)(Code)
Registers the given tag library against the given namespace URI. This should be called before the parser is used.



registerTagLibrary
public void registerTagLibrary(String namespaceURI, String className)(Code)
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.



removeVariable
public void removeVariable(String name)(Code)
Removes the given variable



removeVariable
public void removeVariable(String name, String scopeName)(Code)
Removes the given variable in the specified scope.
Parameters:
  name - is the name of the variable
Parameters:
  scopeName - is the optional scope name such as 'parent'. For servlet environmentsthis could be 'application', 'session' or 'request'.



runScript
public JellyContext runScript(File file, XMLOutput output) throws JellyException(Code)
Parses the script from the given File then compiles it and runs it. the new child context that was used to run the script



runScript
public JellyContext runScript(URL url, XMLOutput output) throws JellyException(Code)
Parses the script from the given URL then compiles it and runs it. the new child context that was used to run the script



runScript
public JellyContext runScript(InputSource source, XMLOutput output) throws JellyException(Code)
Parses the script from the given InputSource then compiles it and runs it. the new child context that was used to run the script



runScript
public JellyContext runScript(String uri, XMLOutput output) throws JellyException(Code)
Parses the script from the given uri using the JellyContext.getResource() API then compiles it and runs it. the new child context that was used to run the script



runScript
public JellyContext runScript(String uri, XMLOutput output, boolean export, boolean inherit) throws JellyException(Code)
Parses the script from the given uri using the JellyContext.getResource() API then compiles it and runs it. the new child context that was used to run the script



runScript
public JellyContext runScript(File file, XMLOutput output, boolean export, boolean inherit) throws JellyException(Code)
Parses the script from the given file then compiles it and runs it. the new child context that was used to run the script



runScript
public JellyContext runScript(URL url, XMLOutput output, boolean export, boolean inherit) throws JellyException(Code)
Parses the script from the given URL then compiles it and runs it. the new child context that was used to run the script



runScript
public JellyContext runScript(InputSource source, XMLOutput output, boolean export, boolean inherit) throws JellyException(Code)
Parses the script from the given InputSource then compiles it and runs it. the new child context that was used to run the script



setClassLoader
public void setClassLoader(ClassLoader classLoader)(Code)
Set the class loader to be used for instantiating application objects when required.
Parameters:
  classLoader - The new class loader to use, or nullto revert to the standard rules



setCurrentURL
public void setCurrentURL(URL currentURL)(Code)
Sets the current URL context of the current script that is executing. This URL context is used to deduce relative scripts when relative URIs are used in calls to JellyContext.getResource to process relative scripts.



setExport
public void setExport(boolean export)(Code)
Sets whether we should export variable definitions to our parent context



setExportLibraries
public void setExportLibraries(boolean exportLibraries)(Code)
Sets whether we export tag libraries to our parents context
Parameters:
  exportLibraries - The exportLibraries to set



setInherit
public void setInherit(boolean inherit)(Code)
Sets whether we should inherit variables from our parent context



setParent
protected void setParent(JellyContext context)(Code)
Change the parent context to the one provided
Parameters:
  context - the new parent context



setRootURL
public void setRootURL(URL rootURL)(Code)
Sets the current root context URL from which all absolute resource URIs will be relative to. For example in a web application the root URL will map to the web directory which contains the WEB-INF directory.



setUseContextClassLoader
public void setUseContextClassLoader(boolean use)(Code)
Determine whether to use the Context ClassLoader (the one found by calling Thread.currentThread().getContextClassLoader()) to resolve/load classes. If not using Context ClassLoader, then the class-loading defaults to using the calling-class' ClassLoader.
Parameters:
  use - determines whether to use JellyContext ClassLoader.



setVariable
public void setVariable(String name, Object value)(Code)
Sets the value of the named variable



setVariable
public void setVariable(String name, String scopeName, Object value)(Code)
Sets the value of the given variable name in the given variable scope
Parameters:
  name - is the name of the variable
Parameters:
  scopeName - is the optional scope name such as 'parent'. For servlet environmentsthis could be 'application', 'session' or 'request'.
Parameters:
  value - is the value of the attribute



setVariables
public void setVariables(Map variables)(Code)
Sets the Map of variables to use



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.