com.funambol.syncclient.spap
Class AssetSyncSource

java.lang.Object
  extended by com.funambol.syncclient.spap.AssetSyncSource
All Implemented Interfaces:
SyncSource

public class AssetSyncSource
extends java.lang.Object
implements SyncSource

This class implements a SyncSource that handle the Asset store on a device.

Retrieves the list of the Assets and their state using the AssetDAO that manages the memorization of the Assets using the Device Management as database.

This SyncSource maps a Asset into properties of the corresponding SyncItem.

A asset has transformed in XML using the com.funambol.syncclient.framework.provisioning.XMLHashMapParser class and the xml as gotten is store in the property SyncItem.PROPERTY_BINARY_CONTENT.

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

Constructor Summary
AssetSyncSource()
          Constructs a AssetSyncSource
 
Method Summary
 void beginSync()
           
 void beginSync(int syncMode)
          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.
 SyncItem[] getAllSyncItems(java.security.Principal principal)
          Returns a list of the assets except those with state 'D'
 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 property name
 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()
          Returns property sourceURI
 java.lang.String getType()
          Returns property type
 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 Asset given its key.
 void setName(java.lang.String name)
          Sets property name
 void setSourceURI(java.lang.String sourceURI)
          Sets property sourceURI
 SyncItem setSyncItem(java.security.Principal principal, SyncItem syncItem)
          Replaces an existing Asset or adds a new Asset if it does not exist.
 void setType(java.lang.String type)
          Sets property type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssetSyncSource

public AssetSyncSource()
Constructs a AssetSyncSource

Method Detail

setSourceURI

public void setSourceURI(java.lang.String sourceURI)
Sets property sourceURI

Parameters:
sourceURI - description: uri of the SyncSource displayName: sourceURI

getSourceURI

public java.lang.String getSourceURI()
Returns property sourceURI

Specified by:
getSourceURI in interface SyncSource
Returns:
the absolute URI of the source

setType

public void setType(java.lang.String type)
Sets property type

Parameters:
type - description: type of the SyncSource displayName: type

getType

public java.lang.String getType()
Returns property type

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

setName

public void setName(java.lang.String name)
Sets property name

Parameters:
name - description: name of the SyncSource displayName: name

getName

public java.lang.String getName()
Returns property name

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

getAllSyncItems

public SyncItem[] getAllSyncItems(java.security.Principal principal)
Returns a list of the assets except those with state 'D'

Specified by:
getAllSyncItems in interface SyncSource
Parameters:
principal - the principal for which the data has to be considered.
Returns:
an array of all SyncItems stored in this source. If there are no items an empty array is returned.

getDeletedSyncItems

public SyncItem[] getDeletedSyncItems(java.security.Principal principal,
                                      java.util.Date since)
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 -
since -
Returns:
deleted syncItems

getNewSyncItems

public SyncItem[] getNewSyncItems(java.security.Principal principal,
                                  java.util.Date since)
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 -
since -
Returns:
new syncItems

getUpdatedSyncItems

public SyncItem[] getUpdatedSyncItems(java.security.Principal principal,
                                      java.util.Date since)
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 -
since -
Returns:
update syncItems

setSyncItem

public SyncItem setSyncItem(java.security.Principal principal,
                            SyncItem syncItem)
                     throws SyncException
Replaces an existing Asset or adds a new Asset if it does not exist. The contained version is save as newVersion.

Specified by:
setSyncItem in interface SyncSource
Parameters:
principal -
syncItem -
Returns:
syncItem
Throws:
SyncException

removeSyncItem

public void removeSyncItem(java.security.Principal principal,
                           SyncItem syncItem)
                    throws SyncException
Removes a Asset 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

beginSync

public void beginSync(int syncMode)
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:
syncMode - the synchronization type: one of the values in sync4j.framework.core.AlertCode

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.