GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



next up previous contents
Next: Appendix: Regular Expressions Up: Manual Previous: GATResult Macro's   Contents


Appendix: GATPreferences

The majority of functionality present in GAT is implemented through the the auspices of software components called ``adaptors.'' An adaptors is software component written by a third party which provide some functionality present in the GAT API. For example the class GATFile provides to the application programmer the functionality of moving files. GAT itself does not actually provide such functionality, but only delegates calls to move files to the appropriate adaptor. Hence, GAT, in all truth, simply provides a uniform interface to a set of adaptors.

GAT allows for various adaptors to provide the same functionality. So, for example, there may exist several adaptors which provide all the functionality present in the GATFile class. For example, one adaptor may communicate with remote computers using HTTP protocols while the second may use HTTPS. The question then arises how does the application programmer choose a particular adaptor or a particular class of adaptors to do her bidding? The answer to this question is GATPreferences.

The class GATPreferences can be thought of as a GATObject subclass which is a hashtable capable of holding a set of key/value pairs in which the keys and values are standard C strings, zero terminated a char *'s. When a particular adaptor is loaded by GAT it registers with GAT a GATPreferences describing itself. The application programmer, when she wishes to create a GATFile, say, passes the ``Create'' call a GATPreferences which describes, using key/value paris, the adaptor the application programmer wishes to use. This application programmer provided GATPreferences is then ``matched'' against the adaptor provided GATPreferences, and the first adaptor with a ``matching'' GATPreferences instance is then used to do the application programmer's bidding.

This process of ``matching'' GATPreferences instances is actually relatively simple. For a GATPreferences instance criteria to match a second GATPreferences instance preferences all keys present in criteria must be present in preferences and their corresponding values must ``match,'' a value in preferences is matched by a POSIX 1003.2 regular expression in criteria. GAT has abstracted this process of matching two GATPreferences instances in to a single call,

GATBool 
  GATPreferences_Match( GATPreferences_const preferences, 
                        GATPreferences_const criteria)

So, for example, to determine if a GATPreferences instance criteria matches a GATPreferences instance preferences we would proceed as follows

GATBool match;
GATPreferences criteria;
GATPreferences preferences;

criteria = ...
preferences = ...

match = GATPreferences_Match( preferences, criteria );

if( GATTrue == match )
{
  printf( "criteria matches preferences\n" );
}
else
{
  printf( "criteria does not match preferences\n" );
}


next up previous contents
Next: Appendix: Regular Expressions Up: Manual Previous: GATResult Macro's   Contents
Andre Merzky 2004-05-13