/usr/include/nepomuk/resourcemanager.h is in kdelibs5-dev 4:4.8.4-4+deb7u1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | /*
* This file is part of the Nepomuk KDE project.
* Copyright (C) 2006-2009 Sebastian Trueg <trueg@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _NEPOMUK_RESOURCE_MANAGER_H_
#define _NEPOMUK_RESOURCE_MANAGER_H_
#include "nepomuk_export.h"
#include <QtCore/QObject>
#include <QtCore/QUrl>
namespace Soprano {
class Model;
}
namespace Nepomuk {
class Resource;
class Variant;
class ResourceManagerHelper;
class ResourceManagerPrivate;
namespace Types {
class Class;
class Property;
}
/**
* \class ResourceManager resourcemanager.h Nepomuk/ResourceManager
*
* \brief The ResourceManager is the central \a %Nepomuk configuration point.
*
* Use the initialized() method to check the availabity of the %Nepomuk system.
* Signals nepomukSystemStarted() and nepomukSystemStopped() can be used to
* enable or disable Nepomuk-specific GUI elements.
*
* \author Sebastian Trueg <trueg@kde.org>
*/
class NEPOMUK_EXPORT ResourceManager : public QObject
{
Q_OBJECT
public:
static ResourceManager* instance();
/**
* In KDE 4.3 support for multiple ResourceManager instances
* has been introduced. To keep binary compatibility both the constructor's
* and destructor's access visibility could not be changed. Thus, instead of deleting
* a custom ResourceManager instance the standard way, one has to call this
* method or use QObject::deleteLater.
*
* \since 4.3
*/
void deleteInstance();
/**
* Initialize the Nepomuk framework. This method will initialize the communication with
* the local Nepomuk-KDE services, ie. the data repository. It will trigger a reconnect
* to the %Nepomuk database.
*
* There is normally no reason to call this method manually except when using multiple
* threads. In that case it is highly recommended to call this method in the main thread
* before doing anything else.
*
* \return 0 if all necessary components could be found and -1 otherwise.
*/
int init();
/**
* \return true if init() has been called successfully, ie. the KMetaData system is connected
* to the local RDF repository service and ready to work.
*/
bool initialized() const;
/**
* Retrieve the main data storage model.
*/
Soprano::Model* mainModel();
/**
* Override the main model used for all storage. By default the main model
* used is the Nepomuk server main model.
*
* \param model The model to use instead of the Nepomuk server or 0 to reset.
*
* \since 4.1
*/
void setOverrideMainModel( Soprano::Model* model );
/**
* \deprecated Use the Resource constructor directly.
*
* Creates a Resource object representing the data referenced by \a uri.
* The result is the same as from using the Resource::Resource( const QString&, const QString& )
* constructor with an empty type.
*
* \return The Resource representing the data at \a uri or an invalid Resource object if the local
* NEPOMUK RDF store does not contain an object with URI \a uri.
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED Resource createResourceFromUri( const QString& uri );
#endif
/**
* Remove the resource denoted by \a uri completely.
*
* This method is just a wrapper around Resource::remove. The result
* is the same.
*/
void removeResource( const QString& uri );
/**
* Retrieve a list of all resource managed by this manager.
*
* \warning This list will be very big. Usage of this method is
* discouraged. Use Query::QueryServiceClient in combination with an
* empty Query::Query instead.
*
* \since 4.3
*/
QList<Resource> allResources();
/**
* Retrieve a list of all resources of the specified \a type.
*
* This includes Resources that are not synced yet so it might
* not represent exactly the state as in the RDF store.
*
* \warning This list can be very big. Usage of this method is
* discouraged. Use Query::QueryServiceClient in combination with
* a Query::Query containing one Query::ResourceTypeTerm instead.
*/
QList<Resource> allResourcesOfType( const QUrl& type );
/**
* \deprecated Use allResourcesOfType( const QString& type )
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED QList<Resource> allResourcesOfType( const QString& type );
#endif
/**
* Retrieve a list of all resources that have property \a uri defined with a value of \a v.
*
* This includes Resources that are not synced yet so it might
* not represent exactly the state as in the RDF store.
*
* \param uri The URI identifying the property. If this URI does
* not include a namespace the default namespace is
* prepended.
* \param v The value all returned resources should have set as properts \a uri.
*
* \warning This list can be very big. Usage of this method is
* discouraged. Use Query::QueryServiceClient in combination with
* a Query::Query containing one Query::ComparisonTerm instead.
*/
QList<Resource> allResourcesWithProperty( const QUrl& uri, const Variant& v );
/**
* \deprecated Use allResourcesWithProperty( const QString& type )
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED QList<Resource> allResourcesWithProperty( const QString& uri, const Variant& v );
#endif
/**
* %ResourceManager caches resource locally so subsequent access is faster.
* This method clears this cache, deleting any Resource that is not used.
*
* \since 4.4
*/
void clearCache();
/**
* \deprecated Use generateUniqueUri(const QString&)
*
* Generates a unique URI that is not used in the store yet. This method ca be used to
* generate URIs for virtual types such as Tag.
*/
#ifndef KDE_NO_DEPRECATED
KDE_DEPRECATED QString generateUniqueUri();
#endif
/**
* Generates a unique URI that is not used in the store yet. This method can be used to
* generate URIs for virtual types such as Tag.
*
* \param label A label that the algorithm should use to try to create a more readable URI.
*
* \return A new unique URI which can be used to define a new resource.
*
* \since 4.2
*/
QUrl generateUniqueUri( const QString& label );
/**
* \internal Non-public API. Used by Resource to signalize errors.
*/
void notifyError( const QString& uri, int errorCode );
/**
* Create a new ResourceManager instance which uses model as its
* override model. This allows to use multiple instances of ResourceManager
* at the same time. Normally one does not need this method as the singleton
* accessed via instance() should be enough.
*
* \param model The model to read and write data from and to.
*
* \since 4.3
*/
static ResourceManager* createManagerForModel( Soprano::Model* model );
Q_SIGNALS:
/**
* This signal gets emitted whenever a Resource changes due to a sync procedure.
* Be aware that modifying resources locally via the Resource::setProperty method
* does not result in a resourceModified signal being emitted.
*
* \param uri The URI of the modified resource.
*
* NOT IMPLEMENTED YET
*/
void resourceModified( const QString& uri );
/**
* Whenever a problem occurs (like for example failed resource syncing) this
* signal is emitted.
*
* \param uri The resource related to the error.
* \param errorCode The type of the error (Resource::ErrorCode)
*/
void error( const QString& uri, int errorCode );
/**
* Emitted once the Nepomuk system is up and can be used.
*
* \warning This signal will not be emitted if the Nepomuk
* system is running when the ResourceManager is created.
* Use initialized() to check the status.
*
* \since 4.4
*/
void nepomukSystemStarted();
/**
* Emitted once the Nepomuk system goes down.
*
* \since 4.4
*/
void nepomukSystemStopped();
private Q_SLOTS:
void slotPropertyAdded(const Nepomuk::Resource &res, const Nepomuk::Types::Property &prop, const QVariant &value);
void slotPropertyRemoved(const Nepomuk::Resource &res, const Nepomuk::Types::Property &prop, const QVariant &value);
private:
friend class Nepomuk::Resource;
friend class Nepomuk::ResourceManagerPrivate;
ResourceManager();
~ResourceManager();
static ResourceManager* s_instance;
ResourceManagerPrivate* const d;
Q_PRIVATE_SLOT( d, void _k_storageServiceInitialized(bool) )
Q_PRIVATE_SLOT( d, void _k_dbusServiceUnregistered(QString) )
};
}
#endif
|