public int setComponentState(String serviceName, String componentName, String state) {
    StateProvider.State s = state.equals("STARTED") ? StateProvider.State.Running :
        state.equals("INSTALLED") ? StateProvider.State.Stopped : StateProvider.State.Unknown;

    int requestId = -1;
    if (!isClientOnlyComponent(componentName)) {
      if (s != StateProvider.State.Unknown) {
        Map<String, Set<String>> serviceHostComponents = hostComponents.get(serviceName);
        if (serviceHostComponents != null) {

          for (Map.Entry<String, Set<String>> entry : serviceHostComponents.entrySet()) {
            String      hostName       = entry.getKey();
            Set<String> componentNames = entry.getValue();

            for (String name : componentNames) {
              if (name.equals(componentName)) {
                if(state.equals(getHostComponentState(hostName, componentName))) continue;
                requestId = recordProcess(stateProvider.setRunningState(hostName, componentName, s), requestId,
                        "Set component " + componentName + " state to " + s);
              }
            }
          }
        }
      }
    }
    return requestId;
  }
Set the component state for the given service name.

@param serviceName    the service name
@param componentName  the component name
@param state          the state

@return the request id
contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/msi/ClusterDefinition.java