examples/wmp_job_examples.h

Go to the documentation of this file.
00001 /*
00002 *       Copyright (c) Members of the EGEE Collaboration. 2004.
00003 *       See http://www.eu-egee.org/partners/ for details on the
00004 *       copyright holders.
00005 *
00006 *       Licensed under the Apache License, Version 2.0 (the "License");
00007 *       you may not use this file except in compliance with the License.
00008 *       You may obtain a copy of the License at
00009 *        
00010 *            http://www.apache.org/licenses/LICENSE-2.0
00011 *        
00012 *       Unless required by applicable law or agreed to in writing, software
00013 *       distributed under the License is distributed on an "AS IS" BASIS,
00014 *       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
00015 *       either express or implied.
00016 *       See the License for the specific language governing permissions and
00017 *       limitations under the License.
00018 */
00019 
00020 #ifndef GLITE_WMS_WMPROXYAPICPP_WMP_JOB_EXAMPLES_H
00021 #define GLITE_WMS_WMPROXYAPICPP_WMP_JOB_EXAMPLES_H
00022 
00023 #include "glite/wms/wmproxyapi/wmproxy_api.h"
00024 
00025 
00026 // Exceptions
00027 #include "glite/wmsutils/exception/Exception.h"
00028 
00029 #include <iostream>
00030 #include <vector>
00031 
00032 extern "C" {
00033 #include <getopt.h>
00034 }
00035 #include <fstream>
00036 #include <sstream>
00037 
00038 namespace glite {
00039 namespace wms {
00040 namespace wmproxyapi {
00041 namespace examples {
00042 namespace utilities {
00043 
00044 // environment variable for the wmproxy service URL
00045 #define GLITE_WMPROXY_ENDPOINT  "GLITE_WMPROXY_ENDPOINT"
00046 
00047 /*
00048 *       removes the white spaces at the beginning and
00049 *       at the end of the input string
00050 *       @param str input string
00051 */
00052 const char* clean(char *str);
00053 /*
00054 *       reads the jobid from a file
00055 *       @param path filepath
00056 *       @return a pointer to the jobid string
00057 */
00058 std::string* jobidFromFile (const std::string &path);
00059 /*
00060 *       gets a string with messages of the input exception
00061 *       @param b_ex input BaseException
00062 *       @return the error message of the exception
00063 */
00064 const std::string handle_exception (const glite::wms::wmproxyapi::BaseException &b_ex );
00065 /*
00066 *       save the text in the input string buffer into a file
00067 *       @param path filepath
00068 *       @param bfr input string buffer
00069 *       @return 0 in case of success; -1 in case of any error
00070 */
00071 int saveToFile (const std::string &path, const std::string &bfr) ;
00072 
00073 /*
00074 *       contacts the endpoint configurated in the context
00075 *       in order to retrieve the http(s) destionationURI of the job
00076 *       identified by jobid
00077 *       @param jobid the identifier of the job
00078 *       @param cfs context
00079 *       @return a string with the http(s) destinationURI('s) (or NULL in case of error)
00080 *
00081 */
00082 std::string* getInputSBDestURI(const std::string &jobid, const ConfigContext *cfs);
00083 /*
00084 *       performs user proxy delegation with del_id delegation identifier string
00085 *       @param cfs context (proxy, endpoint, trusted certificates)
00086 *       @param del_id identifier of the delegation operation
00087 *       @param verbose verbosity
00088 *       @return a string with the user proxy
00089 */
00090 const std::string makeDelegation (ConfigContext *cfs, const std::string &del_id, const bool &verbose = false);
00091 /*
00092 *       peforms proxy delegation automatically generating the delegation identifier string
00093 *       @param cfs context (proxy, endpoint, trusted certificates)
00094 *       @param verbose verbosity
00095 */
00096 std::string* makeAutomaticDelegation (ConfigContext *cfs, const bool &verbose = false);
00097 /*
00098 *       checks if the user free quota could support (in size) the transferring of a set of files
00099 *       to the endpoint specified in the context
00100 *       @param files the set of files to be transferred
00101 *       @param cfs context (proxy, endpoint, trusted certificates)
00102 *       @param verbose verbosity
00103 */
00104 bool checkFreeQuota ( const std::vector<std::pair<std::string,std::string> > &files, ConfigContext *cfs, const bool &verbose = false );
00105 /*
00106 *       removes dir-separator characters at the end of the input path
00107 *       if they are present
00108 *       @param fpath the input pathname
00109 *       @return the normalized pathname
00110 */
00111 std::string normalize_path( const std::string &fpath );
00112 /*
00113 *       adds a wildcard at the end of the input pathname
00114 *       @param path the input pathname
00115 *       @param wc the wildcard
00116 *       @return the pathame with the wildcard at the end
00117 *
00118 */
00119 std::string addWildCards2Path(std::string& path, const std::string &wc);
00120 
00121 
00122 
00123 } //glite
00124 }//wms
00125 }//wmproxyapi
00126 }//examples
00127 }//utilities
00128 
00129 
00130 
00131 #endif  // GLITE_WMS_WMPROXYAPICPP_WMP_JOB_EXAMPLES_H

Generated on Wed May 16 19:13:03 2012 for glite-wms-wmproxy-api-cpp-3.3.3 by  doxygen 1.4.7