use of io.hops.hopsworks.common.util.ClientWrapper in project hopsworks by logicalclocks.
the class HopssiteController method complete.
public void complete(String publicDSId) throws DelaException {
checkHopssiteReady();
String publicCId = SettingsHelper.clusterId(settings);
try {
ClientWrapper client = getClient(HopsSite.DatasetService.complete(publicCId, publicDSId), String.class);
LOG.log(Settings.DELA_DEBUG, "hops-site:dataset - {0}", client.getFullPath());
client.doPost();
LOG.log(Settings.DELA_DEBUG, "hops-site:dataset - 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.common.util.ClientWrapper in project hopsworks by logicalclocks.
the class HopssiteController method search.
// *****************************************************SEARCH*********************************************************
public SearchServiceDTO.SearchResult search(String searchTerm) throws DelaException {
checkHopssiteReady();
try {
SearchServiceDTO.Params req = new SearchServiceDTO.Params(searchTerm);
ClientWrapper client = getClient(HopsSite.DatasetService.search(), SearchServiceDTO.SearchResult.class);
client.setPayload(req);
LOG.log(Settings.DELA_DEBUG, "hops-site:dataset - {0}", client.getFullPath());
SearchServiceDTO.SearchResult result = (SearchServiceDTO.SearchResult) client.doPost();
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);
}
}
use of io.hops.hopsworks.common.util.ClientWrapper in project hopsworks by logicalclocks.
the class HopssiteController method getUserId.
public Integer getUserId(String email) throws DelaException {
checkHopssiteReady();
String publicCId = SettingsHelper.clusterId(settings);
try {
ClientWrapper client = getClient(HopsSite.UserService.getUser(publicCId, email), UserDTO.Complete.class);
LOG.log(Settings.DELA_DEBUG, "hops-site:user - {0}", client.getFullPath());
UserDTO.Complete result = (UserDTO.Complete) client.doGet();
LOG.log(Settings.DELA_DEBUG, "hops-site:user - done {0}", client.getFullPath());
return result.getUserId();
} 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.common.util.ClientWrapper in project hopsworks by logicalclocks.
the class HopssiteController method heavyPing.
public void heavyPing(List<String> upldDSIds, List<String> dwnlDSIds) throws DelaException {
checkHopssiteReady();
String publicCId = SettingsHelper.clusterId(settings);
try {
ClientWrapper client = getClient(HopsSite.ClusterService.heavyPing(publicCId), String.class);
ClusterServiceDTO.HeavyPing req = new ClusterServiceDTO.HeavyPing(upldDSIds, dwnlDSIds);
client.setPayload(req);
LOG.log(Settings.DELA_DEBUG, "hops-site:cluster - {0}", client.getFullPath());
String result = (String) client.doPut();
LOG.log(Settings.DELA_DEBUG, "hops-site:cluster - 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.common.util.ClientWrapper 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