Back to index

d-push  2.0
Public Member Functions | Protected Member Functions | Protected Attributes
Backend Class Reference
Inheritance diagram for Backend:
Inheritance graph
[legend]
Collaboration diagram for Backend:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Backend ()
 Constructor.
 GetStateMachine ()
 Returns a IStateMachine implementation used to save states The default StateMachine should be used here, so, false is fine.
 GetSearchProvider ()
 Returns a ISearchProvider implementation used for searches the SearchProvider is just a stub.
 GetSupportedASVersion ()
 Indicates which AS version is supported by the backend.
 EmptyFolder ($folderid, $includeSubfolders=true)
 Deletes all contents of the specified folder.
 HasChangesSink ()
 Indicates if the backend has a ChangesSink.
 ChangesSinkInitialize ($folderid)
 The folder should be considered by the sink.
 ChangesSink ($timeout=30)
 The actual ChangesSink.
 Settings ($settings)
 Applies settings to and gets informations from the device.
 Logon ($username, $domain, $password)
 Authenticates the user.
 Setup ($store, $checkACLonly=false, $folderid=false)
 Setup the backend to work on a specific store or checks ACLs there.
 Logoff ()
 Logs off non critical operations closing the session should be done here.
 GetHierarchy ()
 Returns an array of SyncFolder types with the entire folder hierarchy on the server (the array itself is flat, but refers to parents via the 'parent' property.
 GetImporter ($folderid=false)
 Returns the importer to process changes from the mobile If no $folderid is given, hierarchy data will be imported With a $folderid a content data will be imported.
 GetExporter ($folderid=false)
 Returns the exporter to send changes to the mobile If no $folderid is given, hierarchy data should be exported With a $folderid a content data is expected.
 SendMail ($sm)
 Sends an e-mail This messages needs to be saved into the 'sent items' folder.
 Fetch ($folderid, $id, $contentparameters)
 Returns all available data of a single message.
 GetWasteBasket ()
 Returns the waste basket.
 GetAttachmentData ($attname)
 Returns the content of the named attachment as stream.
 MeetingResponse ($requestid, $folderid, $response)
 Processes a response to a meeting request.

Protected Member Functions

 InitializePermanentStorage ()
 
Protected methods for BackendStorage
 InitializeStateStorage ()
 Loads the state related storage data of the user and device All data not necessary for the next state should be removed.
 SaveStorages ()
 Saves the permanent and state related storage data of the user and device if they were loaded previousily If the backend storage is used this should be called.

Protected Attributes

 $permanentStorage
 $stateStorage

Detailed Description

Definition at line 58 of file backend.php.


Member Function Documentation

Constructor.

public

Definition at line 67 of file backend.php.

                              {
    }

Here is the caller graph for this function:

Backend::ChangesSink ( timeout = 30)

The actual ChangesSink.

For max. the $timeout value this method should block and if no changes are available return an empty array. If changes are available a list of folderids is expected.

Parameters:
int$timeoutmax. amount of seconds to block

public

Returns:
array

Implements IBackend.

Reimplemented in BackendIMAP.

Definition at line 173 of file backend.php.

                                               {
        return array();
    }

The folder should be considered by the sink.

Folders which were not initialized should not result in a notification of IBacken->ChangesSink().

Parameters:
string$folderidpublic
Returns:
boolean false if there is any problem with that folder

Implements IBackend.

Reimplemented in BackendIMAP.

Definition at line 158 of file backend.php.

                                                      {
         return false;
     }
Backend::EmptyFolder ( folderid,
includeSubfolders = true 
)

Deletes all contents of the specified folder.

This is generally used to empty the trash (wastebasked), but could also be used on any other folder.

Parameters:
string$folderid
boolean$includeSubfolders(opt) also delete sub folders, default true

public

Returns:
boolean
Exceptions:
StatusException

Implements IBackend.

Definition at line 133 of file backend.php.

                                                                      {
        return false;
    }
IBackend::Fetch ( folderid,
id,
contentparameters 
) [inherited]

Returns all available data of a single message.

Parameters:
string$folderid
string$id
ContentParameters$contentparametersflag

public

Returns:
object(SyncObject)
Exceptions:
StatusException

Implemented in BackendZarafa, BackendCombined, and BackendDiff.

IBackend::GetAttachmentData ( attname) [inherited]

Returns the content of the named attachment as stream.

The passed attachment identifier is the exact string that is returned in the 'AttName' property of an SyncAttachment. Any information necessary to locate the attachment must be encoded in that 'attname' property. Data is written directly - 'print $data;'

Parameters:
string$attnamepublic
Returns:
SyncItemOperationsAttachment
Exceptions:
StatusException

Implemented in BackendKolab, BackendZarafa, BackendIMAP, BackendCombined, BackendMaildir, and BackendVCardDir.

IBackend::GetExporter ( folderid = false) [inherited]

Returns the exporter to send changes to the mobile If no $folderid is given, hierarchy data should be exported With a $folderid a content data is expected.

Parameters:
string$folderid(opt)

public

Returns:
object implements IExportChanges
Exceptions:
StatusException

Implemented in BackendZarafa, BackendCombined, and BackendDiff.

IBackend::GetHierarchy ( ) [inherited]

Returns an array of SyncFolder types with the entire folder hierarchy on the server (the array itself is flat, but refers to parents via the 'parent' property.

provides AS 1.0 compatibility

public

Returns:
array SYNC_FOLDER

Implemented in BackendZarafa, BackendCombined, and BackendDiff.

IBackend::GetImporter ( folderid = false) [inherited]

Returns the importer to process changes from the mobile If no $folderid is given, hierarchy data will be imported With a $folderid a content data will be imported.

Parameters:
string$folderid(opt)

public

Returns:
object implements IImportChanges
Exceptions:
StatusException

Implemented in BackendZarafa, BackendCombined, and BackendDiff.

Returns a ISearchProvider implementation used for searches the SearchProvider is just a stub.

public

Returns:
object Implementation of ISearchProvider

Implements IBackend.

Definition at line 88 of file backend.php.

                                        {
        return new SearchProvider();
    }

Returns a IStateMachine implementation used to save states The default StateMachine should be used here, so, false is fine.

public

Returns:
boolean/object

Implements IBackend.

Definition at line 77 of file backend.php.

                                      {
        return false;
    }

Indicates which AS version is supported by the backend.

By default AS version 2.5 (ASV_25) is returned (Z-Push 1 standard). Subclasses can overwrite this method to set another AS version

public

Returns:
string AS version constant

Implements IBackend.

Definition at line 100 of file backend.php.

                                            {
        return ZPush::ASV_25;
    }
IBackend::GetWasteBasket ( ) [inherited]

Returns the waste basket.

The waste basked is used when deleting items; if this function returns a valid folder ID, then all deletes are handled as moves and are sent to the backend as a move. If it returns FALSE, then deletes are handled as real deletes

public

Returns:
string

Implemented in BackendZarafa, BackendIMAP, BackendKolab, BackendCombined, BackendMaildir, and BackendVCardDir.

Indicates if the backend has a ChangesSink.

A sink is an active notification mechanism which does not need polling.

public

Returns:
boolean

Implements IBackend.

Reimplemented in BackendIMAP.

Definition at line 144 of file backend.php.

                                     {
        return false;
    }


Protected methods for BackendStorage

Backends can use a permanent and a state related storage to save additional data used during the synchronization.

While permament storage is bound to the device and user, state related data works linked to the regular states (and its counters).

Both consist of a StateObject, while the backend can decide what to save in it.

Before using $this->permanentStorage and $this->stateStorage the initilize methods have to be called from the backend.

Backend->LogOff() must call $this->SaveStorages() so the data is written to disk!

These methods are an abstraction layer for StateManager->Get/SetBackendStorage() which can also be used independently. Loads the permanent storage data of the user and device

protected

Returns:

Definition at line 218 of file backend.php.

                                                    {
        if (!isset($this->permanentStorage)) {
            try {
                $this->permanentStorage = ZPush::GetDeviceManager()->GetStateManager()->GetBackendStorage(StateManager::BACKENDSTORAGE_PERMANENT);
            }
            catch (StateNotYetAvailableException $snyae) {
                $this->permanentStorage = new StateObject();
            }
            catch(StateNotFoundException $snfe) {
                $this->permanentStorage = new StateObject();
            }
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Loads the state related storage data of the user and device All data not necessary for the next state should be removed.

protected

Returns:

Definition at line 239 of file backend.php.

                                                {
        if (!isset($this->stateStorage)) {
            try {
                $this->stateStorage = ZPush::GetDeviceManager()->GetStateManager()->GetBackendStorage(StateManager::BACKENDSTORAGE_STATE);
            }
            catch (StateNotYetAvailableException $snyae) {
                $this->stateStorage = new StateObject();
            }
            catch(StateNotFoundException $snfe) {
                $this->stateStorage = new StateObject();
            }
        }
    }

Here is the call graph for this function:

IBackend::Logoff ( ) [inherited]

Logs off non critical operations closing the session should be done here.

public

Returns:
boolean

Implemented in BackendZarafa, BackendCombined, BackendIMAP, BackendKolab, BackendMaildir, and BackendVCardDir.

IBackend::Logon ( username,
domain,
password 
) [inherited]

Authenticates the user.

Parameters:
string$username
string$domain
string$passwordpublic
Returns:
boolean
Exceptions:
FatalExceptione.g. some required libraries are unavailable

Implemented in BackendZarafa, BackendCombined, BackendIMAP, BackendMaildir, BackendVCardDir, and BackendKolab.

IBackend::MeetingResponse ( requestid,
folderid,
response 
) [inherited]

Processes a response to a meeting request.

CalendarID is a reference and has to be set if a new calendar item is created

Parameters:
string$requestidid of the object containing the request
string$folderidid of the parent folder of $requestid
string$responsepublic
Returns:
string id of the created/updated calendar obj
Exceptions:
StatusException

Implemented in BackendZarafa, BackendCombined, and BackendDiff.

Backend::SaveStorages ( ) [protected]

Saves the permanent and state related storage data of the user and device if they were loaded previousily If the backend storage is used this should be called.

protected

Returns:

Definition at line 261 of file backend.php.

                                      {
        if (isset($this->permanentStorage)) {
            try {
                ZPush::GetDeviceManager()->GetStateManager()->SetBackendStorage($this->permanentStorage, StateManager::BACKENDSTORAGE_PERMANENT);
            }
            catch (StateNotYetAvailableException $snyae) { }
            catch(StateNotFoundException $snfe) { }
        }
        if (isset($this->stateStorage)) {
            try {
                $this->storage_state = ZPush::GetDeviceManager()->GetStateManager()->SetBackendStorage($this->stateStorage, StateManager::BACKENDSTORAGE_STATE);
            }
            catch (StateNotYetAvailableException $snyae) { }
            catch(StateNotFoundException $snfe) { }
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

IBackend::SendMail ( sm) [inherited]

Sends an e-mail This messages needs to be saved into the 'sent items' folder.

Basically two things can be done 1) Send the message to an SMTP server as-is 2) Parse the message, and send it some other way

Parameters:
SyncSendMail$smSyncSendMail object

public

Returns:
boolean
Exceptions:
StatusException

Implemented in BackendZarafa, BackendCombined, BackendIMAP, BackendMaildir, and BackendVCardDir.

Backend::Settings ( settings)

Applies settings to and gets informations from the device.

Parameters:
SyncObject$settings(SyncOOF or SyncUserInformation possible)

public

Returns:
SyncObject $settings

Implements IBackend.

Definition at line 185 of file backend.php.

                                        {
        if ($settings instanceof SyncOOF || $settings instanceof SyncUserInformation)
            $settings->Status = SYNC_SETTINGSSTATUS_SUCCESS;
        return $settings;
    }
IBackend::Setup ( store,
checkACLonly = false,
folderid = false 
) [inherited]

Setup the backend to work on a specific store or checks ACLs there.

If only the $store is submitted, all Import/Export/Fetch/Etc operations should be performed on this store (switch operations store). If the ACL check is enabled, this operation should just indicate the ACL status on the submitted store, without changing the store for operations. For the ACL status, the currently logged on user MUST have access rights on

  • the entire store - admin access if no folderid is sent, or
  • on a specific folderid in the store (secretary/full access rights)

The ACLcheck MUST fail if a folder of the authenticated user is checked!

Parameters:
string$storetarget store, could contain a "domain\user" value
boolean$checkACLonlyif set to true, Setup() should just check ACLs
string$folderidif set, only ACLs on this folderid are relevant

public

Returns:
boolean

Implemented in BackendZarafa, BackendCombined, BackendKolab, and BackendDiff.


Member Data Documentation

Definition at line 59 of file backend.php.

Definition at line 60 of file backend.php.


The documentation for this class was generated from the following file: