/*!
  @header FTSystemDictionary
  @abstract Module of FT
 
  @availability OS X, GNUstep
  @copyright 2004, 2005, 2006 Free Software Foundation, Inc.
  
  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 (at your option) 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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA

  <pre>
  -------------------------------------------------------------------------
  Modification history

  02.03.05 ola     initial version
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__FTSystemDictionary_H)
#define __FTSystemDictionary_H

#include <Foundation/Foundation.h>
#include <FT/FTObject.h>
#include <FT/FTDictionaryProvider.h>

@protocol FTServer;

/*!
 * @class FTSystemDictionary
 * @abstract The system dictionary is used to manage system internal settings
 */
@interface FTSystemDictionary : FTObject {
  @private
    id <FTDictionaryProvider> dictionaryProvider;
    id <FTServer> server;
}


/*!
 * @method initWithDictionaryProvider
 * @param aDictionaryProvider dictionary to use
 * @abstract initialize this instance with the underlying dictionary to be
 *  used
 */
- initWithDictionaryProvider: (id <FTDictionaryProvider>) aDictionaryProvider
  forServer: (id <FTServer>) aServer;
- (void) dealloc;


  
/*!
 * @method newGraphDatabaseName
 * @abstract return  a unique name usefule for creating a database.
 *   This name is based on a naming scheme and a related counter.
 * @discussion This method is for internal purposes only.
 * @param schemeInfoEntry reference to an entry within info.plist
 *   which contains the naming scheme
 * @param aCounterName name of the counter which refers to an integer value
 *   within the dictionary provider
 * @param increment value to add to the counter before creating the name
 * @discussion based on a naming scheme, a counter and an increment value
 *  this method creates a unique name for a database. For internal usage only.
 * @throws ECIllegalArgumentException if the info.plist entry could not be 
 *   found.
 * @throws ECIllegalStateException in case an exception occurs using the
 *   given dictionary provider.
 */
 - (NSString *) newUniqueNameWithScheme: (NSString *) schemeInfoEntry
  counterName: (NSString *) aCounterName increment: (int) increment;
  
  
/*!
 * @method newGraphDatabaseName
 * @abstract Get a unique name for a graph database
 * @discussion This method is based on an internal counter and the naming schema
 *   to be found in info.plist under {@link #FT_IP_GRAPH_DBNAME_SCHEME}
 * @result unique name for a database
 * @throws ECIllegalStateException in case of an unexpected error using the
 *   given dictionary provider.
 */
- (NSString *) newGraphDatabaseName;


/*!
 * @method setup
 * @abstract setup this dictionary
 * @discussion this method should directly be called after the dictionary
 *   database has been created. It setups basic entries.
 */
- setup;


/*!
 * @method updateCounterWithName
 * @abstract update an entry by incrementing its value
 * @discussion This method is for internal purposes only
 * @param aName name of entry
 * @param increment value to add
 * @result new value
 * @throws ECIllegalStateException in case of an exception thrown by the
 *   dictiobary provider
 */
- (int) updateCounterWithName: (NSString *) aName increment: (int) increment;
@end
#endif
