AeroGear Android Libary 1.0.0.M1

org.jboss.aerogear.android.pipeline
Interface Pipe<T>

Type Parameters:
T - The data type of the Pipe operation
All Known Implementing Classes:
RestAdapter

public interface Pipe<T>

A Pipe represents a server connection. An object of this class is responsible to communicate with the server in order to perform read/write operations.


Method Summary
 PipeType getType()
          Returns the connection type of this Pipe object (e.g.
 URL getUrl()
          Returns the URL to which this Pipe object points.
 void read(Callback<List<T>> callback)
          Reads all the data from the underlying server connection.
 void readWithFilter(ReadFilter filter, Callback<List<T>> callback)
          Reads all the data from the underlying server connection.
 void remove(String id, Callback<Void> callback)
          Removes an object from the underlying server connection.
 void save(T item, Callback<T> callback)
          Saves or updates a given object on the server.
 void setAuthenticationModule(AuthenticationModule module)
          Sets the authentication module for the Pipe.
 

Method Detail

getType

PipeType getType()
Returns the connection type of this Pipe object (e.g. REST).

Returns:
the connection type

getUrl

URL getUrl()
Returns the URL to which this Pipe object points.

Returns:
the endpoint URL

read

void read(Callback<List<T>> callback)
Reads all the data from the underlying server connection.

Parameters:
callback - The callback for consuming the result from the Pipe invocation.

readWithFilter

void readWithFilter(ReadFilter filter,
                    Callback<List<T>> callback)
Reads all the data from the underlying server connection.

Parameters:
callback - The callback for consuming the result from the Pipe invocation.
filter - a ReadFilter for performing pagination and querying.

save

void save(T item,
          Callback<T> callback)
Saves or updates a given object on the server.

Parameters:
item - the item to save or update
callback - The callback for consuming the result from the Pipe invocation.

remove

void remove(String id,
            Callback<Void> callback)
Removes an object from the underlying server connection. The given key argument is used as the objects ID.

Parameters:
id - representing the ‘id’ of the object to be removed
callback - The callback for consuming the result from the Pipe invocation.

setAuthenticationModule

void setAuthenticationModule(AuthenticationModule module)
Sets the authentication module for the Pipe. It should already be logged in.

Parameters:
module -

AeroGear Android Libary 1.0.0.M1

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.