public static ResourceProvider getResourceProvider(Resource.Type type,
                                                     AmbariManagementController managementController) {

    switch (type.getInternalType()) {
      case Cluster:
        return new ClusterResourceProvider(managementController);
      case Service:
        return resourceProviderFactory.getServiceResourceProvider(managementController);
      case Component:
        return resourceProviderFactory.getComponentResourceProvider(managementController);
      case Host:
        return resourceProviderFactory.getHostResourceProvider(managementController);
      case HostComponent:
        return resourceProviderFactory.getHostComponentResourceProvider(managementController);
      case Configuration:
        return new ConfigurationResourceProvider(managementController);
      case ServiceConfigVersion:
        return new ServiceConfigVersionResourceProvider(managementController);
      case Action:
        return new ActionResourceProvider(managementController);
      case Request:
        return new RequestResourceProvider(managementController);
      case Task:
        return new TaskResourceProvider(managementController);
      case User:
        return resourceProviderFactory.getUserResourceProvider(managementController);
      case UserAuthenticationSource:
        return resourceProviderFactory.getUserAuthenticationSourceResourceProvider();
      case Group:
        return new GroupResourceProvider(managementController);
      case Member:
        return resourceProviderFactory.getMemberResourceProvider(managementController);
      case Upgrade:
        return resourceProviderFactory.getUpgradeResourceProvider(managementController);
      case Stack:
        return new StackResourceProvider(managementController);
      case Mpack:
        return new MpackResourceProvider(managementController);
      case StackVersion:
        return new StackVersionResourceProvider(managementController);
      case ClusterStackVersion:
        return resourceProviderFactory.getClusterStackVersionResourceProvider(managementController);
      case HostStackVersion:
        return new HostStackVersionResourceProvider(managementController);
      case StackService:
        return new StackServiceResourceProvider(managementController);
      case StackServiceComponent:
        return new StackServiceComponentResourceProvider(managementController);
      case StackConfiguration:
        return new StackConfigurationResourceProvider(managementController);
      case StackConfigurationDependency:
        return new StackConfigurationDependencyResourceProvider(managementController);
      case StackLevelConfiguration:
        return new StackLevelConfigurationResourceProvider(managementController);
      case ExtensionLink:
        return new ExtensionLinkResourceProvider(managementController);
      case Extension:
        return new ExtensionResourceProvider(managementController);
      case ExtensionVersion:
        return new ExtensionVersionResourceProvider(managementController);
      case RootService:
        return new RootServiceResourceProvider(managementController);
      case RootServiceComponent:
        return new RootServiceComponentResourceProvider(managementController);
      case RootServiceComponentConfiguration:
        return resourceProviderFactory.getRootServiceHostComponentConfigurationResourceProvider();
      case RootServiceHostComponent:
        return new RootServiceHostComponentResourceProvider(managementController);
      case ConfigGroup:
        return new ConfigGroupResourceProvider(managementController);
      case RequestSchedule:
        return new RequestScheduleResourceProvider(managementController);
      case HostComponentProcess:
        return new HostComponentProcessResourceProvider(managementController);
      case Blueprint:
        return new BlueprintResourceProvider(managementController);
      case KerberosDescriptor:
        return resourceProviderFactory.getKerberosDescriptorResourceProvider(managementController);
      case Recommendation:
        return new RecommendationResourceProvider(managementController);
      case Validation:
        return new ValidationResourceProvider(managementController);
      case ClientConfig:
        return new ClientConfigResourceProvider(managementController);
      case RepositoryVersion:
        return resourceProviderFactory.getRepositoryVersionResourceProvider();
      case CompatibleRepositoryVersion:
        return new CompatibleRepositoryVersionResourceProvider(managementController);
      case StackArtifact:
        return new StackArtifactResourceProvider(managementController);
      case Theme:
        return new ThemeArtifactResourceProvider(managementController);
      case QuickLink:
        return new QuickLinkArtifactResourceProvider(managementController);
      case ActiveWidgetLayout:
        return new ActiveWidgetLayoutResourceProvider(managementController);
      case WidgetLayout:
        return new WidgetLayoutResourceProvider(managementController);
      case Widget:
        return new WidgetResourceProvider(managementController);
      case HostKerberosIdentity:
        return resourceProviderFactory.getHostKerberosIdentityResourceProvider(managementController);
      case Credential:
        return resourceProviderFactory.getCredentialResourceProvider(managementController);
      case RoleAuthorization:
        return new RoleAuthorizationResourceProvider(managementController);
      case UserAuthorization:
        return new UserAuthorizationResourceProvider(managementController);
      case VersionDefinition:
        return new VersionDefinitionResourceProvider();
      case ClusterKerberosDescriptor:
        return new ClusterKerberosDescriptorResourceProvider(managementController);
      case LoggingQuery:
        return new LoggingResourceProvider(managementController);
      case AlertTarget:
        return resourceProviderFactory.getAlertTargetResourceProvider();
      case ViewInstance:
        return resourceProviderFactory.getViewInstanceResourceProvider();
      case Auth:
        return resourceProviderFactory.getAuthResourceProvider(managementController);
      default:
        throw new IllegalArgumentException("Unknown type " + type);
    }
  }
Factory method for obtaining a resource provider based on a given type and management controller.

@param type                  the resource type
@param managementController  the management controller

@return a new resource provider
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java