You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2017/09/26 05:20:36 UTC
[45/50] [abbrv] ambari git commit: AMBARI-22046. Infra Manager:
Integrate with Spring Boot (oleewere)
AMBARI-22046. Infra Manager: Integrate with Spring Boot (oleewere)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6633a7bd
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6633a7bd
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6633a7bd
Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 6633a7bd44fcbc660956a7e188e2ac63472c6de3
Parents: 520d8fc
Author: Oliver Szabo <ol...@gmail.com>
Authored: Sun Sep 24 14:22:14 2017 +0200
Committer: Oliver Szabo <ol...@gmail.com>
Committed: Mon Sep 25 20:18:03 2017 +0200
----------------------------------------------------------------------
ambari-infra/ambari-infra-manager/.gitignore | 2 +
.../ambari-infra-manager/docker/bin/start.sh | 2 +-
ambari-infra/ambari-infra-manager/pom.xml | 172 ++++++++-------
.../org/apache/ambari/infra/InfraManager.java | 208 +++----------------
.../infra/common/InfraManagerConstants.java | 31 ---
.../infra/conf/InfraManagerDataConfig.java | 37 ++++
.../conf/InfraManagerJerseyResourceConfig.java | 37 ++++
.../infra/conf/InfraManagerServletConfig.java | 83 ++++++++
.../infra/conf/StaticResourceConfiguration.java | 49 +++++
.../infra/doc/InfraManagerApiDocStorage.java | 90 ++++++++
.../ambari/infra/job/dummy/DummyItemWriter.java | 15 +-
.../ambari/infra/rest/ApiDocResource.java | 56 +++++
.../src/main/resources/infra-manager.properties | 4 +-
.../src/main/resources/log4j.xml | 31 ---
.../src/main/resources/log4j2.xml | 41 ++++
.../src/main/resources/static/index.html | 24 +++
.../src/main/resources/swagger/swagger.html | 36 ++--
.../src/main/resources/webapp/index.html | 24 ---
18 files changed, 556 insertions(+), 386 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/.gitignore
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/.gitignore b/ambari-infra/ambari-infra-manager/.gitignore
new file mode 100644
index 0000000..ba4e51d
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/.gitignore
@@ -0,0 +1,2 @@
+out/*
+*.pid
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/docker/bin/start.sh
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/docker/bin/start.sh b/ambari-infra/ambari-infra-manager/docker/bin/start.sh
index 076c06f..2402778 100755
--- a/ambari-infra/ambari-infra-manager/docker/bin/start.sh
+++ b/ambari-infra/ambari-infra-manager/docker/bin/start.sh
@@ -16,6 +16,6 @@
export INFRA_MANAGER_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=5007,server=y,suspend=n"
touch /root/infra-manager.log
-/root/ambari-infra-manager/infraManager.sh --port 61890 > /root/infra-manager.log
+/root/ambari-infra-manager/infraManager.sh > /root/infra-manager.log
tail -f /root/infra-manager.log
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/pom.xml b/ambari-infra/ambari-infra-manager/pom.xml
index b9f2a77..aa86da8 100644
--- a/ambari-infra/ambari-infra-manager/pom.xml
+++ b/ambari-infra/ambari-infra-manager/pom.xml
@@ -30,15 +30,17 @@
<artifactId>ambari-infra-manager</artifactId>
<properties>
- <spring.version>4.2.5.RELEASE</spring.version>
- <spring.security.version>4.0.4.RELEASE</spring.security.version>
- <jersey.version>2.23.2</jersey.version>
- <jetty-version>9.2.11.v20150529</jetty-version>
- <swagger.version>1.5.8</swagger.version>
- <spring-data-solr.version>2.0.2.RELEASE</spring-data-solr.version>
- <jjwt.version>0.6.0</jjwt.version>
+ <spring.version>4.3.10.RELEASE</spring.version>
+ <spring.security.version>4.2.3.RELEASE</spring.security.version>
+ <spring.ldap.version>2.0.4.RELEASE</spring.ldap.version>
+ <jersey.version>2.25.1</jersey.version>
+ <jetty.version>9.4.6.v20170531</jetty.version>
<spring-batch.version>3.0.7.RELEASE</spring-batch.version>
<sqlite.version>3.8.11.2</sqlite.version>
+ <spring-data-solr.version>2.0.2.RELEASE</spring-data-solr.version>
+ <spring-boot.version>1.5.6.RELEASE</spring-boot.version>
+ <swagger.version>1.5.16</swagger.version>
+ <jjwt.version>0.6.0</jjwt.version>
</properties>
<build>
@@ -69,6 +71,21 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring-boot.version}</version>
+ <configuration>
+ <classifier>exec</classifier>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
@@ -161,53 +178,70 @@
<artifactId>spring-security-ldap</artifactId>
<version>${spring.security.version}</version>
</dependency>
+
<dependency>
- <groupId>org.glassfish.jersey.ext</groupId>
- <artifactId>jersey-spring3</artifactId>
- <version>2.23.2</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>${spring-boot.version}</version>
<exclusions>
<exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>*</artifactId>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.connectors</groupId>
- <artifactId>jersey-apache-connector</artifactId>
- <version>${jersey.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ <version>${spring-boot.version}</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- <version>${jersey.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <version>${spring-boot.version}</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-json-jettison</artifactId>
- <version>${jersey.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-security</artifactId>
+ <version>${spring-boot.version}</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-json-jackson</artifactId>
- <version>${jersey.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ <version>${spring-boot.version}</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-common</artifactId>
- <version>${jersey.version}</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jetty</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-jersey</artifactId>
+ <version>${spring-boot.version}</version>
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.1.0</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-freemarker</artifactId>
+ <version>${spring-boot.version}</version>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-autoconfigure</artifactId>
+ <version>${spring-boot.version}</version>
</dependency>
<dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <version>${spring-boot.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jettison</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId>
<version>${solr.version}</version>
@@ -267,6 +301,10 @@
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -303,53 +341,6 @@
<version>1.0.1.RELEASE</version>
</dependency>
<dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlet</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-servlets</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>${jetty-version}</version>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-webapp</artifactId>
- <version>${jetty-version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-annotations</artifactId>
- <version>${jetty-version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>*</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.2.4</version>
@@ -386,11 +377,6 @@
<version>2.1.0</version>
</dependency>
<dependency>
- <groupId>org.springframework.data</groupId>
- <artifactId>spring-data-solr</artifactId>
- <version>${spring-data-solr.version}</version>
- </dependency>
- <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
@@ -411,11 +397,6 @@
<version>${jjwt.version}</version>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.ext</groupId>
- <artifactId>jersey-bean-validation</artifactId>
- <version>2.25</version>
- </dependency>
- <dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>${sqlite.version}</version>
@@ -424,6 +405,17 @@
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-admin-manager</artifactId>
<version>1.3.1.RELEASE</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <artifactId>guava</artifactId>
+ <groupId>com.google.guava</groupId>
+ <version>20.0</version>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
index 186f98c..185e344 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/InfraManager.java
@@ -18,192 +18,32 @@
*/
package org.apache.ambari.infra;
-import org.apache.ambari.infra.conf.InfraManagerConfig;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.handler.HandlerList;
-import org.eclipse.jetty.server.handler.ResourceHandler;
-import org.eclipse.jetty.servlet.DefaultServlet;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.util.resource.Resource;
-import org.eclipse.jetty.util.resource.ResourceCollection;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.context.ContextLoaderListener;
-import org.springframework.web.context.request.RequestContextListener;
-import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-
-import static org.apache.ambari.infra.common.InfraManagerConstants.DATA_FOLDER_LOCATION_PARAM;
-import static org.apache.ambari.infra.common.InfraManagerConstants.DEFAULT_DATA_FOLDER_LOCATION;
-import static org.apache.ambari.infra.common.InfraManagerConstants.DEFAULT_PORT;
-import static org.apache.ambari.infra.common.InfraManagerConstants.DEFAULT_PROTOCOL;
-import static org.apache.ambari.infra.common.InfraManagerConstants.INFRA_MANAGER_SESSION_ID;
-import static org.apache.ambari.infra.common.InfraManagerConstants.PROTOCOL_SSL;
-import static org.apache.ambari.infra.common.InfraManagerConstants.ROOT_CONTEXT;
-import static org.apache.ambari.infra.common.InfraManagerConstants.SESSION_TIMEOUT;
-import static org.apache.ambari.infra.common.InfraManagerConstants.WEB_RESOURCE_FOLDER;
-
+import org.springframework.boot.Banner;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration;
+import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration;
+import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
+import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.system.ApplicationPidFileWriter;
+
+@SpringBootApplication(
+ scanBasePackages = {"org.apache.ambari.infra"},
+ exclude = {
+ RepositoryRestMvcAutoConfiguration.class,
+ WebMvcAutoConfiguration.class,
+ BatchAutoConfiguration.class,
+ SecurityAutoConfiguration.class
+ }
+)
public class InfraManager {
- private static final Logger LOG = LoggerFactory.getLogger(InfraManager.class);
-
public static void main(String[] args) {
- Options options = new Options();
- HelpFormatter helpFormatter = new HelpFormatter();
- helpFormatter.setDescPadding(10);
- helpFormatter.setWidth(200);
-
- final Option helpOption = Option.builder("h")
- .longOpt("help")
- .desc("Print commands")
- .build();
-
- final Option portOption = Option.builder("p")
- .longOpt("port")
- .desc("Infra Manager port")
- .numberOfArgs(1)
- .argName("port_number")
- .build();
-
- final Option dataFolderOption = Option.builder("df")
- .longOpt("data-folder")
- .desc("Infra Manager data folder location")
- .numberOfArgs(1)
- .argName("data_folder")
- .build();
-
- final Option protocolOption = Option.builder("t")
- .longOpt("tls-enabled")
- .desc("TLS enabled for Infra Manager")
- .build();
-
- options.addOption(helpOption);
- options.addOption(portOption);
- options.addOption(protocolOption);
- options.addOption(dataFolderOption);
-
- try {
- CommandLineParser cmdLineParser = new DefaultParser();
- CommandLine cli = cmdLineParser.parse(options, args);
- int port = cli.hasOption('p') ? Integer.parseInt(cli.getOptionValue('p')) : DEFAULT_PORT;
- String protocol = cli.hasOption("t") ? PROTOCOL_SSL : DEFAULT_PROTOCOL;
- String dataFolder = cli.hasOption("df") ? cli.getOptionValue("df"): DEFAULT_DATA_FOLDER_LOCATION;
-
- System.setProperty(DATA_FOLDER_LOCATION_PARAM, dataFolder); // be able to access it from jobs
-
- Server server = buildServer(port, protocol);
- HandlerList handlers = new HandlerList();
- handlers.addHandler(createSwaggerContext());
- handlers.addHandler(createBaseWebappContext(dataFolder));
-
- server.setHandler(handlers);
- server.start();
-
- LOG.debug("============================Server Dump=======================================");
- LOG.debug(server.dump());
- LOG.debug("==============================================================================");
- server.join();
- } catch (Exception e) {
- // TODO
- e.printStackTrace();
- }
- }
-
- private static Server buildServer(int port, String protocol) {
- Server server = new Server();
- HttpConfiguration httpConfiguration = new HttpConfiguration();
- httpConfiguration.setRequestHeaderSize(65535);
- // TODO: tls
- ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory(httpConfiguration));
- connector.setPort(port);
- server.setConnectors(new Connector[]{connector});
- URI infraManagerURI = URI.create(String.format("%s://0.0.0.0:%s", protocol, String.valueOf(port)));
- LOG.info("Starting infra manager URI=" + infraManagerURI);
- return server;
- }
-
- private static WebAppContext createBaseWebappContext(String dataFolder) throws MalformedURLException {
- URI webResourceBase = findWebResourceBase();
- WebAppContext context = new WebAppContext();
- ResourceCollection resources = new ResourceCollection(Resource.newResource(webResourceBase));
- context.setBaseResource(resources);
- context.setContextPath(ROOT_CONTEXT);
- context.setParentLoaderPriority(true);
-
- // Data folder servlet
- ServletHolder dataServlet = new ServletHolder("static-data", DefaultServlet.class);
- dataServlet.setInitParameter("dirAllowed","true");
- dataServlet.setInitParameter("pathInfoOnly","true");
- dataServlet.setInitParameter("resourceBase", dataFolder);
-
- context.addServlet(dataServlet,"/files/*");
-
- // Configure Spring
- context.addEventListener(new ContextLoaderListener());
- context.addEventListener(new RequestContextListener());
- // TODO: security, add: context.addFilter(new FilterHolder(new DelegatingFilterProxy("springSecurityFilterChain")), "/*", EnumSet.allOf(DispatcherType.class));
- context.setInitParameter("contextClass", AnnotationConfigWebApplicationContext.class.getName());
- context.setInitParameter("contextConfigLocation", InfraManagerConfig.class.getName());
-
- // Configure Jersey
- ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/api/v1/*");
- jerseyServlet.setInitOrder(1);
- jerseyServlet.setInitParameter("jersey.config.server.provider.packages","org.apache.ambari.infra.rest,io.swagger.jaxrs.listing");
-
- context.getSessionHandler().getSessionManager().setMaxInactiveInterval(SESSION_TIMEOUT);
- context.getSessionHandler().getSessionManager().getSessionCookieConfig().setName(INFRA_MANAGER_SESSION_ID);
-
- return context;
- }
-
- private static URI findWebResourceBase() {
- URL fileCompleteUrl = Thread.currentThread().getContextClassLoader().getResource(WEB_RESOURCE_FOLDER);
- String errorMessage = "Web Resource Folder " + WEB_RESOURCE_FOLDER + " not found in classpath";
- if (fileCompleteUrl != null) {
- try {
- return fileCompleteUrl.toURI().normalize();
- } catch (URISyntaxException e) {
- LOG.error(errorMessage, e);
- System.exit(1);
- }
- } else {
- LOG.error(errorMessage);
- System.exit(1);
- }
- throw new IllegalStateException(errorMessage);
- }
-
- private static ServletContextHandler createSwaggerContext() throws URISyntaxException {
- ResourceHandler resourceHandler = new ResourceHandler();
- ResourceCollection resources = new ResourceCollection(new String[] {
- InfraManager.class.getClassLoader()
- .getResource("META-INF/resources/webjars/swagger-ui/2.1.0")
- .toURI().toString(),
- InfraManager.class.getClassLoader()
- .getResource("swagger")
- .toURI().toString()
- });
- resourceHandler.setBaseResource(resources);
- resourceHandler.setWelcomeFiles(new String[]{"swagger.html"}); // rewrite index.html from swagger-ui webjar
- ServletContextHandler context = new ServletContextHandler();
- context.setContextPath("/docs/");
- context.setHandler(resourceHandler);
- return context;
+ String pidFile = System.getenv("PID_FILE") == null ? "infra-manager.pid" : System.getenv("PID_FILE");
+ new SpringApplicationBuilder(InfraManager.class)
+ .bannerMode(Banner.Mode.OFF)
+ .listeners(new ApplicationPidFileWriter(pidFile))
+ .web(true)
+ .run(args);
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/common/InfraManagerConstants.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/common/InfraManagerConstants.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/common/InfraManagerConstants.java
deleted file mode 100644
index 105f20e..0000000
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/common/InfraManagerConstants.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.infra.common;
-
-public final class InfraManagerConstants {
- public static final int DEFAULT_PORT = 61890;
- public static final String DEFAULT_PROTOCOL = "http";
- public static final String INFRA_MANAGER_SESSION_ID = "INFRA_MANAGER_SESSIONID";
- public static final String PROTOCOL_SSL = "https";
- public static final String ROOT_CONTEXT = "/";
- public static final String WEB_RESOURCE_FOLDER = "webapp";
- public static final String DEFAULT_DATA_FOLDER_LOCATION = "/opt/ambari-infra-manager/data";
- public static final String DATA_FOLDER_LOCATION_PARAM = "dataFolderLocation";
- public static final Integer SESSION_TIMEOUT = 60 * 30;
-}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerDataConfig.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerDataConfig.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerDataConfig.java
new file mode 100644
index 0000000..b5b215e
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerDataConfig.java
@@ -0,0 +1,37 @@
+/*
+ * 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.infra.conf;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class InfraManagerDataConfig {
+
+ @Value("${infra-manager.server.data.folder:/opt/ambari-infra-manager/data}")
+ private String dataFolder;
+
+ public String getDataFolder() {
+ return dataFolder;
+ }
+
+ public void setDataFolder(String dataFolder) {
+ this.dataFolder = dataFolder;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerJerseyResourceConfig.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerJerseyResourceConfig.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerJerseyResourceConfig.java
new file mode 100644
index 0000000..3a4c00f
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerJerseyResourceConfig.java
@@ -0,0 +1,37 @@
+/*
+ * 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.infra.conf;
+
+import org.apache.ambari.infra.rest.JobResource;
+import org.glassfish.jersey.jackson.JacksonFeature;
+import org.glassfish.jersey.server.ResourceConfig;
+import org.glassfish.jersey.servlet.ServletProperties;
+
+import javax.ws.rs.ApplicationPath;
+
+@ApplicationPath("/api/v1")
+public class InfraManagerJerseyResourceConfig extends ResourceConfig {
+
+ public InfraManagerJerseyResourceConfig() {
+ packages(JobResource.class.getPackage().getName());
+ register(JacksonFeature.class);
+ property(ServletProperties.FILTER_FORWARD_ON_404, true);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerServletConfig.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerServletConfig.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerServletConfig.java
new file mode 100644
index 0000000..06aea79
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/InfraManagerServletConfig.java
@@ -0,0 +1,83 @@
+/*
+ * 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.infra.conf;
+
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.DefaultServlet;
+import org.glassfish.jersey.servlet.ServletContainer;
+import org.glassfish.jersey.servlet.ServletProperties;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.web.ServerProperties;
+import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
+import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer;
+import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import javax.inject.Inject;
+
+@Configuration
+public class InfraManagerServletConfig {
+
+ private static final Integer SESSION_TIMEOUT = 60 * 30;
+ private static final String INFRA_MANAGER_SESSIONID = "INFRAMANAGER_SESSIONID";
+ private static final String INFRA_MANAGER_APPLICATION_NAME = "infra-manager";
+
+ @Value("${infra-manager.server.port:61890}")
+ private int port;
+
+ @Inject
+ private ServerProperties serverProperties;
+
+ @Inject
+ private InfraManagerDataConfig infraManagerDataConfig;
+
+
+ @Bean
+ public ServletRegistrationBean jerseyServlet() {
+ ServletRegistrationBean jerseyServletBean = new ServletRegistrationBean(new ServletContainer(), "/api/v1/*");
+ jerseyServletBean.addInitParameter(ServletProperties.JAXRS_APPLICATION_CLASS, InfraManagerJerseyResourceConfig.class.getName());
+ return jerseyServletBean;
+ }
+
+ @Bean
+ public ServletRegistrationBean dataServlet() {
+ ServletRegistrationBean dataServletBean = new ServletRegistrationBean(new DefaultServlet(), "/files/*");
+ dataServletBean.addInitParameter("dirAllowed","true");
+ dataServletBean.addInitParameter("pathInfoOnly","true");
+ dataServletBean.addInitParameter("resourceBase", infraManagerDataConfig.getDataFolder());
+ return dataServletBean;
+ }
+
+ @Bean
+ public EmbeddedServletContainerFactory containerFactory() {
+ final JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory = new JettyEmbeddedServletContainerFactory() {
+ @Override
+ protected JettyEmbeddedServletContainer getJettyEmbeddedServletContainer(Server server) {
+ return new JettyEmbeddedServletContainer(server);
+ }
+ };
+ jettyEmbeddedServletContainerFactory.setSessionTimeout(SESSION_TIMEOUT);
+ serverProperties.getSession().getCookie().setName(INFRA_MANAGER_SESSIONID);
+ serverProperties.setDisplayName(INFRA_MANAGER_APPLICATION_NAME);
+ jettyEmbeddedServletContainerFactory.setPort(port);
+ return jettyEmbeddedServletContainerFactory;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/StaticResourceConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/StaticResourceConfiguration.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/StaticResourceConfiguration.java
new file mode 100644
index 0000000..f0cd3cf
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/conf/StaticResourceConfiguration.java
@@ -0,0 +1,49 @@
+/*
+ * 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.infra.conf;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@EnableWebMvc
+@Configuration
+public class StaticResourceConfiguration extends WebMvcConfigurerAdapter {
+
+ private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
+ "classpath:/static/", "classpath:/swagger/","classpath:META-INF/resources/webjars/"
+ };
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("/**")
+ .addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
+ }
+
+ @Override
+ public void addViewControllers(ViewControllerRegistry registry) {
+ registry.addViewController("/").setViewName(
+ "forward:/index.html");
+ registry.addViewController("/docs").setViewName(
+ "forward:/swagger.html");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/doc/InfraManagerApiDocStorage.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/doc/InfraManagerApiDocStorage.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/doc/InfraManagerApiDocStorage.java
new file mode 100644
index 0000000..e536d9a
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/doc/InfraManagerApiDocStorage.java
@@ -0,0 +1,90 @@
+/*
+ * 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.infra.doc;
+
+import io.swagger.jaxrs.config.BeanConfig;
+import io.swagger.models.Swagger;
+import io.swagger.util.Yaml;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+@Named
+public class InfraManagerApiDocStorage {
+
+ private static final Logger LOG = LoggerFactory.getLogger(InfraManagerApiDocStorage.class);
+
+ private final Map<String, Object> swaggerMap = new ConcurrentHashMap<>();
+
+ @Inject
+ private BeanConfig beanConfig;
+
+ @PostConstruct
+ private void postConstruct() {
+ Thread loadApiDocThread = new Thread("load_swagger_api_doc") {
+ @Override
+ public void run() {
+ LOG.info("Start thread to scan REST API doc from endpoints.");
+ Swagger swagger = beanConfig.getSwagger();
+ beanConfig.configure(swagger);
+ beanConfig.scanAndRead();
+ setSwagger(swagger);
+ try {
+ if (swagger != null) {
+ String yaml = Yaml.mapper().writeValueAsString(swagger);
+ StringBuilder b = new StringBuilder();
+ String[] parts = yaml.split("\n");
+ for (String part : parts) {
+ b.append(part);
+ b.append("\n");
+ }
+ setSwaggerYaml(b.toString());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ LOG.info("Scanning REST API endpoints and generating docs has been successful.");
+ }
+ };
+ loadApiDocThread.setDaemon(true);
+ loadApiDocThread.start();
+ }
+
+ public Swagger getSwagger() {
+ return (Swagger) swaggerMap.get("swaggerObject");
+ }
+
+ public void setSwagger(final Swagger swagger) {
+ swaggerMap.put("swaggerObject", swagger);
+ }
+
+ public void setSwaggerYaml(final String swaggerYaml) {
+ swaggerMap.put("swaggerYaml", swaggerYaml);
+ }
+
+ public String getSwaggerYaml() {
+ return (String) swaggerMap.get("swaggerYaml");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/dummy/DummyItemWriter.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/dummy/DummyItemWriter.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/dummy/DummyItemWriter.java
index 444f0d1..89ad013 100644
--- a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/dummy/DummyItemWriter.java
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/job/dummy/DummyItemWriter.java
@@ -18,12 +18,14 @@
*/
package org.apache.ambari.infra.job.dummy;
+import org.apache.ambari.infra.conf.InfraManagerDataConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.annotation.BeforeStep;
import org.springframework.batch.item.ItemWriter;
+import javax.inject.Inject;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -31,27 +33,28 @@ import java.nio.file.Paths;
import java.util.Date;
import java.util.List;
-import static org.apache.ambari.infra.common.InfraManagerConstants.DATA_FOLDER_LOCATION_PARAM;
-
public class DummyItemWriter implements ItemWriter<String> {
private static final Logger LOG = LoggerFactory.getLogger(DummyItemWriter.class);
private StepExecution stepExecution;
+ @Inject
+ private InfraManagerDataConfig infraManagerDataConfig;
+
@Override
public void write(List<? extends String> values) throws Exception {
LOG.info("DummyItem writer called (values: {})... wait 1 seconds", values.toString());
Thread.sleep(1000);
- String outputDirectoryLocation = String.format("%s%s%s%s", System.getProperty(DATA_FOLDER_LOCATION_PARAM), File.separator, "dummyOutput-", new Date().getTime());
+ String outputDirectoryLocation = String.format("%s%s%s%s", infraManagerDataConfig.getDataFolder(), File.separator, "dummyOutput-", new Date().getTime());
Path pathToDirectory = Paths.get(outputDirectoryLocation);
Path pathToFile = Paths.get(String.format("%s%s%s", outputDirectoryLocation, File.separator, "dummyOutput.txt"));
Files.createDirectories(pathToDirectory);
LOG.info("Write location to step execution context...");
- stepExecution.getExecutionContext().put("stepOutputLocation", pathToFile.getFileName().toAbsolutePath().toString());
+ stepExecution.getExecutionContext().put("stepOutputLocation", pathToFile.toAbsolutePath().toString());
LOG.info("Write location to job execution context...");
- stepExecution.getJobExecution().getExecutionContext().put("jobOutputLocation", pathToFile.getFileName().toAbsolutePath().toString());
- LOG.info("Write to file: {}", pathToFile.getFileName().toAbsolutePath().toString());
+ stepExecution.getJobExecution().getExecutionContext().put("jobOutputLocation", pathToFile.toAbsolutePath().toString());
+ LOG.info("Write to file: {}", pathToFile.toAbsolutePath());
Files.write(pathToFile, values.toString().getBytes());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/rest/ApiDocResource.java
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/rest/ApiDocResource.java b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/rest/ApiDocResource.java
new file mode 100644
index 0000000..18dfdd9
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/java/org/apache/ambari/infra/rest/ApiDocResource.java
@@ -0,0 +1,56 @@
+/*
+ * 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.infra.rest;
+
+import io.swagger.annotations.ApiOperation;
+import org.apache.ambari.infra.doc.InfraManagerApiDocStorage;
+import org.springframework.context.annotation.Scope;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+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.MediaType;
+import javax.ws.rs.core.Response;
+
+@Path("swagger.{type:json|yaml}")
+@Named
+@Scope("request")
+public class ApiDocResource {
+
+ @Inject
+ private InfraManagerApiDocStorage infraManagerApiDocStorage;
+
+ @GET
+ @Produces({MediaType.APPLICATION_JSON, "application/yaml"})
+ @ApiOperation(value = "The swagger definition in either JSON or YAML", hidden = true)
+ public Response swaggerDefinitionResponse(@PathParam("type") String type) {
+ Response response = Response.status(404).build();
+ if (infraManagerApiDocStorage.getSwagger() != null) {
+ if ("yaml".equalsIgnoreCase(type)) {
+ response = Response.ok().entity(infraManagerApiDocStorage.getSwaggerYaml()).type("application/yaml").build();
+ } else {
+ response = Response.ok().entity(infraManagerApiDocStorage.getSwagger()).build();
+ }
+ }
+ return response;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties b/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
index fbeac78..8162376 100644
--- a/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
+++ b/ambari-infra/ambari-infra-manager/src/main/resources/infra-manager.properties
@@ -15,4 +15,6 @@
infra-manager.batch.db.file=job-repository.db
infra-manager.batch.db.init=true
infra-manager.batch.db.username=admin
-infra-manager.batch.db.password=admin
\ No newline at end of file
+infra-manager.batch.db.password=admin
+management.security.enabled=false
+management.health.solr.enabled=false
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/resources/log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/log4j.xml b/ambari-infra/ambari-infra-manager/src/main/resources/log4j.xml
deleted file mode 100644
index 0450454..0000000
--- a/ambari-infra/ambari-infra-manager/src/main/resources/log4j.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- 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.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
- <appender name="console" class="org.apache.log4j.ConsoleAppender">
- <param name="Target" value="System.out" />
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%d [%t] %-5p %C{6} (%F:%L) - %m%n" />
- </layout>
- </appender>
-
- <root>
- <level value="INFO" />
- <appender-ref ref="console" />
- </root>
-</log4j:configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/log4j2.xml b/ambari-infra/ambari-infra-manager/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..ad1adcd
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/resources/log4j2.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+<Configuration monitorinterval="30" status="info" strict="true">
+ <Properties>
+ <Property name="logging.file">out/infra-manager.log</Property>
+ </Properties>
+ <Appenders>
+ <Appender type="Console" name="Console">
+ <Layout type="PatternLayout" pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36}:%L - %msg%n" />
+ </Appender>
+ <RollingFile name="File" fileName="${logging.file}" filePattern="${logging.file}-%i-%d{yyyy-MM-dd}">
+ <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36}:%L - %msg%n" />
+ <Policies>
+ <TimeBasedTriggeringPolicy />
+ <SizeBasedTriggeringPolicy size="10 MB"/>
+ </Policies>
+ <DefaultRolloverStrategy max="10"/>
+ </RollingFile>
+ </Appenders>
+ <Loggers>
+ <Root level="info">
+ <AppenderRef ref="File" />
+ <AppenderRef ref="Console" />
+ </Root>
+ </Loggers>
+</Configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/resources/static/index.html
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/static/index.html b/ambari-infra/ambari-infra-manager/src/main/resources/static/index.html
new file mode 100644
index 0000000..3e64867
--- /dev/null
+++ b/ambari-infra/ambari-infra-manager/src/main/resources/static/index.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<!--
+ 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.
+-->
+<html>
+ <head>
+ </head>
+ <body>
+ <h1>Welcome!</h1>
+ </body>
+</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/resources/swagger/swagger.html
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/swagger/swagger.html b/ambari-infra/ambari-infra-manager/src/main/resources/swagger/swagger.html
index 8580e1a..52ebf61 100644
--- a/ambari-infra/ambari-infra-manager/src/main/resources/swagger/swagger.html
+++ b/ambari-infra/ambari-infra-manager/src/main/resources/swagger/swagger.html
@@ -18,24 +18,24 @@
<html>
<head>
<title>Infra Manager REST API</title>
- <link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
- <link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
- <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
- <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
- <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
- <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
- <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/>
- <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
- <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
- <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
- <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
- <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script>
- <script src='lib/underscore-min.js' type='text/javascript'></script>
- <script src='lib/backbone-min.js' type='text/javascript'></script>
- <script src='swagger-ui.js' type='text/javascript'></script>
- <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
- <script src='lib/marked.js' type='text/javascript'></script>
- <script src='lib/swagger-oauth.js' type='text/javascript'></script>
+ <link rel="icon" type="image/png" href="swagger-ui/2.1.0/images/favicon-32x32.png" sizes="32x32" />
+ <link rel="icon" type="image/png" href="swagger-ui/2.1.0/images/favicon-16x16.png" sizes="16x16" />
+ <link href='swagger-ui/2.1.0/css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='swagger-ui/2.1.0/css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='swagger-ui/2.1.0/css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
+ <link href='swagger-ui/2.1.0/css/reset.css' media='print' rel='stylesheet' type='text/css'/>
+ <link href='swagger-ui/2.1.0/css/print.css' media='print' rel='stylesheet' type='text/css'/>
+ <script src='swagger-ui/2.1.0/lib/jquery-1.8.0.min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/jquery.slideto.min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/jquery.wiggle.min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/handlebars-2.0.0.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/underscore-min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/backbone-min.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/swagger-ui.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/highlight.7.3.pack.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/marked.js' type='text/javascript'></script>
+ <script src='swagger-ui/2.1.0/lib/swagger-oauth.js' type='text/javascript'></script>
<script type="text/javascript">
$(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/6633a7bd/ambari-infra/ambari-infra-manager/src/main/resources/webapp/index.html
----------------------------------------------------------------------
diff --git a/ambari-infra/ambari-infra-manager/src/main/resources/webapp/index.html b/ambari-infra/ambari-infra-manager/src/main/resources/webapp/index.html
deleted file mode 100644
index 3e64867..0000000
--- a/ambari-infra/ambari-infra-manager/src/main/resources/webapp/index.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<!--
- 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.
--->
-<html>
- <head>
- </head>
- <body>
- <h1>Welcome!</h1>
- </body>
-</html>
\ No newline at end of file