use of org.xwiki.template.event.TemplateEvent in project xwiki-platform by xwiki.
the class DefaultVelocityManager method initialize.
@Override
public void initialize() throws InitializationException {
this.observation.addListener(new EventListener() {
@Override
public void onEvent(Event event, Object source, Object data) {
if (event instanceof TemplateEvent) {
TemplateEvent templateEvent = (TemplateEvent) event;
DefaultVelocityManager.this.velocityFactory.removeVelocityEngine(templateEvent.getId());
}
}
@Override
public String getName() {
return DefaultVelocityManager.class.getName();
}
@Override
public List<Event> getEvents() {
return EVENTS;
}
});
// Set reserved bindings
// "context" is a reserved binding in JSR223 world
this.reservedBindings.add("context");
// Macros directive
this.reservedBindings.add("macro");
// Foreach directive
this.reservedBindings.add("foreach");
this.reservedBindings.add(this.velocityConfiguration.getProperties().getProperty(RuntimeConstants.COUNTER_NAME, RuntimeSingleton.getString(RuntimeConstants.COUNTER_NAME)));
this.reservedBindings.add(this.velocityConfiguration.getProperties().getProperty(RuntimeConstants.HAS_NEXT_NAME, RuntimeSingleton.getString(RuntimeConstants.HAS_NEXT_NAME)));
// Evaluate directive
this.reservedBindings.add("evaluate");
// TryCatch directive
this.reservedBindings.add("exception");
this.reservedBindings.add("try");
// Default directive
this.reservedBindings.add("define");
// The name of the context variable used for the template-level scope
this.reservedBindings.add("template");
}
Aggregations