/*!
  @header FTServiceLoader
  @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
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__FTServiceLoader_H)
#define __FTServiceLoader_H

#include <Foundation/Foundation.h>
#include <FT/FTObject.h>
#include <FT/FTVersion.h>
#include <FT/FTService.h>
#include <FT/FTServiceAvailability.h>
#include <FT/FTServiceEnvironment.h>

/*!
 * @enum t_serviceMode_t
 * @abstract Used to specify the operation mode of a service
 * @constant FT_SERVICE_MODE_UNKNOWN unknown mode. May never be set
 * @constant FT_SERVICE_MODE_STARTED should be set after the setEnvironment call
 *   of a service loader. It indicates that the service has been started
 * @constant FT_SERVICE_MODE_ONLINE indicates that a service is available for
 *   usage
 * @constant FT_SERVICE_MODE_SHUTDOWN after being instructed to turn to this 
 *   mode a service should disconnect all ressources and be prepared to be
 *   removed
 */
typedef enum {
  FT_SERVICE_MODE_UNKNOWN = 0,
  FT_SERVICE_MODE_STARTED = 1,
  FT_SERVICE_MODE_ONLINE = 2,
  FT_SERVICE_MODE_SHUTDOWN = 8
} ft_serviceMode_t;


/*!
 * @protocol FTServiceLoader
 * @abstract A service loader is used to instantiate and return a service
 */
@protocol FTServiceLoader <FTObject>

/*!
 * @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 setEnvironment
 * @abstract called by the service manager directly after this object
 *   is being added to it
 * @param aServiceEnvironment environment for the serbice
 * @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
#endif
