CloudPlugs REST Library  1.0.0
for Android
RestClient Class Reference

A com.cloudplugs.rest.RestClient extension for Android. It implements an automatic and transparent mechanism to create an Android service for reliable background execution. The underlying spooler (if any) will automatically be paused and resumed respectively when the Internet connectivity became unavailable and available.
See com.cloudplugs.rest.RestClient for further details about the RestClient usage. More...

Inheritance diagram for RestClient:

Classes

interface  Listener
 A Listener instance will receive the newly created instance of RestClient when passed to create(Context, Listener) method.
 

Public Member Functions

void onReady ()
 
void onStop ()
 
void onEvt (Object evt, Object value)
 
- Public Member Functions inherited from RestClient
 RestClient ()
 
RestManager getManager (Opts opts)
 
boolean isStarted ()
 
boolean pause ()
 
boolean resume ()
 
boolean stop ()
 
void destroy ()
 
boolean waitForStop (long timeout)
 
void waitForStop ()
 
void onStop ()
 
- Public Member Functions inherited from MultiListener
 MultiListener ()
 
boolean hasListener (Listener l)
 
Listener getListener (int location)
 
void addListener (Listener l)
 
boolean removeListener (Listener l)
 
Listener removeListener (int location)
 
void clearListeners ()
 
Listener getListener ()
 
final void setListener (Listener l)
 
void onStart ()
 
void onStop ()
 
void onPause ()
 
void onResume ()
 
void onReady ()
 
void onIdle ()
 
void onEvt (Object evt, Object value)
 
void onErr (Throwable t)
 
- Public Member Functions inherited from MetaListener
 MetaListener ()
 
 MetaListener (Listener l)
 
Listener getListener ()
 
void setListener (Listener l)
 
void onStart ()
 
void onStop ()
 
void onPause ()
 
void onResume ()
 
void onReady ()
 
void onIdle ()
 
void onEvt (Object evt, Object value)
 
void onErr (Throwable t)
 

Static Public Member Functions

static void create (Context context, Listener listener)
 
static Context ctx ()
 

Static Public Attributes

static final String EVT_CONN = RestService.EVT_CONN
 
- Static Public Attributes inherited from RestClient
static final String EVT_START = "start"
 
static final String EVT_STOP = "stop"
 
static final String EVT_PAUSE = "pause"
 
static final String EVT_RESUME = "resume"
 
static final String EVT_IDLE = "idle"
 

Protected Member Functions

 RestClient (Listener listener)
 
- Protected Member Functions inherited from RestClient
 RestClient (Class<? extends RestSpooler > cls)
 

Static Package Functions

 [static initializer]
 

Additional Inherited Members

- Protected Attributes inherited from RestClient
final Map< String, RestSpoolerspoolers = new HashMap<String,RestSpooler>()
 
- Protected Attributes inherited from MetaListener
Listener listener
 

Detailed Description

A com.cloudplugs.rest.RestClient extension for Android. It implements an automatic and transparent mechanism to create an Android service for reliable background execution. The underlying spooler (if any) will automatically be paused and resumed respectively when the Internet connectivity became unavailable and available.
See com.cloudplugs.rest.RestClient for further details about the RestClient usage.

Constructor & Destructor Documentation

◆ RestClient()

RestClient ( Listener  listener)
protected

Member Function Documentation

◆ [static initializer]()

[static initializer] ( )
staticpackage

◆ create()

static void create ( Context  context,
Listener  listener 
)
static

Create asynchronously a new instance of this class so that it will be passed to the given com.cloudplugs.rest.android.RestClient.Listener when ready. This method will automatically create a dedicated Android service (if not already running) for handling the background execution.

Parameters
contextthe Android context in which create the Android service
listenerthe com.cloudplugs.rest.android.RestClient.Listener will receive the instance of this class
Exceptions
NullPointerExceptionif an argument is null

◆ ctx()

static Context ctx ( )
static
Returns
the instance of android.content.Context associated to this instance

◆ onEvt()

void onEvt ( Object  evt,
Object  value 
)

Invoked on generic events.

Implements Listener.

◆ onReady()

void onReady ( )

Invoked when a mechanism is ready to be used.

Implements Listener.

◆ onStop()

void onStop ( )

Invoked when a mechanism is stopped.

Implements Listener.

Member Data Documentation

◆ EVT_CONN

final String EVT_CONN = RestService.EVT_CONN
static

Event String emitted every time the Internet connectivity becomes available.