<commit_before>/*
 *
 *   Copyright 2007-2008 University Of Southern California
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing,
 *   software distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */

package edu.isi.pegasus.planner.catalog.site.classes;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import edu.isi.pegasus.planner.catalog.classes.SysInfo;
import edu.isi.pegasus.planner.common.PegasusJsonSerializer;
import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * This class describes the Grid Gateway into a site.
 *
 * @version $Revision$
 * @author <NAME>
 */
@JsonDeserialize(using = GridGatewayDeserializer.class)
@JsonSerialize(using = GridGatewaySerializer.class)
public class GridGateway extends AbstractSiteData {

    /** An enumeration of valid types of grid gateway. */
    public static enum TYPE {
        gt2,
        gt4,
        gt5,
        condor,
        cream,
        batch,
        pbs,
        lsf,
        sge,
        nordugrid,
        unicore,
        ec2,
        deltacloud
    };

    /** An enumeration of types of jobs handled by an instance of a grid gateway. */
    public static enum JOB_TYPE {
        compute,
        auxillary,
        transfer,
        register,
        cleanup
    };

    /** An enumeration of valid schedulers on the grid gateway. */
    public static enum SCHEDULER_TYPE {
        fork,
        lsf,
        pbs,
        condor,
        sge,
        slurm,
        moab,
        unknown
    };

    /** The grid type associated with this instance. */
    private TYPE mType;

    /** The contact string for the grid gateway. */
    private String mContact;

    /** The scheduler type with which it interfaces. */
    private SCHEDULER_TYPE mScheduler;

    /** The type of jobs that this grid gateway can accept. */
    private JOB_TYPE mJobType;

    /** An optional os type for the grid gateway. */
    private SysInfo.OS mOS;

    /** An optional architecture type for the grid gateway. */
    private SysInfo.Architecture mArch;

    /** Optional information about the os release. */
    private String mOSRelease;

    /** Optional information about the version. */
    private String mOSVersion;

    /** Optional information about the glibc. */
    private String mGlibc;

    /** The number of idle nodes. */
    private int mIdleNodes;

    /** The number of total nodes */
    private int mTotalNodes;

    /** The default constructor. */
    public GridGateway() {
        this(TYPE.gt2, "localhost/jobmanager-fork", SCHEDULER_TYPE.fork);
    }

    /**
     * The overloaded constructor.
     *
     * @param type the type of grid gateway.<commit_msg>PM-1663 made gt5 the default grid type and got the enums in synch with 5.0 site  catalog schema<commit_after>/*
 *
 *   Copyright 2007-2008 University Of Southern California
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing,
 *   software distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */

package edu.isi.pegasus.planner.catalog.site.classes;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.ObjectCodec;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import edu.isi.pegasus.planner.catalog.classes.SysInfo;
import edu.isi.pegasus.planner.common.PegasusJsonSerializer;
import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * This class describes the Grid Gateway into a site.
 *
 * @version $Revision$
 * @author <NAME>
 */
@JsonDeserialize(using = GridGatewayDeserializer.class)
@JsonSerialize(using = GridGatewaySerializer.class)
public class GridGateway extends AbstractSiteData {

    /** An enumeration of valid types of grid gateway. */
    public static enum TYPE {
        gt5,
        condor,
        cream,
        batch,
        nordugrid,
        unicore,
        ec2,
        deltacloud
    };

    /** An enumeration of types of jobs handled by an instance of a grid gateway. */
    public static enum JOB_TYPE {
        compute,
        auxillary,
        transfer,
        register,
        cleanup
    };

    /** An enumeration of valid schedulers on the grid gateway. */
    public static enum SCHEDULER_TYPE {
        fork,
        lsf,
        pbs,
        condor,
        sge,
        slurm,
        unknown
    };

    /** The grid type associated with this instance. */
    private TYPE mType;

    /** The contact string for the grid gateway. */
    private String mContact;

    /** The scheduler type with which it interfaces. */
    private SCHEDULER_TYPE mScheduler;

    /** The type of jobs that this grid gateway can accept. */
    private JOB_TYPE mJobType;

    /** An optional os type for the grid gateway. */
    private SysInfo.OS mOS;

    /** An optional architecture type for the grid gateway. */
    private SysInfo.Architecture mArch;

    /** Optional information about the os release. */
    private String mOSRelease;

    /** Optional information about the version. */
    private String mOSVersion;

    /** Optional information about the glibc. */
    private String mGlibc;

    /** The number of idle nodes. */
    private int mIdleNodes;

    /** The number of total nodes */
    private int mTotalNodes;

    /** The default constructor. */
    public GridGateway() {
        this(TYPE.gt5, "localhost/jobmanager-fork", SCHEDULER_TYPE.fork);
    }

    /**
     * The overloaded constructor.
     *
     * @param type the type of grid gateway.
{'fraction_non_alphanumeric': 0.08695652173913043, 'fraction_numerical': 0.0050920485703094395, 'mean_word_length': 2.918158567774936, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 24}, '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': '7589814', 'n_tokens_mistral': 2258, 'n_tokens_neox': 2076, 'n_words': 694}