public class AbstractRestBean extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractRestBean.CacheKey |
| Modifier and Type | Field and Description |
|---|---|
protected org.infinispan.Cache<AbstractRestBean.CacheKey,Object> |
cache |
protected org.rhq.core.domain.auth.Subject |
caller
Subject of the caller that gets injected via
SetCallerInterceptor |
protected org.infinispan.manager.CacheContainer |
container |
| Constructor and Description |
|---|
AbstractRestBean() |
| Modifier and Type | Method and Description |
|---|---|
protected org.rhq.core.domain.resource.group.ResourceGroup |
fetchGroup(int groupId,
boolean requireCompatible)
Fetch the group with the passed id
|
protected org.rhq.core.domain.resource.Resource |
fetchResource(int resourceId) |
protected GroupRest |
fillGroup(org.rhq.core.domain.resource.group.ResourceGroup group,
javax.ws.rs.core.UriInfo uriInfo) |
ResourceWithType |
fillRWT(org.rhq.core.domain.resource.Resource res,
javax.ws.rs.core.UriInfo uriInfo) |
protected <T> T |
getFromCache(AbstractRestBean.CacheKey key,
Class<T> clazz)
Retrieve an object from the cache if present or null otherwise.
|
protected <T> T |
getFromCache(int id,
Class<T> clazz)
Retrieve an object from the cache.
|
protected org.rhq.core.domain.resource.Resource |
getResourceFromCache(int resourceid) |
protected List<org.rhq.core.domain.resource.Resource> |
getResourcesFromCacheByParentId(int pid) |
protected void |
putResourceToCache(org.rhq.core.domain.resource.Resource res) |
protected <T> boolean |
putToCache(AbstractRestBean.CacheKey key,
T o)
Put an object into the cache.
|
protected <T> boolean |
putToCache(int id,
Class<T> clazz,
T o)
Put an object into the cache identified by its type and id
|
protected <T> boolean |
removeFromCache(int id,
Class<T> clazz)
Remove an item from the cache
|
protected String |
renderTemplate(String templateName,
Object objectToRender)
Renders the passed object with the help of a freemarker template into a string.
|
void |
start() |
protected org.infinispan.manager.CacheContainer container
protected org.infinispan.Cache<AbstractRestBean.CacheKey,Object> cache
protected org.rhq.core.domain.auth.Subject caller
SetCallerInterceptor@PostConstruct public void start()
protected String renderTemplate(String templateName, Object objectToRender)
templateName - Template to use for rendering. If the template name does not end in .ftl, .ftl is appended.objectToRender - Object to render via templateprotected <T> T getFromCache(int id,
Class<T> clazz)
id - Id of the object to load.clazz - Wanted return typegetFromCache(int, Class)protected <T> T getFromCache(AbstractRestBean.CacheKey key, Class<T> clazz)
key - FullyQualified name (=path in cache) of the object to retrieveclazz - Return typeputToCache(CacheKey, Object)protected <T> boolean putToCache(int id,
Class<T> clazz,
T o)
id - Id of the object to putclazz - Type to put ino - Object to putputToCache(CacheKey, Object)protected <T> boolean putToCache(AbstractRestBean.CacheKey key, T o)
key - Fully qualified name (=path to object)o - Object to putgetFromCache(CacheKey, Class)protected void putResourceToCache(org.rhq.core.domain.resource.Resource res)
protected List<org.rhq.core.domain.resource.Resource> getResourcesFromCacheByParentId(int pid)
protected org.rhq.core.domain.resource.Resource getResourceFromCache(int resourceid)
protected <T> boolean removeFromCache(int id,
Class<T> clazz)
id - Id of the itemclazz - Type of object for that nodepublic ResourceWithType fillRWT(org.rhq.core.domain.resource.Resource res, javax.ws.rs.core.UriInfo uriInfo)
protected org.rhq.core.domain.resource.Resource fetchResource(int resourceId)
protected org.rhq.core.domain.resource.group.ResourceGroup fetchGroup(int groupId,
boolean requireCompatible)
groupId - id of the resource grouprequireCompatible - Does the group have to be a compatible group?StuffNotFoundException - if the group is not found (or not accessible by the caller)BadArgumentException - if a compatible group is required, but the found one is not a compatible oneprotected GroupRest fillGroup(org.rhq.core.domain.resource.group.ResourceGroup group, javax.ws.rs.core.UriInfo uriInfo)
Copyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.