/**
 * Copyright (c) 2005 Red Hat, Inc. All rights reserved.
 *
 * This library 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 any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Component of: Red Hat Application Server
 *
 * Initial Developers: Gregory Lapouchnian
 *                     Patrick Smith
 * --------------------------------------------------------------------------
 * $Id$
 * --------------------------------------------------------------------------
 */
package olstore.client;

import java.util.Properties;

/**
 * Loads a configuration file and returns a properties object
 * that represents the properties set in the configuration file.
 */
public class Configure {

    /** Loaded properties. */
    private Properties props;

    /**
     * Load values from a properties file and store them in field in this class.
     * @throws Exception if the properties file is malformed
     */
    public Configure() throws Exception {
        load("uddi.properties");
    }

    /**
     * Given a configuration file load the properties from it.
     * @param file The configuration file to pass in.
     * @throws Exception If the file is malformed.
     */
    public void load(String file) throws Exception {
        props = new Properties();
        props.load(new java.io.FileInputStream(file));
    }

    /**
     * Get a property by name
     * @param name the name of the property
     * @return the value of the property with the given name
     */
    public String getProperty(String name) {
        return props.getProperty(name);
    }
}
