com.funambol.syncclient.spds.source
Class DummySyncSource

java.lang.Object
  extended by com.funambol.syncclient.spds.source.DummySyncSource
All Implemented Interfaces:
SyncSource

public class DummySyncSource
extends java.lang.Object
implements SyncSource

This class implements a dummy SyncSource that just displays the calls to its methods

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

Constructor Summary
DummySyncSource()
          Creates a new instance of AbstractSyncSource
 
Method Summary
 void beginSync()
           
 void beginSync(int type)
          Called after SyncManager preparation and initialization just before start the synchronization of the SyncSource.
 void commitSync()
          Called just before committing the synchronization process by the SyncManager.
 void endSync()
           
 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 getName()
          Returns the name of the source
 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 getSourceURI()
          Getter for property uri.
 java.lang.String getType()
          Returns the type of the source.
 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.
 void removeSyncItem(java.security.Principal principal, SyncItem syncItem)
          Removes a SyncItem given its key.
 void setName(java.lang.String name)
           
 void setParam1(java.lang.String value)
          Some other initialization parameter
 void setSourceURI(java.lang.String sourceURI)
          Setter for property uri.
 SyncItem setSyncItem(java.security.Principal principal, SyncItem syncItem)
          Replaces an existing SyncItem or adds a new SyncItem if it does not exist.
 void setType(java.lang.String type)
           
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DummySyncSource

public DummySyncSource()
Creates a new instance of AbstractSyncSource

Method Detail

getName

public java.lang.String getName()
Description copied from interface: SyncSource
Returns the name of the source

Specified by:
getName in interface SyncSource
Returns:
the name of the source

setName

public void setName(java.lang.String name)

getType

public java.lang.String getType()
Description copied from interface: SyncSource
Returns the type of the source. The types are defined as mime-types, for instance * text/x-vcard).

Specified by:
getType in interface SyncSource
Returns:
the type of the source

setType

public void setType(java.lang.String type)

getSourceURI

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

Specified by:
getSourceURI in interface SyncSource
Returns:
Value of property uri.

setSourceURI

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

Parameters:
sourceURI - New value of property uri.

setParam1

public void setParam1(java.lang.String value)
Some other initialization parameter


toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object.

beginSync

public void beginSync(int type)
               throws SyncException
Description copied from interface: SyncSource
Called after SyncManager preparation and initialization just before start the synchronization of the SyncSource.

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

endSync

public void endSync()
             throws SyncException
Throws:
SyncException

getAllSyncItems

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

Specified by:
getAllSyncItems in interface SyncSource
Parameters:
principal - not used, always null
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
Description copied from interface: SyncSource
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
Description copied from interface: SyncSource
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 - not used, always null
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
Description copied from interface: SyncSource
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 - not used, always null
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
Description copied from interface: SyncSource
Removes a SyncItem given its key.

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

setSyncItem

public SyncItem setSyncItem(java.security.Principal principal,
                            SyncItem syncItem)
                     throws SyncException
Description copied from interface: SyncSource
Replaces an existing SyncItem or adds a new SyncItem if it does not exist. The item is also returned giving the opportunity to the source to modify its content and return the updated item (i.e. updating the id to the GUID).

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

beginSync

public void beginSync()

commitSync

public void commitSync()
Description copied from interface: SyncSource
Called just before committing the synchronization process by the SyncManager. If an error is detected and

Specified by:
commitSync in interface SyncSource


Copyright © 2010 Funambol. All Rights Reserved.