com.funambol.syncclient.spds.engine.recovery
Class AbstractRecovery

java.lang.Object
  extended by com.funambol.syncclient.spds.engine.recovery.AbstractRecovery
All Implemented Interfaces:
SyncSource

public abstract class AbstractRecovery
extends java.lang.Object
implements SyncSource

This class defines recovery method to manage recovery database in slowsync status. From server reads those parameters:

    <recovery-details>
      <source-list>value</source-list>
      <last>value</last>
      <uri>value</uri>
    </recovery-details>
 

Version:
$Id: AbstractRecovery.java,v 1.3 2007-12-22 18:09:17 nichele Exp $

Field Summary
protected  java.lang.String last
           
protected  java.lang.String sourceList
           
protected  java.lang.String uri
           
 
Constructor Summary
AbstractRecovery()
           
 
Method Summary
 void beginSync(int syncMode)
          Method implements start sync operations
 void commitSync()
          Method implements end sync operations
 SyncItem[] getAllSyncItems(java.security.Principal principal)
          Returns all items in the data store belonging to the given principal.
 SyncItem[] getDeletedSyncItems(java.security.Principal principal, java.util.Date since)
          Returns all deleted items belonging to the given principal and deleted after the given point in time.
 java.lang.String getLast()
          Getter for property last.
 SyncItem[] getNewSyncItems(java.security.Principal principal, java.util.Date since)
          Returns all new items belonging to the given principal and created after the given point in time.
 java.lang.String getSourceList()
          Getter for property sourceList.
 SyncItem[] getUpdatedSyncItems(java.security.Principal principal, java.util.Date since)
          Returns all updated items belonging to the given principal and modified after the given point in time.
 java.lang.String getUri()
          Getter for property uri.
abstract  void recovery(java.security.Principal p)
          This method manage recovery database in slowsync status
 void removeSyncItem(java.security.Principal principal, SyncItem syncItem)
          Removes a SyncItem given its key.
 void setLast(java.lang.String last)
          Setter for property last.
 void setSourceList(java.lang.String sourceList)
          Setter for property sourceList.
 SyncItem setSyncItem(java.security.Principal principal, SyncItem syncItem)
          Replaces an existing SyncItem or adds a new SyncItem if it does not exist.
 void setUri(java.lang.String uri)
          Setter for property uri.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.funambol.syncclient.spds.engine.SyncSource
getName, getSourceURI, getType
 

Field Detail

sourceList

protected java.lang.String sourceList

last

protected java.lang.String last

uri

protected java.lang.String uri
Constructor Detail

AbstractRecovery

public AbstractRecovery()
Method Detail

getSourceList

public java.lang.String getSourceList()
Getter for property sourceList.

Returns:
Value of property sourceList.

setSourceList

public void setSourceList(java.lang.String sourceList)
Setter for property sourceList.

Parameters:
sourceList - New value of property sourceList.

getLast

public java.lang.String getLast()
Getter for property last.

Returns:
Value of property last.

setLast

public void setLast(java.lang.String last)
Setter for property last.

Parameters:
last - New value of property last.

getUri

public java.lang.String getUri()
Getter for property uri.

Returns:
Value of property uri.

setUri

public void setUri(java.lang.String uri)
Setter for property uri.

Parameters:
uri - New value of property uri.

recovery

public abstract void recovery(java.security.Principal p)
This method manage recovery database in slowsync status

Parameters:
p - Principal

getAllSyncItems

public SyncItem[] getAllSyncItems(java.security.Principal principal)
                           throws SyncException
Returns all items in the data store belonging to the given principal.

Specified by:
getAllSyncItems in interface SyncSource
Parameters:
principal - the principal for which the data has to be considered Null means all principals
Returns:
an array of all SyncItems stored in this source. If there are no items an empty array is returned.
Throws:
SyncException - in case of error (for instance if the underlying data store runs into problems)

getDeletedSyncItems

public SyncItem[] getDeletedSyncItems(java.security.Principal principal,
                                      java.util.Date since)
                               throws SyncException
Returns all deleted items belonging to the given principal and deleted after the given point in time.

Specified by:
getDeletedSyncItems in interface SyncSource
Parameters:
principal - the principal for which the data has to be considered Null means all principals
since - consider the changes since this point in time. Null means all items regardless when they were changed.
Returns:
an array of keys containing the SyncItem's key of the deleted items after the last synchronizazion. If there are no deleted items an empty array is returned.
Throws:
SyncException - in case of error (for instance if the underlying data store runs into problems)

getNewSyncItems

public SyncItem[] getNewSyncItems(java.security.Principal principal,
                                  java.util.Date since)
                           throws SyncException
Returns all new items belonging to the given principal and created after the given point in time.

Specified by:
getNewSyncItems in interface SyncSource
Parameters:
principal - the principal for which the data has to be considered Null means all principals
since - consider the changes since this point in . Null means all items regardless when they were changed.
Returns:
an array of items containing representing the newly created items. If there are no new items an empty array MUST BE returned.
Throws:
SyncException - in case of error (for instance if the underlying data store runs into problems)

getUpdatedSyncItems

public SyncItem[] getUpdatedSyncItems(java.security.Principal principal,
                                      java.util.Date since)
                               throws SyncException
Returns all updated items belonging to the given principal and modified after the given point in time.

Specified by:
getUpdatedSyncItems in interface SyncSource
Parameters:
principal - the principal for which the data has to be considered Null means all principals
since - consider the changes since this point in time. Null means all items regardless when they were changed.
Returns:
an array of keys containing the SyncItem's key of the updated items after the last synchronizazion. It MUST NOT return null for no keys, but instad an empty array.
Throws:
SyncException

removeSyncItem

public void removeSyncItem(java.security.Principal principal,
                           SyncItem syncItem)
                    throws SyncException
Removes a SyncItem given its key.

Specified by:
removeSyncItem in interface SyncSource
Parameters:
principal - the entity that wants to do the operation
syncItem - the item to remove
Throws:
SyncException - in case of error (for instance if the underlying data store runs into problems)

beginSync

public void beginSync(int syncMode)
               throws SyncException
Method implements start sync operations

Specified by:
beginSync in interface SyncSource
Parameters:
syncMode - the synchronization type: one of the values in sync4j.framework.core.AlertCode
Throws:
SyncException - in case of error. This will stop the sync process

commitSync

public void commitSync()
                throws SyncException
Method implements end sync operations

Specified by:
commitSync in interface SyncSource
Throws:
SyncException

setSyncItem

public SyncItem setSyncItem(java.security.Principal principal,
                            SyncItem syncItem)
                     throws SyncException
Replaces an existing SyncItem or adds a new SyncItem if it does not exist.

Specified by:
setSyncItem in interface SyncSource
Parameters:
principal - not used, always null
syncItem - the item to replace/add
Returns:
the inserted
Throws:
SyncException - in case of error (for instance if the underlying data store runs into problems)


Copyright © 2010 Funambol. All Rights Reserved.