InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
DocHTTPBatchQueryManager.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Ramnik Singh
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // ADOBE CONFIDENTIAL
16 //
17 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
18 //
19 // NOTICE: All information contained herein is, and remains
20 // the property of Adobe Systems Incorporated and its suppliers,
21 // if any. The intellectual and technical concepts contained
22 // herein are proprietary to Adobe Systems Incorporated and its
23 // suppliers and may be covered by U.S. and Foreign Patents,
24 // patents in process, and are protected by trade secret or copyright law.
25 // Dissemination of this information or reproduction of this material
26 // is strictly forbidden unless prior written permission is obtained
27 // from Adobe Systems Incorporated.
28 //
29 //========================================================================================
30 
31 #ifndef __DocHTTPBatchQueryManager__
32 #define __DocHTTPBatchQueryManager__
33 #include "IDataBase.h"
34 #include "URI.h"
35 #include <set>
36 #include <boost/bimap.hpp>
37 #include "boost/bimap/set_of.hpp"
38 #include "URI.h"
39 #include "HTTPLinkSubsystemTypes.h"
40 
41 /*
42  AdobePatentID="P7137-US"
43  */
44 
45 //Forward Declaration
46 class DocHTTPBatchQueryHandler;
47 
49 {
50 public:
56 
57  // Internal use only, do not call it from outside world, destroys the singleton instance
58  static void TerminateInstance();
59 
60  /*
61  Retrieves the corresponding guid for the database
62  @param db [IN] database whose guid is to be retrieved
63  */
65 
66  /*
67  Retrieves the corresponding database for the guid
68  @param guid [IN] guid whose database is to be retrieved
69  */
70  IDataBase* GetDatabase(const HTTPLinkSubsystemTypes::GUID& guid) const;
71 
72  /*
73  Generates guid for the database if required and creates a db to guid mapping
74  @param db [IN] database whose guid and db to guid mapping is to be generated
75  */
76  HTTPLinkSubsystemTypes::GUID GenerateGuidAndCreateMapping(IDataBase*);
77 
78  /*
79  Invalidates and clears db to guid mapping
80  @param db [IN] database whose guid and db to guid mapping is to be cleared
81  */
82  bool InvalidateAndClearDBGuidMapping(IDataBase* db);
83 
84  /*
85  Adds the Link Resource UID for Guid and HTTP Connection URI in the map
86  @param guid [IN] Guid to be used instead of db whose Link resource UID info is to be kept in the map.
87  @param uri [IN] Connection URI
88  @param uid [IN] Link resource UID
89  @param type [IN] Asset/Asset Text Fragment Link Object Type
90  */
91  bool AddUIDForGuidAndConnectionURI(const HTTPLinkSubsystemTypes::GUID& guid, const URI& uri, const UID& uid, HTTPLinkSubsystemTypes::BatchRequestObjectType type);
92 
93  /*
94  Removes the Link Resource UID for Guid and HTTP Connection URI in the map
95  @param guid [IN] Guid to be used instead of db whose Link resource UID info is to be removed from the map.
96  @param uri [IN] Connection URI
97  @param uid [IN] Link resource UID
98  @param type [IN] Asset/Asset Text Fragment Link Object Type
99  */
100  bool RemoveUIDForGuidAndConnectionURI(const HTTPLinkSubsystemTypes::GUID& guid, const URI& uri, const UID& uid, HTTPLinkSubsystemTypes::BatchRequestObjectType type);
101 
102  /*
103  Gets the number of Link Resource UIDs for Guid and HTTP Connection URI in the map
104  @param guid [IN] Guid to be used instead of db whose Link resource UID number is to be retrieved from the map.
105  @param uri [IN] Connection URI
106  @param type [IN] Asset/Asset Text Fragment Link Object Type
107  @return the number of link resource UIDs
108  */
109  size_t GetNumberOfUIDsForGuidAndConnectionURI(const HTTPLinkSubsystemTypes::GUID& guid, const URI& uri, HTTPLinkSubsystemTypes::BatchRequestObjectType type);
110 
111  /*
112  Gets the Link Resource UIDs for Guid and HTTP Connection URI in the map
113  @param guid [IN] Guid to be used instead of db whose Link resource UIDs are to be retrieved from the map.
114  @param uri [IN] Connection URI
115  @param uidSet [OUT] Output LinkResource UIDs
116  @param type [IN] Asset/Asset Text Fragment Link Object Type
117  @return true if the operation is successful else false
118  */
119  bool GetUIDsForGuidAndConnectionURI(const HTTPLinkSubsystemTypes::GUID& guid, const URI& uri, std::set<UID> &uidSet, HTTPLinkSubsystemTypes::BatchRequestObjectType type);
120 
121 private:
125 
126  typedef boost::bimap<IDataBase*, HTTPLinkSubsystemTypes::GUID> DbGuidBimap;
127  typedef DbGuidBimap::left_map::const_iterator DbGuidBimap_left_const_iterator;
128  typedef DbGuidBimap::right_map::const_iterator DbGuidBimap_right_const_iterator;
129  typedef DbGuidBimap::value_type value_type;
130  typedef std::map<HTTPLinkSubsystemTypes::GUID, boost::shared_ptr<DocHTTPBatchQueryHandler> > GuidToDocHTTPBatchQueryHandlerMap;
131  typedef GuidToDocHTTPBatchQueryHandlerMap::iterator GuidToDocHTTPBatchQueryHandlerMap_iter;
132  DbGuidBimap fDbToGuidMap;
133  GuidToDocHTTPBatchQueryHandlerMap fGuidToDocHTTPBatchQueryHandlerMap;
134 
135  static DocHTTPBatchQueryManager* _pInstance;
136 };
137 #endif // __DocHTTPBatchQueryManager__