de.msponer.android.yac.services.impl
Class YConnectionService

java.lang.Object
  extended by android.content.Context
      extended by android.content.ContextWrapper
          extended by android.app.Service
              extended by com.j256.ormlite.android.apptools.OrmLiteBaseService<DatabaseHelper>
                  extended by de.msponer.android.yac.services.impl.YConnectionService
All Implemented Interfaces:
ComponentCallbacks

public class YConnectionService
extends com.j256.ormlite.android.apptools.OrmLiteBaseService<DatabaseHelper>

Android service encapsulating communication processes between YAC and YAWL. Two sync modes are implemented (complete and live).

Author:
msponer

Nested Class Summary
 class YConnectionService.YConnectionServiceBinder
          The connection binder class.
 
Field Summary
static String SYNC_ACTION_ACCEPT_OFFER
          Sync-Action: Accept work item.
static String SYNC_ACTION_COMPLETE
          Sync-Action: Complete work item.
static String SYNC_ACTION_DEALLOCATE
          Sync-Action: Deallocate work item.
static String SYNC_ACTION_PILE
          Sync-Action: Pile work item.
static String SYNC_ACTION_SAVE
          Sync-Action: Save work item.
static String SYNC_ACTION_SKIP
          Sync-Action: Skip work item.
static String SYNC_ACTION_START
          Sync-Action: Start work item.
static String SYNC_ACTION_SUSPEND
          Sync-Action: Suspend work item.
static String SYNC_ACTION_UNSUSPEND
          Sync-Action: Unsuspend work item.
 
Fields inherited from class android.app.Service
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY
 
Fields inherited from class android.content.Context
ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, AUDIO_SERVICE, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_NOT_FOREGROUND, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DROPBOX_SERVICE, INPUT_METHOD_SERVICE, KEYGUARD_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MODE_APPEND, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NOTIFICATION_SERVICE, POWER_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, TELEPHONY_SERVICE, UI_MODE_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_SERVICE, WINDOW_SERVICE
 
Constructor Summary
YConnectionService()
           
 
Method Summary
 boolean areAllInterfacesConnected()
          Returns true if all interfaces are connected.
 void doSync()
          Performs a complete sync between YAC and YAWL.
 String getCurrentRGHandle()
          Returns the current resource gateway handle.
 String getCurrentWQGHandle()
          Returns the current work queue gateway handle.
 org.yawlfoundation.yawl.resourcing.resource.Participant getParticipant()
          Returns the current participant.
 String getPassword()
          Returns the participant's password.
 org.yawlfoundation.yawl.resourcing.rsInterface.ResourceGatewayClient getResourceGateway()
          Returns the resource gateway.
 String getResourceGatewayUrl()
          Returns the resource gateway url.
 String getUsername()
          Returns the participant's username.
 org.yawlfoundation.yawl.resourcing.rsInterface.WorkQueueGatewayClient getWorkQueueGateway()
          Returns the work queue gatway.
 String getWorkQueueGatewayUrl()
          Returns the work queue gateway url.
 boolean isRgConnected()
          true if resource gateway is connected.
 boolean isWqgConnected()
          true if work queue gateway is connected.
 int liveSyncWorkitem(MobileWorkItem wi)
          Performs a live sync for a specified work item.
 IBinder onBind(Intent intent)
           
 void onCreate()
           
 void onDestroy()
           
 void resetDb()
          Resets the DB, all mobile work items are dropped.
 void setParticipant(org.yawlfoundation.yawl.resourcing.resource.Participant participant)
          Sets the current participant.
 void setPassword(String password)
          Sets the participant's password.
 void setResourceGateway(org.yawlfoundation.yawl.resourcing.rsInterface.ResourceGatewayClient resourceGateway)
          Sets the resource gateway.
 void setResourceGatewayUrl(String resourceGatewayUrl)
          Sets the resource gateway url.
 void setRgConnected(boolean rgConnected)
          Sets the resource gateway connection flag.
 void setUsername(String username)
          Sets the participant's username.
 void setWorkQueueGateway(org.yawlfoundation.yawl.resourcing.rsInterface.WorkQueueGatewayClient workQueueGateway)
          Sets the work queue gatway.
 void setWorkQueueGatewayUrl(String workQueueGatewayUrl)
          Sets the work queue gateway url.
 void setWqgConnected(boolean wqgConnected)
          Sets the work queue gateway connection flag.
 void yConnect()
          Initializes the connections to the resource and work queue gateway and passes participant's user credentials.
 void yDisconnect()
          Disconnects the YAWL gateways.
 
Methods inherited from class com.j256.ormlite.android.apptools.OrmLiteBaseService
getConnectionSource, getHelper, getHelperInternal, releaseHelper
 
Methods inherited from class android.app.Service
dump, finalize, getApplication, onConfigurationChanged, onLowMemory, onRebind, onStart, onStartCommand, onUnbind, setForeground, startForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
 
Methods inherited from class android.content.ContextWrapper
attachBaseContext, bindService, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkUriPermission, checkUriPermission, clearWallpaper, createPackageContext, databaseList, deleteDatabase, deleteFile, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getBaseContext, getCacheDir, getClassLoader, getContentResolver, getDatabasePath, getDir, getExternalCacheDir, getExternalFilesDir, getFilesDir, getFileStreamPath, getMainLooper, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isRestricted, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, removeStickyBroadcast, revokeUriPermission, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendStickyBroadcast, sendStickyOrderedBroadcast, setTheme, setWallpaper, setWallpaper, startActivity, startInstrumentation, startIntentSender, startService, stopService, unbindService, unregisterReceiver
 
Methods inherited from class android.content.Context
getString, getString, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYNC_ACTION_ACCEPT_OFFER

public static final String SYNC_ACTION_ACCEPT_OFFER
Sync-Action: Accept work item.

See Also:
Constant Field Values

SYNC_ACTION_DEALLOCATE

public static final String SYNC_ACTION_DEALLOCATE
Sync-Action: Deallocate work item.

See Also:
Constant Field Values

SYNC_ACTION_SKIP

public static final String SYNC_ACTION_SKIP
Sync-Action: Skip work item.

See Also:
Constant Field Values

SYNC_ACTION_PILE

public static final String SYNC_ACTION_PILE
Sync-Action: Pile work item.

See Also:
Constant Field Values

SYNC_ACTION_START

public static final String SYNC_ACTION_START
Sync-Action: Start work item.

See Also:
Constant Field Values

SYNC_ACTION_SAVE

public static final String SYNC_ACTION_SAVE
Sync-Action: Save work item.

See Also:
Constant Field Values

SYNC_ACTION_COMPLETE

public static final String SYNC_ACTION_COMPLETE
Sync-Action: Complete work item.

See Also:
Constant Field Values

SYNC_ACTION_SUSPEND

public static final String SYNC_ACTION_SUSPEND
Sync-Action: Suspend work item.

See Also:
Constant Field Values

SYNC_ACTION_UNSUSPEND

public static final String SYNC_ACTION_UNSUSPEND
Sync-Action: Unsuspend work item.

See Also:
Constant Field Values
Constructor Detail

YConnectionService

public YConnectionService()
Method Detail

onCreate

public void onCreate()
Overrides:
onCreate in class Service

onDestroy

public void onDestroy()
Overrides:
onDestroy in class com.j256.ormlite.android.apptools.OrmLiteBaseService<DatabaseHelper>

onBind

public IBinder onBind(Intent intent)
Specified by:
onBind in class Service

yConnect

public void yConnect()
Initializes the connections to the resource and work queue gateway and passes participant's user credentials.


yDisconnect

public void yDisconnect()
Disconnects the YAWL gateways.


doSync

public void doSync()
Performs a complete sync between YAC and YAWL. 3 phases are proceeded:
1. All modified work items are submitted.
2. The DB is reseted.
3. All work items are fetched.


liveSyncWorkitem

public int liveSyncWorkitem(MobileWorkItem wi)
Performs a live sync for a specified work item. After submitting the modifications the new status is retrieved and db is updated.

Parameters:
wi - The work item to sync.
Returns:
the work-item primary key.

resetDb

public void resetDb()
Resets the DB, all mobile work items are dropped.


setResourceGateway

public void setResourceGateway(org.yawlfoundation.yawl.resourcing.rsInterface.ResourceGatewayClient resourceGateway)
Sets the resource gateway.

Parameters:
resourceGateway - The resource gateway to set.

getResourceGateway

public org.yawlfoundation.yawl.resourcing.rsInterface.ResourceGatewayClient getResourceGateway()
Returns the resource gateway.

Returns:
the resource gateway.

setWorkQueueGateway

public void setWorkQueueGateway(org.yawlfoundation.yawl.resourcing.rsInterface.WorkQueueGatewayClient workQueueGateway)
Sets the work queue gatway.

Parameters:
workQueueGateway - the work queue gatway.

getWorkQueueGateway

public org.yawlfoundation.yawl.resourcing.rsInterface.WorkQueueGatewayClient getWorkQueueGateway()
Returns the work queue gatway.

Returns:
the work queue gatway.

getUsername

public String getUsername()
Returns the participant's username.

Returns:
the participant's username

setUsername

public void setUsername(String username)
Sets the participant's username.

Parameters:
username - the participant's username

getPassword

public String getPassword()
Returns the participant's password.

Returns:
the participant's password

setPassword

public void setPassword(String password)
Sets the participant's password.

Parameters:
password - the participant's password

setResourceGatewayUrl

public void setResourceGatewayUrl(String resourceGatewayUrl)
Sets the resource gateway url.

Parameters:
resourceGatewayUrl - the resource gateway url.

getResourceGatewayUrl

public String getResourceGatewayUrl()
Returns the resource gateway url.

Returns:
the resource gateway url.

setWorkQueueGatewayUrl

public void setWorkQueueGatewayUrl(String workQueueGatewayUrl)
Sets the work queue gateway url.

Parameters:
workQueueGatewayUrl - the work queue gateway url.

getWorkQueueGatewayUrl

public String getWorkQueueGatewayUrl()
Returns the work queue gateway url.

Returns:
the work queue gateway url.

isRgConnected

public boolean isRgConnected()
true if resource gateway is connected.

Returns:
true if resource gateway is connected.

setRgConnected

public void setRgConnected(boolean rgConnected)
Sets the resource gateway connection flag.

Parameters:
rgConnected - the resource gateway connection flag

isWqgConnected

public boolean isWqgConnected()
true if work queue gateway is connected.

Returns:
true if work queue gateway is connected.

setWqgConnected

public void setWqgConnected(boolean wqgConnected)
Sets the work queue gateway connection flag.

Parameters:
wqgConnected - the work queue gateway connection flag

getCurrentRGHandle

public String getCurrentRGHandle()
Returns the current resource gateway handle.

Returns:
the current resource gateway handle

getCurrentWQGHandle

public String getCurrentWQGHandle()
Returns the current work queue gateway handle.

Returns:
the current work queue gateway handle

areAllInterfacesConnected

public boolean areAllInterfacesConnected()
Returns true if all interfaces are connected.

Returns:
true if all interfaces are connected.

setParticipant

public void setParticipant(org.yawlfoundation.yawl.resourcing.resource.Participant participant)
Sets the current participant.

Parameters:
participant - the current participant

getParticipant

public org.yawlfoundation.yawl.resourcing.resource.Participant getParticipant()
Returns the current participant.

Returns:
the current participant