GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

advertservice_adaptor.c

Go to the documentation of this file.
00001 /** @file advertservice_adaptor.c
00002  *  Source file for the adverservice_adaptor entry point.
00003  *
00004  *  @date Thu Mar 18 2004
00005  *
00006  *  @version $Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/adaptors/advertservice_adaptor/advertservice_adaptor.c,v 1.6 2004/04/26 12:30:24 hartmutkaiser Exp $
00007  *
00008  *  Copyright (C) Hartmut Kaiser
00009  *  This file is part of the GAT Engine.
00010  *  Contributed by Hartmut Kaiser <hartmutkaiser [at] t-online [dot] de>.
00011  *
00012  *  Use, modification and distribution is subject to the Gridlab Software
00013  *  License. (See accompanying file GLlicense.txt or copy at
00014  *  http://www.gridlab.org/GLlicense.txt)
00015  */
00016  
00017 static const char *rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/adaptors/advertservice_adaptor/advertservice_adaptor.c,v 1.6 2004/04/26 12:30:24 hartmutkaiser Exp $";
00018  
00019 /* System Header Files */
00020 #include <stdio.h>
00021 #include <stdlib.h>
00022 #include <string.h>
00023 
00024 /* GAT Header Files */
00025 #include <GATCPI.h>
00026 
00027 #include "advertservice.h"
00028 
00029 /* Macros */
00030 
00031 /* Structures, unions and enums */
00032 
00033 /* Static function prototypes */
00034 
00035 /* File scope variables */
00036 
00037 /* External functions */
00038 /** resourcebroker_adaptor_register
00039  *  Registers all CPIs this adaptor provides.
00040  *  This function is invoked by the loader in the GATEngine when
00041  *  an instance of this adaptor is loaded.  Each instance has its
00042  *  own private configuration table.
00043  *
00044  *  @param registry The registry the adaptor should register its CPIs with.
00045  *  @param system_config The system configuration table.
00046  *  @param instance_config The configuration table for this instance.
00047  *  @param token An arbitrary token used by the loader to identify this adaptor 
00048  *        instance
00049  *
00050  *  @return An error code.
00051  */
00052 GATResult 
00053 advertservice_adaptor_register(GATContext error_context, GATRegistry registry, 
00054   GATTable_const system_config, GATTable_const instance_config, void *token)
00055 {
00056   GAT_USES_STATUS(error_context, "advertservice_adaptor_register_ex");
00057   
00058   int load_request_cpi = 0;
00059   
00060   if (!GATVERSION_ISCOMPATIBLE())
00061   {
00062     GAT_CREATE_STATUS(GAT_UNKNOWN_VERSION);
00063   }
00064   else
00065   {
00066     /* Check if the user has disabled the creation of a ResourceBrokerCPI */
00067     GATResult retval = GATTable_Get_int(instance_config, "AdvertService", 
00068       &load_request_cpi);
00069     if (GAT_SUCCESS != retval)
00070     {
00071       load_request_cpi = 1;
00072     }
00073 
00074     /* load CPI's if appropriate */
00075     if (load_request_cpi)
00076     {
00077       GAT_CREATE_STATUS(advertservice_adaptor_Register_GATAdvertServiceCPI(
00078         error_context, registry, system_config, instance_config, token));
00079     }
00080   }
00081   return GAT_RETURN_STATUS();
00082 }
00083 
00084 
00085 /* Local functions */