com.novell.sentinel.client.bean.json
Class BeanTransporterJSON<B extends SentinelBean>

java.lang.Object
  extended by com.novell.sentinel.client.bean.BeanTransporterBase<B,JSONParser>
      extended by com.novell.sentinel.client.bean.json.BeanTransporterJSON<B>
Type Parameters:
B - The SentinelBean-derived type (e.g., IdentityBean)
All Implemented Interfaces:
BeanTransporter<B>

public class BeanTransporterJSON<B extends SentinelBean>
extends BeanTransporterBase<B,JSONParser>

Implementation of BeanTransporter that serialized to and from JSON.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.novell.sentinel.client.bean.BeanTransporterBase
BeanTransporterBase.ParseException
 
Field Summary
 
Fields inherited from interface com.novell.sentinel.client.bean.BeanTransporter
NO_FIELDS, UNLIMITED_PAGE_SIZE
 
Constructor Summary
BeanTransporterJSON(BeanMetaData<? extends B> _beanMD, HttpRequestor<JSONParser> _requestor, UriConstructorFactory _urlFactory)
           
 
Method Summary
protected  B createBean(JSONParser parser)
          Derived classes must create a single instance of class B from the HTTP GET result content obtained from the parser parameter.
protected  PagedBeanCollection<B> createPage(JSONParser parser)
          Derived classes must create a PagedBeanCollection instance based on the HTTP GET result content obtained from the parser parameter.
protected  JSONParser 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.
protected  long parseCount(JSONParser parser)
          Derived classes must parse the item count returned as a result of an HTTP GET request.
protected  String parseURL(JSONParser parser)
          Derived classes must parse the URL returned as a result of an HTTP POST request.
 
Methods inherited from class com.novell.sentinel.client.bean.BeanTransporterBase
cleanup, count, count, delete, delete, get, get, getBeanMD, getLocaleName, getRequestor, getSortFields, getUrlFactory, list, list, list, listFromURL, listFromURL, listFromURL, post, put, put, setLocaleName, setSortFields
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanTransporterJSON

public BeanTransporterJSON(BeanMetaData<? extends B> _beanMD,
                           HttpRequestor<JSONParser> _requestor,
                           UriConstructorFactory _urlFactory)
Method Detail

createPage

protected PagedBeanCollection<B> createPage(JSONParser parser)
                                                          throws BeanSerializationException
Description copied from class: BeanTransporterBase
Derived classes must create a PagedBeanCollection instance based on the HTTP GET result content obtained from the parser parameter.

Specified by:
createPage in class BeanTransporterBase<B extends SentinelBean,JSONParser>
Parameters:
parser - The source of the HTTP GET results.
Returns:
A page implementation.
Throws:
BeanSerializationException - if an error occurs during construction from the GET results.

createBean

protected B createBean(JSONParser parser)
                                     throws BeanSerializationException
Description copied from class: BeanTransporterBase
Derived classes must create a single instance of class B from the HTTP GET result content obtained from the parser parameter.

Specified by:
createBean in class BeanTransporterBase<B extends SentinelBean,JSONParser>
Parameters:
parser - The source of the HTTP GET results.
Returns:
The created bean.
Throws:
BeanSerializationException - if an error occurs during construction from the GET results.

createParser

protected JSONParser createParser(B bean)
                           throws BeanSerializationException
Description copied from class: BeanTransporterBase
Derived classes must create a data source from which can be obtained the content data for an HTTP PUT or POST request.

Specified by:
createParser in class BeanTransporterBase<B extends SentinelBean,JSONParser>
Parameters:
bean - The bean containing the Sentinel data item fields.
Returns:
A source for HTTP PUT or POST content.
Throws:
BeanSerializationException - if an error occurs during the construction of the data source.

parseURL

protected String parseURL(JSONParser parser)
                   throws BeanTransporterBase.ParseException
Description copied from class: BeanTransporterBase
Derived classes must parse the URL returned as a result of an HTTP POST request.

Specified by:
parseURL in class BeanTransporterBase<B extends SentinelBean,JSONParser>
Parameters:
parser - The source for the result content of the HTTP POST request.
Returns:
The URL from the result content.
Throws:
BeanTransporterBase.ParseException - If an error occurs during the parsing of the POST result content.

parseCount

protected long parseCount(JSONParser parser)
                   throws BeanTransporterBase.ParseException
Description copied from class: BeanTransporterBase
Derived classes must parse the item count returned as a result of an HTTP GET request.

Specified by:
parseCount in class BeanTransporterBase<B extends SentinelBean,JSONParser>
Parameters:
parser - The source for the result content of the HTTP GET request.
Returns:
The URL from the result content.
Throws:
BeanTransporterBase.ParseException - If an error occurs during the parsing of the GET result content.