com.ibm.mobileservices.isync.event
Class ISyncEvent

java.lang.Object
  |
  +--com.ibm.mobileservices.isync.event.ISyncEvent

public class ISyncEvent
extends java.lang.Object

ISyncEvent is used to pass information from the synchronization engine to the implementor of ISyncListener via its eventIssued() method, and also from the client application to the synchronization engine.

The ISyncEvent object is valid only in the scope of the eventIssued method. After eventIssued returns, the ISyncEvent object will be invalidated.

A list of event types and its associated event code that the listener is being notified of are listed below:

  • EVTTYPE_CONFLICT - Data conflicts in synchronization.


    Please see the ISyncDriver specific implementation documentation for details as to what EVT_ codes and EVTTYPE_s are supported.

    See Also:
    ISyncListener

    Constructor Summary
    ISyncEvent(com.ibm.mobileservices.isync.ISyncDriver source, int eventType, int eventCode, java.lang.String subssetName, java.lang.String subsName, int subsType, int retries, int progress, java.lang.Object eventInfo)
              Class constructor.
     
    Method Summary
     int getEventCode()
              Returns the event code(EVT_*) for this event.
     java.lang.Object getEventInfo()
              Gets specific information based on the event code.
     int getEventType()
              Gets the event type(EVTTYPE_*) for this event.
     int getNumberOfRetries()
              Gets the number of retries performed so far by the ISyncDriver.
     com.ibm.mobileservices.isync.ISyncDriver getSource()
              Gets the event source.
     java.lang.String getSubscriptionName()
              Gets the name of the subscription that is currently being synchronized.
     java.lang.String getSubscriptionSetName()
              Gets the name of the subscription set that is currently being synchronized.
     int getSubscriptionType()
              Gets the subscription type(SUBSTYPE_*); see ISync.java for valid ranges.
     int getSyncProgress()
              Gets current sync progress; -1 indicates progress has not been set.
     void setEventValues(com.ibm.mobileservices.isync.ISyncDriver source, int eventType, int eventCode, java.lang.String subssetName, java.lang.String subsName, int subsType, int retries, int progress, java.lang.Object eventInfo)
              Sets the state of the event.
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    ISyncEvent

    public ISyncEvent(com.ibm.mobileservices.isync.ISyncDriver source,
                      int eventType,
                      int eventCode,
                      java.lang.String subssetName,
                      java.lang.String subsName,
                      int subsType,
                      int retries,
                      int progress,
                      java.lang.Object eventInfo)
    Class constructor.

    Parameters:
    source - an ISyncDriver object
    eventType - an int specifying event type
    eventCode - an int specifying event code
    subssetName - a String specifying subscription set name
    subsName - a String specifying subscription name
    subsType - an int specifying subscription type
    retries - an int specifying the number of retries
    progress - an int specifying the synchronization progress
    eventInfo - an Object supplying other information about the event
    Method Detail

    setEventValues

    public void setEventValues(com.ibm.mobileservices.isync.ISyncDriver source,
                               int eventType,
                               int eventCode,
                               java.lang.String subssetName,
                               java.lang.String subsName,
                               int subsType,
                               int retries,
                               int progress,
                               java.lang.Object eventInfo)
    Sets the state of the event.

    Parameters:
    source - an ISyncDriver object
    eventType - an int specifying event type
    eventCode - an int specifying event code
    subssetName - a String specifying subscription set name
    subsName - a String specifying subscription name
    subsType - an int specifying subscription type
    retries - an int specifying the number of retries
    progress - an int specifying the synchronization progress
    eventInfo - an Object supplying other information about the event

    getSource

    public com.ibm.mobileservices.isync.ISyncDriver getSource()
    Gets the event source.

    Returns:
    the source which generated the event.

    getEventCode

    public int getEventCode()
    Returns the event code(EVT_*) for this event. See ISyncEvent class documentation for event types and each event type's associated event codes for details. Event codes are defined in ISync class.

    Returns:
    an int specifying the event code.

    getEventType

    public int getEventType()
    Gets the event type(EVTTYPE_*) for this event. See ISyncEvent class documentation for event types and each event type's associated event codes for details. Event codes are defined in ISync class.

    Returns:
    • EVTTYPE_INFO
    • EVTTYPE_RETRY
    • EVTTYPE_ERROR
    • EVTTYPE_QUERY
    • EVTTYPE_CONFLICT

    getSubscriptionSetName

    public java.lang.String getSubscriptionSetName()
    Gets the name of the subscription set that is currently being synchronized.

    Returns:
    subscription set name.

    getSubscriptionName

    public java.lang.String getSubscriptionName()
    Gets the name of the subscription that is currently being synchronized.

    Returns:
    subscription name.

    getSubscriptionType

    public int getSubscriptionType()
    Gets the subscription type(SUBSTYPE_*); see ISync.java for valid ranges.

    Returns:
    subscription type

    getNumberOfRetries

    public int getNumberOfRetries()
    Gets the number of retries performed so far by the ISyncDriver.

    Returns:
    number of retries

    getSyncProgress

    public int getSyncProgress()
    Gets current sync progress; -1 indicates progress has not been set.

    Returns:
    an int specifying synchronization progress in percentage

    getEventInfo

    public java.lang.Object getEventInfo()
    Gets specific information based on the event code.

    EVENT CODE EVENT INFO OBJECT DESCRIPTION
    ISync.EVT_CFT_REJECT ISync Provider implementation dependent Data conflicts in synchronization EventInfo object; keeps the actual conflicting data
    ISync.EVT_QUE_LOGIN Java array of String objects:
    User creates String objects below and sets the String
    references to the array in the following order:
    [out] arr[0]: Target name of data source
    [in] arr[1]: User name
    [in] arr[2]: Password
    Login information requested by an adapter.  The listener should provide the requested info in the EventInfo and return ISync.RTNCB_DONE
    ISync.EVT_ERR_NOT_FOUND Java array of String objects:
    [out] arr[0]:  Target name of data source
    [out] arr[1]:  Data name
    Requested data not found
    ISync.EVT_ERR_READ_ONLY Java array of String objects:
    [out] arr[0]:  Target name of data source
    [out] arr[1]:  Data name
    Attempt to update read-only data
    ISync.EVT_ERR_NOT_AVAIL Java array of String objects:
    [out] arr[0]:  Target name of data source
    [out] arr[1]:  Data name
    Requested data not available
    ISync. EVT_ERR_DATA_TOO_LONG Java array of String objects:
    [out] arr[0]:  Target name of data source
    [out] arr[1]:  Data name
    [out] arr[2]:  Data element name (if not empty)
    Data too long and truncated

    Returns:
    an Object with additional information depending on the event code


    (c) Copyright IBM Corp. 2001, 2002, 2003. All Rights Reserved.