use of io.hops.hopsworks.exceptions.DelaException in project hopsworks by logicalclocks.
the class HopssiteController method updateRating.
public boolean updateRating(RateDTO datasetRating) throws DelaException {
checkHopssiteReady();
try {
ClientWrapper client = getClient(HopsSite.RatingService.rating(), String.class);
client.setPayload(datasetRating);
String res = (String) client.doPut();
return "OK".equals(res);
} catch (IllegalStateException ise) {
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.exceptions.DelaException in project hopsworks by logicalclocks.
the class HopssiteController method delaVersion.
// *************************************************HEARTBEAT**********************************************************
public String delaVersion() throws DelaException {
checkSetupReady();
try {
ClientWrapper client = getClient(HopsSite.ClusterService.delaVersion(), String.class);
LOG.log(Settings.DELA_DEBUG, "hops-site:cluster - {0}", client.getFullPath());
String result = (String) client.doGet();
LOG.log(Settings.DELA_DEBUG, "hops-site:cluster - done {0}", client.getFullPath());
return result;
} catch (IllegalStateException ise) {
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.exceptions.DelaException in project hopsworks by logicalclocks.
the class HopssiteController method updateUser.
// *************************************************SETTINGS CHECK*****************************************************
public boolean updateUser(UserDTO.Publish userDTO) throws DelaException {
checkHopssiteReady();
try {
ClientWrapper client = getClient(HopsSite.UserService.user(), String.class);
client.setPayload(userDTO);
String res = (String) client.doPut();
return "OK".equals(res);
} catch (IllegalStateException ise) {
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.exceptions.DelaException in project hopsworks by logicalclocks.
the class HopssiteController method getDatasetAllComments.
// ***********************************************COMMENT PUBLIC*******************************************************
public List<CommentDTO.RetrieveComment> getDatasetAllComments(String publicDSId) throws DelaException {
checkHopssiteReady();
try {
ClientWrapper client = getClient(HopsSite.CommentService.getDatasetAllComments(publicDSId), String.class);
LOG.log(Settings.DELA_DEBUG, "hops-site:comment:get:all {0}", client.getFullPath());
String aux = (String) client.doGet();
CommentDTO.RetrieveComment[] result = new Gson().fromJson(aux, CommentDTO.RetrieveComment[].class);
LOG.log(Settings.DELA_DEBUG, "hops-site:comment:get:all - done {0}", client.getFullPath());
return Arrays.asList(result);
} catch (IllegalStateException ise) {
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.exceptions.DelaException in project hopsworks by logicalclocks.
the class ManifestHelper method marshall.
public static byte[] marshall(ManifestJSON manifest) throws DelaException {
Gson gson = new GsonBuilder().create();
String jsonString = gson.toJson(manifest);
byte[] jsonByte;
try {
jsonByte = jsonString.getBytes("UTF-8");
} catch (UnsupportedEncodingException ex) {
throw new DelaException(RESTCodes.DelaErrorCode.MANIFEST_ENCODING_ERROR, Level.SEVERE, DelaException.Source.LOCAL, null, ex.getMessage(), ex);
}
return jsonByte;
}
Aggregations