ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [5/5] ambari git commit: AMBARI-18126 - Refactor Configuration To Allow For Generation Of Documentation (jonathanhurley)
Date Fri, 12 Aug 2016 13:41:27 GMT
AMBARI-18126 - Refactor Configuration To Allow For Generation Of Documentation (jonathanhurley)


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

Branch: refs/heads/trunk
Commit: b1a63404a0efb7fabce77f7a87df1033f8cf2fe0
Parents: 7ce06fc
Author: Jonathan Hurley <jhurley@hortonworks.com>
Authored: Thu Aug 11 15:40:14 2016 -0400
Committer: Jonathan Hurley <jhurley@hortonworks.com>
Committed: Fri Aug 12 09:40:48 2016 -0400

----------------------------------------------------------------------
 .../org/apache/ambari/annotations/Markdown.java |   41 +
 .../ambari/annotations/TransactionalLock.java   |    2 +-
 .../server/api/services/ComponentService.java   |   30 +-
 .../api/services/HostComponentService.java      |   15 +-
 .../checks/DatabaseConsistencyCheckHelper.java  |    2 +-
 .../ComponentSSLConfiguration.java              |    8 +-
 .../server/configuration/Configuration.java     | 2994 +++++++++++-------
 .../ambari/server/controller/AmbariServer.java  |   83 +-
 .../server/controller/ControllerModule.java     |   34 +-
 .../server/controller/KerberosHelperImpl.java   |    2 +-
 .../internal/ClientConfigResourceProvider.java  |    6 +-
 .../controller/utilities/DatabaseChecker.java   |    2 +-
 .../server/resources/ResourceManager.java       |    4 +-
 .../security/AbstractSecurityHeaderFilter.java  |    6 +-
 .../server/security/CertificateManager.java     |   49 +-
 .../encryption/MasterKeyServiceImpl.java        |   35 +-
 .../security/unsecured/rest/ConnectionInfo.java |    9 +-
 .../services/RetryUpgradeActionService.java     |   57 +-
 .../ambari/server/state/stack/OsFamily.java     |   10 +-
 .../server/view/ViewURLStreamProvider.java      |   54 +-
 .../annotations/TransactionalLockTest.java      |    4 +-
 .../actionmanager/TestActionScheduler.java      |    6 +-
 .../server/agent/TestHeartbeatHandler.java      |   10 +-
 .../KdcServerConnectionVerificationTest.java    |    2 +-
 .../server/api/services/AmbariMetaInfoTest.java |   16 +-
 .../services/KerberosServiceMetaInfoTest.java   |   10 +-
 .../ambari/server/bootstrap/BootStrapTest.java  |   41 +-
 .../server/checks/UpgradeCheckOrderTest.java    |    6 +-
 .../cleanup/CleanupServiceFunctionalTest.java   |    2 +-
 .../ComponentSSLConfigurationTest.java          |    9 +-
 .../server/configuration/ConfigurationTest.java |  188 +-
 .../AmbariManagementControllerTest.java         |   26 +-
 .../BackgroundCustomCommandExecutionTest.java   |   54 +-
 .../internal/AlertResourceProviderTest.java     |    6 +-
 .../ClientConfigResourceProviderTest.java       |   27 +-
 ...ClusterStackVersionResourceProviderTest.java |    6 +-
 .../CredentialResourceProviderTest.java         |   45 +-
 .../utilities/DatabaseCheckerTest.java          |    8 +-
 .../notifications/DispatchFactoryTest.java      |    8 +-
 .../server/orm/InMemoryDefaultTestModule.java   |   20 +-
 .../ambari/server/orm/JdbcPropertyTest.java     |   13 +-
 .../ambari/server/resources/TestResources.java  |   26 +-
 .../scheduler/ExecutionScheduleManagerTest.java |   61 +-
 .../scheduler/ExecutionSchedulerTest.java       |   26 +-
 .../AbstractSecurityHeaderFilterTest.java       |   32 +-
 .../AmbariServerSecurityHeaderFilterTest.java   |   16 +-
 .../AmbariViewsSecurityHeaderFilterTest.java    |   16 +-
 .../server/security/CertGenerationTest.java     |   40 +-
 .../server/security/CertificateManagerTest.java |   42 +-
 .../server/security/SslExecutionTest.java       |   32 +-
 ...henticationProviderForDuplicateUserTest.java |   20 +-
 .../AmbariLdapAuthenticationProviderTest.java   |   33 +-
 .../AmbariLdapBindAuthenticatorTest.java        |   22 +-
 .../authorization/AuthorizationTestModule.java  |   14 +-
 ...thorizationTestModuleForLdapDNWithSpace.java |   16 +-
 .../security/authorization/TestUsers.java       |    7 +-
 .../encryption/CredentialProviderTest.java      |    7 +-
 .../CredentialStoreServiceImplTest.java         |   24 +-
 .../encryption/MasterKeyServiceTest.java        |   33 +-
 .../security/ldap/LdapPerformanceTest.java      |   14 +-
 .../state/stack/ConfigUpgradeValidityTest.java  |    3 +-
 .../ambari/server/upgrade/UpgradeTest.java      |   20 +-
 .../server/view/ViewURLStreamProviderTest.java  |   42 +-
 63 files changed, 2725 insertions(+), 1771 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b1a63404/ambari-server/src/main/java/org/apache/ambari/annotations/Markdown.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/annotations/Markdown.java b/ambari-server/src/main/java/org/apache/ambari/annotations/Markdown.java
new file mode 100644
index 0000000..0f7748e
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/annotations/Markdown.java
@@ -0,0 +1,41 @@
+/**
+ * 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.annotations;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * The {@link Markdown} annotation is used to add information when creating <a
+ * href=https://en.wikipedia.org/wiki/Markdown>Markdown</a> content.
+ */
+@Retention(RUNTIME)
+@Target({ TYPE, FIELD, METHOD })
+public @interface Markdown {
+  /**
+   * A description to add for this element when generating Markdown.
+   *
+   * @return
+   */
+  String description();
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1a63404/ambari-server/src/main/java/org/apache/ambari/annotations/TransactionalLock.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/annotations/TransactionalLock.java
b/ambari-server/src/main/java/org/apache/ambari/annotations/TransactionalLock.java
index cd961ba..a8b89a9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/annotations/TransactionalLock.java
+++ b/ambari-server/src/main/java/org/apache/ambari/annotations/TransactionalLock.java
@@ -65,7 +65,7 @@ public @interface TransactionalLock {
      * Joinpoint lock around work performed on caching the host role command
      * status in a given stage and request.
      */
-    HRC_STATUS_CACHE(Configuration.SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED);
+    HRC_STATUS_CACHE(Configuration.SERVER_HRC_STATUS_SUMMARY_CACHE_ENABLED.getKey());
 
     /**
      * Logger.

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1a63404/ambari-server/src/main/java/org/apache/ambari/server/api/services/ComponentService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ComponentService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ComponentService.java
index e7e0029..ded2596 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ComponentService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ComponentService.java
@@ -18,17 +18,6 @@
 
 package org.apache.ambari.server.api.services;
 
-import com.google.inject.Inject;
-import org.apache.ambari.server.api.resources.ResourceInstance;
-import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.controller.spi.ClusterController;
-import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.controller.utilities.ClusterControllerHelper;
-import org.apache.ambari.server.orm.GuiceJpaInitializer;
-import org.apache.ambari.server.state.ConfigHelper;
-
-import javax.ws.rs.*;
-import javax.ws.rs.core.*;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -36,6 +25,23 @@ import java.io.InputStream;
 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.QueryParam;
+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.configuration.Configuration;
+import org.apache.ambari.server.controller.spi.Resource;
+
 /**
  * Service responsible for components resource requests.
  */
@@ -233,7 +239,7 @@ public class ComponentService extends BaseService {
 
     Response.ResponseBuilder rb = Response.status(Response.Status.OK);
     Configuration configs = new Configuration();
-    String tmpDir = configs.getProperty(Configuration.SERVER_TMP_DIR_KEY);
+    String tmpDir = configs.getProperty(Configuration.SERVER_TMP_DIR.getKey());
     File file = new File(tmpDir + File.separator + componentName + "-configs" + Configuration.DEF_ARCHIVE_EXTENSION);
     InputStream resultInputStream = null;
     try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1a63404/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostComponentService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostComponentService.java
b/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostComponentService.java
index 72351c3..bc9bb30 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostComponentService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostComponentService.java
@@ -25,7 +25,14 @@ import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.ws.rs.*;
+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.QueryParam;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.Response;
@@ -203,7 +210,7 @@ public class HostComponentService extends BaseService {
     return handleRequest(headers, null, ui, Request.Type.DELETE,
         createHostComponentResource(m_clusterName, m_hostName, hostComponentName));
   }
-  
+
   /**
    * Handles DELETE /clusters/{clusterID}/hosts/{hostID}/host_components
    * Deletes multiple host_component resources.
@@ -235,7 +242,7 @@ public class HostComponentService extends BaseService {
 
     return handleRequest(headers, null, ui, Request.Type.GET, ri);
   }
-  
+
   /**
    * Create a host_component resource instance.
    *
@@ -272,7 +279,7 @@ public class HostComponentService extends BaseService {
 
     Response.ResponseBuilder rb = Response.status(Response.Status.OK);
     Configuration configs = new Configuration();
-    String tmpDir = configs.getProperty(Configuration.SERVER_TMP_DIR_KEY);
+    String tmpDir = configs.getProperty(Configuration.SERVER_TMP_DIR.getKey());
     File file = new File(tmpDir+File.separator+hostComponentName+"-configs.tar.gz");
     InputStream resultInputStream = null;
     try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1a63404/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
index 36a2d99..2bebf95 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/DatabaseConsistencyCheckHelper.java
@@ -112,7 +112,7 @@ public class DatabaseConsistencyCheckHelper {
       metainfoDAO = injector.getInstance(MetainfoDAO.class);
     }
 
-    MetainfoEntity schemaVersionEntity = metainfoDAO.findByKey(Configuration.SERVER_VERSION_KEY);
+    MetainfoEntity schemaVersionEntity = metainfoDAO.findByKey(Configuration.SERVER_VERSION.getKey());
     String schemaVersion = null;
 
     if (schemaVersionEntity != null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/b1a63404/ambari-server/src/main/java/org/apache/ambari/server/configuration/ComponentSSLConfiguration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/ComponentSSLConfiguration.java
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/ComponentSSLConfiguration.java
index cb9651e..c68efa6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/ComponentSSLConfiguration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/ComponentSSLConfiguration.java
@@ -57,10 +57,10 @@ public class ComponentSSLConfiguration {
    * @param configuration  the configuration
    */
   public void init(Configuration configuration) {
-    truststorePath     = configuration.getProperty(Configuration.SSL_TRUSTSTORE_PATH_KEY);
+    truststorePath     = configuration.getProperty(Configuration.SSL_TRUSTSTORE_PATH.getKey());
     truststorePassword = getPassword(configuration);
-    truststoreType     = configuration.getProperty(Configuration.SSL_TRUSTSTORE_TYPE_KEY);
-    httpsEnabled = Boolean.parseBoolean(configuration.getProperty(Configuration.AMRABI_METRICS_HTTPS_ENABLED_KEY));
+    truststoreType     = configuration.getProperty(Configuration.SSL_TRUSTSTORE_TYPE.getKey());
+    httpsEnabled = Boolean.parseBoolean(configuration.getProperty(Configuration.AMBARI_METRICS_HTTPS_ENABLED.getKey()));
   }
 
 
@@ -115,7 +115,7 @@ public class ComponentSSLConfiguration {
   // -----helper methods -----------------------------------------------------
 
   private String getPassword(Configuration configuration) {
-    String rawPassword = configuration.getProperty(Configuration.SSL_TRUSTSTORE_PASSWORD_KEY);
+    String rawPassword = configuration.getProperty(Configuration.SSL_TRUSTSTORE_PASSWORD.getKey());
     String password    = configuration.readPasswordFromStore(rawPassword);
 
     return password == null ? rawPassword : password;


Mime
View raw message