add more spacing
[personal-kdebase.git] / runtime / nepomuk / services / storage / repository.h
blobd78614d82e666459f4ca270e4cad59b87c1a9e11
1 /*
3 * $Id: sourceheader 511311 2006-02-19 14:51:05Z trueg $
5 * This file is part of the Nepomuk KDE project.
6 * Copyright (C) 2006-2007 Sebastian Trueg <trueg@kde.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 * See the file "COPYING" for the exact licensing terms.
15 #ifndef _REPOSITORY_H_
16 #define _REPOSITORY_H_
18 #include <QtCore/QString>
19 #include <QtCore/QMap>
21 #include <Soprano/Util/SignalCacheModel>
24 namespace Soprano {
25 class Model;
26 class Backend;
27 namespace Index {
28 class IndexFilterModel;
29 class CLuceneIndex;
33 class KJob;
35 namespace Nepomuk {
37 class CLuceneAnalyzer;
39 class Repository : public Soprano::Util::SignalCacheModel
41 Q_OBJECT
43 public:
44 Repository( const QString& name );
45 ~Repository();
47 QString name() const { return m_name; }
49 enum State {
50 CLOSED,
51 OPENING,
52 OPEN
55 State state() const;
57 static const Soprano::Backend* activeSopranoBackend();
59 public Q_SLOTS:
60 /**
61 * Will emit the opened signal
63 void open();
65 void close();
67 /**
68 * Calls slotDoOptimize via timer for instant return.
70 void optimize();
72 Q_SIGNALS:
73 void opened( Repository*, bool success );
75 private Q_SLOTS:
76 void copyFinished( KJob* job );
77 void rebuildingIndexFinished();
78 void slotDoOptimize();
80 private:
81 /**
82 * \return true if the index needs to be rebuilt and the method
83 * took over initialization.
85 bool rebuildIndexIfNecessary();
87 QString m_name;
88 State m_state;
90 // the base path for the data. Will contain subfolders:
91 // "index" for the fulltext index
92 // "data" for the data
93 QString m_basePath;
95 const Soprano::Backend* m_oldStorageBackend;
96 QString m_oldStoragePath;
98 Soprano::Model* m_model;
99 Nepomuk::CLuceneAnalyzer* m_analyzer;
100 Soprano::Index::CLuceneIndex* m_index;
101 Soprano::Index::IndexFilterModel* m_indexModel;
104 typedef QMap<QString, Repository*> RepositoryMap;
107 #endif