Package org.apache.ambari.view.slider

Source Code of org.apache.ambari.view.slider.SliderAppTypesResourceProvider

/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.ambari.view.slider;

import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.ambari.view.NoSuchResourceException;
import org.apache.ambari.view.ReadRequest;
import org.apache.ambari.view.ResourceAlreadyExistsException;
import org.apache.ambari.view.ResourceProvider;
import org.apache.ambari.view.SystemException;
import org.apache.ambari.view.UnsupportedPropertyException;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.log4j.Logger;

import com.google.inject.Inject;

public class SliderAppTypesResourceProvider implements
    ResourceProvider<SliderAppType> {

  private static final Logger logger = Logger
      .getLogger(SliderAppTypesResourceProvider.class);
  @Inject
  private SliderAppsViewController sliderController;

  @Override
  public void createResource(String resourceId, Map<String, Object> properties)
      throws SystemException, ResourceAlreadyExistsException,
      NoSuchResourceException, UnsupportedPropertyException {
    // TODO Auto-generated method stub
  }

  @Override
  public boolean deleteResource(String resourceId) throws SystemException,
      NoSuchResourceException, UnsupportedPropertyException {
    // TODO Auto-generated method stub
    return false;
  }

  @Override
  public SliderAppType getResource(String appTypeId, Set<String> properties)
      throws SystemException, NoSuchResourceException,
      UnsupportedPropertyException {
      SliderAppType sliderAppType = sliderController.getSliderAppType(appTypeId,
          properties);
      if (sliderAppType == null)
        throw new NoSuchResourceException(appTypeId);
      return sliderAppType;
  }

  @Override
  public Set<SliderAppType> getResources(ReadRequest request)
      throws SystemException, NoSuchResourceException,
      UnsupportedPropertyException {
    Set<SliderAppType> appSet = new HashSet<SliderAppType>();
      List<SliderAppType> sliderAppTypes = sliderController.getSliderAppTypes(request
          .getPropertyIds());
      for (SliderAppType app : sliderAppTypes)
        appSet.add(app);
    return appSet;
  }

  @Override
  public boolean updateResource(String resourceId,
      Map<String, Object> properties) throws SystemException,
      NoSuchResourceException, UnsupportedPropertyException {
    // TODO Auto-generated method stub
    return false;
  }

}
TOP

Related Classes of org.apache.ambari.view.slider.SliderAppTypesResourceProvider

TOP
Copyright © 2018 www.massapi.com. 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.