Tom Beerbower created AMBARI-3577:
-------------------------------------

             Summary: Move service related code in AmbariManagementController 
to ServiceResourceProvider
                 Key: AMBARI-3577
                 URL: https://issues.apache.org/jira/browse/AMBARI-3577
             Project: Ambari
          Issue Type: Task
            Reporter: Tom Beerbower
            Assignee: Tom Beerbower


With the goal of getting rid of the AmbariManagementController, we should start 
pushing some of the code out to the resource providers for the different 
resource types.

This refactoring will achieve several things :
# help to get rid of the AmbariManagementController interface and 
implementation which has become very bloated and difficult to maintain / add to.
# organize all of the service related code in one place separate from the other 
resource types.
# get rid of the layer of abstraction between the resource providers and the 
AmbariManagementController which prevents us from using things like Predicates 
(not part of the AMC interface).

The short term goal should be to move the code that implements the following 
AmbariManagementController interface methods into the ServiceResourceProvider 
as private methods and remove the methods from the interface :

{code}
  AmbariManagementController

  public void createServices(Set<ServiceRequest> requests)
      throws AmbariException, ParentObjectNotFoundException;

  public Set<ServiceResponse> getServices(Set<ServiceRequest> requests)
      throws AmbariException;

  public RequestStatusResponse updateServices(Set<ServiceRequest> requests,
      Map<String, String> requestProperties, boolean runSmokeTest,
      boolean reconfigureClients) throws AmbariException;

  public RequestStatusResponse deleteServices(Set<ServiceRequest> requests)
      throws AmbariException;

{code}

There is some code in the AMC implementation that is common to multiple 
resource types that doesn't make sense to pull into ServiceResourceProvider.  
That code should remain in the AMCImpl for now.  For example ...

{code}
  private final Clusters clusters;
  ...
  cluster = clusters.getCluster(clusterName);
{code}
... the member clusters is used across multiple resource types.  Using it from 
the resource providers would require that we expose it through the AMC 
interface.  I think that is okay for this first step.  Once the AMC is reduced 
to something manageable, we can revisit. 

We should move the associated AMCImpl tests as well.




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to