ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Beerbower (JIRA)" <>
Subject [jira] [Created] (AMBARI-4375) Ambari-SCOM : Remove Resource.Type switch statements.
Date Tue, 21 Jan 2014 18:14:19 GMT
Tom Beerbower created AMBARI-4375:

             Summary: Ambari-SCOM : Remove Resource.Type switch statements.
                 Key: AMBARI-4375
             Project: Ambari
          Issue Type: Improvement
            Reporter: Tom Beerbower
            Assignee: Tom Beerbower

Currently Resource.Type is an enum.  In order to allow for the extension of resources by adding
new types it should be converted to a class.  One thing that prevents this is the use of the
Type enum in switch statements ...

   switch (type) {
      case Cluster:
        return new ClusterProvider(clusterDefinition);
      case Service:
        return new ServiceProvider(clusterDefinition);
      case Component:
        return new ComponentProvider(clusterDefinition);
      case Host:
        return new HostProvider(clusterDefinition);
      case HostComponent:
        return new HostComponentProvider(clusterDefinition);
      case Request:
        return new RequestProvider(clusterDefinition);
      case Task:
        return new TaskProvider(clusterDefinition);
        return new NoOpProvider(type, clusterDefinition);

We should convert these usages to a static Map<Type, ResourceProvider> lookup if possible,
or if statements.

It looks like this needs to be done in AbstractResourceProvider and SQLProviderModule for
Ambari SCOM.


This message was sent by Atlassian JIRA

View raw message