@Interceptors(SetCallerInterceptor.class) @Stateless public class ResourceHandlerBean extends AbstractRestBean implements ResourceHandlerLocal {
This page is a placeholder for the design of a REST API.
See also the JSON page which should be integrated here and then perhaps be removed.
Provide data as XML / JSON
export metrics of a resource or group as data points
get resource tree
full
level by level
get groups
authorization follows the existing role model
adding / editing of alert templates
acknowledge / view / delete of alerts
testability
initial prototypes accompanied by integration tests
involvement from qa
get availability for a resource/group
get metric chart for a resource/group
You really mean, the complete .png for that?
how to locate a resource/group?
id?
../../parentResourceKey/resourcekey?
Search / List resource from discovery queue, add resource or remove from inventory
Reading, Updating configurations
Read monitored statistics data
Execute, Schedule operations
Resource / application deployment (i.e., EARs, WARs)
Provider higher-level APIs than what we expose in the CLI today.
methods will return appropriate HTTP codes to indicate success, failure and so on. See e.g. http://restpatterns.org/HTTP_Status_Codes
I've implemented a very first very basic rest provider, which is now in the master branch on git. This is meant as a start to bootstrap the REST api effort.
Security integration is now done: The web layer authenticates all requests against the RHQ_Principal table and forwards authenticated JEE Principals to the EJB layer. Here an interceptor takes the principal, constructs an RHQ Subject from it and
creates a session. The Subject is stored in a variable caller and the call is forwarded to the target EJB. After returning,
the session is invalidated.
Implementing classes need to extend AbstractRestBean and add the SetCallerInterceptor:
@Interceptors(SetCallerInterceptor.class) @Stateless public class ResourceHandlerBean extends AbstractRestBean implements ResourceHandlerLocal {
Please check the automatically generated documentation for available URIs and HTTP verbs. You can find the documentation either at
The project release page on source forge - e.g. http://sourceforge.net/projects/rhq/files/rhq/rhq-4.5.1/
When you are building from source, the modules/enterprise/server/jar/target/docbkx/ directory
The entry point for the API is http://localhost:7080/rest/
This is work in progress and likely not the final state. When in doubt consult the code
All of the following is relative to http://localhost:7080/rest/1/:
uri |
verbs |
description |
implemented |
resource/{id} |
GET |
Get details of the resource with id id |
|
resource/platforms |
GET |
List the platforms |
|
resource/{id}/children |
GET |
Get the direct children of the resource with id id |
|
resource/{id}/availability |
GET |
Get the current availability of the resource with id id |
|
resource/{id}/schedules |
GET |
Get the metric schedules of the resource with id id |
|
|
|
|
|
user/favorites/resource |
GET |
List the favorite resources of the current user |
|
user/favorites/resource/{id} |
PUT |
Add the resource with id id to the list the favorite resources of the current user |
|
user/favorites/resource/{id} |
DELETE |
Remove the resource with id id from the list the favorite resources of the current user |
|
|
|
|
|
metric/data/{u} |
GET |
Get the metric data for schedule u |
|
metric/schedule/{id} |
GET |
Get the metric schedule with id id |
|
metric/schedule/{id} |
PUT |
Update the metric schedule with id id (enabled,interval) |
|
metric/data/resource/{rId} |
GET |
Get the metric aggregate for resource rId |
|
|
|
|
|
status |
GET |
Return generic server status (like the summary portlet) |
|
|
|
|
|
alert/ |
GET |
List alerts |
|
alert/{id} |
GET |
Display alert with id id |
|
alert/{id} |
PUT |
Acknowledge alert with id id |
|
alert/{id} |
DELETE |
Purge alert with id id |
|
alert/definition |
GET |
Display alert definitions |
|
alert/definition/{id} |
GET |
Display alert definition with id id |
|
alert/definition/{id} |
PUT |
Update alert definition with id id |
|
|
|
|
|
group/ |
GET |
List groups |
|
group/ |
POST |
Create a new group |
|
group/{id} |
GET |
Get the specific group |
|
group/{id} |
PUT |
Update group (name only at the moment |
|
group/{id} |
DELETE |
Delete the group |
|
group/{id}/resources |
GET |
Get the resources of this group |
|
group/{id}/resource/{rid} |
PUT |
Add resource rid to group id |
|
group/{id}/resource/{rid} |
DELETE |
Remove resource rid from group id |
|
Items with will need a better data model and/ or evaluation of query parameters or more work
http://www.infoq.com/presentations/Getting-Things-Done-with-REST
http://www.infoq.com/presentations/Hypermedia-Services-for-Systems-Integration – very good presentation
http://javablogs.com/Jump.action?id=672973 – blog post announcing that we will put REST in RHQ master
https://github.com/pilhuhn/RHQpocket – RHQpocket on GitHub ( demo video on vimeo )
http://www.ietf.org/rfc/rfc4627.txt – RFC about JSON
http://www.pluralsight-training.net/community/blogs/tewald/archive/2007/04/26/46984.aspx – "I finally get REST"
http://wikis.sun.com/display/Jersey/Overview+of+JAX-RS+1.0+Features – JAX-RS 1.0 features
http://blog.steveklabnik.com/posts/2011-07-03-nobody-understands-rest-or-http
http://blog.programmableweb.com/2010/08/13/api-anti-patterns-how-to-avoid-common-rest-mistakes/ – REST antipatterns