You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2014/05/25 17:49:30 UTC

git commit: AMBARI-5886. Implement app_types endpoint to provide app definitions. (srimanth)

Repository: ambari
Updated Branches:
  refs/heads/trunk 6d8a9c572 -> 2234623b9


AMBARI-5886. Implement app_types endpoint to provide app definitions. (srimanth)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2234623b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2234623b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2234623b

Branch: refs/heads/trunk
Commit: 2234623b938729d842243d0c38fff35602ab141c
Parents: 6d8a9c5
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Sat May 24 23:50:41 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Sun May 25 00:19:05 2014 -0700

----------------------------------------------------------------------
 .../slider/slider/0.30.0/slider-0.30.0.jar      | Bin 1029968 -> 1036988 bytes
 .../apache/ambari/view/slider/SliderApp.java    |   2 +
 .../ambari/view/slider/SliderAppType.java       |  89 +++++++++++++
 .../view/slider/SliderAppTypeComponent.java     | 103 +++++++++++++++
 .../slider/SliderAppTypesResourceProvider.java  |  91 +++++++++++++
 .../view/slider/SliderAppsViewController.java   |   4 +
 .../slider/SliderAppsViewControllerImpl.java    | 131 ++++++++++++++++++-
 .../slider/rest/SliderAppTypesResource.java     |  54 ++++++++
 .../views/slider/src/main/resources/view.xml    |   8 ++
 9 files changed, 479 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2234623b/contrib/views/slider/lib/org/apache/slider/slider/0.30.0/slider-0.30.0.jar
----------------------------------------------------------------------
diff --git a/contrib/views/slider/lib/org/apache/slider/slider/0.30.0/slider-0.30.0.jar b/contrib/views/slider/lib/org/apache/slider/slider/0.30.0/slider-0.30.0.jar
index 6e7b8d1..4bd5833 100644
Binary files a/contrib/views/slider/lib/org/apache/slider/slider/0.30.0/slider-0.30.0.jar and b/contrib/views/slider/lib/org/apache/slider/slider/0.30.0/slider-0.30.0.jar differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/2234623b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java
index 9c9d73b..6f7e45e 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderApp.java
@@ -21,6 +21,8 @@ package org.apache.ambari.view.slider;
 import java.util.Map;
 
 public class SliderApp {
+	public static final String STATE_FROZEN = "FROZEN";
+
 	private String id;
 	private String yarnId;
 	private String name;

http://git-wip-us.apache.org/repos/asf/ambari/blob/2234623b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppType.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppType.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppType.java
new file mode 100644
index 0000000..7c52190
--- /dev/null
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppType.java
@@ -0,0 +1,89 @@
+/**
+ * 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.util.List;
+import java.util.Map;
+
+public class SliderAppType {
+	private String id;
+	private String typeName;
+	private String typeVersion;
+	private String typeDescription;
+	private Map<String, String> typeConfigs;
+	private List<SliderAppTypeComponent> typeComponents;
+	private String typePackageFileName;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getTypeName() {
+		return typeName;
+	}
+
+	public void setTypeName(String name) {
+		this.typeName = name;
+	}
+
+	public String getTypeDescription() {
+		return typeDescription;
+	}
+
+	public void setTypeDescription(String description) {
+		this.typeDescription = description;
+	}
+
+	public Map<String, String> getTypeConfigs() {
+		return typeConfigs;
+	}
+
+	public void setTypeConfigs(Map<String, String> configs) {
+		this.typeConfigs = configs;
+	}
+
+	public List<SliderAppTypeComponent> getTypeComponents() {
+		return typeComponents;
+	}
+
+	public void setTypeComponents(List<SliderAppTypeComponent> components) {
+		this.typeComponents = components;
+	}
+
+	public String getTypeVersion() {
+		return typeVersion;
+	}
+
+	public void setTypeVersion(String version) {
+		this.typeVersion = version;
+	}
+
+	public String getTypePackageFileName() {
+		return typePackageFileName;
+	}
+
+	public void setTypePackageFileName(String typePackageFileName) {
+		this.typePackageFileName = typePackageFileName;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2234623b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppTypeComponent.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppTypeComponent.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppTypeComponent.java
new file mode 100644
index 0000000..aa6c922
--- /dev/null
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppTypeComponent.java
@@ -0,0 +1,103 @@
+/**
+ * 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;
+
+public class SliderAppTypeComponent {
+	private String id;
+	private String name;
+	private String category;
+	private String displayName;
+	private int priority;
+	private int instanceCount;
+	private int maxInstanceCount;
+	private int yarnMemory;
+	private int yarnCpuCores;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getDisplayName() {
+		return displayName;
+	}
+
+	public void setDisplayName(String displayName) {
+		this.displayName = displayName;
+	}
+
+	public int getPriority() {
+		return priority;
+	}
+
+	public void setPriority(int priority) {
+		this.priority = priority;
+	}
+
+	public int getInstanceCount() {
+		return instanceCount;
+	}
+
+	public void setInstanceCount(int instanceCount) {
+		this.instanceCount = instanceCount;
+	}
+
+	public int getYarnMemory() {
+		return yarnMemory;
+	}
+
+	public void setYarnMemory(int yarnMemory) {
+		this.yarnMemory = yarnMemory;
+	}
+
+	public int getYarnCpuCores() {
+		return yarnCpuCores;
+	}
+
+	public void setYarnCpuCores(int yarnCpuCores) {
+		this.yarnCpuCores = yarnCpuCores;
+	}
+
+	public int getMaxInstanceCount() {
+		return maxInstanceCount;
+	}
+
+	public void setMaxInstanceCount(int maxInstanceCount) {
+		this.maxInstanceCount = maxInstanceCount;
+	}
+
+	public String getCategory() {
+		return category;
+	}
+
+	public void setCategory(String category) {
+		this.category = category;
+	}
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2234623b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppTypesResourceProvider.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppTypesResourceProvider.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppTypesResourceProvider.java
new file mode 100644
index 0000000..e696016
--- /dev/null
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppTypesResourceProvider.java
@@ -0,0 +1,91 @@
+/**
+ * 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;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2234623b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java
index 0b368be..da66a3b 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java
@@ -68,4 +68,8 @@ public interface SliderAppsViewController {
 	 */
 	public void deleteSliderApp(String applicationId) throws YarnException,
 	    IOException;
+
+	public SliderAppType getSliderAppType(String appTypeId, Set<String> properties);
+
+	public List<SliderAppType> getSliderAppTypes(Set<String> properties);
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/2234623b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
index 8c3741f..774bf76 100644
--- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java
@@ -18,6 +18,8 @@
 
 package org.apache.ambari.view.slider;
 
+import java.io.File;
+import java.io.FilenameFilter;
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
@@ -27,6 +29,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.zip.ZipException;
 
 import org.apache.ambari.view.ViewContext;
 import org.apache.ambari.view.slider.clients.AmbariClient;
@@ -37,6 +40,8 @@ import org.apache.ambari.view.slider.clients.AmbariService;
 import org.apache.ambari.view.slider.clients.AmbariServiceInfo;
 import org.apache.ambari.view.slider.rest.client.SliderAppMasterClient;
 import org.apache.ambari.view.slider.rest.client.SliderAppMasterClient.SliderAppMasterData;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.io.filefilter.RegexFileFilter;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.hdfs.HdfsConfiguration;
@@ -53,7 +58,15 @@ import org.apache.slider.common.SliderKeys;
 import org.apache.slider.common.tools.SliderFileSystem;
 import org.apache.slider.core.exceptions.UnknownApplicationInstanceException;
 import org.apache.slider.core.main.LauncherExitCodes;
+import org.apache.slider.providers.agent.application.metadata.Component;
+import org.apache.slider.providers.agent.application.metadata.Metainfo;
+import org.apache.slider.providers.agent.application.metadata.MetainfoParser;
+import org.apache.slider.providers.agent.application.metadata.Service;
+import org.apache.tools.zip.ZipFile;
 
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
 
@@ -66,6 +79,13 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
 	private ViewContext viewContext;
 	@Inject
 	private AmbariClient ambariClient;
+	private List<SliderAppType> appTypes;
+
+	private String getAppsFolderPath() {
+		return viewContext
+		    .getAmbariProperty(org.apache.ambari.server.configuration.Configuration.RESOURCES_DIR_KEY)
+		    + "/apps";
+	}
 
 	@Override
 	public ViewStatus getViewStatus() {
@@ -189,7 +209,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
 		if (YarnApplicationState.FINISHED.equals(yarnApp.getYarnApplicationState())) {
 			try {
 				if (sliderClient.actionExists(yarnApp.getName(), false) == LauncherExitCodes.EXIT_SUCCESS)
-					app.setState("FROZEN");
+					app.setState(SliderApp.STATE_FROZEN);
 			} catch (UnknownApplicationInstanceException e) {
 				return null; // Application not in HDFS - means it is not frozen
 			} catch (YarnException e) {
@@ -340,9 +360,10 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
 					super.serviceInit(conf);
 					// Override the default FS client to set the super user.
 					FileSystem fs = FileSystem.get(FileSystem.getDefaultUri(getConfig()),
-					    getConfig(), "hdfs");
+					    getConfig(), "yarn");
 					SliderFileSystem fileSystem = new SliderFileSystem(fs, getConfig());
-					Field fsField = SliderClient.class.getDeclaredField("sliderFileSystem");
+					Field fsField = SliderClient.class
+					    .getDeclaredField("sliderFileSystem");
 					fsField.setAccessible(true);
 					fsField.set(this, fileSystem);
 				}
@@ -456,4 +477,108 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
 			Thread.currentThread().setContextClassLoader(currentClassLoader);
 		}
 	}
+
+	@Override
+	public SliderAppType getSliderAppType(String appTypeId, Set<String> properties) {
+		List<SliderAppType> appTypes = getSliderAppTypes(properties);
+		if (appTypeId != null && appTypes != null) {
+			for (SliderAppType appType : appTypes)
+				if (appTypeId != null && appTypeId.equals(appType.getId()))
+					return appType;
+		}
+		return null;
+	}
+
+	@Override
+	public List<SliderAppType> getSliderAppTypes(Set<String> properties) {
+		if (appTypes == null)
+			appTypes = loadAppTypes();
+		return appTypes;
+	}
+
+	private List<SliderAppType> loadAppTypes() {
+		List<SliderAppType> appTypes = null;
+		String appsFolderPath = getAppsFolderPath();
+		File appsFolder = new File(appsFolderPath);
+		if (appsFolder.exists()) {
+			File[] appZips = appsFolder
+			    .listFiles((FilenameFilter) new RegexFileFilter("^.*\\.zip$"));
+			if (appZips != null) {
+				appTypes = new ArrayList<SliderAppType>();
+				for (File appZip : appZips) {
+					try {
+						ZipFile zipFile = new ZipFile(appZip);
+						Metainfo metainfo = new MetainfoParser().parse(zipFile
+						    .getInputStream(zipFile.getEntry("metainfo.xml")));
+						// Create app type object
+						if (metainfo.getServices() != null
+						    && metainfo.getServices().size() > 0) {
+							Service service = metainfo.getServices().get(0);
+							String appConfigJsonString = IOUtils.toString(
+							    zipFile.getInputStream(zipFile.getEntry("appConfig.json")),
+							    "UTF-8");
+							String resourcesJsonString = IOUtils.toString(
+							    zipFile.getInputStream(zipFile.getEntry("resources.json")),
+							    "UTF-8");
+							JsonElement appConfigJson = new JsonParser()
+							    .parse(appConfigJsonString);
+							JsonElement resourcesJson = new JsonParser()
+							    .parse(resourcesJsonString);
+							SliderAppType appType = new SliderAppType();
+							appType.setId(service.getName());
+							appType.setTypeName(service.getName());
+							appType.setTypeDescription(service.getComment());
+							appType.setTypeVersion(service.getVersion());
+							appType.setTypePackageFileName(appZip.getName());
+							// Configs
+							Map<String, String> configsMap = new HashMap<String, String>();
+							JsonObject appTypeGlobalJson = appConfigJson.getAsJsonObject()
+							    .get("global").getAsJsonObject();
+							for (Entry<String, JsonElement> e : appTypeGlobalJson.entrySet())
+								configsMap.put(e.getKey(), e.getValue().getAsString());
+							appType.setTypeConfigs(configsMap);
+							// Components
+							ArrayList<SliderAppTypeComponent> appTypeComponentList = new ArrayList<SliderAppTypeComponent>();
+							for (Component component : service.getComponents()) {
+								SliderAppTypeComponent appTypeComponent = new SliderAppTypeComponent();
+								appTypeComponent.setDisplayName(component.getName());
+								appTypeComponent.setId(component.getName());
+								appTypeComponent.setName(component.getName());
+								appTypeComponent.setYarnMemory(1024);
+								appTypeComponent.setYarnCpuCores(1);
+								// appTypeComponent.setPriority(component.);
+								if (component.getMinInstanceCount() != null)
+									appTypeComponent.setInstanceCount(Integer.parseInt(component
+									    .getMinInstanceCount()));
+								if (component.getMaxInstanceCount() != null)
+									appTypeComponent.setMaxInstanceCount(Integer
+									    .parseInt(component.getMaxInstanceCount()));
+								if (resourcesJson != null) {
+									JsonElement componentJson = resourcesJson.getAsJsonObject()
+									    .get("components").getAsJsonObject()
+									    .get(component.getName());
+									if (componentJson != null
+									    && componentJson.getAsJsonObject().has(
+									        "yarn.role.priority")) {
+										appTypeComponent.setPriority(Integer.parseInt(componentJson
+										    .getAsJsonObject().get("yarn.role.priority")
+										    .getAsString()));
+									}
+								}
+								appTypeComponent.setCategory(component.getCategory());
+								appTypeComponentList.add(appTypeComponent);
+							}
+							appType.setTypeComponents(appTypeComponentList);
+							appTypes.add(appType);
+						}
+					} catch (ZipException e) {
+						logger.warn("Unable to parse app " + appZip.getAbsolutePath(), e);
+					} catch (IOException e) {
+						logger.warn("Unable to parse app " + appZip.getAbsolutePath(), e);
+					}
+				}
+			}
+		}
+		return appTypes;
+	}
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/2234623b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppTypesResource.java
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppTypesResource.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppTypesResource.java
new file mode 100644
index 0000000..fa2a71c
--- /dev/null
+++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/rest/SliderAppTypesResource.java
@@ -0,0 +1,54 @@
+/**
+ * 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.rest;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.view.ViewResourceHandler;
+
+import com.google.inject.Inject;
+
+public class SliderAppTypesResource {
+
+	@Inject
+	ViewResourceHandler resourceHandler;
+
+	@GET
+	@Produces({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
+	public Response getApps(@Context HttpHeaders headers, @Context UriInfo uri) {
+		return resourceHandler.handleRequest(headers, uri, null);
+	}
+
+	@GET
+	@Path("{appTypeId}")
+	@Produces({ MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
+	public Response getApp(@Context HttpHeaders headers, @Context UriInfo uri,
+	    @PathParam("appTypeId") String appTypeId) {
+		return resourceHandler.handleRequest(headers, uri, appTypeId);
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/2234623b/contrib/views/slider/src/main/resources/view.xml
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/view.xml b/contrib/views/slider/src/main/resources/view.xml
index c960e15..57499ce 100644
--- a/contrib/views/slider/src/main/resources/view.xml
+++ b/contrib/views/slider/src/main/resources/view.xml
@@ -33,4 +33,12 @@ limitations under the License. Kerberos, LDAP, Custom. Binary/Htt
     <provider-class>org.apache.ambari.view.slider.SliderAppsResourceProvider</provider-class>
     <service-class>org.apache.ambari.view.slider.rest.SliderAppsResource</service-class>
   </resource>
+  <resource>
+    <name>apptype</name>
+    <plural-name>apptypes</plural-name>
+    <id-property>id</id-property>
+    <resource-class>org.apache.ambari.view.slider.SliderAppType</resource-class>
+    <provider-class>org.apache.ambari.view.slider.SliderAppTypesResourceProvider</provider-class>
+    <service-class>org.apache.ambari.view.slider.rest.SliderAppTypesResource</service-class>
+  </resource>
 </view>
\ No newline at end of file