org.apache.ambari.view
Interface ResourceProvider<T>

Type Parameters:
T - the type of the resource class provided by this ResourceProvider object.

public interface ResourceProvider<T>

Class used to access view sub-resources.


Method Summary
 void createResource(String resourceId, Map<String,Object> properties)
          Create a resource with the given id and given property values.
 boolean deleteResource(String resourceId)
          Delete the resource identified by the given resource id.
 T getResource(String resourceId, Set<String> properties)
          Get a single resource from the given id.
 Set<T> getResources(ReadRequest request)
          Get all of the resources.
 boolean updateResource(String resourceId, Map<String,Object> properties)
          Update the resource identified by given resource id with the given property values.
 

Method Detail

getResource

T getResource(String resourceId,
              Set<String> properties)
              throws SystemException,
                     NoSuchResourceException,
                     UnsupportedPropertyException
Get a single resource from the given id. The resource should be populated with the given properties.

Parameters:
resourceId - the id of the requested resource
properties - the set of requested property ids
Returns:
the resource
Throws:
SystemException - an internal system exception occurred
NoSuchResourceException - a requested resource doesn't exist
UnsupportedPropertyException - the request contains unsupported property ids

getResources

Set<T> getResources(ReadRequest request)
                    throws SystemException,
                           NoSuchResourceException,
                           UnsupportedPropertyException
Get all of the resources. The resources should be populated with the given resources.

Parameters:
request - the read request
Returns:
a set containing all the resources
Throws:
SystemException - an internal system exception occurred
NoSuchResourceException - a requested resource doesn't exist
UnsupportedPropertyException - the request contains unsupported property ids

createResource

void createResource(String resourceId,
                    Map<String,Object> properties)
                    throws SystemException,
                           ResourceAlreadyExistsException,
                           NoSuchResourceException,
                           UnsupportedPropertyException
Create a resource with the given id and given property values.

Parameters:
resourceId - the id of the requested resource
properties - the map of property values to set on the new resource
Throws:
SystemException - an internal system exception occurred
ResourceAlreadyExistsException - attempted to create a resource which already exists
NoSuchResourceException - a parent resource doesn't exist
UnsupportedPropertyException - the request contains unsupported property ids

updateResource

boolean updateResource(String resourceId,
                       Map<String,Object> properties)
                       throws SystemException,
                              NoSuchResourceException,
                              UnsupportedPropertyException
Update the resource identified by given resource id with the given property values.

Parameters:
resourceId - the id of the requested resource
properties - the map of property values to update on the resource
Returns:
true if the resource was successfully updated
Throws:
SystemException - an internal system exception occurred
NoSuchResourceException - a requested resource doesn't exist
UnsupportedPropertyException - the request contains unsupported property ids

deleteResource

boolean deleteResource(String resourceId)
                       throws SystemException,
                              NoSuchResourceException,
                              UnsupportedPropertyException
Delete the resource identified by the given resource id.

Parameters:
resourceId - the id of the requested resource
Returns:
true if the resource was successfully deleted
Throws:
SystemException - an internal system exception occurred
NoSuchResourceException - the resource instance to be deleted doesn't exist
UnsupportedPropertyException - the request contains unsupported property ids


Copyright © 2015 Apache Software Foundation. All rights reserved.