class PigResource {

	@POST
	@Path("/jar/{jarName}")
	@Consumes ( {MediaType.APPLICATION_OCTET_STREAM} )
	@Produces ({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
	public Response registerJar(@PathParam("jarName") String jarName, InputStream uploadedJar) throws IOException {
		logger.info("Request for registring jar with name " + jarName);
	    if (uploadedJar == null || uploadedJar.available() == 0){
		    logger.error("Empty input stream passed");
			return Response.status(400).entity("Bad request. No jar uploaded!").build();
		}
		String pathName= PropertyLoader.getInstance().getProperty(Constants.JARS_PATH) + jarName;
		PigJobServerImpl.getPigJobServer().registerFile(pathName, uploadedJar);
		return Response.ok().entity(pathName).type(MediaType.TEXT_PLAIN).build();
	}

}