|
|
@ -37,7 +37,8 @@ public class APIUtil {
|
|
|
|
|
|
|
|
|
|
|
|
private static ApplicationManager applicationManager;
|
|
|
|
private static ApplicationManager applicationManager;
|
|
|
|
|
|
|
|
|
|
|
|
public static ApplicationManager getApplicationManagemer() {
|
|
|
|
public static ApplicationManager getApplicationManager() {
|
|
|
|
|
|
|
|
|
|
|
|
if (applicationManager == null) {
|
|
|
|
if (applicationManager == null) {
|
|
|
|
synchronized (APIUtil.class) {
|
|
|
|
synchronized (APIUtil.class) {
|
|
|
|
if (applicationManager == null) {
|
|
|
|
if (applicationManager == null) {
|
|
|
@ -52,10 +53,12 @@ public class APIUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return applicationManager;
|
|
|
|
return applicationManager;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Response getResponse(ApplicationManagementException ex, Response.Status status) {
|
|
|
|
public static Response getResponse(ApplicationManagementException ex, Response.Status status) {
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: check for exception type and set the response code.
|
|
|
|
//TODO: check for exception type and set the response code.
|
|
|
|
ErrorResponse errorMessage = new ErrorResponse();
|
|
|
|
ErrorResponse errorMessage = new ErrorResponse();
|
|
|
|
errorMessage.setMessage(ex.getMessage());
|
|
|
|
errorMessage.setMessage(ex.getMessage());
|
|
|
@ -64,5 +67,6 @@ public class APIUtil {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
errorMessage.setCode(status.getStatusCode());
|
|
|
|
errorMessage.setCode(status.getStatusCode());
|
|
|
|
return Response.status(status).entity(errorMessage).build();
|
|
|
|
return Response.status(status).entity(errorMessage).build();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|