|
||
class CMsvServerEntry : public CActive, public MMsvStoreObserver;
Accesses and acts upon a particular Message Server entry.
It provides similar functionality to that which CMsvEntry
gives to client-side programs. The current entry that a CMsvServerEntry object relates is similarly referred to as its context.
A difference to note is that CMsvEntry
functions, when used on a remote context, can result in requests to Server-side MTMs to change data on a remote server, as
well as the local Message Server index. Naturally, as CMsvServerEntry is designed to be used by Server-side MTMs themselves,
its comparable functions only alter the Message Server index.
A CBaseServerMTM-derived object gets an initial CMsvServerEntry on construction. It can get further CMsvServerEntry objects
by calling CMsvServerEntry::NewEntryL(TMsvId)
. The context can be changed by CMsvServerEntry::SetEntry(TMsvId)
.
The context is locked, preventing it being accessed by other MTMs. The lock is released when the object is deleted, or the context changes.
As with CMsvEntry
, CBaseServerMTM functions can be divided into two broad groups. The first provides means to access the various types of storage
associated with an entry. The second provides a means to discover and access other entries that the entry owns (its children).
MMsvStoreObserver
- Observer interface to get events relating to a message store.
CBase
-
Base class for all classes to be instantiated on the heap.
CActive
-
The core class of the active object abstraction.
CMsvServerEntry
- Accesses and acts upon a particular Message Server entry.
Defined in CMsvServerEntry
:
ChangeAttributes(const CMsvEntrySelection &,TUint,TUint)
Provides a quick way to set or clear multiple fields in a selection of entries.ChangeEntry(const TMsvEntry &)
Sets the context's index entry to the specified values.ChangeEntry(const TMsvEntry &,TSecureId)
Sets the context's index entry to the specified values and updates the owner of ...ChangeEntryBulk(const TMsvEntry &)
Sets the context's index entry to the specified values and updates the owner of ...ChangeEntryBulk(const TMsvEntry &,TSecureId)
Sets the context's index entry to the specified values and updates the owner of ...CompleteBulk()
Completes the current bulk transaction (if any) Requests that the message server...CopyEntriesL(const CMsvEntrySelection &,TMsvId,CMsvEntrySelection &,TRequestStatus &)
Copies a selection of children of the context to another entry that belongs to a...CopyEntriesL(const CMsvEntrySelection &,TMsvId,TRequestStatus &)
Copies a selection of children of the context to another entry that belongs to a...CopyEntryL(TMsvId,TMsvId,TMsvId &,TRequestStatus &)
Copies a child of the context to another entry. All descendants will be copied a...CopyEntryL(TMsvId,TMsvId,TRequestStatus &)
Copies a child of the context to another entry. All descendants will be copied a...CreateEntry(TMsvEntry &)
Creates a new entry as a child of the current context.CreateEntry(TMsvEntry &,TSecureId)
Creates a new entry as a child of the current context.CreateEntry(TMsvEntry &,TSecureId,TBool)
Creates a new entry as a child of the current context.CreateEntryBulk(TMsvEntry &)
Creates a new entry as a child of the current context as part of a bulk creation...CreateEntryBulk(TMsvEntry &,TSecureId)
Creates a new entry as a child of the current context as part of a bulk creation...DeleteEntries(CMsvEntrySelection &)
Deletes a selection of child entries. The delete works recursively through all t...DeleteEntry(TMsvId)
Deletes a child entry of the context. The delete works recursively through all t...DoCancel()
Implements cancellation of an outstanding request.EditStoreL()
Obtains the message store for the current context with read-write access.Entry()const
Gets the context's index entry.FileSession()
Allows a Server-side MTM to access the file session handle created by the Messag...GetChildren(CMsvEntrySelection &)
Gets a selection containing the IDs of all the context children.GetChildrenWithMtm(TUid,CMsvEntrySelection &)
Gets a selection containing the IDs of all the context children with the specifi...GetChildrenWithService(TMsvId,CMsvEntrySelection &)
Gets a selection containing the IDs of all the context children with the specifi...GetChildrenWithType(TUid,CMsvEntrySelection &)
Gets a selection containing the IDs of all the context children with the specifi...GetEntryFromId(TMsvId,TMsvEntry *&)
Gets the index entry for a specified entry ID.HasStoreL()const
Tests if the context has an associated message store.MoveEntriesL(const CMsvEntrySelection &,TMsvId,TRequestStatus &)
Moves a selection of children of the context to another entry that belongs to a ...MoveEntriesWithinService(CMsvEntrySelection &,TMsvId)
Moves a child of the context to under another entry. All descendants will be mov...MoveEntryL(TMsvId,TMsvId,TRequestStatus &)
Moves a child of the context to another entry that belongs to a different servic...MoveEntryWithinService(TMsvId,TMsvId)
Moves a child of the context to under another entry. All descendants will be mov...NewEntryL(TMsvId)
Gets a new CMsvServerEntry object for the specified entry ID.OwningService()const
Gets the ID of the service that owns the context.ReadStoreL()
Obtains the message store for the current context with read-only access.RunL()
Handles an active object's request completion event.SetEntry(TMsvId)
Changes the context of the specified entry.SetMtm(TUid)
Sets this MTM sorting type to specified UID. When children of an entry are sorte...SetSort(TMsvSelectionOrdering &)
Sets the sort order that is used when listing children, for example with CMsvSer...Sort()
Gets the current sort order of children of the entry.Inherited from CActive
:
CActive(TInt)
Constructs the active object with the specified priority.Cancel()
Cancels the wait for completion of an outstanding request.Deque()
Removes the active object from the active scheduler's list of active objects.EPriorityHigh
A priority higher than EPriorityUserInput.EPriorityIdle
A low priority, useful for active objects representing background processing.EPriorityLow
A priority higher than EPriorityIdle but lower than EPriorityStandard.EPriorityStandard
Most active objects will have this priority.EPriorityUserInput
A priority higher than EPriorityStandard; useful for active objects handling use...Extension_(TUint,TAny *&,TAny *)
Extension function IsActive()const
Determines whether the active object has a request outstanding.IsAdded()const
Determines whether the active object has been added to the active scheduler's li...Priority()const
Gets the priority of the active object.RunError(TInt)
Handles a leave occurring in the request completion event handler CActive::RunL(...SetActive()
Indicates that the active object has issued a request and that it is now outstan...SetPriority(TInt)
Sets the priority of the active object.TPriority
Defines standard priorities for active objects. iStatus
The request status associated with an asynchronous request.Inherited from CBase
:
Delete(CBase *)
Deletes the specified object.operator new(TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TAny *)
Initialises the object to binary zeroes.operator new(TUint,TLeave)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TLeave,TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TUint)
Allocates the object from the heap and then initialises its contents to binary z...Inherited from MMsvStoreObserver
:
EMsvEditStoreClosed
An editable message store was closed. EMsvReadStoreClosed
A read-only message store was closed. HandleStoreEvent(TMsvStoreEvent,TMsvId)
Receives a message store event.TMsvStoreEvent
Defines message store event types.IMPORT_C TInt SetEntry(TMsvId aId);
Changes the context of the specified entry.
The call locks the entry, preventing it from being accessed by other clients. The lock is released when the object is deleted or the context is changed.
Note that you can change the context to KMsvNullIndexEntryId to unlock an entry without locking another.
|
|
inline const TMsvEntry& Entry() const;
Gets the context's index entry.
|
IMPORT_C TMsvId OwningService() const;
Gets the ID of the service that owns the context.
Local entries are considered as being members of the local service.
If the entry is the root, then the root ID (KMsvRootIndexEntryId) is returned.
|
IMPORT_C TInt ChangeEntry(const TMsvEntry &aEntry, TSecureId aOwnerId);
Sets the context's index entry to the specified values and updates the owner of the entry to that specified by the supplied ID.
|
|
IMPORT_C TInt ChangeEntry(const TMsvEntry &aEntry);
Sets the context's index entry to the specified values.
|
|
IMPORT_C TInt CreateEntry(TMsvEntry &aEntry);
Creates a new entry as a child of the current context.
The parent ID and entry ID are set by the Message Server.
|
|
IMPORT_C TInt CreateEntry(TMsvEntry &aEntry, TSecureId aOwnerId);
Creates a new entry as a child of the current context.
Ownership of the created entry is given to the process with the specified SID.
The parent ID and entry ID are set by the Message Server.
|
|
IMPORT_C TInt CreateEntry(TMsvEntry &aEntry, TSecureId aOwnerId, TBool aBulk);
Creates a new entry as a child of the current context.
Ownership of the created entry is given to the process with the specified SID.
The parent ID and entry ID are set by the Message Server.
|
|
IMPORT_C TInt DeleteEntry(TMsvId aId);
Deletes a child entry of the context. The delete works recursively through all the descendants.
If a child or any descendant is locked by another client, then no entries are deleted.
|
|
IMPORT_C TInt DeleteEntries(CMsvEntrySelection &aSelection);
Deletes a selection of child entries. The delete works recursively through all the descendants.
If a child or any descendant is locked by another client, then no entries are deleted.
|
|
IMPORT_C TInt MoveEntryWithinService(TMsvId aId, TMsvId aDestination);
Moves a child of the context to under another entry. All descendants will be moved as well. The destination must belong to the same service as the context.
If an error occurs, no changes are made.
For pre-Unicode releases see the synchronous overload of MoveEntry().
|
|
IMPORT_C TInt MoveEntriesWithinService(CMsvEntrySelection &aSelection, TMsvId aDestination);
Moves a child of the context to under another entry. All descendants will be moved as well. The destination must belong to the same service as the context.
|
|
IMPORT_C TInt ChangeAttributes(const CMsvEntrySelection &aSelection, TUint aSetAttributes, TUint aClearAttributes);
Provides a quick way to set or clear multiple fields in a selection of entries.
Fields to change are specified using a bitmask of TMsvAttribute values. Possible fields that can be changed using this function are:
1. PC synchronisation
2. Visibility flag
3. Read flag
4. In-preparation flag
5. Connected flag
6. New flag
|
|
TMsvAttribute
Supplies values for bitmasks that allows the rapid setting or clearing of a numb...IMPORT_C void MoveEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus &aObserverStatus);
Moves a child of the context to another entry that belongs to a different service. All descendants will be moved as well.
The move is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the move is complete.
If the function leaves, no changes are made.
In pre-Unicode versions an asynchronous move can be cancelled through CancelMoveEntry(); in other releases, use CActive::Cancel()
.
|
|
IMPORT_C void MoveEntriesL(const CMsvEntrySelection &aSelection, TMsvId aDestination, TRequestStatus &aObserverStatus);
Moves a selection of children of the context to another entry that belongs to a different service. All descendants will be moved as well.
The move is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the move is complete.
|
|
IMPORT_C void CopyEntryL(TMsvId aId, TMsvId aDestination, TRequestStatus &aObserverStatus);
Copies a child of the context to another entry. All descendants will be copied as well.
The copy is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the copy is complete.
If the function leaves, no changes are made.
|
|
IMPORT_C void CopyEntryL(TMsvId aId, TMsvId aDestination, TMsvId &aCompletedEntry, TRequestStatus &aObserverStatus);
Copies a child of the context to another entry. All descendants will be copied as well.
This overload returns the ID of the new entry.
The copy is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the copy is complete.
If the function leaves, no changes are made.
|
|
IMPORT_C void CopyEntriesL(const CMsvEntrySelection &aSelection, TMsvId aDestination, TRequestStatus &aObserverStatus);
Copies a selection of children of the context to another entry that belongs to a different service. All descendants will be copied as well.
The copy is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the copy is complete.
|
|
IMPORT_C void CopyEntriesL(const CMsvEntrySelection &aSelection, TMsvId aDestination, CMsvEntrySelection &aCompletedSelection,
TRequestStatus &aObserverStatus);
Copies a selection of children of the context to another entry that belongs to a different service. All descendants will be copied as well.
This overload returns the IDs of the new entries.
The copy is carried out asynchronously. The caller should supply in aObserverStatus the status word of an active object that it owns. The function will signal this to be completed when the copy is complete.
|
|
IMPORT_C TInt GetEntryFromId(TMsvId aId, TMsvEntry *&aEntry);
Gets the index entry for a specified entry ID.
|
|
IMPORT_C CMsvStore* ReadStoreL();
Obtains the message store for the current context with read-only access.
Multiple clients can read from a store simultaneously. If another client is already writing to the store, the function leaves with KErrAccessDenied.
The returned CMsvStore
must be deleted when it is no longer required.
|
|
IMPORT_C CMsvStore* EditStoreL();
Obtains the message store for the current context with read-write access.
Only one client can edit a message store at one time. If another client is already writing to the store, KErrAccessDenied is returned. However, any number of clients can read from the store simultaneously.
If the message store does not exist when EditStore() is called, a new message store is created.
The returned CMsvStore
must be deleted when it is no longer required.
|
|
inline const TMsvSelectionOrdering& Sort();
Gets the current sort order of children of the entry.
|
inline void SetSort(TMsvSelectionOrdering &aOrdering);
Sets the sort order that is used when listing children, for example with CMsvServerEntry::GetChildren(CMsvEntrySelection &)
.
|
inline void SetMtm(TUid aMtm);
Sets this MTM sorting type to specified UID. When children of an entry are sorted, entries belonging to the same MTM type can be grouped together.
|
IMPORT_C TInt GetChildren(CMsvEntrySelection &aSelection);
Gets a selection containing the IDs of all the context children.
If the entry has no children, the selection is empty.
|
|
IMPORT_C TInt GetChildrenWithService(TMsvId aServiceId, CMsvEntrySelection &aSelection);
Gets a selection containing the IDs of all the context children with the specified service.
If the entry has no children, the selection is empty.
|
|
IMPORT_C TInt GetChildrenWithMtm(TUid aMtm, CMsvEntrySelection &aSelection);
Gets a selection containing the IDs of all the context children with the specified MTM.
If the entry has no children, the selection is empty.
|
|
IMPORT_C TInt GetChildrenWithType(TUid aType, CMsvEntrySelection &aSelection);
Gets a selection containing the IDs of all the context children with the specified entry type.
If the entry has no children, the selection is empty.
|
|
IMPORT_C CMsvServerEntry* NewEntryL(TMsvId aId);
Gets a new CMsvServerEntry object for the specified entry ID.
The call locks the entry, preventing it being accessed by other clients.
The object must be deleted when it is no longer required. The lock is released when the object is deleted or the context is
changed with CMsvServerEntry::SetEntry(TMsvId)
.
|
|
|
IMPORT_C TBool HasStoreL() const;
Tests if the context has an associated message store.
|
IMPORT_C RFs& FileSession();
Allows a Server-side MTM to access the file session handle created by the Message Server. This is preferable, as more efficient, to creating another handle.
|
IMPORT_C TInt CreateEntryBulk(TMsvEntry &aEntry, TSecureId aOwnerId);
Creates a new entry as a child of the current context as part of a bulk creation operation. The entry will not be committed to file immediately.
The parent ID and entry ID are set by the Message Server.
|
|
IMPORT_C TInt CreateEntryBulk(TMsvEntry &aEntry);
Creates a new entry as a child of the current context as part of a bulk creation operation
The parent ID and entry ID are set by the Message Server.
|
|
IMPORT_C TInt ChangeEntryBulk(const TMsvEntry &aEntry, TSecureId aOwnerId);
Sets the context's index entry to the specified values and updates the owner of the entry to that specified by the supplied ID. It does this as part of a bulk operation, so the changes are not immediately committed to file.
|
|
IMPORT_C TInt ChangeEntryBulk(const TMsvEntry &aEntry);
Sets the context's index entry to the specified values and updates the owner of the entry to that specified by the supplied ID. It does this as part of a bulk operation, so the changes are not immediately committed to file.
|
|
IMPORT_C void CompleteBulk();
Completes the current bulk transaction (if any) Requests that the message server commit to the index file on disk any entries which have not been committed and to generate notifications for any entries which require them.
protected: virtual void RunL();
Handles an active object's request completion event.
A derived class must provide an implementation to handle the completed request. If appropriate, it may issue another request.
The function is called by the active scheduler when a request completion event occurs, i.e. after the active scheduler's WaitForAnyRequest() function completes.
Before calling this active object's CMsvServerEntry::RunL()
function, the active scheduler has:
1. decided that this is the highest priority active object with a completed request
2. marked this active object's request as complete (i.e. the request is no longer outstanding)
CMsvServerEntry::RunL()
runs under a trap harness in the active scheduler. If it leaves, then the active scheduler calls CActive::RunError(TInt)
to handle the leave.
Note that once the active scheduler's Start() function has been called, all user code is run under one of the program's active
object's CMsvServerEntry::RunL()
or CActive::RunError(TInt)
functions.
CActiveScheduler::Start()
Starts a new wait loop under the control of the current active scheduler.CActiveScheduler::Error(TInt)const
Handles the result of a leave occurring in an active object’s RunL() function.CActiveScheduler::WaitForAnyRequest()
Wait for an asynchronous request to complete.protected: virtual void DoCancel();
Implements cancellation of an outstanding request.
This function is called as part of the active object's CActive::Cancel()
.
It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.
CMsvServerEntry::DoCancel()
must not wait for event completion; this is handled by CActive::Cancel()
.
CActive::Cancel()
Cancels the wait for completion of an outstanding request.