Search in sources :

Example 11 with ResourceFilters

use of com.sun.jersey.spi.container.ResourceFilters in project druid by druid-io.

the class DatasourcesResource method getSegmentDataSourceSegment.

@GET
@Path("/{dataSourceName}/segments/{segmentId}")
@Produces(MediaType.APPLICATION_JSON)
@ResourceFilters(DatasourceResourceFilter.class)
public Response getSegmentDataSourceSegment(@PathParam("dataSourceName") String dataSourceName, @PathParam("segmentId") String segmentId) {
    DruidDataSource dataSource = getDataSource(dataSourceName);
    if (dataSource == null) {
        return Response.noContent().build();
    }
    Pair<DataSegment, Set<String>> retVal = getSegment(segmentId);
    if (retVal != null) {
        return Response.ok(ImmutableMap.of("metadata", retVal.lhs, "servers", retVal.rhs)).build();
    }
    return Response.noContent().build();
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) DruidDataSource(io.druid.client.DruidDataSource) DataSegment(io.druid.timeline.DataSegment) Path(javax.ws.rs.Path) ResourceFilters(com.sun.jersey.spi.container.ResourceFilters) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 12 with ResourceFilters

use of com.sun.jersey.spi.container.ResourceFilters in project druid by druid-io.

the class WorkerResource method doDisable.

@POST
@Path("/disable")
@Produces(MediaType.APPLICATION_JSON)
@ResourceFilters(ConfigResourceFilter.class)
public Response doDisable() {
    try {
        final Worker disabledWorker = new Worker(enabledWorker.getHost(), enabledWorker.getIp(), enabledWorker.getCapacity(), DISABLED_VERSION);
        curatorCoordinator.updateWorkerAnnouncement(disabledWorker);
        return Response.ok(ImmutableMap.of(disabledWorker.getHost(), "disabled")).build();
    } catch (Exception e) {
        return Response.serverError().build();
    }
}
Also used : Worker(io.druid.indexing.worker.Worker) IOException(java.io.IOException) Path(javax.ws.rs.Path) ResourceFilters(com.sun.jersey.spi.container.ResourceFilters) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Aggregations

ResourceFilters (com.sun.jersey.spi.container.ResourceFilters)12 Path (javax.ws.rs.Path)12 GET (javax.ws.rs.GET)11 Produces (javax.ws.rs.Produces)11 DataSegment (io.druid.timeline.DataSegment)8 Interval (org.joda.time.Interval)6 DruidDataSource (io.druid.client.DruidDataSource)5 Set (java.util.Set)4 ImmutableMap (com.google.common.collect.ImmutableMap)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 DateTime (org.joda.time.DateTime)3 Function (com.google.common.base.Function)2 Worker (io.druid.indexing.worker.Worker)2 TableDataSource (io.druid.query.TableDataSource)2 TimelineObjectHolder (io.druid.timeline.TimelineObjectHolder)2 IOException (java.io.IOException)2 POST (javax.ws.rs.POST)2 Response (javax.ws.rs.core.Response)2 Predicate (com.google.common.base.Predicate)1