com.sybase.uep.bobclient.data
Class CommonMBOModel

java.lang.Object
  extended by com.sybase.uep.bobclient.data.CommonMBOModel
Direct Known Subclasses:
MBOModel, PKMBOModel

public abstract class CommonMBOModel
extends java.lang.Object

Stores common information of MBO model

Author:
haowang

Field Summary
protected  DatabaseMetaData _databaseMetaData
          DatabaseMetaData of the MYDatabaseMetaData class
protected  AppLoggerWrapper _log
          application Log utility
protected  MBOMobileApplication _mboApp
          MBOMobileApplication
protected  ClassMetaData _metaData
          meta data of the Class that is generated for the MBO application.
static long KEY
           
static int PENDING_OP_SCOPE_MBO
          Pending operation submit scope constant: MBO level
static int PENDING_OP_SCOPE_PACKAGE
          Pending operation submit scope constant: package level
static int PENDING_OP_SCOPE_SYNCGROUP
          Pending operation submit scope constant: synchronization group level, which is the default value is not specified
static int SYNCHRONIZATION_NORMAL
          Normal synchronization type.
static int SYNCHRONIZATION_NOTIFICATION
          SIS synchronization type.
 
Constructor Summary
CommonMBOModel()
           
 
Method Summary
 void addModelChangeListener(IModelChangeListener listener)
          Registers a listener
static void deleteDatabase(java.lang.String packageName)
          Deletes ULJ database file that is used in client
 void fireModelChanged(ModelChangeEvent event)
          Notifies the listeners.
static void fireSyncEvent(java.lang.String packageName, java.lang.String synGroup)
          Fire sync type model change event based on the package name and the sync group
static void fireSyncEvent(java.lang.String packageName, java.util.Vector synGroupList)
          Fire sync type model change event based on the package name and the sync group list
 DataType getDataType(java.lang.String attributeName)
          Get the data type for a specific attribute
 java.lang.String getID()
          Get MBO ID
 java.util.Date getLastSynchronized()
          Get the last time the MBO was synced
static Logger getLogger()
          Get the logger for application trace
static LogRecord[] getLogs(Query q)
          Get application trace logs
 ClassMetaData getMetaData()
          Get MBO meta data
 java.lang.String getName()
          Get MBO name
 java.lang.String getPackageName()
          Gets the package name of the MBO
 java.lang.String getProfileRefID()
          Get the mobile application reference ID
abstract  java.lang.String getSynchronizationGroup()
          Obtains the synchronization group registered by this MBO; Returns null if no synchronization group found
static SynchronizationGroup getSynchronizationGroup(java.lang.String packageName, java.lang.String syncGroup)
          Retrieve the SynchronizationGroup based on the package name and the sync group name
static ConnectionProfile getSynchronizationProfile(java.lang.String packageName)
          Retrieve the synchronization connection profile being used in the current package
static ConnectionProfile getSynchronizationProfile(java.lang.String packageName, java.lang.String clientName)
          Retrieve the synchronization connection profile being used in the current package for Options Module
 int getType()
          Return the type of the mbo model
 java.lang.Object invoke(java.lang.Object mbo, java.lang.String operationName, ObjectList paramValueList)
          Wrapper the invoke method of reflection manager.
 java.lang.Object invoke(java.lang.Object mbo, java.lang.String operationName, java.lang.String[] paramTypeList, ObjectList paramValueList)
          Wrapper the invoke method of reflection manager
abstract  boolean isSynchronized()
          Gets whether this MBO application has been synchronized.
static void loginToSync(java.lang.String packageName, java.lang.String username, java.lang.String password)
          login to sync
static void registerCallbackHandler(java.lang.String packageName, CallbackHandler handler)
          Starts the background synchronization on the synchronization groups.
 void removeModelChangeListener(IModelChangeListener listener)
          Removes a listener
static void startBackgroundSynchronization(java.util.Hashtable packageSyncGroupMap, int syncType)
          Starts the background synchronization on the synchronization groups.
static void startBackgroundSynchronization(java.lang.String packageName, java.util.Vector syncGroupList, int syncType)
          Starts the background synchronization on the synchronization groups.
static void submitPendingOperations(java.lang.String packageName)
           
static void submitPendingOperations(java.lang.String packageName, java.lang.String syncGroup)
          Submits all pending operations
 void synchronize()
          Synchronizes the MBO application.
 void synchronize(SyncStatusListener syncStatusListener)
          Synchronizes the MBO application with a sync status listener
abstract  void synchronize(SyncStatusListener syncStatusListener, int pendingOpScope)
          Synchronizes the MBO application with a sync status listener and pending operation scope
static void syncSyncGroup(java.lang.String packageName, java.lang.String syncGroup, SyncStatusListener syncStatusListener)
          Synchronizes the given synchronization group.
static void syncSyncGroupNoSubmit(java.lang.String packageName, java.lang.String syncGroup, SyncStatusListener syncStatusListener)
          Synchronizes the given synchronization group without submit any pending operations.
static void uploadLogs()
          Upload the logs for application trace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PENDING_OP_SCOPE_PACKAGE

public static final int PENDING_OP_SCOPE_PACKAGE
Pending operation submit scope constant: package level

See Also:
Constant Field Values

PENDING_OP_SCOPE_SYNCGROUP

public static final int PENDING_OP_SCOPE_SYNCGROUP
Pending operation submit scope constant: synchronization group level, which is the default value is not specified

See Also:
Constant Field Values

PENDING_OP_SCOPE_MBO

public static final int PENDING_OP_SCOPE_MBO
Pending operation submit scope constant: MBO level

See Also:
Constant Field Values

_mboApp

protected MBOMobileApplication _mboApp
MBOMobileApplication


_metaData

protected ClassMetaData _metaData
meta data of the Class that is generated for the MBO application. For example, if this MBOModel is created for MBO application "Customer" then the meta data will be an instance of CustomerMetaData


_log

protected AppLoggerWrapper _log
application Log utility


_databaseMetaData

protected DatabaseMetaData _databaseMetaData
DatabaseMetaData of the MYDatabaseMetaData class


KEY

public static final long KEY
See Also:
Constant Field Values

SYNCHRONIZATION_NORMAL

public static final int SYNCHRONIZATION_NORMAL
Normal synchronization type.

See Also:
Constant Field Values

SYNCHRONIZATION_NOTIFICATION

public static final int SYNCHRONIZATION_NOTIFICATION
SIS synchronization type.

See Also:
Constant Field Values
Constructor Detail

CommonMBOModel

public CommonMBOModel()
Method Detail

addModelChangeListener

public void addModelChangeListener(IModelChangeListener listener)
Registers a listener

Parameters:
listener -

getProfileRefID

public java.lang.String getProfileRefID()
Get the mobile application reference ID

Returns:
string value of ID

isSynchronized

public abstract boolean isSynchronized()
Gets whether this MBO application has been synchronized.

Returns:

getSynchronizationGroup

public abstract java.lang.String getSynchronizationGroup()
Obtains the synchronization group registered by this MBO; Returns null if no synchronization group found

Returns:
the synchronization group name

synchronize

public void synchronize()
                 throws java.lang.Exception
Synchronizes the MBO application.

Throws:
NoSuchOperationException - if synchronize() is not defined in corresponding database class.
java.lang.Exception

synchronize

public void synchronize(SyncStatusListener syncStatusListener)
                 throws java.lang.Exception
Synchronizes the MBO application with a sync status listener

Parameters:
syncStatusListener - - Sync status listener
Throws:
NoSuchOperationException - if synchronize( SyncStatusListener ) is not defined in corresponding database class.
java.lang.Exception

synchronize

public abstract void synchronize(SyncStatusListener syncStatusListener,
                                 int pendingOpScope)
                          throws java.lang.Exception
Synchronizes the MBO application with a sync status listener and pending operation scope

Parameters:
syncStatusListener - - Sync status listener
pendingOpScope - - @see PENDING_OP_SCOPE_SYNCGROUP, PENDING_OP_SCOPE_MBO, PENDING_OP_SCOPE_PACKAGE
Throws:
NoSuchOperationException - if synchronize( SyncStatusListener ) is not defined in corresponding database class.
java.lang.Exception

syncSyncGroup

public static void syncSyncGroup(java.lang.String packageName,
                                 java.lang.String syncGroup,
                                 SyncStatusListener syncStatusListener)
                          throws java.lang.Exception
Synchronizes the given synchronization group. Also submits pending operation for the synchronization group.

Parameters:
packageName - - package name of the client application
syncGroup - - synchronization group to sync
syncStatusListener - - sync status listener
Throws:
java.lang.Exception

syncSyncGroupNoSubmit

public static void syncSyncGroupNoSubmit(java.lang.String packageName,
                                         java.lang.String syncGroup,
                                         SyncStatusListener syncStatusListener)
                                  throws java.lang.Exception
Synchronizes the given synchronization group without submit any pending operations. Callers should be responsible to submit pending operations at a proper level.

Parameters:
packageName - - package name of the client application
syncGroup - - syncGroup to sync
syncStatusListener - - sync status listener
pendingOpScope - - @see PENDING_OP_SCOPE_SYNCGROUP, PENDING_OP_SCOPE_MBO, PENDING_OP_SCOPE_PACKAGE
Throws:
java.lang.Exception

fireSyncEvent

public static void fireSyncEvent(java.lang.String packageName,
                                 java.lang.String synGroup)
Fire sync type model change event based on the package name and the sync group

Parameters:
packageName - String value for the package name
synGroup - String value for the sync group name

fireSyncEvent

public static void fireSyncEvent(java.lang.String packageName,
                                 java.util.Vector synGroupList)
Fire sync type model change event based on the package name and the sync group list

Parameters:
packageName - String value for the package name
synGroupList - Vector value for the sync group list

submitPendingOperations

public static void submitPendingOperations(java.lang.String packageName)

submitPendingOperations

public static void submitPendingOperations(java.lang.String packageName,
                                           java.lang.String syncGroup)
Submits all pending operations

Parameters:
packageName - - package name of the profile to sync

getID

public java.lang.String getID()
Get MBO ID

Returns:
String ID of MBO

getName

public java.lang.String getName()
Get MBO name

Returns:
String name of MBO

getMetaData

public ClassMetaData getMetaData()
Get MBO meta data

Returns:
ClassMetaData object

getLastSynchronized

public java.util.Date getLastSynchronized()
Get the last time the MBO was synced

Returns:
Date object of last time MBO was synced

fireModelChanged

public void fireModelChanged(ModelChangeEvent event)
Notifies the listeners. If it is sync event, all listeners to the MBOs that belong to the same synchronization group need to be notified.

Parameters:
event -

removeModelChangeListener

public void removeModelChangeListener(IModelChangeListener listener)
Removes a listener

Parameters:
listener -

getDataType

public DataType getDataType(java.lang.String attributeName)
Get the data type for a specific attribute

Parameters:
attributeName - - name of the attribute
Returns:
DataType object

loginToSync

public static void loginToSync(java.lang.String packageName,
                               java.lang.String username,
                               java.lang.String password)
                        throws java.lang.Exception
login to sync

Parameters:
packageName - - package name of the profile to sync
username - - user name
password - - password
Throws:
NoSuchOperationException - if loginToSync() is not defined in corresponding database class.
java.lang.Exception

getSynchronizationProfile

public static ConnectionProfile getSynchronizationProfile(java.lang.String packageName,
                                                          java.lang.String clientName)
                                                   throws java.lang.Exception
Retrieve the synchronization connection profile being used in the current package for Options Module

Parameters:
packageName - String value for the package name
clientName - String value for the database class name
Returns:
ConnectionProfile object of the synchronization connection profile
Throws:
NoSuchOperationException - if getSynchronizationProfile() is not defined in corresponding database class.
java.lang.Exception

getSynchronizationProfile

public static ConnectionProfile getSynchronizationProfile(java.lang.String packageName)
                                                   throws java.lang.Exception
Retrieve the synchronization connection profile being used in the current package

Parameters:
packageName - String value for the package name
Returns:
ConnectionProfile object of the synchronization connection profile
Throws:
NoSuchOperationException - if getSynchronizationProfile() is not defined in corresponding database class.
java.lang.Exception

getSynchronizationGroup

public static SynchronizationGroup getSynchronizationGroup(java.lang.String packageName,
                                                           java.lang.String syncGroup)
                                                    throws java.lang.Exception
Retrieve the SynchronizationGroup based on the package name and the sync group name

Parameters:
packageName - String value for the package name
syncGroup - String value for the sync group
Returns:
SynchronizationGroup object of the SynchronizationGroup
Throws:
NoSuchOperationException - if getSynchronizationGroup() is not defined in corresponding database class.
java.lang.Exception

invoke

public java.lang.Object invoke(java.lang.Object mbo,
                               java.lang.String operationName,
                               java.lang.String[] paramTypeList,
                               ObjectList paramValueList)
Wrapper the invoke method of reflection manager

Parameters:
mbo -
operationName -
paramTypeList -
paramValueList -
Returns:

invoke

public java.lang.Object invoke(java.lang.Object mbo,
                               java.lang.String operationName,
                               ObjectList paramValueList)
Wrapper the invoke method of reflection manager. The difference with invoke(Object mbo, String operationName, String[] paramTypeList, ObjectList paramValueList)is that it doesn't require the data types. Object API can do this because there will be an restriction that there won't duplicate operation name in one MBO

Parameters:
mbo -
operationName -
paramValueList -
Returns:

getType

public int getType()
Return the type of the mbo model

Returns:

startBackgroundSynchronization

public static void startBackgroundSynchronization(java.lang.String packageName,
                                                  java.util.Vector syncGroupList,
                                                  int syncType)
                                           throws java.lang.Exception
Starts the background synchronization on the synchronization groups.

Parameters:
packageName - String value for the package name
syncGroupList - Vector value for the sync group list
syncType - value for the sync type
Throws:
NoSuchOperationException - if startBackgroundSynchronization() is not defined in corresponding database class.
java.lang.Exception

startBackgroundSynchronization

public static void startBackgroundSynchronization(java.util.Hashtable packageSyncGroupMap,
                                                  int syncType)
                                           throws java.lang.Exception
Starts the background synchronization on the synchronization groups.

Parameters:
packageName - String value for the package name
syncGroupList - Vector value for the sync group list
syncType - value for the sync type
Throws:
NoSuchOperationException - if startBackgroundSynchronization() is not defined in corresponding database class.
java.lang.Exception

registerCallbackHandler

public static void registerCallbackHandler(java.lang.String packageName,
                                           CallbackHandler handler)
                                    throws java.lang.Exception
Starts the background synchronization on the synchronization groups.

Parameters:
packageName - String value for the package name
syncGroupList - Vector value for the sync group list
Throws:
NoSuchOperationException - if startBackgroundSynchronization() is not defined in corresponding database class.
java.lang.Exception

getLogger

public static Logger getLogger()
Get the logger for application trace


uploadLogs

public static void uploadLogs()
Upload the logs for application trace


getLogs

public static LogRecord[] getLogs(Query q)
Get application trace logs

Parameters:
q - - query object
Returns:
LogRecord[] - list of LogRecord objects

deleteDatabase

public static void deleteDatabase(java.lang.String packageName)
                           throws java.lang.Exception
Deletes ULJ database file that is used in client

Parameters:
packageName -
Throws:
java.lang.Exception

getPackageName

public java.lang.String getPackageName()
Gets the package name of the MBO

Returns: