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

ReplicaMetadataCatalogImpl.h

Go to the documentation of this file.
00001 /* -*- C++ -*- $Id: ReplicaMetadataCatalogImpl.h,v 1.25 2004/06/27 15:42:09 jamesc Exp $
00002  *
00003  * ReplicaMetadataCatalogImpl.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  */
00010 
00011 
00012 #ifndef ReplicaMetadataCatalogImpl_H
00013 #define ReplicaMetadataCatalogImpl_H 1
00014 
00015 #include "EdgReplicaMetadataCatalog/ReplicaMetadataCatalog.h"
00016 #include "EdgReplicaMetadataCatalog/ReplicationExceptions.h"
00017 
00018 #include <string>
00019 #include <vector>
00020 #include <memory>
00021 #include <iostream>
00022 
00023 struct soap;
00024 struct SOAP_ENV_Fault;
00025 
00026 namespace EdgReplicaMetadataCatalog {
00027 
00035   class ReplicaMetadataCatalogImpl : public ReplicaMetadataCatalog
00036   {
00037                         
00038   public:
00046     ReplicaMetadataCatalogImpl(const std::string& url,
00047                                int timeOut);
00048 #ifdef WITH_WP2_SECURITY
00049 
00050     ReplicaMetadataCatalogImpl(const std::string& url,
00051                                char *passphrase,
00052                                char *credentials,
00053                                char *cacertdir,
00054                                char *rseedfile,
00055                                int timeOut);
00056 #endif    
00057 
00058                         
00059     virtual ~ReplicaMetadataCatalogImpl();
00060                         
00061     const std::string& getUrl() const;
00062                         
00063     //
00064     // Implementation of MetadataCatalog
00065     //
00066       
00078     virtual void
00079     addAlias(const std::string& guid,
00080              const std::string& alias)
00081       throw(AliasExistsException,
00082             ValueTooLongException,
00083             CommunicationException);
00084 
00091     virtual void
00092     removeAlias(const std::string& guid,
00093                 const std::string& alias)
00094       throw(CommunicationException);
00095 
00103     virtual bool
00104     aliasExists(const std::string& alias) const
00105       throw(CommunicationException);
00106                         
00114     virtual bool
00115     guidExists(const std::string& guid) const
00116       throw(CommunicationException);
00117                         
00126     virtual const std::string
00127     guidForAlias(const std::string&  alias) const
00128       throw(NoSuchAliasException,
00129             CommunicationException);
00130                         
00140     virtual void
00141     getAliases(const std::string& guid,
00142                Aliases_t& vec ) const
00143       throw(NoSuchGuidException,
00144             CommunicationException);
00145                         
00159     virtual void
00160     createAliasAttributeDefinition(const AttributeDefinition& attrDef)
00161       throw(AttributeDefinitionExistsException,
00162             UnsupportedAttributeTypeException,
00163             EmptyAttributeNameException,
00164             ValueTooLongException,
00165             CommunicationException);
00166           
00167           
00168     virtual void
00169     createAliasAttributeDefinition(const std::string& attrName)
00170       throw(AttributeDefinitionExistsException,
00171             UnsupportedAttributeTypeException,
00172             EmptyAttributeNameException,
00173             ValueTooLongException,
00174             CommunicationException);
00175           
00182     virtual void
00183     getAliasAttributeDefinitions( AttrDefs_t& ads ) const
00184       throw(CommunicationException);
00185                         
00191     virtual AttributeDefinition
00192     getAliasAttributeDefinition( const std::string& attrAliasName ) const
00193       throw(CommunicationException);
00194                         
00201     virtual bool
00202     aliasAttributeDefinitionExists(const std::string& attrName) const
00203       throw(CommunicationException);
00204                         
00216     virtual void
00217     removeAliasAttributeDefinition(const std::string& attrName)
00218       throw(NoSuchAttributeDefinitionException,
00219             EmptyAttributeNameException,
00220             CommunicationException);
00221                         
00235     virtual void
00236     createGuidAttributeDefinition(const AttributeDefinition& attrDef)
00237       throw(AttributeDefinitionExistsException,
00238             UnsupportedAttributeTypeException,
00239             EmptyAttributeNameException,
00240             ValueTooLongException,
00241             CommunicationException);
00242                         
00243     virtual void
00244     createGuidAttributeDefinition(const std::string& attrName)
00245       throw(AttributeDefinitionExistsException,
00246             UnsupportedAttributeTypeException,
00247             EmptyAttributeNameException,
00248             ValueTooLongException,
00249             CommunicationException);
00250           
00257     virtual void
00258     getGuidAttributeDefinitions( AttrDefs_t& ads ) const
00259       throw(CommunicationException);
00260                         
00266     virtual AttributeDefinition
00267     getGuidAttributeDefinition( const std::string& attrGuidName ) const
00268       throw(CommunicationException);
00269                         
00276     virtual bool
00277     guidAttributeDefinitionExists(const std::string& attrName) const
00278       throw(CommunicationException);
00279                         
00291     virtual void
00292     removeGuidAttributeDefinition(const std::string& attrName)
00293       throw(NoSuchAttributeDefinitionException,
00294             EmptyAttributeNameException,
00295             CommunicationException);
00296                         
00315     virtual const std::string
00316     setGuidAttribute(const std::string& guidName,
00317                      const std::string& attrDefnName,
00318                      const std::string& attrValue)
00319       throw(NoSuchAttributeDefinitionException,
00320             NoSuchGuidException,
00321             ValueTooLongException,
00322             CommunicationException);
00323                         
00339     virtual const std::string
00340     setStringGuidAttribute( const std::string& guidName,
00341                             const std::string& attrDefnName,
00342                             const std::string& attrValue)
00343       throw(NoSuchAttributeDefinitionException,
00344             NoSuchGuidException,
00345             ValueTooLongException,
00346             UnappropriateAttributeTypeException,
00347             CommunicationException);
00348 
00349     virtual int
00350     setIntGuidAttribute( const std::string& guidName,
00351                          const std::string& attrDefnName,
00352                          int                attrValue)
00353       throw(NoSuchAttributeDefinitionException,
00354             NoSuchGuidException,
00355             ValueTooLongException,
00356             UnappropriateAttributeTypeException,
00357             CommunicationException);
00358 
00359     virtual float
00360     setFloatGuidAttribute( const std::string& guidName,
00361                            const std::string& attrDefnName,
00362                            float              attrValue)
00363       throw(NoSuchAttributeDefinitionException,
00364             NoSuchGuidException,
00365             ValueTooLongException,
00366             UnappropriateAttributeTypeException,
00367             CommunicationException);
00368 
00381     virtual const std::string
00382     getGuidAttribute(const std::string& guidName,
00383                      const std::string& attrDefnName) const
00384       throw(NoSuchGuidException,
00385             NoSuchAttributeDefinitionException,
00386             CommunicationException);
00387                         
00398     virtual const std::string
00399     getStringGuidAttribute( const std::string& guidName,
00400                             const std::string& attrDefnName) const
00401       throw(NoSuchGuidException,
00402             NoSuchAttributeDefinitionException,
00403             UnappropriateAttributeTypeException,
00404             CommunicationException);
00405                         
00406     virtual int
00407     getIntGuidAttribute( const std::string& guidName,
00408                          const std::string& attrDefnName) const
00409       throw(NoSuchGuidException,
00410             NoSuchAttributeDefinitionException,
00411             UnappropriateAttributeTypeException,
00412             CommunicationException);
00413                         
00414     virtual float
00415     getFloatGuidAttribute( const std::string& guidName,
00416                            const std::string& attrDefnName) const
00417       throw(NoSuchGuidException,
00418             NoSuchAttributeDefinitionException,
00419             UnappropriateAttributeTypeException,
00420             CommunicationException);
00421                         
00428     virtual void
00429     removeGuidAttribute(const std::string& guidName,
00430                         const std::string& attrDefnName)
00431       throw(NoSuchGuidException, NoSuchAttributeDefinitionException, CommunicationException);
00432                         
00449     virtual const std::string
00450     setAliasAttribute(const std::string& aliasName,
00451                       const std::string& attrDefnName,
00452                       const std::string& attrValue)
00453       throw(NoSuchAttributeDefinitionException,
00454             NoSuchAliasException,
00455             ValueTooLongException,
00456             CommunicationException);
00457                         
00458     virtual const std::string
00459     setStringAliasAttribute( const std::string& aliasName,
00460                              const std::string& attrDefnName,
00461                              const std::string& attrValue)
00462       throw(NoSuchAttributeDefinitionException,
00463             NoSuchAliasException,
00464             ValueTooLongException,
00465             UnappropriateAttributeTypeException,
00466             CommunicationException);
00467                         
00468     virtual int
00469     setIntAliasAttribute( const std::string& aliasName,
00470                           const std::string& attrDefnName,
00471                           int                attrValue)
00472       throw(NoSuchAttributeDefinitionException,
00473             NoSuchAliasException,
00474             ValueTooLongException,
00475             UnappropriateAttributeTypeException,
00476             CommunicationException);
00477 
00478     virtual float
00479     setFloatAliasAttribute( const std::string& aliasName,
00480                             const std::string& attrDefnName,
00481                             float              attrValue)
00482       throw(NoSuchAttributeDefinitionException,
00483             NoSuchAliasException,
00484             ValueTooLongException,
00485             UnappropriateAttributeTypeException,
00486             CommunicationException);
00487 
00500     virtual const std::string
00501     getAliasAttribute(const std::string& aliasName,
00502                       const std::string& attrDefnName) const 
00503       throw(NoSuchAliasException,
00504             NoSuchAttributeDefinitionException,
00505             CommunicationException);
00506     virtual const std::string
00507     getStringAliasAttribute( const std::string& aliasName,
00508                              const std::string& attrDefnName) const 
00509       throw(NoSuchAliasException,
00510             NoSuchAttributeDefinitionException,
00511             UnappropriateAttributeTypeException,
00512             CommunicationException);
00513       
00514     virtual int
00515     getIntAliasAttribute( const std::string& aliasName,
00516                           const std::string& attrDefnName) const 
00517       throw(NoSuchAliasException,
00518             NoSuchAttributeDefinitionException,
00519             UnappropriateAttributeTypeException,
00520             CommunicationException);
00521       
00522     virtual float
00523     getFloatAliasAttribute( const std::string& aliasName,
00524                             const std::string& attrDefnName) const 
00525       throw(NoSuchAliasException,
00526             NoSuchAttributeDefinitionException,
00527             UnappropriateAttributeTypeException,
00528             CommunicationException);
00529                         
00536     virtual void
00537     removeAliasAttribute(const std::string& aliasName,
00538                          const std::string& attrDefnName)
00539       throw(NoSuchAliasException, NoSuchAttributeDefinitionException, CommunicationException);
00540                         
00548     virtual void
00549     setDefaultResultLength(int resultLength)
00550       throw(CommunicationException);
00551                         
00558     virtual int
00559     getDefaultResultLength() const
00560       throw(CommunicationException);
00561                         
00568     virtual void getColumnSizes( ColumnSizes& cs ) const
00569       throw(CommunicationException);
00570 
00579     virtual void
00580     getMappingsWithAttributes(const std::vector<std::string>& guids,
00581                               std::vector<Mapping>& mappings) const
00582       throw(CommunicationException);
00583 
00584 
00593     virtual void 
00594     setMappingsWithAttributes(const std::vector<Mapping>& mappings) const
00595       throw(CommunicationException, NoSuchAttributeDefinitionException,
00596             UnappropriateAttributeTypeException, AliasExistsException);
00597 
00607     virtual void
00608     getMappingsByGuid(const std::string& guidPattern,
00609                       GaMap& mappings) const
00610       throw(CommunicationException);
00611                         
00624     virtual void
00625     getMappingsByGuid(const std::string& guidPattern,
00626                       int          resultLength,
00627                       GaMap&       mappings    ) const
00628       throw(CommunicationException);
00629                         
00642     virtual void
00643     getMappingsByGuid(const std::string&  guidPattern,
00644                       int           resultLength,
00645                       int           resultStart,
00646                       GaMap&        mappings    ) const
00647       throw(CommunicationException);
00648                         
00658     virtual void
00659     getMappingsByAlias(const std::string& aliasPattern,
00660                        GaMap& mappings) const
00661       throw(CommunicationException);
00662                         
00673     virtual void
00674     getMappingsByAlias(const std::string&  aliasPattern,
00675                        int           resultLength,
00676                        GaMap&        mappings) const
00677       throw(CommunicationException);
00678                         
00690     virtual void
00691     getMappingsByAlias(const std::string&  aliasPattern,
00692                        int           resultLength,
00693                        int           resultStart,
00694                        GaMap&        mappings) const
00695       throw(CommunicationException);
00696                         
00709     virtual void
00710     getMappingsByGuidAttribute(const std::string& name,
00711                                const std::string& value,
00712                                GaMap&             mappings) const
00713       throw(NoSuchAttributeDefinitionException,
00714             CommunicationException);
00715                         
00728     virtual void
00729     getMappingsByGuidAttribute(const std::string& name,
00730                                const std::string& value,
00731                                int                resultLength,
00732                                GaMap&             mappings) const
00733       throw(NoSuchAttributeDefinitionException,
00734             CommunicationException);
00735                         
00749     virtual void
00750     getMappingsByGuidAttribute(const std::string& name,
00751                                const std::string& value,
00752                                int                resultLength,
00753                                int                resultStart,
00754                                GaMap&             mappings) const
00755       throw(NoSuchAttributeDefinitionException,
00756             CommunicationException);
00757                         
00770     virtual void
00771     getMappingsByAliasAttribute(const std::string& name,
00772                                 const std::string& value,
00773                                 GaMap& mappings) const
00774       throw(NoSuchAttributeDefinitionException,
00775             CommunicationException);
00776                         
00789     virtual void
00790     getMappingsByAliasAttribute(const std::string& name,
00791                                 const std::string& value,
00792                                 int                resultLength,
00793                                 GaMap&             mappings) const
00794       throw(NoSuchAttributeDefinitionException,
00795             CommunicationException);
00796                         
00810     virtual void
00811     getMappingsByAliasAttribute(const std::string& name,
00812                                 const std::string& value,
00813                                 int                resultLength,
00814                                 int                resultStart,
00815                                 GaMap&             mappings) const
00816       throw(NoSuchAttributeDefinitionException,
00817             CommunicationException);
00818                         
00825     virtual void
00826     getMappingsByAttribute( const std::string& SQLQuery, 
00827                             int                resultLength,
00828                             GaMap&             mappings ) const
00829       throw(CommunicationException);
00830       
00838     virtual void
00839     getMappingsByAttribute( const std::string& SQLQuery, 
00840                             int                resultLength, 
00841                             int                resultStart,
00842                             GaMap&             mappings ) const
00843       throw(CommunicationException);
00844 
00856     virtual void
00857     getMappingsWithAttributes( const std::string& SQLQuery, 
00858                                int resultLength,
00859                                std::vector<Mapping>& mappings) const
00860       throw(NoSuchAttributeDefinitionException,
00861             InvalidQueryException,
00862             CommunicationException);
00863 
00876     virtual void
00877     getMappingsWithAttributes( const std::string& SQLQuery, 
00878                                int resultLength, 
00879                                int resultStart,
00880                                std::vector<Mapping>& mappings) const
00881       throw(NoSuchAttributeDefinitionException,
00882             InvalidQueryException,
00883             CommunicationException);
00884 
00885 
00889     virtual const std::string getVersion() const
00890       throw(CommunicationException);
00891                         
00895     virtual const std::string getInterfaceVersion() const
00896       throw(CommunicationException);
00897                         
00901     virtual const std::string getSchemaVersion() const
00902       throw(CommunicationException);
00903                         
00910     virtual const std::string ping() const
00911       throw(CommunicationException);                    
00912                         
00913   private:
00914     //
00915     // helper methods
00916     //
00917 
00918     void
00919     dump_soap(int ret, const struct soap* soap) const;
00920 
00921     void
00922     dump_soap_error(int ret, const struct soap* const_soap) const;
00923 
00924     void
00925     handleGenericFaults(int ret, const struct soap* soap) const;
00926 
00927     const char*
00928     endpoint() const;
00929 
00930     //
00931     // member variables
00932     //
00933     const std::string m_endpoint;
00934     struct soap*      m_soap;
00935 
00936 #ifdef WITH_WP2_SECURITY
00937     /* sorry, had to loosen the visibility of soap()
00938      * a bit. Could try protected and friend decls as well.
00939      */
00940   public:
00941 #endif
00942     struct soap*
00943     soap() const;
00944 
00945 #ifdef WITH_WP2_SECURITY
00946     /* For defining the desired role and policy after the lrc
00947      * object has laready been created
00948      */
00949     int addRoleAndPolicy(char *role,
00950                          char *policy,
00951                          char *defaultrole,
00952                          char *defaultpolicy);
00953 
00954     void clearRoleAndPolicy();
00955 
00956 #endif
00957   
00958   };
00959 }
00960 
00961 #endif // ReplicaMetadataCatalogImpl_H
00962 
00963 // EOF ReplicaMetadataCatalogImpl.h
00964 
The EU DataGrid Project. All rights reserved.