00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef LocalReplicaCatalog_H
00013 #define LocalReplicaCatalog_H
00014
00015 #include <string>
00016 #include <set>
00017 #include <map>
00018 #include <vector>
00019
00020 #include "EdgReplicaLocationService/ReplicationExceptions.h"
00021
00022 namespace EdgReplicaLocationService {
00030 struct ColumnSizes
00031 {
00032 int attDefNameColSize;
00033 int guidColSize;
00034 int pfnColSize;
00035 };
00036
00037 struct AttributeDefinition
00038 {
00039 AttributeDefinition( const std::string& name,
00040 const std::string& type )
00041 : m_name( name ), m_type( type )
00042 {
00043 }
00044
00045 std::string m_name;
00046 std::string m_type;
00047 };
00048
00049 struct Mapping {
00050 Mapping(const std::string& guid, const std::string& pfn,
00051 const std::vector<std::string>& pfnAttributeNames,
00052 const std::vector<std::string>& pfnAttributes)
00053 : m_guid(guid), m_pfn(pfn), m_pfnAttributeNames(pfnAttributeNames),
00054 m_pfnAttributes(pfnAttributes) {
00055 }
00056
00057 std::string m_guid;
00058 std::string m_pfn;
00059 std::vector<std::string> m_pfnAttributeNames;
00060 std::vector<std::string> m_pfnAttributes;
00061 };
00062
00063 typedef std::pair<std::string, std::string> GuidPfnPair_t;
00064 typedef std::pair<std::string, std::string> GuidAliasPair_t;
00065 typedef std::vector<AttributeDefinition> AttrDefs_t;
00066 typedef std::vector<std::string> RliList_t;
00067
00068 class LocalReplicaCatalog {
00074 public:
00075
00078 LocalReplicaCatalog(const std::string& url) {
00079 }
00080
00083 virtual ~LocalReplicaCatalog() { };
00084
00089 virtual const std::string& getUrl() const =0;
00090
00105 virtual void
00106 addMapping(const std::string& guid,
00107 const std::string& pfn)
00108 throw(ValueTooLongException,
00109 PfnExistsException,
00110 CommunicationException)=0;
00111
00118 virtual void
00119 deleteMapping(const std::string& guid)
00120 throw(CommunicationException)=0;
00121
00128 virtual void
00129 removeMapping(const std::string& guid,
00130 const std::string& pfn)
00131 throw(CommunicationException)=0;
00132
00140 virtual bool
00141 guidExists(const std::string& guid) const
00142 throw(CommunicationException)=0;
00143
00151 virtual bool
00152 pfnExists(const std::string& pfn) const
00153 throw(CommunicationException)=0;
00154
00164 virtual void
00165 getPfns(const std::string& guid,
00166 std::vector<std::string>& output)
00167 const throw(NoSuchGuidException,
00168 CommunicationException)=0;
00169
00178 virtual const std::string
00179 guidForPfn(const std::string& pfn)
00180 const throw(NoSuchPfnException,
00181 CommunicationException)=0;
00182
00195 virtual void
00196 createAttributeDefinition(const AttributeDefinition& attrDef)
00197 throw(AttributeDefinitionExistsException,
00198 EmptyAttributeNameException,
00199 ValueTooLongException,
00200 CommunicationException)=0;
00201
00208 virtual AttributeDefinition
00209 getAttributeDefinition(const std::string& attrName) const
00210 throw(NoSuchAttributeDefinitionException,
00211 CommunicationException)=0;
00212
00219 virtual void
00220 getAttributeDefinitions(AttrDefs_t& attdefs) const
00221 throw(CommunicationException)=0;
00222
00232 virtual void
00233 removeAttributeDefinition(const std::string& attrName)
00234 throw(NoSuchAttributeDefinitionException,
00235 EmptyAttributeNameException,
00236 CommunicationException)=0;
00237
00244 virtual bool
00245 attributeDefinitionExists(const std::string& attrName) const
00246 throw(CommunicationException)=0;
00247
00264 virtual void
00265 setPfnAttribute(const std::string& pfn,
00266 const std::string& attrName,
00267 const std::string& value)
00268 throw(NoSuchPfnException,
00269 NoSuchAttributeDefinitionException,
00270 ValueTooLongException,
00271 CommunicationException)=0;
00272
00284 virtual void
00285 setStringPfnAttribute( const std::string& pfnName,
00286 const std::string& attrDefnName,
00287 const std::string& attrValue)
00288 throw(NoSuchAttributeDefinitionException,
00289 NoSuchPfnException,
00290 UnappropriateAttributeTypeException,
00291 CommunicationException)=0;
00292
00304 virtual void
00305 setIntPfnAttribute( const std::string& pfnName,
00306 const std::string& attrDefnName,
00307 int attrValue)
00308 throw(NoSuchAttributeDefinitionException,
00309 NoSuchPfnException,
00310 UnappropriateAttributeTypeException,
00311 CommunicationException)=0;
00312
00324 virtual void
00325 setFloatPfnAttribute(const std::string& pfnName,
00326 const std::string attrDefnName,
00327 float attrValue)
00328 throw(NoSuchAttributeDefinitionException,
00329 NoSuchPfnException,
00330 UnappropriateAttributeTypeException,
00331 CommunicationException)=0;
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00380 virtual std::string
00381 getStringPfnAttribute( const std::string& pfnName,
00382 const std::string& attrDefnName)
00383 throw(NoSuchPfnException,
00384 NoSuchAttributeDefinitionException,
00385 UnappropriateAttributeTypeException,
00386 CommunicationException)=0;
00387
00397 virtual int
00398 getIntPfnAttribute( const std::string& pfnName,
00399 const std::string& attrDefnName)
00400 throw(NoSuchPfnException,
00401 NoSuchAttributeDefinitionException,
00402 UnappropriateAttributeTypeException,
00403 CommunicationException)=0;
00404
00414 virtual float
00415 getFloatPfnAttribute( const std::string& pfnName,
00416 const std::string& attrDefnName)
00417 throw(NoSuchPfnException,
00418 NoSuchAttributeDefinitionException,
00419 UnappropriateAttributeTypeException,
00420 CommunicationException)=0;
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00450 virtual void
00451 removePfnAttribute(const std::string& pfn,
00452 const std::string& attrName)
00453 throw(NoSuchPfnException,
00454 NoSuchAttributeDefinitionException,
00455 NoSuchAttributeException,
00456 CommunicationException)=0;
00457
00465 virtual void setDefaultResultLength(int resultLength)
00466 throw(CommunicationException)=0;
00467
00474 virtual int getDefaultResultLength() const
00475 throw(CommunicationException)=0;
00476
00485 virtual void getColumnSizes(ColumnSizes&) const
00486 throw(CommunicationException)=0;
00487
00488
00497 virtual void
00498 getMappingsWithAttributes(const std::vector<std::string>& guids,
00499 std::vector<Mapping>& mappings) const
00500 throw(CommunicationException)=0;
00501
00502
00511 virtual void
00512 setMappingsWithAttributes(const std::vector<Mapping>& mappings) const
00513 throw(CommunicationException, NoSuchAttributeDefinitionException,
00514 UnappropriateAttributeTypeException, PfnExistsException)=0;
00515
00516
00527 virtual void
00528 getMappingsByGuid(const std::string& guidPattern,
00529 std::vector<GuidPfnPair_t>& mappings) const
00530 throw(CommunicationException)=0;
00531
00544 virtual void
00545 getMappingsByGuid(const std::string& guidPattern,
00546 int resultLength,
00547 std::vector<GuidPfnPair_t>& mappings ) const
00548 throw(CommunicationException)=0;
00549
00562 virtual void
00563 getMappingsByGuid(const std::string& guidPattern,
00564 int resultLength,
00565 int resultStart,
00566 std::vector<GuidPfnPair_t>& mappings ) const
00567 throw(CommunicationException)=0;
00568
00579 virtual void
00580 getMappingsByPfn(const std::string& pfnPattern,
00581 std::vector<GuidPfnPair_t>& mappings) const
00582 throw(CommunicationException)=0;
00583
00596 virtual void
00597 getMappingsByPfn(const std::string& pfnPattern,
00598 int resultLength,
00599 std::vector<GuidPfnPair_t>& mappings) const
00600 throw(CommunicationException)=0;
00601
00614 virtual void
00615 getMappingsByPfn(const std::string& pfnPattern,
00616 int resultLength,
00617 int resultStart,
00618 std::vector<GuidPfnPair_t>& mappings) const
00619 throw(CommunicationException)=0;
00620
00631 virtual void
00632 getMappingsByAttribute( const std::string& SQLQuery,
00633 int resultLength,
00634 std::vector<GuidPfnPair_t>& mappings) const
00635 throw(InvalidQueryException,
00636 CommunicationException)=0;
00637
00649 virtual void
00650 getMappingsByAttribute( const std::string& SQLQuery,
00651 int resultLength,
00652 int resultStart,
00653 std::vector<GuidPfnPair_t>& mappings) const
00654 throw(InvalidQueryException,
00655 CommunicationException)=0;
00656
00657
00669 virtual void
00670 getMappingsWithAttributes( const std::string& SQLQuery,
00671 int resultLength,
00672 std::vector<Mapping>& mappings) const
00673 throw(InvalidQueryException, CommunicationException)=0;
00674
00687 virtual void
00688 getMappingsWithAttributes( const std::string& SQLQuery,
00689 int resultLength,
00690 int resultStart,
00691 std::vector<Mapping>& mappings) const
00692 throw(InvalidQueryException, CommunicationException)=0;
00693
00707 virtual void
00708 getMappingsByPfnAttribute(const std::string& attrName,
00709 const std::string& valuePattern,
00710 std::vector<GuidPfnPair_t>& mappings)
00711 throw(NoSuchAttributeDefinitionException,
00712 CommunicationException) = 0;
00713
00728 virtual void
00729 getMappingsByPfnAttribute(const std::string& attrName,
00730 const std::string& valuePattern,
00731 int resultLength,
00732 std::vector<GuidPfnPair_t>& mappings)
00733 throw(NoSuchAttributeDefinitionException,
00734 CommunicationException) = 0;
00735
00751 virtual void
00752 getMappingsByPfnAttribute(const std::string& attrName,
00753 const std::string& valuePattern,
00754 int resultLength,
00755 int resultStart,
00756 std::vector<GuidPfnPair_t>& mappings)
00757 throw(NoSuchAttributeDefinitionException,
00758 CommunicationException) = 0;
00759
00769 virtual bool addRLISubscription(const std::string& lrcURL,
00770 const std::string& rliURL)
00771 throw(CommunicationException)=0;
00772
00777 virtual bool addRLISubscription( const std::string& rliURL)
00778 throw( CommunicationException)=0;
00779
00785 virtual bool removeRLISubscription(const std::string& rliURL)
00786 throw(CommunicationException)=0;
00787
00793 virtual void getRLISubscriptions(RliList_t& rlis) const
00794 throw(CommunicationException)=0;
00795
00799 virtual void forceRLIUpdate() const
00800 throw(CommunicationException)=0;
00801
00808 virtual const std::string ping() const
00809 throw(CommunicationException)=0;
00810
00814 virtual const std::string getVersion() const
00815 throw(CommunicationException)=0;
00816
00820 virtual const std::string getInterfaceVersion() const
00821 throw(CommunicationException)=0;
00822
00826 virtual const std::string getSchemaVersion() const
00827 throw(CommunicationException)=0;
00828
00829 #ifdef WITH_WP2_SECURITY
00830
00831
00832
00833 virtual int addRoleAndPolicy(char *role,
00834 char *policy,
00835 char *defaultrole,
00836 char *defaultpolicy)=0;
00837
00838 virtual void clearRoleAndPolicy()=0;
00839
00840 #endif
00841
00842 };
00843 }
00844 #endif