qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oru...@apache.org
Subject svn commit: r1417438 - in /qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src: main/java/org/apache/qpid/server/configuration/ main/java/org/apache/qpid/server/registry/ test/java/org/apache/qpid/server/configuration/ velocity/templates/or...
Date Wed, 05 Dec 2012 14:25:19 GMT
Author: orudyy
Date: Wed Dec  5 14:25:18 2012
New Revision: 1417438

URL: http://svn.apache.org/viewvc?rev=1417438&view=rev
Log:
QPID-4390: Change messages classes to use default US locale and remove references from them
to ApplicationRegistry

Modified:
    qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
    qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
    qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
    qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java?rev=1417438&r1=1417437&r2=1417438&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
(original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/configuration/ServerConfiguration.java
Wed Dec  5 14:25:18 2012
@@ -24,7 +24,6 @@ import java.io.File;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import javax.net.ssl.KeyManagerFactory;
 import javax.net.ssl.TrustManagerFactory;
@@ -303,52 +302,6 @@ public class ServerConfiguration extends
         }
     }
 
-    /**
-     * The currently defined {@see Locale} for this broker
-     *
-     * @return the configuration defined locale
-     */
-    public Locale getLocale()
-    {
-        String localeString = getStringValue(ADVANCED_LOCALE);
-        // Expecting locale of format langauge_country_variant
-
-        // If the configuration does not have a defined locale use the JVM default
-        if (localeString == null)
-        {
-            return Locale.getDefault();
-        }
-
-        String[] parts = localeString.split("_");
-
-        Locale locale;
-        switch (parts.length)
-        {
-            case 1:
-                locale = new Locale(localeString);
-                break;
-            case 2:
-                locale = new Locale(parts[0], parts[1]);
-                break;
-            default:
-                StringBuilder variant = new StringBuilder(parts[2]);
-                // If we have a variant such as the Java doc suggests for Spanish
-                // Traditional_WIN we may end up with more than 3 parts on a
-                // split with '_'. So we should recombine the variant.
-                if (parts.length > 3)
-                {
-                    for (int index = 3; index < parts.length; index++)
-                    {
-                        variant.append('_').append(parts[index]);
-                    }
-                }
-
-                locale = new Locale(parts[0], parts[1], variant.toString());
-        }
-
-        return locale;
-    }
-
     public String getConfigurationURL()
     {
         return _configFile == null ? "" : _configFile.getAbsolutePath();

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java?rev=1417438&r1=1417437&r2=1417438&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
(original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/main/java/org/apache/qpid/server/registry/ApplicationRegistry.java
Wed Dec  5 14:25:18 2012
@@ -184,11 +184,6 @@ public class ApplicationRegistry impleme
 
             getVirtualHostRegistry().setDefaultVirtualHostName(configuration.getDefaultVirtualHost());
 
-            // We have already loaded the BrokerMessages class by this point so we
-            // need to refresh the locale setting in case we had a different value in
-            // the configuration.
-            BrokerMessages.reload();
-
             // Create the RootLogger to be used during broker operation
             boolean statusUpdatesEnabled = Boolean.parseBoolean(System.getProperty(BrokerProperties.PROPERTY_STATUS_UPDATES,
"true"));
             _rootMessageLogger = new Log4jMessageLogger(statusUpdatesEnabled);

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java?rev=1417438&r1=1417437&r2=1417438&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
(original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/test/java/org/apache/qpid/server/configuration/ServerConfigurationTest.java
Wed Dec  5 14:25:18 2012
@@ -39,7 +39,6 @@ import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.Writer;
-import java.util.Locale;
 
 import javax.net.ssl.KeyManagerFactory;
 
@@ -142,39 +141,6 @@ public class ServerConfigurationTest ext
         assertEquals(true, _serverConfig.getSynchedClocks());
     }
 
-    public void testGetLocale() throws ConfigurationException
-    {
-        // Check default
-        _serverConfig.initialise();
-
-        // The Default is what ever the VMs default is
-        Locale defaultLocale = Locale.getDefault();
-
-        assertEquals(defaultLocale, _serverConfig.getLocale());
-
-
-        //Test Language only
-        Locale update = new Locale("es");
-        _config.setProperty(ServerConfiguration.ADVANCED_LOCALE, "es");
-        _serverConfig = new ServerConfiguration(_config);
-        _serverConfig.initialise();
-        assertEquals(update, _serverConfig.getLocale());
-
-        //Test Language and Country
-        update = new Locale("es","ES");
-        _config.setProperty(ServerConfiguration.ADVANCED_LOCALE, "es_ES");
-        _serverConfig = new ServerConfiguration(_config);
-        _serverConfig.initialise();
-        assertEquals(update, _serverConfig.getLocale());
-
-        //Test Language and Country and Variant
-        update = new Locale("es","ES", "Traditional_WIN");
-        _config.setProperty(ServerConfiguration.ADVANCED_LOCALE, "es_ES_Traditional_WIN");
-        _serverConfig = new ServerConfiguration(_config);
-        _serverConfig.initialise();
-        assertEquals(update, _serverConfig.getLocale());
-    }
-
     public void testGetManagementKeyStorePath() throws ConfigurationException
     {
         // Check default

Modified: qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm?rev=1417438&r1=1417437&r2=1417438&view=diff
==============================================================================
--- qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm
(original)
+++ qpid/branches/java-broker-config-qpid-4390/qpid/java/broker/src/velocity/templates/org/apache/qpid/server/logging/messages/LogMessages.vm
Wed Dec  5 14:25:18 2012
@@ -24,7 +24,6 @@ import static org.apache.qpid.server.log
 
 import org.apache.log4j.Logger;
 import org.apache.qpid.server.logging.LogMessage;
-import org.apache.qpid.server.registry.ApplicationRegistry;
 
 import java.text.MessageFormat;
 import java.util.Locale;
@@ -44,7 +43,7 @@ import java.util.ResourceBundle;
 public class ${type.name}Messages
 {
     private static ResourceBundle _messages;
-    private static Locale _currentLocale;
+    private static Locale _currentLocale = Locale.US;
     
     public static final String ${type.name.toUpperCase()}_LOG_HIERARCHY = DEFAULT_LOG_HIERARCHY_PREFIX
+ "${type.name.toLowerCase()}";
 #foreach( $message in ${type.list} )
@@ -61,21 +60,17 @@ public class ${type.name}Messages
         reload();
     }
 
-    public static void reload()
+    public static void reload(Locale locale)
     {
-        if (ApplicationRegistry.isConfigured())
-        {
-            _currentLocale = ApplicationRegistry.getInstance().getConfiguration().getLocale();
-        }
-        else
-        {
-            _currentLocale = Locale.getDefault();
-        }
+        _currentLocale = locale;
+        reload();
+    }
 
+    public static void reload()
+    {
         _messages = ResourceBundle.getBundle("${resource}", _currentLocale);
     }
 
-
 ##
 ## The list stored under key 'list' in the 'type' HashMap contains all the
 ## log messages that this class should contain. So for each entry in the list



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message