<commit_before>package org.jenkinsci.plugins.ontrack;

import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Notifier;
import net.ontrack.client.ControlUIClient;
import net.ontrack.client.support.ControlUIClientFactory;
import org.apache.commons.lang3.StringUtils;

public abstract class AbstractOntrackNotifier extends Notifier {

    public BuildStepMonitor getRequiredMonitorService() {
        return BuildStepMonitor.BUILD;
    }

    protected <T> T call(ClientCall<T> clientCall) {
        // FIXME Gets the configuration
        // OntrackDescriptorImpl descriptor = getDescriptor();
        // FIXME Gets the configuration data
        String url = "", user = "", password = "";
        // String url = descriptor.getOntrackUrl();
        // String user = descriptor.getOntrackUser();
        // String password = descriptor.getOntrackPassword();
        // Controls the data
        if (StringUtils.isBlank(url)) {
            throw new IllegalStateException("ontrack URL global parameter must be defined");
        }
        if (StringUtils.isBlank(user)) {
            throw new IllegalStateException("ontrack User global parameter must be defined");
        }
        if (StringUtils.isBlank(password)) {
            throw new IllegalStateException("ontrack Password global parameter must be defined");
        }
        // Creates the client
        ControlUIClient client = ControlUIClientFactory.create(url).build();
        // Login
        client.login(user, password);
        try {
            // Performs the call
            return clientCall.onCall(client);
        } finally {
            client.logout();<commit_msg>Jenkins: using global configuration from the plugins<commit_after>package org.jenkinsci.plugins.ontrack;

import hudson.tasks.BuildStepMonitor;
import hudson.tasks.Notifier;
import jenkins.model.Jenkins;
import net.ontrack.client.ControlUIClient;
import net.ontrack.client.support.ControlUIClientFactory;
import org.apache.commons.lang3.StringUtils;

public abstract class AbstractOntrackNotifier extends Notifier {

    public BuildStepMonitor getRequiredMonitorService() {
        return BuildStepMonitor.BUILD;
    }

    protected <T> T call(ClientCall<T> clientCall) {
        // Gets the configuration
        OntrackConfiguration configuration = (OntrackConfiguration) Jenkins.getInstance().getDescriptor(OntrackConfiguration.class);
        // Gets the configuration data
        String url = configuration.getOntrackUrl();
        String user = configuration.getOntrackUser();
        String password = configuration.getOntrackPassword();
        // Controls the data
        if (StringUtils.isBlank(url)) {
            throw new IllegalStateException("ontrack URL global parameter must be defined");
        }
        if (StringUtils.isBlank(user)) {
            throw new IllegalStateException("ontrack User global parameter must be defined");
        }
        if (StringUtils.isBlank(password)) {
            throw new IllegalStateException("ontrack Password global parameter must be defined");
        }
        // Creates the client
        ControlUIClient client = ControlUIClientFactory.create(url).build();
        // Login
        client.login(user, password);
        try {
            // Performs the call
            return clientCall.onCall(client);
        } finally {
            client.logout();
{'fraction_non_alphanumeric': 0.08764111705288176, 'fraction_numerical': 0.0005941770647653001, 'mean_word_length': 2.856815578465063, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6965425', 'n_tokens_mistral': 831, 'n_tokens_neox': 823, 'n_words': 214}