1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file devel/devel.dmacvicar/XMLFilesBackend.h
12 #ifndef DEVEL_DEVEL_DMACVICAR_XMLFILESBACKEND_H
13 #define DEVEL_DEVEL_DMACVICAR_XMLFILESBACKEND_H
18 #include "zypp/Message.h"
19 #include "zypp/Patch.h"
20 #include "zypp/Script.h"
21 #include "zypp/Product.h"
22 #include "zypp/Selection.h"
24 #include "zypp/parser/yum/YUMParser.h"
25 #include "zypp/parser/yum/YUMParserData.h"
26 #include "zypp/base/PtrTypes.h"
30 using namespace zypp::parser::yum;
32 ///////////////////////////////////////////////////////////////////
34 { /////////////////////////////////////////////////////////////////
35 ///////////////////////////////////////////////////////////////////
37 { /////////////////////////////////////////////////////////////////
38 ///////////////////////////////////////////////////////////////////
40 // CLASS NAME : XMLFilesBackend
43 class XMLFilesBackend : public Backend
45 friend std::ostream & operator<<( std::ostream & str, const XMLFilesBackend & obj );
47 typedef intrusive_ptr<XMLFilesBackend> Ptr;
48 typedef intrusive_ptr<const XMLFilesBackend> constPtr;
52 XMLFilesBackend(const Pathname &root);
55 void setRandomFileNameEnabled( bool enabled );
56 virtual void doTest();
59 * is the storage backend initialized
61 virtual bool isBackendInitialized() const;
63 * initialize the storage backend
65 virtual void initBackend();
67 * Stores a Resolvable in the active backend.
69 virtual void storeObject( Resolvable::constPtr resolvable ) ;
71 * Deletes a Resolvable from the active backend.
73 virtual void deleteObject( Resolvable::Ptr resolvable );
75 * Deletes a Resolvable from the active backend.
77 virtual std::list<Resolvable::Ptr> storedObjects() const;
79 * Query for installed Resolvables of a certain kind
81 virtual std::list<Resolvable::Ptr> storedObjects(const Resolvable::Kind) const;
83 * Query for installed Resolvables of a certain kind by name
84 * \a partial_match allows for text search.
86 virtual std::list<Resolvable::Ptr> storedObjects(const Resolvable::Kind, const std::string & name, bool partial_match = false) const;
88 /////////////////////////////////////////////////////////
90 ////////////////////////////////////////////////////////
92 * Query for installed Sources
94 virtual std::list<PersistentStorage::SourceData> storedSources() const;
96 * Query for installed Sources
98 virtual void storeSource(const PersistentStorage::SourceData &data);
100 * Query for installed Sources
102 virtual void deleteSource(const std::string &alias);
106 std::string randomString(int length) const;
111 * Directory where the xml file is stored (for the given resolvable)
113 std::string dirForResolvable( Resolvable::constPtr resolvable ) const;
115 * Directory where the xml file is stored (for the given resolvable kind)
117 std::string dirForResolvableKind( Resolvable::Kind kind ) const;
119 * Full path to the xml file for a given resolvable
120 * Does not care if the resolvable is yet stored or not
122 std::string fullPathForResolvable( Resolvable::constPtr resolvable ) const;
124 * Full path to the xml file for a given resolvable
125 * Does not care if the resolvable is yet stored or not
127 Resolvable::Ptr resolvableFromFile( std::string file_path, Resolvable::Kind kind ) const;
129 Patch::Ptr createPatch( const zypp::parser::yum::YUMPatchData & parsed ) const;
130 Message::Ptr createMessage( const zypp::parser::yum::YUMPatchMessage & parsed ) const;
131 Script::Ptr createScript(const zypp::parser::yum::YUMPatchScript & parsed ) const;
132 Product::Ptr createProduct( const zypp::parser::yum::YUMProductData & parsed ) const;
133 Selection::Ptr createSelection( const zypp::parser::yum::YUMGroupData & parsed ) const;
136 Dependencies createDependencies( const zypp::parser::yum::YUMObjectData & parsed, const Resolvable::Kind my_kind ) const;
137 Dependencies createGroupDependencies( const zypp::parser::yum::YUMGroupData & parsed ) const;
138 Dependencies createPatternDependencies( const zypp::parser::yum::YUMPatternData & parsed ) const;
139 Capability createCapability(const YUMDependency & dep, const Resolvable::Kind & my_kind) const;
146 ///////////////////////////////////////////////////////////////////
147 /** \relates XMLFilesBackend Stream output */
148 std::ostream & operator<<( std::ostream & str, const XMLFilesBackend & obj );
149 /////////////////////////////////////////////////////////////////
150 } // namespace devel.dmacvicar
151 ///////////////////////////////////////////////////////////////////
152 /////////////////////////////////////////////////////////////////
154 ///////////////////////////////////////////////////////////////////
155 #endif // DEVEL_DEVEL_DMACVICAR_SQLITEBACKEND_H