<commit_before>package com.topsy.jmxproxy;

import com.topsy.jmxproxy.core.Domain;
import com.topsy.jmxproxy.core.Host;
import com.topsy.jmxproxy.core.MBean;
import com.topsy.jmxproxy.jmx.ConnectionCredentials;
import com.topsy.jmxproxy.jmx.ConnectionManager;

import com.yammer.dropwizard.jersey.params.BooleanParam;

import javax.security.auth.login.FailedLoginException;

import javax.validation.Valid;

import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.POST;
import javax.ws.rs.QueryParam;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.WebApplicationException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public class JMXProxyResource {
    private static final Logger LOG = LoggerFactory.getLogger(JMXProxyResource.class);

    private final ConnectionManager manager;

    public JMXProxyResource(ConnectionManager manager) {
        this.manager = manager;
    }

    @GET
    @Path("{host}:{port:\\d+}/{mbean}/{attribute}")
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("mbean") String mbean, @PathParam("attribute") String attribute) {
        LOG.debug("fetching jmx data for " + host + ":" + port + "/" + mbean + "/" + attribute);
        return getJMXHost(host, port, mbean, attribute, null);
    }

    @POST
    @Path("{host}:{port:\\d+}/{mbean}/{attribute}")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("mbean") String mbean, @PathParam("attribute") String attribute, @FormParam("username") String username, @FormParam("password") String password) {
        LOG.debug("fetching jmx data for " + username + "@" + host + ":" + port + "/" + mbean + "/" + attribute);
        return getJMXHost(host, port, mbean, attribute, new ConnectionCredentials(username, password));
    }

    @POST
    @Path("{host}:{port:\\d+}/{mbean}/{attribute}")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("mbean") String mbean, @PathParam("attribute") String attribute, @Valid ConnectionCredentials auth) {
        LOG.debug("fetching jmx data for " + auth.getUsername() + "@" + host + ":" + port + "/" + mbean + "/" + attribute);

        return getJMXHost(host, port, mbean, attribute, auth);
    }

    @GET
    @Path("{host}:{port:\\d+}/{name}")
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("name") String name, @QueryParam("full") @DefaultValue("true") BooleanParam full) {
        LOG.debug("fetching jmx data for " + host + ":" + port + "/" + name + " (full:" + full.get() + ")");
        return getJMXHost(host, port, name, full.get(), null);
    }

    @POST
    @Path("{host}:{port:\\d+}/{name}")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("name") String name, @FormParam("username") String username, @FormParam("password") String password, @QueryParam("full") @DefaultValue("false") BooleanParam full) {
        LOG.debug("fetching jmx data for " + username + "@" + host + ":" + port + "/" + name + " (full:" + full.get() + ")");
        return getJMXHost(host, port, name, full.get(), new ConnectionCredentials(username, password));
    }

    @POST
    @Path("{host}:{port:\\d+}/{name}")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("name") String name, @QueryParam("full") @DefaultValue("false") BooleanParam full, @Valid ConnectionCredentials auth) {
        LOG.debug("fetching jmx data for " + auth.getUsername() + "@" + host + ":" + port + "/" + name + " (full:" + full.get() + ")");

        return getJMXHost(host, port, name, full.get(), auth);
    }

    @GET
    @Path("{host}:{port:\\d+}")
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @QueryParam("full") @DefaultValue("true") BooleanParam full) {
        LOG.debug("fetching jmx data for " + host + ":" + port + " (full:" + full.get() + ")");
        return getJMXHost(host, port, full.get(), null);
    }

    @POST
    @Path("{host}:{port:\\d+}")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @FormParam("username") String username, @FormParam("password") String password, @QueryParam("full") @DefaultValue("false") BooleanParam full) {
        LOG.debug("fetching jmx data for " + username + "@" + host + ":" + port + " (full:" + full.get() + ")");
        return getJMXHost(host, port, full.get(), new ConnectionCredentials(username, password));
    }<commit_msg>Default to full=false for domain and host fetching.<commit_after>package com.topsy.jmxproxy;

import com.topsy.jmxproxy.core.Domain;
import com.topsy.jmxproxy.core.Host;
import com.topsy.jmxproxy.core.MBean;
import com.topsy.jmxproxy.jmx.ConnectionCredentials;
import com.topsy.jmxproxy.jmx.ConnectionManager;

import com.yammer.dropwizard.jersey.params.BooleanParam;

import javax.security.auth.login.FailedLoginException;

import javax.validation.Valid;

import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.POST;
import javax.ws.rs.QueryParam;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.WebApplicationException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public class JMXProxyResource {
    private static final Logger LOG = LoggerFactory.getLogger(JMXProxyResource.class);

    private final ConnectionManager manager;

    public JMXProxyResource(ConnectionManager manager) {
        this.manager = manager;
    }

    @GET
    @Path("{host}:{port:\\d+}/{mbean}/{attribute}")
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("mbean") String mbean, @PathParam("attribute") String attribute) {
        LOG.debug("fetching jmx data for " + host + ":" + port + "/" + mbean + "/" + attribute);
        return getJMXHost(host, port, mbean, attribute, null);
    }

    @POST
    @Path("{host}:{port:\\d+}/{mbean}/{attribute}")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("mbean") String mbean, @PathParam("attribute") String attribute, @FormParam("username") String username, @FormParam("password") String password) {
        LOG.debug("fetching jmx data for " + username + "@" + host + ":" + port + "/" + mbean + "/" + attribute);
        return getJMXHost(host, port, mbean, attribute, new ConnectionCredentials(username, password));
    }

    @POST
    @Path("{host}:{port:\\d+}/{mbean}/{attribute}")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("mbean") String mbean, @PathParam("attribute") String attribute, @Valid ConnectionCredentials auth) {
        LOG.debug("fetching jmx data for " + auth.getUsername() + "@" + host + ":" + port + "/" + mbean + "/" + attribute);

        return getJMXHost(host, port, mbean, attribute, auth);
    }

    @GET
    @Path("{host}:{port:\\d+}/{name}")
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("name") String name, @QueryParam("full") @DefaultValue("false") BooleanParam full) {
        LOG.debug("fetching jmx data for " + host + ":" + port + "/" + name + " (full:" + full.get() + ")");
        return getJMXHost(host, port, name, full.get(), null);
    }

    @POST
    @Path("{host}:{port:\\d+}/{name}")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("name") String name, @FormParam("username") String username, @FormParam("password") String password, @QueryParam("full") @DefaultValue("false") BooleanParam full) {
        LOG.debug("fetching jmx data for " + username + "@" + host + ":" + port + "/" + name + " (full:" + full.get() + ")");
        return getJMXHost(host, port, name, full.get(), new ConnectionCredentials(username, password));
    }

    @POST
    @Path("{host}:{port:\\d+}/{name}")
    @Consumes(MediaType.APPLICATION_JSON)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @PathParam("name") String name, @QueryParam("full") @DefaultValue("false") BooleanParam full, @Valid ConnectionCredentials auth) {
        LOG.debug("fetching jmx data for " + auth.getUsername() + "@" + host + ":" + port + "/" + name + " (full:" + full.get() + ")");

        return getJMXHost(host, port, name, full.get(), auth);
    }

    @GET
    @Path("{host}:{port:\\d+}")
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @QueryParam("full") @DefaultValue("false") BooleanParam full) {
        LOG.debug("fetching jmx data for " + host + ":" + port + " (full:" + full.get() + ")");
        return getJMXHost(host, port, full.get(), null);
    }

    @POST
    @Path("{host}:{port:\\d+}")
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public Response getJMXHostData(@PathParam("host") String host, @PathParam("port") int port, @FormParam("username") String username, @FormParam("password") String password, @QueryParam("full") @DefaultValue("false") BooleanParam full) {
        LOG.debug("fetching jmx data for " + username + "@" + host + ":" + port + " (full:" + full.get() + ")");
        return getJMXHost(host, port, full.get(), new ConnectionCredentials(username, password));
    }
{'fraction_non_alphanumeric': 0.17055167055167056, 'fraction_numerical': 0.0003885003885003885, 'mean_word_length': 4.497597437266418, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, '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': '1458019', 'n_tokens_mistral': 3281, 'n_tokens_neox': 3259, 'n_words': 699}