001    /**
002     * ========================================
003     * JFreeReport : a free Java report library
004     * ========================================
005     *
006     * Project Info:  http://reporting.pentaho.org/
007     *
008     * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors.
009     *
010     * This library is free software; you can redistribute it and/or modify it under the terms
011     * of the GNU Lesser General Public License as published by the Free Software Foundation;
012     * either version 2.1 of the License, or (at your option) any later version.
013     *
014     * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016     * See the GNU Lesser General Public License for more details.
017     *
018     * You should have received a copy of the GNU Lesser General Public License along with this
019     * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020     * Boston, MA 02111-1307, USA.
021     *
022     * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023     * in the United States and other countries.]
024     *
025     * ------------
026     * $Id: NullConfigStorage.java 3048 2007-07-28 18:02:42Z tmorgner $
027     * ------------
028     * (C) Copyright 2000-2005, by Object Refinery Limited.
029     * (C) Copyright 2005-2007, by Pentaho Corporation.
030     */
031    
032    package org.jfree.report.modules.preferences.base;
033    
034    import org.jfree.util.Configuration;
035    
036    /**
037     * An empty default implementation. This config storare will not store any values and will
038     * provide no read access to stored properties by denying their existence.
039     *
040     * @author Thomas Morgner
041     */
042    public class NullConfigStorage implements ConfigStorage
043    {
044      /**
045       * DefaultConstructor.
046       */
047      public NullConfigStorage ()
048      {
049      }
050    
051      /**
052       * This method does nothing.
053       *
054       * @param configPath this parameter is not used.
055       * @param properties this parameter is not used.
056       * @see org.jfree.report.modules.misc.configstore.base.ConfigStorage#storeProperties
057       *      (java.lang.String, java.util.Properties)
058       */
059      public void store (final String configPath, final Configuration properties)
060      {
061      }
062    
063      /**
064       * Loads the properties from the given path, specifying the given properties as
065       * default.
066       * <p/>
067       * This implementation will always throw and ConfigStoreException as the specified
068       * resource is not available.
069       *
070       * @param configPath the configuration path from where to read the properties.
071       * @param defaults   the property set that acts as fallback to provide default values.
072       * @return the loaded properties
073       *
074       * @throws ConfigStoreException always throws this exception as the specified resource
075       *                              will be not available.
076       */
077      public Configuration load (final String configPath, final Configuration defaults)
078              throws ConfigStoreException
079      {
080        throw new ConfigStoreException("This configuration path is not available.");
081      }
082    
083      /**
084       * Tests, whether some configuration data exists for the given configuration.
085       * <p/>
086       * This method returns always false and denies the existence of any resource.
087       *
088       * @param configPath the configuration path to the property storage.
089       * @return always false as this implementation does not store anything.
090       */
091      public boolean isAvailable (final String configPath)
092      {
093        return false;
094      }
095    }