001package org.nuxeo.template.api.context;
002
003import java.util.Map;
004
005import org.nuxeo.ecm.core.api.DocumentModel;
006
007/**
008 * Factory used to register new Context Extensions The resturned Object will be directly accessible inside the Rendering
009 * context
010 * 
011 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a>
012 */
013public interface ContextExtensionFactory {
014
015    /**
016     * Called before redering to let you add objects inside the rendering context.
017     * <p>
018     * If the method returns an object, it will be automatically pushed inside the context using the name defined in the
019     * contribution.
020     * </p>
021     * <p>
022     * you can also directly push in the provided ctx map
023     * </p>
024     * 
025     * @param currentDocument
026     * @param wrapper
027     * @param ctx
028     * @return
029     */
030    Object getExtension(DocumentModel currentDocument, DocumentWrapper wrapper, Map<String, Object> ctx);
031}