class PigResource {

	@GET 
	@Path("/request/{requestId}/output")
	@Produces( {MediaType.TEXT_PLAIN} )
	public Response getOutput(@PathParam("requestId") String requestId) throws IOException {
        logger.info("Request for reading output for " + requestId);
		String outputPath= PropertyLoader.getInstance().getProperty(Constants.REQUEST_PATH) + requestId;
		StreamingPigOutputImpl streamingPigOutputImpl = new StreamingPigOutputImpl(outputPath);	
   
		if(streamingPigOutputImpl.isAvailable() == false) {
		    logger.info("Request " + requestId + " not available");
			return Response.status(404).entity("Invalid Request ID").build();				   
	    }
		return Response.ok(streamingPigOutputImpl).build();
	}

}