GridLab
Grid Application Toolkit

A simple API for Grid Applications
GAT

Menu



next up previous contents
Next: Some Useful Programs Up: The Advertisement Package Previous: Getting or Deleting an   Contents

Setting and Getting the Working Directory

A point which we have, as up until this moment ignored is the fact that a POSIX path can be not only an absolute path but also also a relative path. What happens if one uses a relative POSIX path for something like the ``Get'' function above? Well, it works.

The GATAdvertService carries internal state in the form of a ``working directory.'' A working directory is a POSIX path which is used to resolve relative POSIX paths passed to the GATAdvertService. As an example , consider the case in which an GATAdvertService has the working directory

/Users/lenardo/unfinished/house/

then is asked to ``Get'' the advertisable at POSIX path

../ufizzi/waterpeople

The GATAdvertService would the resolve this relative POSIX path against the working directory and get the advertisable at the absolution POSIX path

/Users/lenardo/unfinished/ufizzi/waterpeople

A similar resolution process will occur for any GATAdvertService which accepts a POSIX path. So, you may ask, how does this working directory get set?

The working directory for a GATAdvertService get set through a call to the following function

GATResult GATAdvertService_SetPWD( GATAdvertService as, GATString_const path )

The first argument to this function is the GATAdvertService whose working directory is to be set. ( One should note even through a GATAdvertService is accessible across machine boundaries the working directory of a GATAdvertService is a property which is specific to a given GATAdvertService instance. So, setting the working directory on instance A of a GATAdvertService has no effect upon the working directory of GATAdvertService instance B. ) The next argument to this function is a GATString which is the POSIX path of the desired working directory. Again, this POSIX path can also be a relative path and would, in this case, be resolved against the current working directory of the GATAdvertService. Finally, this function returns a GATResult which indicates the completion status of this function.

As one may set the working the directory, the next natural thing one may wish to do is to get the working directory that one has just set or that, more commonly, has been set by some other code. This is achieved through use of the function

GATResult GATAdvertService_GetPWD(GATAdvertService object, GATString *path)

the first argument is the GATAdvertService one wishes to obtain the working directory of. The second argument is a pointer to a GATString. It is through this pointer that a GATString instance containing the working directory of the passed GATAdvertService is returned to the caller. Finally, this function returns a GATResult, a type covered in Appendix [*], which indicates the completion status of this function.


next up previous contents
Next: Some Useful Programs Up: The Advertisement Package Previous: Getting or Deleting an   Contents
Andre Merzky 2004-05-13