Search in sources :

Example 26 with ClientWrapper

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

the class HopssiteController method reportComment.

public void reportComment(String publicCId, String publicDSId, Integer commentId, CommentIssueDTO commentIssue) throws DelaException {
    checkHopssiteReady();
    try {
        ClientWrapper client = getClient(HopsSite.CommentService.reportComment(publicCId, publicDSId, commentId), String.class);
        client.setPayload(commentIssue);
        LOG.log(Settings.DELA_DEBUG, "hops-site:comment:report {0}", client.getFullPath());
        client.doPost();
        LOG.log(Settings.DELA_DEBUG, "hops-site:comment:report - 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 27 with ClientWrapper

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

the class HopssiteController method getDatasetUserRating.

// **************************************************RATING CLUSTER****************************************************
public RatingDTO getDatasetUserRating(String publicCId, String publicDSId, String email) throws DelaException {
    checkHopssiteReady();
    try {
        ClientWrapper client = getClient(HopsSite.RatingService.getDatasetUserRating(publicCId, publicDSId), RatingDTO.class).setPayload(email);
        LOG.log(Settings.DELA_DEBUG, "hops-site:rating:get:user - {0}", client.getFullPath());
        RatingDTO result = (RatingDTO) client.doPost();
        LOG.log(Settings.DELA_DEBUG, "hops-site:rating:get:user - 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);
    }
}
Also used : RatingDTO(io.hops.hopsworks.dela.dto.hopssite.RatingDTO) DelaException(io.hops.hopsworks.exceptions.DelaException) ClientWrapper(io.hops.hopsworks.common.util.ClientWrapper)

Example 28 with ClientWrapper

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

the class HopssiteController method addCategory.

public boolean addCategory(DatasetDTO dataset) throws DelaException {
    checkHopssiteReady();
    try {
        ClientWrapper client = getClient(HopsSite.DatasetService.datasetCategory(), String.class);
        client.setPayload(dataset);
        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 29 with ClientWrapper

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

the class HopssiteController method download.

public void download(String publicDSId) throws DelaException {
    checkHopssiteReady();
    String publicCId = SettingsHelper.clusterId(settings);
    try {
        ClientWrapper client = getClient(HopsSite.DatasetService.download(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 30 with ClientWrapper

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

the class HopssiteController method addPopularDatasets.

public boolean addPopularDatasets(PopularDatasetJSON popularDatasetsJson) throws DelaException {
    checkHopssiteReady();
    try {
        ClientWrapper client = getClient(HopsSite.DatasetService.datasetPopular(), String.class);
        client.setPayload(popularDatasetsJson);
        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)

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