<commit_before>//----------------------------------------------------------------------
//This code is developed as part of the Java CoG Kit project
//The terms of the license can be found at http://www.cogkit.org/license
//This message may not be removed or altered.
//----------------------------------------------------------------------

/*
 * Created on Aug 3, 2010
 */
package org.globus.cog.abstraction.coaster.service;

import java.io.IOException;
import java.net.InetAddress;

import org.apache.log4j.Logger;
import org.globus.cog.util.ArgumentParser;
import org.globus.cog.util.ArgumentParserException;
import org.globus.gsi.GlobusCredential;
import org.globus.gsi.GlobusCredentialException;
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
import org.globus.gsi.gssapi.auth.SelfAuthorization;
import org.ietf.jgss.GSSCredential;
import org.ietf.jgss.GSSException;

public class CoasterPersistentService extends CoasterService {
    public static final Logger logger = Logger.getLogger(CoasterPersistentService.class);
    
    public CoasterPersistentService() throws IOException {
        super(false);
    }

    public CoasterPersistentService(GSSCredential cred, int port, InetAddress bindTo) throws IOException {
        super(cred, port, bindTo);
    }

    public CoasterPersistentService(boolean secure, int port, InetAddress bindTo) throws IOException {
        super(secure, port, bindTo);
    }

    public static void main(String[] args) {
        ArgumentParser ap = new ArgumentParser();
        ap.setExecutableName("coaster-service");
        ap.addOption("port", "Specifies which port to start the service on", "port",
            ArgumentParser.OPTIONAL);
        ap.addAlias("port", "p");
        ap.addFlag("nosec", "Disables GSI security and uses plain TCP sockets instead");
        ap.addOption("proxy",
            "Specifies the location of a proxy credential that will be used for authentication. " +
            "If not specified, the default proxy will be used.",
            "file", ArgumentParser.OPTIONAL);
        ap.addFlag("local", "Binds the service to the loopback interface");
        ap.addFlag("help", "Displays usage information");
        ap.addAlias("help", "h");
        try {
            ap.parse(args);
            if (ap.isPresent("help")) {
                ap.usage();
                System.exit(0);
            }
            InetAddress bindTo = null;
            if (ap.isPresent("local")) {
                bindTo = InetAddress.getLocalHost();
            }
            boolean secure = true;
            if (ap.isPresent("nosec")) {
                secure = false;
            }
            GlobusCredential gc;
            if (ap.hasValue("proxy")) {
                gc = new GlobusCredential(ap.getStringValue("proxy"));
            }
            else {
                gc = GlobusCredential.getDefaultCredential();
            }
            GSSCredential cred = new GlobusGSSCredentialImpl(gc, GSSCredential.INITIATE_AND_ACCEPT);
            
            int port = 1984;
            if (ap.hasValue("port")) {
                port = ap.getIntValue("port");
            }
            <commit_msg>don't load credential if -nosec<commit_after>//----------------------------------------------------------------------
//This code is developed as part of the Java CoG Kit project
//The terms of the license can be found at http://www.cogkit.org/license
//This message may not be removed or altered.
//----------------------------------------------------------------------

/*
 * Created on Aug 3, 2010
 */
package org.globus.cog.abstraction.coaster.service;

import java.io.IOException;
import java.net.InetAddress;

import org.apache.log4j.Logger;
import org.globus.cog.util.ArgumentParser;
import org.globus.cog.util.ArgumentParserException;
import org.globus.gsi.GlobusCredential;
import org.globus.gsi.GlobusCredentialException;
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
import org.globus.gsi.gssapi.auth.SelfAuthorization;
import org.ietf.jgss.GSSCredential;
import org.ietf.jgss.GSSException;

public class CoasterPersistentService extends CoasterService {
    public static final Logger logger = Logger.getLogger(CoasterPersistentService.class);

    public CoasterPersistentService() throws IOException {
        super(false);
    }

    public CoasterPersistentService(GSSCredential cred, int port, InetAddress bindTo)
            throws IOException {
        super(cred, port, bindTo);
    }

    public CoasterPersistentService(boolean secure, int port, InetAddress bindTo)
            throws IOException {
        super(secure, port, bindTo);
    }

    public static void main(String[] args) {
        ArgumentParser ap = new ArgumentParser();
        ap.setExecutableName("coaster-service");
        ap.addOption("port", "Specifies which port to start the service on", "port",
            ArgumentParser.OPTIONAL);
        ap.addAlias("port", "p");
        ap.addFlag("nosec", "Disables GSI security and uses plain TCP sockets instead");
        ap.addOption("proxy",
            "Specifies the location of a proxy credential that will be used for authentication. " +
                    "If not specified, the default proxy will be used.",
            "file", ArgumentParser.OPTIONAL);
        ap.addFlag("local", "Binds the service to the loopback interface");
        ap.addFlag("help", "Displays usage information");
        ap.addAlias("help", "h");
        try {
            ap.parse(args);
            if (ap.isPresent("help")) {
                ap.usage();
                System.exit(0);
            }
            InetAddress bindTo = null;
            if (ap.isPresent("local")) {
                bindTo = InetAddress.getLocalHost();
            }
            boolean secure = true;
            if (ap.isPresent("nosec")) {
                secure = false;
            }
            GSSCredential cred = null;
            if (secure) {
                GlobusCredential gc;
                if (ap.hasValue("proxy")) {
                    gc = new GlobusCredential(ap.getStringValue("proxy"));
                }
                else {
                    gc = GlobusCredential.getDefaultCredential();
                }
                cred = new GlobusGSSCredentialImpl(gc, GSSCredential.INITIATE_AND_ACCEPT);
            }

            int port = 1984;
            if (ap.hasValue("port")) {
                port = ap.getIntValue("port");
            }

{'fraction_non_alphanumeric': 0.14101968076863475, 'fraction_numerical': 0.0034092670075933675, 'mean_word_length': 2.008857808857809, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4338516', 'n_tokens_mistral': 1777, 'n_tokens_neox': 1725, 'n_words': 436}