|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.novell.sentinel.client.bean.BeanTransporterBase<B,P>
B
- Bean type (e.g., IdentityBean)P
- HTTP content parser type (e.g., JSONParser or org.xml.sax.Parser)public abstract class BeanTransporterBase<B extends SentinelBean,P>
Base class for GWT and asynchronous Java BeanTransporter implementations.
Nested Class Summary | |
---|---|
static class |
BeanTransporterBase.ParseException
Generic carrier exception to allow derived classes to report errors in parsing HTTP results. |
Field Summary |
---|
Fields inherited from interface com.novell.sentinel.client.bean.BeanTransporter |
---|
NO_FIELDS, UNLIMITED_PAGE_SIZE |
Constructor Summary | |
---|---|
protected |
BeanTransporterBase(BeanMetaData<? extends B> _beanMD,
HttpRequestor<P> _requestor,
UriConstructorFactory _urlFactory)
Constructor for derived classes. |
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. |
protected abstract B |
createBean(P parser)
Derived classes must create a single instance of class B from the HTTP GET result content obtained from the parser parameter. |
protected abstract PagedBeanCollection<B> |
createPage(P parser)
Derived classes must create a PagedBeanCollection instance based on the HTTP GET result content obtained from the parser parameter. |
protected abstract P |
createParser(B bean)
Derived classes must create a data source from which can be obtained the content data for an HTTP PUT or POST request. |
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. |
protected BeanMetaData<? extends B> |
getBeanMD()
Return the metadata for the bean-type handled by this instance. |
String |
getLocaleName()
Get the locale name currently set in the implementing instance. |
HttpRequestor<P> |
getRequestor()
Get the HttpRequestor used by this instance. |
List<String> |
getSortFields()
Get the sort field names currently set in the implementing instance. |
UriConstructorFactory |
getUrlFactory()
Get the URL creator factory used by this 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. |
protected abstract long |
parseCount(P parser)
Derived classes must parse the item count returned as a result of an HTTP GET request. |
protected abstract String |
parseURL(P parser)
Derived classes must parse the URL returned as a result of an HTTP POST request. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected BeanTransporterBase(BeanMetaData<? extends B> _beanMD, HttpRequestor<P> _requestor, UriConstructorFactory _urlFactory)
_beanMD
- The metadata of the SentinelBean implementation._requestor
- The interface through which HTTP requests will be made._urlFactory
- The factory instance from which request URLs will be constructed. The factory must
return UriConstructor instances which are pre-loaded with the base URL of the Sentinel DataObject REST API.Method Detail |
---|
public String getLocaleName()
BeanTransporter
getLocaleName
in interface BeanTransporter<B extends SentinelBean>
public void setLocaleName(String localeName)
BeanTransporter
setLocaleName
in interface BeanTransporter<B extends SentinelBean>
localeName
- The public void setSortFields(List<String> sortFields)
BeanTransporter
setSortFields
in interface BeanTransporter<B extends SentinelBean>
sortFields
- The list of field names on which to sort list results.public List<String> getSortFields()
BeanTransporter
getSortFields
in interface BeanTransporter<B extends SentinelBean>
public void count(OnBeanCount handler)
BeanTransporter
count
in interface BeanTransporter<B extends SentinelBean>
handler
- The handler to which the result of the HTTP request will be reported.public void count(String query, OnBeanCount handler)
BeanTransporter
count
in interface BeanTransporter<B extends SentinelBean>
query
- Optional filter for the results (may be null
).handler
- The handler to which the result of the HTTP request will be reported.public void listFromURL(String url, OnBeanPageLoad<B> handler)
BeanTransporter
listFromURL
in interface BeanTransporter<B extends SentinelBean>
url
- The URL specifying the beans.handler
- The handler to which the result of the HTTP request will be reported.public void listFromURL(String url, int pageSize, Iterable<String> fields, OnBeanPageLoad<B> handler)
BeanTransporter
listFromURL
in interface BeanTransporter<B extends SentinelBean>
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.public void listFromURL(String url, int pageSize, Iterable<String> fields, boolean getChangeCounts, OnBeanPageLoad<B> handler)
BeanTransporter
listFromURL
in interface BeanTransporter<B extends SentinelBean>
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.public void list(String query, int pageSize, Iterable<String> fields, OnBeanPageLoad<B> handler)
BeanTransporter
list
in interface BeanTransporter<B extends SentinelBean>
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.public void list(String query, int pageSize, Iterable<String> fields, boolean getChangeCounts, OnBeanPageLoad<B> handler)
BeanTransporter
list
in interface BeanTransporter<B extends SentinelBean>
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.public void list(OnBeanPageLoad<B> handler)
BeanTransporter
list
in interface BeanTransporter<B extends SentinelBean>
handler
- The handler to which the result of the HTTP request will be reported.public void get(String url, Iterable<String> fields, OnBeanLoad<B> handler)
BeanTransporter
get
in interface BeanTransporter<B extends SentinelBean>
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.public void get(String url, OnOctetStreamLoad handler)
BeanTransporter
get
in interface BeanTransporter<B extends SentinelBean>
url
- The reference to the attribute value.handler
- The handler to which the result of the HTTP request will be reported.public void put(B bean, OnBeanPut handler) throws BeanSerializationException
BeanTransporter
put
in interface BeanTransporter<B extends SentinelBean>
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.
BeanSerializationException
public void put(String url, byte[] data, OnBeanPut handler)
BeanTransporter
put
in interface BeanTransporter<B extends SentinelBean>
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.public void post(B bean, OnBeanPost handler) throws BeanSerializationException
BeanTransporter
post
in interface BeanTransporter<B extends SentinelBean>
bean
- The bean containing the data for the new instance.handler
- The handler to which the result of the HTTP request will be reported.
BeanSerializationException
- If an error occurs transforming the bean data into HTTP request data.public void delete(String url, OnBeanDelete handler)
BeanTransporter
delete
in interface BeanTransporter<B extends SentinelBean>
url
- The URL specifying the data instance to be deleted.handler
- The handler to which the result of the HTTP request will be reported.public void delete(B bean, OnBeanDelete handler)
BeanTransporter
delete
in interface BeanTransporter<B extends SentinelBean>
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.public void cleanup(String url, OnBeanDelete handler)
BeanTransporter
cleanup
in interface BeanTransporter<B extends SentinelBean>
url
- The URL representing the resource to clean up.handler
- The handler to which the result of the HTTP request will be reported.public HttpRequestor<P> getRequestor()
public UriConstructorFactory getUrlFactory()
protected abstract PagedBeanCollection<B> createPage(P parser) throws BeanSerializationException
parser
- The source of the HTTP GET results.
BeanSerializationException
- if an error occurs during construction from the GET results.protected abstract B createBean(P parser) throws BeanSerializationException
parser
- The source of the HTTP GET results.
BeanSerializationException
- if an error occurs during construction from the GET results.protected abstract P createParser(B bean) throws BeanSerializationException
bean
- The bean containing the Sentinel data item fields.
BeanSerializationException
- if an error occurs during the construction of the data source.protected abstract String parseURL(P parser) throws BeanTransporterBase.ParseException
parser
- The source for the result content of the HTTP POST request.
BeanTransporterBase.ParseException
- If an error occurs during the parsing of the POST result content.protected abstract long parseCount(P parser) throws BeanTransporterBase.ParseException
parser
- The source for the result content of the HTTP GET request.
BeanTransporterBase.ParseException
- If an error occurs during the parsing of the GET result content.protected BeanMetaData<? extends B> getBeanMD()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |