<commit_before>/*
* CollabNet Subversion Edge
* Copyright (C) 2010, CollabNet Inc. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package com.collabnet.svnedge.console.services

/**
 * The abstract service provided shared method calls for the grails services.
 * 
 * @author <NAME> (<EMAIL>)
 *
 */
abstract class AbstractSvnEdgeService {

    def grailsApplication

    /**
     * Gets an i18n message from the messages.properties file without providing
     * parameters using the default locale.
     * @param key is the key in the messages.properties file.
     * @return the message related to the key in the messages.properties file
     * using the default locale.
      */
    protected def getMessage(String key) {
        return this.getMessage(key, null)
    }

    /**
     * Gets an i18n message from the messages.properties file with the default
     * locale used by the JVM.
     * @param key is the key in the messages.properties file.
     * @param params is the list of parameters to provide the i18n.
     * @return the message related to the key in the messages.properties file
     * using the default locale from the JVM.
     */
    protected def getMessage(String key, params) {
        return this.getMessage(key, params as String[], Locale.getDefault())
    }

    /**
    * Gets an i18n message from the messages.properties file with the default
    * locale used by the JVM.
    * @param key is the key in the messages.properties file.
    * @param params is the list of parameters to provide the i18n.
    * @return the message related to the key in the messages.properties file
    * using the default locale from the JVM.
    */
   protected def getMessage(String key, Locale locale) {
       return this.getMessage(key, null, locale)
   }

   /**
    * Gets an i18n message from the messages.properties file without providing
    * parameters using the default locale.
    * @param key is the key in the messages.properties file.
    * @param params is the list of parameters to provide the i18n.
    * @return the message related to the key in the messages.properties file
    * using the default locale.
    */
   protected def getMessage(String key, params, locale) {
       if (!locale) {
           locale = Locale.getDefault()
       }
       def appCtx = grailsApplication.getMainContext()
       return appCtx.getMessage(key, params as String[], locale)
   }

}<commit_msg>[artf5114] : faulty i18n message call when sigar libs don't load<commit_after>/*
* CollabNet Subversion Edge
* Copyright (C) 2010, CollabNet Inc. All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package com.collabnet.svnedge.console.services

/**
 * The abstract service provided shared method calls for the grails services.
 * 
 * @author <NAME> (<EMAIL>)
 *
 */
abstract class AbstractSvnEdgeService {

    def grailsApplication

    /**
     * Gets an i18n message from the messages.properties file without providing
     * parameters using the default locale.
     * @param key is the key in the messages.properties file.
     * @return the message related to the key in the messages.properties file
     * using the default locale.
      */
    protected def getMessage(String key) {
        return this.getMessage(key, null)
    }

    /**
     * Gets an i18n message from the messages.properties file with the default
     * locale used by the JVM.
     * @param key is the key in the messages.properties file.
     * @param params is the list of parameters to provide the i18n.
     * @return the message related to the key in the messages.properties file
     * using the default locale from the JVM.
     */
    protected def getMessage(String key, List<String> params) {
        return this.getMessage(key, params as String[], Locale.getDefault())
    }

    /**
    * Gets an i18n message from the messages.properties file with the default
    * locale used by the JVM.
    * @param key is the key in the messages.properties file.
    * @param params is the list of parameters to provide the i18n.
    * @return the message related to the key in the messages.properties file
    * using the default locale from the JVM.
    */
   protected def getMessage(String key, Locale locale) {
       return this.getMessage(key, null, locale)
   }

   /**
    * Gets an i18n message from the messages.properties file without providing
    * parameters using the default locale.
    * @param key is the key in the messages.properties file.
    * @param params is the list of parameters to provide the i18n.
    * @return the message related to the key in the messages.properties file
    * using the default locale.
    */
   protected def getMessage(String key, List<String> params, Locale locale) {
       if (!locale) {
           locale = Locale.getDefault()
       }
       def appCtx = grailsApplication.getMainContext()
       return appCtx.getMessage(key, params as String[], locale)
   }

}
{'fraction_non_alphanumeric': 0.07022653721682848, 'fraction_numerical': 0.007119741100323625, 'mean_word_length': 3.05045871559633, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '4944668', 'n_tokens_mistral': 1628, 'n_tokens_neox': 1600, 'n_words': 770}