• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

NepomukDaemons

sopranoindexmanager.cpp

Go to the documentation of this file.
00001 /*
00002    Copyright (C) 2007-2008 Sebastian Trueg <trueg@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU General Public License as
00006    published by the Free Software Foundation; either version 2 of
00007    the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this library; see the file COPYING.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #include "sopranoindexmanager.h"
00021 #include "sopranoindexwriter.h"
00022 #include "sopranoindexreader.h"
00023 
00024 #include <strigi/strigiconfig.h>
00025 
00026 #include <Soprano/Client/DBusClient>
00027 #include <Soprano/Index/IndexFilterModel>
00028 #include <Soprano/Index/CLuceneIndex>
00029 #include <Soprano/Util/MutexModel>
00030 #include <Soprano/Client/DBusModel>
00031 #include <Soprano/Client/LocalSocketClient>
00032 
00033 #include <QtCore/QDir>
00034 #include <QtCore/QDebug>
00035 #include <QtCore/QString>
00036 
00037 #include <Nepomuk/ResourceManager>
00038 
00039 
00040 class Strigi::Soprano::IndexManager::Private
00041 {
00042 public:
00043     Private()
00044         : writer( 0 ),
00045           reader( 0 ) {
00046     }
00047 
00048     IndexWriter* writer;
00049     IndexReader* reader;
00050 };
00051 
00052 
00053 extern "C" {
00054 // we do not use REGISTER_STRIGI_INDEXMANAGER as we do have to perform some additional checks
00055 STRIGI_EXPORT Strigi::IndexManager* createIndexManager( const char* )
00056 {
00057     if( Nepomuk::ResourceManager::instance()->init() == 0 ) {
00058         return new Strigi::Soprano::IndexManager();
00059     }
00060     else {
00061         return 0;
00062     }
00063 }
00064 
00065 STRIGI_EXPORT void deleteIndexManager( Strigi::IndexManager* m )
00066 {
00067     delete m;
00068 }
00069 }
00070 
00071 Strigi::Soprano::IndexManager::IndexManager()
00072 {
00073     d = new Private;
00074 }
00075 
00076 
00077 Strigi::Soprano::IndexManager::~IndexManager()
00078 {
00079     qDebug() << "Cleaning up SopranoIndexManager";
00080     delete d->reader;
00081     delete d->writer;
00082     delete d;
00083 }
00084 
00085 
00086 Strigi::IndexReader* Strigi::Soprano::IndexManager::indexReader()
00087 {
00088     if ( !d->reader ) {
00089         qDebug() << "(Soprano::IndexManager) creating IndexReader";
00090         d->reader = new Strigi::Soprano::IndexReader( Nepomuk::ResourceManager::instance()->mainModel() );
00091     }
00092 
00093     return d->reader;
00094 }
00095 
00096 
00097 Strigi::IndexWriter* Strigi::Soprano::IndexManager::indexWriter()
00098 {
00099     if ( !d->writer ) {
00100         qDebug() << "(Soprano::IndexManager) creating IndexWriter";
00101         d->writer = new Strigi::Soprano::IndexWriter( Nepomuk::ResourceManager::instance()->mainModel() );
00102     }
00103 
00104     return d->writer;
00105 }

NepomukDaemons

Skip menu "NepomukDaemons"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KCMShell
  • KNotify
  • KStyles
  • Nepomuk Daemons
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal