directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r721380 - in /directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model: Messages.java Server.java ServerStateEnum.java ServersHandler.java ServersHandlerIO.java messages.properties messages_de.properties
Date Fri, 28 Nov 2008 08:27:18 GMT
Author: felixk
Date: Fri Nov 28 00:27:17 2008
New Revision: 721380

URL: http://svn.apache.org/viewvc?rev=721380&view=rev
Log:
- Externalize Strings
- Add German translation

Added:
    directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Messages.java
  (with props)
    directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages.properties
  (with props)
    directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages_de.properties
  (with props)
Modified:
    directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Server.java
    directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServerStateEnum.java
    directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandler.java
    directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandlerIO.java

Added: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Messages.java?rev=721380&view=auto
==============================================================================
--- directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Messages.java
(added)
+++ directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Messages.java
Fri Nov 28 00:27:17 2008
@@ -0,0 +1,51 @@
+/*
+ *  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.directory.studio.apacheds.model;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+    private static final String BUNDLE_NAME = "org.apache.directory.studio.apacheds.model.messages";
//$NON-NLS-1$
+
+    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME
);
+
+
+    private Messages()
+    {
+    }
+
+
+    public static String getString( String key )
+    {
+        try
+        {
+            return RESOURCE_BUNDLE.getString( key );
+        }
+        catch ( MissingResourceException e )
+        {
+            return '!' + key + '!';
+        }
+    }
+}

Propchange: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Messages.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Server.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Server.java?rev=721380&r1=721379&r2=721380&view=diff
==============================================================================
--- directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Server.java
(original)
+++ directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/Server.java
Fri Nov 28 00:27:17 2008
@@ -73,7 +73,7 @@
     {
         if ( listener == null )
         {
-            throw new IllegalArgumentException( "Listener cannot be null" );
+            throw new IllegalArgumentException( Messages.getString( "Server.ListenerCantBeNull"
) ); //$NON-NLS-1$
         }
 
         listeners.add( listener );
@@ -90,7 +90,7 @@
     {
         if ( listener == null )
         {
-            throw new IllegalArgumentException( "Listener cannot be null" );
+            throw new IllegalArgumentException( Messages.getString( "Server.ListenerCantBeNull"
) ); //$NON-NLS-1$
         }
 
         listeners.remove( listener );

Modified: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServerStateEnum.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServerStateEnum.java?rev=721380&r1=721379&r2=721380&view=diff
==============================================================================
--- directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServerStateEnum.java
(original)
+++ directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServerStateEnum.java
Fri Nov 28 00:27:17 2008
@@ -28,7 +28,7 @@
  */
 public enum ServerStateEnum
 {
-    STARTING("Starting"), STARTED("Started"), STOPPING("Stopping"), STOPPED("Stopped"), UNKNONW("Unknown");
+    STARTING(Messages.getString( "ServerStateEnum.Starting" )), STARTED(Messages.getString(
"ServerStateEnum.Started" )), STOPPING(Messages.getString( "ServerStateEnum.Stopping" )),
STOPPED(Messages.getString( "ServerStateEnum.Stopped" )), UNKNONW(Messages.getString( "ServerStateEnum.Unknown"
)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
 
     /** The dispayable name of the state */
     private String displayName;

Modified: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandler.java?rev=721380&r1=721379&r2=721380&view=diff
==============================================================================
--- directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandler.java
(original)
+++ directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandler.java
Fri Nov 28 00:27:17 2008
@@ -230,7 +230,7 @@
         File store = getServersStorePath().toFile();
         File tempStore = getServersStoreTempPath().toFile();
         boolean loadFailed = false;
-        String exceptionMessage = "";
+        String exceptionMessage = ""; //$NON-NLS-1$
 
         // We try to load the servers file
         if ( store.exists() )
@@ -273,18 +273,18 @@
                     }
                     catch ( FileNotFoundException e )
                     {
-                        ApacheDsPluginUtils.reportError( "An error occured when loading the
servers.\n\n"
+                        ApacheDsPluginUtils.reportError( Messages.getString( "ServersHandler.ErrorLoadingServer"
) //$NON-NLS-1$
                             + e.getMessage() );
                     }
                     catch ( ServersHandlerIOException e )
                     {
-                        ApacheDsPluginUtils.reportError( "An error occured when loading the
servers.\n\n"
+                        ApacheDsPluginUtils.reportError( Messages.getString( "ServersHandler.ErrorLoadingServer"
) //$NON-NLS-1$
                             + e.getMessage() );
                     }
                 }
                 else
                 {
-                    ApacheDsPluginUtils.reportError( "An error occured when loading the servers.\n\n"
+                    ApacheDsPluginUtils.reportError( Messages.getString( "ServersHandler.ErrorLoadingServer"
) //$NON-NLS-1$
                         + exceptionMessage );
                 }
             }
@@ -308,8 +308,8 @@
             ServersHandlerIO.write( serversList, outputStream );
 
             // Copying the temp servers file to the final location
-            String content = FileUtils.readFileToString( tempStore, "UTF-8" );
-            FileUtils.writeStringToFile( store, content, "UTF-8" );
+            String content = FileUtils.readFileToString( tempStore, "UTF-8" ); //$NON-NLS-1$
+            FileUtils.writeStringToFile( store, content, "UTF-8" ); //$NON-NLS-1$
         }
         catch ( FileNotFoundException e )
         {
@@ -333,11 +333,13 @@
             }
             catch ( FileNotFoundException e )
             {
-                ApacheDsPluginUtils.reportError( "An error occured when loading the servers.\n\n"
+ e.getMessage() );
+                ApacheDsPluginUtils
+                    .reportError( Messages.getString( "ServersHandler.ErrorLoadingServer"
) + e.getMessage() ); //$NON-NLS-1$
             }
             catch ( IOException e )
             {
-                ApacheDsPluginUtils.reportError( "An error occured when loading the servers.\n\n"
+ e.getMessage() );
+                ApacheDsPluginUtils
+                    .reportError( Messages.getString( "ServersHandler.ErrorLoadingServer"
) + e.getMessage() ); //$NON-NLS-1$
             }
         }
     }
@@ -351,7 +353,7 @@
      */
     private IPath getServersStorePath()
     {
-        return ApacheDsPlugin.getDefault().getStateLocation().append( "servers.xml" );
+        return ApacheDsPlugin.getDefault().getStateLocation().append( "servers.xml" ); //$NON-NLS-1$
     }
 
 
@@ -363,7 +365,7 @@
      */
     private IPath getServersStoreTempPath()
     {
-        return ApacheDsPlugin.getDefault().getStateLocation().append( "servers-temp.xml"
);
+        return ApacheDsPlugin.getDefault().getStateLocation().append( "servers-temp.xml"
); //$NON-NLS-1$
     }
 
 

Modified: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandlerIO.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandlerIO.java?rev=721380&r1=721379&r2=721380&view=diff
==============================================================================
--- directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandlerIO.java
(original)
+++ directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/ServersHandlerIO.java
Fri Nov 28 00:27:17 2008
@@ -46,11 +46,11 @@
 public class ServersHandlerIO
 {
     // XML tags and attributes
-    private static final String SERVERS_TAG = "servers";
-    private static final String SERVER_TAG = "server";
-    private static final String SERVER_ID_ATTRIBUTE = "id";
-    private static final String SERVER_NAME_ATTRIBUTE = "name";
-    private static final String SERVER_VERSION_ATTRIBUTE = "version";
+    private static final String SERVERS_TAG = "servers"; //$NON-NLS-1$
+    private static final String SERVER_TAG = "server"; //$NON-NLS-1$
+    private static final String SERVER_ID_ATTRIBUTE = "id"; //$NON-NLS-1$
+    private static final String SERVER_NAME_ATTRIBUTE = "name"; //$NON-NLS-1$
+    private static final String SERVER_VERSION_ATTRIBUTE = "version"; //$NON-NLS-1$
 
 
     /**
@@ -81,7 +81,7 @@
         Element rootElement = document.getRootElement();
         if ( !rootElement.getName().equals( SERVERS_TAG ) )
         {
-            throw new ServersHandlerIOException( "The file does not seem to be a valid servers
file." );
+            throw new ServersHandlerIOException( Messages.getString( "ServersHandlerIO.ErrorNotValidServersFile"
) ); //$NON-NLS-1$
         }
 
         for ( Iterator<?> i = rootElement.elementIterator( SERVER_TAG ); i.hasNext();
)
@@ -123,11 +123,11 @@
         Attribute versionAttribute = element.attribute( SERVER_VERSION_ATTRIBUTE );
         if ( versionAttribute != null )
         {
-            if ( versionAttribute.getValue().equalsIgnoreCase( "1.5.4" ) )
+            if ( versionAttribute.getValue().equalsIgnoreCase( "1.5.4" ) ) //$NON-NLS-1$
             {
                 server.setVersion( ServerVersion.VERSION_1_5_4 );
             }
-            else if ( versionAttribute.getValue().equalsIgnoreCase( "1.5.3" ) )
+            else if ( versionAttribute.getValue().equalsIgnoreCase( "1.5.3" ) ) //$NON-NLS-1$
             {
                 server.setVersion( ServerVersion.VERSION_1_5_3 );
             }
@@ -179,7 +179,7 @@
 
         // Writing the file to the stream
         OutputFormat outformat = OutputFormat.createPrettyPrint();
-        outformat.setEncoding( "UTF-8" );
+        outformat.setEncoding( "UTF-8" ); //$NON-NLS-1$
         XMLWriter writer = new XMLWriter( outputStream, outformat );
         writer.write( document );
         writer.flush();

Added: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages.properties?rev=721380&view=auto
==============================================================================
--- directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages.properties
(added)
+++ directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages.properties
Fri Nov 28 00:27:17 2008
@@ -0,0 +1,25 @@
+#  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.
+
+Server.ListenerCantBeNull=Listener cannot be null
+ServersHandler.ErrorLoadingServer=An error occured when loading the servers.\n\n
+ServersHandlerIO.ErrorNotValidServersFile=The file does not seem to be a valid servers file.
+ServerStateEnum.Started=Started
+ServerStateEnum.Starting=Starting
+ServerStateEnum.Stopped=Stopped
+ServerStateEnum.Stopping=Stopping
+ServerStateEnum.Unknown=Unknown

Propchange: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages.properties
------------------------------------------------------------------------------
    svn:keywords = Id

Added: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages_de.properties?rev=721380&view=auto
==============================================================================
--- directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages_de.properties
(added)
+++ directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages_de.properties
Fri Nov 28 00:27:17 2008
@@ -0,0 +1,25 @@
+#  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.
+
+Server.ListenerCantBeNull=Empf\u00E4nger kann nicht null sein
+ServersHandler.ErrorLoadingServer=Beim Laden des Servers ist ein Fehler aufgetreten.\n\n
+ServersHandlerIO.ErrorNotValidServersFile=Die Datei scheint keine g\u00FCltige Server-Datei
zu sein.
+ServerStateEnum.Started=Gestartet
+ServerStateEnum.Starting=Startend
+ServerStateEnum.Stopped=Gestoppt
+ServerStateEnum.Stopping=Stoppend
+ServerStateEnum.Unknown=Unbekannt

Propchange: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages_de.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/studio/trunk/apacheds/src/main/java/org/apache/directory/studio/apacheds/model/messages_de.properties
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message