Home · All Classes · All Namespaces · Modules · Functions · Files
Public Member Functions | Protected Member Functions
Tp::DBusProxyFactory Class Reference

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 <TelepathyQt4/DBusProxyFactory>

Inherits QObject, and Tp::RefCounted.

Inherited by Tp::ChannelFactory, and Tp::FixedFeatureFactory.

List of all members.

Public Member Functions

Protected Member Functions


Detailed Description

The DBusProxyFactory class is a base class for all D-Bus proxy factory classes. Handles proxy caching and making them ready as appropriate.


Constructor & Destructor Documentation

Tp::DBusProxyFactory::~DBusProxyFactory ( ) [virtual]

Class destructor.

Tp::DBusProxyFactory::DBusProxyFactory ( const QDBusConnection bus) [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.

Parameters:
busThe D-Bus bus connection for the objects constructed using this factory.

Member Function Documentation

const QDBusConnection & Tp::DBusProxyFactory::dbusConnection ( ) const

Return the D-Bus connection all of the proxies from this factory communicate with.

Returns:
A QDBusConnection object.
DBusProxyPtr Tp::DBusProxyFactory::cachedProxy ( const QString busName,
const QString objectPath 
) const [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.

Parameters:
busNameBus name of the proxy to return.
objectPathObject path of the proxy to return.
Returns:
A pointer to the DBusProxy object, if any.
PendingReady * Tp::DBusProxyFactory::nowHaveProxy ( const DBusProxyPtr &  proxy) const [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.

Parameters:
proxyThe proxy which the factory should now make sure is prepared and made ready.
Returns:
A PendingReady operation which will emit PendingReady::finished when the proxy is usable.
QString Tp::DBusProxyFactory::finalBusNameFrom ( const QString uniqueOrWellKnown) const [protected, pure 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.

Parameters:
uniqueOrWellKnownAny valid D-Bus service name, either unique or well-known.
Returns:
Whatever that name would turn to, when a proxy is constructed for it.

Implemented in Tp::AccountFactory, Tp::ChannelFactory, and Tp::ConnectionFactory.

PendingOperation * Tp::DBusProxyFactory::initialPrepare ( const DBusProxyPtr &  proxy) const [protected, virtual]

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.

Todo:
FIXME actually implement this... :) Currently just a vtable placeholder.
Parameters:
proxyThe just-constructed proxy to be prepared.
Returns:
NULL ie. nothing to do.
PendingOperation * Tp::DBusProxyFactory::readyPrepare ( const DBusProxyPtr &  proxy) const [protected, virtual]

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.

Todo:
FIXME actually implement this... :) Currently just a vtable placeholder.
Parameters:
proxyThe just-readified proxy to be prepared.
Returns:
NULL ie. nothing to do.
virtual Features Tp::DBusProxyFactory::featuresFor ( const DBusProxyPtr &  proxy) const [protected, pure virtual]


Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation
Telepathy-Qt4 0.6.5