public Optional<ServiceInfo> getServiceInfo(String serviceName) {
    try {
      return Optional.of(controller.getAmbariMetaInfo().getService(getName(), getVersion(), serviceName));
    } catch (AmbariException e) {
      return Optional.empty();
    }
  }
@return an optional ServiceInfo of the given serviceName or Optional.empty() if the service doesn't exist in the stack
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/Stack.java