<commit_before>package ca.ualberta.physics.cssdp.resource;

import java.net.URI;
import java.net.URISyntaxException;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import ca.ualberta.physics.cssdp.domain.ServiceInfo;
import ca.ualberta.physics.cssdp.domain.ServiceStats;
import ca.ualberta.physics.cssdp.domain.ServiceStats.ServiceName;
import ca.ualberta.physics.cssdp.service.StatsService;

import com.google.common.base.Throwables;
import com.google.inject.Inject;
import com.wordnik.swagger.annotations.ApiError;
import com.wordnik.swagger.annotations.ApiErrors;
import com.wordnik.swagger.annotations.ApiOperation;

@Consumes(MediaType.WILDCARD)
public abstract class AbstractServiceResource {

	protected abstract ServiceInfo buildInfo();

	protected abstract ServiceStats buildStats();

	protected abstract URI getDocURI() throws URISyntaxException;

	@Inject
	private StatsService statsService;

	@Path("/info")
	@GET
	@ApiOperation(value = "Basic identification and provenance information about the service.", notes = "CANARIE's monitoring service will poll this URI periodically.", responseClass = "ca.ualberta.physics.cssdp.domain.ServiceInfo")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getInfo() {
		return Response.ok(buildInfo()).build();
	}

	@Path("/stats")
	@GET
	@ApiOperation(value = "CANARIE's monitoring service will poll this URI periodically. Return information about the usage of this RPI.", notes = "If this URI fails or times out, this RPI is unavailable.", responseClass = "ca.ualberta.physics.cssdp.domain.ServiceStats")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getStats() {
		// keep track of how many times CANARIE is polling the service
		statsService.incrementInvocationCount(ServiceName.STATS);
		return Response.ok(buildStats()).build();
	}

	@Path("/doc")
	@GET
	@ApiOperation(value = "Returns an HTTP redirect to the service documention on github")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getDoc() {
		try {
			return Response.seeOther(getDocURI()).build();
		} catch (URISyntaxException e) {
			return Response.serverError()
					.entity(Throwables.getStackTraceAsString(e)).build();
		}

	}

	@Path("/releasenotes")
	@GET
	@ApiOperation(value = "Returns an HTTP redirect to the release notes documention on github")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getReleaseNotes() {
		try {
			return Response
					.seeOther(
							new URI(
									"https://github.com/RoddiPotter/cicstart/wiki/releasenotes"))
					.build();
		} catch (URISyntaxException e) {
			return Response.serverError()
					.entity(Throwables.getStackTraceAsString(e)).build();
		}
	}

	@Path("/support")
	@GET
	@ApiOperation(value = "Returns an HTTP redirect to the support documention on github")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getSupport() {
		try {
			return Response
					.seeOther(
							new URI(
									"https://github.com/RoddiPotter/cicstart/wiki/support"))
					.build();
		} catch (URISyntaxException e) {
			return Response.serverError()
					.entity(Throwables.getStackTraceAsString(e)).build();
		}
	}

	@Path("/source")
	@GET
	@ApiOperation(value = "Returns an HTTP redirect to the source on github")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getSource() {
		try {
			return Response.seeOther(
					new URI("https://github.com/RoddiPotter/cicstart")).build();
		} catch (URISyntaxException e) {
			return Response.serverError()
					.entity(Throwables.getStackTraceAsString(e)).build();
		}
	}

	@Path("/tryme")
	@GET
	@ApiOperation(value = "Not implemented")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getTryMe() {
		return Response.noContent().build();
	}
}<commit_msg>add wildcard consume/produce annotations for canarie validator<commit_after>package ca.ualberta.physics.cssdp.resource;

import java.net.URI;
import java.net.URISyntaxException;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import ca.ualberta.physics.cssdp.domain.ServiceInfo;
import ca.ualberta.physics.cssdp.domain.ServiceStats;
import ca.ualberta.physics.cssdp.domain.ServiceStats.ServiceName;
import ca.ualberta.physics.cssdp.service.StatsService;

import com.google.common.base.Throwables;
import com.google.inject.Inject;
import com.wordnik.swagger.annotations.ApiError;
import com.wordnik.swagger.annotations.ApiErrors;
import com.wordnik.swagger.annotations.ApiOperation;

@Consumes(MediaType.WILDCARD)
public abstract class AbstractServiceResource {

	protected abstract ServiceInfo buildInfo();

	protected abstract ServiceStats buildStats();

	protected abstract URI getDocURI() throws URISyntaxException;

	@Inject
	private StatsService statsService;

	@Path("/info")
	@GET
	@ApiOperation(value = "Basic identification and provenance information about the service.", notes = "CANARIE's monitoring service will poll this URI periodically.", responseClass = "ca.ualberta.physics.cssdp.domain.ServiceInfo")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getInfo() {
		return Response.ok(buildInfo()).build();
	}

	@Path("/stats")
	@GET
	@ApiOperation(value = "CANARIE's monitoring service will poll this URI periodically. Return information about the usage of this RPI.", notes = "If this URI fails or times out, this RPI is unavailable.", responseClass = "ca.ualberta.physics.cssdp.domain.ServiceStats")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getStats() {
		// keep track of how many times CANARIE is polling the service
		statsService.incrementInvocationCount(ServiceName.STATS);
		return Response.ok(buildStats()).build();
	}

	@Path("/doc")
	@Consumes(MediaType.WILDCARD)
	@Produces(MediaType.WILDCARD)
	@GET
	@ApiOperation(value = "Returns an HTTP redirect to the service documention on github")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getDoc() {
		try {
			return Response.seeOther(getDocURI()).build();
		} catch (URISyntaxException e) {
			return Response.serverError()
					.entity(Throwables.getStackTraceAsString(e)).build();
		}

	}

	@Path("/releasenotes")
	@Consumes(MediaType.WILDCARD)
	@Produces(MediaType.WILDCARD)
	@GET
	@ApiOperation(value = "Returns an HTTP redirect to the release notes documention on github")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getReleaseNotes() {
		try {
			return Response
					.seeOther(
							new URI(
									"https://github.com/RoddiPotter/cicstart/wiki/releasenotes"))
					.build();
		} catch (URISyntaxException e) {
			return Response.serverError()
					.entity(Throwables.getStackTraceAsString(e)).build();
		}
	}

	@Path("/support")
	@Consumes(MediaType.WILDCARD)
	@Produces(MediaType.WILDCARD)
	@GET
	@ApiOperation(value = "Returns an HTTP redirect to the support documention on github")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getSupport() {
		try {
			return Response
					.seeOther(
							new URI(
									"https://github.com/RoddiPotter/cicstart/wiki/support"))
					.build();
		} catch (URISyntaxException e) {
			return Response.serverError()
					.entity(Throwables.getStackTraceAsString(e)).build();
		}
	}

	@Path("/source")
	@Consumes(MediaType.WILDCARD)
	@Produces(MediaType.WILDCARD)
	@GET
	@ApiOperation(value = "Returns an HTTP redirect to the source on github")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getSource() {
		try {
			return Response.seeOther(
					new URI("https://github.com/RoddiPotter/cicstart")).build();
		} catch (URISyntaxException e) {
			return Response.serverError()
					.entity(Throwables.getStackTraceAsString(e)).build();
		}
	}

	@Path("/tryme")
	@Consumes(MediaType.WILDCARD)
	@Produces(MediaType.WILDCARD)
	@GET
	@ApiOperation(value = "Not implemented")
	@ApiErrors(value = { @ApiError(code = 500, reason = "Unable to complete request, see response body for error details") })
	public Response getTryMe() {
		return Response.noContent().build();
	}
}
{'fraction_non_alphanumeric': 0.12070091423595995, 'fraction_numerical': 0.00457117979973879, 'mean_word_length': 4.790170132325142, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1467940', 'n_tokens_mistral': 3086, 'n_tokens_neox': 2796, 'n_words': 726}