001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     bstefanescu
011 *
012 * $Id$
013 */
014
015package org.nuxeo.ecm.platform.rendering.fm;
016
017import org.nuxeo.runtime.model.ComponentContext;
018import org.nuxeo.runtime.model.ComponentInstance;
019import org.nuxeo.runtime.model.ComponentName;
020import org.nuxeo.runtime.model.DefaultComponent;
021
022/**
023 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
024 */
025public class FreemarkerComponent extends DefaultComponent {
026
027    public static final ComponentName NAME = new ComponentName(FreemarkerComponent.class.getName());
028
029    @Override
030    public void activate(ComponentContext context) {
031    }
032
033    @Override
034    public void deactivate(ComponentContext context) {
035    }
036
037    @Override
038    public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) {
039    }
040
041    public FreemarkerEngine newEngine() {
042        return new FreemarkerEngine();
043    }
044
045    @Override
046    public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) {
047    }
048
049    @Override
050    public <T> T getAdapter(Class<T> adapter) {
051        if (adapter == FreemarkerComponent.class) {
052            return adapter.cast(this);
053        }
054        return null;
055    }
056
057}