Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.annotations;

import org.apache.ambari.server.configuration.Configuration;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* The {@link ClusterScale} class is a representation of the size of the
* cluster combined with a value. It's used to represent different
* configuration values depending on how many hosts are in the cluster.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD })
public @interface ClusterScale {
Configuration.ClusterSizeType clusterSize();
String value();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ambari.annotations;

import org.apache.ambari.server.configuration.Configuration;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* The {@link ConfigurationMarkdown} is used to represent more complex
* Markdown for {@link Configuration.ConfigurationProperty} fields. It wraps the traditional
* {@link Markdown} along with extra metadata used to generate documentation.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD })
public @interface ConfigurationMarkdown {
/**
* The base Markdown.
*
* @return
*/
Markdown markdown();

/**
* The logic grouping that the configuration property belongs to.
*
* @return
*/
Configuration.ConfigurationGrouping group();

/**
* All of the recommended values for the property based on cluster size.
*
* @return
*/
ClusterScale[] scaleValues() default {};
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
import org.apache.ambari.annotations.Experimental;
import org.apache.ambari.annotations.ExperimentalFeature;
import org.apache.ambari.annotations.Markdown;
import org.apache.ambari.annotations.ConfigurationMarkdown;
import org.apache.ambari.annotations.ClusterScale;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.actionmanager.CommandExecutionType;
import org.apache.ambari.server.actionmanager.HostRoleCommand;
Expand Down Expand Up @@ -5994,7 +5996,7 @@ public int compareTo(ConfigurationProperty<?> o) {
/**
* The {@link ConfigurationGrouping} represents a logical grouping of configurations.
*/
private enum ConfigurationGrouping {
public enum ConfigurationGrouping {
/**
* Alerts & Notifications.
*/
Expand Down Expand Up @@ -6032,7 +6034,7 @@ public String toString() {
* The {@link ClusterSizeType} is used to represent fixed sizes of clusters
* for easy table generation when creating documentation.
*/
private enum ClusterSizeType {
public enum ClusterSizeType {
/**
* 10 Hosts.
*/
Expand Down Expand Up @@ -6076,47 +6078,6 @@ public String toString() {
}
}

/**
* The {@link ConfigurationMarkdown} is used to represent more complex
* Markdown for {@link ConfigurationProperty} fields. It wraps the traditional
* {@link Markdown} along with extra metadata used to generate documentation.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD })
@interface ConfigurationMarkdown {
/**
* The base Markdown.
*
* @return
*/
Markdown markdown();

/**
* The logic grouping that the configuration property belongs to.
*
* @return
*/
ConfigurationGrouping group();

/**
* All of the recommended values for the property based on cluster size.
*
* @return
*/
ClusterScale[] scaleValues() default {};
}

/**
* The {@link ClusterScale} class is a representation of the size of the
* cluster combined with a value. It's used to represent different
* configuration values depending on how many hosts are in the cluster.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD })
private @interface ClusterScale {
ClusterSizeType clusterSize();
String value();
}

/**
* Creates an AmbariKerberosAuthenticationProperties instance containing the Kerberos authentication-specific
Expand Down
12 changes: 7 additions & 5 deletions ambari-server/src/main/resources/version_definition.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,25 @@

<xs:simpleType name="family-type">
<xs:restriction base="xs:string">

<xs:enumeration value="redhat6" />
<xs:enumeration value="redhat5" /><!--for test-->
<xs:enumeration value="centos5" /><!--for test-->
<xs:enumeration value="centos6" /><!--for test-->
<xs:enumeration value="redhat6" /><!--for test-->
<xs:enumeration value="redhat7" />
<xs:enumeration value="redhat8" />
<xs:enumeration value="redhat9" />
<xs:enumeration value="fedora36" />
<xs:enumeration value="fedora38" />
<xs:enumeration value="redhat-ppc6" />
<xs:enumeration value="redhat-ppc7" />
<xs:enumeration value="debian6" /><!-- //test-->
<xs:enumeration value="debian6" /><!--for test-->
<xs:enumeration value="debian10" />
<xs:enumeration value="debian11" />
<xs:enumeration value="ubuntu14" /><!-- //test-->
<xs:enumeration value="ubuntu14" /><!--for test-->
<xs:enumeration value="ubuntu20" />
<xs:enumeration value="ubuntu22" />
<xs:enumeration value="suse11" />
<xs:enumeration value="suse11sp3" /><!-- //test-->
<xs:enumeration value="suse11sp3" /><!--for test-->
<xs:enumeration value="suse12" />
<xs:enumeration value="amazonlinux2" />
<xs:enumeration value="openeuler22" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
Expand All @@ -36,8 +37,8 @@
import java.util.Properties;

import org.apache.ambari.annotations.Markdown;
import org.apache.ambari.annotations.ConfigurationMarkdown;
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.configuration.Configuration.ConfigurationMarkdown;
import org.apache.ambari.server.configuration.Configuration.ConfigurationProperty;
import org.apache.ambari.server.configuration.Configuration.ConnectionPoolType;
import org.apache.ambari.server.configuration.Configuration.DatabaseType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,31 +176,16 @@ public void setConfigs(AmbariManagementController controller, String masterProto
Class<?> c = controller.getClass();
Field f = c.getDeclaredField("masterProtocol");
f.setAccessible(true);

Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);

f.set(controller, masterProtocol);

// masterHostname
f = c.getDeclaredField("masterHostname");
f.setAccessible(true);

modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);

f.set(controller, masterHostname);

// masterPort
f = c.getDeclaredField("masterPort");
f.setAccessible(true);

modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(f, f.getModifiers() & ~Modifier.FINAL);

f.set(controller, masterPort);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public void testGetAvailable() throws Exception {
VersionDefinitionResourceProvider.SHOW_AVAILABLE).equals("true").toPredicate();

Set<Resource> results = versionProvider.getResources(getRequest, predicate);
Assert.assertEquals(3, results.size());
Assert.assertEquals(2, results.size());

boolean found1 = false;
boolean found2 = false;
Expand Down