Search in sources :

Example 21 with ClientWrapper

use of io.hops.hopsworks.common.util.ClientWrapper in project hopsworks by logicalclocks.

the class HopssiteController method addDatasetIssue.

public boolean addDatasetIssue(DatasetIssueDTO datasetIssue) throws DelaException {
    checkHopssiteReady();
    try {
        ClientWrapper client = getClient(HopsSite.DatasetService.datasetIssue(), String.class);
        client.setPayload(datasetIssue);
        String res = (String) client.doPost();
        return "OK".equals(res);
    } catch (IllegalStateException ise) {
        throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
    }
}
Also used : DelaException(io.hops.hopsworks.exceptions.DelaException) ClientWrapper(io.hops.hopsworks.common.util.ClientWrapper)

Example 22 with ClientWrapper

use of io.hops.hopsworks.common.util.ClientWrapper in project hopsworks by logicalclocks.

the class HopssiteController method deleteRating.

public boolean deleteRating(Integer ratingId) throws DelaException {
    checkHopssiteReady();
    try {
        ClientWrapper client = getClient(HopsSite.RatingService.rating() + "/" + ratingId, String.class);
        String res = (String) client.doDelete();
        return "OK".equals(res);
    } catch (IllegalStateException ise) {
        throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
    }
}
Also used : DelaException(io.hops.hopsworks.exceptions.DelaException) ClientWrapper(io.hops.hopsworks.common.util.ClientWrapper)

Example 23 with ClientWrapper

use of io.hops.hopsworks.common.util.ClientWrapper in project hopsworks by logicalclocks.

the class HopssiteController method publish.

// ****************************************************TRACKER********************************************************
public String publish(String datasetName, String description, Collection<String> categories, long size, String userEmail) throws DelaException {
    checkHopssiteReady();
    String publicCId = SettingsHelper.clusterId(settings);
    try {
        DatasetDTO.Proto msg = new DatasetDTO.Proto(datasetName, description, categories, size, userEmail);
        ClientWrapper client = getClient(HopsSite.DatasetService.publish(publicCId), String.class);
        LOG.log(Settings.DELA_DEBUG, "hops-site:dataset - {0}", client.getFullPath());
        client.setPayload(msg);
        LOG.log(Settings.DELA_DEBUG, "hops-site:dataset - done {0}", client.getFullPath());
        String result = (String) client.doPost();
        return result;
    } catch (IllegalStateException ise) {
        throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
    }
}
Also used : DatasetDTO(io.hops.hopsworks.dela.dto.hopssite.DatasetDTO) HopsSiteDatasetDTO(io.hops.hopsworks.dela.dto.hopssite.HopsSiteDatasetDTO) DelaException(io.hops.hopsworks.exceptions.DelaException) ClientWrapper(io.hops.hopsworks.common.util.ClientWrapper)

Example 24 with ClientWrapper

use of io.hops.hopsworks.common.util.ClientWrapper in project hopsworks by logicalclocks.

the class HopssiteController method cancel.

public void cancel(String publicDSId) throws DelaException {
    checkHopssiteReady();
    String publicCId = SettingsHelper.clusterId(settings);
    try {
        ClientWrapper client = getClient(HopsSite.DatasetService.remove(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);
    }
}
Also used : DelaException(io.hops.hopsworks.exceptions.DelaException) ClientWrapper(io.hops.hopsworks.common.util.ClientWrapper)

Example 25 with ClientWrapper

use of io.hops.hopsworks.common.util.ClientWrapper in project hopsworks by logicalclocks.

the class HopssiteController method updateComment.

public void updateComment(String publicCId, String publicDSId, Integer commentId, CommentDTO.Publish comment) throws DelaException {
    checkHopssiteReady();
    try {
        ClientWrapper client = getClient(HopsSite.CommentService.updateComment(publicCId, publicDSId, commentId), String.class);
        LOG.log(Settings.DELA_DEBUG, "hops-site:comment:udpate {0}", client.getFullPath());
        client.setPayload(comment);
        client.doPut();
        LOG.log(Settings.DELA_DEBUG, "hops-site:comment:udpate - done {0}", client.getFullPath());
    } catch (IllegalStateException ise) {
        throw new DelaException(RESTCodes.DelaErrorCode.COMMUNICATION_FAILURE, Level.SEVERE, DelaException.Source.HOPS_SITE, null, ise.getMessage(), ise);
    }
}
Also used : DelaException(io.hops.hopsworks.exceptions.DelaException) ClientWrapper(io.hops.hopsworks.common.util.ClientWrapper)

Aggregations

ClientWrapper (io.hops.hopsworks.common.util.ClientWrapper)31 DelaException (io.hops.hopsworks.exceptions.DelaException)31 Gson (com.google.gson.Gson)3 UserDTO (io.hops.hopsworks.dela.dto.common.UserDTO)3 ClusterServiceDTO (io.hops.hopsworks.dela.dto.hopssite.ClusterServiceDTO)2 HopsSiteDatasetDTO (io.hops.hopsworks.dela.dto.hopssite.HopsSiteDatasetDTO)2 RatingDTO (io.hops.hopsworks.dela.dto.hopssite.RatingDTO)2 SearchServiceDTO (io.hops.hopsworks.dela.dto.hopssite.SearchServiceDTO)2 FilePreviewDTO (io.hops.hopsworks.common.dataset.FilePreviewDTO)1 DatasetDTO (io.hops.hopsworks.dela.dto.hopssite.DatasetDTO)1 List (java.util.List)1