private Resource getResource(Object bean, String viewName, String viewVersion,
                               String instanceName, Set<String> requestedIds)
      throws InvocationTargetException, IllegalAccessException {

    Resource resource = new ResourceImpl(type);

    resource.setProperty(VIEW_NAME_PROPERTY_ID, viewName);
    resource.setProperty(VIEW_VERSION_PROPERTY_ID, viewVersion);
    resource.setProperty(INSTANCE_NAME_PROPERTY_ID, instanceName);

    for (Map.Entry<String, PropertyDescriptor> entry : descriptorMap.entrySet()) {
      Object value = entry.getValue().getReadMethod().invoke(bean);

      setResourceProperty(resource, entry.getKey(), value, requestedIds);
    }
    return resource;
  }
Construct a view resource provider for the given resource type and bean class.

@param type            the resource type
@param clazz           the resource bean class
@param pkField         the primary key field name
@param viewDefinition  the associated view definition

@throws IntrospectionException if an exception occurs during introspection of the resource bean class
ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java