Home · Modules · All Classes · All Namespaces |
The DBusProxyFactory class is a base class for all D-Bus proxy factory classes. Handles proxy caching and making them ready as appropriate. More...
#include <TelepathyQt/DBusProxyFactory>
Inherits QObject, and Tp::RefCounted.
Inherited by Tp::ChannelFactory, and Tp::FixedFeatureFactory.
Public Member Functions | |
virtual | ~DBusProxyFactory () |
const QDBusConnection & | dbusConnection () const |
Public Member Functions inherited from Tp::RefCounted | |
RefCounted () | |
virtual | ~RefCounted () |
Protected Member Functions | |
DBusProxyFactory (const QDBusConnection &bus) | |
DBusProxyPtr | cachedProxy (const QString &busName, const QString &objectPath) const |
PendingReady * | nowHaveProxy (const DBusProxyPtr &proxy) const |
virtual QString | finalBusNameFrom (const QString &uniqueOrWellKnown) const =0 |
virtual PendingOperation * | initialPrepare (const DBusProxyPtr &proxy) const |
virtual PendingOperation * | readyPrepare (const DBusProxyPtr &proxy) const |
virtual Features | featuresFor (const DBusProxyPtr &proxy) const =0 |
The DBusProxyFactory class is a base class for all D-Bus proxy factory classes. Handles proxy caching and making them ready as appropriate.
|
virtual |
Class destructor.
|
protected |
Construct a new DBusProxyFactory object.
The intention for storing the bus here is that it generally doesn't make sense to construct proxies for multiple buses in the same context. Allowing that would lead to more complex keying needs in the cache, as well.
bus | The D-Bus bus connection for the objects constructed using this factory. |
const QDBusConnection & Tp::DBusProxyFactory::dbusConnection | ( | ) | const |
Return the D-Bus connection all of the proxies from this factory communicate with.
|
protected |
Return a cached proxy with the given busName and objectPath.
If a proxy has not been previously put into the cache by nowHaveProxy for those identifying attributes, or a previously cached proxy has since been invalidated and/or destroyed, a Null
shared pointer is returned instead.
busName | Bus name of the proxy to return. |
objectPath | Object path of the proxy to return. |
|
protected |
Should be called by subclasses when they have a proxy, be it a newly-constructed one or one from the cache.
This function will then do the rest of the factory work, including caching the proxy if it's not cached already, doing any initialPrepare()/readyPrepare() work if appropriate, and making the features from featuresFor() ready if they aren't already.
The returned PendingReady only finishes when the initialPrepare() and readyPrepare() operations for the proxy has completed, and the requested features have all been made ready (or found unable to be made ready). Note that this might have happened already before calling this function, if the proxy was not a newly created one, but was looked up from the cache. DBusProxyFactory handles the necessary subleties for this to work.
Access to the proxy instance is allowed as soon as this method returns through PendingReady::proxy(), if the proxy is needed in a context where it's not required to be ready.
proxy | The proxy which the factory should now make sure is prepared and made ready. |
|
protectedpure virtual |
"Normalize" a bus name according to the rules for the proxy class to construct.
Should be implemented by subclasses to transform the application-specified name uniqueOrWellKnown to whatever the proxy constructed for that name would have in its DBusProxy::busName() in the end.
For StatelessDBusProxy sub-classes this should mostly be an identity transform, while for StatefulDBusProxy sub-classes StatefulDBusProxy::uniqueNameFrom() or an equivalent thereof should be used in most cases.
If this is not implemented correctly, caching won't work properly.
uniqueOrWellKnown | Any valid D-Bus service name, either unique or well-known. |
Implemented in Tp::ChannelFactory, Tp::AccountFactory, and Tp::ConnectionFactory.
|
protectedvirtual |
Allows subclasses to do arbitrary manipulation on the proxy before it is attempted to be made ready.
If a non-NULL
operation is returned, the completion of that operation is waited for before starting to make the object ready whenever nowHaveProxy() is called the first time around for a given proxy.
proxy | The just-constructed proxy to be prepared. |
NULL
ie. nothing to do.
|
protectedvirtual |
Allows subclasses to do arbitrary manipulation on the proxy after it has been made ready.
If a non-NULL
operation is returned, the completion of that operation is waited for before signaling that the object is ready for use after ReadyObject::becomeReady() for it has finished whenever nowHaveProxy() is called the first time around for a given proxy.
proxy | The just-readified proxy to be prepared. |
NULL
ie. nothing to do.
|
protectedpure virtual |
Return the features which should be made ready on a given proxy.
This can be used to implement instance-specific features based on arbitrary criteria. FixedFeatureFactory implements this as a fixed set of features independent of the instance, however.
It should be noted that if an empty set of features is returned, ReadyObject::becomeReady() is not called at all. In other words, any "core feature" is not automatically added to the requested features. This is to enable setting a factory to not make proxies ready at all, which is useful eg. in the case of account editing UIs which aren't interested in the state of Connection objects for the Account objects they're editing.
proxy | The proxy on which the returned features will be made ready. |
Implemented in Tp::ChannelFactory, and Tp::FixedFeatureFactory.
TelepathyQt 0.9.8 | Generated by 1.8.15 |