de.unikassel.android.sdcframework.service
Class TimeProviderOutOfSyncIgnoreStrategy

Package class diagram package TimeProviderOutOfSyncIgnoreStrategy
java.lang.Object
  extended by de.unikassel.android.sdcframework.util.AbstractTimeProviderErrorStrategy
      extended by de.unikassel.android.sdcframework.service.TimeProviderOutOfSyncIgnoreStrategy
All Implemented Interfaces:
EventObserver<NetworkStateChangeEvent>, TimeProviderErrorStrategy

public class TimeProviderOutOfSyncIgnoreStrategy
extends AbstractTimeProviderErrorStrategy
implements EventObserver<NetworkStateChangeEvent>

Simple ignore strategy in case of time provider synchronization errors.


Field Summary
private  ObservableAlarm alarm
          The alarm for retry attempts.
private  EventObserver<AlarmEvent> alarmObserver
          The alarm observer to delegate to.
private  NetworkConnectionObserver connectionObserver
          The network connection observer
private  ServiceManager manager
          The service manager.
private static long RETRY_SYNC_OFFSET
          The time offset for synchronization retries.
private  boolean timeSyncStateDeviceWasEnabeled
          The flag is the time sync state device was enabled or not.
 
Constructor Summary
TimeProviderOutOfSyncIgnoreStrategy(ServiceManager manager)
          Constructor
 
Method Summary
 void finalize(Context context)
          Does finalize the strategy.
 boolean handleTimeErrorEvent(TimeErrorEvent event, ServiceManager serviceManager)
          Handler for error events (e.g.
 void onEvent(ObservableEventSource<? extends NetworkStateChangeEvent> eventSource, NetworkStateChangeEvent observedEvent)
          This method is called whenever the observed object does create an observed event
 void prepare(Context context)
          Does prepare the strategy.
protected  void startSyncProcess()
          Method to trigger a synchronization process
 
Methods inherited from class de.unikassel.android.sdcframework.util.AbstractTimeProviderErrorStrategy
getDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RETRY_SYNC_OFFSET

private static final long RETRY_SYNC_OFFSET
The time offset for synchronization retries.

See Also:
Constant Field Values

alarm

private final ObservableAlarm alarm
The alarm for retry attempts.


alarmObserver

private final EventObserver<AlarmEvent> alarmObserver
The alarm observer to delegate to.


manager

private final ServiceManager manager
The service manager.


timeSyncStateDeviceWasEnabeled

private boolean timeSyncStateDeviceWasEnabeled
The flag is the time sync state device was enabled or not.


connectionObserver

private final NetworkConnectionObserver connectionObserver
The network connection observer

Constructor Detail

TimeProviderOutOfSyncIgnoreStrategy

public TimeProviderOutOfSyncIgnoreStrategy(ServiceManager manager)
Constructor

Parameters:
manager - the service manager
Method Detail

handleTimeErrorEvent

public final boolean handleTimeErrorEvent(TimeErrorEvent event,
                                          ServiceManager serviceManager)
Description copied from interface: TimeProviderErrorStrategy
Handler for error events (e.g. time provider out of sync)

Specified by:
handleTimeErrorEvent in interface TimeProviderErrorStrategy
Parameters:
event - the error event
serviceManager - the service manager
Returns:
true if the error was handled properly, false otherwise

prepare

public final void prepare(Context context)
Description copied from interface: TimeProviderErrorStrategy
Does prepare the strategy.

Specified by:
prepare in interface TimeProviderErrorStrategy
Parameters:
context - the application context

finalize

public final void finalize(Context context)
Description copied from interface: TimeProviderErrorStrategy
Does finalize the strategy.

Specified by:
finalize in interface TimeProviderErrorStrategy
Parameters:
context - the application context

onEvent

public void onEvent(ObservableEventSource<? extends NetworkStateChangeEvent> eventSource,
                    NetworkStateChangeEvent observedEvent)
Description copied from interface: EventObserver
This method is called whenever the observed object does create an observed event

Specified by:
onEvent in interface EventObserver<NetworkStateChangeEvent>
Parameters:
eventSource - the event generator
observedEvent - the event created by the observed object

startSyncProcess

protected void startSyncProcess()
Method to trigger a synchronization process