[Hawkular-dev] Inventory REST now has result sets pagination

Lukas Krejci lkrejci at redhat.com
Tue Apr 28 05:43:36 EDT 2015


Hi,

I went ahead and prototyped the pagination support both in the backend and the 
REST API within the boundaries of inventory.

Because this is a generic feature, it's been agreed that this stuff would 
deserve a place of its own so that it can be shared amongst the various 
hawkular components.

There are 2 aspects of the paging:

* support in backend - This basically only revolves around the specification 
of the paging requirements and a list "wrapper" that adds paging context to 
the results. The way how the paging will be implemented will differ in each 
component.
https://github.com/hawkular/hawkular-inventory/tree/master/api/src/main/java/org/hawkular/inventory/api/paging

* support in the REST API - This means to translate the query parameters with 
the paging specification into paging java API and transform the results from 
the backend into the set of headers attached to the response.

The support for paging in REST in inventory is contained in these classes:

https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/src/main/java/org/hawkular/inventory/rest/RequestUtil.java

https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/src/main/java/org/hawkular/inventory/rest/ResponseUtil.java

https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/src/main/java/org/hawkular/inventory/rest/json/Link.java

https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/src/main/java/org/hawkular/inventory/rest/json/LinkDeserializer.java

https://github.com/hawkular/hawkular-inventory/blob/master/rest-servlet/src/main/java/org/hawkular/inventory/rest/json/LinkSerializer.java

Both the backend and the REST support were either taken from or were heavily 
inspired by the paging support in RHQ.

Where do you think these should live? Do we have a repo for common stuff? I 
imagine we will have to have 2 separate common modules so that we don't drag 
jaxrs deps into core components.

Cheers,

Lukas






More information about the hawkular-dev mailing list