diff options
author | Eckhart Koppen <eckhart.koppen@nokia.com> | 2011-04-20 11:52:57 +0300 |
---|---|---|
committer | Eckhart Koppen <eckhart.koppen@nokia.com> | 2011-04-20 11:52:57 +0300 |
commit | fb3e9bc2d941462f1244aaf0ea79425a307f883d (patch) | |
tree | afce91959098ec887ce466abc6e40342261df3db /src/serviceframework | |
parent | c61d909c7b815319e40ba27d7f84e92aa5f1f946 (diff) | |
parent | 6f0dc7cc40dd63763a581a7fb6d4e76649b8026c (diff) |
Merge branch 'master' into 1.2.0v1.2.0
Diffstat (limited to 'src/serviceframework')
-rw-r--r-- | src/serviceframework/databasemanager.cpp | 2 | ||||
-rw-r--r-- | src/serviceframework/ipc/objectendpoint.cpp | 10 | ||||
-rw-r--r-- | src/serviceframework/ipc/qmetaobjectbuilder.cpp | 19 | ||||
-rw-r--r-- | src/serviceframework/ipc/qsignalintercepter.cpp | 1 | ||||
-rw-r--r-- | src/serviceframework/ipc/qslotinvoker.cpp | 1 | ||||
-rw-r--r-- | src/serviceframework/qabstractsecuritysession.cpp | 15 | ||||
-rw-r--r-- | src/serviceframework/qremoteserviceregister.cpp | 2 | ||||
-rw-r--r-- | src/serviceframework/qservicecontext.cpp | 15 | ||||
-rw-r--r-- | src/serviceframework/qservicefilter.cpp | 65 | ||||
-rw-r--r-- | src/serviceframework/qserviceinterfacedescriptor.cpp | 73 | ||||
-rw-r--r-- | src/serviceframework/qservicemanager.cpp | 11 | ||||
-rw-r--r-- | src/serviceframework/qserviceplugininterface.cpp | 17 | ||||
-rw-r--r-- | src/serviceframework/servicemetadata.cpp | 54 |
13 files changed, 147 insertions, 138 deletions
diff --git a/src/serviceframework/databasemanager.cpp b/src/serviceframework/databasemanager.cpp index 98abb22996..ce3bc9ca21 100644 --- a/src/serviceframework/databasemanager.cpp +++ b/src/serviceframework/databasemanager.cpp @@ -239,6 +239,8 @@ bool lessThan(const QServiceInterfaceDescriptor &d1, data from both combined into a single dataset. When referring to a user scope database it means the user database only. + + \since 1.0 */ /* diff --git a/src/serviceframework/ipc/objectendpoint.cpp b/src/serviceframework/ipc/objectendpoint.cpp index caf555278f..866af4c2c9 100644 --- a/src/serviceframework/ipc/objectendpoint.cpp +++ b/src/serviceframework/ipc/objectendpoint.cpp @@ -621,15 +621,9 @@ void ObjectEndPoint::waitForResponse(const QUuid& requestId) if (openRequests()->contains(requestId) ) { Response* response = openRequests()->value(requestId); QEventLoop* loop = new QEventLoop( this ); + QTimer::singleShot(30000, loop, SLOT(quit())); connect(this, SIGNAL(pendingRequestFinished()), loop, SLOT(quit())); - QTime timer; - timer.start(); - - while(!response->isFinished) { - loop->processEvents(QEventLoop::AllEvents, 30000); - if(timer.elapsed() > 30000) - break; - } + loop->exec(); delete loop; qDebug() << "- response->isFinished: " << response->isFinished; diff --git a/src/serviceframework/ipc/qmetaobjectbuilder.cpp b/src/serviceframework/ipc/qmetaobjectbuilder.cpp index 63eeeabb97..b19eb1a34c 100644 --- a/src/serviceframework/ipc/qmetaobjectbuilder.cpp +++ b/src/serviceframework/ipc/qmetaobjectbuilder.cpp @@ -52,6 +52,7 @@ QTM_BEGIN_NAMESPACE \class QMetaObjectBuilder \internal \brief The QMetaObjectBuilder class supports building QMetaObject objects at runtime. + \since 1.1 */ @@ -889,7 +890,7 @@ const QMetaObject *QMetaObjectBuilder::relatedMetaObject(int index) const QByteArray QMetaObjectBuilder::classInfoName(int index) const { if (index >= 0 && index < d->classInfoNames.size()) - return d->classInfoNames[index]; + return d->classInfoNames[index]; else return QByteArray(); } @@ -904,7 +905,7 @@ QByteArray QMetaObjectBuilder::classInfoName(int index) const QByteArray QMetaObjectBuilder::classInfoValue(int index) const { if (index >= 0 && index < d->classInfoValues.size()) - return d->classInfoValues[index]; + return d->classInfoValues[index]; else return QByteArray(); } @@ -1178,9 +1179,9 @@ static QByteArray buildParameterNames // Build a QMetaObject in "buf" based on the information in "d". // If "buf" is null, then return the number of bytes needed to -// build the QMetaObject. Returns -1 if the metaobject if +// build the QMetaObject. Returns -1 if the metaobject if // relocatable is set, but the metaobject contains extradata. -static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, +static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, bool relocatable) { int size = 0; @@ -1189,7 +1190,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, int index; bool hasNotifySignals = false; - if (relocatable && + if (relocatable && (d->relatedMetaObjects.size() > 0 || d->staticMetacallFunction)) return -1; @@ -1466,7 +1467,7 @@ QMetaObject *QMetaObjectBuilder::toMetaObject() const The data is specific to the architecture on which it was created, but is not specific to the process that created it. Not all meta object builder's can be converted to data in this way. If \a ok is provided, it will be set to - true if the conversion succeeds, and false otherwise. If a + true if the conversion succeeds, and false otherwise. If a staticMetacallFunction() or any relatedMetaObject()'s are specified the conversion to relocatable data will fail. */ @@ -1489,12 +1490,12 @@ QByteArray QMetaObjectBuilder::toRelocatableData(bool *ok) const /* \internal - Sets the \a data returned from toRelocatableData() onto a concrete + Sets the \a data returned from toRelocatableData() onto a concrete QMetaObject instance, \a output. As the meta object's super class is not saved in the relocatable data, it must be passed as \a superClass. */ -void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output, - const QMetaObject *superclass, +void QMetaObjectBuilder::fromRelocatableData(QMetaObject *output, + const QMetaObject *superclass, const QByteArray &data) { if (!output) diff --git a/src/serviceframework/ipc/qsignalintercepter.cpp b/src/serviceframework/ipc/qsignalintercepter.cpp index 9b97fea611..049e1072c3 100644 --- a/src/serviceframework/ipc/qsignalintercepter.cpp +++ b/src/serviceframework/ipc/qsignalintercepter.cpp @@ -50,6 +50,7 @@ \internal \brief The QSignalIntercepter class provides an interface for intercepting signals as meta-calls + \since 1.1 IPC mechanisms need to intercept signals and convert them into protocol messages, but it is generally impractical to create a slot for every diff --git a/src/serviceframework/ipc/qslotinvoker.cpp b/src/serviceframework/ipc/qslotinvoker.cpp index 76b369e3ab..56427b0094 100644 --- a/src/serviceframework/ipc/qslotinvoker.cpp +++ b/src/serviceframework/ipc/qslotinvoker.cpp @@ -50,6 +50,7 @@ \internal \brief The QSlotInvoker class provides an interface for invoking slots with explicit arguments + \since 1.1 IPC mechanisms need to intercept protocol messages and convert them into slot invocations, but it is generally impractical to create explicit code diff --git a/src/serviceframework/qabstractsecuritysession.cpp b/src/serviceframework/qabstractsecuritysession.cpp index 00465b2b18..e655ec44cb 100644 --- a/src/serviceframework/qabstractsecuritysession.cpp +++ b/src/serviceframework/qabstractsecuritysession.cpp @@ -49,18 +49,19 @@ QTM_BEGIN_NAMESPACE \ingroup servicefw \brief The QAbstractSecuritySession class provides a generic mechanism to enable permission checks for services. - + \since 1.0 + QAbstractSecuritySession describes the abstract interface that security/permission engines must implement in order to provide capability related functionality. A QAbstractSecuritySession encapsulates the service client's capabilities. QServiceManager - can match those capabilites with the capabilites required by a particular service. - Service capabilites are declared via the services XML description. + can match those capabilites with the capabilites required by a particular service. + Service capabilites are declared via the services XML description. The use of a security session is not mandated by the service manager. If the client is passing a security session object QServiceManager ensures that the permissions - are checked before the requested service is loaded and forwards the session to the - service in case the service intends to implement additional checks. If no security + are checked before the requested service is loaded and forwards the session to the + service in case the service intends to implement additional checks. If no security session is passed to QServiceManager capability checks are not performed. Note that the security session is no substitute for platform security such as control over a processes ability to load arbitrary plug-ins. @@ -93,11 +94,11 @@ QAbstractSecuritySession::~QAbstractSecuritySession() { } -/*! +/*! \fn bool QAbstractSecuritySession::isAllowed(const QStringList& capabilities) = 0; Returns true if the security session has sufficient rights to access the required - service \a capabilities. + service \a capabilities. */ #include "moc_qabstractsecuritysession.cpp" diff --git a/src/serviceframework/qremoteserviceregister.cpp b/src/serviceframework/qremoteserviceregister.cpp index a60484c8eb..19bdfad59e 100644 --- a/src/serviceframework/qremoteserviceregister.cpp +++ b/src/serviceframework/qremoteserviceregister.cpp @@ -56,6 +56,8 @@ QTM_BEGIN_NAMESPACE details matching a valid QServiceInterfaceDescriptor. A registration entry can then be published for discovery by remote clients. + + \since 1.1 */ /*! diff --git a/src/serviceframework/qservicecontext.cpp b/src/serviceframework/qservicecontext.cpp index d3ffd130ce..dc941c0aa2 100644 --- a/src/serviceframework/qservicecontext.cpp +++ b/src/serviceframework/qservicecontext.cpp @@ -58,13 +58,14 @@ public: \class QServiceContext \inmodule QtServiceFramework \ingroup servicefw - \brief The QServiceContext class provides context information to + \brief The QServiceContext class provides context information to services. + \since 1.0 A service context is created by clients and passed on to the service. - It enables the opportunity to pass additional context information + It enables the opportunity to pass additional context information and errors between services, clients and the service framework. - + Clients must implement this abstract class to receive context information. \sa QServiceManager @@ -76,9 +77,9 @@ public: This enum describes the type of context information. - \value DisplayContext The service provides user visible display + \value DisplayContext The service provides user visible display text such as an error message. - \value ScriptContext The service provides a script which may + \value ScriptContext The service provides a script which may be executed by the client. \value UserDefined The first context type that can be used for service specific context information. @@ -88,7 +89,7 @@ public: \fn void QServiceContext::notify(ContextType type, const QVariant& data) = 0 Services may call this function to notify the service client about service related - context information of the given \a type. The contextual information is stored in \a data. + context information of the given \a type. The contextual information is stored in \a data. */ @@ -110,7 +111,7 @@ QServiceContext::QServiceContext(QObject* parent) /*! Destroys the service context object. */ -QServiceContext::~QServiceContext() +QServiceContext::~QServiceContext() { //ServiceContextUserData deleted by QObject } diff --git a/src/serviceframework/qservicefilter.cpp b/src/serviceframework/qservicefilter.cpp index b37362f63a..770b76dcee 100644 --- a/src/serviceframework/qservicefilter.cpp +++ b/src/serviceframework/qservicefilter.cpp @@ -66,16 +66,17 @@ public: /*! \class QServiceFilter - + \ingroup servicefw \inmodule QtServiceFramework - \brief The QServiceFilter class defines criteria for defining a sub-set of + \brief The QServiceFilter class defines criteria for defining a sub-set of all available services. + \since 1.0 A QServiceFilter can be used to constrain the number of services when searching for services. Only those services that match all filter criteria are returned by \l QServiceManager::findInterfaces(). - + \sa QServiceInterfaceDescriptor, QServiceManager */ @@ -86,7 +87,7 @@ public: This enum describes how interface version matching is performed. \value ExactVersionMatch The filter matches any interface implementation that implements - the exact version provided. + the exact version provided. \value MinimumVersionMatch The filter matches any interface implementation that implements either the given major/minor version or any subsequent version. */ @@ -94,8 +95,8 @@ public: /*! \enum QServiceFilter::CapabilityMatchRule - This enum describes the capability/permission matching rules. Some platforms restrict what services clients - can access using "capabilities" or permissions. Services with more capabilities require + This enum describes the capability/permission matching rules. Some platforms restrict what services clients + can access using "capabilities" or permissions. Services with more capabilities require more privileged clients. Platforms without capabilities may ignore this type of matching rule as the default behavior is to ignore any capability restrictions. @@ -121,17 +122,17 @@ public: \row \o MatchMinimum \o \{A\} \o S2, S3, S4, S5 \row \o MatchMinimum \o \{A,B,C\} \o S4 \endtable - - \value MatchMinimum The filter matches any service that requires at least the given + + \value MatchMinimum The filter matches any service that requires at least the given filter capabilities. This may mean that the returned services may require more capabilities than the specified ones. - Such a search is equivalent to a wildcard match if the passed filter's capability list is empty. In mathematical set notation + Such a search is equivalent to a wildcard match if the passed filter's capability list is empty. In mathematical set notation this rule is equivalent to Cap\sub{(Filter)} \\ Cap\sub{(Service)} = {}. This is the default matching rule. \value MatchLoadable The filter matches any service that could be loaded by the client. Using this matching rule guarantees that the returned services do not require more capabilites than specified by this rule. It includes services with no capability requirements. If this rule - is provided alongside an empty capability search list the returned + is provided alongside an empty capability search list the returned services do not require any capabilities and thus can be accessed by any client. The equivalent set notation is Cap\sub{(Service)} \\ Cap\sub{(Filter)} = {}. */ @@ -159,7 +160,7 @@ QServiceFilter::QServiceFilter(const QServiceFilter& other) /*! \fn QServiceFilter::QServiceFilter(const QString& interfaceName, const QString& version, QServiceFilter::VersionMatchRule rule) - + Creates a new filter object that matches all service implementations implementing \a interfaceName that match the specified \a version using the given \a rule. @@ -184,8 +185,8 @@ QServiceFilter::~QServiceFilter() /*! \fn QServiceFilter& QServiceFilter::operator=(const QServiceFilter& other) - - Copies the content of the QServiceFilter object contained in + + Copies the content of the QServiceFilter object contained in \a other into this one. */ QServiceFilter& QServiceFilter::operator=(const QServiceFilter& other) @@ -204,7 +205,7 @@ QServiceFilter& QServiceFilter::operator=(const QServiceFilter& other) /*! \fn void QServiceFilter::setServiceName(const QString& serviceName) - + The filter only matches implementations which are provided by the service specified by \a serviceName. @@ -217,7 +218,7 @@ void QServiceFilter::setServiceName(const QString& serviceName) /*! \fn void QServiceFilter::setInterface(const QString &interfaceName, const QString& version, QServiceFilter::VersionMatchRule rule) - + Sets the filter to match any interface implementation that implements \a interfaceName with version \a version. The version is matched according to the given \a rule. If \a version is not set, the filter matches any version of the @@ -232,7 +233,7 @@ void QServiceFilter::setServiceName(const QString& serviceName) void QServiceFilter::setInterface(const QString &interfaceName, const QString& version, QServiceFilter::VersionMatchRule rule) { //unset interface name - if (interfaceName.isEmpty() && version.isEmpty()) + if (interfaceName.isEmpty() && version.isEmpty()) { d->interface = interfaceName; d->majorVersion = d->minorVersion = -1; @@ -261,8 +262,8 @@ void QServiceFilter::setInterface(const QString &interfaceName, const QString& v bool success = false; int temp_major = -1; int temp_minor = -1; - if (pos == 0 && list.count() == 3 - && rx.matchedLength() == version.length() ) + if (pos == 0 && list.count() == 3 + && rx.matchedLength() == version.length() ) { temp_major = list[1].toInt(&success); if ( success ) { @@ -282,7 +283,7 @@ void QServiceFilter::setInterface(const QString &interfaceName, const QString& v /*! \fn QString QServiceFilter::serviceName() const - + Returns the service name for this filter. \sa setServiceName() @@ -294,7 +295,7 @@ QString QServiceFilter::serviceName() const /*! \fn QString QServiceFilter::interfaceName() const - + Returns the interface name for this filter. \sa setInterface() @@ -306,7 +307,7 @@ QString QServiceFilter::interfaceName() const /*! \fn int QServiceFilter::majorVersion() const - + Returns the major interface version for this filter. \sa setInterface() @@ -318,7 +319,7 @@ int QServiceFilter::majorVersion() const /*! \fn int QServiceFilter::minorVersion() const - + Returns the minor interface version for this filter. \sa setInterface() @@ -330,9 +331,9 @@ int QServiceFilter::minorVersion() const /*! \fn void QServiceFilter::setCustomAttribute(const QString& key, const QString& value) - + The filter only matches implementations which have the custom attribute - \a key with the given \a value. Such constraints are specified via the + \a key with the given \a value. Such constraints are specified via the \i{<customproperty>} tag within the service xml. \sa customAttribute(), clearCustomAttribute() @@ -344,7 +345,7 @@ void QServiceFilter::setCustomAttribute(const QString& key, const QString& value /*! \fn QString QServiceFilter::customAttribute(const QString& key) const - + Returns the value for the custom attribute \a key; otherwise returns a null string. @@ -357,7 +358,7 @@ QString QServiceFilter::customAttribute(const QString& key) const /*! \fn void QServiceFilter::clearCustomAttribute(const QString &key) - + Clears the custom attribute \a key from the filter's set of constraints. If \a key is empty all custom attributes are cleared. @@ -373,7 +374,7 @@ void QServiceFilter::clearCustomAttribute(const QString &key) /*! \fn QServiceFilter::VersionMatchRule QServiceFilter::versionMatchRule() const - + Returns the version match rule for this filter. \sa setInterface() @@ -385,7 +386,7 @@ QServiceFilter::VersionMatchRule QServiceFilter::versionMatchRule() const /*! \fn QList<QString> QServiceFilter::customAttributes() const - + Returns the list of custom keys which have been added to the filter. */ QStringList QServiceFilter::customAttributes() const @@ -395,11 +396,11 @@ QStringList QServiceFilter::customAttributes() const /*! \fn void QServiceFilter::setCapabilities(QServiceFilter::CapabilityMatchRule rule, const QStringList& capabilities ) - + Sets the list of \a capabilities which are used to constrain searches for services. The capabilities are matched according to the given \a rule. - + \sa capabilities(), QAbstractSecuritySession */ void QServiceFilter::setCapabilities(QServiceFilter::CapabilityMatchRule rule, const QStringList& capabilities ) @@ -410,7 +411,7 @@ void QServiceFilter::setCapabilities(QServiceFilter::CapabilityMatchRule rule, c /*! \fn QStringList QServiceFilter::capabilities() const - + Returns the list of capabilities which are used to limit services searches. The filter matches any services that requires the given or less @@ -435,7 +436,7 @@ QServiceFilter::CapabilityMatchRule QServiceFilter::capabilityMatchRule() const } #ifndef QT_NO_DATASTREAM -/*! +/*! \fn QDataStream &operator<<(QDataStream &out, const QServiceFilter &sf) \relates QServiceFilter diff --git a/src/serviceframework/qserviceinterfacedescriptor.cpp b/src/serviceframework/qserviceinterfacedescriptor.cpp index 7d86fcb9bc..617b70486d 100644 --- a/src/serviceframework/qserviceinterfacedescriptor.cpp +++ b/src/serviceframework/qserviceinterfacedescriptor.cpp @@ -54,32 +54,33 @@ QTM_BEGIN_NAMESPACE \ingroup servicefw \inmodule QtServiceFramework \brief The QServiceInterfaceDescriptor class identifies a service implementation. + \since 1.0 - A service can implement multiple interfaces and each interface can have multiple implementations. + A service can implement multiple interfaces and each interface can have multiple implementations. The QServiceInterfaceDescriptor class enscapsulates this information, as illustrated by the diagram below. \image qserviceinterfacedescriptor.png Service-Interface-Implementation The major version tag indicates the interface version and the minor version tag identifies the implementation - version. Subsequent versions of the same interface must be binary compatible to previous versions - of the same interface. + version. Subsequent versions of the same interface must be binary compatible to previous versions + of the same interface. In the above example service A and B implement the interface \i com.nokia.qt.x. - In fact Service A provides two different implementations for the very same interface. - This is indicated by the changed minor version number. Although Service B is + In fact Service A provides two different implementations for the very same interface. + This is indicated by the changed minor version number. Although Service B is using the same interface it's implementation actually utilizes the second version of - the interface \i com.nokia.qt.x. Binary compatibility guarantees that clients + the interface \i com.nokia.qt.x. Binary compatibility guarantees that clients who know version 1 can utilize version 2. If an existing interface has to be changed in a non-compatible way a new interface (name) is required. \section1 Namespaces - A QServiceInterfaceDescriptor (the quadruble of service name, - interface name, interface version and implementation version) uniquely - identifies a service implementation on a device. Interface names follow + A QServiceInterfaceDescriptor (the quadruble of service name, + interface name, interface version and implementation version) uniquely + identifies a service implementation on a device. Interface names follow the java namespace convention. - + The namespace \i com.nokia.qt.* is reserved for future Qt development. \sa QServiceFilter, QServiceManager @@ -93,19 +94,19 @@ QTM_BEGIN_NAMESPACE \value Capabilities The capabilities attribute is a QStringList and describes the capabilities that a service client - would require to use the service if capability + would require to use the service if capability checks are enforced. \value Location This attribute points to either the location where the plug-in providing this service is stored or where the name of the service IPC path is found. If the service is plug-in based the location is the - name and/or path of the plugin. If the service is + name and/or path of the plugin. If the service is IPC based the location is the name of the socket address. \value ServiceDescription This attribute provides a general description for the service. - \value InterfaceDescription This attribute provides a description for the interface + \value InterfaceDescription This attribute provides a description for the interface implementation. - \value ServiceType This attribute specifies the QService::Type that the + \value ServiceType This attribute specifies the QService::Type that the service is being provided. */ @@ -137,14 +138,14 @@ QServiceInterfaceDescriptor::QServiceInterfaceDescriptor(const QServiceInterface /*! \fn QServiceInterfaceDescriptor& QServiceInterfaceDescriptor::operator=(const QServiceInterfaceDescriptor& other) - - Copies the content of the QServiceInterfaceDescriptor object contained + + Copies the content of the QServiceInterfaceDescriptor object contained in \a other into this one. */ QServiceInterfaceDescriptor& QServiceInterfaceDescriptor::operator=(const QServiceInterfaceDescriptor& other) { if ( !other.isValid() ) { - if (d) + if (d) delete d; d = 0; return *this; @@ -159,8 +160,8 @@ QServiceInterfaceDescriptor& QServiceInterfaceDescriptor::operator=(const QServi /*! \fn bool QServiceInterfaceDescriptor::operator==(const QServiceInterfaceDescriptor& other) const - - Compares a QServiceInterfaceDescriptor to \a other. Returns true if they + + Compares a QServiceInterfaceDescriptor to \a other. Returns true if they are equal and false otherwise. */ bool QServiceInterfaceDescriptor::operator==(const QServiceInterfaceDescriptor& other) const @@ -185,7 +186,7 @@ bool QServiceInterfaceDescriptor::operator==(const QServiceInterfaceDescriptor& /*! \fn bool QServiceInterfaceDescriptor::isValid() const - + Returns true if this descriptor is valid; otherwise returns false. */ bool QServiceInterfaceDescriptor::isValid() const @@ -195,7 +196,7 @@ bool QServiceInterfaceDescriptor::isValid() const /*! \fn bool QServiceInterfaceDescriptor::scope() const - + Returns true if this implementation is provided for all users on the system. \sa QService::Scope @@ -207,7 +208,7 @@ QService::Scope QServiceInterfaceDescriptor::scope() const /*! \fn QString QServiceInterfaceDescriptor::serviceName() const - + Returns the name of service that provides this implementation. */ QString QServiceInterfaceDescriptor::serviceName() const @@ -217,7 +218,7 @@ QString QServiceInterfaceDescriptor::serviceName() const /*! \fn QString QServiceInterfaceDescriptor::interfaceName() const - + Returns the name of the interface that is implemented. */ QString QServiceInterfaceDescriptor::interfaceName() const @@ -227,10 +228,10 @@ QString QServiceInterfaceDescriptor::interfaceName() const /*! \fn int QServiceInterfaceDescriptor::majorVersion() const - - Returns the version of the interface. - - Subsequent versions of an interface are binary compatible + + Returns the version of the interface. + + Subsequent versions of an interface are binary compatible to previous versions of the same interface. If an interface is broken it must use a new interface name. */ @@ -241,8 +242,8 @@ int QServiceInterfaceDescriptor::majorVersion() const /*! \fn int QServiceInterfaceDescriptor::minorVersion() const - - Returns the version of the implementation. + + Returns the version of the implementation. */ int QServiceInterfaceDescriptor::minorVersion() const { @@ -251,8 +252,8 @@ int QServiceInterfaceDescriptor::minorVersion() const /*! \fn QVariant QServiceInterfaceDescriptor::attribute(QServiceInterfaceDescriptor::Attribute which) const - - Returns the value for the attribute \a which; otherwise returns + + Returns the value for the attribute \a which; otherwise returns an invalid QVariant. */ QVariant QServiceInterfaceDescriptor::attribute(QServiceInterfaceDescriptor::Attribute which) const @@ -264,8 +265,8 @@ QVariant QServiceInterfaceDescriptor::attribute(QServiceInterfaceDescriptor::Att /*! \fn QString QServiceInterfaceDescriptor::customAttribute(const QString& which) const - - Returns the value for the custom attribute \a which; otherwise + + Returns the value for the custom attribute \a which; otherwise returns a null string. */ QString QServiceInterfaceDescriptor::customAttribute(const QString& which) const @@ -318,7 +319,7 @@ QDataStream &operator>>(QDataStream &in, QServiceInterfaceDescriptor::Attribute k = (QServiceInterfaceDescriptor::Attribute)key; return in; } -/*! +/*! \fn QDataStream &operator<<(QDataStream &out, const QServiceInterfaceDescriptor &dc) \relates QServiceInterfaceDescriptor @@ -335,7 +336,7 @@ QDataStream &operator<<(QDataStream &out, const QServiceInterfaceDescriptor &dc) out << magicNumber << majorVersion << minorVersion; out << valid; if (valid) { - out << dc.d->serviceName; + out << dc.d->serviceName; out << dc.d->interfaceName; out << dc.d->major; out << dc.d->minor; @@ -362,7 +363,7 @@ QDataStream &operator>>(QDataStream &in, QServiceInterfaceDescriptor &dc) qWarning() << "Datastream doesn't provide searialized QServiceInterfaceDescriptor"; return in; } - + const quint16 currentMajorVersion = 1; quint16 majorVersion = 0; quint16 minorVersion = 0; diff --git a/src/serviceframework/qservicemanager.cpp b/src/serviceframework/qservicemanager.cpp index e1670728d8..584e488cf8 100644 --- a/src/serviceframework/qservicemanager.cpp +++ b/src/serviceframework/qservicemanager.cpp @@ -87,7 +87,7 @@ static QString qservicemanager_resolveLibraryPath(const QString &libNameOrPath) return libPath; } #else - QLibrary lib(libPath); + QLibrary lib(libPath); if (lib.load()) { lib.unload(); return lib.fileName(); @@ -205,6 +205,7 @@ private slots: \inmodule QtServiceFramework \brief The QServiceManager class enables the loading of service plugins and the (de)registration of services. + \since 1.0 A service is a stand-alone component that can be used by multiple clients. Each service implementation must derive from QObject. Clients request a @@ -399,7 +400,7 @@ QObject* QServiceManager::loadInterface(const QServiceInterfaceDescriptor& descr } const QString location = descriptor.attribute(QServiceInterfaceDescriptor::Location).toString(); - const bool isInterProcess = (descriptor.attribute(QServiceInterfaceDescriptor::ServiceType).toInt() + const bool isInterProcess = (descriptor.attribute(QServiceInterfaceDescriptor::ServiceType).toInt() == QService::InterProcess); if (isInterProcess) { //ipc service @@ -492,7 +493,7 @@ QObject* QServiceManager::loadInterface(const QServiceInterfaceDescriptor& descr the service manager will not perform any checks. Therefore it is assumed that the service manager client is trusted as it controls whether service capabilities are enforced during service loading. - + \sa setInterfaceDefault(), interfaceDefault() */ @@ -579,7 +580,7 @@ bool QServiceManager::addService(QIODevice *device) ServiceMetaDataResults results = parser.parseResults(); bool result = d->dbManager->registerService(results, scope); - + if (results.type == QService::InterProcess) return result; @@ -658,7 +659,7 @@ bool QServiceManager::removeService(const QString& serviceName) DatabaseManager::UserOnlyScope : DatabaseManager::SystemScope)) { d->setError(); return false; - } + } return true; } diff --git a/src/serviceframework/qserviceplugininterface.cpp b/src/serviceframework/qserviceplugininterface.cpp index 47af95782b..b5a3826db2 100644 --- a/src/serviceframework/qserviceplugininterface.cpp +++ b/src/serviceframework/qserviceplugininterface.cpp @@ -48,28 +48,29 @@ QTM_BEGIN_NAMESPACE \inmodule QtServiceFramework \brief The QServicePluginInterface class defines the interface that every plug-in based service must implement. + \since 1.0 */ /*! \internal */ -QServicePluginInterface::QServicePluginInterface() +QServicePluginInterface::QServicePluginInterface() { } /*! \internal */ -QServicePluginInterface::~QServicePluginInterface() +QServicePluginInterface::~QServicePluginInterface() { } - + /*! \fn QObject* QServicePluginInterface::createInstance(const QServiceInterfaceDescriptor& descriptor, QServiceContext* context, QAbstractSecuritySession* securitySession) Creates a new instance of the service specified by \a descriptor. The service - may use the given \a context and \a securitySession. \a context and \a securitySession object are owned + may use the given \a context and \a securitySession. \a context and \a securitySession object are owned by the client of the service. This function returns a null pointer if the plug-in doesn't @@ -82,17 +83,17 @@ QServicePluginInterface::~QServicePluginInterface() This function is called by QServiceManager as part of the service registration process. It can be used to initialize the environment or the creation of external settings files which may be required during the execution of the service. - + The default implementation for this function does nothing. \sa QServiceManager::addService() */ -void QServicePluginInterface::installService() +void QServicePluginInterface::installService() { } /*! - \fn bool QServicePluginInterface::uninstallService() + \fn bool QServicePluginInterface::uninstallService() This function is called bu QServiceManager as part of the deregistration process for services. This gives the service the possibility to perform cleanup operations such as the removal of setting files @@ -103,7 +104,7 @@ void QServicePluginInterface::installService() \sa QServiceManager::removeService() */ -void QServicePluginInterface::uninstallService() +void QServicePluginInterface::uninstallService() { } diff --git a/src/serviceframework/servicemetadata.cpp b/src/serviceframework/servicemetadata.cpp index 4e1d50d184..a0abaf5c1f 100644 --- a/src/serviceframework/servicemetadata.cpp +++ b/src/serviceframework/servicemetadata.cpp @@ -52,13 +52,13 @@ #define XML_MAX "1.1" //Service related -#define SERVICE_TAG "service" +#define SERVICE_TAG "service" #define SERVICE_FILEPATH "filepath" #define SERVICE_IPCADDRESS "ipcaddress" //Interface related #define INTERFACE_TAG "interface" -#define INTERFACE_VERSION "version" +#define INTERFACE_VERSION "version" #define INTERFACE_CAPABILITY "capabilities" #define INTERFACE_CUSTOM_PROPERTY "customproperty" @@ -88,9 +88,11 @@ QDataStream &operator>>(QDataStream &in, ServiceMetaDataResults &r) /* \class ServiceMetaData - Utility class (used by service database) that offers support for + \since 1.0 + + Utility class (used by service database) that offers support for parsing metadata service xml registry file during service registration. \n - + It uses QXMLStreamReader class for parsing. Supproted Operations are: - Parse the service and interfaces defined in XML file - name, version, capabilitiesList, description and filePath of service can be retrieved @@ -100,7 +102,7 @@ QDataStream &operator>>(QDataStream &in, ServiceMetaDataResults &r) /* * Class constructor * - * @param aXmlFilePath path to the xml file that describes the service. + * @param aXmlFilePath path to the xml file that describes the service. */ ServiceMetaData::ServiceMetaData(const QString &aXmlFilePath) { @@ -123,7 +125,7 @@ ServiceMetaData::ServiceMetaData(QIODevice *device) /* * Class destructor - * + * */ ServiceMetaData::~ServiceMetaData() { @@ -158,7 +160,7 @@ QIODevice *ServiceMetaData::device() const { return serviceName; }*/ - + /* * Gets the path of the service implementation file * @@ -168,7 +170,7 @@ QIODevice *ServiceMetaData::device() const { return serviceLocation; }*/ - + /* * Gets the service description * @@ -178,7 +180,7 @@ QIODevice *ServiceMetaData::device() const { return serviceDescription; }*/ - + /* Returns the metadata of the interace at \a index; otherwise returns 0. @@ -219,7 +221,7 @@ bool ServiceMetaData::extractMetadata() Q_ASSERT(checkVersion(XML_MAX)); latestError = 0; - clearMetadata(); + clearMetadata(); QXmlStreamReader xmlReader; bool parseError = false; //Open xml file @@ -229,7 +231,7 @@ bool ServiceMetaData::extractMetadata() } else { //Load xml content xmlReader.setDevice(xmlDevice); - // Read XML doc + // Read XML doc while (!xmlReader.atEnd() && !parseError) { xmlReader.readNext(); //Found <SFW> xml versioning tag introduced in 1.1 @@ -258,7 +260,7 @@ bool ServiceMetaData::extractMetadata() if (ownsXmlDevice) xmlDevice->close(); } - + if (parseError) { //provide better error reports switch (latestError) { @@ -290,7 +292,7 @@ bool ServiceMetaData::extractMetadata() qDebug() << "Not a valid service xml"; break; case SFW_ERROR_PARSE_SERVICE: /* Error parsing service node */ - qDebug().nospace() << "Invalid tag within <service> with the supplied version(" + qDebug().nospace() << "Invalid tag within <service> with the supplied version(" << xmlVersion << ")"; break; case SFW_ERROR_PARSE_INTERFACE: /* Error parsing interface node */ @@ -321,11 +323,11 @@ bool ServiceMetaData::extractMetadata() qDebug() << "Invalid or missing version attribute in <SFW> tag"; break; case SFW_ERROR_UNSUPPORTED_IPC: /* Servicefw version doesn't support IPC */ - qDebug().nospace() << "Supplied service framework version(" << xmlVersion + qDebug().nospace() << "Supplied service framework version(" << xmlVersion << ") doesn't support the <ipcaddress> tag"; break; case SFW_ERROR_UNSUPPORTED_XML_VERSION: /* Unsupported servicefw version supplied */ - qDebug().nospace() << "Service framework version(" << xmlVersion + qDebug().nospace() << "Service framework version(" << xmlVersion << ") is higher than available support(" << QString(XML_MAX) << ")"; break; } @@ -333,7 +335,7 @@ bool ServiceMetaData::extractMetadata() } return !parseError; } - + /* Gets the latest parsing error \n @return parsing error(negative value) or 0 in case there is none @@ -342,7 +344,7 @@ int ServiceMetaData::getLatestError() const { return latestError; } - + /* Parses the service framework xml version tag and continues to parse the service */ @@ -350,7 +352,7 @@ bool ServiceMetaData::processVersionElement(QXmlStreamReader &aXMLReader) { Q_ASSERT(aXMLReader.isStartElement() && aXMLReader.name() == SERVICEFW_TAG); bool parseError = false; - + if (aXMLReader.attributes().hasAttribute("version")) { xmlVersion = aXMLReader.attributes().value("version").toString(); bool success = checkVersion(xmlVersion); @@ -376,11 +378,11 @@ bool ServiceMetaData::processVersionElement(QXmlStreamReader &aXMLReader) if (!processServiceElement(aXMLReader)) { parseError = true; } - } + } else if (aXMLReader.isEndElement() && aXMLReader.name() == SERVICEFW_TAG) { //Found </SFW>, leave the loop break; - } + } else if (aXMLReader.isStartElement() && aXMLReader.name() != SERVICE_TAG) { latestError = ServiceMetaData::SFW_ERROR_NO_SERVICE; parseError = true; @@ -442,8 +444,8 @@ bool ServiceMetaData::processServiceElement(QXmlStreamReader &aXMLReader) parseError = true; } } else if (aXMLReader.isStartElement() && aXMLReader.name() == INTERFACE_TAG) { - //Found interface> node, read module related metadata - if (!processInterfaceElement(aXMLReader)) + //Found interface> node, read module related metadata + if (!processInterfaceElement(aXMLReader)) parseError = true; } else if (aXMLReader.isStartElement() && aXMLReader.name() == "version") { //Found <version> tag on service level. We ignore this for now @@ -453,7 +455,7 @@ bool ServiceMetaData::processServiceElement(QXmlStreamReader &aXMLReader) break; } else if (aXMLReader.isEndElement() || aXMLReader.isStartElement()) { latestError = ServiceMetaData::SFW_ERROR_PARSE_SERVICE; - parseError = true; + parseError = true; } else if (aXMLReader.tokenType() == QXmlStreamReader::Invalid) { latestError = ServiceMetaData::SFW_ERROR_INVALID_XML_FILE; parseError = true; @@ -520,7 +522,7 @@ bool ServiceMetaData::processInterfaceElement(QXmlStreamReader &aXMLReader) 0 //->description }; aInterface.d = new QServiceInterfaceDescriptorPrivate; - + while (!parseError && !aXMLReader.atEnd()) { aXMLReader.readNext(); //Read interface description @@ -594,7 +596,7 @@ bool ServiceMetaData::processInterfaceElement(QXmlStreamReader &aXMLReader) parseError = true; } } - + for(int i=0;!parseError && i<4;i++) { if (dupITags[i] > 1) { parseError = true; @@ -665,7 +667,7 @@ bool ServiceMetaData::greaterThan(const QString &v1, const QString &v2) const int minorV2 = -1; transformVersion(v2, &majorV2, &minorV2); - return (majorV1 > majorV2 + return (majorV1 > majorV2 || (majorV1 == majorV2 && minorV1 > minorV2)); } |