You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by di...@apache.org on 2016/01/11 20:15:48 UTC
[12/13] ambari git commit: AMBARI-12885: Dynamic stack extensions -
install and upgrade support for custom services (tthorpe via dili)
http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionOperatingSystemService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionOperatingSystemService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionOperatingSystemService.java
new file mode 100644
index 0000000..0acb21d
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionOperatingSystemService.java
@@ -0,0 +1,127 @@
+/**
+ * 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.
+ */
+/**
+ * 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.server.api.services;
+
+import java.util.HashMap;
+import java.util.Map;
+
+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.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Service responsible for operating systems requests.
+ */
+public class ExtensionOperatingSystemService extends BaseService {
+
+ /**
+ * Extra properties to be inserted into created resource.
+ */
+ private Map<Resource.Type, String> parentKeyProperties;
+
+ /**
+ * Constructor.
+ *
+ * @param parentKeyProperties extra properties to be inserted into created resource
+ */
+ public ExtensionOperatingSystemService(Map<Resource.Type, String> parentKeyProperties) {
+ this.parentKeyProperties = parentKeyProperties;
+ }
+
+ /**
+ * Gets all operating systems.
+ * Handles: GET /operating_systems requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ */
+ @GET
+ @Produces("text/plain")
+ public Response getOperatingSystems(@Context HttpHeaders headers, @Context UriInfo ui) {
+ return handleRequest(headers, null, ui, Request.Type.GET, createResource(null));
+ }
+
+ /**
+ * Gets a single operating system.
+ * Handles: GET /operating_systems/{osType} requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ * @param osType os type
+ * @return information regarding the specified operating system
+ */
+ @GET
+ @Path("{osType}")
+ @Produces("text/plain")
+ public Response getOperatingSystem(@Context HttpHeaders headers, @Context UriInfo ui, @PathParam("osType") String osType) {
+ return handleRequest(headers, null, ui, Request.Type.GET, createResource(osType));
+ }
+
+ /**
+ * Handles ANY /{osType}/repositories requests.
+ *
+ * @param osType the os type
+ * @return repositories service
+ */
+ @Path("{osType}/repositories")
+ public ExtensionRepositoryService getOperatingSystemsHandler(@PathParam("osType") String osType) {
+ final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.putAll(parentKeyProperties);
+ mapIds.put(Resource.Type.ExtensionOperatingSystem, osType);
+ return new ExtensionRepositoryService(mapIds);
+ }
+
+ /**
+ * Create an operating system resource instance.
+ *
+ * @param osType os type
+ *
+ * @return an operating system instance
+ */
+ private ResourceInstance createResource(String osType) {
+ final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.putAll(parentKeyProperties);
+ mapIds.put(Resource.Type.ExtensionOperatingSystem, osType);
+ return createResource(Resource.Type.ExtensionOperatingSystem, mapIds);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionRepositoryService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionRepositoryService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionRepositoryService.java
new file mode 100644
index 0000000..494f573
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionRepositoryService.java
@@ -0,0 +1,161 @@
+/**
+ * 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.
+ */
+/**
+ * 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.server.api.services;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+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.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Service responsible for repository requests.
+ */
+public class ExtensionRepositoryService extends BaseService {
+
+ /**
+ * Extra properties to be inserted into created resource.
+ */
+ private Map<Resource.Type, String> parentKeyProperties;
+
+ /**
+ * Constructor.
+ *
+ * @param parentKeyProperties extra properties to be inserted into created resource
+ */
+ public ExtensionRepositoryService(Map<Resource.Type, String> parentKeyProperties) {
+ this.parentKeyProperties = parentKeyProperties;
+ }
+
+ /**
+ * Creates repository.
+ * Handles: POST /repositories requests.
+ *
+ * @param body body
+ * @param headers http headers
+ * @param ui uri info
+ */
+ @POST
+ @Produces("text/plain")
+ public Response createRepository(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
+ return handleRequest(headers, body, ui, Request.Type.POST, createResource(null));
+ }
+
+ /**
+ * Creates repository.
+ * Handles: POST /repositories requests.
+ *
+ *@param body body
+ * @param headers http headers
+ * @param repoId repository id
+ * @param ui uri info
+ */
+ @POST
+ @Path("{repoId}")
+ @Produces("text/plain")
+ public Response createRepository(String body, @Context HttpHeaders headers, @Context UriInfo ui, @PathParam("repoId") String repoId) {
+ return handleRequest(headers, body, ui, Request.Type.POST, createResource(repoId));
+ }
+
+ /**
+ * Gets all repositories.
+ * Handles: GET /repositories requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ */
+ @GET
+ @Produces("text/plain")
+ public Response getRepositories(@Context HttpHeaders headers, @Context UriInfo ui) {
+ return handleRequest(headers, null, ui, Request.Type.GET, createResource(null));
+ }
+
+ /**
+ * Gets a single repository.
+ * Handles: GET /repositories/{repoId} requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ * @param repoId repository id
+ * @return information regarding the specified repository
+ */
+ @GET
+ @Path("{repoId}")
+ @Produces("text/plain")
+ public Response getRepository(@Context HttpHeaders headers, @Context UriInfo ui, @PathParam("repoId") String repoId) {
+ return handleRequest(headers, null, ui, Request.Type.GET, createResource(repoId));
+ }
+
+ /**
+ * Updates a single repository.
+ * Handles: PUT /repositories/{repoId} requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ * @param repoId repository id
+ * @return information regarding the specified repository
+ */
+ @PUT
+ @Path("{repoId}")
+ @Produces("text/plain")
+ public Response updateRepository(String body, @Context HttpHeaders headers, @Context UriInfo ui, @PathParam("repoId") String repoId) {
+ return handleRequest(headers, body, ui, Request.Type.PUT, createResource(repoId));
+ }
+
+ /**
+ * Create a repository resource instance.
+ *
+ * @param repoId repository id
+ *
+ * @return a repository instance
+ */
+ private ResourceInstance createResource(String repoId) {
+ final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.putAll(parentKeyProperties);
+ mapIds.put(Resource.Type.ExtensionRepository, repoId);
+ return createResource(Resource.Type.ExtensionRepository, mapIds);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionRepositoryVersionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionRepositoryVersionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionRepositoryVersionService.java
new file mode 100644
index 0000000..a511425
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionRepositoryVersionService.java
@@ -0,0 +1,160 @@
+/**
+ * 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.server.api.services;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+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.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Service responsible for repository versions requests.
+ */
+public class ExtensionRepositoryVersionService extends BaseService {
+
+ /**
+ * Extra properties to be inserted into created resource.
+ */
+ private Map<Resource.Type, String> parentKeyProperties;
+
+ /**
+ * Constructor.
+ *
+ * @param parentKeyProperties extra properties to be inserted into created resource
+ */
+ public ExtensionRepositoryVersionService(Map<Resource.Type, String> parentKeyProperties) {
+ this.parentKeyProperties = parentKeyProperties;
+ }
+
+ /**
+ * Gets all repository versions.
+ * Handles: GET /repository_versions requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ */
+ @GET
+ @Produces("text/plain")
+ public Response getRepositoryVersions(@Context HttpHeaders headers, @Context UriInfo ui) {
+ return handleRequest(headers, null, ui, Request.Type.GET, createResource(null));
+ }
+
+ /**
+ * Gets a single repository version.
+ * Handles: GET /repository_versions/{repositoryVersionId} requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ * @param repositoryVersionId the repository version id
+ * @return information regarding the specified repository
+ */
+ @GET
+ @Path("{repositoryVersionId}")
+ @Produces("text/plain")
+ public Response getRepositoryVersion(@Context HttpHeaders headers, @Context UriInfo ui,
+ @PathParam("repositoryVersionId") String repositoryVersionId) {
+ return handleRequest(headers, null, ui, Request.Type.GET, createResource(repositoryVersionId));
+ }
+
+ /**
+ * Creates a repository version.
+ * Handles: POST /repository_versions requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ * @return information regarding the created repository
+ */
+ @POST
+ @Produces("text/plain")
+ public Response createRepositoryVersion(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
+ return handleRequest(headers, body, ui, Request.Type.POST, createResource(null));
+ }
+
+ /**
+ * Deletes a repository version. Handles: DELETE /repository_versions/{repositoryVersionId} requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ * @param repositoryVersionId the repository version id
+ * @return information regarding the deleted repository
+ */
+ @DELETE
+ @Path("{repositoryVersionId}")
+ @Produces("text/plain")
+ public Response deleteRepositoryVersion(@Context HttpHeaders headers, @Context UriInfo ui,
+ @PathParam("repositoryVersionId") String repositoryVersionId) {
+ return handleRequest(headers, null, ui, Request.Type.DELETE, createResource(repositoryVersionId));
+ }
+
+ /**
+ * Updates a specific repository version. Handles: PUT /repository_versions/{repositoryVersionId} requests.
+ *
+ * @param headers http headers
+ * @param ui uri info
+ * @param repositoryVersionId the repository version id
+ * @return information regarding the updated repository
+ */
+ @PUT
+ @Path("{repositoryVersionId}")
+ @Produces("text/plain")
+ public Response updateRepositoryVersion(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+ @PathParam("repositoryVersionId") String repositoryVersionId) {
+ return handleRequest(headers, body, ui, Request.Type.PUT, createResource(repositoryVersionId));
+ }
+
+ /**
+ * Handles ANY /{repositoryVersionId}/operating_systems requests.
+ *
+ * @param repositoryVersionId the repository version id
+ * @return operating systems service
+ */
+ @Path("{repositoryVersionId}/operating_systems")
+ public ExtensionOperatingSystemService getOperatingSystemsHandler(@PathParam("repositoryVersionId") String repositoryVersionId) {
+ final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.putAll(parentKeyProperties);
+ mapIds.put(Resource.Type.ExtensionRepositoryVersion, repositoryVersionId);
+ return new ExtensionOperatingSystemService(mapIds);
+ }
+
+ /**
+ * Create a repository version resource instance.
+ *
+ * @param repositoryVersionId repository version id
+ *
+ * @return a repository resource instance
+ */
+ private ResourceInstance createResource(String repositoryVersionId) {
+ final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.putAll(parentKeyProperties);
+ mapIds.put(Resource.Type.ExtensionRepositoryVersion, repositoryVersionId);
+ return createResource(Resource.Type.ExtensionRepositoryVersion, mapIds);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionsService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionsService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionsService.java
new file mode 100644
index 0000000..4c4c423
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionsService.java
@@ -0,0 +1,487 @@
+/**
+ * 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.server.api.services;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+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.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Service for extensions management.
+ */
+@Path("/extensions/")
+public class ExtensionsService extends BaseService {
+
+ @GET
+ @Produces("text/plain")
+ public Response getExtensions(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionResource(null));
+ }
+
+ @GET
+ @Path("{extensionName}")
+ @Produces("text/plain")
+ public Response getExtension(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui,
+ @PathParam("extensionName") String extensionName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionResource(extensionName));
+ }
+
+ @GET
+ @Path("{extensionName}/versions")
+ @Produces("text/plain")
+ public Response getExtensionVersions(String body,
+ @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionVersionResource(extensionName, null));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}")
+ @Produces("text/plain")
+ public Response getExtensionVersion(String body,
+ @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionVersionResource(extensionName, extensionVersion));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/links")
+ @Produces("text/plain")
+ public Response getExtensionVersionLinks(String body,
+ @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionLinkResource(null, null, extensionName, extensionVersion));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/configurations")
+ @Produces("text/plain")
+ public Response getExtensionLevelConfigurations(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionLevelConfigurationsResource(extensionName, extensionVersion, null));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/configurations/{propertyName}")
+ @Produces("text/plain")
+ public Response getExtensionLevelConfiguration(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName,
+ @PathParam("propertyName") String propertyName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionLevelConfigurationsResource(extensionName, extensionVersion, propertyName));
+ }
+
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services")
+ @Produces("text/plain")
+ public Response getExtensionServices(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceResource(extensionName, extensionVersion, null));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}")
+ @Produces("text/plain")
+ public Response getExtensionService(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceResource(extensionName, extensionVersion, serviceName));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/artifacts")
+ @Produces("text/plain")
+ public Response getExtensionArtifacts(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionArtifactsResource(extensionName, extensionVersion, null));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/artifacts/{artifactName}")
+ @Produces("text/plain")
+ public Response getExtensionArtifact(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("artifactName") String artifactName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionArtifactsResource(extensionName, extensionVersion, artifactName));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/artifacts")
+ @Produces("text/plain")
+ public Response getExtensionServiceArtifacts(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceArtifactsResource(extensionName, extensionVersion, serviceName, null));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/themes")
+ @Produces("text/plain")
+ public Response getExtensionServiceThemes(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceThemesResource(extensionName, extensionVersion, serviceName, null));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/themes/{themeName}")
+ @Produces("text/plain")
+ public Response getExtensionServiceTheme(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName,
+ @PathParam("themeName") String themeName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceThemesResource(extensionName, extensionVersion, serviceName, themeName));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/artifacts/{artifactName}")
+ @Produces("text/plain")
+ public Response getExtensionServiceArtifact(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName,
+ @PathParam("artifactName") String artifactName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceArtifactsResource(extensionName, extensionVersion, serviceName, artifactName));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/configurations")
+ @Produces("text/plain")
+ public Response getExtensionConfigurations(String body,
+ @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionConfigurationResource(extensionName, extensionVersion, serviceName, null));
+ }
+
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/configurations/{propertyName}")
+ @Produces("text/plain")
+ public Response getExtensionConfiguration(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName,
+ @PathParam("propertyName") String propertyName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionConfigurationResource(extensionName, extensionVersion, serviceName, propertyName));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/configurations/{propertyName}/dependencies")
+ @Produces("text/plain")
+ public Response getExtensionConfigurationDependencies(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName,
+ @PathParam("propertyName") String propertyName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionConfigurationDependencyResource(extensionName, extensionVersion, serviceName, propertyName));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/components")
+ @Produces("text/plain")
+ public Response getServiceComponents(String body,
+ @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceComponentResource(extensionName, extensionVersion, serviceName, null));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/components/{componentName}/dependencies")
+ @Produces("text/plain")
+ public Response getServiceComponentDependencies(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName,
+ @PathParam("componentName") String componentName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceComponentDependencyResource(extensionName, extensionVersion, serviceName, componentName, null));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/components/{componentName}/dependencies/{dependencyName}")
+ @Produces("text/plain")
+ public Response getServiceComponentDependency(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName,
+ @PathParam("componentName") String componentName,
+ @PathParam("dependencyName") String dependencyName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceComponentDependencyResource(extensionName, extensionVersion, serviceName, componentName, dependencyName));
+ }
+
+ @GET
+ @Path("{extensionName}/versions/{extensionVersion}/services/{serviceName}/components/{componentName}")
+ @Produces("text/plain")
+ public Response getServiceComponent(String body, @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion,
+ @PathParam("serviceName") String serviceName,
+ @PathParam("componentName") String componentName) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionServiceComponentResource(extensionName, extensionVersion, serviceName, componentName));
+ }
+
+ /**
+ * Handles ANY /{extensionName}/versions/{extensionVersion}/operating_systems.
+ *
+ * @param extensionName extension name
+ * @param extensionVersion extension version
+ * @return operating system service
+ */
+ @Path("{extensionName}/versions/{extensionVersion}/operating_systems")
+ public ExtensionOperatingSystemService getOperatingSystemsHandler(@PathParam("extensionName") String extensionName, @PathParam("extensionVersion") String extensionVersion) {
+ final Map<Resource.Type, String> extensionProperties = new HashMap<Resource.Type, String>();
+ extensionProperties.put(Resource.Type.Extension, extensionName);
+ extensionProperties.put(Resource.Type.ExtensionVersion, extensionVersion);
+ return new ExtensionOperatingSystemService(extensionProperties);
+ }
+
+ /**
+ * Handles ANY /{extensionName}/versions/{extensionVersion}/repository_versions.
+ *
+ * @param extensionName extension name
+ * @param extensionVersion extension version
+ * @return repository version service
+ */
+ @Path("{extensionName}/versions/{extensionVersion}/repository_versions")
+ public ExtensionRepositoryVersionService getRepositoryVersionHandler(@PathParam("extensionName") String extensionName, @PathParam("extensionVersion") String extensionVersion) {
+ final Map<Resource.Type, String> extensionProperties = new HashMap<Resource.Type, String>();
+ extensionProperties.put(Resource.Type.Extension, extensionName);
+ extensionProperties.put(Resource.Type.ExtensionVersion, extensionVersion);
+ return new ExtensionRepositoryVersionService(extensionProperties);
+ }
+
+ /**
+ * Handles ANY /{extensionName}/versions/{extensionVersion}/compatible_repository_versions.
+ *
+ * @param extensionName extension name
+ * @param extensionVersion extension version
+ * @return repository version service
+ */
+ @Path("{extensionName}/versions/{extensionVersion}/compatible_repository_versions")
+ public CompatibleExtensionRepositoryVersionService getCompatibleRepositoryVersionHandler(
+ @PathParam("extensionName") String extensionName,
+ @PathParam("extensionVersion") String extensionVersion) {
+ final Map<Resource.Type, String> extensionProperties = new HashMap<Resource.Type, String>();
+ extensionProperties.put(Resource.Type.Extension, extensionName);
+ extensionProperties.put(Resource.Type.ExtensionVersion, extensionVersion);
+ return new CompatibleExtensionRepositoryVersionService(extensionProperties);
+ }
+
+ ResourceInstance createExtensionServiceComponentResource(
+ String extensionName, String extensionVersion, String serviceName, String componentName) {
+
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+ mapIds.put(Resource.Type.ExtensionService, serviceName);
+ mapIds.put(Resource.Type.ExtensionServiceComponent, componentName);
+
+ return createResource(Resource.Type.ExtensionServiceComponent, mapIds);
+ }
+
+ ResourceInstance createExtensionServiceComponentDependencyResource(
+ String extensionName, String extensionVersion, String serviceName, String componentName, String dependencyName) {
+
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+ mapIds.put(Resource.Type.ExtensionService, serviceName);
+ mapIds.put(Resource.Type.ExtensionServiceComponent, componentName);
+ mapIds.put(Resource.Type.ExtensionServiceComponentDependency, dependencyName);
+
+ return createResource(Resource.Type.ExtensionServiceComponentDependency, mapIds);
+ }
+
+ ResourceInstance createExtensionConfigurationResource(String extensionName,
+ String extensionVersion, String serviceName, String propertyName) {
+
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+ mapIds.put(Resource.Type.ExtensionService, serviceName);
+ mapIds.put(Resource.Type.ExtensionConfiguration, propertyName);
+
+ return createResource(Resource.Type.ExtensionConfiguration, mapIds);
+ }
+
+ ResourceInstance createExtensionConfigurationDependencyResource(String extensionName,
+ String extensionVersion, String serviceName, String propertyName) {
+
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+ mapIds.put(Resource.Type.ExtensionService, serviceName);
+ mapIds.put(Resource.Type.ExtensionConfiguration, propertyName);
+
+ return createResource(Resource.Type.ExtensionConfigurationDependency, mapIds);
+ }
+
+ ResourceInstance createExtensionServiceResource(String extensionName,
+ String extensionVersion, String serviceName) {
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+ mapIds.put(Resource.Type.ExtensionService, serviceName);
+
+ return createResource(Resource.Type.ExtensionService, mapIds);
+ }
+
+ ResourceInstance createExtensionVersionResource(String extensionName,
+ String extensionVersion) {
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+
+ return createResource(Resource.Type.ExtensionVersion, mapIds);
+ }
+
+ ResourceInstance createExtensionLevelConfigurationsResource(String extensionName,
+ String extensionVersion, String propertyName) {
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+ mapIds.put(Resource.Type.ExtensionLevelConfiguration, propertyName);
+
+ return createResource(Resource.Type.ExtensionLevelConfiguration, mapIds);
+ }
+
+ ResourceInstance createExtensionArtifactsResource(String extensionName, String extensionVersion, String artifactName) {
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+ mapIds.put(Resource.Type.ExtensionArtifact, artifactName);
+
+ return createResource(Resource.Type.ExtensionArtifact, mapIds);
+ }
+
+ ResourceInstance createExtensionServiceArtifactsResource(String extensionName,
+ String extensionVersion,
+ String serviceName,
+ String artifactName) {
+
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+ mapIds.put(Resource.Type.ExtensionService, serviceName);
+ mapIds.put(Resource.Type.ExtensionArtifact, artifactName);
+
+ return createResource(Resource.Type.ExtensionArtifact, mapIds);
+ }
+
+ ResourceInstance createExtensionServiceThemesResource(String extensionName, String extensionVersion, String serviceName,
+ String themeName) {
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+ mapIds.put(Resource.Type.ExtensionService, serviceName);
+ mapIds.put(Resource.Type.Theme, themeName);
+
+ return createResource(Resource.Type.Theme, mapIds);
+ }
+
+ ResourceInstance createExtensionLinkResource(String stackName, String stackVersion,
+ String extensionName, String extensionVersion) {
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Stack, stackName);
+ mapIds.put(Resource.Type.StackVersion, stackVersion);
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+
+ return createResource(Resource.Type.ExtensionLink, mapIds);
+ }
+
+ ResourceInstance createExtensionResource(String extensionName) {
+
+ return createResource(Resource.Type.Extension,
+ Collections.singletonMap(Resource.Type.Extension, extensionName));
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java
index 76397fb..5623db2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/StacksService.java
@@ -83,6 +83,18 @@ public class StacksService extends BaseService {
}
@GET
+ @Path("{stackName}/versions/{stackVersion}/links")
+ @Produces("text/plain")
+ public Response getStackVersionLinks(String body,
+ @Context HttpHeaders headers,
+ @Context UriInfo ui, @PathParam("stackName") String stackName,
+ @PathParam("stackVersion") String stackVersion) {
+
+ return handleRequest(headers, body, ui, Request.Type.GET,
+ createExtensionLinkResource(stackName, stackVersion, null, null));
+ }
+
+ @GET
@Path("{stackName}/versions/{stackVersion}/configurations")
@Produces("text/plain")
public Response getStackLevelConfigurations(String body, @Context HttpHeaders headers,
@@ -455,6 +467,17 @@ public class StacksService extends BaseService {
return createResource(Resource.Type.Theme, mapIds);
}
+ ResourceInstance createExtensionLinkResource(String stackName, String stackVersion,
+ String extensionName, String extensionVersion) {
+ Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ mapIds.put(Resource.Type.Stack, stackName);
+ mapIds.put(Resource.Type.StackVersion, stackVersion);
+ mapIds.put(Resource.Type.Extension, extensionName);
+ mapIds.put(Resource.Type.ExtensionVersion, extensionVersion);
+
+ return createResource(Resource.Type.ExtensionLink, mapIds);
+ }
+
ResourceInstance createStackResource(String stackName) {
return createResource(Resource.Type.Stack,
http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java
index a925d7d..d7dd401 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java
@@ -113,7 +113,9 @@ public class StackAdvisorHelper {
StackAdvisorRequestType requestType) throws StackAdvisorException {
StackAdvisorCommand<RecommendationResponse> command;
if (requestType == StackAdvisorRequestType.HOST_GROUPS) {
- command = new ComponentLayoutRecommendationCommand(recommendationsDir, stackAdvisorScript,
+ File script = new File(stackAdvisorScript);
+ String layoutScript = new File(script.getParentFile(), "stack_layout_advisor.py").getAbsolutePath();
+ command = new ComponentLayoutRecommendationCommand(recommendationsDir, layoutScript,
requestId, saRunner, metaInfo);
} else if (requestType == StackAdvisorRequestType.CONFIGURATIONS) {
command = new ConfigurationRecommendationCommand(recommendationsDir, stackAdvisorScript,
http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index c31a119..58c89ab 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -127,6 +127,7 @@ public class Configuration {
public static final String RESOURCES_DIR_KEY = "resources.dir";
public static final String METADATA_DIR_PATH = "metadata.path";
public static final String COMMON_SERVICES_DIR_PATH = "common.services.path";
+ public static final String EXTENSIONS_DIR_PATH = "extensions.path";
public static final String SERVER_VERSION_FILE = "server.version.file";
public static final String SERVER_VERSION_KEY = "version";
public static final String JAVA_HOME_KEY = "java.home";
@@ -1096,6 +1097,14 @@ public class Configuration {
return properties.getProperty(COMMON_SERVICES_DIR_PATH);
}
+ /**
+ * Gets ambari extensions-path
+ * @return String
+ */
+ public String getExtensionsPath() {
+ return properties.getProperty(EXTENSIONS_DIR_PATH);
+ }
+
public String getServerVersionFilePath() {
return properties.getProperty(SERVER_VERSION_FILE);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 2ed8f9d..9de0dce 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -78,6 +78,7 @@ import org.apache.ambari.server.state.CommandScriptDefinition;
import org.apache.ambari.server.state.ComponentInfo;
import org.apache.ambari.server.state.ConfigHelper;
import org.apache.ambari.server.state.CustomCommandDefinition;
+import org.apache.ambari.server.state.ExtensionInfo;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.HostComponentAdminState;
import org.apache.ambari.server.state.HostState;
@@ -981,7 +982,7 @@ public class AmbariCustomCommandExecutionHelper {
StackId stackId = cluster.getDesiredStackVersion();
- Map<String, List<RepositoryInfo>> repos = ambariMetaInfo.getRepository(
+ Map<String, List<RepositoryInfo>> repos = ambariMetaInfo.getStackAndExtensionRepository(
stackId.getStackName(), stackId.getStackVersion());
String family = os_family.find(host.getOsType());
http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
index 424678e..f0357c7 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
@@ -31,6 +31,7 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo;
import org.apache.ambari.server.controller.internal.RequestStageContainer;
import org.apache.ambari.server.controller.metrics.timeline.cache.TimelineMetricCacheProvider;
import org.apache.ambari.server.metadata.RoleCommandOrder;
+import org.apache.ambari.server.orm.entities.ExtensionLinkEntity;
import org.apache.ambari.server.scheduler.ExecutionScheduleManager;
import org.apache.ambari.server.security.authorization.AuthorizationException;
import org.apache.ambari.server.security.ldap.LdapBatchDto;
@@ -342,6 +343,34 @@ public interface AmbariManagementController {
public RequestStatusResponse updateStacks() throws AmbariException;
/**
+ * Create an extension link and link the stack to the extension
+ *
+ * @throws AmbariException if we fail to link the extension to the stack
+ */
+ public void createExtensionLink(ExtensionLinkRequest request) throws AmbariException;
+
+ /**
+ * Create an extension link and link the stack to the extension
+ *
+ * @throws AmbariException if we fail to link the extension to the stack
+ */
+ public void updateExtensionLink(ExtensionLinkRequest request) throws AmbariException;
+
+ /**
+ * Create an extension link and link the stack to the extension
+ *
+ * @throws AmbariException if we fail to link the extension to the stack
+ */
+ public void updateExtensionLink(ExtensionLinkEntity linkEntity) throws AmbariException;
+
+ /**
+ * Delete an extension link and link the stack to the extension
+ *
+ * @throws AmbariException if we fail to unlink the extension from the stack
+ */
+ public void deleteExtensionLink(ExtensionLinkRequest request) throws AmbariException;
+
+ /**
* Get supported stacks versions.
*
* @param requests the stacks versions
@@ -352,6 +381,45 @@ public interface AmbariManagementController {
*/
public Set<StackVersionResponse> getStackVersions(Set<StackVersionRequest> requests) throws AmbariException;
+ /**
+ * Get supported extensions.
+ *
+ * @param requests the extensions
+ *
+ * @return a set of extensions responses
+ *
+ * @throws AmbariException if the resources cannot be read
+ */
+ public Set<ExtensionResponse> getExtensions(Set<ExtensionRequest> requests) throws AmbariException;
+
+ /**
+ * Get configurations by extension name, version and service.
+ *
+ * @param requests the configurations
+ *
+ * @return a set of configurations
+ *
+ * @throws AmbariException if the resources cannot be read
+ */
+ public Set<ExtensionConfigurationResponse> getExtensionConfigurations(Set<ExtensionConfigurationRequest> requests) throws AmbariException;
+
+ /**
+ * Get configuration dependencies which are specific for a specific service configuration property
+ * @param requests
+ * @return
+ */
+ Set<ExtensionConfigurationDependencyResponse> getExtensionConfigurationDependencies(Set<ExtensionConfigurationDependencyRequest> requests) throws AmbariException;
+
+ /**
+ * Get supported extension versions.
+ *
+ * @param requests the extension versions
+ *
+ * @return a set of extension versions responses
+ *
+ * @throws AmbariException if the resources cannot be read
+ */
+ public Set<ExtensionVersionResponse> getExtensionVersions(Set<ExtensionVersionRequest> requests) throws AmbariException;
/**
* Get repositories by stack name, version and operating system.
@@ -383,6 +451,35 @@ public interface AmbariManagementController {
public void verifyRepositories(Set<RepositoryRequest> requests) throws AmbariException;
/**
+ * Get repositories by extension name, version and operating system.
+ *
+ * @param requests the repositories
+ *
+ * @return a set of repositories
+ *
+ * @throws AmbariException if the resources cannot be read
+ */
+ public Set<ExtensionRepositoryResponse> getExtensionRepositories(Set<ExtensionRepositoryRequest> requests) throws AmbariException;
+
+ /**
+ * Updates repositories by extension name, version and operating system.
+ *
+ * @param requests the repositories
+ *
+ * @throws AmbariException
+ */
+ public void updateExtensionRepositories(Set<ExtensionRepositoryRequest> requests) throws AmbariException;
+
+ /**
+ * Verifies repositories' base urls.
+ *
+ * @param requests the repositories
+ *
+ * @throws AmbariException if verification of any of urls fails
+ */
+ public void verifyExtensionRepositories(Set<ExtensionRepositoryRequest> requests) throws AmbariException;
+
+ /**
* Get repositories by stack name, version.
*
* @param requests the services
@@ -393,6 +490,17 @@ public interface AmbariManagementController {
*/
public Set<StackServiceResponse> getStackServices(Set<StackServiceRequest> requests) throws AmbariException;
+ /**
+ * Get repositories by extension name, version.
+ *
+ * @param requests the services
+ *
+ * @return a set of services
+ *
+ * @throws AmbariException if the resources cannot be read
+ */
+ public Set<ExtensionServiceResponse> getExtensionServices(Set<ExtensionServiceRequest> requests) throws AmbariException;
+
/**
* Get configurations by stack name, version and service.
@@ -419,6 +527,17 @@ public interface AmbariManagementController {
/**
+ * Get components by extension name, version and service.
+ *
+ * @param requests the components
+ *
+ * @return a set of components
+ *
+ * @throws AmbariException if the resources cannot be read
+ */
+ public Set<ExtensionServiceComponentResponse> getExtensionComponents(Set<ExtensionServiceComponentRequest> requests) throws AmbariException;
+
+ /**
* Get operating systems by stack name, version.
*
* @param requests the operating systems
@@ -430,6 +549,17 @@ public interface AmbariManagementController {
public Set<OperatingSystemResponse> getOperatingSystems(Set<OperatingSystemRequest> requests) throws AmbariException;
/**
+ * Get operating systems by extension name, version.
+ *
+ * @param requests the operating systems
+ *
+ * @return a set of operating systems
+ *
+ * @throws AmbariException if the resources cannot be read
+ */
+ public Set<ExtensionOperatingSystemResponse> getExtensionOperatingSystems(Set<ExtensionOperatingSystemRequest> requests) throws AmbariException;
+
+ /**
* Get all top-level services of Ambari, not related to certain cluster.
*
* @param requests the top-level services
@@ -733,6 +863,14 @@ public interface AmbariManagementController {
public Set<StackConfigurationResponse> getStackLevelConfigurations(Set<StackLevelConfigurationRequest> requests) throws AmbariException;
/**
+ * Get configurations which are specific for a cluster (!not a service).
+ * @param requests
+ * @return
+ * @throws AmbariException
+ */
+ public Set<ExtensionConfigurationResponse> getExtensionLevelConfigurations(Set<ExtensionLevelConfigurationRequest> requests) throws AmbariException;
+
+ /**
* @param serviceInfo service info for a given service
* @param hostParams parameter map. May be changed during method execution
* @param osFamily os family for host