You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Tom Beerbower (JIRA)" <ji...@apache.org> on 2013/02/12 19:59:15 UTC

[jira] [Commented] (AMBARI-1402) Refactor resource providers to remove special cases for configuration

    [ https://issues.apache.org/jira/browse/AMBARI-1402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13576894#comment-13576894 ] 

Tom Beerbower commented on AMBARI-1402:
---------------------------------------

See checkPropertyIds() in ConfigurationResourceProvider, ServiceResourceProvider and HostComponentResourceProvider.  For example, in ConfigurationResourceProvider ...

{code}
  @Override
  public Set<String> checkPropertyIds(Set<String> propertyIds) {
    propertyIds = super.checkPropertyIds(propertyIds);

    if (propertyIds.isEmpty()) {
      return propertyIds;
    }
    Set<String> unsupportedProperties = new HashSet<String>();

    for (String propertyId : propertyIds) {

      // TODO : hack to allow for inconsistent property names
      // for example, the tag property can come here as Config/tag, /tag or tag
      if (!propertyId.equals("tag") && !propertyId.equals("type") &&
          !propertyId.equals("/tag") && !propertyId.equals("/type") &&
          !propertyId.equals("properties")) {

        String propertyCategory = PropertyHelper.getPropertyCategory(propertyId);

        if (propertyCategory == null || !propertyCategory.equals("properties")) {
          unsupportedProperties.add(propertyId);
        }
      }
    }
    return unsupportedProperties;
  }
{code}

We should be able to remove this method and handle it generically in super.checkPropertyIds(propertyIds) by adding the property ids and the category "properties" to the list of supported ids for the configuration resource.  Same is true for ServiceResourceProvider and HostComponentResourceProvider.
                
> Refactor resource providers to remove special cases for configuration
> ---------------------------------------------------------------------
>
>                 Key: AMBARI-1402
>                 URL: https://issues.apache.org/jira/browse/AMBARI-1402
>             Project: Ambari
>          Issue Type: Sub-task
>            Reporter: Tom Beerbower
>            Assignee: Tom Beerbower
>             Fix For: 1.3.0
>
>
> The configuration resource provider changed the SPI model somewhat in that it isn't able to provide a set of supported properties. Instead it provides a set of arbitrary properties under a known category (i.e. "properties"). Specialized code was added to allow for this in the configuration resource provider as well as the service and component resource providers. The SPI has since been cleaned up to the point where it should be possible to remove this specialized code and handle it with a generic mechanism.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira