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

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

#if !defined(__FTServiceManager_H)
#define __FTServiceManager_H

#include <Foundation/Foundation.h>
#include <FT/FTObject.h>
#include <FT/FTVersion.h>
#include <FT/FTService.h>
#include <FT/FTServiceLoader.h>
#include <FT/FTGraph.h>
#include <FT/FTNode.h>


/*!
 * @protocol FTServiceManager
 * @abstract Used to load/get services
 */
@protocol FTServiceManager <FTObject>

/*!
 * @method allServicesForGraph
 * @abstract This method gives information about the availability of 
 *   services for a particular graph
 */
- (id <ECIterator>) allServicesForGraph: (id <FTGraph>) aGraph;


/*!
 * @method allServicesForNode
 * @abstract This method gives information about the availability of services
 *   for a particular node
 */
- (id <ECIterator>) allServicesForNode: (id <FTNode>) aNode 
  ofGraph: (id <FTGraph>) aGraph;


/*!
 * @method registerServiceWithId
 * @abstract This method is used to register a service.
 * @discussion The current implementation simply removes older version if newer
 *   ones are being registered.
 * @param serviceId identifier for the service
 * @param serviceVersion version of this service
 * @param serviceLoader loader of this service
 * @throws ECAlreadyExistsException if the service already exists
 *   (same service-id and version)
 * @result self
 */
- registerServiceWithId: (NSString *) serviceId
  withVersion: (id <FTVersion>) serviceVersion 
  withServiceLoader: (id <FTServiceLoader>) serviceLoader;
  
  
/*!
 * @method serviceWithId 
 * @abstract returns the specified service
 * @result the specified service
 */
- (id <FTService>) serviceWithId: (NSString *) aServiceId 
  forGraph: (id <FTGraph>) aGraph;
  
  
/*!
 * @method serviceWithId 
 * @abstract returns the specified service
 * @result the specified service
 */
- (id <FTService>) serviceWithId: (NSString *) aServiceId 
  forGraph: (id <FTGraph>) aGraph forNode: (id <FTNode>) aNode;
  

/*!
 * @method switchAllServicesToMode
 * @param serviceMode mode to switch to
 * @result self
 * @abstract Switches all registered services to the specified mode
 */
- switchAllServicesToMode: (ft_serviceMode_t) serviceMode;

  
/*!
 * @method unregisterAllVersionsOfServiceWithId
 * @abstract removes all versions of the specified service
 * @result self
 */
- unregisterAllVersionsOfServiceWithId: (NSString *) serviceId;
@end
#endif
