소스 검색

AMBARI-14869: Rename AdminSetting API to Setting (Ajit Kumar via smnaha)

Nahappan Somasundaram 9 년 전
부모
커밋
774d689eee
20개의 변경된 파일268개의 추가작업 그리고 269개의 파일을 삭제
  1. 2 2
      ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
  2. 19 19
      ambari-server/src/main/java/org/apache/ambari/server/api/services/SettingService.java
  3. 2 2
      ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java
  4. 68 67
      ambari-server/src/main/java/org/apache/ambari/server/controller/internal/SettingResourceProvider.java
  5. 2 2
      ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java
  6. 20 20
      ambari-server/src/main/java/org/apache/ambari/server/orm/dao/SettingDAO.java
  7. 11 11
      ambari-server/src/main/java/org/apache/ambari/server/orm/entities/SettingEntity.java
  8. 1 1
      ambari-server/src/main/java/org/apache/ambari/server/security/authorization/RoleAuthorization.java
  9. 4 4
      ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
  10. 4 4
      ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
  11. 4 4
      ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
  12. 4 4
      ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
  13. 5 5
      ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql
  14. 4 4
      ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
  15. 4 4
      ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
  16. 1 1
      ambari-server/src/main/resources/META-INF/persistence.xml
  17. 22 22
      ambari-server/src/test/java/org/apache/ambari/server/api/services/SettingServiceTest.java
  18. 71 72
      ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SettingResourceProviderTest.java
  19. 10 10
      ambari-server/src/test/java/org/apache/ambari/server/orm/dao/SettingDAOTest.java
  20. 10 11
      ambari-server/src/test/java/org/apache/ambari/server/orm/entities/SettingEntityTest.java

+ 2 - 2
ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java

@@ -408,8 +408,8 @@ public class ResourceInstanceFactoryImpl implements ResourceInstanceFactory {
         resourceDefinition = new SimpleResourceDefinition(Resource.Type.UserAuthorization, "authorization", "authorizations");
         resourceDefinition = new SimpleResourceDefinition(Resource.Type.UserAuthorization, "authorization", "authorizations");
         break;
         break;
 
 
-      case AdminSetting:
-        resourceDefinition = new SimpleResourceDefinition(Resource.Type.AdminSetting, "admin-setting", "admin-settings");
+      case Setting:
+        resourceDefinition = new SimpleResourceDefinition(Resource.Type.Setting, "setting", "settings");
         break;
         break;
 
 
       default:
       default:

+ 19 - 19
ambari-server/src/main/java/org/apache/ambari/server/api/services/AdminSettingService.java → ambari-server/src/main/java/org/apache/ambari/server/api/services/SettingService.java

@@ -36,15 +36,15 @@ import javax.ws.rs.core.UriInfo;
 import java.util.Collections;
 import java.util.Collections;
 
 
 /**
 /**
- * Service responsible for admin setting resource requests.
+ * Service responsible for setting resource requests.
  */
  */
-@Path("/admin-settings/")
-public class AdminSettingService extends BaseService {
+@Path("/settings/")
+public class SettingService extends BaseService {
 
 
   /**
   /**
-   * Construct a AdminSettingService.
+   * Construct a SettingService.
    */
    */
-  public AdminSettingService() {
+  public SettingService() {
 
 
   }
   }
 
 
@@ -55,7 +55,7 @@ public class AdminSettingService extends BaseService {
    * @param headers  http headers
    * @param headers  http headers
    * @param ui       uri info
    * @param ui       uri info
    *
    *
-   * @return admin setting collection resource representation
+   * @return setting collection resource representation
    */
    */
   @GET
   @GET
   @Produces("text/plain")
   @Produces("text/plain")
@@ -64,14 +64,14 @@ public class AdminSettingService extends BaseService {
   }
   }
 
 
   /**
   /**
-   * Handles: GET /admin-settings/{settingName}
-   * Get a specific admin setting.
+   * Handles: GET /settings/{settingName}
+   * Get a specific setting.
    *
    *
    * @param headers      http headers
    * @param headers      http headers
    * @param ui           uri info
    * @param ui           uri info
    * @param settingName  settingName
    * @param settingName  settingName
    *
    *
-   * @return admin setting instance representation
+   * @return setting instance representation
    */
    */
   @GET
   @GET
   @Path("{settingName}")
   @Path("{settingName}")
@@ -82,8 +82,8 @@ public class AdminSettingService extends BaseService {
   }
   }
 
 
   /**
   /**
-   * Handles: POST /admin-settings/{settingName}
-   * Create a specific admin setting.
+   * Handles: POST /settings/{settingName}
+   * Create a specific setting.
    *
    *
    * @param headers      http headers
    * @param headers      http headers
    * @param ui           uri info
    * @param ui           uri info
@@ -97,8 +97,8 @@ public class AdminSettingService extends BaseService {
   }
   }
 
 
   /**
   /**
-   * Handles: PUT /admin-settings/{settingName}
-   * Update a specific admin setting.
+   * Handles: PUT /settings/{settingName}
+   * Update a specific setting.
    *
    *
    * @param headers      http headers
    * @param headers      http headers
    * @param ui           uri info
    * @param ui           uri info
@@ -115,8 +115,8 @@ public class AdminSettingService extends BaseService {
   }
   }
 
 
   /**
   /**
-   * Handles: DELETE /admin-settings/{settingName}
-   * Delete a specific admin setting.
+   * Handles: DELETE /settings/{settingName}
+   * Delete a specific setting.
    *
    *
    * @param headers      http headers
    * @param headers      http headers
    * @param ui           uri info
    * @param ui           uri info
@@ -135,14 +135,14 @@ public class AdminSettingService extends BaseService {
   // ----- helper methods ----------------------------------------------------
   // ----- helper methods ----------------------------------------------------
 
 
   /**
   /**
-   * Create an admin setting resource instance.
+   * Create a setting resource instance.
    *
    *
    * @param settingName setting name
    * @param settingName setting name
    *
    *
-   * @return an admin setting resource instance
+   * @return a setting resource instance
    */
    */
   ResourceInstance createSettingResource(String settingName) {
   ResourceInstance createSettingResource(String settingName) {
-    return createResource(Resource.Type.AdminSetting,
-        Collections.singletonMap(Resource.Type.AdminSetting, settingName));
+    return createResource(Resource.Type.Setting,
+        Collections.singletonMap(Resource.Type.Setting, settingName));
   }
   }
 }
 }

+ 2 - 2
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java

@@ -112,8 +112,8 @@ public class DefaultProviderModule extends AbstractProviderModule {
         return new OperatingSystemResourceProvider(managementController);
         return new OperatingSystemResourceProvider(managementController);
       case Repository:
       case Repository:
         return new RepositoryResourceProvider(managementController);
         return new RepositoryResourceProvider(managementController);
-      case AdminSetting:
-        return new AdminSettingResourceProvider();
+      case Setting:
+        return new SettingResourceProvider();
       case Artifact:
       case Artifact:
         return new ArtifactResourceProvider(managementController);
         return new ArtifactResourceProvider(managementController);
 
 

+ 68 - 67
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AdminSettingResourceProvider.java → ambari-server/src/main/java/org/apache/ambari/server/controller/internal/SettingResourceProvider.java

@@ -30,8 +30,8 @@ import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.apache.ambari.server.orm.dao.AdminSettingDAO;
-import org.apache.ambari.server.orm.entities.AdminSettingEntity;
+import org.apache.ambari.server.orm.dao.SettingDAO;
+import org.apache.ambari.server.orm.entities.SettingEntity;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
@@ -48,53 +48,54 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.Set;
 
 
 /**
 /**
- * This class deals with managing CRUD operation on {@link AdminSettingEntity}.
+ * This class deals with managing CRUD operation on {@link SettingEntity}.
  */
  */
 @StaticallyInject
 @StaticallyInject
-public class AdminSettingResourceProvider extends AbstractAuthorizedResourceProvider {
+public class SettingResourceProvider extends AbstractAuthorizedResourceProvider {
 
 
+  private static final String SETTINGS = "Settings";
   protected static final String ID = "id";
   protected static final String ID = "id";
-  protected static final String ADMINSETTING = "AdminSetting";
-  protected static final String ADMINSETTING_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("AdminSettings", "name");
-  protected static final String ADMINSETTING_SETTING_TYPE_PROPERTY_ID = PropertyHelper.getPropertyId("AdminSettings", "setting_type");
-  protected static final String ADMINSETTING_CONTENT_PROPERTY_ID = PropertyHelper.getPropertyId("AdminSettings", "content");
-  protected static final String ADMINSETTING_UPDATED_BY_PROPERTY_ID = PropertyHelper.getPropertyId("AdminSettings", "updated_by");
-  protected static final String ADMINSETTING_UPDATE_TIMESTAMP_PROPERTY_ID = PropertyHelper.getPropertyId("AdminSettings", "update_timestamp");
+  protected static final String SETTING = "Setting";
+  protected static final String SETTING_NAME_PROPERTY_ID = PropertyHelper.getPropertyId(SETTINGS, "name");
+  protected static final String SETTING_SETTING_TYPE_PROPERTY_ID = PropertyHelper.getPropertyId(SETTINGS, "setting_type");
+  protected static final String SETTING_CONTENT_PROPERTY_ID = PropertyHelper.getPropertyId(SETTINGS, "content");
+  protected static final String SETTING_UPDATED_BY_PROPERTY_ID = PropertyHelper.getPropertyId(SETTINGS, "updated_by");
+  protected static final String SETTING_UPDATE_TIMESTAMP_PROPERTY_ID = PropertyHelper.getPropertyId(SETTINGS, "update_timestamp");
 
 
   /**
   /**
-   * The property ids for a admin setting resource.
+   * The property ids for setting resource.
    */
    */
   private static final Set<String> propertyIds = new HashSet<>();
   private static final Set<String> propertyIds = new HashSet<>();
 
 
   /**
   /**
-   * The key property ids for a admin setting resource.
+   * The key property ids for setting resource.
    */
    */
   private static final Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
   private static final Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
 
 
   private static final Set<String> requiredProperties = new HashSet<>();
   private static final Set<String> requiredProperties = new HashSet<>();
 
 
   @Inject
   @Inject
-  private static AdminSettingDAO dao;
+  private static SettingDAO dao;
 
 
   static {
   static {
-    propertyIds.add(ADMINSETTING_NAME_PROPERTY_ID);
-    propertyIds.add(ADMINSETTING_SETTING_TYPE_PROPERTY_ID);
-    propertyIds.add(ADMINSETTING_CONTENT_PROPERTY_ID);
-    propertyIds.add(ADMINSETTING_UPDATED_BY_PROPERTY_ID);
-    propertyIds.add(ADMINSETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
-    propertyIds.add(ADMINSETTING_SETTING_TYPE_PROPERTY_ID);
-    propertyIds.add(ADMINSETTING);
-
-    keyPropertyIds.put(Resource.Type.AdminSetting, ADMINSETTING_NAME_PROPERTY_ID);
-
-    requiredProperties.add(ADMINSETTING_NAME_PROPERTY_ID);
-    requiredProperties.add(ADMINSETTING_SETTING_TYPE_PROPERTY_ID);
-    requiredProperties.add(ADMINSETTING_CONTENT_PROPERTY_ID);
+    propertyIds.add(SETTING_NAME_PROPERTY_ID);
+    propertyIds.add(SETTING_SETTING_TYPE_PROPERTY_ID);
+    propertyIds.add(SETTING_CONTENT_PROPERTY_ID);
+    propertyIds.add(SETTING_UPDATED_BY_PROPERTY_ID);
+    propertyIds.add(SETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
+    propertyIds.add(SETTING_SETTING_TYPE_PROPERTY_ID);
+    propertyIds.add(SETTING);
+
+    keyPropertyIds.put(Resource.Type.Setting, SETTING_NAME_PROPERTY_ID);
+
+    requiredProperties.add(SETTING_NAME_PROPERTY_ID);
+    requiredProperties.add(SETTING_SETTING_TYPE_PROPERTY_ID);
+    requiredProperties.add(SETTING_CONTENT_PROPERTY_ID);
   }
   }
 
 
-  protected AdminSettingResourceProvider() {
+  protected SettingResourceProvider() {
     super(propertyIds, keyPropertyIds);
     super(propertyIds, keyPropertyIds);
-    EnumSet<RoleAuthorization> requiredAuthorizations = EnumSet.of(RoleAuthorization.AMBARI_MANAGE_ADMIN_SETTINGS);
+    EnumSet<RoleAuthorization> requiredAuthorizations = EnumSet.of(RoleAuthorization.AMBARI_MANAGE_SETTINGS);
     setRequiredCreateAuthorizations(requiredAuthorizations);
     setRequiredCreateAuthorizations(requiredAuthorizations);
     setRequiredDeleteAuthorizations(requiredAuthorizations);
     setRequiredDeleteAuthorizations(requiredAuthorizations);
     setRequiredUpdateAuthorizations(requiredAuthorizations);
     setRequiredUpdateAuthorizations(requiredAuthorizations);
@@ -111,9 +112,9 @@ public class AdminSettingResourceProvider extends AbstractAuthorizedResourceProv
     Set<Resource> associatedResources = new HashSet<>();
     Set<Resource> associatedResources = new HashSet<>();
 
 
     for (Map<String, Object> properties : request.getProperties()) {
     for (Map<String, Object> properties : request.getProperties()) {
-      AdminSettingEntity settingEntity = createResources(newCreateCommand(request, properties));
-      Resource resource = new ResourceImpl(Resource.Type.AdminSetting);
-      resource.setProperty(ADMINSETTING_NAME_PROPERTY_ID, settingEntity.getName());
+      SettingEntity settingEntity = createResources(newCreateCommand(request, properties));
+      Resource resource = new ResourceImpl(Resource.Type.Setting);
+      resource.setProperty(SETTING_NAME_PROPERTY_ID, settingEntity.getName());
       associatedResources.add(resource);
       associatedResources.add(resource);
     }
     }
 
 
@@ -122,17 +123,17 @@ public class AdminSettingResourceProvider extends AbstractAuthorizedResourceProv
 
 
   @Override
   @Override
   public Set<Resource> getResourcesAuthorized(Request request, Predicate predicate) throws NoSuchResourceException {
   public Set<Resource> getResourcesAuthorized(Request request, Predicate predicate) throws NoSuchResourceException {
-    List<AdminSettingEntity> entities = new LinkedList<>();
+    List<SettingEntity> entities = new LinkedList<>();
     final Set<Map<String, Object>> propertyMaps = getPropertyMaps(predicate);
     final Set<Map<String, Object>> propertyMaps = getPropertyMaps(predicate);
     if (propertyMaps.isEmpty()) {
     if (propertyMaps.isEmpty()) {
       entities = dao.findAll();
       entities = dao.findAll();
     }
     }
     for (Map<String, Object> propertyMap: propertyMaps) {
     for (Map<String, Object> propertyMap: propertyMaps) {
-      if (propertyMap.containsKey(ADMINSETTING_NAME_PROPERTY_ID)) {
-        String name = propertyMap.get(ADMINSETTING_NAME_PROPERTY_ID).toString();
-        AdminSettingEntity entity = dao.findByName(name);
+      if (propertyMap.containsKey(SETTING_NAME_PROPERTY_ID)) {
+        String name = propertyMap.get(SETTING_NAME_PROPERTY_ID).toString();
+        SettingEntity entity = dao.findByName(name);
         if (entity == null) {
         if (entity == null) {
-          throw new NoSuchResourceException(String.format("AdminSetting with name %s does not exists", name));
+          throw new NoSuchResourceException(String.format("Setting with name %s does not exists", name));
         }
         }
         entities.add(entity);
         entities.add(entity);
       } else {
       } else {
@@ -142,7 +143,7 @@ public class AdminSettingResourceProvider extends AbstractAuthorizedResourceProv
     }
     }
     Set<String> requestedIds = getRequestPropertyIds(request, predicate);
     Set<String> requestedIds = getRequestPropertyIds(request, predicate);
     Set<Resource> resources = new HashSet<>();
     Set<Resource> resources = new HashSet<>();
-    for(AdminSettingEntity entity : entities) {
+    for(SettingEntity entity : entities) {
       resources.add(toResource(entity, requestedIds));
       resources.add(toResource(entity, requestedIds));
     }
     }
     return resources;
     return resources;
@@ -159,25 +160,25 @@ public class AdminSettingResourceProvider extends AbstractAuthorizedResourceProv
   public RequestStatus deleteResourcesAuthorized(Predicate predicate) {
   public RequestStatus deleteResourcesAuthorized(Predicate predicate) {
     final Set<Map<String, Object>> propertyMaps = getPropertyMaps(predicate);
     final Set<Map<String, Object>> propertyMaps = getPropertyMaps(predicate);
     for (Map<String, Object> propertyMap : propertyMaps) {
     for (Map<String, Object> propertyMap : propertyMaps) {
-      if (propertyMap.containsKey(ADMINSETTING_NAME_PROPERTY_ID)) {
-        dao.removeByName(propertyMap.get(ADMINSETTING_NAME_PROPERTY_ID).toString());
+      if (propertyMap.containsKey(SETTING_NAME_PROPERTY_ID)) {
+        dao.removeByName(propertyMap.get(SETTING_NAME_PROPERTY_ID).toString());
       }
       }
     }
     }
     return getRequestStatus(null);
     return getRequestStatus(null);
   }
   }
 
 
 
 
-  private Command<AdminSettingEntity> newCreateCommand(final Request request, final Map<String, Object> properties) {
-    return new Command<AdminSettingEntity>() {
+  private Command<SettingEntity> newCreateCommand(final Request request, final Map<String, Object> properties) {
+    return new Command<SettingEntity>() {
       @Override
       @Override
-      public AdminSettingEntity invoke() throws AmbariException, AuthorizationException {
-        AdminSettingEntity entity = toEntity(properties);
+      public SettingEntity invoke() throws AmbariException, AuthorizationException {
+        SettingEntity entity = toEntity(properties);
         if (dao.findByName(entity.getName()) != null) {
         if (dao.findByName(entity.getName()) != null) {
           throw new DuplicateResourceException(
           throw new DuplicateResourceException(
                   String.format("Setting already exists. setting name :%s ", entity.getName()));
                   String.format("Setting already exists. setting name :%s ", entity.getName()));
         }
         }
         dao.create(entity);
         dao.create(entity);
-        notifyCreate(Resource.Type.AdminSetting, request);
+        notifyCreate(Resource.Type.Setting, request);
         return entity;
         return entity;
       }
       }
     };
     };
@@ -189,11 +190,11 @@ public class AdminSettingResourceProvider extends AbstractAuthorizedResourceProv
       public Void invoke() throws AmbariException {
       public Void invoke() throws AmbariException {
         final Set<Map<String, Object>> propertyMaps = request.getProperties();
         final Set<Map<String, Object>> propertyMaps = request.getProperties();
         for (Map<String, Object> propertyMap : propertyMaps) {
         for (Map<String, Object> propertyMap : propertyMaps) {
-          if (propertyMap.containsKey(ADMINSETTING_NAME_PROPERTY_ID)) {
-            String name = propertyMap.get(ADMINSETTING_NAME_PROPERTY_ID).toString();
-            AdminSettingEntity entity = dao.findByName(name);
+          if (propertyMap.containsKey(SETTING_NAME_PROPERTY_ID)) {
+            String name = propertyMap.get(SETTING_NAME_PROPERTY_ID).toString();
+            SettingEntity entity = dao.findByName(name);
             if (entity == null) {
             if (entity == null) {
-              throw new AmbariException(String.format("There is no admin setting with name: %s ", name));
+              throw new AmbariException(String.format("There is no setting with name: %s ", name));
             }
             }
             updateEntity(entity, propertyMap);
             updateEntity(entity, propertyMap);
             dao.merge(entity);
             dao.merge(entity);
@@ -204,45 +205,45 @@ public class AdminSettingResourceProvider extends AbstractAuthorizedResourceProv
     };
     };
   }
   }
 
 
-  private void updateEntity(AdminSettingEntity entity, Map<String, Object> propertyMap) throws AmbariException {
-    String name = propertyMap.get(ADMINSETTING_NAME_PROPERTY_ID).toString();
+  private void updateEntity(SettingEntity entity, Map<String, Object> propertyMap) throws AmbariException {
+    String name = propertyMap.get(SETTING_NAME_PROPERTY_ID).toString();
     if (!Objects.equals(name, entity.getName())) {
     if (!Objects.equals(name, entity.getName())) {
-      throw new AmbariException("Name for AdminSetting is immutable, cannot change name.");
+      throw new AmbariException("Name for Setting is immutable, cannot change name.");
     }
     }
 
 
-    if (StringUtils.isNotBlank(ObjectUtils.toString(propertyMap.get(ADMINSETTING_CONTENT_PROPERTY_ID)))) {
-      entity.setContent(propertyMap.get(ADMINSETTING_CONTENT_PROPERTY_ID).toString());
+    if (StringUtils.isNotBlank(ObjectUtils.toString(propertyMap.get(SETTING_CONTENT_PROPERTY_ID)))) {
+      entity.setContent(propertyMap.get(SETTING_CONTENT_PROPERTY_ID).toString());
     }
     }
 
 
-    if (StringUtils.isNotBlank(ObjectUtils.toString(propertyMap.get(ADMINSETTING_SETTING_TYPE_PROPERTY_ID)))) {
-      entity.setSettingType(propertyMap.get(ADMINSETTING_SETTING_TYPE_PROPERTY_ID).toString());
+    if (StringUtils.isNotBlank(ObjectUtils.toString(propertyMap.get(SETTING_SETTING_TYPE_PROPERTY_ID)))) {
+      entity.setSettingType(propertyMap.get(SETTING_SETTING_TYPE_PROPERTY_ID).toString());
     }
     }
 
 
     entity.setUpdatedBy(AuthorizationHelper.getAuthenticatedName());
     entity.setUpdatedBy(AuthorizationHelper.getAuthenticatedName());
     entity.setUpdateTimestamp(System.currentTimeMillis());
     entity.setUpdateTimestamp(System.currentTimeMillis());
   }
   }
 
 
-  private Resource toResource(final AdminSettingEntity adminSettingEntity, final Set<String> requestedIds) {
-    Resource resource = new ResourceImpl(Resource.Type.AdminSetting);
-    setResourceProperty(resource, ADMINSETTING_NAME_PROPERTY_ID, adminSettingEntity.getName(), requestedIds);
-    setResourceProperty(resource, ADMINSETTING_SETTING_TYPE_PROPERTY_ID, adminSettingEntity.getSettingType(), requestedIds);
-    setResourceProperty(resource, ADMINSETTING_CONTENT_PROPERTY_ID, adminSettingEntity.getContent(), requestedIds);
-    setResourceProperty(resource, ADMINSETTING_UPDATED_BY_PROPERTY_ID, adminSettingEntity.getUpdatedBy(), requestedIds);
-    setResourceProperty(resource, ADMINSETTING_UPDATE_TIMESTAMP_PROPERTY_ID, adminSettingEntity.getUpdateTimestamp(), requestedIds);
+  private Resource toResource(final SettingEntity settingEntity, final Set<String> requestedIds) {
+    Resource resource = new ResourceImpl(Resource.Type.Setting);
+    setResourceProperty(resource, SETTING_NAME_PROPERTY_ID, settingEntity.getName(), requestedIds);
+    setResourceProperty(resource, SETTING_SETTING_TYPE_PROPERTY_ID, settingEntity.getSettingType(), requestedIds);
+    setResourceProperty(resource, SETTING_CONTENT_PROPERTY_ID, settingEntity.getContent(), requestedIds);
+    setResourceProperty(resource, SETTING_UPDATED_BY_PROPERTY_ID, settingEntity.getUpdatedBy(), requestedIds);
+    setResourceProperty(resource, SETTING_UPDATE_TIMESTAMP_PROPERTY_ID, settingEntity.getUpdateTimestamp(), requestedIds);
     return resource;
     return resource;
   }
   }
 
 
-  private AdminSettingEntity toEntity(final Map<String, Object> properties) throws AmbariException {
+  private SettingEntity toEntity(final Map<String, Object> properties) throws AmbariException {
     for (String propertyName: requiredProperties) {
     for (String propertyName: requiredProperties) {
       if (properties.get(propertyName) == null) {
       if (properties.get(propertyName) == null) {
         throw new AmbariException(String.format("Property %s should be provided", propertyName));
         throw new AmbariException(String.format("Property %s should be provided", propertyName));
       }
       }
     }
     }
 
 
-    AdminSettingEntity entity = new AdminSettingEntity();
-    entity.setName(properties.get(ADMINSETTING_NAME_PROPERTY_ID).toString());
-    entity.setSettingType(properties.get(ADMINSETTING_SETTING_TYPE_PROPERTY_ID).toString());
-    entity.setContent(properties.get(ADMINSETTING_CONTENT_PROPERTY_ID).toString());
+    SettingEntity entity = new SettingEntity();
+    entity.setName(properties.get(SETTING_NAME_PROPERTY_ID).toString());
+    entity.setSettingType(properties.get(SETTING_SETTING_TYPE_PROPERTY_ID).toString());
+    entity.setContent(properties.get(SETTING_CONTENT_PROPERTY_ID).toString());
     entity.setUpdatedBy(AuthorizationHelper.getAuthenticatedName());
     entity.setUpdatedBy(AuthorizationHelper.getAuthenticatedName());
     entity.setUpdateTimestamp(System.currentTimeMillis());
     entity.setUpdateTimestamp(System.currentTimeMillis());
     return entity;
     return entity;

+ 2 - 2
ambari-server/src/main/java/org/apache/ambari/server/controller/spi/Resource.java

@@ -76,7 +76,7 @@ public interface Resource {
   enum InternalType {
   enum InternalType {
     Cluster,
     Cluster,
     Service,
     Service,
-    AdminSetting,
+    Setting,
     Host,
     Host,
     Component,
     Component,
     HostComponent,
     HostComponent,
@@ -187,7 +187,7 @@ public interface Resource {
      */
      */
     public static final Type Cluster = InternalType.Cluster.getType();
     public static final Type Cluster = InternalType.Cluster.getType();
     public static final Type Service = InternalType.Service.getType();
     public static final Type Service = InternalType.Service.getType();
-    public static final Type AdminSetting = InternalType.AdminSetting.getType();
+    public static final Type Setting = InternalType.Setting.getType();
     public static final Type Host = InternalType.Host.getType();
     public static final Type Host = InternalType.Host.getType();
     public static final Type Component = InternalType.Component.getType();
     public static final Type Component = InternalType.Component.getType();
     public static final Type HostComponent = InternalType.HostComponent.getType();
     public static final Type HostComponent = InternalType.HostComponent.getType();

+ 20 - 20
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AdminSettingDAO.java → ambari-server/src/main/java/org/apache/ambari/server/orm/dao/SettingDAO.java

@@ -22,7 +22,7 @@ import com.google.inject.Provider;
 import com.google.inject.Singleton;
 import com.google.inject.Singleton;
 import com.google.inject.persist.Transactional;
 import com.google.inject.persist.Transactional;
 import org.apache.ambari.server.orm.RequiresSession;
 import org.apache.ambari.server.orm.RequiresSession;
-import org.apache.ambari.server.orm.entities.AdminSettingEntity;
+import org.apache.ambari.server.orm.entities.SettingEntity;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManager;
@@ -30,7 +30,7 @@ import javax.persistence.TypedQuery;
 import java.util.List;
 import java.util.List;
 
 
 @Singleton
 @Singleton
-public class AdminSettingDAO {
+public class SettingDAO {
 
 
   @Inject
   @Inject
   Provider<EntityManager> entityManagerProvider;
   Provider<EntityManager> entityManagerProvider;
@@ -38,61 +38,61 @@ public class AdminSettingDAO {
   DaoUtils daoUtils;
   DaoUtils daoUtils;
 
 
   /**
   /**
-   * Find an admin setting with the given name.
+   * Find a setting with the given name.
    *
    *
-   * @param name - name of admin setting.
-   * @return  a matching admin setting or null
+   * @param name - name of setting.
+   * @return  a matching setting or null
    */
    */
   @RequiresSession
   @RequiresSession
-  public AdminSettingEntity findByName(String name) {
+  public SettingEntity findByName(String name) {
     if (StringUtils.isBlank(name)) {
     if (StringUtils.isBlank(name)) {
       return null;
       return null;
     }
     }
-    TypedQuery<AdminSettingEntity> query = entityManagerProvider.get()
-            .createNamedQuery("adminSettingByName", AdminSettingEntity.class);
+    TypedQuery<SettingEntity> query = entityManagerProvider.get()
+            .createNamedQuery("settingByName", SettingEntity.class);
     query.setParameter("name", name);
     query.setParameter("name", name);
     return daoUtils.selectOne(query);
     return daoUtils.selectOne(query);
   }
   }
 
 
   /**
   /**
-   * Find all admin settings.
+   * Find all settings.
    *
    *
-   * @return all admin setting instances.
+   * @return all setting instances.
    */
    */
   @RequiresSession
   @RequiresSession
-  public List<AdminSettingEntity> findAll() {
-    return daoUtils.selectAll(entityManagerProvider.get(), AdminSettingEntity.class);
+  public List<SettingEntity> findAll() {
+    return daoUtils.selectAll(entityManagerProvider.get(), SettingEntity.class);
   }
   }
 
 
   /**
   /**
-   * Create a new admin setting entity.
+   * Create a new setting entity.
    *
    *
    * @param entity - entity to be created
    * @param entity - entity to be created
    */
    */
   @Transactional
   @Transactional
-  public void create(AdminSettingEntity entity) {
+  public void create(SettingEntity entity) {
     entityManagerProvider.get().persist(entity);
     entityManagerProvider.get().persist(entity);
   }
   }
 
 
   /**
   /**
-   * Update admin setting instance.
+   * Update setting instance.
    *
    *
    * @param entity - entity to be updated.
    * @param entity - entity to be updated.
-   * @return - updated admin entity.
+   * @return - updated entity.
    */
    */
   @Transactional
   @Transactional
-  public AdminSettingEntity merge(AdminSettingEntity entity) {
+  public SettingEntity merge(SettingEntity entity) {
     return entityManagerProvider.get().merge(entity);
     return entityManagerProvider.get().merge(entity);
   }
   }
 
 
   /**
   /**
-   * Delete admin setting with given name.
+   * Delete setting with given name.
    *
    *
-   * @param name - name of admin setting to be deleted.
+   * @param name - name of setting to be deleted.
    */
    */
   @Transactional
   @Transactional
   public void removeByName(String name) {
   public void removeByName(String name) {
-    AdminSettingEntity entity = findByName(name);
+    SettingEntity entity = findByName(name);
     if (entity!= null) {
     if (entity!= null) {
       entityManagerProvider.get().remove(entity);
       entityManagerProvider.get().remove(entity);
     }
     }

+ 11 - 11
ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AdminSettingEntity.java → ambari-server/src/main/java/org/apache/ambari/server/orm/entities/SettingEntity.java

@@ -30,19 +30,19 @@ import javax.persistence.TableGenerator;
 import java.util.Objects;
 import java.util.Objects;
 
 
 /**
 /**
- * Entity representing AdminSetting.
+ * Entity representing Setting.
  */
  */
-@Table(name = "adminsetting")
-@TableGenerator(name = "admin_setting_id_generator",
+@Table(name = "setting")
+@TableGenerator(name = "setting_id_generator",
     table = "ambari_sequences", pkColumnName = "sequence_name", valueColumnName = "sequence_value",
     table = "ambari_sequences", pkColumnName = "sequence_name", valueColumnName = "sequence_value",
-        pkColumnValue = "admin_setting_id_seq", initialValue = 0)
+        pkColumnValue = "setting_id_seq", initialValue = 0)
 
 
-@NamedQuery(name = "adminSettingByName", query = "SELECT adminSetting FROM AdminSettingEntity adminsetting WHERE adminSetting.name=:name")
+@NamedQuery(name = "settingByName", query = "SELECT setting FROM SettingEntity setting WHERE setting.name=:name")
 @Entity
 @Entity
-public class AdminSettingEntity {
+public class SettingEntity {
   @Id
   @Id
   @Column(name = "id", nullable = false, insertable = true, updatable = false)
   @Column(name = "id", nullable = false, insertable = true, updatable = false)
-  @GeneratedValue(strategy = GenerationType.TABLE, generator = "admin_setting_id_generator")
+  @GeneratedValue(strategy = GenerationType.TABLE, generator = "setting_id_generator")
   private long id;
   private long id;
 
 
   @Column(name = "name", nullable = false, insertable = true, updatable = false, unique = true)
   @Column(name = "name", nullable = false, insertable = true, updatable = false, unique = true)
@@ -66,7 +66,7 @@ public class AdminSettingEntity {
   @Basic
   @Basic
   private long updateTimestamp;
   private long updateTimestamp;
 
 
-  public AdminSettingEntity() {
+  public SettingEntity() {
   }
   }
 
 
   public long getId() {
   public long getId() {
@@ -117,8 +117,8 @@ public class AdminSettingEntity {
     this.updateTimestamp = updateTimestamp;
     this.updateTimestamp = updateTimestamp;
   }
   }
 
 
-  public AdminSettingEntity clone() {
-    AdminSettingEntity cloned = new AdminSettingEntity();
+  public SettingEntity clone() {
+    SettingEntity cloned = new SettingEntity();
     cloned.setId(id);
     cloned.setId(id);
     cloned.setName(name);
     cloned.setName(name);
     cloned.setContent(content);
     cloned.setContent(content);
@@ -133,7 +133,7 @@ public class AdminSettingEntity {
     if (this == o) return true;
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
     if (o == null || getClass() != o.getClass()) return false;
 
 
-    AdminSettingEntity entity = (AdminSettingEntity) o;
+    SettingEntity entity = (SettingEntity) o;
     return id == entity.id &&
     return id == entity.id &&
             Objects.equals(name, entity.name) &&
             Objects.equals(name, entity.name) &&
             Objects.equals(settingType, entity.settingType) &&
             Objects.equals(settingType, entity.settingType) &&

+ 1 - 1
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/RoleAuthorization.java

@@ -32,7 +32,7 @@ public enum RoleAuthorization {
   AMBARI_ADD_DELETE_CLUSTERS("AMBARI.ADD_DELETE_CLUSTERS"),
   AMBARI_ADD_DELETE_CLUSTERS("AMBARI.ADD_DELETE_CLUSTERS"),
   AMBARI_ASSIGN_ROLES("AMBARI.ASSIGN_ROLES"),
   AMBARI_ASSIGN_ROLES("AMBARI.ASSIGN_ROLES"),
   AMBARI_EDIT_STACK_REPOS("AMBARI.EDIT_STACK_REPOS"),
   AMBARI_EDIT_STACK_REPOS("AMBARI.EDIT_STACK_REPOS"),
-  AMBARI_MANAGE_ADMIN_SETTINGS("AMBARI.MANAGE_ADMIN_SETTINGS"),
+  AMBARI_MANAGE_SETTINGS("AMBARI.MANAGE_SETTINGS"),
   AMBARI_MANAGE_GROUPS("AMBARI.MANAGE_GROUPS"),
   AMBARI_MANAGE_GROUPS("AMBARI.MANAGE_GROUPS"),
   AMBARI_MANAGE_STACK_VERSIONS("AMBARI.MANAGE_STACK_VERSIONS"),
   AMBARI_MANAGE_STACK_VERSIONS("AMBARI.MANAGE_STACK_VERSIONS"),
   AMBARI_MANAGE_USERS("AMBARI.MANAGE_USERS"),
   AMBARI_MANAGE_USERS("AMBARI.MANAGE_USERS"),

+ 4 - 4
ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql

@@ -655,7 +655,7 @@ CREATE TABLE topology_logical_task (
   PRIMARY KEY (id)
   PRIMARY KEY (id)
 );
 );
 
 
-CREATE TABLE adminsetting (
+CREATE TABLE setting (
   id BIGINT NOT NULL,
   id BIGINT NOT NULL,
   name VARCHAR(255) NOT NULL UNIQUE,
   name VARCHAR(255) NOT NULL UNIQUE,
   setting_type VARCHAR(255) NOT NULL,
   setting_type VARCHAR(255) NOT NULL,
@@ -1033,7 +1033,7 @@ INSERT INTO ambari_sequences (sequence_name, sequence_value)
   union all
   union all
   select 'topology_host_group_id_seq', 0 FROM SYSIBM.SYSDUMMY1
   select 'topology_host_group_id_seq', 0 FROM SYSIBM.SYSDUMMY1
   union all
   union all
-  select 'admin_setting_id_seq', 0 FROM SYSIBM.SYSDUMMY1
+  select 'setting_id_seq', 0 FROM SYSIBM.SYSDUMMY1
   union all
   union all
   select 'hostcomponentstate_id_seq', 0  FROM SYSIBM.SYSDUMMY1;
   select 'hostcomponentstate_id_seq', 0  FROM SYSIBM.SYSDUMMY1;
 
 
@@ -1111,7 +1111,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' FROM SYSIBM.SYSDUMMY1 UNION ALL
-  SELECT 'AMBARI.MANAGE_ADMIN_SETTINGS', 'Manage administrative settings' FROM SYSIBM.SYSDUMMY1 UNION ALL
+  SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage settings' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' FROM SYSIBM.SYSDUMMY1 UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' FROM SYSIBM.SYSDUMMY1 UNION ALL
@@ -1292,7 +1292,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
-  SELECT permission_id, 'AMBARI.MANAGE_ADMIN_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
+  SELECT permission_id, 'AMBARI.MANAGE_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR'  UNION ALL

+ 4 - 4
ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql

@@ -662,7 +662,7 @@ CREATE TABLE topology_logical_task (
   PRIMARY KEY (id)
   PRIMARY KEY (id)
 );
 );
 
 
-CREATE TABLE adminsetting (
+CREATE TABLE setting (
   id BIGINT NOT NULL,
   id BIGINT NOT NULL,
   name VARCHAR(255) NOT NULL UNIQUE,
   name VARCHAR(255) NOT NULL UNIQUE,
   setting_type VARCHAR(255) NOT NULL,
   setting_type VARCHAR(255) NOT NULL,
@@ -997,7 +997,7 @@ INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_lo
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_logical_task_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_logical_task_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_request_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_request_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_host_group_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_host_group_id_seq', 0);
-INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('admin_setting_id_seq', 0);
+INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('setting_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('hostcomponentstate_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('hostcomponentstate_id_seq', 0);
 
 
 insert into adminresourcetype (resource_type_id, resource_type_name)
 insert into adminresourcetype (resource_type_id, resource_type_name)
@@ -1076,7 +1076,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
-  SELECT 'AMBARI.MANAGE_ADMIN_SETTINGS', 'Manage administrative settings' UNION ALL
+  SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage administrative settings' UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
@@ -1263,7 +1263,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
-  SELECT permission_id, 'AMBARI.MANAGE_ADMIN_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+  SELECT permission_id, 'AMBARI.MANAGE_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL

+ 4 - 4
ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql

@@ -651,7 +651,7 @@ CREATE TABLE topology_logical_task (
   PRIMARY KEY (id)
   PRIMARY KEY (id)
 );
 );
 
 
-CREATE TABLE adminsetting (
+CREATE TABLE setting (
   id NUMBER(19) NOT NULL,
   id NUMBER(19) NOT NULL,
   name VARCHAR(255) NOT NULL UNIQUE,
   name VARCHAR(255) NOT NULL UNIQUE,
   setting_type VARCHAR(255) NOT NULL,
   setting_type VARCHAR(255) NOT NULL,
@@ -987,7 +987,7 @@ INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_lo
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_logical_task_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_logical_task_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_request_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_request_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_host_group_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_host_group_id_seq', 0);
-INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('admin_setting_id_seq', 0);
+INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('setting_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('hostcomponentstate_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('hostcomponentstate_id_seq', 0);
 
 
 INSERT INTO metainfo("metainfo_key", "metainfo_value") values ('version', '${ambariVersion}');
 INSERT INTO metainfo("metainfo_key", "metainfo_value") values ('version', '${ambariVersion}');
@@ -1068,7 +1068,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' FROM dual UNION ALL
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' FROM dual UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' FROM dual UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' FROM dual UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' FROM dual UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' FROM dual UNION ALL
-  SELECT 'AMBARI.MANAGE_ADMIN_SETTINGS', 'Manage administrative settings' FROM dual UNION ALL
+  SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage settings' FROM dual UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' FROM dual UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' FROM dual UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' FROM dual UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' FROM dual UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' FROM dual UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' FROM dual UNION ALL
@@ -1255,7 +1255,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
-  SELECT permission_id, 'AMBARI.MANAGE_ADMIN_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+  SELECT permission_id, 'AMBARI.MANAGE_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL

+ 4 - 4
ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql

@@ -655,7 +655,7 @@ CREATE TABLE topology_logical_task (
   PRIMARY KEY (id)
   PRIMARY KEY (id)
 );
 );
 
 
-CREATE TABLE adminsetting (
+CREATE TABLE setting (
   id BIGINT NOT NULL,
   id BIGINT NOT NULL,
   name VARCHAR(255) NOT NULL UNIQUE,
   name VARCHAR(255) NOT NULL UNIQUE,
   setting_type VARCHAR(255) NOT NULL,
   setting_type VARCHAR(255) NOT NULL,
@@ -1033,7 +1033,7 @@ INSERT INTO ambari_sequences (sequence_name, sequence_value)
   union all
   union all
   select 'topology_host_group_id_seq', 0
   select 'topology_host_group_id_seq', 0
   union all
   union all
-  select 'admin_setting_id_seq', 0
+  select 'setting_id_seq', 0
   union all
   union all
   select 'hostcomponentstate_id_seq', 0;
   select 'hostcomponentstate_id_seq', 0;
 
 
@@ -1113,7 +1113,7 @@ INSERT INTO roleauthorization(authorization_id, authorization_name)
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
-  SELECT 'AMBARI.MANAGE_ADMIN_SETTINGS', 'Manage administrative settings' UNION ALL
+  SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage administrative settings' UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
@@ -1300,7 +1300,7 @@ INSERT INTO permission_roleauthorization(permission_id, authorization_id)
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
-  SELECT permission_id, 'AMBARI.MANAGE_ADMIN_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+  SELECT permission_id, 'AMBARI.MANAGE_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL

+ 5 - 5
ambari-server/src/main/resources/Ambari-DDL-Postgres-EMBEDDED-CREATE.sql

@@ -736,7 +736,7 @@ CREATE TABLE ambari.topology_logical_task (
 );
 );
 GRANT ALL PRIVILEGES ON TABLE ambari.topology_logical_task TO :username;
 GRANT ALL PRIVILEGES ON TABLE ambari.topology_logical_task TO :username;
 
 
-CREATE TABLE ambari.adminsetting (
+CREATE TABLE ambari.setting (
   id BIGINT NOT NULL,
   id BIGINT NOT NULL,
   name VARCHAR(255) NOT NULL UNIQUE,
   name VARCHAR(255) NOT NULL UNIQUE,
   setting_type VARCHAR(255) NOT NULL,
   setting_type VARCHAR(255) NOT NULL,
@@ -745,7 +745,7 @@ CREATE TABLE ambari.adminsetting (
   update_timestamp BIGINT NOT NULL,
   update_timestamp BIGINT NOT NULL,
   PRIMARY KEY (id)
   PRIMARY KEY (id)
 );
 );
-GRANT ALL PRIVILEGES ON TABLE ambari.adminsetting TO :username;
+GRANT ALL PRIVILEGES ON TABLE ambari.setting TO :username;
 
 
 -- tasks indices --
 -- tasks indices --
 CREATE INDEX idx_stage_request_id ON ambari.stage (request_id);
 CREATE INDEX idx_stage_request_id ON ambari.stage (request_id);
@@ -1132,7 +1132,7 @@ INSERT INTO ambari.ambari_sequences (sequence_name, sequence_value)
   union all
   union all
   select 'topology_host_group_id_seq', 0
   select 'topology_host_group_id_seq', 0
   union all
   union all
-  select 'admin_setting_id_seq', 0
+  select 'setting_id_seq', 0
   union all
   union all
   select 'hostcomponentstate_id_seq', 0;
   select 'hostcomponentstate_id_seq', 0;
 
 
@@ -1212,7 +1212,7 @@ INSERT INTO ambari.roleauthorization(authorization_id, authorization_name)
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
   SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
   SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
   SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
-  SELECT 'AMBARI.MANAGE_ADMIN_SETTINGS', 'Manage administrative settings' UNION ALL
+  SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage settings' UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
   SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
   SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
   SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
@@ -1399,7 +1399,7 @@ INSERT INTO ambari.permission_roleauthorization(permission_id, authorization_id)
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
-  SELECT permission_id, 'AMBARI.MANAGE_ADMIN_SETTINGS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+  SELECT permission_id, 'AMBARI.MANAGE_SETTINGS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
   SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM ambari.adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL

+ 4 - 4
ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql

@@ -652,7 +652,7 @@ CREATE TABLE topology_logical_task (
   PRIMARY KEY (id)
   PRIMARY KEY (id)
 );
 );
 
 
-CREATE TABLE adminsetting (
+CREATE TABLE setting (
   id NUMERIC(19) NOT NULL,
   id NUMERIC(19) NOT NULL,
   name VARCHAR(255) NOT NULL UNIQUE,
   name VARCHAR(255) NOT NULL UNIQUE,
   setting_type VARCHAR(255) NOT NULL,
   setting_type VARCHAR(255) NOT NULL,
@@ -984,7 +984,7 @@ INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_lo
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_logical_task_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_logical_task_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_request_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_request_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_host_group_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('topology_host_group_id_seq', 0);
-INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('admin_setting_id_seq', 0);
+INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('setting_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('hostcomponentstate_id_seq', 0);
 INSERT INTO ambari_sequences(sequence_name, sequence_value) values ('hostcomponentstate_id_seq', 0);
 
 
 insert into adminresourcetype (resource_type_id, resource_type_name)
 insert into adminresourcetype (resource_type_id, resource_type_name)
@@ -1063,7 +1063,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
     SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
     SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
     SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
     SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
     SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
     SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
-    SELECT 'AMBARI.MANAGE_ADMIN_SETTINGS', 'Manage administrative settings' UNION ALL
+    SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage settings' UNION ALL
     SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
     SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
     SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
     SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
     SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
     SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
@@ -1250,7 +1250,7 @@ insert into adminpermission(permission_id, permission_name, resource_type_id, pe
     SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
-    SELECT permission_id, 'AMBARI.MANAGE_ADMIN_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+    SELECT permission_id, 'AMBARI.MANAGE_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL

+ 4 - 4
ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql

@@ -760,7 +760,7 @@ CREATE TABLE topology_logical_task (
   PRIMARY KEY CLUSTERED (id)
   PRIMARY KEY CLUSTERED (id)
 );
 );
 
 
-CREATE TABLE adminsetting (
+CREATE TABLE setting (
   id BIGINT NOT NULL,
   id BIGINT NOT NULL,
   name VARCHAR(255) NOT NULL UNIQUE,
   name VARCHAR(255) NOT NULL UNIQUE,
   setting_type VARCHAR(255) NOT NULL,
   setting_type VARCHAR(255) NOT NULL,
@@ -1100,7 +1100,7 @@ BEGIN TRANSACTION
     ('topology_logical_task_id_seq', 0),
     ('topology_logical_task_id_seq', 0),
     ('topology_request_id_seq', 0),
     ('topology_request_id_seq', 0),
     ('topology_host_group_id_seq', 0),
     ('topology_host_group_id_seq', 0),
-    ('admin_setting_id_seq', 0),
+    ('setting_id_seq', 0),
     ('hostcomponentstate_id_seq', 0);
     ('hostcomponentstate_id_seq', 0);
 
 
   insert into adminresourcetype (resource_type_id, resource_type_name)
   insert into adminresourcetype (resource_type_id, resource_type_name)
@@ -1173,7 +1173,7 @@ BEGIN TRANSACTION
     SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
     SELECT 'AMBARI.ADD_DELETE_CLUSTERS', 'Create new clusters' UNION ALL
     SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
     SELECT 'AMBARI.SET_SERVICE_USERS_GROUPS', 'Set service users and groups' UNION ALL
     SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
     SELECT 'AMBARI.RENAME_CLUSTER', 'Rename clusters' UNION ALL
-    SELECT 'AMBARI.MANAGE_ADMIN_SETTINGS', 'Manage administrative settings' UNION ALL
+    SELECT 'AMBARI.MANAGE_SETTINGS', 'Manage settings' UNION ALL
     SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
     SELECT 'AMBARI.MANAGE_USERS', 'Manage users' UNION ALL
     SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
     SELECT 'AMBARI.MANAGE_GROUPS', 'Manage groups' UNION ALL
     SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
     SELECT 'AMBARI.MANAGE_VIEWS', 'Manage Ambari Views' UNION ALL
@@ -1360,7 +1360,7 @@ BEGIN TRANSACTION
     SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.ADD_DELETE_CLUSTERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.SET_SERVICE_USERS_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.RENAME_CLUSTER' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
-    SELECT permission_id, 'AMBARI.MANAGE_ADMIN_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
+    SELECT permission_id, 'AMBARI.MANAGE_SETTINGS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_USERS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_GROUPS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL
     SELECT permission_id, 'AMBARI.MANAGE_VIEWS' FROM adminpermission WHERE permission_name='AMBARI.ADMINISTRATOR' UNION ALL

+ 1 - 1
ambari-server/src/main/resources/META-INF/persistence.xml

@@ -88,7 +88,7 @@
     <class>org.apache.ambari.server.orm.entities.TopologyHostInfoEntity</class>
     <class>org.apache.ambari.server.orm.entities.TopologyHostInfoEntity</class>
     <class>org.apache.ambari.server.orm.entities.TopologyHostTaskEntity</class>
     <class>org.apache.ambari.server.orm.entities.TopologyHostTaskEntity</class>
     <class>org.apache.ambari.server.orm.entities.TopologyLogicalTaskEntity</class>
     <class>org.apache.ambari.server.orm.entities.TopologyLogicalTaskEntity</class>
-    <class>org.apache.ambari.server.orm.entities.AdminSettingEntity</class>
+    <class>org.apache.ambari.server.orm.entities.SettingEntity</class>
     <class>org.apache.ambari.server.orm.entities.KerberosDescriptorEntity</class>
     <class>org.apache.ambari.server.orm.entities.KerberosDescriptorEntity</class>
 
 
     <properties>
     <properties>

+ 22 - 22
ambari-server/src/test/java/org/apache/ambari/server/api/services/AdminSettingServiceTest.java → ambari-server/src/test/java/org/apache/ambari/server/api/services/SettingServiceTest.java

@@ -30,56 +30,56 @@ import java.util.List;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertEquals;
 
 
 /**
 /**
- * Unit test for {@link AdminSettingService}
+ * Unit test for {@link SettingService}
  */
  */
-public class AdminSettingServiceTest extends BaseServiceTest {
+public class SettingServiceTest extends BaseServiceTest {
   @Override
   @Override
   public List<ServiceTestInvocation> getTestInvocations() throws Exception {
   public List<ServiceTestInvocation> getTestInvocations() throws Exception {
     List<ServiceTestInvocation> listInvocations = new ArrayList<>();
     List<ServiceTestInvocation> listInvocations = new ArrayList<>();
 
 
     //getSetting
     //getSetting
-    AdminSettingService adminSettingService = new TestAdminSettingService("settingName");
-    Method m = adminSettingService.getClass().getMethod("getSetting", String.class, HttpHeaders.class, UriInfo.class, String.class);
+    SettingService settingService = new TestSettingService("settingName");
+    Method m = settingService.getClass().getMethod("getSetting", String.class, HttpHeaders.class, UriInfo.class, String.class);
     Object[] args = new Object[] {null, getHttpHeaders(), getUriInfo(), "settingName"};
     Object[] args = new Object[] {null, getHttpHeaders(), getUriInfo(), "settingName"};
-    listInvocations.add(new ServiceTestInvocation(Request.Type.GET, adminSettingService, m, args, null));
+    listInvocations.add(new ServiceTestInvocation(Request.Type.GET, settingService, m, args, null));
 
 
     //getSettings
     //getSettings
-    adminSettingService = new TestAdminSettingService(null);
-    m = adminSettingService.getClass().getMethod("getSettings", String.class, HttpHeaders.class, UriInfo.class);
+    settingService = new TestSettingService(null);
+    m = settingService.getClass().getMethod("getSettings", String.class, HttpHeaders.class, UriInfo.class);
     args = new Object[] {null, getHttpHeaders(), getUriInfo()};
     args = new Object[] {null, getHttpHeaders(), getUriInfo()};
-    listInvocations.add(new ServiceTestInvocation(Request.Type.GET, adminSettingService, m, args, null));
+    listInvocations.add(new ServiceTestInvocation(Request.Type.GET, settingService, m, args, null));
 
 
     //createSetting
     //createSetting
-    adminSettingService = new TestAdminSettingService(null);
-    m = adminSettingService.getClass().getMethod("createSetting", String.class, HttpHeaders.class, UriInfo.class);
+    settingService = new TestSettingService(null);
+    m = settingService.getClass().getMethod("createSetting", String.class, HttpHeaders.class, UriInfo.class);
     args = new Object[] {"body", getHttpHeaders(), getUriInfo()};
     args = new Object[] {"body", getHttpHeaders(), getUriInfo()};
-    listInvocations.add(new ServiceTestInvocation(Request.Type.POST, adminSettingService, m, args, "body"));
+    listInvocations.add(new ServiceTestInvocation(Request.Type.POST, settingService, m, args, "body"));
 
 
     //updateSetting
     //updateSetting
-    adminSettingService = new TestAdminSettingService("settingName");
-    m = adminSettingService.getClass().getMethod("updateSetting", String.class, HttpHeaders.class, UriInfo.class, String.class);
+    settingService = new TestSettingService("settingName");
+    m = settingService.getClass().getMethod("updateSetting", String.class, HttpHeaders.class, UriInfo.class, String.class);
     args = new Object[] {"body", getHttpHeaders(), getUriInfo(), "settingName"};
     args = new Object[] {"body", getHttpHeaders(), getUriInfo(), "settingName"};
-    listInvocations.add(new ServiceTestInvocation(Request.Type.PUT, adminSettingService, m, args, "body"));
+    listInvocations.add(new ServiceTestInvocation(Request.Type.PUT, settingService, m, args, "body"));
 
 
     //deleteSetting
     //deleteSetting
-    adminSettingService = new TestAdminSettingService("settingName");
-    m = adminSettingService.getClass().getMethod("deleteSetting", HttpHeaders.class, UriInfo.class, String.class);
+    settingService = new TestSettingService("settingName");
+    m = settingService.getClass().getMethod("deleteSetting", HttpHeaders.class, UriInfo.class, String.class);
     args = new Object[] {getHttpHeaders(), getUriInfo(), "settingName"};
     args = new Object[] {getHttpHeaders(), getUriInfo(), "settingName"};
-    listInvocations.add(new ServiceTestInvocation(Request.Type.DELETE, adminSettingService, m, args, null));
+    listInvocations.add(new ServiceTestInvocation(Request.Type.DELETE, settingService, m, args, null));
 
 
     return listInvocations;
     return listInvocations;
   }
   }
 
 
-  private class TestAdminSettingService extends AdminSettingService {
-    private String adminSettingName;
+  private class TestSettingService extends SettingService {
+    private String settingName;
 
 
-    private TestAdminSettingService(String settingName) {
-      this.adminSettingName = settingName;
+    private TestSettingService(String settingName) {
+      this.settingName = settingName;
     }
     }
 
 
     @Override
     @Override
     ResourceInstance createSettingResource(String settingName) {
     ResourceInstance createSettingResource(String settingName) {
-      assertEquals(this.adminSettingName, settingName);
+      assertEquals(this.settingName, settingName);
       return getTestResource();
       return getTestResource();
     }
     }
 
 

+ 71 - 72
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AdminSettingResourceProviderTest.java → ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SettingResourceProviderTest.java

@@ -18,7 +18,6 @@
 package org.apache.ambari.server.controller.internal;
 package org.apache.ambari.server.controller.internal;
 
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Lists;
-import org.apache.ambari.server.DuplicateResourceException;
 import org.apache.ambari.server.controller.spi.Predicate;
 import org.apache.ambari.server.controller.spi.Predicate;
 import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.spi.Request;
 import org.apache.ambari.server.controller.spi.RequestStatus;
 import org.apache.ambari.server.controller.spi.RequestStatus;
@@ -26,8 +25,8 @@ import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
 import org.apache.ambari.server.controller.utilities.PredicateBuilder;
 import org.apache.ambari.server.controller.utilities.PredicateBuilder;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.apache.ambari.server.orm.dao.AdminSettingDAO;
-import org.apache.ambari.server.orm.entities.AdminSettingEntity;
+import org.apache.ambari.server.orm.dao.SettingDAO;
+import org.apache.ambari.server.orm.entities.SettingEntity;
 import org.apache.ambari.server.security.TestAuthenticationFactory;
 import org.apache.ambari.server.security.TestAuthenticationFactory;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
@@ -46,28 +45,28 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Map;
 import java.util.Set;
 import java.util.Set;
 
 
-import static org.apache.ambari.server.controller.internal.AdminSettingResourceProvider.ADMINSETTING_NAME_PROPERTY_ID;
-import static org.apache.ambari.server.controller.internal.AdminSettingResourceProvider.ADMINSETTING_SETTING_TYPE_PROPERTY_ID;
-import static org.apache.ambari.server.controller.internal.AdminSettingResourceProvider.ADMINSETTING_CONTENT_PROPERTY_ID;
-import static org.apache.ambari.server.controller.internal.AdminSettingResourceProvider.ADMINSETTING_UPDATED_BY_PROPERTY_ID;
-import static org.apache.ambari.server.controller.internal.AdminSettingResourceProvider.ADMINSETTING_UPDATE_TIMESTAMP_PROPERTY_ID;
+import static org.apache.ambari.server.controller.internal.SettingResourceProvider.SETTING_NAME_PROPERTY_ID;
+import static org.apache.ambari.server.controller.internal.SettingResourceProvider.SETTING_SETTING_TYPE_PROPERTY_ID;
+import static org.apache.ambari.server.controller.internal.SettingResourceProvider.SETTING_CONTENT_PROPERTY_ID;
+import static org.apache.ambari.server.controller.internal.SettingResourceProvider.SETTING_UPDATED_BY_PROPERTY_ID;
+import static org.apache.ambari.server.controller.internal.SettingResourceProvider.SETTING_UPDATE_TIMESTAMP_PROPERTY_ID;
 import static org.easymock.EasyMock.capture;
 import static org.easymock.EasyMock.capture;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.createControl;
 import static org.easymock.EasyMock.createControl;
 
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertEquals;
 
 
-public class AdminSettingResourceProviderTest {
+public class SettingResourceProviderTest {
   IMocksControl mockControl;
   IMocksControl mockControl;
-  AdminSettingDAO dao;
-  AdminSettingResourceProvider resourceProvider;
+  SettingDAO dao;
+  SettingResourceProvider resourceProvider;
 
 
 
 
   @Before
   @Before
   public void setUp() throws Exception {
   public void setUp() throws Exception {
     mockControl = createControl();
     mockControl = createControl();
-    dao = mockControl.createMock(AdminSettingDAO.class);
-    resourceProvider = new AdminSettingResourceProvider();
+    dao = mockControl.createMock(SettingDAO.class);
+    resourceProvider = new SettingResourceProvider();
     setPrivateField(resourceProvider, "dao", dao);
     setPrivateField(resourceProvider, "dao", dao);
   }
   }
 
 
@@ -87,7 +86,7 @@ public class AdminSettingResourceProviderTest {
   public void testGetResources_instance_clusterUser() throws Exception {
   public void testGetResources_instance_clusterUser() throws Exception {
     setupAuthenticationForClusterUser();
     setupAuthenticationForClusterUser();
     String name = "motd";
     String name = "motd";
-    AdminSettingEntity entity = newEntity(name);
+    SettingEntity entity = newEntity(name);
 
 
     Set<Resource> response = getResources_instance(entity, readRequest());
     Set<Resource> response = getResources_instance(entity, readRequest());
     assertEquals(1, response.size());
     assertEquals(1, response.size());
@@ -98,7 +97,7 @@ public class AdminSettingResourceProviderTest {
   @Test
   @Test
   public void testGetResources_instance_admin() throws Exception {
   public void testGetResources_instance_admin() throws Exception {
     setupAuthenticationForAdmin();
     setupAuthenticationForAdmin();
-    AdminSettingEntity entity = newEntity("motd");
+    SettingEntity entity = newEntity("motd");
     Set<Resource> response = getResources_instance(entity, readRequest());
     Set<Resource> response = getResources_instance(entity, readRequest());
     assertEquals(1, response.size());
     assertEquals(1, response.size());
     Resource resource = response.iterator().next();
     Resource resource = response.iterator().next();
@@ -109,11 +108,11 @@ public class AdminSettingResourceProviderTest {
   public void testGetResources_collection_noAuth() throws Exception {
   public void testGetResources_collection_noAuth() throws Exception {
     mockControl.replay();
     mockControl.replay();
     Request request = PropertyHelper.getReadRequest(
     Request request = PropertyHelper.getReadRequest(
-            ADMINSETTING_NAME_PROPERTY_ID,
-            ADMINSETTING_CONTENT_PROPERTY_ID,
-            ADMINSETTING_SETTING_TYPE_PROPERTY_ID,
-            ADMINSETTING_UPDATED_BY_PROPERTY_ID,
-            ADMINSETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
+            SETTING_NAME_PROPERTY_ID,
+            SETTING_CONTENT_PROPERTY_ID,
+            SETTING_SETTING_TYPE_PROPERTY_ID,
+            SETTING_UPDATED_BY_PROPERTY_ID,
+            SETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
     resourceProvider.getResources(request, null);
     resourceProvider.getResources(request, null);
   }
   }
 
 
@@ -121,14 +120,14 @@ public class AdminSettingResourceProviderTest {
   public void testGetResources_collection_clusterUser() throws Exception {
   public void testGetResources_collection_clusterUser() throws Exception {
     setupAuthenticationForClusterUser();
     setupAuthenticationForClusterUser();
 
 
-    AdminSettingEntity entity1 = newEntity("motd");
-    AdminSettingEntity entity2 = newEntity("ldap");
+    SettingEntity entity1 = newEntity("motd");
+    SettingEntity entity2 = newEntity("ldap");
     Request request = PropertyHelper.getReadRequest(
     Request request = PropertyHelper.getReadRequest(
-            ADMINSETTING_NAME_PROPERTY_ID,
-            ADMINSETTING_CONTENT_PROPERTY_ID,
-            ADMINSETTING_SETTING_TYPE_PROPERTY_ID,
-            ADMINSETTING_UPDATED_BY_PROPERTY_ID,
-            ADMINSETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
+            SETTING_NAME_PROPERTY_ID,
+            SETTING_CONTENT_PROPERTY_ID,
+            SETTING_SETTING_TYPE_PROPERTY_ID,
+            SETTING_UPDATED_BY_PROPERTY_ID,
+            SETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
 
 
     expect(dao.findAll()).andReturn(Lists.newArrayList(entity1, entity2));
     expect(dao.findAll()).andReturn(Lists.newArrayList(entity1, entity2));
     mockControl.replay();
     mockControl.replay();
@@ -138,9 +137,9 @@ public class AdminSettingResourceProviderTest {
     Map<Object, Resource> resourceMap = new HashMap<>();
     Map<Object, Resource> resourceMap = new HashMap<>();
     Iterator<Resource> resourceIterator = response.iterator();
     Iterator<Resource> resourceIterator = response.iterator();
     Resource nextResource = resourceIterator.next();
     Resource nextResource = resourceIterator.next();
-    resourceMap.put(nextResource.getPropertyValue(ADMINSETTING_NAME_PROPERTY_ID), nextResource);
+    resourceMap.put(nextResource.getPropertyValue(SETTING_NAME_PROPERTY_ID), nextResource);
     nextResource = resourceIterator.next();
     nextResource = resourceIterator.next();
-    resourceMap.put(nextResource.getPropertyValue(ADMINSETTING_NAME_PROPERTY_ID), nextResource);
+    resourceMap.put(nextResource.getPropertyValue(SETTING_NAME_PROPERTY_ID), nextResource);
     assertEqualsEntityAndResource(entity1, resourceMap.get(entity1.getName()));
     assertEqualsEntityAndResource(entity1, resourceMap.get(entity1.getName()));
     assertEqualsEntityAndResource(entity2, resourceMap.get(entity2.getName()));
     assertEqualsEntityAndResource(entity2, resourceMap.get(entity2.getName()));
   }
   }
@@ -149,14 +148,14 @@ public class AdminSettingResourceProviderTest {
   public void testGetResources_collection_admin() throws Exception {
   public void testGetResources_collection_admin() throws Exception {
     setupAuthenticationForAdmin();
     setupAuthenticationForAdmin();
 
 
-    AdminSettingEntity entity1 = newEntity("motd");
-    AdminSettingEntity entity2 = newEntity("ldap");
+    SettingEntity entity1 = newEntity("motd");
+    SettingEntity entity2 = newEntity("ldap");
     Request request = PropertyHelper.getReadRequest(
     Request request = PropertyHelper.getReadRequest(
-            ADMINSETTING_NAME_PROPERTY_ID,
-            ADMINSETTING_CONTENT_PROPERTY_ID,
-            ADMINSETTING_SETTING_TYPE_PROPERTY_ID,
-            ADMINSETTING_UPDATED_BY_PROPERTY_ID,
-            ADMINSETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
+            SETTING_NAME_PROPERTY_ID,
+            SETTING_CONTENT_PROPERTY_ID,
+            SETTING_SETTING_TYPE_PROPERTY_ID,
+            SETTING_UPDATED_BY_PROPERTY_ID,
+            SETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
     expect(dao.findAll()).andReturn(Lists.newArrayList(entity1, entity2));
     expect(dao.findAll()).andReturn(Lists.newArrayList(entity1, entity2));
     mockControl.replay();
     mockControl.replay();
 
 
@@ -165,9 +164,9 @@ public class AdminSettingResourceProviderTest {
     Map<Object, Resource> resourceMap = new HashMap<>();
     Map<Object, Resource> resourceMap = new HashMap<>();
     Iterator<Resource> resourceIterator = response.iterator();
     Iterator<Resource> resourceIterator = response.iterator();
     Resource nextResource = resourceIterator.next();
     Resource nextResource = resourceIterator.next();
-    resourceMap.put(nextResource.getPropertyValue(ADMINSETTING_NAME_PROPERTY_ID), nextResource);
+    resourceMap.put(nextResource.getPropertyValue(SETTING_NAME_PROPERTY_ID), nextResource);
     nextResource = resourceIterator.next();
     nextResource = resourceIterator.next();
-    resourceMap.put(nextResource.getPropertyValue(ADMINSETTING_NAME_PROPERTY_ID), nextResource);
+    resourceMap.put(nextResource.getPropertyValue(SETTING_NAME_PROPERTY_ID), nextResource);
     assertEqualsEntityAndResource(entity1, resourceMap.get(entity1.getName()));
     assertEqualsEntityAndResource(entity1, resourceMap.get(entity1.getName()));
     assertEqualsEntityAndResource(entity2, resourceMap.get(entity2.getName()));
     assertEqualsEntityAndResource(entity2, resourceMap.get(entity2.getName()));
   }
   }
@@ -188,8 +187,8 @@ public class AdminSettingResourceProviderTest {
   @Test
   @Test
   public void testCreateResource_admin() throws Exception {
   public void testCreateResource_admin() throws Exception {
     setupAuthenticationForAdmin();
     setupAuthenticationForAdmin();
-    AdminSettingEntity entity = newEntity("motd");
-    Capture<AdminSettingEntity> entityCapture = Capture.newInstance();
+    SettingEntity entity = newEntity("motd");
+    Capture<SettingEntity> entityCapture = Capture.newInstance();
     Request request = createRequest(entity);
     Request request = createRequest(entity);
 
 
     expect(dao.findByName(entity.getName())).andReturn(null);
     expect(dao.findByName(entity.getName())).andReturn(null);
@@ -200,7 +199,7 @@ public class AdminSettingResourceProviderTest {
     assertEquals(RequestStatus.Status.Complete, response.getStatus());
     assertEquals(RequestStatus.Status.Complete, response.getStatus());
     Set<Resource> associatedResources = response.getAssociatedResources();
     Set<Resource> associatedResources = response.getAssociatedResources();
     assertEquals(1, associatedResources.size());
     assertEquals(1, associatedResources.size());
-    AdminSettingEntity capturedEntity = entityCapture.getValue();
+    SettingEntity capturedEntity = entityCapture.getValue();
     assertEquals(entity.getName(), capturedEntity.getName());
     assertEquals(entity.getName(), capturedEntity.getName());
     assertEquals(entity.getContent(), capturedEntity.getContent());
     assertEquals(entity.getContent(), capturedEntity.getContent());
     assertEquals(entity.getSettingType(), capturedEntity.getSettingType());
     assertEquals(entity.getSettingType(), capturedEntity.getSettingType());
@@ -210,7 +209,7 @@ public class AdminSettingResourceProviderTest {
   @Test(expected = ResourceAlreadyExistsException.class)
   @Test(expected = ResourceAlreadyExistsException.class)
   public void testCreateDuplicateResource() throws Exception {
   public void testCreateDuplicateResource() throws Exception {
     setupAuthenticationForAdmin();
     setupAuthenticationForAdmin();
-    AdminSettingEntity entity = newEntity("motd");
+    SettingEntity entity = newEntity("motd");
     Request request = createRequest(entity);
     Request request = createRequest(entity);
 
 
     expect(dao.findByName(entity.getName())).andReturn(entity);
     expect(dao.findByName(entity.getName())).andReturn(entity);
@@ -235,21 +234,21 @@ public class AdminSettingResourceProviderTest {
   public void testUpdateResources_admin() throws Exception {
   public void testUpdateResources_admin() throws Exception {
     setupAuthenticationForAdmin();
     setupAuthenticationForAdmin();
     String name = "motd";
     String name = "motd";
-    AdminSettingEntity oldEntity = newEntity(name);
-    AdminSettingEntity updatedEntity = oldEntity.clone();
+    SettingEntity oldEntity = newEntity(name);
+    SettingEntity updatedEntity = oldEntity.clone();
     updatedEntity.setContent("{text}");
     updatedEntity.setContent("{text}");
     updatedEntity.setSettingType("new-type");
     updatedEntity.setSettingType("new-type");
 
 
     PredicateBuilder pb = new PredicateBuilder();
     PredicateBuilder pb = new PredicateBuilder();
-    Predicate predicate = pb.begin().property(ADMINSETTING_NAME_PROPERTY_ID).equals(name).end().toPredicate();
-    Capture<AdminSettingEntity> capture = Capture.newInstance();
+    Predicate predicate = pb.begin().property(SETTING_NAME_PROPERTY_ID).equals(name).end().toPredicate();
+    Capture<SettingEntity> capture = Capture.newInstance();
 
 
     expect(dao.findByName(name)).andReturn(oldEntity);
     expect(dao.findByName(name)).andReturn(oldEntity);
     expect(dao.merge(capture(capture))).andReturn(updatedEntity);
     expect(dao.merge(capture(capture))).andReturn(updatedEntity);
     mockControl.replay();
     mockControl.replay();
 
 
     RequestStatus response = resourceProvider.updateResources(updateRequest(updatedEntity), predicate);
     RequestStatus response = resourceProvider.updateResources(updateRequest(updatedEntity), predicate);
-    AdminSettingEntity capturedEntity = capture.getValue();
+    SettingEntity capturedEntity = capture.getValue();
     assertEquals(RequestStatus.Status.Complete, response.getStatus());
     assertEquals(RequestStatus.Status.Complete, response.getStatus());
     assertEquals(updatedEntity.getId(), capturedEntity.getId());
     assertEquals(updatedEntity.getId(), capturedEntity.getId());
     assertEquals(updatedEntity.getName(), capturedEntity.getName());
     assertEquals(updatedEntity.getName(), capturedEntity.getName());
@@ -278,16 +277,16 @@ public class AdminSettingResourceProviderTest {
 
 
     String name = "motd";
     String name = "motd";
     PredicateBuilder pb = new PredicateBuilder();
     PredicateBuilder pb = new PredicateBuilder();
-    Predicate predicate = pb.begin().property(ADMINSETTING_NAME_PROPERTY_ID).equals(name).end().toPredicate();
+    Predicate predicate = pb.begin().property(SETTING_NAME_PROPERTY_ID).equals(name).end().toPredicate();
     dao.removeByName(name);
     dao.removeByName(name);
     mockControl.replay();
     mockControl.replay();
     resourceProvider.deleteResources(predicate);
     resourceProvider.deleteResources(predicate);
   }
   }
 
 
-  private Set<Resource> getResources_instance(AdminSettingEntity entity, Request request) throws Exception {
+  private Set<Resource> getResources_instance(SettingEntity entity, Request request) throws Exception {
     String name = entity.getName();
     String name = entity.getName();
     PredicateBuilder pb = new PredicateBuilder();
     PredicateBuilder pb = new PredicateBuilder();
-    Predicate predicate = pb.begin().property(ADMINSETTING_NAME_PROPERTY_ID).equals(name).end().toPredicate();
+    Predicate predicate = pb.begin().property(SETTING_NAME_PROPERTY_ID).equals(name).end().toPredicate();
 
 
     expect(dao.findByName(name)).andReturn(entity).anyTimes();
     expect(dao.findByName(name)).andReturn(entity).anyTimes();
     mockControl.replay();
     mockControl.replay();
@@ -297,27 +296,27 @@ public class AdminSettingResourceProviderTest {
 
 
   private Request readRequest() {
   private Request readRequest() {
     return PropertyHelper.getReadRequest(
     return PropertyHelper.getReadRequest(
-            ADMINSETTING_NAME_PROPERTY_ID,
-            ADMINSETTING_CONTENT_PROPERTY_ID,
-            ADMINSETTING_SETTING_TYPE_PROPERTY_ID,
-            ADMINSETTING_UPDATED_BY_PROPERTY_ID,
-            ADMINSETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
+            SETTING_NAME_PROPERTY_ID,
+            SETTING_CONTENT_PROPERTY_ID,
+            SETTING_SETTING_TYPE_PROPERTY_ID,
+            SETTING_UPDATED_BY_PROPERTY_ID,
+            SETTING_UPDATE_TIMESTAMP_PROPERTY_ID);
   }
   }
 
 
-  private Request createRequest(AdminSettingEntity entity) {
+  private Request createRequest(SettingEntity entity) {
     Map<String, Object> properties = new HashMap<>();
     Map<String, Object> properties = new HashMap<>();
-    properties.put(ADMINSETTING_NAME_PROPERTY_ID, entity.getName());
-    properties.put(ADMINSETTING_CONTENT_PROPERTY_ID, entity.getContent());
-    properties.put(ADMINSETTING_UPDATED_BY_PROPERTY_ID, entity.getUpdatedBy());
-    properties.put(ADMINSETTING_SETTING_TYPE_PROPERTY_ID, entity.getSettingType());
+    properties.put(SETTING_NAME_PROPERTY_ID, entity.getName());
+    properties.put(SETTING_CONTENT_PROPERTY_ID, entity.getContent());
+    properties.put(SETTING_UPDATED_BY_PROPERTY_ID, entity.getUpdatedBy());
+    properties.put(SETTING_SETTING_TYPE_PROPERTY_ID, entity.getSettingType());
     return PropertyHelper.getCreateRequest(Collections.singleton(properties), null);
     return PropertyHelper.getCreateRequest(Collections.singleton(properties), null);
   }
   }
 
 
-  private Request updateRequest(AdminSettingEntity entity) {
+  private Request updateRequest(SettingEntity entity) {
     Map<String, Object> properties = new HashMap<>();
     Map<String, Object> properties = new HashMap<>();
-    properties.put(ADMINSETTING_NAME_PROPERTY_ID, entity.getName());
-    properties.put(ADMINSETTING_CONTENT_PROPERTY_ID, entity.getContent());
-    properties.put(ADMINSETTING_SETTING_TYPE_PROPERTY_ID, entity.getSettingType());
+    properties.put(SETTING_NAME_PROPERTY_ID, entity.getName());
+    properties.put(SETTING_CONTENT_PROPERTY_ID, entity.getContent());
+    properties.put(SETTING_SETTING_TYPE_PROPERTY_ID, entity.getSettingType());
     return PropertyHelper.getUpdateRequest(properties, null);
     return PropertyHelper.getUpdateRequest(properties, null);
   }
   }
 
 
@@ -329,8 +328,8 @@ public class AdminSettingResourceProviderTest {
     SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
     SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator());
   }
   }
 
 
-  private AdminSettingEntity newEntity(String name) {
-    AdminSettingEntity entity = new AdminSettingEntity();
+  private SettingEntity newEntity(String name) {
+    SettingEntity entity = new SettingEntity();
     entity.setName(name);
     entity.setName(name);
     entity.setContent(RandomStringUtils.randomAlphabetic(10));
     entity.setContent(RandomStringUtils.randomAlphabetic(10));
     entity.setSettingType(RandomStringUtils.randomAlphabetic(5));
     entity.setSettingType(RandomStringUtils.randomAlphabetic(5));
@@ -339,12 +338,12 @@ public class AdminSettingResourceProviderTest {
     return entity;
     return entity;
   }
   }
 
 
-  private void assertEqualsEntityAndResource(AdminSettingEntity entity, Resource resource) {
-    assertEquals(entity.getName(), resource.getPropertyValue(ADMINSETTING_NAME_PROPERTY_ID));
-    assertEquals(entity.getSettingType(), resource.getPropertyValue(ADMINSETTING_SETTING_TYPE_PROPERTY_ID));
-    assertEquals(entity.getContent(), resource.getPropertyValue(ADMINSETTING_CONTENT_PROPERTY_ID));
-    assertEquals(entity.getUpdatedBy(), resource.getPropertyValue(ADMINSETTING_UPDATED_BY_PROPERTY_ID));
-    assertEquals(entity.getUpdateTimestamp(), resource.getPropertyValue(ADMINSETTING_UPDATE_TIMESTAMP_PROPERTY_ID));
+  private void assertEqualsEntityAndResource(SettingEntity entity, Resource resource) {
+    assertEquals(entity.getName(), resource.getPropertyValue(SETTING_NAME_PROPERTY_ID));
+    assertEquals(entity.getSettingType(), resource.getPropertyValue(SETTING_SETTING_TYPE_PROPERTY_ID));
+    assertEquals(entity.getContent(), resource.getPropertyValue(SETTING_CONTENT_PROPERTY_ID));
+    assertEquals(entity.getUpdatedBy(), resource.getPropertyValue(SETTING_UPDATED_BY_PROPERTY_ID));
+    assertEquals(entity.getUpdateTimestamp(), resource.getPropertyValue(SETTING_UPDATE_TIMESTAMP_PROPERTY_ID));
   }
   }
 
 
   private void setPrivateField(Object o, String field, Object value) throws Exception{
   private void setPrivateField(Object o, String field, Object value) throws Exception{

+ 10 - 10
ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AdminSettingDAOTest.java → ambari-server/src/test/java/org/apache/ambari/server/orm/dao/SettingDAOTest.java

@@ -22,7 +22,7 @@ import com.google.inject.Injector;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.GuiceJpaInitializer;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
 import org.apache.ambari.server.orm.OrmTestHelper;
 import org.apache.ambari.server.orm.OrmTestHelper;
-import org.apache.ambari.server.orm.entities.AdminSettingEntity;
+import org.apache.ambari.server.orm.entities.SettingEntity;
 import org.junit.Before;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.Test;
 
 
@@ -33,24 +33,24 @@ import java.util.Objects;
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertNull;
 
 
-public class AdminSettingDAOTest {
+public class SettingDAOTest {
   private  Injector injector;
   private  Injector injector;
-  private  AdminSettingDAO dao;
+  private SettingDAO dao;
 
 
   @Before
   @Before
   public void setUp() {
   public void setUp() {
     injector = Guice.createInjector(new InMemoryDefaultTestModule());
     injector = Guice.createInjector(new InMemoryDefaultTestModule());
-    dao = injector.getInstance(AdminSettingDAO.class);
+    dao = injector.getInstance(SettingDAO.class);
     injector.getInstance(GuiceJpaInitializer.class);
     injector.getInstance(GuiceJpaInitializer.class);
     injector.getInstance(OrmTestHelper.class).createCluster();
     injector.getInstance(OrmTestHelper.class).createCluster();
   }
   }
 
 
   @Test
   @Test
   public void testCRUD() {
   public void testCRUD() {
-    Map<String, AdminSettingEntity> entities = new HashMap<>();
+    Map<String, SettingEntity> entities = new HashMap<>();
     //Create
     //Create
     for (int i=0; i < 3; i++) {
     for (int i=0; i < 3; i++) {
-      AdminSettingEntity entity = new AdminSettingEntity();
+      SettingEntity entity = new SettingEntity();
       entity.setName("motd" + i);
       entity.setName("motd" + i);
       entity.setContent("test content" + i);
       entity.setContent("test content" + i);
       entity.setUpdatedBy("ambari");
       entity.setUpdatedBy("ambari");
@@ -69,7 +69,7 @@ public class AdminSettingDAOTest {
 
 
 
 
     //Update
     //Update
-    for(Map.Entry<String, AdminSettingEntity> entry : entities.entrySet()) {
+    for(Map.Entry<String, SettingEntity> entry : entities.entrySet()) {
       entry.getValue().setContent(Objects.toString(Math.random()));
       entry.getValue().setContent(Objects.toString(Math.random()));
       dao.merge(entry.getValue());
       dao.merge(entry.getValue());
     }
     }
@@ -78,14 +78,14 @@ public class AdminSettingDAOTest {
     assertEquals(entities.size(), dao.findAll().size());
     assertEquals(entities.size(), dao.findAll().size());
 
 
     //Delete
     //Delete
-    for(Map.Entry<String, AdminSettingEntity> entry : entities.entrySet()) {
+    for(Map.Entry<String, SettingEntity> entry : entities.entrySet()) {
       dao.removeByName(entry.getKey());
       dao.removeByName(entry.getKey());
     }
     }
     assertEquals(0, dao.findAll().size());
     assertEquals(0, dao.findAll().size());
   }
   }
 
 
-  private void retrieveAndValidateSame(Map<String, AdminSettingEntity> entities) {
-    for(Map.Entry<String, AdminSettingEntity> entry : entities.entrySet()) {
+  private void retrieveAndValidateSame(Map<String, SettingEntity> entities) {
+    for(Map.Entry<String, SettingEntity> entry : entities.entrySet()) {
       String name = entry.getKey();
       String name = entry.getKey();
       assertEquals(entry.getValue(), dao.findByName(name));
       assertEquals(entry.getValue(), dao.findByName(name));
     }
     }

+ 10 - 11
ambari-server/src/test/java/org/apache/ambari/server/orm/entities/AdminSettingEntityTest.java → ambari-server/src/test/java/org/apache/ambari/server/orm/entities/SettingEntityTest.java

@@ -17,20 +17,19 @@
  */
  */
 package org.apache.ambari.server.orm.entities;
 package org.apache.ambari.server.orm.entities;
 
 
-import org.junit.Assert;
 import org.junit.Test;
 import org.junit.Test;
 
 
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertEquals;
 
 
 /**
 /**
- * AdminSettingEntity unit tests.
+ * SettingEntity unit tests.
  */
  */
-public class AdminSettingEntityTest {
+public class SettingEntityTest {
 
 
   @Test
   @Test
   public void testSetGetId() {
   public void testSetGetId() {
     long id = 1000;
     long id = 1000;
-    AdminSettingEntity entity = new AdminSettingEntity();
+    SettingEntity entity = new SettingEntity();
     entity.setId(id);
     entity.setId(id);
     assertEquals(id, entity.getId());
     assertEquals(id, entity.getId());
   }
   }
@@ -38,7 +37,7 @@ public class AdminSettingEntityTest {
   @Test
   @Test
   public void testSetGetName() {
   public void testSetGetName() {
     String name = "motd";
     String name = "motd";
-    AdminSettingEntity entity = new AdminSettingEntity();
+    SettingEntity entity = new SettingEntity();
     entity.setName(name);
     entity.setName(name);
     assertEquals(name, entity.getName());
     assertEquals(name, entity.getName());
   }
   }
@@ -46,7 +45,7 @@ public class AdminSettingEntityTest {
   @Test
   @Test
   public void testSetGetSettingType() {
   public void testSetGetSettingType() {
     String settingType = "ambari-server";
     String settingType = "ambari-server";
-    AdminSettingEntity entity = new AdminSettingEntity();
+    SettingEntity entity = new SettingEntity();
     entity.setSettingType(settingType);
     entity.setSettingType(settingType);
     assertEquals(settingType, entity.getSettingType());
     assertEquals(settingType, entity.getSettingType());
   }
   }
@@ -54,7 +53,7 @@ public class AdminSettingEntityTest {
   @Test
   @Test
   public void testSetGetContent() {
   public void testSetGetContent() {
     String content = "{tag:random-tag, text:random-text}";
     String content = "{tag:random-tag, text:random-text}";
-    AdminSettingEntity entity = new AdminSettingEntity();
+    SettingEntity entity = new SettingEntity();
     entity.setContent(content);
     entity.setContent(content);
     assertEquals(content, entity.getContent());
     assertEquals(content, entity.getContent());
   }
   }
@@ -62,7 +61,7 @@ public class AdminSettingEntityTest {
   @Test
   @Test
   public void testSetGetUpdatedBy() {
   public void testSetGetUpdatedBy() {
     String updatedBy = "ambari";
     String updatedBy = "ambari";
-    AdminSettingEntity entity = new AdminSettingEntity();
+    SettingEntity entity = new SettingEntity();
     entity.setUpdatedBy(updatedBy);
     entity.setUpdatedBy(updatedBy);
     assertEquals(updatedBy, entity.getUpdatedBy());
     assertEquals(updatedBy, entity.getUpdatedBy());
   }
   }
@@ -70,21 +69,21 @@ public class AdminSettingEntityTest {
   @Test
   @Test
   public void testSetGetUpdatedTimeStamp() {
   public void testSetGetUpdatedTimeStamp() {
     long updateTimeStamp = 1234567890;
     long updateTimeStamp = 1234567890;
-    AdminSettingEntity entity = new AdminSettingEntity();
+    SettingEntity entity = new SettingEntity();
     entity.setUpdateTimestamp(updateTimeStamp);
     entity.setUpdateTimestamp(updateTimeStamp);
     assertEquals(updateTimeStamp, entity.getUpdateTimestamp());
     assertEquals(updateTimeStamp, entity.getUpdateTimestamp());
   }
   }
 
 
   @Test
   @Test
   public void testEquals() {
   public void testEquals() {
-    AdminSettingEntity entity = new AdminSettingEntity();
+    SettingEntity entity = new SettingEntity();
     entity.setId(1);
     entity.setId(1);
     entity.setName("motd");
     entity.setName("motd");
     entity.setContent("{tag:random-tag, text:random-text}");
     entity.setContent("{tag:random-tag, text:random-text}");
     entity.setSettingType("ambari-server");
     entity.setSettingType("ambari-server");
     entity.setUpdatedBy("ambari");
     entity.setUpdatedBy("ambari");
     entity.setUpdateTimestamp(1234567890);
     entity.setUpdateTimestamp(1234567890);
-    AdminSettingEntity newEntity = entity.clone();
+    SettingEntity newEntity = entity.clone();
     assertEquals(entity, newEntity);
     assertEquals(entity, newEntity);
   }
   }