Package org.apache.ambari.server.state

Examples of org.apache.ambari.server.state.ServiceInfo


  }

  public Set<PropertyInfo> getProperties(String stackName, String version, String serviceName)
      throws AmbariException {

    ServiceInfo serviceInfo = getServiceInfo(stackName, version, serviceName);
    List<PropertyInfo> properties = serviceInfo.getProperties();
    Set<PropertyInfo> propertiesResult = new HashSet<PropertyInfo>(properties);

    return propertiesResult;
  }
View Full Code Here


        File[] servicesFolders = servicesRootFolder.listFiles(FILENAME_FILTER);

        if (servicesFolders != null) {
          for (File serviceFolder : servicesFolders) {
            // Get information about service
            ServiceInfo serviceInfo = new ServiceInfo();
            serviceInfo.setName(serviceFolder.getName());
            stackInfo.getServices().add(serviceInfo);

            if (LOG.isDebugEnabled()) {
              LOG.debug("Adding new service to stack"
                  + ", stackName=" + stackFolder.getName()
                  + ", stackVersion=" + stack.getName()
                  + ", serviceName=" + serviceInfo.getName());
            }

            // Get metainfo data from metainfo.xml
            File metainfoFile = new File(serviceFolder.getAbsolutePath()
                + File.separator + SERVICE_METAINFO_FILE_NAME);
            if (metainfoFile.exists()) {
              setMetaInfo(metainfoFile, serviceInfo);
            }

            // Get all properties from all "configs/*-site.xml" files
            File serviceConfigFolder = new File(serviceFolder.getAbsolutePath()
                + File.separator + SERVICE_CONFIG_FOLDER_NAME);
            File[] configFiles = serviceConfigFolder.listFiles(FILENAME_FILTER);
            if (configFiles != null) {
              for (File config : configFiles) {
                if (config.getName().endsWith(SERVICE_CONFIG_FILE_NAME_POSTFIX)) {
                  serviceInfo.getProperties().addAll(getProperties(config));
                }
              }
            }
          }
        }
View Full Code Here

   * Method: getServiceInfo(String stackName, String version, String
   * serviceName)
   */
  @Test
  public void getServiceInfo() throws Exception {
    ServiceInfo si = metaInfo.getServiceInfo(STACK_NAME_HDP, STACK_VERSION_HDP,
        SERVICE_NAME_HDFS);
    assertNotNull(si);
  }
View Full Code Here

   * @throws AmbariException
   */
  public List<ComponentInfo> getComponentsByService(String stackName,
                                                    String version, String serviceName) throws AmbariException {
    List<ComponentInfo> componentsResult = null;
    ServiceInfo service = getServiceInfo(stackName, version, serviceName);
    if (service != null)
      componentsResult = service.getComponents();

    return componentsResult;
  }
View Full Code Here

  public boolean isValidService(String stackName, String version,
                                String serviceName) throws AmbariException {

    boolean exist = false;
    try {
      ServiceInfo info= getServiceInfo(stackName, version, serviceName);
      if (info != null) {
        exist = true;
      }
    } catch (ObjectNotFoundException e) {
    }
View Full Code Here

  /*
   * support isValidService(), isValidComponent for a given stack/version
   */
  public boolean isValidServiceComponent(String stackName, String version,
                                         String serviceName, String componentName) throws AmbariException {
    ServiceInfo service = getServiceInfo(stackName, version, serviceName);
    if (service == null) {
      return false;
    }
    for (ComponentInfo compInfo : service.getComponents()) {
      if (compInfo.getName().equals(componentName)) {
        return true;
      }
    }
    return false;
View Full Code Here

   */
  public Map<String, Map<String, String>> getSupportedConfigs(String stackName,
                                                              String version, String serviceName) throws AmbariException {
    Map<String, Map<String, String>> propertiesResult = new HashMap<String, Map<String, String>>();

    ServiceInfo service = getServiceInfo(stackName, version, serviceName);
    if (service != null)
      if (serviceName.equals(service.getName())) {
        List<PropertyInfo> properties = service.getProperties();
        if (properties != null)
          for (PropertyInfo propertyInfo : properties) {
            Map<String, String> fileProperties = propertiesResult
                .get(propertyInfo.getFilename());
            if (fileProperties == null) {
View Full Code Here

    Map<String, ServiceInfo> services = getServices(stackName, version);

    if (services.size() == 0)
      throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName);

    ServiceInfo serviceInfo = services.get(serviceName);

    if (serviceInfo == null)
      throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName);

    return serviceInfo;
View Full Code Here

  }

  public ServiceInfo getServiceInfo(String stackName, String version,
                                    String serviceName) throws AmbariException {
    ServiceInfo serviceInfoResult = null;
    List<ServiceInfo> services = null;
    StackInfo stack = getStackInfo(stackName, version);
    if (stack == null)
      return null;
    services = stack.getServices();
View Full Code Here

  }

  public Set<PropertyInfo> getProperties(String stackName, String version, String serviceName)
      throws AmbariException {

    ServiceInfo serviceInfo = getServiceInfo(stackName, version, serviceName);
    List<PropertyInfo> properties = serviceInfo.getProperties();
    Set<PropertyInfo> propertiesResult = new HashSet<PropertyInfo>(properties);

    return propertiesResult;
  }
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.state.ServiceInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.