All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.addc.server.commons.tomcat.ServerPropertySource Maven / Gradle / Ivy

There is a newer version: 2.9
Show newest version
package com.addc.server.commons.tomcat;

import java.io.IOException;
import java.util.Properties;

import org.apache.tomcat.util.IntrospectionUtils.PropertySource;

import com.addc.commons.properties.PropertiesLoader;

/**
 * The ServerPropertySource supplies a properties source for the embedded tomcat
 * which reads the tomcat.properties file at creation
 */
public class ServerPropertySource implements PropertySource {
    private Properties props;

    /**
     * Create new PlayPropertySource from the file "classpath:tomcat.properties"
     * 
     * @throws IOException
     *             if the tomcat properties file cannot be loaded
     */
    public ServerPropertySource() throws IOException {
        this("classpath:tomcat.properties");
    }

    /**
     * Create a new ServerPropertySource using the given file name
     * 
     * @param tomcatpropsFileName
     *            The tomcat properties file path
     * @throws IOException
     *             if the tomcat properties file cannot be loaded
     */
    public ServerPropertySource(String tomcatpropsFileName) throws IOException {
        props= PropertiesLoader.getInstance().load(tomcatpropsFileName);
    }

    @Override
    public String getProperty(String key) {
        return props.getProperty(key);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy