Search in sources :

Example 1 with ScriptService

use of org.xwiki.script.service.ScriptService in project xwiki-platform by xwiki.

the class AnnotationVelocityContextInitializer method initialize.

@Override
public void initialize(VelocityContext context) {
    try {
        // create a wrapper of the annotation service for exposing its methods in velocity
        ScriptService annotationsScriptService = componentManager.getInstance(ScriptService.class, ANNOTATION_SCRIPT_SERVICE_HINT);
        context.put(VELOCITY_CONTEXT_KEY, annotationsScriptService);
    } catch (ComponentLookupException e) {
        this.logger.warn("Could not initialize the annotations velocity bridge, " + "annotations service will not be accessible in velocity context.");
    }
}
Also used : ScriptService(org.xwiki.script.service.ScriptService) ComponentLookupException(org.xwiki.component.manager.ComponentLookupException)

Aggregations

ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)1 ScriptService (org.xwiki.script.service.ScriptService)1