Search in sources :

Example 1 with RangerPluginInfoList

use of org.apache.ranger.view.RangerPluginInfoList in project ranger by apache.

the class ServiceREST method getPluginsInfo.

@GET
@Path("/plugins/info")
@Produces({ "application/json", "application/xml" })
@PreAuthorize("@rangerPreAuthSecurityHandler.isAPIAccessible(\"" + RangerAPIList.GET_PLUGINS_INFO + "\")")
public RangerPluginInfoList getPluginsInfo(@Context HttpServletRequest request) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("==> ServiceREST.getPluginsInfo()");
    }
    RangerPluginInfoList ret = null;
    SearchFilter filter = searchUtil.getSearchFilter(request, pluginInfoService.getSortFields());
    try {
        PList<RangerPluginInfo> paginatedPluginsInfo = pluginInfoService.searchRangerPluginInfo(filter);
        if (paginatedPluginsInfo != null) {
            ret = new RangerPluginInfoList();
            ret.setPluginInfoList(paginatedPluginsInfo.getList());
            ret.setPageSize(paginatedPluginsInfo.getPageSize());
            ret.setResultSize(paginatedPluginsInfo.getResultSize());
            ret.setStartIndex(paginatedPluginsInfo.getStartIndex());
            ret.setTotalCount(paginatedPluginsInfo.getTotalCount());
            ret.setSortBy(paginatedPluginsInfo.getSortBy());
            ret.setSortType(paginatedPluginsInfo.getSortType());
        }
    } catch (WebApplicationException excp) {
        throw excp;
    } catch (Throwable excp) {
        LOG.error("getPluginsInfo() failed", excp);
        throw restErrorUtil.createRESTException(excp.getMessage());
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("<== ServiceREST.getPluginsInfo()");
    }
    return ret;
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) RangerPluginInfoList(org.apache.ranger.view.RangerPluginInfoList) SearchFilter(org.apache.ranger.plugin.util.SearchFilter) RangerPluginInfo(org.apache.ranger.plugin.model.RangerPluginInfo) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 RangerPluginInfo (org.apache.ranger.plugin.model.RangerPluginInfo)1 SearchFilter (org.apache.ranger.plugin.util.SearchFilter)1 RangerPluginInfoList (org.apache.ranger.view.RangerPluginInfoList)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1