<commit_before>/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 org.apache.cassandra.config;

import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.io.*;

import org.apache.log4j.Logger;

import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.Table;
import org.apache.cassandra.db.TypeInfo;
import org.apache.cassandra.db.SystemTable;
import org.apache.cassandra.utils.FileUtils;
import org.apache.cassandra.utils.XMLUtils;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;


/**
 * Author : <NAME> ( <EMAIL>) & <NAME> ( <EMAIL> )
 */

public class DatabaseDescriptor
{
    private static Logger logger_ = Logger.getLogger(DatabaseDescriptor.class);

    public static final String random_ = "RANDOM";
    public static final String ophf_ = "OPHF";
    private static int storagePort_ = 7000;
    private static int controlPort_ = 7001;
    private static int httpPort_ = 7002;
    private static int thriftPort_ = 9160;
    private static String listenAddress_; // leave null so we can fall through to getLocalHost
    private static String clusterName_ = "Test";
    private static int replicationFactor_ = 3;
    private static long rpcTimeoutInMillis_ = 2000;
    private static Set<String> seeds_ = new HashSet<String>();
    private static String metadataDirectory_;
    private static String snapshotDirectory_;
    /* Keeps the list of Ganglia servers to contact */
    private static String[] gangliaServers_ ;
    /* Keeps the list of data file directories */
    private static String[] dataFileDirectories_;
    /* Current index into the above list of directories */
    private static int currentIndex_ = 0;
    private static String logFileDirectory_;
    private static String bootstrapFileDirectory_;
    private static int logRotationThreshold_ = 128*1024*1024;
    private static boolean fastSync_ = false;
    private static boolean rackAware_ = false;
    private static int threadsPerPool_ = 4;
    private static List<String> tables_ = new ArrayList<String>();
    private static Set<String> applicationColumnFamilies_ = new HashSet<String>();

    // Default descriptive names for use in CQL. The user can override
    // these choices in the config file. These are not case sensitive.
    // Hence, these are stored in UPPER case for easy comparison.
    private static String d_rowKey_           = "ROW_KEY";
    private static String d_superColumnMap_   = "SUPER_COLUMN_MAP";
    private static String d_superColumnKey_   = "SUPER_COLUMN_KEY";
    private static String d_columnMap_        = "COLUMN_MAP";
    private static String d_columnKey_        = "COLUMN_KEY";
    private static String d_columnValue_      = "COLUMN_VALUE";
    private static String d_columnTimestamp_  = "COLUMN_TIMESTAMP";

    /*
     * A map from table names to the set of column families for the table and the
     * corresponding meta data for that column family.
    */
    private static Map<String, Map<String, CFMetaData>> tableToCFMetaDataMap_;
    /* Hashing strategy Random or OPHF */
    private static String partitionerClass_;
    /* if the size of columns or super-columns are more than this, indexing will kick in */
    private static int columnIndexSizeInKB_;
    /* Size of touch key cache */
    private static int touchKeyCacheSize_ = 1024;
    /* Number of hours to keep a memtable in memory */
    private static int memtableLifetime_ = 6;
    /* Size of the memtable in memory before it is dumped */
    private static int memtableSize_ = 128;
    /* Number of objects in millions in the memtable before it is dumped */
    private static double memtableObjectCount_ = 1;
    /* 
     * This parameter enables or disables consistency checks. 
     * If set to false the read repairs are disable for very
     * high throughput on reads but at the cost of consistency.
    */
    private static boolean doConsistencyCheck_ = true;
    /* Address of ZooKeeper cell */
    private static String zkAddress_;
    /* Callout directories */
    private static String calloutLocation_;
    /* Job Jar Location */
    private static String jobJarFileLocation_;
    /* Address where to run the job tracker */
    private static String jobTrackerHost_;    
    /* Zookeeper session timeout. */
    private static int zkSessionTimeout_ = 30000;
    /* time to wait before garbage collecting tombstones (deletion markers) */
    private static int gcGraceInSeconds_ = 10 * 24 * 3600; // 10 days

    // the path qualified config file (storage-conf.xml) name
    private static String configFileName_;

    static
    {
        try
        {
            String file = System.getProperty("storage-config") + System.getProperty("file.separator") + "storage-conf.xml";
            XMLUtils xmlUtils = new XMLUtils(file);

            /* Cluster Name */
            clusterName_ = xmlUtils.getNodeValue("/Storage/ClusterName");

            /* Ganglia servers contact list */
            gangliaServers_ = xmlUtils.getNodeValues("/Storage/GangliaServers/GangliaServer");
<commit_msg>initialize configFileName_.  patch by <NAME>; reviewed by jbellis for CASSANDRA-129<commit_after>/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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 org.apache.cassandra.config;

import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.io.*;

import org.apache.log4j.Logger;

import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.Table;
import org.apache.cassandra.db.TypeInfo;
import org.apache.cassandra.db.SystemTable;
import org.apache.cassandra.utils.FileUtils;
import org.apache.cassandra.utils.XMLUtils;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;


/**
 * Author : <NAME> ( <EMAIL>) & <NAME> ( <EMAIL> )
 */

public class DatabaseDescriptor
{
    private static Logger logger_ = Logger.getLogger(DatabaseDescriptor.class);

    public static final String random_ = "RANDOM";
    public static final String ophf_ = "OPHF";
    private static int storagePort_ = 7000;
    private static int controlPort_ = 7001;
    private static int httpPort_ = 7002;
    private static int thriftPort_ = 9160;
    private static String listenAddress_; // leave null so we can fall through to getLocalHost
    private static String clusterName_ = "Test";
    private static int replicationFactor_ = 3;
    private static long rpcTimeoutInMillis_ = 2000;
    private static Set<String> seeds_ = new HashSet<String>();
    private static String metadataDirectory_;
    private static String snapshotDirectory_;
    /* Keeps the list of Ganglia servers to contact */
    private static String[] gangliaServers_ ;
    /* Keeps the list of data file directories */
    private static String[] dataFileDirectories_;
    /* Current index into the above list of directories */
    private static int currentIndex_ = 0;
    private static String logFileDirectory_;
    private static String bootstrapFileDirectory_;
    private static int logRotationThreshold_ = 128*1024*1024;
    private static boolean fastSync_ = false;
    private static boolean rackAware_ = false;
    private static int threadsPerPool_ = 4;
    private static List<String> tables_ = new ArrayList<String>();
    private static Set<String> applicationColumnFamilies_ = new HashSet<String>();

    // Default descriptive names for use in CQL. The user can override
    // these choices in the config file. These are not case sensitive.
    // Hence, these are stored in UPPER case for easy comparison.
    private static String d_rowKey_           = "ROW_KEY";
    private static String d_superColumnMap_   = "SUPER_COLUMN_MAP";
    private static String d_superColumnKey_   = "SUPER_COLUMN_KEY";
    private static String d_columnMap_        = "COLUMN_MAP";
    private static String d_columnKey_        = "COLUMN_KEY";
    private static String d_columnValue_      = "COLUMN_VALUE";
    private static String d_columnTimestamp_  = "COLUMN_TIMESTAMP";

    /*
     * A map from table names to the set of column families for the table and the
     * corresponding meta data for that column family.
    */
    private static Map<String, Map<String, CFMetaData>> tableToCFMetaDataMap_;
    /* Hashing strategy Random or OPHF */
    private static String partitionerClass_;
    /* if the size of columns or super-columns are more than this, indexing will kick in */
    private static int columnIndexSizeInKB_;
    /* Size of touch key cache */
    private static int touchKeyCacheSize_ = 1024;
    /* Number of hours to keep a memtable in memory */
    private static int memtableLifetime_ = 6;
    /* Size of the memtable in memory before it is dumped */
    private static int memtableSize_ = 128;
    /* Number of objects in millions in the memtable before it is dumped */
    private static double memtableObjectCount_ = 1;
    /* 
     * This parameter enables or disables consistency checks. 
     * If set to false the read repairs are disable for very
     * high throughput on reads but at the cost of consistency.
    */
    private static boolean doConsistencyCheck_ = true;
    /* Address of ZooKeeper cell */
    private static String zkAddress_;
    /* Callout directories */
    private static String calloutLocation_;
    /* Job Jar Location */
    private static String jobJarFileLocation_;
    /* Address where to run the job tracker */
    private static String jobTrackerHost_;    
    /* Zookeeper session timeout. */
    private static int zkSessionTimeout_ = 30000;
    /* time to wait before garbage collecting tombstones (deletion markers) */
    private static int gcGraceInSeconds_ = 10 * 24 * 3600; // 10 days

    // the path qualified config file (storage-conf.xml) name
    private static String configFileName_;

    static
    {
        try
        {
            configFileName_ = System.getProperty("storage-config") + System.getProperty("file.separator") + "storage-conf.xml";
            XMLUtils xmlUtils = new XMLUtils(configFileName_);

            /* Cluster Name */
            clusterName_ = xmlUtils.getNodeValue("/Storage/ClusterName");

            /* Ganglia servers contact list */
            gangliaServers_ = xmlUtils.getNodeValues("/Storage/GangliaServers/GangliaServer");

{'fraction_non_alphanumeric': 0.07233751814843283, 'fraction_numerical': 0.011358783841489452, 'mean_word_length': 3.349925705794948, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 10}, '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': '4152059', 'n_tokens_mistral': 3183, 'n_tokens_neox': 3038, 'n_words': 1218}