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.49 2004/05/05 08:55:22 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 #include "edg_gsoap_baseH.h"
00025 
00026 namespace EdgReplicaLocationService
00027 {
00035   class RemoteLocalReplicaCatalog : public LocalReplicaCatalog
00036   {
00037   
00038   public:
00039 
00040     /* create a new RemoteLocalReplicaCatalog
00041      * @param url     The URL of the LocalReplicaCatalog to connect to.  This
00042      *                will normally be a normal http/s URI which points 
00043      *                to a SOAP endpoint.
00044 
00045      * @param timeOut the timeout value, positive means seconds
00046                       negative microseconds,
00047      *                default is 30 seconds
00048      */
00049     RemoteLocalReplicaCatalog(const std::string& url,
00050                               int timeOut=30);
00051 
00054     virtual ~RemoteLocalReplicaCatalog();
00055 
00060     const std::string& getUrl() const;
00061 
00063 
00077     virtual void addMapping(const std::string& guid,
00078                             const std::string& pfn)
00079       throw(ValueTooLongException,
00080             PfnExistsException,
00081             CommunicationException);
00082                         
00089     virtual void deleteMapping(const std::string& guid)
00090       throw(CommunicationException);
00091 
00098     virtual void removeMapping(const std::string& guid,
00099                                const std::string& pfn)
00100       throw(CommunicationException);
00101 
00109     virtual bool guidExists(const std::string& guid) const
00110       throw(CommunicationException);
00111                         
00119     virtual bool pfnExists(const std::string& pfn) const
00120       throw(CommunicationException);
00121     
00130     virtual void getPfns(const std::string&        guid,
00131                          std::vector<std::string>& output) const
00132       throw(NoSuchGuidException,
00133             CommunicationException);
00134   
00143     virtual const std::string guidForPfn(const std::string& pfn) const
00144       throw(NoSuchPfnException,
00145             CommunicationException);
00146 
00159     virtual void
00160     createAttributeDefinition(const AttributeDefinition& attrDef)
00161       throw(AttributeDefinitionExistsException,
00162             EmptyAttributeNameException,
00163             ValueTooLongException,
00164             CommunicationException);
00165 
00172     virtual AttributeDefinition
00173     getAttributeDefinition(const std::string& attrName) const
00174       throw(NoSuchAttributeDefinitionException,
00175             CommunicationException);
00176 
00183     virtual void
00184     getAttributeDefinitions(AttrDefs_t& attdefs) const
00185       throw(CommunicationException);
00186 
00196     virtual void
00197     removeAttributeDefinition(const std::string& attrName)
00198       throw(NoSuchAttributeDefinitionException,
00199             EmptyAttributeNameException,
00200             CommunicationException);
00201 
00208     virtual bool attributeDefinitionExists(const std::string& attrName) const
00209       throw(CommunicationException);
00210                 
00226     virtual void setPfnAttribute(const std::string& pfn, 
00227                                  const std::string& attrName,
00228                                  const std::string& value)
00229       throw(NoSuchPfnException,
00230             NoSuchAttributeDefinitionException,
00231             ValueTooLongException,
00232             CommunicationException);
00233       
00245     virtual void
00246     setStringPfnAttribute( const std::string& pfnName,
00247                            const std::string& attrDefnName,
00248                            const std::string& attrValue)
00249       throw(NoSuchAttributeDefinitionException,
00250             NoSuchPfnException,
00251             UnappropriateAttributeTypeException,
00252             CommunicationException);
00253       
00265     virtual void
00266     setIntPfnAttribute( const std::string& pfnName,
00267                         const std::string& attrDefnName,
00268                         int attrValue)
00269       throw(NoSuchAttributeDefinitionException,
00270             NoSuchPfnException,
00271             UnappropriateAttributeTypeException,
00272             CommunicationException);
00273       
00285     virtual void
00286     setFloatPfnAttribute(const std::string& pfnName,
00287                          const std::string attrDefnName,
00288                          float attrValue)
00289       throw(NoSuchAttributeDefinitionException,
00290             NoSuchPfnException,
00291             UnappropriateAttributeTypeException,
00292             CommunicationException);
00293 
00294     //       /** Add an attribute value to a PFN attribute of type date.
00295     //        *
00296     //        * @param pfnName The PFN
00297     //        * @param attrDefnName the name of attribute
00298     //        * @param attrValue The attribute value we'll add. 
00299     //        * @throws NoSuchPfnException if the PFN does not exist in the Catalog
00300     //        * @throws NoSuchAttributeDefinitionException if the definition of
00301     //        *         the attribute does not exist in the Catalog.
00302     //        * @throws UnappropriateAttributeTypeException
00303     //        *         if the attribute is not of type date
00304     //        */
00305     // TO BE REVISITED
00306     //       virtual void setDatePfnAttribute( const std::string& pfnName,
00307     //                                         const std::string& attrDefnName,
00308     //                                         Date attrValue)
00309     //         throw(NoSuchAttributeDefinitionException,
00310     //               NoSuchPfnException,
00311     //               UnappropriateAttributeTypeException,
00312     //               CommunicationException);
00313       
00326     virtual const std::string getPfnAttribute(const std::string& pfn, 
00327                                               const std::string& attrName) const
00328       throw(NoSuchPfnException,
00329             NoSuchAttributeDefinitionException,
00330             CommunicationException);
00331       
00341     virtual std::string
00342     getStringPfnAttribute( const std::string& pfnName,
00343                            const std::string& attrDefnName)
00344       throw(NoSuchPfnException,
00345             NoSuchAttributeDefinitionException,
00346             UnappropriateAttributeTypeException,
00347             CommunicationException);
00348       
00358     virtual int
00359     getIntPfnAttribute( const std::string& pfnName,
00360                         const std::string& attrDefnName)
00361       throw(NoSuchPfnException,
00362             NoSuchAttributeDefinitionException,
00363             UnappropriateAttributeTypeException,
00364             CommunicationException);
00365       
00375     virtual float
00376     getFloatPfnAttribute( const std::string& pfnName,
00377                           const std::string& attrDefnName)
00378       throw(NoSuchPfnException,
00379             NoSuchAttributeDefinitionException,
00380             UnappropriateAttributeTypeException,
00381             CommunicationException);
00382 
00383     //       /** return the value of a given date attribute for an PFN.
00384     //        *
00385     //        * @param pfnName the PFN
00386     //        * @param attrDefnName the AttributeDefinition name to check for
00387     //        * @return the attribute value
00388     //        * @throws NoSuchPfnException if the PFN does not exist in the Catalog
00389     //        * @throws NoSuchAttributeDefinitionException if the AttributeDefintion
00390     //        *         does not exist in the catalog.
00391     //        */
00392     // TO BE REVISITED
00393     //       virtual Date getDatePfnAttribute( const std::string& pfnName,
00394     //                                         const std::string& attrDefnName)
00395     //         throw(NoSuchPfnException,
00396     //               NoSuchAttributeDefinitionException,
00397     //               UnappropriateAttributeTypeException
00398     //               CommunicationException);
00399 
00411     virtual void removePfnAttribute(const std::string& pfn, 
00412                                     const std::string& attrName)
00413       throw(NoSuchPfnException,
00414             NoSuchAttributeDefinitionException, NoSuchAttributeException,
00415             CommunicationException);
00416    
00424     virtual void setDefaultResultLength(int resultLength)
00425       throw(CommunicationException);
00426 
00433     virtual int getDefaultResultLength() const
00434       throw(CommunicationException);
00435 
00444     virtual void getColumnSizes( ColumnSizes& cs ) const
00445       throw(CommunicationException);
00446 
00455     virtual void
00456     getMappingsWithAttributes(const std::vector<std::string>& guids,
00457                               std::vector<Mapping>& mappings) const
00458       throw(CommunicationException);
00459 
00468     virtual void 
00469     setMappingsWithAttributes(const std::vector<Mapping>& mappings) const
00470       throw(CommunicationException, NoSuchAttributeDefinitionException,
00471              UnappropriateAttributeTypeException, PfnExistsException);
00472 
00483     virtual void
00484     getMappingsByGuid(const std::string& guidPattern,
00485                       std::vector<GuidPfnPair_t>& mappings) const
00486       throw(CommunicationException);
00487 
00500     virtual void
00501     getMappingsByGuid(const std::string&          guidPattern,
00502                       int                         resultLength,
00503                       std::vector<GuidPfnPair_t>& mappings    ) const
00504       throw(CommunicationException);
00505     
00518     virtual void
00519     getMappingsByGuid(const std::string&          guidPattern,
00520                       int                         resultLength,
00521                       int                         resultStart,
00522                       std::vector<GuidPfnPair_t>& mappings    ) const
00523       throw(CommunicationException);
00524 
00525 
00536     virtual void
00537     getMappingsByPfn(const std::string&          pfnPattern,
00538                      std::vector<GuidPfnPair_t>& mappings) const
00539       throw(CommunicationException); 
00540 
00553     virtual void
00554     getMappingsByPfn(const std::string&          pfnPattern,
00555                      int                         resultLength,
00556                      std::vector<GuidPfnPair_t>& mappings) const
00557       throw(CommunicationException);
00558     
00571     virtual void
00572     getMappingsByPfn(const std::string&          pfnPattern,
00573                      int                         resultLength,
00574                      int                         resultStart,
00575                      std::vector<GuidPfnPair_t>& mappings) const
00576       throw(CommunicationException);
00577     
00588     virtual void
00589     getMappingsByAttribute( const std::string& SQLQuery, 
00590                             int resultLength,
00591                             std::vector<GuidPfnPair_t>& mappings) const
00592       throw(InvalidQueryException,
00593             CommunicationException);
00594     
00606     virtual void
00607     getMappingsByAttribute( const std::string& SQLQuery, 
00608                             int resultLength, 
00609                             int resultStart,
00610                             std::vector<GuidPfnPair_t>& mappings) const
00611       throw(InvalidQueryException,
00612             CommunicationException);
00613 
00625     virtual void
00626     getMappingsWithAttributes( const std::string& SQLQuery, 
00627                                int resultLength,
00628                                std::vector<Mapping>& mappings) const
00629       throw(InvalidQueryException, CommunicationException);
00630 
00643     virtual void
00644     getMappingsWithAttributes( const std::string& SQLQuery, 
00645                                int resultLength, 
00646                                int resultStart,
00647                                std::vector<Mapping>& mappings) const
00648       throw(InvalidQueryException,  CommunicationException);
00649 
00650 
00664     virtual void
00665     getMappingsByPfnAttribute(const std::string& attrName,
00666                               const std::string& valuePattern,
00667                               std::vector<GuidPfnPair_t>& mappings) 
00668       throw(NoSuchAttributeDefinitionException,
00669             CommunicationException);
00670 
00685     virtual void
00686     getMappingsByPfnAttribute(const std::string& attrName,
00687                               const std::string& valuePattern,
00688                               int                resultLength,
00689                               std::vector<GuidPfnPair_t>& mappings) 
00690       throw(NoSuchAttributeDefinitionException,
00691             CommunicationException);
00692 
00708     virtual void
00709     getMappingsByPfnAttribute(const std::string& attrName,
00710                               const std::string& valuePattern,
00711                               int                resultLength,
00712                               int                resultStart,
00713                               std::vector<GuidPfnPair_t>& mappings) 
00714       throw(NoSuchAttributeDefinitionException,
00715             CommunicationException);
00716                 
00726     virtual bool addRLISubscription(const std::string& lrcURL,
00727                                     const std::string& rliURL)
00728       throw(CommunicationException);
00729 
00734     virtual bool addRLISubscription( const std::string& rliURL)
00735       throw( CommunicationException);
00736 
00742     virtual bool removeRLISubscription(const std::string& rliURL)
00743       throw(CommunicationException);
00744 
00750     virtual void getRLISubscriptions(RliList_t& rlis) const
00751       throw(CommunicationException);
00752                  
00756     virtual void forceRLIUpdate() const
00757       throw(CommunicationException);
00758                         
00765     virtual const std::string ping() const
00766       throw(CommunicationException);
00767 
00771     virtual const std::string getVersion() const
00772       throw(CommunicationException);
00773                 
00777     virtual const std::string getInterfaceVersion() const
00778       throw(CommunicationException);
00779                 
00783     virtual const std::string getSchemaVersion() const
00784       throw(CommunicationException);
00785                 
00786   private:
00787       
00788     //
00789     // helper methods
00790     //
00791 
00792     void dump_soap_error(int ret, const struct soap* const_soap) const;
00793 
00794     void handleGenericFaults(int ret, const struct soap* soap) const;
00795 
00796     const char* endpoint() const;
00797 
00798     //
00799     // member variables
00800     //
00801     const std::string m_endpoint;
00802     struct soap *m_soap;
00803 
00804 #ifdef WITH_WP2_SECURITY                        
00805     /* sorry, had to loosen the visibility of soap()
00806      * a bit. Could try protected and friend decls as well.
00807      */
00808   public:
00809 #endif
00810     struct soap* soap() const;
00811 
00812 #ifdef WITH_WP2_SECURITY
00813     /* For defining the desired role and policy
00814      * after the lrc object has laready been created
00815      */
00816     int addRoleAndPolicy(char *role,
00817                          char *policy,
00818                          char *defaultrole,
00819                          char *defaultpolicy);
00820 
00821     void clearRoleAndPolicy();
00822 
00823 #endif
00824   };
00825 }
00826 
00827 #endif
00828 
00829 // EOF RemoteLocalReplicaCatalog.h
The EU DataGrid Project. All rights reserved.