Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

RemoteLocalReplicaCatalog.h

Go to the documentation of this file.
00001 /* -*- C++ -*-
00002  *
00003  * RemoteLocalReplicaCatalog.h
00004  *
00005  * Copyright (c) 2002 CERN on behalf of the EU DataGrid.
00006  * For license conditions see LICENSE file or 
00007  * http://www.edg.org/license.html
00008  * 
00009  * $Id: RemoteLocalReplicaCatalog.h,v 1.50 2004/05/07 14:46:16 jamesc Exp $
00010  *
00011  */
00012 
00013 
00014 #ifndef RemoteLocalReplicaCatalog_H
00015 #define RemoteLocalReplicaCatalog_H
00016 
00017 #include <string>
00018 #include <vector>
00019 #include <memory>
00020 #include <iostream>
00021  
00022 #include "EdgReplicaLocationService/LocalReplicaCatalog.h"
00023 #include "EdgReplicaLocationService/ReplicationExceptions.h"
00024 
00025 struct soap;
00026 struct SOAP_ENV_Fault;
00027 
00028 namespace EdgReplicaLocationService
00029 {
00037   class RemoteLocalReplicaCatalog : public LocalReplicaCatalog
00038   {
00039   
00040   public:
00041 
00042     /* create a new RemoteLocalReplicaCatalog
00043      * @param url     The URL of the LocalReplicaCatalog to connect to.  This
00044      *                will normally be a normal http/s URI which points 
00045      *                to a SOAP endpoint.
00046 
00047      * @param timeOut the timeout value, positive means seconds
00048                       negative microseconds,
00049      *                default is 30 seconds
00050      */
00051     RemoteLocalReplicaCatalog(const std::string& url,
00052                               int timeOut=30);
00053 
00056     virtual ~RemoteLocalReplicaCatalog();
00057 
00062     const std::string& getUrl() const;
00063 
00065 
00079     virtual void addMapping(const std::string& guid,
00080                             const std::string& pfn)
00081       throw(ValueTooLongException,
00082             PfnExistsException,
00083             CommunicationException);
00084                         
00091     virtual void deleteMapping(const std::string& guid)
00092       throw(CommunicationException);
00093 
00100     virtual void removeMapping(const std::string& guid,
00101                                const std::string& pfn)
00102       throw(CommunicationException);
00103 
00111     virtual bool guidExists(const std::string& guid) const
00112       throw(CommunicationException);
00113                         
00121     virtual bool pfnExists(const std::string& pfn) const
00122       throw(CommunicationException);
00123     
00132     virtual void getPfns(const std::string&        guid,
00133                          std::vector<std::string>& output) const
00134       throw(NoSuchGuidException,
00135             CommunicationException);
00136   
00145     virtual const std::string guidForPfn(const std::string& pfn) const
00146       throw(NoSuchPfnException,
00147             CommunicationException);
00148 
00161     virtual void
00162     createAttributeDefinition(const AttributeDefinition& attrDef)
00163       throw(AttributeDefinitionExistsException,
00164             EmptyAttributeNameException,
00165             ValueTooLongException,
00166             CommunicationException);
00167 
00174     virtual AttributeDefinition
00175     getAttributeDefinition(const std::string& attrName) const
00176       throw(NoSuchAttributeDefinitionException,
00177             CommunicationException);
00178 
00185     virtual void
00186     getAttributeDefinitions(AttrDefs_t& attdefs) const
00187       throw(CommunicationException);
00188 
00198     virtual void
00199     removeAttributeDefinition(const std::string& attrName)
00200       throw(NoSuchAttributeDefinitionException,
00201             EmptyAttributeNameException,
00202             CommunicationException);
00203 
00210     virtual bool attributeDefinitionExists(const std::string& attrName) const
00211       throw(CommunicationException);
00212                 
00228     virtual void setPfnAttribute(const std::string& pfn, 
00229                                  const std::string& attrName,
00230                                  const std::string& value)
00231       throw(NoSuchPfnException,
00232             NoSuchAttributeDefinitionException,
00233             ValueTooLongException,
00234             CommunicationException);
00235       
00247     virtual void
00248     setStringPfnAttribute( const std::string& pfnName,
00249                            const std::string& attrDefnName,
00250                            const std::string& attrValue)
00251       throw(NoSuchAttributeDefinitionException,
00252             NoSuchPfnException,
00253             UnappropriateAttributeTypeException,
00254             CommunicationException);
00255       
00267     virtual void
00268     setIntPfnAttribute( const std::string& pfnName,
00269                         const std::string& attrDefnName,
00270                         int attrValue)
00271       throw(NoSuchAttributeDefinitionException,
00272             NoSuchPfnException,
00273             UnappropriateAttributeTypeException,
00274             CommunicationException);
00275       
00287     virtual void
00288     setFloatPfnAttribute(const std::string& pfnName,
00289                          const std::string attrDefnName,
00290                          float attrValue)
00291       throw(NoSuchAttributeDefinitionException,
00292             NoSuchPfnException,
00293             UnappropriateAttributeTypeException,
00294             CommunicationException);
00295 
00296     //       /** Add an attribute value to a PFN attribute of type date.
00297     //        *
00298     //        * @param pfnName The PFN
00299     //        * @param attrDefnName the name of attribute
00300     //        * @param attrValue The attribute value we'll add. 
00301     //        * @throws NoSuchPfnException if the PFN does not exist in the Catalog
00302     //        * @throws NoSuchAttributeDefinitionException if the definition of
00303     //        *         the attribute does not exist in the Catalog.
00304     //        * @throws UnappropriateAttributeTypeException
00305     //        *         if the attribute is not of type date
00306     //        */
00307     // TO BE REVISITED
00308     //       virtual void setDatePfnAttribute( const std::string& pfnName,
00309     //                                         const std::string& attrDefnName,
00310     //                                         Date attrValue)
00311     //         throw(NoSuchAttributeDefinitionException,
00312     //               NoSuchPfnException,
00313     //               UnappropriateAttributeTypeException,
00314     //               CommunicationException);
00315       
00328     virtual const std::string getPfnAttribute(const std::string& pfn, 
00329                                               const std::string& attrName) const
00330       throw(NoSuchPfnException,
00331             NoSuchAttributeDefinitionException,
00332             CommunicationException);
00333       
00343     virtual std::string
00344     getStringPfnAttribute( const std::string& pfnName,
00345                            const std::string& attrDefnName)
00346       throw(NoSuchPfnException,
00347             NoSuchAttributeDefinitionException,
00348             UnappropriateAttributeTypeException,
00349             CommunicationException);
00350       
00360     virtual int
00361     getIntPfnAttribute( const std::string& pfnName,
00362                         const std::string& attrDefnName)
00363       throw(NoSuchPfnException,
00364             NoSuchAttributeDefinitionException,
00365             UnappropriateAttributeTypeException,
00366             CommunicationException);
00367       
00377     virtual float
00378     getFloatPfnAttribute( const std::string& pfnName,
00379                           const std::string& attrDefnName)
00380       throw(NoSuchPfnException,
00381             NoSuchAttributeDefinitionException,
00382             UnappropriateAttributeTypeException,
00383             CommunicationException);
00384 
00385     //       /** return the value of a given date attribute for an PFN.
00386     //        *
00387     //        * @param pfnName the PFN
00388     //        * @param attrDefnName the AttributeDefinition name to check for
00389     //        * @return the attribute value
00390     //        * @throws NoSuchPfnException if the PFN does not exist in the Catalog
00391     //        * @throws NoSuchAttributeDefinitionException if the AttributeDefintion
00392     //        *         does not exist in the catalog.
00393     //        */
00394     // TO BE REVISITED
00395     //       virtual Date getDatePfnAttribute( const std::string& pfnName,
00396     //                                         const std::string& attrDefnName)
00397     //         throw(NoSuchPfnException,
00398     //               NoSuchAttributeDefinitionException,
00399     //               UnappropriateAttributeTypeException
00400     //               CommunicationException);
00401 
00413     virtual void removePfnAttribute(const std::string& pfn, 
00414                                     const std::string& attrName)
00415       throw(NoSuchPfnException,
00416             NoSuchAttributeDefinitionException, NoSuchAttributeException,
00417             CommunicationException);
00418    
00426     virtual void setDefaultResultLength(int resultLength)
00427       throw(CommunicationException);
00428 
00435     virtual int getDefaultResultLength() const
00436       throw(CommunicationException);
00437 
00446     virtual void getColumnSizes( ColumnSizes& cs ) const
00447       throw(CommunicationException);
00448 
00457     virtual void
00458     getMappingsWithAttributes(const std::vector<std::string>& guids,
00459                               std::vector<Mapping>& mappings) const
00460       throw(CommunicationException);
00461 
00470     virtual void 
00471     setMappingsWithAttributes(const std::vector<Mapping>& mappings) const
00472       throw(CommunicationException, NoSuchAttributeDefinitionException,
00473              UnappropriateAttributeTypeException, PfnExistsException);
00474 
00485     virtual void
00486     getMappingsByGuid(const std::string& guidPattern,
00487                       std::vector<GuidPfnPair_t>& mappings) const
00488       throw(CommunicationException);
00489 
00502     virtual void
00503     getMappingsByGuid(const std::string&          guidPattern,
00504                       int                         resultLength,
00505                       std::vector<GuidPfnPair_t>& mappings    ) const
00506       throw(CommunicationException);
00507     
00520     virtual void
00521     getMappingsByGuid(const std::string&          guidPattern,
00522                       int                         resultLength,
00523                       int                         resultStart,
00524                       std::vector<GuidPfnPair_t>& mappings    ) const
00525       throw(CommunicationException);
00526 
00527 
00538     virtual void
00539     getMappingsByPfn(const std::string&          pfnPattern,
00540                      std::vector<GuidPfnPair_t>& mappings) const
00541       throw(CommunicationException); 
00542 
00555     virtual void
00556     getMappingsByPfn(const std::string&          pfnPattern,
00557                      int                         resultLength,
00558                      std::vector<GuidPfnPair_t>& mappings) const
00559       throw(CommunicationException);
00560     
00573     virtual void
00574     getMappingsByPfn(const std::string&          pfnPattern,
00575                      int                         resultLength,
00576                      int                         resultStart,
00577                      std::vector<GuidPfnPair_t>& mappings) const
00578       throw(CommunicationException);
00579     
00590     virtual void
00591     getMappingsByAttribute( const std::string& SQLQuery, 
00592                             int resultLength,
00593                             std::vector<GuidPfnPair_t>& mappings) const
00594       throw(InvalidQueryException,
00595             CommunicationException);
00596     
00608     virtual void
00609     getMappingsByAttribute( const std::string& SQLQuery, 
00610                             int resultLength, 
00611                             int resultStart,
00612                             std::vector<GuidPfnPair_t>& mappings) const
00613       throw(InvalidQueryException,
00614             CommunicationException);
00615 
00627     virtual void
00628     getMappingsWithAttributes( const std::string& SQLQuery, 
00629                                int resultLength,
00630                                std::vector<Mapping>& mappings) const
00631       throw(InvalidQueryException, CommunicationException);
00632 
00645     virtual void
00646     getMappingsWithAttributes( const std::string& SQLQuery, 
00647                                int resultLength, 
00648                                int resultStart,
00649                                std::vector<Mapping>& mappings) const
00650       throw(InvalidQueryException,  CommunicationException);
00651 
00652 
00666     virtual void
00667     getMappingsByPfnAttribute(const std::string& attrName,
00668                               const std::string& valuePattern,
00669                               std::vector<GuidPfnPair_t>& mappings) 
00670       throw(NoSuchAttributeDefinitionException,
00671             CommunicationException);
00672 
00687     virtual void
00688     getMappingsByPfnAttribute(const std::string& attrName,
00689                               const std::string& valuePattern,
00690                               int                resultLength,
00691                               std::vector<GuidPfnPair_t>& mappings) 
00692       throw(NoSuchAttributeDefinitionException,
00693             CommunicationException);
00694 
00710     virtual void
00711     getMappingsByPfnAttribute(const std::string& attrName,
00712                               const std::string& valuePattern,
00713                               int                resultLength,
00714                               int                resultStart,
00715                               std::vector<GuidPfnPair_t>& mappings) 
00716       throw(NoSuchAttributeDefinitionException,
00717             CommunicationException);
00718                 
00728     virtual bool addRLISubscription(const std::string& lrcURL,
00729                                     const std::string& rliURL)
00730       throw(CommunicationException);
00731 
00736     virtual bool addRLISubscription( const std::string& rliURL)
00737       throw( CommunicationException);
00738 
00744     virtual bool removeRLISubscription(const std::string& rliURL)
00745       throw(CommunicationException);
00746 
00752     virtual void getRLISubscriptions(RliList_t& rlis) const
00753       throw(CommunicationException);
00754                  
00758     virtual void forceRLIUpdate() const
00759       throw(CommunicationException);
00760                         
00767     virtual const std::string ping() const
00768       throw(CommunicationException);
00769 
00773     virtual const std::string getVersion() const
00774       throw(CommunicationException);
00775                 
00779     virtual const std::string getInterfaceVersion() const
00780       throw(CommunicationException);
00781                 
00785     virtual const std::string getSchemaVersion() const
00786       throw(CommunicationException);
00787                 
00788   private:
00789       
00790     //
00791     // helper methods
00792     //
00793 
00794     void dump_soap_error(int ret, const struct soap* const_soap) const;
00795 
00796     void handleGenericFaults(int ret, const struct soap* soap) const;
00797 
00798     const char* endpoint() const;
00799 
00800     //
00801     // member variables
00802     //
00803     const std::string m_endpoint;
00804     struct soap *m_soap;
00805 
00806 #ifdef WITH_WP2_SECURITY                        
00807     /* sorry, had to loosen the visibility of soap()
00808      * a bit. Could try protected and friend decls as well.
00809      */
00810   public:
00811 #endif
00812     struct soap* soap() const;
00813 
00814 #ifdef WITH_WP2_SECURITY
00815     /* For defining the desired role and policy
00816      * after the lrc object has laready been created
00817      */
00818     int addRoleAndPolicy(char *role,
00819                          char *policy,
00820                          char *defaultrole,
00821                          char *defaultpolicy);
00822 
00823     void clearRoleAndPolicy();
00824 
00825 #endif
00826   };
00827 }
00828 
00829 #endif
00830 
00831 // EOF RemoteLocalReplicaCatalog.h
The EU DataGrid Project. All rights reserved.