<commit_before>/* vim: set et ts=4 sts=4 sw=4 tw=72 : */
/* See the LICENSE file for the license of the project */
package uk.ac.cam.UROP.twentyfourteen;

import java.util.List;
import java.util.LinkedList;

import javax.ws.rs.GET;
import javax.ws.rs.PathParam;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

@Path("/")
public class GitService {
   
	@GET
	@Path("/git")
	public Response listRepositories() {
	    List<Repository> repos = ConfigDatabase.getRepos();
	    List<String> toReturn = new LinkedList<String>();
	    for (Repository repo : repos) {
	        toReturn.add(repo.getName());
	    }
	    return Response.status(200).entity(toReturn.toString()).build();
	}

    @GET
    @Path("/git/{repoName}/{pathParam:.*}")
    public Response getFile(@PathParam("pathParam") String filePath
                          , @PathParam("repoName")  String repoName)
    {
        /* TODO
         * 1. Open the file given by filePath in the Git repository
         *    repoName. This can be done with GitDb and TreeWalker
         *    somehow, to prevent the need of cloning the repository.
         * 2. Give the contents of the file as the entity
         */
        return Response.status(200).entity(filePath).build();
    }
}<commit_msg>Also added method skeleton for querying files. <commit_after>/* vim: set et ts=4 sts=4 sw=4 tw=72 : */
/* See the LICENSE file for the license of the project */
package uk.ac.cam.UROP.twentyfourteen;

import java.util.List;
import java.util.LinkedList;

import javax.ws.rs.GET;
import javax.ws.rs.PathParam;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

@Path("/")
public class GitService {
   
	@GET
	@Path("/git")
	public Response listRepositories() {
	    List<Repository> repos = ConfigDatabase.getRepos();
	    List<String> toReturn = new LinkedList<String>();
	    for (Repository repo : repos) {
	        toReturn.add(repo.getName());
	    }
	    return Response.status(200).entity(toReturn.toString()).build();
	}

    @GET
    @Path("/git/{repoName}")
    public Response listFiles(@PathParam("repoName") String repoName)
    {
        /* TODO
         * 1. Open repository and list files
         * 2. Return files
         */
        return Response.status(200).entity(repoName).build();
    }

    @GET
    @Path("/git/{repoName}/{fileName:.*}")
    public Response getFile(@PathParam("fileName") String fileName
                          , @PathParam("repoName")  String repoName)
    {
        /* TODO
         * 1. Open the file given by filePath in the Git repository
         *    repoName. This can be done with GitDb and TreeWalker
         *    somehow, to prevent the need of cloning the repository.
         * 2. Give the contents of the file as the entity
         */
        return Response.status(200).entity(fileName).build();
    }
}
{'fraction_non_alphanumeric': 0.12495587716201906, 'fraction_numerical': 0.010942463819272856, 'mean_word_length': 2.6473616473616475, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '135639', 'n_tokens_mistral': 875, 'n_tokens_neox': 839, 'n_words': 240}