Package org.opensaml.saml.metadata.generator.impl

# Class VelocityMetadataGenerator

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
org.opensaml.saml.metadata.generator.impl.VelocityMetadataGenerator

All Implemented Interfaces:
  `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `MetadataGenerator`

public class VelocityMetadataGenerator extends AbstractIdentifiableInitializableComponent implements MetadataGenerator
Implementation of SAML metadata generation using Velocity.

Since:
  5.0.0

## Field Summary

Fields
Modifier and Type
Field
Description
`private org.apache.velocity.app.VelocityEngine`
`velocityEngine`
Velocity engine.

## Constructor Summary

Constructors
Constructor
Description
`VelocityMetadataGenerator()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`doInitialize()`
`void`
`generate(MetadataGeneratorParameters params, Writer sink)`
Generate metadata using the supplied parameters into the supplied destination.
`protected org.apache.velocity.VelocityContext`
`getVelocityContext(TemplateMetadataGeneratorParameters params)`
Builds the Velocity template context.
`void`
`setVelocityEngine(org.apache.velocity.app.VelocityEngine engine)`
Set the Velocity engine to use.

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

`getId`

## Field Details

### velocityEngine

@NonnullAfterInit private org.apache.velocity.app.VelocityEngine velocityEngine
Velocity engine.

## Constructor Details

### VelocityMetadataGenerator

public VelocityMetadataGenerator()

## Method Details

### setVelocityEngine

public void setVelocityEngine(@Nonnull org.apache.velocity.app.VelocityEngine engine)
Set the Velocity engine to use.

Parameters:
  `engine` - velocity engine

### doInitialize

protected void doInitialize() throws ComponentInitializationException

Overrides:
  `doInitialize` in class `AbstractIdentifiedInitializableComponent`
Throws:
  `ComponentInitializationException`

### generate

public void generate(@Nonnull MetadataGeneratorParameters params, @Nonnull Writer sink) throws IOException
Generate metadata using the supplied parameters into the supplied destination.

The writer must be open and will not be closed by this method.

Specified by:
  `generate` in interface `MetadataGenerator`
Parameters:
  `params` - input parameters
  `sink` - destination for output
Throws:
  `IOException` - on error

### getVelocityContext

@Nonnull protected org.apache.velocity.VelocityContext getVelocityContext(@Nonnull TemplateMetadataGeneratorParameters params)
Builds the Velocity template context.

Parameters:
  `params` - the input parameters
Returns:
  the populated context