/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package com.celements.inheritor;
import java.util.Properties;
import org.xwiki.component.annotation.Component;
import org.xwiki.component.annotation.Requirement;
import org.xwiki.component.phase.Initializable;
import org.xwiki.component.phase.InitializationException;
import org.xwiki.configuration.ConfigurationSource;
/**
* All configuration options for the Template Path transformation to access templates on
* disk based on inheritance.
*/
@Component
public class DefaultTemplatePathTransformationConfiguration implements
TemplatePathTransformationConfiguration, Initializable {
/**
* Prefix for configuration keys for the Icon transformation module.
*/
private static final String PREFIX = "celRendering.transformation.templatePath.";
/**
* Default Tools.
*/
private Properties defaultMappings = new Properties();
/**
* Defines from where to read the rendering configuration data.
*/
@Requirement
private ConfigurationSource configuration;
/**
* {@inheritDoc}
*
* @see org.xwiki.component.phase.Initializable#initialize()
*/
public void initialize() throws InitializationException {
// Default Mappings
this.defaultMappings.setProperty("Templates", "celTemplates");
this.defaultMappings.setProperty("Ajax", "celAjax");
this.defaultMappings.setProperty("Mails", "celMails");
this.defaultMappings.setProperty("ActionTemplates", "celActionTemplates");
}
/**
* {@inheritDoc}
*
* @see com.celements.inheritor.TemplatePathTransformationConfiguration#getMappings()
*/
public Properties getMappings() {
// Merge default properties and properties defined in the configuration
Properties props = new Properties();
props.putAll(this.defaultMappings);
props.putAll(this.configuration.getProperty(PREFIX + "mappings", Properties.class));
return props;
}
}