/*!
  @header FTDictionaryServiceLoader
  @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

  21.09.05 ola     initial version
  16.07.06 ola     new implementation
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__FTDictionaryServiceLoader_H)
#define __FTDictionaryServiceLoader_H

#include <Foundation/Foundation.h>
#include <FT/FTObject.h>
#include <FT/FTServiceLoader.h>
#include <FT/FTServiceAvailability.h>


/*!
 * @class FTDictionaryServiceLoader
 * @abstract Used to integrate the service FTDictionaryService
 */
@interface FTDictionaryServiceLoader : FTObject <FTServiceLoader> {
  @private
    id <FTVersion> serviceVersion;
    id <FTServiceAvailability> serviceAvailability;
    id <FTServiceEnvironment> serviceEnvironment;
    
    /*
     * String containg basic name scheme used by all instances of
     * FTDictionaryServiceForGraphImpl
     */
    NSString *databaseNameScheme;

        
    ECCache *graphToServiceImpl;
    NSLock *generalLock;
    
}

/*!
 * @method initialize
 * @abstract used to set up this 
 */
- init;
- (void) dealloc;


/*!
 * @method databaseNameScheme
 * @result the naming schema for each graph dictionary database
 */
- (NSString *) databaseNameScheme;


/*! 
 * @method onGraphClosed
 * @abstract called by notification center in case a graph has been closed
 * @param notification underlying notification
 * @result self
 */
- onGraphClosed: (NSNotification *) notification;


/*!
 * @method serviceAvailability
 * @result information about the availability of the service
 */
- (id <FTServiceAvailability>) serviceAvailability;


/*!
 * @method serviceForGraph
 * @param aGraph graph to load the service for
 * @result loads the service for the specified graph
 */
- (id <FTService>) serviceForGraph: (id <FTGraph>) aGraph;


/*!
 * @method serviceForNode
 * @param aGraph graph to load the service for
 * @result loads the service for the specified graph
 */
- (id <FTService>) serviceForNode: (id <FTNode>) aNode 
  ofGraph: (id <FTGraph>) aGraph;
  

/*!
 * @method serviceId
 * @result identifier for this services
 */
- (NSString *) serviceId;


/*! 
 * @method version
 * @result return the version of this service
 */
- (id <FTVersion>) serviceVersion;


/*!
 * @method setDatabaseNameSchema
 * @abstract specifies the naming schema for each graph dictionary database
 * @param aDatabaseName the naming schema for each graph dictionary database
 * @result self
 */
- setDatabaseNameSchema: (NSString *) aDatabaseName;


/*!
 * @method setEnvironment
 * @abstract called by the service manager directly after this object
 *   is being added to it
 * @param aServiceEnvironment environment for the service
 * @result self
 */
- setEnvironment: (id <FTServiceEnvironment>) aServiceEnvironment;


/*!
 * @method switchToMode
 * @result self
 * @abstract used to switch to a given operation mode
 */
- switchToMode: (ft_serviceMode_t) aServiceMode;

@end


/*!
 * @class FTDictionaryServiceAvailability
 * @abstract Gives information about the availability
 * @discussion This dictionary service is available for all graphs and nodes.
 */
@interface FTDictionaryServiceAvailability : FTObject <FTServiceAvailability>
/*!
 * @method availableForGraph
 * @abstract checks wether the service is available for the given graph
 * @result returns YES if the service is available for the specified graph
 */
- (BOOL) availableForGraph: (id <FTGraph>) aGraph;


/*!
 * @method availableForNodesOfGraph
 * @abstract checks wether the service is available for the specified graph
 * @result YES if the service is available for the specified graph
 */
- (BOOL) availableForNodesOfGraph: (id <FTGraph>) aGraph;


/*!
 * @method availableForNode
 * @abstract checks wether the service is available for the specified node
 * @result YES if the service is available for the specified node
 */
- (BOOL) availableForNode: (id <FTNode>) aNode ofGraph: (id <FTGraph>) aGraph;
@end
#endif
