use of io.hops.hopsworks.exceptions.DelaException in project hopsworks by logicalclocks.
the class HopssiteController method removeComment.
public void removeComment(String publicCId, String publicDSId, Integer commentId, String userEmail) throws DelaException {
checkHopssiteReady();
try {
ClientWrapper client = getClient(HopsSite.CommentService.removeComment(publicCId, publicDSId, commentId), String.class).setPayload(userEmail);
LOG.log(Settings.DELA_DEBUG, "hops-site:comment:remove {0}", client.getFullPath());
client.doPost();
LOG.log(Settings.DELA_DEBUG, "hops-site:comment:remove - done {0}", client.getFullPath());
} 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 TransferDelaController method advanceDownload.
public void advanceDownload(String publicDSId, HDFSEndpoint hdfsEndpoint, KafkaEndpoint kafkaEndpoint, ExtendedDetails details) throws DelaException {
if (!delaStateController.transferDelaAvailable()) {
throw new DelaException(RESTCodes.DelaErrorCode.DELA_TRANSFER_NOT_AVAILABLE, Level.SEVERE, DelaException.Source.LOCAL);
}
HopsTorrentAdvanceDownload reqContent = new HopsTorrentAdvanceDownload(new TorrentId(publicDSId), kafkaEndpoint, hdfsEndpoint, details);
try {
ClientWrapper<SuccessJSON> rc = ClientWrapper.httpInstance(SuccessJSON.class).setTarget(settings.getDELA_TRANSFER_HTTP_ENDPOINT()).setPath("torrent/hops/download/advance/xml").setPayload(reqContent);
SuccessJSON result = rc.doPost();
} catch (IllegalStateException ise) {
logger.log(Level.WARNING, "dela communication fail:{0}", ise.getMessage());
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.DELA, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.exceptions.DelaException in project hopsworks by logicalclocks.
the class TransferDelaController method getDelaPublicEndpoint.
public AddressJSON getDelaPublicEndpoint(String delaVersion) throws DelaException {
String delaTransferHttpEndpoint = SettingsHelper.delaTransferHttpEndpoint(settings);
try {
ClientWrapper<AddressJSON> rc = ClientWrapper.httpInstance(AddressJSON.class).setTarget(delaTransferHttpEndpoint).setPath(TransferDela.CONTACT).setPayload(delaVersion);
logger.log(Settings.DELA_DEBUG, "dela:contact {0}", rc.getFullPath());
AddressJSON result = rc.doPost();
logger.log(Settings.DELA_DEBUG, "dela:contact - done {0} {1}", new Object[] { rc.getFullPath(), result.getIp() });
return result;
} catch (IllegalStateException ise) {
logger.log(Level.WARNING, "dela:contact - communication fail{0}", ise.getMessage());
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.DELA, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.exceptions.DelaException in project hopsworks by logicalclocks.
the class TransferDelaController method upload.
public void upload(String publicDSId, HopsDatasetDetailsDTO datasetDetails, HDFSResource resource, HDFSEndpoint endpoint) throws DelaException {
if (!delaStateController.transferDelaAvailable()) {
throw new DelaException(RESTCodes.DelaErrorCode.DELA_TRANSFER_NOT_AVAILABLE, Level.SEVERE, DelaException.Source.LOCAL);
}
logger.log(Settings.DELA_DEBUG, "{0} upload - transfer");
HopsTorrentUpload reqContent = new HopsTorrentUpload(new TorrentId(publicDSId), datasetDetails.getDatasetName(), datasetDetails.getProjectId(), datasetDetails.getDatasetId(), resource, endpoint);
try {
ClientWrapper<SuccessJSON> rc = ClientWrapper.httpInstance(SuccessJSON.class).setTarget(settings.getDELA_TRANSFER_HTTP_ENDPOINT()).setPath("torrent/hops/upload/xml").setPayload(reqContent);
SuccessJSON result = rc.doPost();
} catch (IllegalStateException ise) {
logger.log(Level.WARNING, "dela communication fail:{0}", ise.getMessage());
throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.DELA, null, ise.getMessage(), ise);
}
}
use of io.hops.hopsworks.exceptions.DelaException in project hopsworks by logicalclocks.
the class HopssiteController method page.
public SearchServiceDTO.Item[] page(String sessionId, int startItem, int nrItems) throws DelaException {
checkHopssiteReady();
try {
ClientWrapper client = getClient(HopsSite.DatasetService.searchPage(sessionId, startItem, nrItems), String.class);
LOG.log(Settings.DELA_DEBUG, "hops-site:dataset - {0}", client.getFullPath());
String auxResult = (String) client.doGet();
SearchServiceDTO.Item[] result = new Gson().fromJson(auxResult, SearchServiceDTO.Item[].class);
LOG.log(Settings.DELA_DEBUG, "hops-site:dataset: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);
}
}
Aggregations