dca_interface  6.3.4
customdb_toolbox.h
Go to the documentation of this file.
1 /* IBM Source Code */
2 /* (C) Copyright IBM Corp. 2009, 2012 */
3 /* Licensed Materials - Property of IBM */
4 /* US Government Users Restricted Rights - Use duplication or disclosure restricted by GSA Schedule Contract with IBM Corp. */
5 
6 #ifndef CUSTOMDB_TOOLBOX_H
7 #define CUSTOMDB_TOOLBOX_H
8 
34 #include "dca/dca_base.h"
35 #include <string>
36 #include <set>
37 
38 namespace dca {
39 
40  class custommodule_p;
41  class customdb_p;
42 
48  typedef std::set< int > CategorySet;
49 
87  {
88  public:
90  UrlCustomDb();
91  UrlCustomDb( const UrlCustomDb& rhi );
92  UrlCustomDb& operator = (const UrlCustomDb& rhi );
93  virtual ~UrlCustomDb();
95 
102  bool getUrl( const std::string& aUrlString, CategorySet& foundCategories ) const;
118  void setUrl( const std::string& aUrlString, const CategorySet& categories );
124  void removeUrl( const std::string& aUrlString );
125 
127  customdb_p *_p;
128  };
129 
136  {
137  public:
140 
148  static UrlCustomDbModule create( const DcaInstance& aDcaInstance, const License& aLicense );
149 
152  UrlCustomDbModule( const UrlCustomDbModule& rhi );
153  UrlCustomDbModule& operator = (const UrlCustomDbModule& rhi );
154  virtual ~UrlCustomDbModule();
156 
166  CategoriesInfo createCategoriesInfo( const std::string& categoriesXmlFolder ) const;
167 
177  FunctionResult createCustomDb( const std::string& aDatabaseFolder ) const;
178 
186  UrlCustomDb openCustomDb( const DbConnection& aDbConnection ) const;
187 
189  PRIVATE_PTR custommodule_p *_p;
190  };
191 
192 }
193 
194 #endif
int DCA_MODULE_ID_TYPE
Type for module ids.
Definition: base_types.h:21
The Custom Database module, used to create new custom databases or open existing custom databases.
UrlCustomDb openCustomDb(const DbConnection &aDbConnection) const
Creates a UrlCustomDb instance that is connected to the database defined by the given DbConnection.
static UrlCustomDbModule create(const DcaInstance &aDcaInstance, const License &aLicense)
Loads and initializes the custom database module.
void removeUrl(const std::string &aUrlString)
Removes the given URL string from the database, if present.
A container class that allows access to the contained Categories, Groups and Locales.
Encapsulates the Custom Database maintenance interface.
Database connection class for a local or remote database.
Definition: base_classes.h:859
void setUrl(const std::string &aUrlString, const CategorySet &categories)
Updates or creates categories for the given URL string.
Use a License to initialize a classification package or a toolbox package.
Definition: base_classes.h:560
FunctionResult createCustomDb(const std::string &aDatabaseFolder) const
Creates a new custom database file in the given folder.
This header includes all header files of the DCA Base Package.
Encapsulates the init and deinit of the DCA API.
Definition: base_classes.h:315
std::set< int > CategorySet
Basic container used for categorizations of URLs. This represents a set of category ids.
CategoriesInfo createCategoriesInfo(const std::string &categoriesXmlFolder) const
Creates a CategoriesInfo object by using the provided categoriesXmlFolder.
bool getUrl(const std::string &aUrlString, CategorySet &foundCategories) const
Retrieves the categories of URL string (if found).
#define PRIVATE_PTR
Type for private pointer implementations, for internal use only.
Definition: base_types.h:83
Standard function result.
Definition: base_classes.h:148
static DCA_MODULE_ID_TYPE ID
The unique ID of the Custom DB module.