[cal10n-dev] [GIT] Compiler assisted localization library branch, master, updated. 268749b09993fdb1487c7108b724aae54d1db2eb

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Tue Sep 1 14:10:44 CEST 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Compiler assisted localization library".

The branch, master has been updated
       via  268749b09993fdb1487c7108b724aae54d1db2eb (commit)
      from  e3551bfd202a35a9dcc796b992317d3ed2570935 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=cal10n.git;a=commit;h=268749b09993fdb1487c7108b724aae54d1db2eb
http://github.com/ceki/cal10n/commit/268749b09993fdb1487c7108b724aae54d1db2eb

commit 268749b09993fdb1487c7108b724aae54d1db2eb
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Tue Sep 1 14:06:37 2009 +0200

    - we now refer to message keys instead of message codes
    
    - added support for MessageParameterObj based on contribution by Rick
      Beton

diff --git a/cal10n-api/pom.xml b/cal10n-api/pom.xml
index ea8c23d..f7486f7 100644
--- a/cal10n-api/pom.xml
+++ b/cal10n-api/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>ch.qos.cal10n</groupId>
     <artifactId>cal10n-parent</artifactId>
-    <version>0.5</version>
+    <version>0.5.1</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/Cal10nConstants.java b/cal10n-api/src/main/java/ch/qos/cal10n/Cal10nConstants.java
index 05a67a4..d782ec1 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/Cal10nConstants.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/Cal10nConstants.java
@@ -12,5 +12,5 @@ public class Cal10nConstants {
   final public static String CODE_URL_PREFIX = "http://cal10n.qos.ch/codes.html";
   final public static String MISSING_RB_ANNOTATION_URL =  Cal10nConstants.CODE_URL_PREFIX+"#missingRBAnnotation";
 
-  final public static String MessageCodeVerifier_FQCN = "ch.qos.cal10n.verifier.MessageCodeVerifier";
+  final public static String MessageKeyVerifier_FQCN = "ch.qos.cal10n.verifier.MessageKeyVerifier";
 }
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/IMessageConveyor.java b/cal10n-api/src/main/java/ch/qos/cal10n/IMessageConveyor.java
index f54c19d..53fb1b6 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/IMessageConveyor.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/IMessageConveyor.java
@@ -49,16 +49,25 @@ public interface IMessageConveyor {
    * 
    * @param <E>
    *          an enum type
-   * @param e
+   * @param key
    *          an enum instance
    * @param args
    *          optional arguments
-   * @return
+   * @return The translated/localized message
+   */
+  <E extends Enum<?>> String getMessage(E key, Object... args);
+
+  /**
+   * Syntactic sugar for the case where the massage is contained in a
+   * {@link MessageParameterObj}. 
    * 
-   * @param <E>
-   * @param e
-   * @param args
-   * @return
+   * <p>Equivalent to calling
+   * <pre>getMessage(mpo.getKey(), mpo.getArgs());</pre>
+   * 
+   * @see #getMessage(Enum, Object...)
+   * @param mpo
+   *          The MessageParameterObj to translate
+   * @return translated message
    */
-  <E extends Enum<?>> String getMessage(E e, Object... args);
+  String getMessage(MessageParameterObj mpo);
 }
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/LocaleNames.java b/cal10n-api/src/main/java/ch/qos/cal10n/LocaleNames.java
index 46c4832..20e2b14 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/LocaleNames.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/LocaleNames.java
@@ -26,7 +26,7 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
-import ch.qos.cal10n.verifier.MessageCodeVerifier;
+import ch.qos.cal10n.verifier.MessageKeyVerifier;
 
 /**
  * This annotation serves to designate a list of locale names for which resource
@@ -49,7 +49,7 @@ import ch.qos.cal10n.verifier.MessageCodeVerifier;
  * The name of the corresponding resource bundle named "colors".
  * 
  * <p>
- * Verification tools such {@link MessageCodeVerifier} can thus conclude that
+ * Verification tools such {@link MessageKeyVerifier} can thus conclude that
  * the resource bundle files <em>colors_en.properties</em> and
  * <em>colors_jp.properties</em> exist and should be checked against the codes
  * defined in the Colors enum.
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/MessageConveyor.java b/cal10n-api/src/main/java/ch/qos/cal10n/MessageConveyor.java
index c061195..b8670b3 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/MessageConveyor.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/MessageConveyor.java
@@ -51,32 +51,33 @@ public class MessageConveyor implements IMessageConveyor {
   }
 
   /**
-   * Given an enum e, find the corresponding resource bundle and return the
-   * internationalized message defined by the message code 'e'.
+   * Given an enum as key, find the corresponding resource bundle and return the
+   * corresponding internationalized.
    * 
    * <p>
    * The name of the resource bundle is defined via the
-   * {@link ResourceBundleName} annotation whereas the locale was specified in
+   * {@link ResourceBundleName} annotation whereas the locale is specified in
    * this MessageConveyor instance's constructor.
    * 
-   * @param e an enum instance used as message code
+   * @param key
+   *          an enum instance used as message key
    * 
    */
-  public <E extends Enum<?>> String getMessage(E e, Object... args) {
-    String code = e.toString();
+  public <E extends Enum<?>> String getMessage(E key, Object... args) {
+    String keyAsStr = key.toString();
 
-    String resouceBundleName = AnnotationExtractor.getResourceBundleName(e
+    String resouceBundleName = AnnotationExtractor.getResourceBundleName(key
         .getClass());
     if (resouceBundleName == null) {
       throw new IllegalArgumentException(
-          "Missing ResourceBundleAnnotation in [" + e.getClass().getName()
+          "Missing ResourceBundleAnnotation in [" + key.getClass().getName()
               + "]. See also " + Cal10nConstants.MISSING_RB_ANNOTATION_URL);
     }
     ResourceBundle rb = ResourceBundle.getBundle(resouceBundleName, locale);
 
-    String value = rb.getString(code);
+    String value = rb.getString(keyAsStr);
     if (value == null) {
-      return "No key found for " + code;
+      return "No key found for " + keyAsStr;
     } else {
       if (args == null || args.length == 0) {
         return value;
@@ -86,4 +87,12 @@ public class MessageConveyor implements IMessageConveyor {
     }
   }
 
+  public String getMessage(MessageParameterObj mpo) {
+    if (mpo == null) {
+      throw new IllegalArgumentException(
+          "MessageParameterObj argumument cannot be null");
+    }
+    return getMessage(mpo.getKey(), mpo.getArgs());
+  }
+
 }
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/MessageParameterObj.java b/cal10n-api/src/main/java/ch/qos/cal10n/MessageParameterObj.java
new file mode 100644
index 0000000..ff5101b
--- /dev/null
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/MessageParameterObj.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2009 QOS.ch All rights reserved.
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS  IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package ch.qos.cal10n;
+
+import java.util.Arrays;
+
+/**
+ * Holds data relevant for a deferred message lookup. This is useful when the
+ * appropriate locale is unknown at the time or place where the message key and
+ * message args are emitted. For example, a low level library might emit a
+ * localized message but it is only at the UI (user interface) layer that the
+ * locale is known. As another example, imagine that the host where the
+ * localized messages are presented to the user is in a different locale, e.g.
+ * Japan, than the source host. e.g. US.
+ * 
+ * <p>
+ * Instances of this class are intended to be immutable, subject to the
+ * immutability of the supplied args.
+ * 
+ * @author Rick Beton
+ * @author Ceki G&uuml;lc&uuml;
+ * 
+ */
+public class MessageParameterObj {
+
+  private final Enum<?> key;
+  private final Object[] args;
+
+  /**
+   * Constructs an instance.
+   * 
+   * @param code
+   *          the code for the corresponding resource.
+   * @param args
+   *          any message parameters, as required.
+   */
+  public MessageParameterObj(Enum<?> key, Object... args) {
+    if (key == null) {
+      new IllegalArgumentException("Enum argument \"key\" can't be null");
+    }
+    this.key = key;
+    this.args = args;
+  }
+
+  public Enum<?> getKey() {
+    return key;
+  }
+
+  public Object[] getArgs() {
+    return args;
+  }
+
+  @Override
+  public String toString() {
+    final StringBuilder b = new StringBuilder("Message(");
+    b.append(key.name());
+    b.append(", ");
+    b.append(Arrays.toString(args));
+    b.append(")");
+    return b.toString();
+  }
+
+  @Override
+  public int hashCode() {
+    return key.hashCode();
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj)
+      return true;
+    if (obj == null)
+      return false;
+    if (getClass() != obj.getClass())
+      return false;
+
+    MessageParameterObj other = (MessageParameterObj) obj;
+    // key cannot be null by virtue of the check done within the constructor
+    if (!key.equals(other.key))
+      return false;
+
+    return Arrays.equals(args, other.args);
+  }
+}
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/ResourceBundleName.java b/cal10n-api/src/main/java/ch/qos/cal10n/ResourceBundleName.java
index a865d1d..7d730fa 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/ResourceBundleName.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/ResourceBundleName.java
@@ -27,7 +27,7 @@ import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
-import ch.qos.cal10n.verifier.MessageCodeVerifier;
+import ch.qos.cal10n.verifier.MessageKeyVerifier;
 
 /**
  * This annotation serves to designate the name of the resource bundle
@@ -51,7 +51,7 @@ import ch.qos.cal10n.verifier.MessageCodeVerifier;
  * files <em>colors_en.properties</em> and <em>colors_jp.properties</em> exist.
  * 
  * <p>
- * Verification tools such as {@link MessageCodeVerifier} can then proceed to
+ * Verification tools such as {@link MessageKeyVerifier} can then proceed to
  * check that the codes defined in the enum type match those in the resource bundles.
  * 
  * @author Ceki G&uuml;lc&uuml;
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/verifier/Cal10nError.java b/cal10n-api/src/main/java/ch/qos/cal10n/verifier/Cal10nError.java
index 5bad0aa..b4ba6d8 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/verifier/Cal10nError.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/verifier/Cal10nError.java
@@ -39,16 +39,16 @@ public class Cal10nError {
   }
 
   final ErrorType errorType;
-  final String code;
+  final String key;
   final Locale locale;
   final Class<?> enumClass;
   final String enumClassName;
   final String resouceBundleName;
 
-  Cal10nError(ErrorType errorType, String code, Class<?> enumClass,
+  Cal10nError(ErrorType errorType, String key, Class<?> enumClass,
       Locale locale, String resourceBundleName) {
     this.errorType = errorType;
-    this.code = code;
+    this.key = key;
     this.enumClass = enumClass;
     this.enumClassName = enumClass.getName();
     this.locale = locale;
@@ -60,7 +60,7 @@ public class Cal10nError {
   }
 
   public String getCode() {
-    return code;
+    return key;
   }
 
   public Locale getLocale() {
@@ -91,11 +91,11 @@ public class Cal10nError {
     case EMPTY_ENUM:
       return "Empty enum type [" + enumClassName + "]";
     case ABSENT_IN_ENUM:
-      return "Code [" + code + "] present in resource bundle named ["
+      return "Key [" + key + "] present in resource bundle named ["
           + resouceBundleName + "] for locale [" + locale
           + "] but absent in enum type [" + enumClassName + "]";
     case ABSENT_IN_RB:
-      return "Code [" + code + "] present in enum type [" + enumClassName
+      return "Key [" + key + "] present in enum type [" + enumClassName
           + "] but absent in resource bundle named [" + resouceBundleName
           + "] for locale [" + locale + "]";
     default:
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/verifier/IMessageCodeVerifier.java b/cal10n-api/src/main/java/ch/qos/cal10n/verifier/IMessageKeyVerifier.java
similarity index 90%
rename from cal10n-api/src/main/java/ch/qos/cal10n/verifier/IMessageCodeVerifier.java
rename to cal10n-api/src/main/java/ch/qos/cal10n/verifier/IMessageKeyVerifier.java
index de30c9a..5dee005 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/verifier/IMessageCodeVerifier.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/verifier/IMessageKeyVerifier.java
@@ -8,12 +8,12 @@ import java.util.Locale;
  * found in the corresponding resource bundles.
  * 
  * <p>
- * See also {@link MessageCodeVerifier} for a concrete implementation.
+ * See also {@link MessageKeyVerifier} for a concrete implementation.
  * 
  * @author Ceki G&uuml;lc&uuml;
  * 
  */
-public interface IMessageCodeVerifier {
+public interface IMessageKeyVerifier {
 
   // WARNING: The name of this class is referenced in String form
   // to do class loader tricks. Do not change the name of this class
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageCodeVerifier.java b/cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageKeyVerifier.java
similarity index 87%
rename from cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageCodeVerifier.java
rename to cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageKeyVerifier.java
index 0146e1f..4effb60 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageCodeVerifier.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageKeyVerifier.java
@@ -35,22 +35,22 @@ import ch.qos.cal10n.verifier.Cal10nError.ErrorType;
 
 /**
  * Given an enum class, verify that the resource bundles corresponding to a
- * given locale contains the correct codes.
+ * given locale contains the correct keys.
  * 
  * @author Ceki Gulcu
  */
-public class MessageCodeVerifier implements IMessageCodeVerifier {
+public class MessageKeyVerifier implements IMessageKeyVerifier {
 
   Class<? extends Enum<?>> enumType;
   String enumTypeAsStr;
 
-  public MessageCodeVerifier(Class<? extends Enum<?>> enumClass) {
+  public MessageKeyVerifier(Class<? extends Enum<?>> enumClass) {
     this.enumType = enumClass;
     this.enumTypeAsStr = enumClass.getName();
   }
 
   @SuppressWarnings("unchecked")
-  public MessageCodeVerifier(String enumTypeAsStr) {
+  public MessageKeyVerifier(String enumTypeAsStr) {
     this.enumTypeAsStr = enumTypeAsStr;
     String errMsg = "Failed to find enum class [" + enumTypeAsStr + "]";
     try {
@@ -62,29 +62,14 @@ public class MessageCodeVerifier implements IMessageCodeVerifier {
     }
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see ch.qos.cai10n.verifier.IIMessageCodeVerifier#getEnumType()
-   */
   public Class<? extends Enum<?>> getEnumType() {
     return enumType;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see ch.qos.cal10n.verifier.IIMessageCodeVerifier#getEnumTypeAsStr()
-   */
   public String getEnumTypeAsStr() {
     return enumTypeAsStr;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see ch.qos.cal10n.verifier.IIMessageCodeVerifier#verify(java.util.Locale)
-   */
   public List<Cal10nError> verify(Locale locale) {
     List<Cal10nError> errorList = new ArrayList<Cal10nError>();
 
diff --git a/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageCodeVerifierTest.java b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageCodeVerifierTest.java
index 847c368..e0354a6 100644
--- a/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageCodeVerifierTest.java
+++ b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageCodeVerifierTest.java
@@ -30,8 +30,8 @@ import java.util.Locale;
 import org.junit.Test;
 
 import ch.qos.cal10n.verifier.Cal10nError;
-import ch.qos.cal10n.verifier.IMessageCodeVerifier;
-import ch.qos.cal10n.verifier.MessageCodeVerifier;
+import ch.qos.cal10n.verifier.IMessageKeyVerifier;
+import ch.qos.cal10n.verifier.MessageKeyVerifier;
 
 /**
  * 
@@ -42,14 +42,14 @@ public class MessageCodeVerifierTest {
   
   @Test
   public void smoke() {
-    IMessageCodeVerifier miv = new MessageCodeVerifier(Colors.class);
+    IMessageKeyVerifier miv = new MessageKeyVerifier(Colors.class);
     List<Cal10nError> errorList = miv.verify(Locale.UK);
     assertEquals(0, errorList.size());
   }
   
   @Test
   public void withErrors_UK() {
-    IMessageCodeVerifier miv = new MessageCodeVerifier(Countries.class);
+    IMessageKeyVerifier miv = new MessageKeyVerifier(Countries.class);
     List<Cal10nError> errorList = miv.verify(Locale.UK);
     assertEquals(2, errorList.size());
     assertEquals("CH", errorList.get(0).getCode());
@@ -59,7 +59,7 @@ public class MessageCodeVerifierTest {
   
   @Test
   public void withErrors_FR() {
-    IMessageCodeVerifier miv = new MessageCodeVerifier(Countries.class);
+    IMessageKeyVerifier miv = new MessageKeyVerifier(Countries.class);
     List<Cal10nError> errorList = miv.verify(Locale.FRANCE);
     assertEquals(3, errorList.size());
     assertEquals("CH", errorList.get(0).getCode());
diff --git a/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageConveyorTest.java b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageConveyorTest.java
index dfc2219..f60ce2c 100644
--- a/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageConveyorTest.java
+++ b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MessageConveyorTest.java
@@ -29,44 +29,56 @@ import java.util.Locale;
 import org.junit.Test;
 
 import ch.qos.cal10n.MessageConveyor;
+import ch.qos.cal10n.MessageParameterObj;
 
 public class MessageConveyorTest {
 
   @Test
   public void smoke_EN() {
-    MessageConveyor rbbmc = new MessageConveyor(
-        Locale.UK);
+    MessageConveyor rbbmc = new MessageConveyor(Locale.UK);
 
     {
       String val = rbbmc.getMessage(Colors.BLUE);
       assertEquals("violets are blue", val);
     }
 
-
     {
       String val = rbbmc.getMessage(Colors.GREEN, "apples");
       assertEquals("apples are green", val);
     }
 
   }
-  
+
   @Test
   public void smoke_FR() {
-    MessageConveyor rbbmc = new MessageConveyor(
-        Locale.FRANCE);
+    MessageConveyor rbbmc = new MessageConveyor(Locale.FRANCE);
 
     {
       String val = rbbmc.getMessage(Colors.BLUE);
       assertEquals("les violettes sont bleues", val);
     }
 
-
     {
       // lemon=citron in french. This illustrates the problem of
       // translating the parameters of a message
       String val = rbbmc.getMessage(Colors.GREEN, "pommes");
       assertEquals("les pommes sont verts", val);
     }
+  }
+
+  @Test
+  public void mpo() {
+    MessageConveyor rbbmc = new MessageConveyor(Locale.UK);
+    {
+      MessageParameterObj mpo = new MessageParameterObj(Colors.BLUE);
+      String val = rbbmc.getMessage(mpo);
+      assertEquals("violets are blue", val);
+    }
 
+    {
+      MessageParameterObj mpo = new MessageParameterObj(Colors.GREEN, "apples");
+      String val = rbbmc.getMessage(mpo);
+      assertEquals("apples are green", val);
+    }
   }
 }
diff --git a/cal10n-api/src/test/java/ch/qos/cal10n/sample/MyAllInOneColorVerificationTest.java b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MyAllInOneColorVerificationTest.java
index 80b30db..5f5014a 100644
--- a/cal10n-api/src/test/java/ch/qos/cal10n/sample/MyAllInOneColorVerificationTest.java
+++ b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MyAllInOneColorVerificationTest.java
@@ -29,8 +29,8 @@ import java.util.List;
 import org.junit.Test;
 
 import ch.qos.cal10n.verifier.Cal10nError;
-import ch.qos.cal10n.verifier.IMessageCodeVerifier;
-import ch.qos.cal10n.verifier.MessageCodeVerifier;
+import ch.qos.cal10n.verifier.IMessageKeyVerifier;
+import ch.qos.cal10n.verifier.MessageKeyVerifier;
 
 /**
  * 
@@ -42,7 +42,7 @@ public class MyAllInOneColorVerificationTest {
 
   @Test
   public void all() {
-    IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
+    IMessageKeyVerifier mcv = new MessageKeyVerifier(Colors.class);
     List<Cal10nError> errorList = mcv.verifyAllLocales();
     assertEquals(0, errorList.size());
   }
diff --git a/cal10n-api/src/test/java/ch/qos/cal10n/sample/MyColorVerificationTest.java b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MyColorVerificationTest.java
index 3b8f7ab..1624fd4 100644
--- a/cal10n-api/src/test/java/ch/qos/cal10n/sample/MyColorVerificationTest.java
+++ b/cal10n-api/src/test/java/ch/qos/cal10n/sample/MyColorVerificationTest.java
@@ -30,14 +30,14 @@ import java.util.Locale;
 import org.junit.Test;
 
 import ch.qos.cal10n.verifier.Cal10nError;
-import ch.qos.cal10n.verifier.IMessageCodeVerifier;
-import ch.qos.cal10n.verifier.MessageCodeVerifier;
+import ch.qos.cal10n.verifier.IMessageKeyVerifier;
+import ch.qos.cal10n.verifier.MessageKeyVerifier;
 
 public class MyColorVerificationTest {
 
   @Test
   public void en_UK() {
-    IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
+    IMessageKeyVerifier mcv = new MessageKeyVerifier(Colors.class);
     List<Cal10nError> errorList = mcv.verify(Locale.UK);
     for(Cal10nError error: errorList) {
       System.out.println(error);
@@ -47,7 +47,7 @@ public class MyColorVerificationTest {
 
   @Test
   public void fr() {
-    IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
+    IMessageKeyVerifier mcv = new MessageKeyVerifier(Colors.class);
     List<Cal10nError> errorList = mcv.verify(Locale.FRANCE);
     for(Cal10nError error: errorList) {
       System.out.println(error);
diff --git a/cal10n-site/pom.xml b/cal10n-site/pom.xml
index 57240ca..eed061c 100644
--- a/cal10n-site/pom.xml
+++ b/cal10n-site/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>ch.qos.cal10n</groupId>
     <artifactId>cal10n-parent</artifactId>
-    <version>0.5</version>
+    <version>0.5.1</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/cal10n-site/src/site/pages/manual.html b/cal10n-site/src/site/pages/manual.html
index a4c60b1..9d62b09 100644
--- a/cal10n-site/src/site/pages/manual.html
+++ b/cal10n-site/src/site/pages/manual.html
@@ -101,7 +101,7 @@ public enum Colors  {
 }</pre>
    
 
-  <p>Once you define a few color codes, you can create a regular
+  <p>Once you define a few color keys, you can create a regular
   resource bundle named after the value of the @ResourceBundleName
   annotation in Colors and the appropriate locale. For example, for
   the UK locale, you would name your resource bundle as
@@ -144,9 +144,9 @@ String blue = mc.getMessage(Colors.BLUE);  </pre>
   have been accustomed to, but adds compiler verification on top.</p>
 
 
-  <p>An astute reader will comment that even if the messages codes are now
+  <p>An astute reader will comment that even if the messages keys are now
   verified by the compiler, it is still possible to have mismatching
-  message codes in the resources bundles. For this reason, CAL10N
+  message keys in the resources bundles. For this reason, CAL10N
   comes with additional tooling support.
   </p>
 
@@ -170,15 +170,15 @@ import java.util.Locale;
 import org.junit.Test;
 
 import ch.qos.cal10n.verifier.Cal10nError;
-import ch.qos.cal10n.verifier.IMessageCodeVerifier;
-import ch.qos.cal10n.verifier.MessageCodeVerifier;
+import ch.qos.cal10n.verifier.IMessageKeyVerifier;
+import ch.qos.cal10n.verifier.MessageKeyVerifier;
 
 public class MyColorVerificationTest {
 
   @Test
   public void en_UK() {
-    IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
-    List&lt;Cal10nError> errorList = mcv.verify(Locale.UK);
+    IMessageKeyVerifier mkv = new MessageKeyVerifier(Colors.class);
+    List&lt;Cal10nError> errorList = mkv.verify(Locale.UK);
     for(Cal10nError error: errorList) {
       System.out.println(error);
     }
@@ -187,8 +187,8 @@ public class MyColorVerificationTest {
 
   @Test
   public void fr() {
-    IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
-    List&lt;Cal10nError> errorList = mcv.verify(Locale.FRANCE);
+    IMessageKeyVerifier mkv = new MessageKeyVerifier(Colors.class);
+    List&lt;Cal10nError> errorList = mkv.verify(Locale.FRANCE);
     for(Cal10nError error: errorList) {
       System.out.println(error);
     }
@@ -197,11 +197,11 @@ public class MyColorVerificationTest {
 } </pre>
 
   <p>The above unit tests start by creating a
-  <code>MessageCodeVerifier</code> instance associated with an enum
+  <code>MessageKeyVerifier</code> instance associated with an enum
   type, <code>Colors</code> in this case. The test proceeds to invoke
   the <code>verify()</code> method passing a locale as an
   argument. The <code>verify()</code> method returns the list of
-  errors, that is the list of discrepancies between the codes listed
+  errors, that is the list of discrepancies between the keys listed
   in the enum type and the correspondign resource bundle. An empty
   list will be returned if there are no errors.
   </p>
@@ -209,15 +209,15 @@ public class MyColorVerificationTest {
   <p>The unit test verifies that no errors have occured by asserting
   that the size of the error list is zero.</p>
 
-  <p>Suppose the code "BLUE" was misspelled as "BLEU" in the
+  <p>Suppose the key "BLUE" was misspelled as "BLEU" in the
   <em>colors_fr.properties</em> resource bundle. The unit test would
   print the following list of errors and throw an
   <code>AssertionError</code>.
 
   </p>
-  <pre class="source">Code [BLUE] present in enum type [ch.qos.cal10n.sample.Colors] but absent in resource bundle \
+  <pre class="source">Key [BLUE] present in enum type [ch.qos.cal10n.sample.Colors] but absent in resource bundle \
    named [colors] for locale [fr_FR]
-Code [BLEU] present in resource bundle named [colors] for locale [fr_FR] but absent \ 
+Key [BLEU] present in resource bundle named [colors] for locale [fr_FR] but absent \ 
    in enum type [ch.qos.cal10n.sample.Colors]</pre>
 
   <h3>One test to rule them all</h3>
@@ -237,16 +237,16 @@ import java.util.Locale;
 import org.junit.Test;
 
 import ch.qos.cal10n.verifier.Cal10nError;
-import ch.qos.cal10n.verifier.IMessageCodeVerifier;
-import ch.qos.cal10n.verifier.MessageCodeVerifier;
+import ch.qos.cal10n.verifier.IMessageKeyVerifier;
+import ch.qos.cal10n.verifier.MessageKeyVerifier;
 
 public class MyAllInOneColorVerificationTest {
 
   // verify all locales in one step
   @Test
   public void all() {
-    IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
-    List&lt;Cal10nError> errorList = mcv.verifyAllLocales();
+    IMessageKeyVerifier mkv = new MessageKeyVerifier(Colors.class);
+    List&lt;Cal10nError> errorList = mkv.verifyAllLocales();
     for(Cal10nError error: errorList) {
       System.out.println(error);
     }
@@ -322,9 +322,8 @@ public class MyAllInOneColorVerificationTest {
 
   <ul>
     <li><b>mismatch highlighting</b> 
-    <p>While editing a property file,
-    highlight any keys, a.k.a. message codes, that do not match the
-    keys defined in the corresponding enum type.</p>
+    <p>While editing a property file, highlight any keys that do not
+    match any keys defined in the corresponding enum type.</p>
     </li>
 
     
diff --git a/cal10n-site/src/site/pages/news.html b/cal10n-site/src/site/pages/news.html
index 5f49c4a..dac2e1d 100644
--- a/cal10n-site/src/site/pages/news.html
+++ b/cal10n-site/src/site/pages/news.html
@@ -27,6 +27,16 @@
     href="http://www.qos.ch/mailman/listinfo/cal10n-announce">cal10n-announce</a>
     mailing list.</p>
 
+
+    <hr width="80%" align="center" />
+ 
+    <h3>1st of September 2009 - Release of CAL10N version 0.5.1</h3>
+
+    <p>Fixed a bug causing the <em>maven-cal10n-plugin</em> to fail on
+    Linux. The plug-in is not tested on both Windows and Linux.
+    </p>
+    
+
     <hr width="80%" align="center" />
 
     <h3>29th of August 2009 - Release of CAL10N version 0.5</h3>
diff --git a/maven-cal10n-plugin-smoke/pom.xml b/maven-cal10n-plugin-smoke/pom.xml
index ab0d015..b3f8061 100644
--- a/maven-cal10n-plugin-smoke/pom.xml
+++ b/maven-cal10n-plugin-smoke/pom.xml
@@ -4,7 +4,7 @@
 	<parent>
 		<groupId>ch.qos.cal10n</groupId>
 		<artifactId>cal10n-parent</artifactId>
-		<version>0.5</version>
+		<version>0.5.1</version>
 	</parent>
 
 	<modelVersion>4.0.0</modelVersion>
diff --git a/maven-cal10n-plugin/pom.xml b/maven-cal10n-plugin/pom.xml
index 322ad2d..d540cdc 100644
--- a/maven-cal10n-plugin/pom.xml
+++ b/maven-cal10n-plugin/pom.xml
@@ -8,7 +8,7 @@
   <parent>
     <artifactId>cal10n-parent</artifactId>
     <groupId>ch.qos.cal10n</groupId>
-    <version>0.5</version>
+    <version>0.5.1</version>
   </parent>
 
   <groupId>ch.qos.cal10n.plugins</groupId>
diff --git a/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/ThisFirstClassLoader.java b/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/ThisFirstClassLoader.java
index 85dfabc..0e03c2f 100644
--- a/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/ThisFirstClassLoader.java
+++ b/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/ThisFirstClassLoader.java
@@ -57,9 +57,9 @@ public class ThisFirstClassLoader extends URLClassLoader {
   protected Class<?> loadClass(String name, boolean resolve)
       throws ClassNotFoundException {
 
-    // Treating IMessageCodeVerifier as a special case is the whole point of the
+    // Treating IMessageKeyVerifier as a special case is the whole point of the
     // exercise.
-    if (name.equals("ch.qos.cal10n.verifier.IMessageCodeVerifier")) {
+    if (name.equals("ch.qos.cal10n.verifier.IMessageKeyVerifier")) {
       return super.loadClass(name, resolve);
     }
 
diff --git a/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/VerifyMojo.java b/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/VerifyMojo.java
index 7b6760a..d5d804b 100644
--- a/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/VerifyMojo.java
+++ b/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/VerifyMojo.java
@@ -37,7 +37,7 @@ import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 
 import ch.qos.cal10n.Cal10nConstants;
-import ch.qos.cal10n.verifier.IMessageCodeVerifier;
+import ch.qos.cal10n.verifier.IMessageKeyVerifier;
 
 /**
  * Verifies resources bundles in various locales against an enumType
@@ -92,7 +92,7 @@ public class VerifyMojo extends AbstractMojo {
           + MISSING_ENUM_TYPES);
     }
     for (String enumTypeAsStr : enumTypes) {
-      IMessageCodeVerifier imcv = getMessageCodeVerifierInstance(enumTypeAsStr);
+      IMessageKeyVerifier imcv = getMessageCodeVerifierInstance(enumTypeAsStr);
       getLog()
           .info(
               "Checking all resource bundles for enum type [" + enumTypeAsStr
@@ -101,7 +101,7 @@ public class VerifyMojo extends AbstractMojo {
     }
   }
 
-  public void checkAllLocales(IMessageCodeVerifier mcv)
+  public void checkAllLocales(IMessageKeyVerifier mcv)
       throws MojoFailureException, MojoExecutionException {
 
     String enumClassAsStr = mcv.getEnumTypeAsStr();
@@ -140,15 +140,15 @@ public class VerifyMojo extends AbstractMojo {
     }
   }
 
-  IMessageCodeVerifier getMessageCodeVerifierInstance(String enumClassAsStr)
+  IMessageKeyVerifier getMessageCodeVerifierInstance(String enumClassAsStr)
       throws MojoExecutionException {
     String errMsg = "Failed to instantiate MessageCodeVerifier class";
     try {
       ThisFirstClassLoader thisFirstClassLoader = (ThisFirstClassLoader) buildClassLoader();
-      Class<?> cla = Class.forName(Cal10nConstants.MessageCodeVerifier_FQCN,
+      Class<?> mkvClass = Class.forName(Cal10nConstants.MessageKeyVerifier_FQCN,
           true, thisFirstClassLoader);
-      Constructor<?> cons = cla.getConstructor(String.class);
-      IMessageCodeVerifier imcv = (IMessageCodeVerifier) cons
+      Constructor<?> mkvCons = mkvClass.getConstructor(String.class);
+      IMessageKeyVerifier imcv = (IMessageKeyVerifier) mkvCons
           .newInstance(enumClassAsStr);
       return imcv;
     } catch (ClassNotFoundException e) {
diff --git a/pom.xml b/pom.xml
index 4a64b7c..c26d7ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
   <groupId>ch.qos.cal10n</groupId>
   <artifactId>cal10n-parent</artifactId>
 	<packaging>pom</packaging>
-  <version>0.5</version>
+  <version>0.5.1</version>
   <name>Compiler assisted localization library (CAL10N) - Parent</name>
 
   <url>http://cal10n.qos.ch</url>

-----------------------------------------------------------------------

Summary of changes:
 cal10n-api/pom.xml                                 |    2 +-
 .../main/java/ch/qos/cal10n/Cal10nConstants.java   |    2 +-
 .../main/java/ch/qos/cal10n/IMessageConveyor.java  |   23 +++--
 .../src/main/java/ch/qos/cal10n/LocaleNames.java   |    4 +-
 .../main/java/ch/qos/cal10n/MessageConveyor.java   |   29 ++++--
 .../java/ch/qos/cal10n/MessageParameterObj.java    |  104 ++++++++++++++++++++
 .../java/ch/qos/cal10n/ResourceBundleName.java     |    4 +-
 .../java/ch/qos/cal10n/verifier/Cal10nError.java   |   12 +-
 ...eCodeVerifier.java => IMessageKeyVerifier.java} |    4 +-
 ...geCodeVerifier.java => MessageKeyVerifier.java} |   23 +----
 .../qos/cal10n/sample/MessageCodeVerifierTest.java |   10 +-
 .../ch/qos/cal10n/sample/MessageConveyorTest.java  |   26 ++++--
 .../sample/MyAllInOneColorVerificationTest.java    |    6 +-
 .../qos/cal10n/sample/MyColorVerificationTest.java |    8 +-
 cal10n-site/pom.xml                                |    2 +-
 cal10n-site/src/site/pages/manual.html             |   41 ++++----
 cal10n-site/src/site/pages/news.html               |   10 ++
 maven-cal10n-plugin-smoke/pom.xml                  |    2 +-
 maven-cal10n-plugin/pom.xml                        |    2 +-
 .../qos/cal10n/plugins/ThisFirstClassLoader.java   |    4 +-
 .../java/ch/qos/cal10n/plugins/VerifyMojo.java     |   14 ++--
 pom.xml                                            |    2 +-
 22 files changed, 231 insertions(+), 103 deletions(-)
 create mode 100644 cal10n-api/src/main/java/ch/qos/cal10n/MessageParameterObj.java
 rename cal10n-api/src/main/java/ch/qos/cal10n/verifier/{IMessageCodeVerifier.java => IMessageKeyVerifier.java} (90%)
 rename cal10n-api/src/main/java/ch/qos/cal10n/verifier/{MessageCodeVerifier.java => MessageKeyVerifier.java} (87%)


hooks/post-receive
-- 
Compiler assisted localization library


More information about the cal10n-dev mailing list