|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.internet2.middleware.shibboleth.common.attribute.resolver.provider.dataConnector.TemplateEngine
public class TemplateEngine
A velocity based template engine that pulls information from a resolution context for use within the template.
Nested Class Summary | |
---|---|
static interface |
TemplateEngine.CharacterEscapingStrategy
Represents a domain specific strategy for escaping values used within a template. |
Constructor Summary | |
---|---|
TemplateEngine(org.apache.velocity.app.VelocityEngine engine)
Constructor. |
Method Summary | |
---|---|
String |
createStatement(String templateName,
ShibbolethResolutionContext resolutionContext,
List<String> dependencies,
TemplateEngine.CharacterEscapingStrategy escapingStrategy)
Create a statement from a give template by replacing it's macro's with information within the resolution context. |
protected org.apache.velocity.VelocityContext |
createVelocityContext(ShibbolethResolutionContext resolutionContext,
List<String> dependencies,
TemplateEngine.CharacterEscapingStrategy escapingStrategy)
Creates the velocity context from the given resolution context. |
protected List<Object> |
prepareAttributeValues(BaseAttribute attribute,
TemplateEngine.CharacterEscapingStrategy escapingStrategy)
Prepares an attributes values for use within a template. |
void |
registerTemplate(String templateName,
String template)
Registers a template under a given name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TemplateEngine(org.apache.velocity.app.VelocityEngine engine)
engine
- velocity engine used to evaluate templatesMethod Detail |
---|
public void registerTemplate(String templateName, String template)
templateName
- name to register the template undertemplate
- template to registerpublic String createStatement(String templateName, ShibbolethResolutionContext resolutionContext, List<String> dependencies, TemplateEngine.CharacterEscapingStrategy escapingStrategy) throws AttributeResolutionException
templateName
- name of the templateresolutionContext
- the current resolution contextdependencies
- the list of resolution plug-in dependencies that will provider attributesescapingStrategy
- strategy used to escape values, may be null if no escaping is necessary
AttributeResolutionException
- thrown if the given template can not be populated because it is malformed or
the given data connectors or attribute definitions error out during resolutionprotected org.apache.velocity.VelocityContext createVelocityContext(ShibbolethResolutionContext resolutionContext, List<String> dependencies, TemplateEngine.CharacterEscapingStrategy escapingStrategy) throws AttributeResolutionException
resolutionContext
- the resolution context containing the currently resolved attribute informationdependencies
- resolution plug-in dependencies that will provide attributes to the velocity contextescapingStrategy
- strategy used to escape values
AttributeResolutionException
- thrown if a resolution plugin errors out while resolving its attributesprotected List<Object> prepareAttributeValues(BaseAttribute attribute, TemplateEngine.CharacterEscapingStrategy escapingStrategy)
attribute
- attribute whose values are to be preparedescapingStrategy
- character escaping strategy to be sued
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |