00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 static const char *rcsid = "$Header: /export/cvs-gridlab/wp-1/Codes/GATEngine/C-reference/adaptors/resourcebroker/resourcebroker_adaptor.c,v 1.7 2004/04/26 12:29:57 hartmutkaiser Exp $";
00018
00019
00020 #include <stdio.h>
00021 #include <stdlib.h>
00022 #include <string.h>
00023
00024
00025 #include <GATCPI.h>
00026
00027 #include "resourcebroker.h"
00028 #include "reservation.h"
00029 #include "resource.h"
00030 #include "job.h"
00031 #include "self.h"
00032 #include "request.h"
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 GATResult
00058 resourcebroker_adaptor_register(GATContext error_context, GATRegistry registry,
00059 GATTable_const system_config, GATTable_const instance_config, void *token)
00060 {
00061 GAT_USES_STATUS(error_context, "resourcebroker_adaptor_register");
00062
00063 if (!GATVERSION_ISCOMPATIBLE())
00064 {
00065 GAT_CREATE_STATUS(GAT_UNKNOWN_VERSION);
00066 }
00067 else
00068 {
00069 int load_resourcebroker_cpi = 0;
00070 int load_reservation_cpi = 0;
00071 int load_resource_cpi = 0;
00072 int load_job_cpi = 0;
00073 int load_self_cpi = 0;
00074 int load_request_cpi = 0;
00075
00076
00077 GATResult retval = GATTable_Get_int(instance_config, "ResourceBroker",
00078 &load_resourcebroker_cpi);
00079 if (GAT_SUCCESS != retval)
00080 {
00081 load_resourcebroker_cpi = 1;
00082 }
00083
00084
00085 retval = GATTable_Get_int(instance_config, "Reservation",
00086 &load_reservation_cpi);
00087 if (GAT_SUCCESS != retval)
00088 {
00089 load_reservation_cpi = 1;
00090 }
00091
00092
00093 retval = GATTable_Get_int(instance_config, "Resource", &load_resource_cpi);
00094 if (GAT_SUCCESS != retval)
00095 {
00096 load_resource_cpi = 1;
00097 }
00098
00099
00100 retval = GATTable_Get_int(instance_config, "Job", &load_job_cpi);
00101 if (GAT_SUCCESS != retval)
00102 {
00103 load_job_cpi = 1;
00104 }
00105
00106
00107 retval = GATTable_Get_int(instance_config, "Self", &load_self_cpi);
00108 if (GAT_SUCCESS != retval)
00109 {
00110 load_self_cpi = 1;
00111 }
00112
00113
00114 retval = GATTable_Get_int(instance_config, "Request", &load_request_cpi);
00115 if (GAT_SUCCESS != retval)
00116 {
00117 load_request_cpi = 1;
00118 }
00119
00120
00121 retval = GAT_SUCCESS;
00122 if (load_resourcebroker_cpi)
00123 {
00124 GAT_CREATE_STATUS(resourcebroker_adaptor_Register_GATResourceBrokerCPI(
00125 error_context, registry, system_config, instance_config, token));
00126 }
00127 if (GAT_SUCCEEDED(GAT_CURRENT_STATUS()) && load_reservation_cpi)
00128 {
00129 GAT_CREATE_STATUS(resourcebroker_adaptor_Register_GATReservationCPI(
00130 error_context, registry, system_config, instance_config, token));
00131 }
00132 if (GAT_SUCCEEDED(GAT_CURRENT_STATUS()) && load_resource_cpi)
00133 {
00134 GAT_CREATE_STATUS(resourcebroker_adaptor_Register_GATResourceCPI(
00135 error_context, registry, system_config, instance_config, token));
00136 }
00137 if (GAT_SUCCEEDED(GAT_CURRENT_STATUS()) && load_job_cpi)
00138 {
00139 GAT_CREATE_STATUS(resourcebroker_adaptor_Register_GATJobCPI(
00140 error_context, registry, system_config, instance_config, token));
00141 }
00142 if (GAT_SUCCEEDED(GAT_CURRENT_STATUS()) && load_self_cpi)
00143 {
00144 GAT_CREATE_STATUS(resourcebroker_adaptor_Register_GATSelfCPI(
00145 error_context, registry, system_config, instance_config, token));
00146 }
00147 if (GAT_SUCCEEDED(GAT_CURRENT_STATUS()) && load_request_cpi)
00148 {
00149 GAT_CREATE_STATUS(resourcebroker_adaptor_Register_GATRequestCPI(
00150 error_context, registry, system_config, instance_config, token));
00151 }
00152 }
00153 return GAT_RETURN_STATUS();
00154 }
00155
00156
00157