    View Javadoc
    1   /*
    2    * Copyright (c) 2003
    3    * Information Desire GmbH
    4    * All rights reserved.
    5    */
    6   package com.infodesire.infobit;
    7
    8   import org.apache.commons.logging.Log;
    9   import org.apache.commons.logging.LogFactory;
    10
    11  import java.util.HashMap;
    12  import java.util.Map;
    13
    14  import com.infodesire.infobit.config.InfobitConfig;
    15
    16  import java.io.InputStream;
    17
    18  /***
    19   * configuration manager for infobit pools. can provide pools by name
    20   *
    21   * @author    konstantin
    22   * @created   July 29, 2003
    23   * @version   $Revision: 1.3 $
    24   */
    25  public class InfobitConfiguration {
    26      private final static String DEFAULT_CONFIG = "infobit-config.xml";
    27
    28      private static InfobitConfiguration _instance = null;
    29      private static Log _log = LogFactory.getLog(InfobitConfiguration.class);
    30
    31      private Map     _poolMap = new HashMap();
    32
    33
    34      /***
    35       * Constructor for the InfobitManager object
    36       */
    37      public InfobitConfiguration() {
    38          this(DEFAULT_CONFIG);
    39      }
    40
    41
    42      /***
    43       * Constructor for the InfobitManager object
    44       *
    45       * @param file  Description of Parameter
    46       */
    47      public InfobitConfiguration(String file) {
    48          if (_log.isDebugEnabled()) {
    49              _log.debug("configuring with file: " + file);
    50          }
    51          InfobitConfig config = new InfobitConfig();
    52          config.configure(this, file);
    53      }
    54
    55
    56      /***
    57       * Gets the Instance attribute of the InfobitManager class
    58       *
    59       * @return   The Instance value
    60       */
    61      public static InfobitConfiguration getInstance() {
    62          try {
    63              if (_instance == null) {
    64                  _instance = new InfobitConfiguration();
    65              }
    66          } catch (RuntimeException ex) {
    67              _log.error("exception occured while instaniating", ex);
    68              throw ex;
    69          }
    70          return _instance;
    71      }
    72
    73
    74      /***
    75       * Gets the Pool attribute of the InfobitManager object
    76       *
    77       * @param name  Description of Parameter
    78       * @return      The Pool value
    79       */
    80      public InfobitPool getPool(String name) {
    81          return (InfobitPool) _poolMap.get(name);
    82      }
    83
    84
    85      /***
    86       * Adds a feature to the Pool attribute of the InfobitManager object
    87       *
    88       * @param pool  The feature to be added to the Pool attribute
    89       */
    90      public void addPool(InfobitPool pool) {
    91          _poolMap.put(pool.getName(), pool);
    92      }
    93  }

This page was automatically generated by Maven