org.jboss.resteasy.annotations.GZIP Java Examples

The following examples show how to use org.jboss.resteasy.annotations.GZIP. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/purgeQueryCache")
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@GZIP
@Interceptors(ResponseInterceptor.class)
@RolesAllowed("Administrator")
public VoidResponse purgeQueryCache() {
    VoidResponse response = new VoidResponse();
    try {
        queryCache.clear();
        return response;
    } catch (Exception e) {
        QueryException qe = new QueryException(DatawaveErrorCode.QUERY_CACHE_PURGE_ERROR, e);
        log.error(qe, e);
        response.addException(qe.getBottomQueryException());
        int statusCode = qe.getBottomQueryException().getStatusCode();
        throw new DatawaveWebApplicationException(qe, response, statusCode);
    }
}
 
Example #2
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{logicName}/async/createAndNext")
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@EnrichQueryMetrics(methodType = MethodType.CREATE_AND_NEXT)
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Asynchronous
@Timed(name = "dw.query.createAndNextAsync", absolute = true)
public void createQueryAndNextAsync(@Required("logicName") @PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters,
                @Suspended AsyncResponse asyncResponse) {
    try {
        BaseQueryResponse response = createQueryAndNext(logicName, queryParameters);
        asyncResponse.resume(response);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #3
Source File: ModificationBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a list of the Modification service names and their configurations
 *
 * @return datawave.webservice.results.modification.ModificationConfigurationResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 * @RequestHeader X-ProxiedIssuersChain required when using X-ProxiedEntitiesChain, specify one issuer DN per subject DN listed in X-ProxiedEntitiesChain
 * @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
 */
@GET
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/listConfigurations")
@GZIP
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public List<ModificationConfigurationResponse> listConfigurations() {
    List<ModificationConfigurationResponse> configs = new ArrayList<>();
    for (Entry<String,ModificationServiceConfiguration> entry : this.modificationConfiguration.getConfigurations().entrySet()) {
        ModificationConfigurationResponse r = new ModificationConfigurationResponse();
        r.setName(entry.getKey());
        r.setRequestClass(entry.getValue().getRequestClass().getName());
        r.setDescription(entry.getValue().getDescription());
        r.setAuthorizedRoles(entry.getValue().getAuthorizedRoles());
        configs.add(r);
    }
    return configs;
}
 
Example #4
Source File: ModificationCacheBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@GET
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/getMutableFieldList")
@GZIP
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public List<MutableFieldListResponse> getMutableFieldList() {
    List<MutableFieldListResponse> lists = new ArrayList<>();
    for (Entry<String,Set<String>> entry : this.cache.entrySet()) {
        MutableFieldListResponse r = new MutableFieldListResponse();
        r.setDatatype(entry.getKey());
        r.setMutableFields(entry.getValue());
        lists.add(r);
    }
    return lists;
}
 
Example #5
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{logicName}/createAndNext")
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@EnrichQueryMetrics(methodType = MethodType.CREATE_AND_NEXT)
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Timed(name = "dw.query.createAndNext", absolute = true)
public BaseQueryResponse createQueryAndNext(@Required("logicName") @PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters,
                @Context HttpHeaders httpHeaders) {
    CreateQuerySessionIDFilter.QUERY_ID.set(null);
    
    GenericResponse<String> createResponse = createQuery(logicName, queryParameters, httpHeaders);
    String queryId = createResponse.getResult();
    CreateQuerySessionIDFilter.QUERY_ID.set(queryId);
    return next(queryId, false);
}
 
Example #6
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{logicName}/async/create")
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@EnrichQueryMetrics(methodType = MethodType.CREATE)
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
@Asynchronous
@Timed(name = "dw.query.createQueryAsync", absolute = true)
public void createQueryAsync(@Required("logicName") @PathParam("logicName") String queryLogicName, MultivaluedMap<String,String> queryParameters,
                @Suspended AsyncResponse asyncResponse) {
    try {
        GenericResponse<String> response = createQuery(queryLogicName, queryParameters);
        asyncResponse.resume(response);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #7
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/{id}/async/next")
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@GZIP
@EnrichQueryMetrics(methodType = MethodType.NEXT)
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Asynchronous
@Timed(name = "dw.query.nextAsync", absolute = true)
public void nextAsync(@Required("id") @PathParam("id") String id, @Suspended AsyncResponse asyncResponse) {
    try {
        BaseQueryResponse response = next(id);
        asyncResponse.resume(response);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #8
Source File: QueryCacheBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * <strong>Administrator credentials required.</strong>
 *
 * @return running queries
 */
@GET
@Path("/listRunningQueries")
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "text/html"})
@GZIP
@RolesAllowed({"Administrator", "JBossAdministrator"})
public RunningQueries getRunningQueries() {
    
    RunningQueries result = new RunningQueries();
    
    // Iterate over the cache contents
    for (RunningQuery value : cache) {
        result.getQueries().add(value.toString());
    }
    // Iterate over queries that are in the init phase
    for (Entry<String,Pair<QueryLogic<?>,Connector>> entry : qlCache.snapshot().entrySet()) {
        result.getQueries().add("Identifier: " + entry.getKey() + " Query Logic: " + entry.getValue().getFirst().getClass().getName() + "\n");
    }
    return result;
}
 
Example #9
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Produces("*/*")
@Path("/{logicName}/async/execute")
@GZIP
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Asynchronous
@Timed(name = "dw.query.executeQueryAsync", absolute = true)
public void executeAsync(@PathParam("logicName") String logicName, MultivaluedMap<String,String> queryParameters, @Context HttpHeaders httpHeaders,
                @Suspended AsyncResponse asyncResponse) {
    try {
        StreamingOutput output = execute(logicName, queryParameters, httpHeaders);
        asyncResponse.resume(output);
    } catch (Throwable t) {
        asyncResponse.resume(t);
    }
}
 
Example #10
Source File: ModelBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * <strong>Administrator credentials required.</strong> Delete a model with the supplied name
 *
 * @param name
 *            model name to delete
 * @param modelTableName
 *            name of the table that contains the model
 * @return datawave.webservice.result.VoidResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 *
 * @HTTP 200 success
 * @HTTP 404 model not found
 * @HTTP 500 internal server error
 */
@DELETE
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{name}")
@GZIP
@RolesAllowed({"Administrator", "JBossAdministrator"})
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public VoidResponse deleteModel(@Required("name") @PathParam("name") String name, @QueryParam("modelTableName") String modelTableName) {
    
    if (modelTableName == null) {
        modelTableName = defaultModelTableName;
    }
    
    return deleteModel(name, modelTableName, true);
}
 
Example #11
Source File: ModelBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * <strong>Administrator credentials required.</strong> Copy a model
 *
 * @param name
 *            model to copy
 * @param newName
 *            name of copied model
 * @param modelTableName
 *            name of the table that contains the model
 * @return datawave.webservice.result.VoidResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 *
 * @HTTP 200 success
 * @HTTP 204 model not found
 * @HTTP 500 internal server error
 */
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/clone")
@GZIP
@RolesAllowed({"Administrator", "JBossAdministrator"})
@Interceptors({RequiredInterceptor.class, ResponseInterceptor.class})
public VoidResponse cloneModel(@Required("name") @FormParam("name") String name, @Required("newName") @FormParam("newName") String newName,
                @FormParam("modelTableName") String modelTableName) {
    VoidResponse response = new VoidResponse();
    
    if (modelTableName == null) {
        modelTableName = defaultModelTableName;
    }
    
    datawave.webservice.model.Model model = getModel(name, modelTableName);
    // Set the new name
    model.setName(newName);
    importModel(model, modelTableName);
    return response;
}
 
Example #12
Source File: ModelBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * <strong>Administrator credentials required.</strong> Delete field mappings from an existing model
 *
 * @param model
 *            list of field mappings to delete
 * @param modelTableName
 *            name of the table that contains the model
 * @return datawave.webservice.result.VoidResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 *
 * @HTTP 200 success
 * @HTTP 500 internal server error
 */
@DELETE
@Consumes({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml"})
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/delete")
@GZIP
@RolesAllowed({"Administrator", "JBossAdministrator"})
@Interceptors(ResponseInterceptor.class)
public VoidResponse deleteMapping(datawave.webservice.model.Model model, @QueryParam("modelTableName") String modelTableName) {
    
    if (modelTableName == null) {
        modelTableName = defaultModelTableName;
    }
    
    return deleteMapping(model, modelTableName, true);
}
 
Example #13
Source File: AuditBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
@POST
@Path("/audit")
@Consumes("*/*")
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@GZIP
public VoidResponse auditRest(MultivaluedMap<String,String> parameters) {
    VoidResponse response = new VoidResponse();
    try {
        auditService.audit(auditParameterBuilder.validate(parameters));
        return response;
    } catch (Exception e) {
        QueryException qe = new QueryException(DatawaveErrorCode.AUDITING_ERROR, e);
        log.error(qe);
        response.addException(qe.getBottomQueryException());
        int statusCode = qe.getBottomQueryException().getStatusCode();
        throw new DatawaveWebApplicationException(qe, response, statusCode);
    }
}
 
Example #14
Source File: AccumuloTableCache.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * <strong>JBossAdministrator or Administrator credentials required.</strong>
 *
 * @return datawave.webservice.common.result.AccumuloTableCacheStatus
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 * @RequestHeader X-ProxiedIssuersChain required when using X-ProxiedEntitiesChain, specify one issuer DN per subject DN listed in X-ProxiedEntitiesChain
 * @RequestHeader query-session-id session id value used for load balancing purposes. query-session-id can be placed in the request in a Cookie header or as
 *                a query parameter
 * @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
 *
 * @HTTP 200 success
 */
@GET
@Path("/")
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff", "text/html"})
@GZIP
public AccumuloTableCacheStatus getStatus() {
    AccumuloTableCacheStatus response = new AccumuloTableCacheStatus();
    for (Entry<String,TableCache> entry : details.entrySet()) {
        datawave.webservice.common.result.TableCache t = new datawave.webservice.common.result.TableCache();
        t.setTableName(entry.getValue().getTableName());
        t.setConnectionPoolName(entry.getValue().getConnectionPoolName());
        t.setAuthorizations(entry.getValue().getAuths());
        t.setReloadInterval(entry.getValue().getReloadInterval());
        t.setMaxRows(entry.getValue().getMaxRows());
        t.setLastRefresh(entry.getValue().getLastRefresh());
        t.setCurrentlyRefreshing((entry.getValue().getReference() != null));
        response.getCaches().add(t);
    }
    return response;
}
 
Example #15
Source File: MapReduceStatusUpdateBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * This method is meant to be a callback from the Hadoop infrastructure and is not protected. When a BulkResults job is submitted the
 * "job.end.notification.url" property is set to public URL endpoint for this servlet. The Hadoop infrastructure will call back to this servlet. If the call
 * back fails for some reason, then Hadoop will retry for the number of configured attempts (job.end.retry.attempts) at some configured interval
 * (job.end.retry.interval)
 *
 * @param jobId
 * @param jobStatus
 *
 * @HTTP 200 success
 * @HTTP 500 failure
 *
 * @return datawave.webservice.result.VoidResponse
 * @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
 *
 */
@GET
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@GZIP
@Path("/updateState")
@PermitAll
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
public VoidResponse updateState(@Required("jobId") @QueryParam("jobId") String jobId, @Required("jobStatus") @QueryParam("jobStatus") String jobStatus) {
    log.info("Received MapReduce status update for job: " + jobId + ", new status: " + jobStatus);
    
    VoidResponse response = new VoidResponse();
    try {
        mapReduceState.updateState(jobId, MapReduceState.valueOf(jobStatus));
        return response;
    } catch (Exception e) {
        QueryException qe = new QueryException(DatawaveErrorCode.MAPRED_UPDATE_STATUS_ERROR, e);
        log.error(qe);
        response.addException(qe.getBottomQueryException());
        throw new DatawaveWebApplicationException(qe, response);
    }
}
 
Example #16
Source File: MapReduceBean.java    From datawave with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a list of the MapReduce job names and their configurations
 *
 * @param jobType
 *            limit returned jobs configs to the specified type
 * @return datawave.webservice.results.mr.MapReduceJobDescription
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user by specifying a chain of DNs of the identities to proxy
 * @RequestHeader X-ProxiedIssuersChain required when using X-ProxiedEntitiesChain, specify one issuer DN per subject DN listed in X-ProxiedEntitiesChain
 * @ResponseHeader X-OperationTimeInMS time spent on the server performing the operation, does not account for network or result serialization
 */
@GET
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@javax.ws.rs.Path("/listConfigurations")
@GZIP
public List<MapReduceJobDescription> listConfiguredMapReduceJobs(@DefaultValue("none") @QueryParam("jobType") String jobType) {
    List<MapReduceJobDescription> jobs = new ArrayList<>();
    if (jobType.equals("none")) {
        jobType = null;
    }
    for (Entry<String,MapReduceJobConfiguration> entry : this.mapReduceConfiguration.getJobConfiguration().entrySet()) {
        if (jobType != null && !entry.getValue().getJobType().equals(jobType)) {
            continue;
        }
        jobs.add(entry.getValue().getConfigurationDescription(entry.getKey()));
    }
    return jobs;
}
 
Example #17
Source File: SchedulerRestInterface.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @param sessionId a valid session id
 * @param jobsId the list of job ids
 * @return a map which contains job id as key and resultMap of this job as value
 */
@GET
@GZIP
@Path("jobs/resultmap")
@Produces("application/json")
Map<Long, Map<String, String>> jobResultMaps(@HeaderParam("sessionid") String sessionId,
        @QueryParam("jobsid") List<String> jobsId) throws RestException;
 
Example #18
Source File: RMRestInterface.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Set all node tokens to the given node.
 * @param sessionId current session
 * @param nodeUrl URL of the Node
 * @param tokens list of tokens to set
 */
@POST
@GZIP
@Path("node/tokens")
@Produces("application/json")
void setNodeTokens(@HeaderParam("sessionid") String sessionId, @HeaderParam("nodeurl") String nodeUrl,
        @QueryParam("tokens") List<String> tokens) throws NotConnectedException, RestException;
 
Example #19
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 5 votes vote down vote up
@GET
@Path("/{id}/next")
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@GZIP
@EnrichQueryMetrics(methodType = MethodType.NEXT)
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
@Override
@Timed(name = "dw.query.next", absolute = true)
public BaseQueryResponse next(@Required("id") @PathParam("id") String id) {
    return this.next(id, true);
}
 
Example #20
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 5 votes vote down vote up
@PUT
@POST
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/{id}/close")
@GZIP
@ClearQuerySessionId
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@Override
@Timed(name = "dw.query.close", absolute = true)
public VoidResponse close(@Required("id") @PathParam("id") String id) {
    return close(id, ctx.getCallerPrincipal());
}
 
Example #21
Source File: QueryExecutorBean.java    From datawave with Apache License 2.0 5 votes vote down vote up
@POST
@Path("/lookupUUID")
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@GZIP
@GenerateQuerySessionId(cookieBasePath = "/DataWave/Query/")
@Interceptors({ResponseInterceptor.class, RequiredInterceptor.class})
@Override
@Timed(name = "dw.query.lookupUUIDBatch", absolute = true)
public <T> T lookupUUIDBatch(MultivaluedMap<String,String> queryParameters, @Required("httpHeaders") @Context HttpHeaders httpHeaders) {
    if (!queryParameters.containsKey("uuidPairs")) {
        throw new BadRequestException(new IllegalArgumentException("uuidPairs missing from query parameters"), new VoidResponse());
    }
    T response;
    String queryId = null;
    try {
        String uuidPairs = queryParameters.getFirst("uuidPairs");
        String streaming = queryParameters.getFirst("streaming");
        boolean streamingOutput = false;
        if (!StringUtils.isEmpty(streaming)) {
            streamingOutput = Boolean.parseBoolean(streaming);
        }
        final PostUUIDCriteria criteria = new PostUUIDCriteria(uuidPairs, queryParameters);
        if (streamingOutput) {
            criteria.setStreamingOutputHeaders(httpHeaders);
        }
        response = this.lookupUUIDUtil.createUUIDQueryAndNext(criteria);
        if (response instanceof BaseQueryResponse) {
            queryId = ((BaseQueryResponse) response).getQueryId();
        }
        return response;
    } finally {
        if (null != queryId) {
            asyncClose(queryId);
        }
    }
    
}
 
Example #22
Source File: ModelBean.java    From datawave with Apache License 2.0 5 votes vote down vote up
/**
 * <strong>Administrator credentials required.</strong> Insert a new model
 *
 * @param model
 * @param modelTableName
 *            name of the table that contains the model
 * @return datawave.webservice.result.VoidResponse
 * @RequestHeader X-ProxiedEntitiesChain use when proxying request for user
 *
 * @HTTP 200 success
 * @HTTP 412 if model already exists with this name, delete it first
 * @HTTP 500 internal server error
 */
@POST
@Consumes({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml"})
@Produces({"application/xml", "text/xml", "application/json", "text/yaml", "text/x-yaml", "application/x-yaml", "application/x-protobuf",
        "application/x-protostuff"})
@Path("/import")
@GZIP
@RolesAllowed({"Administrator", "JBossAdministrator"})
@Interceptors(ResponseInterceptor.class)
public VoidResponse importModel(datawave.webservice.model.Model model, @QueryParam("modelTableName") String modelTableName) {
    
    if (modelTableName == null) {
        modelTableName = defaultModelTableName;
    }
    
    if (log.isDebugEnabled()) {
        log.debug("modelTableName: " + (null == modelTableName ? "" : modelTableName));
    }
    VoidResponse response = new VoidResponse();
    
    ModelList models = listModelNames(modelTableName);
    if (models.getNames().contains(model.getName()))
        throw new PreConditionFailedException(null, response);
    
    insertMapping(model, modelTableName);
    
    return response;
}
 
Example #23
Source File: RMRestInterface.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Returns the list of supported node source policies descriptors.
 *
 * @param sessionId current session
 * @return the list of supported node source policies descriptors
 */
@GET
@GZIP
@Path("policies")
@Produces("application/json")
Collection<PluginDescriptorData> getSupportedNodeSourcePolicies(@HeaderParam("sessionid") String sessionId)
        throws NotConnectedException, PermissionRestException;
 
Example #24
Source File: SchedulerRestInterface.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * @param sessionId a valid session id
 * @param jobsId the list of job ids
 * @return a map where key is a job id, and value is list of precious tasks names of this job
 **/
@GET
@GZIP
@Path("jobs/result/precious/metadata")
@Produces("application/json")
Map<Long, List<String>> getPreciousTaskNames(@HeaderParam("sessionid") String sessionId,
        @QueryParam("jobsid") List<String> jobsId) throws RestException;
 
Example #25
Source File: RMRestInterface.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Remove access token from the given node.
 * @param sessionId current session
 * @param nodeUrl URL of the Node
 * @param token single token
 */
@DELETE
@GZIP
@Path("node/token")
@Produces("application/json")
void removeNodeToken(@HeaderParam("sessionid") String sessionId, @HeaderParam("nodeurl") String nodeUrl,
        @HeaderParam("token") String token) throws NotConnectedException, RestException;
 
Example #26
Source File: RMRestInterface.java    From scheduling with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Add access token to the given node.
 * @param sessionId current session
 * @param nodeUrl URL of the Node
 * @param token single token
 */
@POST
@GZIP
@Path("node/token")
@Produces("application/json")
void addNodeToken(@HeaderParam("sessionid") String sessionId, @HeaderParam("nodeurl") String nodeUrl,
        @HeaderParam("token") String token) throws NotConnectedException, RestException;
 
Example #27
Source File: GitHubFileService.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
@PUT
@Path("/contents/{path}/{fileName}")
@Produces("application/json; charset=utf-8")
@Consumes("application/json; charset=utf-8")
@GZIP
public GitHubResponse updateFile(@PathParam("user") String user,
		@PathParam("repository") String repository,
		@PathParam("path") String path,
		@PathParam("fileName") String fileName,
		@HeaderParam("Authorization") String authorization,
		GitHubUpdateFileRequest content);
 
Example #28
Source File: SchedulerRestInterface.java    From scheduling with GNU Affero General Public License v3.0 3 votes vote down vote up
/**
 * Returns a list of taskState of the tasks filtered by a given tag and
 * paginated.
 * 
 * @param sessionId
 *            a valid session id.
 * @param jobId
 *            the job id.
 * @param taskTag
 *            the tag used to filter the tasks.
 * @param offset
 *            the number of the first task to fetch
 * @param limit
 *            the number of the last task to fetch (non inclusive)
 * @return a list of task' states of the job <code>jobId</code> filtered by
 *         a given tag, and the total number
 */
@GET
@GZIP
@Path("jobs/{jobid}/taskstates/{tasktag}/paginated")
@Produces("application/json")
RestPage<TaskStateData> getJobTaskStatesByTagPaginated(@HeaderParam("sessionid") String sessionId,
        @PathParam("jobid") String jobId, @PathParam("tasktag") String taskTag,
        @QueryParam("offset") @DefaultValue("0") int offset, @QueryParam("limit") @DefaultValue("50") int limit)
        throws RestException;
 
Example #29
Source File: SchedulerRestInterface.java    From scheduling with GNU Affero General Public License v3.0 3 votes vote down vote up
/**
 * Returns a list of taskState with pagination
 * 
 * @param sessionId
 *            a valid session id
 * @param jobId
 *            the job id
 * @param offset
 *            the index of the first TaskState to return
 * @param limit
 *            the index (non inclusive) of the last TaskState to return
 * @return a list of task' states of the job <code>jobId</code> and the
 *         total number
 */
@GET
@GZIP
@Path("jobs/{jobid}/taskstates/paginated")
@Produces("application/json")
RestPage<TaskStateData> getJobTaskStatesPaginated(@HeaderParam("sessionid") String sessionId,
        @PathParam("jobid") String jobId, @QueryParam("offset") @DefaultValue("0") int offset,
        @QueryParam("limit") @DefaultValue("50") int limit) throws RestException;
 
Example #30
Source File: SchedulerRestInterface.java    From scheduling with GNU Affero General Public License v3.0 3 votes vote down vote up
/**
 * Returns a list of taskState of the tasks filtered by a given tag.
 * 
 * @param sessionId
 *            a valid session id.
 * @param jobId
 *            the job id.
 * @param taskTag
 *            the tag used to filter the tasks.
 * @return a list of task' states of the job <code>jobId</code> filtered by
 *         a given tag and the total number
 */
@GET
@GZIP
@Path("jobs/{jobid}/taskstates/{tasktag}")
@Produces("application/json")
RestPage<TaskStateData> getJobTaskStatesByTag(@HeaderParam("sessionid") String sessionId,
        @PathParam("jobid") String jobId, @PathParam("tasktag") String taskTag) throws RestException;