00001
00002
00003
00004
00005
00006
00007
00008
00009
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
00043
00044
00045
00046
00047
00048
00049
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
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
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
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
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
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
00802
00803 const std::string m_endpoint;
00804 struct soap *m_soap;
00805
00806 #ifdef WITH_WP2_SECURITY
00807
00808
00809
00810 public:
00811 #endif
00812 struct soap* soap() const;
00813
00814 #ifdef WITH_WP2_SECURITY
00815
00816
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