|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.synchronization.SyncItem
public abstract class SyncItem
Provides an implementation of SyncCollection
to provide small objects
with easy access to the Synchronization API.
This class is used to provide backup/restore functionality to small bits
of information, typically configuration options.
Implementers should extend this object and implement the abstract functions:
SyncItem.getSyncName()
SyncItem.getSyncName(Locale locale)
SyncItem.getSyncVersion()
SyncItem.getSyncData(DataBuffer buffer, int version)
SyncItem.setSyncData(DataBuffer buffer, int version)
SyncCollection
,
SyncManager.enableSynchronization(net.rim.device.api.synchronization.SyncCollection)
,
SyncConverter
,
SyncObject
Constructor Summary | ||
---|---|---|
|
protected |
SyncItem()
|
Method Summary | ||
---|---|---|
|
boolean |
addSyncObject(SyncObject object)
Adds a SyncObject to this SyncCollection . |
|
void |
beginTransaction()
Starts a transaction. |
|
void |
clearSyncObjectDirty(SyncObject object)
Marks the specified SyncObject as not dirty. |
|
boolean |
convert(SyncObject object,
DataBuffer buffer,
int version)
Converts a SyncObject into synchronization data. |
|
SyncObject |
convert(DataBuffer data,
int version,
int uid)
Extracts a SyncObject from the synchronization data. |
|
void |
endTransaction()
Ends a transaction. |
|
SyncConverter |
getSyncConverter()
Returns the synchronization message converter ( SyncConverter )
for this SyncCollection . |
|
abstract boolean |
getSyncData(DataBuffer buffer,
int version)
Gets the data of this object for use in synchronization. |
|
abstract String |
getSyncName()
Returns the name of this SyncCollection . |
|
abstract String |
getSyncName(Locale locale)
|
|
SyncObject |
getSyncObject(int uid)
Return the SyncObject in this SyncCollection
with the given UID. |
|
int |
getSyncObjectCount()
Returns a the number of SyncObjects in this SyncCollection . |
|
SyncObject[] |
getSyncObjects()
Returns an array of SyncObjects representing all
SyncObjects in this SyncCollection . |
|
abstract int |
getSyncVersion()
Returns the current version number of this SyncCollection . |
|
int |
getUID()
Returns the unique ID stored in this SyncObject . |
|
boolean |
isSyncObjectDirty(SyncObject object)
Determines whether a specified SyncObject is dirty. |
|
boolean |
removeAllSyncObjects()
Called to remove all SyncObjects from the SyncCollection . |
|
boolean |
removeSyncObject(SyncObject object)
Removes a SyncObject from this SyncCollection . |
|
abstract boolean |
setSyncData(DataBuffer buffer,
int version)
Sets the data of this object from the data received through synchronization. |
|
void |
setSyncObjectDirty(SyncObject object)
Marks the specified SyncObject as dirty. |
|
boolean |
updateSyncObject(SyncObject oldObject,
SyncObject newObject)
Updates a SyncObject in this SyncCollection . |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.rim.device.api.synchronization.SyncCollection |
---|
getSyncName |
Constructor Detail |
---|
protected SyncItem()
Method Detail |
---|
public abstract boolean setSyncData(DataBuffer buffer, int version)
buffer
- The data received through synchronization.version
- The version number specified with the data.
true
if the operation was successful;
false
otherwise.public abstract boolean getSyncData(DataBuffer buffer, int version)
buffer
- The DataBuffer into which the data should be placed.version
- The version of the information to be provided.
true
if the operation was successful;
false
otherwise.public int getUID()
SyncObject
SyncObject
.
getUID
in interface SyncObject
SyncObject.getUID()
public boolean convert(SyncObject object, DataBuffer buffer, int version)
SyncConverter
SyncObject
into synchronization data.
convert
in interface SyncConverter
object
- The SyncObject
to be converted.buffer
- The buffer into which the data will be placed.
This buffer should not be rewound as it may already contain
other data.version
- The version number specified with the data.
true
if the object was converted successfully;
false
otherwise.SyncConverter.convert( SyncObject, DataBuffer, int )
public SyncObject convert(DataBuffer data, int version, int uid)
SyncConverter
SyncObject
from the synchronization data.
convert
in interface SyncConverter
data
- The DataBuffer
containing only the synchronization data.
This buffer may be rewound as it will contain only the data
associated with the SyncObject
in question.version
- The version number specified with the data.
SyncObject
obtained from the synchronization data,
or null
if this conversion was unsuccessful.SyncConverter.convert( DataBuffer, int, int )
public abstract int getSyncVersion()
SyncCollection
SyncCollection
.
getSyncVersion
in interface SyncCollection
SyncCollection
.SyncCollection.getSyncVersion()
public abstract String getSyncName()
SyncCollection
SyncCollection
.
NOTE: The name that is returned must be unique across all
SyncCollections and should never be localized.
getSyncName
in interface SyncCollection
SyncCollection
.SyncCollection.getSyncName()
public abstract String getSyncName(Locale locale)
SyncCollection.getSyncName()
public boolean addSyncObject(SyncObject object)
SyncCollection
SyncObject
to this SyncCollection
.
The SyncObject's
dirty bit is set to clean by default.
addSyncObject
in interface SyncCollection
object
- The SyncObject
to be added to the collection.
true
if the operation was successful;
false
otherwise.SyncCollection.addSyncObject(net.rim.device.api.synchronization.SyncObject)
public boolean updateSyncObject(SyncObject oldObject, SyncObject newObject)
SyncCollection
SyncObject
in this SyncCollection
.
The method accepts the old object to be replaced as well as the new
object that will replace it in the collection.
The SyncObject
should subsequently be marked clean.
updateSyncObject
in interface SyncCollection
oldObject
- The object to be updated.
true
if the operation was successful;
false
otherwise.SyncCollection.updateSyncObject(net.rim.device.api.synchronization.SyncObject, net.rim.device.api.synchronization.SyncObject)
public boolean removeSyncObject(SyncObject object)
SyncCollection
SyncObject
from this SyncCollection
.
removeSyncObject
in interface SyncCollection
object
- The object to be removed.
true
if the operation was successful;
false
otherwise.SyncCollection.removeSyncObject(net.rim.device.api.synchronization.SyncObject)
public boolean removeAllSyncObjects()
SyncCollection
SyncObjects
from the SyncCollection
.
removeAllSyncObjects
in interface SyncCollection
true
if the update succeeded;
false
otherwise.SyncCollection.removeAllSyncObjects()
public SyncObject[] getSyncObjects()
SyncCollection
SyncObjects
representing all
SyncObjects
in this SyncCollection
.
The synchronization manager assumes that it is free to manipulate this array as it requires.
getSyncObjects
in interface SyncCollection
SyncObjects
in this SyncCollection
.SyncCollection.getSyncObjects()
public SyncObject getSyncObject(int uid)
SyncCollection
SyncObject
in this SyncCollection
with the given UID.
getSyncObject
in interface SyncCollection
uid
- The UID of the SyncObject
to retrieve.
SyncObject
with the given ID or null if no
such SyncObject
exists.SyncCollection.getSyncObject(int)
public boolean isSyncObjectDirty(SyncObject object)
SyncCollection
SyncObject
is dirty.
"Dirty" refers to whether or not the object has been modified on the handheld.
isSyncObjectDirty
in interface SyncCollection
object
- The object in question.
true
if the SyncObject is dirty;
false
otherwise.SyncCollection.isSyncObjectDirty(net.rim.device.api.synchronization.SyncObject)
public void setSyncObjectDirty(SyncObject object)
SyncCollection
SyncObject
as dirty.
"Dirty" refers to whether or not the object has been modified on the handheld.
setSyncObjectDirty
in interface SyncCollection
object
- The SyncObject
in question.SyncCollection.setSyncObjectDirty(net.rim.device.api.synchronization.SyncObject)
public void clearSyncObjectDirty(SyncObject object)
SyncCollection
SyncObject
as not dirty.
"Dirty" refers to whether or not the object has been modified on the handheld.
clearSyncObjectDirty
in interface SyncCollection
object
- The SyncObject
in question.SyncCollection.clearSyncObjectDirty(net.rim.device.api.synchronization.SyncObject)
public int getSyncObjectCount()
SyncCollection
SyncObjects
in this SyncCollection
.
getSyncObjectCount
in interface SyncCollection
SyncObjects
in this SyncCollection
.SyncCollection.getSyncObjectCount()
public SyncConverter getSyncConverter()
SyncCollection
SyncConverter
)
for this SyncCollection
.
A SyncConverter
serializes SyncObjects
and
processes serialized data to create SyncObjects
.
getSyncConverter
in interface SyncCollection
SyncCollection.getSyncConverter()
public void beginTransaction()
SyncCollection
Transactions are required to execute synchronizations that involve a
large number of data records. The beginTransaction
method
is invoked by the SyncManager
before adding, modifying
or deleting a data record serially.
beginTransaction
in interface SyncCollection
SyncCollection.beginTransaction()
public void endTransaction()
SyncCollection
Transactions are required to execute synchronizations that involve a
large number of data records. The endTransaction
method is
invoked to signal the end of the transaction.
endTransaction
in interface SyncCollection
SyncCollection.endTransaction()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.