Java Doc for VelocityEngineFactory.java in  » J2EE » spring-framework-2.0.6 » org » springframework » ui » velocity » 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 » J2EE » spring framework 2.0.6 » org.springframework.ui.velocity 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.ui.velocity.VelocityEngineFactory

All known Subclasses:   org.springframework.web.servlet.view.velocity.VelocityConfigurer,  org.springframework.ui.velocity.VelocityEngineFactoryBean,
VelocityEngineFactory
public class VelocityEngineFactory (Code)
Factory that configures a VelocityEngine. Can be used standalone, but typically you will either use VelocityEngineFactoryBean for preparing a VelocityEngine as bean reference, or org.springframework.web.servlet.view.velocity.VelocityConfigurer for web views.

The optional "configLocation" property sets the location of the Velocity properties file, within the current application. Velocity properties can be overridden via "velocityProperties", or even completely specified locally, avoiding the need for an external properties file.

The "resourceLoaderPath" property can be used to specify the Velocity resource loader path via Spring's Resource abstraction, possibly relative to the Spring application context.

If "overrideLogging" is true (the default), the VelocityEngine will be configured to log via Commons Logging, that is, using the Spring-provided CommonsLoggingLogSystem as log system.

The simplest way to use this class is to specify a VelocityEngineFactory.setResourceLoaderPath(String) "resourceLoaderPath" ; the VelocityEngine typically then does not need any further configuration.
author:
   Juergen Hoeller
See Also:   VelocityEngineFactory.setConfigLocation
See Also:   VelocityEngineFactory.setVelocityProperties
See Also:   VelocityEngineFactory.setResourceLoaderPath
See Also:   VelocityEngineFactory.setOverrideLogging
See Also:   VelocityEngineFactory.createVelocityEngine
See Also:   CommonsLoggingLogSystem
See Also:   VelocityEngineFactoryBean
See Also:   org.springframework.web.servlet.view.velocity.VelocityConfigurer
See Also:   org.apache.velocity.app.VelocityEngine



Field Summary
final protected  Loglogger
    


Method Summary
public  VelocityEnginecreateVelocityEngine()
     Prepare the VelocityEngine instance and return it.
protected  ResourceLoadergetResourceLoader()
     Return the Spring ResourceLoader to use for loading Velocity template files.
protected  voidinitSpringResourceLoader(VelocityEngine velocityEngine, String resourceLoaderPath)
     Initialize a SpringResourceLoader for the given VelocityEngine.
protected  voidinitVelocityResourceLoader(VelocityEngine velocityEngine, String resourceLoaderPath)
     Initialize a Velocity resource loader for the given VelocityEngine: either a standard Velocity FileResourceLoader or a SpringResourceLoader.
protected  booleanisPreferFileSystemAccess()
     Return whether to prefer file system access for template loading.
protected  VelocityEnginenewVelocityEngine()
     Return a new VelocityEngine.
protected  voidpostProcessVelocityEngine(VelocityEngine velocityEngine)
     To be implemented by subclasses that want to to perform custom post-processing of the VelocityEngine after this FactoryBean performed its default configuration (but before VelocityEngine.init).
public  voidsetConfigLocation(Resource configLocation)
     Set the location of the Velocity config file.
public  voidsetOverrideLogging(boolean overrideLogging)
     Set whether Velocity should log via Commons Logging, i.e.
public  voidsetPreferFileSystemAccess(boolean preferFileSystemAccess)
     Set whether to prefer file system access for template loading. File system access enables hot detection of template changes.

If this is enabled, VelocityEngineFactory will try to resolve the specified "resourceLoaderPath" as file system resource (which will work for expanded class path resources and ServletContext resources too).

Default is "true".

public  voidsetResourceLoader(ResourceLoader resourceLoader)
     Set the Spring ResourceLoader to use for loading Velocity template files. The default is DefaultResourceLoader.
public  voidsetResourceLoaderPath(String resourceLoaderPath)
     Set the Velocity resource loader path via a Spring resource location. Accepts multiple locations in Velocity's comma-separated path style.

When populated via a String, standard URLs like "file:" and "classpath:" pseudo URLs are supported, as understood by ResourceLoader.

public  voidsetVelocityProperties(Properties velocityProperties)
     Set Velocity properties, like "file.resource.loader.path".
public  voidsetVelocityPropertiesMap(Map velocityPropertiesMap)
     Set Velocity properties as Map, to allow for non-String values like "ds.resource.loader.instance".

Field Detail
logger
final protected Log logger(Code)





Method Detail
createVelocityEngine
public VelocityEngine createVelocityEngine() throws IOException, VelocityException(Code)
Prepare the VelocityEngine instance and return it. the VelocityEngine instance
throws:
  IOException - if the config file wasn't found
throws:
  VelocityException - on Velocity initialization failure



getResourceLoader
protected ResourceLoader getResourceLoader()(Code)
Return the Spring ResourceLoader to use for loading Velocity template files.



initSpringResourceLoader
protected void initSpringResourceLoader(VelocityEngine velocityEngine, String resourceLoaderPath)(Code)
Initialize a SpringResourceLoader for the given VelocityEngine.

Called by initVelocityResourceLoader.
Parameters:
  velocityEngine - the VelocityEngine to configure
Parameters:
  resourceLoaderPath - the path to load Velocity resources from
See Also:   SpringResourceLoader
See Also:   VelocityEngineFactory.initVelocityResourceLoader




initVelocityResourceLoader
protected void initVelocityResourceLoader(VelocityEngine velocityEngine, String resourceLoaderPath)(Code)
Initialize a Velocity resource loader for the given VelocityEngine: either a standard Velocity FileResourceLoader or a SpringResourceLoader.

Called by createVelocityEngine().
Parameters:
  velocityEngine - the VelocityEngine to configure
Parameters:
  resourceLoaderPath - the path to load Velocity resources from
See Also:   org.apache.velocity.runtime.resource.loader.FileResourceLoader
See Also:   SpringResourceLoader
See Also:   VelocityEngineFactory.initSpringResourceLoader
See Also:   VelocityEngineFactory.createVelocityEngine()




isPreferFileSystemAccess
protected boolean isPreferFileSystemAccess()(Code)
Return whether to prefer file system access for template loading.



newVelocityEngine
protected VelocityEngine newVelocityEngine() throws IOException, VelocityException(Code)
Return a new VelocityEngine. Subclasses can override this for custom initialization, or for using a mock object for testing.

Called by createVelocityEngine(). the VelocityEngine instance
throws:
  IOException - if a config file wasn't found
throws:
  VelocityException - on Velocity initialization failure
See Also:   VelocityEngineFactory.createVelocityEngine()




postProcessVelocityEngine
protected void postProcessVelocityEngine(VelocityEngine velocityEngine) throws IOException, VelocityException(Code)
To be implemented by subclasses that want to to perform custom post-processing of the VelocityEngine after this FactoryBean performed its default configuration (but before VelocityEngine.init).

Called by createVelocityEngine().
Parameters:
  velocityEngine - the current VelocityEngine
throws:
  IOException - if a config file wasn't found
throws:
  VelocityException - on Velocity initialization failure
See Also:   VelocityEngineFactory.createVelocityEngine()
See Also:   org.apache.velocity.app.VelocityEngine.init




setConfigLocation
public void setConfigLocation(Resource configLocation)(Code)
Set the location of the Velocity config file. Alternatively, you can specify all properties locally.
See Also:   VelocityEngineFactory.setVelocityProperties
See Also:   VelocityEngineFactory.setResourceLoaderPath



setOverrideLogging
public void setOverrideLogging(boolean overrideLogging)(Code)
Set whether Velocity should log via Commons Logging, i.e. whether Velocity's log system should be set to CommonsLoggingLogSystem. Default value is true.
See Also:   CommonsLoggingLogSystem



setPreferFileSystemAccess
public void setPreferFileSystemAccess(boolean preferFileSystemAccess)(Code)
Set whether to prefer file system access for template loading. File system access enables hot detection of template changes.

If this is enabled, VelocityEngineFactory will try to resolve the specified "resourceLoaderPath" as file system resource (which will work for expanded class path resources and ServletContext resources too).

Default is "true". Turn this off to always load via SpringResourceLoader (i.e. as stream, without hot detection of template changes), which might be necessary if some of your templates reside in an expanded classes directory while others reside in jar files.
See Also:   VelocityEngineFactory.setResourceLoaderPath




setResourceLoader
public void setResourceLoader(ResourceLoader resourceLoader)(Code)
Set the Spring ResourceLoader to use for loading Velocity template files. The default is DefaultResourceLoader. Will get overridden by the ApplicationContext if running in a context.
See Also:   org.springframework.core.io.DefaultResourceLoader
See Also:   org.springframework.context.ApplicationContext



setResourceLoaderPath
public void setResourceLoaderPath(String resourceLoaderPath)(Code)
Set the Velocity resource loader path via a Spring resource location. Accepts multiple locations in Velocity's comma-separated path style.

When populated via a String, standard URLs like "file:" and "classpath:" pseudo URLs are supported, as understood by ResourceLoader. Allows for relative paths when running in an ApplicationContext.

Will define a path for the default Velocity resource loader with the name "file". If the specified resource cannot be resolved to a java.io.File, a generic SpringResourceLoader will be used under the name "spring", without modification detection.

Note that resource caching will be enabled in any case. With the file resource loader, the last-modified timestamp will be checked on access to detect changes. With SpringResourceLoader, the resource will be cached forever (for example for class path resources).

To specify a modification check interval for files, use Velocity's standard "file.resource.loader.modificationCheckInterval" property. By default, the file timestamp is checked on every access (which is surprisingly fast). Of course, this just applies when loading resources from the file system.

To enforce the use of SpringResourceLoader, i.e. to not resolve a path as file system resource in any case, turn off the "preferFileSystemAccess" flag. See the latter's javadoc for details.
See Also:   VelocityEngineFactory.setResourceLoader
See Also:   VelocityEngineFactory.setVelocityProperties
See Also:   VelocityEngineFactory.setPreferFileSystemAccess
See Also:   SpringResourceLoader
See Also:   org.apache.velocity.runtime.resource.loader.FileResourceLoader




setVelocityProperties
public void setVelocityProperties(Properties velocityProperties)(Code)
Set Velocity properties, like "file.resource.loader.path". Can be used to override values in a Velocity config file, or to specify all necessary properties locally.

Note that the Velocity resource loader path also be set to any Spring resource location via the "resourceLoaderPath" property. Setting it here is just necessary when using a non-file-based resource loader.
See Also:   VelocityEngineFactory.setVelocityPropertiesMap
See Also:   VelocityEngineFactory.setConfigLocation
See Also:   VelocityEngineFactory.setResourceLoaderPath




setVelocityPropertiesMap
public void setVelocityPropertiesMap(Map velocityPropertiesMap)(Code)
Set Velocity properties as Map, to allow for non-String values like "ds.resource.loader.instance".
See Also:   VelocityEngineFactory.setVelocityProperties



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.