com.novell.sentinel.client.bean
Interface BeanTransporter<B extends SentinelBean>

Type Parameters:
B - bean type (e.g., com.novell.db.object.bean.IdentityBean).
All Known Implementing Classes:
BeanTransporterBase, BeanTransporterJSON, BeanTransporterJSONSync, BeanTransporterSyncBase

public interface BeanTransporter<B extends SentinelBean>

Interface specifying methods used to send and receive SentinelBean-derived instances to and from the Sentinel server.

Note that this interface is designed for use in both Java and GWT. Because of the limitations of the GWT environment (a browser-hosted, single-threaded Javascript environment) the methods of this interface that make HTTP requests are all asynchronous and use callbacks to report request results.

In Java it is sometimes more convenient in a single-thread environment to use a synchronous model. For these cases see the interface BeanTransporterSync and the implementation BeanTransporterJSONSync.

To use a BeanTransporter it is necessary to first construct an implementation of HttpRequestor and then use the HttpRequestor implementation to construct an implementation of BeanTransporter (or, for the synchronous case, of BeanTransporterSync).

Once a transporter implementation is available the count, list and get methods are used to obtain data from the Sentinel server.

To create, update, or delete data on the server the post, put, and delete methods are used.


Field Summary
static List<String> NO_FIELDS
          Value specifying that no field values are to be returned.
static int UNLIMITED_PAGE_SIZE
          Value specifying that no limit is placed on the maximum number of data instances returned as the result of a list call.
 
Method Summary
 void cleanup(String url, OnBeanDelete handler)
          Issues a cleanup request to the server for the passed URL.
 void count(OnBeanCount handler)
          Get a count of the data instances available.
 void count(String query, OnBeanCount handler)
          Get a count of the data instances available, optionally filtered by the passed query.
 void delete(B bean, OnBeanDelete handler)
          Delete the data instance represented by the passed bean.
 void delete(String url, OnBeanDelete handler)
          Delete the data instance at the specified URL.
 void get(String url, Iterable<String> fields, OnBeanLoad<B> handler)
          Get the data at the passed URL in a bean.
 void get(String url, OnOctetStreamLoad handler)
          Get the octet stream value of an object attribute referenced by the passed URL.
 String getLocaleName()
          Get the locale name currently set in the implementing instance.
 List<String> getSortFields()
          Get the sort field names currently set in the implementing instance.
 void list(OnBeanPageLoad<B> handler)
          Get a collection of the beans available.
 void list(String query, int pageSize, Iterable<String> fields, boolean getChangeCounts, OnBeanPageLoad<B> handler)
          Get a collection of the data instances available, optionally filtered by the passed query.
 void list(String query, int pageSize, Iterable<String> fields, OnBeanPageLoad<B> handler)
          Get a collection of the data instances available, optionally filtered by the passed query.
 void listFromURL(String url, int pageSize, Iterable<String> fields, boolean getChangeCounts, OnBeanPageLoad<B> handler)
          Get a collection of the data instances available at the passed URL.
 void listFromURL(String url, int pageSize, Iterable<String> fields, OnBeanPageLoad<B> handler)
          Get a collection of the data instances available at the passed URL.
 void listFromURL(String url, OnBeanPageLoad<B> handler)
          Get a collection of the beans available at the passed URL.
 void post(B bean, OnBeanPost handler)
          Create a new data instance.
 void put(B bean, OnBeanPut handler)
          Update the underlying Sentinel data from the passed bean.
 void put(String url, byte[] data, OnBeanPut handler)
          Put the octet stream value of an object attribute referenced by the passed URL.
 void setLocaleName(String localeName)
          Set the name of the locale to use to sort list results if an order is used.
 void setSortFields(List<String> sortFields)
          Set list of field names on which to sort list results.
 

Field Detail

UNLIMITED_PAGE_SIZE

static final int UNLIMITED_PAGE_SIZE
Value specifying that no limit is placed on the maximum number of data instances returned as the result of a list call.

See Also:
Constant Field Values

NO_FIELDS

static final List<String> NO_FIELDS
Value specifying that no field values are to be returned. Use for the value of the fields parameter of the list and get methods.

Method Detail

setLocaleName

void setLocaleName(String localeName)
Set the name of the locale to use to sort list results if an order is used.

Parameters:
localeName - The _ string representing a locale. Supported locales are those available in Java.

getLocaleName

String getLocaleName()
Get the locale name currently set in the implementing instance.

Returns:
The locale name (may be null).

setSortFields

void setSortFields(List<String> sortFields)
Set list of field names on which to sort list results. Setting this to null (the default) will return the objects unsorted, or if there is a default order defined for the object type, sorted by the default order. To eliminate any default sort order, set this to an empty list.

Parameters:
sortFields - The list of field names on which to sort list results.

getSortFields

List<String> getSortFields()
Get the sort field names currently set in the implementing instance.

Returns:
The sort fields names (may be null).

count

void count(OnBeanCount handler)
Get a count of the data instances available.

Parameters:
handler - The handler to which the result of the HTTP request will be reported.

count

void count(String query,
           OnBeanCount handler)
Get a count of the data instances available, optionally filtered by the passed query.

Parameters:
query - Optional filter for the results (may be null).
handler - The handler to which the result of the HTTP request will be reported.

listFromURL

void listFromURL(String url,
                 OnBeanPageLoad<B> handler)
Get a collection of the beans available at the passed URL. The URL supplied must be appropriate for the bean type <B>.

Parameters:
url - The URL specifying the beans.
handler - The handler to which the result of the HTTP request will be reported.

listFromURL

void listFromURL(String url,
                 int pageSize,
                 Iterable<String> fields,
                 OnBeanPageLoad<B> handler)
Get a collection of the data instances available at the passed URL. The URL supplied must be appropriate for the bean type <B>.

Parameters:
url - The URL specifying the beans.
pageSize - The maximum number of beans to return as a result of this call.
fields - Optional collection of the names of fields to return in each bean (may be null, if a single value of "none" is specified then no fields are retrieved).
handler - The handler to which the result of the HTTP request will be reported.

listFromURL

void listFromURL(String url,
                 int pageSize,
                 Iterable<String> fields,
                 boolean getChangeCounts,
                 OnBeanPageLoad<B> handler)
Get a collection of the data instances available at the passed URL. The URL supplied must be appropriate for the bean type <B>.

Parameters:
url - The URL specifying the beans.
pageSize - The maximum number of beans to return as a result of this call.
fields - Optional collection of the names of fields to return in each bean (may be null, if a single value of "none" is specified then no fields are retrieved).
getChangeCounts - if true, get the "delta counts" of the object.
handler - The handler to which the result of the HTTP request will be reported.

list

void list(String query,
          int pageSize,
          Iterable<String> fields,
          OnBeanPageLoad<B> handler)
Get a collection of the data instances available, optionally filtered by the passed query.

Parameters:
query - Optional filter for the results (may be null).
pageSize - The maximum number of beans to return as a result of this call.
fields - Optional collection of the names of fields to return in each bean (may be null, if a single value of "none" is specified then no fields are retrieved).
handler - The handler to which the result of the HTTP request will be reported.

list

void list(String query,
          int pageSize,
          Iterable<String> fields,
          boolean getChangeCounts,
          OnBeanPageLoad<B> handler)
Get a collection of the data instances available, optionally filtered by the passed query.

Parameters:
query - Optional filter for the results (may be null).
pageSize - The maximum number of beans to return as a result of this call.
fields - Optional collection of the names of fields to return in each bean (may be null, if a single value of "none" is specified then no fields are retrieved).
getChangeCounts - if true, get the "delta counts" of the object.
handler - The handler to which the result of the HTTP request will be reported.

list

void list(OnBeanPageLoad<B> handler)
Get a collection of the beans available.

Parameters:
handler - The handler to which the result of the HTTP request will be reported.

get

void get(String url,
         Iterable<String> fields,
         OnBeanLoad<B> handler)
Get the data at the passed URL in a bean.

Parameters:
url - The URL specifying the data to retrieve.
fields - Optional collection of the names of fields to return in each bean (may be null, if a single value of "none" is specified then no fields are retrieved).
handler - The handler to which the result of the HTTP request will be reported.

get

void get(String url,
         OnOctetStreamLoad handler)
Get the octet stream value of an object attribute referenced by the passed URL.

Parameters:
url - The reference to the attribute value.
handler - The handler to which the result of the HTTP request will be reported.

put

void put(B bean,
         OnBeanPut handler)
         throws BeanSerializationException
Update the underlying Sentinel data from the passed bean.

Parameters:
bean - The bean containing the updated data (must have been obtained from a list or get call.
handler - The handler to which the status of the HTTP request will be reported.
Throws:
BeanSerializationException

put

void put(String url,
         byte[] data,
         OnBeanPut handler)
Put the octet stream value of an object attribute referenced by the passed URL.

Parameters:
url - The reference to the attribute value.
data - The octet stream data for the attribute value.
handler - The handler to which the status of the HTTP request will be reported.

post

void post(B bean,
          OnBeanPost handler)
          throws BeanSerializationException
Create a new data instance.

Parameters:
bean - The bean containing the data for the new instance.
handler - The handler to which the result of the HTTP request will be reported.
Throws:
BeanSerializationException - If an error occurs transforming the bean data into HTTP request data.

delete

void delete(String url,
            OnBeanDelete handler)
Delete the data instance at the specified URL.

Parameters:
url - The URL specifying the data instance to be deleted.
handler - The handler to which the result of the HTTP request will be reported.

delete

void delete(B bean,
            OnBeanDelete handler)
Delete the data instance represented by the passed bean.

Parameters:
bean - The representation of the data instance to be deleted (must have been obtained from a list or get call.
handler - The handler to which the result of the HTTP request will be reported.

cleanup

void cleanup(String url,
             OnBeanDelete handler)
Issues a cleanup request to the server for the passed URL. Cleanup requests are used for certain types of resources that implicitly create server-side resources that can be freed once the client is finished with them. An example is a search job created implicitly when events are searched for using the EventBean list operation, rather than the EventSearch post operation.

Parameters:
url - The URL representing the resource to clean up.
handler - The handler to which the result of the HTTP request will be reported.