YARN-5796. Convert enums values in service code to upper case and special handling of an error. Contributed by Gour Saha

This commit is contained in:
Jian He 2016-11-01 11:00:11 -07:00
parent 09e4b9e897
commit 3741e5518f
5 changed files with 15 additions and 7 deletions

View File

@ -172,6 +172,10 @@ public class ApplicationApiService implements ApplicationApi {
applicationStatus.setDiagnostics(ERROR_APPLICATION_IN_USE);
return Response.status(Status.BAD_REQUEST).entity(applicationStatus)
.build();
} else if (se.getExitCode() == SliderExitCodes.EXIT_INSTANCE_EXISTS) {
applicationStatus.setDiagnostics(ERROR_APPLICATION_INSTANCE_EXISTS);
return Response.status(Status.BAD_REQUEST).entity(applicationStatus)
.build();
} else {
applicationStatus.setDiagnostics(se.getMessage());
}

View File

@ -40,7 +40,7 @@ public class Artifact implements Serializable {
private String id = null;
public enum TypeEnum {
DOCKER("docker"), TARBALL("tarball"), APPLICATION("application");
DOCKER("DOCKER"), TARBALL("TARBALL"), APPLICATION("APPLICATION");
private String value;

View File

@ -43,8 +43,8 @@ public class ConfigFile implements Serializable {
private static final long serialVersionUID = -7009402089417704612L;
public enum TypeEnum {
XML("xml"), PROPERTIES("properties"), JSON("json"), YAML("yaml"), TEMPLATE(
"template"), ENV("env"), HADOOP_XML("hadoop_xml");
XML("XML"), PROPERTIES("PROPERTIES"), JSON("JSON"), YAML("YAML"), TEMPLATE(
"TEMPLATE"), ENV("ENV"), HADOOP_XML("HADOOP_XML");
private String value;

View File

@ -39,7 +39,7 @@ public class ReadinessCheck implements Serializable {
private static final long serialVersionUID = -3836839816887186801L;
public enum TypeEnum {
HTTP("http");
HTTP("HTTP");
private String value;

View File

@ -26,6 +26,11 @@ public interface RestApiErrorMessages {
String ERROR_APPLICATION_NOT_RUNNING = "Application not running";
String ERROR_APPLICATION_DOES_NOT_EXIST = "Application not found";
String ERROR_APPLICATION_IN_USE = "Application already exists in started"
+ " state";
String ERROR_APPLICATION_INSTANCE_EXISTS = "Application already exists in"
+ " stopped/failed state (either restart with PUT or destroy with DELETE"
+ " before creating a new one)";
String ERROR_SUFFIX_FOR_COMPONENT =
" for component %s (nor at the global level)";
@ -66,7 +71,6 @@ public interface RestApiErrorMessages {
String ERROR_RESOURCE_PROFILE_NOT_SUPPORTED_YET =
"Resource profile is not " + "supported yet. Please specify cpus/memory.";
String ERROR_APPLICATION_IN_USE = "Application name is already in use";
String ERROR_NULL_ARTIFACT_ID =
"Artifact Id can not be null if artifact type is none";
String ERROR_ABSENT_NUM_OF_INSTANCE =
@ -74,6 +78,6 @@ public interface RestApiErrorMessages {
String ERROR_ABSENT_LAUNCH_COMMAND =
"launch command should appear if type is slider-zip or none";
String ERROR_QUICKLINKS_FOR_COMP_INVALID =
"Quicklinks specified at component level, needs corresponding values set at application level";
String ERROR_QUICKLINKS_FOR_COMP_INVALID = "Quicklinks specified at"
+ " component level, needs corresponding values set at application level";
}