abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r607806 - in /incubator/abdera/java/trunk: client/src/main/java/org/apache/abdera/protocol/client/ client/src/main/java/org/apache/abdera/protocol/client/util/ core/src/main/java/org/apache/abdera/util/ core/src/main/resources/ dependencies...
Date Tue, 01 Jan 2008 05:42:00 GMT
Author: jmsnell
Date: Mon Dec 31 21:41:59 2007
New Revision: 607806

URL: http://svn.apache.org/viewvc?rev=607806&view=rev
Log:
Minor refactoring of the l10n Messages class to make it generally reusable.  Also, provide a 
sprintf style option for formatting messages rather than the pre-jdk 1.5 MessageFormat. 

Rename the Messages class to Localizer and move it into the i18n module

Added:
    incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Localizer.java
Removed:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Messages.java
Modified:
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
    incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaConfiguration.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java
    incubator/abdera/java/trunk/core/src/main/resources/abderamessages.properties
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedContentTypeException.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedTextTypeException.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java
    incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/SignedRequestFilter.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/ServiceManager.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractRequestContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/ProviderSupport.java

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/RequestOptions.java Mon Dec 31 21:41:59 2007
@@ -26,6 +26,7 @@
 
 import javax.activation.MimeType;
 
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.i18n.text.UrlEncoding;
 import org.apache.abdera.i18n.text.CharUtils.Profile;
 import org.apache.abdera.protocol.Request;
@@ -33,7 +34,6 @@
 import org.apache.abdera.protocol.util.CacheControlUtil;
 import org.apache.abdera.protocol.util.EncodingUtil;
 import org.apache.abdera.util.EntityTag;
-import org.apache.abdera.util.Messages;
 import org.apache.commons.httpclient.util.DateParseException;
 import org.apache.commons.httpclient.util.DateUtil;
 
@@ -424,7 +424,7 @@
     if (slug.indexOf((char)10) > -1 ||
         slug.indexOf((char)13) > -1)
       throw new IllegalArgumentException(
-        Messages.get("SLUG.BAD.CHARACTERS"));
+        Localizer.get("SLUG.BAD.CHARACTERS"));
     return setHeader("Slug", UrlEncoding.encode(slug,Profile.ASCIISANSCRLF.filter()));
   }
   

Modified: incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java (original)
+++ incubator/abdera/java/trunk/client/src/main/java/org/apache/abdera/protocol/client/util/ClientAuthSSLProtocolSocketFactory.java Mon Dec 31 21:41:59 2007
@@ -30,7 +30,7 @@
 import javax.net.ssl.SSLSocketFactory;
 import javax.net.ssl.TrustManager;
 
-import org.apache.abdera.util.Messages;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.commons.httpclient.ConnectTimeoutException;
 import org.apache.commons.httpclient.params.HttpConnectionParams;
 import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
@@ -59,7 +59,7 @@
     String protocol, 
     String kmfFactory,
     TrustManager tm) {
-      if (ks == null) throw new IllegalArgumentException(Messages.get("INVALID.KEYSTORE"));
+      if (ks == null) throw new IllegalArgumentException(Localizer.get("INVALID.KEYSTORE"));
       this.ks = ks;
       this.keyStorePass = keyStorePass;
       this.protocol = protocol != null ? protocol : DEFAULT_PROTOCOL;

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaConfiguration.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaConfiguration.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbderaConfiguration.java Mon Dec 31 21:41:59 2007
@@ -31,6 +31,7 @@
 import org.apache.abdera.factory.ExtensionFactory;
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.factory.StreamBuilder;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.parser.NamedParser;
 import org.apache.abdera.parser.Parser;
 import org.apache.abdera.parser.ParserFactory;
@@ -304,7 +305,7 @@
     try {
       return ServiceUtil.newXPathInstance(abdera);
     } catch (NoClassDefFoundError n) {
-      throw new RuntimeException(Messages.format("IMPLEMENTATION.NOT.AVAILABLE","XPath"),n);
+      throw new RuntimeException(Localizer.sprintf("IMPLEMENTATION.NOT.AVAILABLE","XPath"),n);
     }
   }
     
@@ -317,7 +318,7 @@
     try {
       return ServiceUtil.newParserFactoryInstance(abdera);
     } catch (NoClassDefFoundError n) {
-      throw new RuntimeException(Messages.format("IMPLEMENTATION.NOT.AVAILABLE","Parser"),n);
+      throw new RuntimeException(Localizer.sprintf("IMPLEMENTATION.NOT.AVAILABLE","Parser"),n);
     }
   }
     
@@ -330,7 +331,7 @@
     try {
       return ServiceUtil.newWriterFactoryInstance(abdera);
     } catch (NoClassDefFoundError n) {
-      throw new RuntimeException(Messages.format("IMPLEMENTATION.NOT.AVAILABLE","WriterFactory"),n);
+      throw new RuntimeException(Localizer.sprintf("IMPLEMENTATION.NOT.AVAILABLE","WriterFactory"),n);
     }
   }
     
@@ -343,7 +344,7 @@
     try {
       return ServiceUtil.newWriterInstance(abdera);
     } catch (NoClassDefFoundError n) {
-      throw new RuntimeException(Messages.format("IMPLEMENTATION.NOT.AVAILABLE","Writer"),n);
+      throw new RuntimeException(Localizer.sprintf("IMPLEMENTATION.NOT.AVAILABLE","Writer"),n);
     }
   }
   
@@ -356,7 +357,7 @@
     try {
       return ServiceUtil.newStreamWriterInstance(abdera);
     } catch (NoClassDefFoundError n) {
-      throw new RuntimeException(Messages.format("IMPLEMENTATION.NOT.AVAILABLE","StreamWriter"),n);
+      throw new RuntimeException(Localizer.sprintf("IMPLEMENTATION.NOT.AVAILABLE","StreamWriter"),n);
     }
   }  
 

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/EntityTag.java Mon Dec 31 21:41:59 2007
@@ -20,6 +20,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.commons.codec.binary.Hex;
 
 /**
@@ -29,7 +30,7 @@
 
   private static final long serialVersionUID = 1559972888659121461L;
   
-  private static final String INVALID_ENTITY_TAG = Messages
+  private static final String INVALID_ENTITY_TAG = Localizer
       .get("INVALID.ENTITY.TAG");
 
   public static final EntityTag WILD = new EntityTag("*");
@@ -193,11 +194,11 @@
       byte[] digest = md.digest();
       etag = new String(Hex.encodeHex(digest));
     } catch (NoSuchAlgorithmException e) {
-      throw new UnsupportedOperationException(Messages
+      throw new UnsupportedOperationException(Localizer
           .get("HASHING.NOT.AVAILABLE"));
     } catch (UnsupportedEncodingException e) {
       // should not happen
-      throw new RuntimeException(Messages.get("UTF8.NOT.SUPPORTED"), e);
+      throw new RuntimeException(Localizer.get("UTF8.NOT.SUPPORTED"), e);
     }
     return new EntityTag(etag);
   }

Modified: incubator/abdera/java/trunk/core/src/main/resources/abderamessages.properties
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/resources/abderamessages.properties?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/resources/abderamessages.properties (original)
+++ incubator/abdera/java/trunk/core/src/main/resources/abderamessages.properties Mon Dec 31 21:41:59 2007
@@ -1,4 +1,4 @@
-IMPLEMENTATION.NOT.AVAILABLE=An Abdera {0} implementation is not available
+IMPLEMENTATION.NOT.AVAILABLE=An Abdera %s implementation is not available
 INVALID.ENTITY.TAG=Invalid Entity Tag
 UTF8.NOT.SUPPORTED=UTF-8 not supported?
 HASHING.NOT.AVAILABLE=The hashing function is not available
@@ -6,17 +6,17 @@
 INPUTSTREAM.NOT.NULL=InputStream must not be null
 READER.NOT.NULL=Reader must not be null
 
-WRONG.PARSER.INSTANCE=Only instances or subclasses of {0} may be used with this parser implementation
-UNSUPPORTED.CONTENT.TYPE=Unsupported Content Type: {0}
-UNSUPPORTED.TEXT.TYPE=Unsupported Text Type: {0}
+WRONG.PARSER.INSTANCE=Only instances or subclasses of %s may be used with this parser implementation
+UNSUPPORTED.CONTENT.TYPE=Unsupported Content Type: %s
+UNSUPPORTED.TEXT.TYPE=Unsupported Text Type: %s
 SLUG.NOT.NULL=Slug cannot be null
 SLUG.BAD.CHARACTERS=The slug must not contain ASCII carriage return or linefeed characters
 PROPERTY.NOT.SUPPORTED=Property not supported
 
-RETURNING.INSTANCE=Returning {0} as instance of '{1}'.
-CREATING.NEW.INSTANCE=Creating new {0} instance
-INITIALIZING.INSTANCE=Initializing {0} instance
-CREATING.ERROR.DOC=Creating error document - {0}, {1}
+RETURNING.INSTANCE=Returning %s as instance of '%s'.
+CREATING.NEW.INSTANCE=Creating new %s instance
+INITIALIZING.INSTANCE=Initializing %s instance
+CREATING.ERROR.DOC=Creating error document - %s, %s
 SERVER_ERROR=Server error
 UNAUTHORIZED=Unauthorized
 FORBIDDEN=Forbidden
@@ -31,22 +31,22 @@
 NOT.SUPPORTED=Not supported
 LOCKED=Locked
 RETURNING.DOCUMENT=Returning document
-SLUG.SANITIZED=Sanitized slug '{0}' to '{1}'
-DEFAULT.PAGE.SIZE=Getting default page size: {0}
-PAGE.SIZE=Getting page size: {0}
-OFFSET=Getting offset: {0}
-CHECKING.VALID.ENTRY=Checking valid entry: {0}
-CHECKING.ENTRY.NAMESPACES=Checking entry namespaces: {0}
-TARGET.TYPE=Target type: {0}
-TARGET.ID=Target id: {0}
-METHOD=Method: {0}
+SLUG.SANITIZED=Sanitized slug '%s' to '%s'
+DEFAULT.PAGE.SIZE=Getting default page size: %s
+PAGE.SIZE=Getting page size: %s
+OFFSET=Getting offset: %s
+CHECKING.VALID.ENTRY=Checking valid entry: %s
+CHECKING.ENTRY.NAMESPACES=Checking entry namespaces: %s
+TARGET.TYPE=Target type: %s
+TARGET.ID=Target id: %s
+METHOD=Method: %s
 PARSING.REQUEST.DOCUMENT=Parsing request document
 PROCESSING.REQUEST=Processing the request
-USING.PROVIDER=Using provider: {0}
+USING.PROVIDER=Using provider: %s
 OUTPUT.ERROR=Error producing output
-RELEASING.PROVIDER=Releasing provider: {0}
+RELEASING.PROVIDER=Releasing provider: %s
 NO.PROVIDER=No Provider
-METHOD.NOT.ALLOWED=Method '{0}' Not Allowed
+METHOD.NOT.ALLOWED=Method '%s' Not Allowed
 
 VALID.SIGNATURE.REQUIRED=A Valid Signature is required
 INVALID.KEYSTORE=Invalid Keystore

Added: incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Localizer.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Localizer.java?rev=607806&view=auto
==============================================================================
--- incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Localizer.java (added)
+++ incubator/abdera/java/trunk/dependencies/i18n/src/main/java/org/apache/abdera/i18n/text/Localizer.java Mon Dec 31 21:41:59 2007
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera.i18n.text;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Wraps ResourceBundle with a couple of additional, useful methods. Used for l10n 
+ */
+public final class Localizer {
+
+  private static Localizer instance = null;
+  
+  public static synchronized Localizer getInstance() {
+    if (instance == null) instance = new Localizer();
+    return instance;
+  }
+  
+  public static synchronized void setInstance(Localizer localizer) {
+    Localizer.instance = localizer;
+  }
+  
+  public static String get(String key) {
+    return getInstance().getValue(key);
+  }
+  
+  public static String get(String key, String defaultValue) {
+    return getInstance().getValue(key,defaultValue);
+  }
+  
+  /**
+   * @deprecated
+   */
+  public static String format(String key, Object... args) {
+    return getInstance().formatValue(key,args);
+  }
+  
+  public static String sprintf(String key, Object... args) {
+    return getInstance().sprintfValue(key, args);
+  }
+  
+  private static final String DEFAULT_BUNDLE = "abderamessages";
+  
+  private final Locale locale;
+  private final ResourceBundle bundle;
+  
+  public Localizer() {
+    this(
+      Locale.getDefault(), 
+      Thread.currentThread().getContextClassLoader());
+  }
+  
+  public Localizer(
+    Locale locale, 
+    ClassLoader loader) {
+      this(
+        initResourceBundle(
+          DEFAULT_BUNDLE, 
+          locale, 
+          loader), 
+        locale);
+  }
+  
+  public Localizer(String bundle) {
+    this(initResourceBundle(
+      bundle, 
+      Locale.getDefault(), 
+      Thread.currentThread().getContextClassLoader()));
+  }
+  
+  public Localizer(
+    String bundle, 
+    Locale locale) {
+      this(
+        initResourceBundle(
+          bundle, 
+          locale, 
+          Thread.currentThread().getContextClassLoader()));
+  }
+  
+  public Localizer(
+    ResourceBundle bundle) {
+      this(bundle, bundle.getLocale());
+  }
+  
+  public Localizer(
+    ResourceBundle bundle, 
+    Locale locale) {
+      this.bundle = bundle;
+      this.locale = locale;
+  }
+  
+  private static ResourceBundle initResourceBundle(
+    String bundle, 
+    Locale locale, 
+    ClassLoader loader) {
+    try {
+      return ResourceBundle.getBundle(
+        bundle, locale, loader);
+    } catch (Exception e) {
+      return null;
+    }
+  }
+  
+  public Locale getLocale() {
+    return locale;
+  }
+  
+  public String getValue(String key) {
+    try {
+      return bundle.getString(key);
+    } catch (Exception e) {
+      return null;
+    }
+  }
+  
+  public String getValue(
+    String key, 
+    String defaultValue) {
+      String value = getValue(key);
+      return value != null ? value : defaultValue;
+  }
+  
+  /**
+   * Use the pre-JDK 1.5 MessageFormat.  This should be avoided.
+   * Applications should use the sprintfValue method instead
+   * @deprecated
+   * @see springfValue
+   */
+  public String formatValue(
+    String key, 
+    Object... args) {
+      String value = getValue(key);
+      return value != null ? 
+        MessageFormat.format(value, args) : 
+        null;
+  }
+  
+  /**
+   * Use the JDK 1.5 sprintf style Formatter 
+   */
+  public String sprintfValue(
+    String key, 
+    Object... args) {
+      String value = getValue(key);
+      return value != null ?
+        String.format(locale, value, args) : 
+        null;
+  }
+}

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMContent.java Mon Dec 31 21:41:59 2007
@@ -23,12 +23,12 @@
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.model.Content;
 import org.apache.abdera.model.Div;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.ElementWrapper;
 import org.apache.abdera.util.Constants;
-import org.apache.abdera.util.Messages;
 import org.apache.axiom.attachments.utils.DataHandlerUtils;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
@@ -203,7 +203,7 @@
   public DataHandler getDataHandler() {
     if (!Type.MEDIA.equals(type)) 
       throw new UnsupportedOperationException(
-        Messages.get("DATA.HANDLER.NOT.SUPPORTED"));
+        Localizer.get("DATA.HANDLER.NOT.SUPPORTED"));
     MimeType type = getMimeType();
     java.net.URL src = null;
     try {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParser.java Mon Dec 31 21:41:59 2007
@@ -27,6 +27,7 @@
 import org.apache.abdera.Abdera;
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.parser.ParseException;
@@ -36,7 +37,6 @@
 import org.apache.abdera.parser.stax.util.FOMXmlRestrictedCharReader;
 import org.apache.abdera.util.AbstractParser;
 import org.apache.abdera.util.CompressionUtil;
-import org.apache.abdera.util.Messages;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.util.StAXUtils;
 
@@ -90,7 +90,7 @@
     ParserOptions options)
       throws ParseException {
     if (in == null)
-      throw new IllegalArgumentException(Messages.get("INPUTSTREAM.NOT.NULL"));
+      throw new IllegalArgumentException(Localizer.get("INPUTSTREAM.NOT.NULL"));
     try {
       if (options == null) options = getDefaultParserOptions();
       if (options.getCompressionCodecs() != null) {
@@ -133,7 +133,7 @@
     ParserOptions options) 
       throws ParseException {
     if (in == null)
-      throw new IllegalArgumentException(Messages.get("READER.NOT.NULL"));
+      throw new IllegalArgumentException(Localizer.get("READER.NOT.NULL"));
     try {
       if (options == null) options = getDefaultParserOptions();
       if (options.getFilterRestrictedCharacters() && 

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMParserOptions.java Mon Dec 31 21:41:59 2007
@@ -18,8 +18,8 @@
 package org.apache.abdera.parser.stax;
 
 import org.apache.abdera.factory.Factory;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.util.AbstractParserOptions;
-import org.apache.abdera.util.Messages;
 
 
 public class FOMParserOptions
@@ -37,7 +37,7 @@
   protected void checkFactory(Factory factory) {
     if (!(factory instanceof FOMFactory))
       throw new FOMException(
-        Messages.format("WRONG.PARSER.INSTANCE",FOMFactory.class.getName()));
+        Localizer.sprintf("WRONG.PARSER.INSTANCE",FOMFactory.class.getName()));
   }
 
 

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedContentTypeException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedContentTypeException.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedContentTypeException.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedContentTypeException.java Mon Dec 31 21:41:59 2007
@@ -17,7 +17,7 @@
 */
 package org.apache.abdera.parser.stax;
 
-import org.apache.abdera.util.Messages;
+import org.apache.abdera.i18n.text.Localizer;
 
 public class FOMUnsupportedContentTypeException 
   extends FOMException {
@@ -25,7 +25,7 @@
   private static final long serialVersionUID = 4156893310308105899L;
 
   public FOMUnsupportedContentTypeException(String message) {
-    super(Messages.format("UNSUPPORTED.CONTENT.TYPE",message));
+    super(Localizer.sprintf("UNSUPPORTED.CONTENT.TYPE",message));
   }
 
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedTextTypeException.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedTextTypeException.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedTextTypeException.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMUnsupportedTextTypeException.java Mon Dec 31 21:41:59 2007
@@ -17,7 +17,7 @@
 */
 package org.apache.abdera.parser.stax;
 
-import org.apache.abdera.util.Messages;
+import org.apache.abdera.i18n.text.Localizer;
 
 public class FOMUnsupportedTextTypeException 
   extends FOMException {
@@ -25,7 +25,7 @@
   private static final long serialVersionUID = 4156893310308105899L;
 
   public FOMUnsupportedTextTypeException(String message) {
-    super(Messages.format("UNSUPPORTED.TEXT.TYPE",message));
+    super(Localizer.sprintf("UNSUPPORTED.TEXT.TYPE",message));
   }
 
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWriterFactory.java Mon Dec 31 21:41:59 2007
@@ -21,7 +21,7 @@
 import java.util.Map;
 
 import org.apache.abdera.Abdera;
-import org.apache.abdera.util.Messages;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.writer.NamedWriter;
 import org.apache.abdera.writer.StreamWriter;
 import org.apache.abdera.writer.Writer;
@@ -89,7 +89,7 @@
         sw = _class.newInstance();
       } catch (Exception e) {
         throw new RuntimeException(
-          Messages.format(
+          Localizer.sprintf(
             "IMPLEMENTATION.NOT.AVAILABLE",
             "StreamWriter"),e);
       }

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/SignedRequestFilter.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/SignedRequestFilter.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/SignedRequestFilter.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/servlet/SignedRequestFilter.java Mon Dec 31 21:41:59 2007
@@ -27,11 +27,11 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.abdera.Abdera;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.security.AbderaSecurity;
 import org.apache.abdera.security.Signature;
-import org.apache.abdera.util.Messages;
 
 /**
  * Servlet Filter that verifies that an Atom document received by the server
@@ -62,7 +62,7 @@
         boolean valid = sig.verify(doc.getRoot(), null);
         if (!valid) {
           ((HttpServletResponse)response).sendError(
-            400, Messages.get("VALID.SIGNATURE.REQUIRED"));
+            400, Localizer.get("VALID.SIGNATURE.REQUIRED"));
           return;
         }
         wrapper.setAttribute(VALID, Boolean.valueOf(valid));

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/ServiceManager.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/ServiceManager.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/ServiceManager.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/ServiceManager.java Mon Dec 31 21:41:59 2007
@@ -20,9 +20,9 @@
 import java.util.Map;
 
 import org.apache.abdera.Abdera;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.protocol.server.impl.DefaultServiceContext;
 import org.apache.abdera.protocol.server.util.ServerConstants;
-import org.apache.abdera.util.Messages;
 import org.apache.abdera.util.ServiceUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -39,7 +39,7 @@
   
   public static synchronized ServiceManager getInstance() {
     if (INSTANCE == null) {
-      log.debug(Messages.format("CREATING.NEW.INSTANCE","ServiceManager"));
+      log.debug(Localizer.sprintf("CREATING.NEW.INSTANCE","ServiceManager"));
       INSTANCE = new ServiceManager();
     }
     return INSTANCE;
@@ -47,7 +47,7 @@
   
   public static synchronized Abdera getAbdera() {
     if (abdera == null) {
-      log.debug(Messages.format("CREATING.NEW.INSTANCE","Abdera"));
+      log.debug(Localizer.sprintf("CREATING.NEW.INSTANCE","Abdera"));
       abdera = new Abdera();
     }
     return abdera;
@@ -57,7 +57,7 @@
     Map<String,String> properties) {
     Abdera abdera = getAbdera();
     String instance = properties.get(SERVICE_CONTEXT);
-    log.debug(Messages.format("CREATING.NEW.INSTANCE","ServiceContext"));
+    log.debug(Localizer.sprintf("CREATING.NEW.INSTANCE","ServiceContext"));
     ServiceContext context = 
       (ServiceContext) ServiceUtil.newInstance(
         SERVICE_CONTEXT, 
@@ -65,7 +65,7 @@
           instance : 
           DefaultServiceContext.class.getName(),
         abdera);
-    log.debug(Messages.format("INITIALIZING.INSTANCE", "ServiceContext"));
+    log.debug(Localizer.sprintf("INITIALIZING.INSTANCE", "ServiceContext"));
     context.init(abdera, properties);
     return context;
   }

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractProvider.java Mon Dec 31 21:41:59 2007
@@ -20,11 +20,11 @@
 import java.io.IOException;
 import java.util.Date;
 
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.protocol.server.Provider;
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ResponseContext;
 import org.apache.abdera.protocol.server.TargetType;
-import org.apache.abdera.util.Messages;
 import org.apache.abdera.writer.StreamWriter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -46,9 +46,9 @@
   public ResponseContext request(RequestContext request) {
     TargetType type = request.getTarget().getType();
     String method = request.getMethod();
-    log.debug(Messages.format("TARGET.TYPE",type));
-    log.debug(Messages.format("TARGET.ID",request.getTarget().getIdentity()));
-    log.debug(Messages.format("METHOD",method));
+    log.debug(Localizer.sprintf("TARGET.TYPE",type));
+    log.debug(Localizer.sprintf("TARGET.ID",request.getTarget().getIdentity()));
+    log.debug(Localizer.sprintf("METHOD",method));
     if (method.equals("GET")) {
       if (type == TargetType.TYPE_SERVICE) {
         return getService(request);
@@ -118,7 +118,7 @@
     return notallowed(
       request.getAbdera(), 
       request, 
-      Messages.get("NOT.ALLOWED"), 
+      Localizer.get("NOT.ALLOWED"), 
       getAllowedMethods(
         request.getTarget().getType()));
   }
@@ -147,7 +147,7 @@
       return notallowed(
         request.getAbdera(), 
         request, 
-        Messages.get("NOT.ALLOWED"), 
+        Localizer.get("NOT.ALLOWED"), 
         getAllowedMethods(
           request.getTarget().getType()));
   }
@@ -157,7 +157,7 @@
       return notallowed(
         request.getAbdera(), 
         request, 
-        Messages.get("NOT.ALLOWED"), 
+        Localizer.get("NOT.ALLOWED"), 
         getAllowedMethods(
           request.getTarget().getType()));
   } 

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractRequestContext.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractRequestContext.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractRequestContext.java Mon Dec 31 21:41:59 2007
@@ -32,8 +32,8 @@
 import org.apache.abdera.protocol.server.ServiceContext;
 import org.apache.abdera.protocol.server.Target;
 import org.apache.abdera.protocol.util.AbstractRequest;
-import org.apache.abdera.util.Messages;
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -71,7 +71,7 @@
   public synchronized <T extends Element>Document<T> getDocument()
     throws ParseException, 
            IOException {
-    log.debug(Messages.get("PARSING.REQUEST.DOCUMENT"));
+    log.debug(Localizer.get("PARSING.REQUEST.DOCUMENT"));
     if (document == null) {
       Abdera abdera = context.getAbdera();
       Parser parser = abdera.getParser();
@@ -85,7 +85,7 @@
     Parser parser)
       throws ParseException, 
              IOException {
-    log.debug(Messages.get("PARSING.REQUEST.DOCUMENT"));
+    log.debug(Localizer.get("PARSING.REQUEST.DOCUMENT"));
     if (document == null) {
       ParserOptions options = parser.getDefaultParserOptions();
       document = getDocument(parser, options);
@@ -98,7 +98,7 @@
     ParserOptions options)
      throws ParseException, 
             IOException  {
-    log.debug(Messages.get("PARSING.REQUEST.DOCUMENT"));
+    log.debug(Localizer.get("PARSING.REQUEST.DOCUMENT"));
     if (document == null) {
       Abdera abdera = context.getAbdera();
       Parser parser = abdera.getParser();
@@ -113,7 +113,7 @@
     ParserOptions options) 
       throws ParseException, 
              IOException {
-    log.debug(Messages.get("PARSING.REQUEST.DOCUMENT"));
+    log.debug(Localizer.get("PARSING.REQUEST.DOCUMENT"));
     if (document == null) {
       return parser.parse(
         getInputStream(), 

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/AbstractResponseContext.java Mon Dec 31 21:41:59 2007
@@ -26,13 +26,13 @@
 
 import javax.activation.MimeType;
 
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.i18n.text.UrlEncoding;
 import org.apache.abdera.i18n.text.CharUtils.Profile;
 import org.apache.abdera.protocol.server.ResponseContext;
 import org.apache.abdera.protocol.util.AbstractResponse;
 import org.apache.abdera.protocol.util.EncodingUtil;
 import org.apache.abdera.util.EntityTag;
-import org.apache.abdera.util.Messages;
 import org.apache.abdera.writer.Writer;
 
 public abstract class AbstractResponseContext
@@ -213,7 +213,7 @@
     if (slug.indexOf((char)10) > -1 ||
         slug.indexOf((char)13) > -1)
       throw new IllegalArgumentException(
-        Messages.get("SLUG.BAD.CHARACTERS"));
+        Localizer.get("SLUG.BAD.CHARACTERS"));
     return setEscapedHeader("Slug", Profile.ASCIISANSCRLF, slug);
   }
   

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultRequestHandler.java Mon Dec 31 21:41:59 2007
@@ -27,6 +27,7 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.abdera.Abdera;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.protocol.ItemManager;
 import org.apache.abdera.protocol.error.Error;
 import org.apache.abdera.protocol.server.HttpResponse;
@@ -36,7 +37,6 @@
 import org.apache.abdera.protocol.server.ResponseContext;
 import org.apache.abdera.protocol.server.ServiceContext;
 import org.apache.abdera.protocol.server.Target;
-import org.apache.abdera.util.Messages;
 import org.apache.abdera.writer.StreamWriter;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -52,24 +52,24 @@
     HttpResponse response) 
       throws IOException {
     
-    log.debug(Messages.get("PROCESSING.REQUEST"));
+    log.debug(Localizer.get("PROCESSING.REQUEST"));
     ItemManager<Provider> manager = context.getProviderManager();
     Provider provider = manager.get(request);
-    log.debug(Messages.format("USING.PROVIDER",provider));
+    log.debug(Localizer.sprintf("USING.PROVIDER",provider));
     try {
       if (preconditions(provider, request, response)) {
         response(request, response,provider.request(request));
       }
     } catch (Throwable e) {
-      log.error(Messages.get("OUTPUT.ERROR"), e);
+      log.error(Localizer.get("OUTPUT.ERROR"), e);
       try {
         response(request,response,new EmptyResponseContext(500));
       } catch (Exception ex) {
-        log.error(Messages.get("OUTPUT.ERROR"), ex);
+        log.error(Localizer.get("OUTPUT.ERROR"), ex);
         internalServerError(request, response);
       }
     } finally {
-      log.debug(Messages.format("RELEASING.PROVIDER", provider));
+      log.debug(Localizer.sprintf("RELEASING.PROVIDER", provider));
       if (provider != null) manager.release(provider);
     }
   }
@@ -174,12 +174,12 @@
   }
     
   protected void noprovider(RequestContext request, HttpResponse response) throws IOException {
-    sendError(request, response, 500, Messages.get("NO.PROVIDER"));
+    sendError(request, response, 500, Localizer.get("NO.PROVIDER"));
   }
   
   protected void notfound(RequestContext request, HttpResponse response) throws IOException {
     sendError(request, response, 404,
-              Messages.get("NOT.FOUND"));
+              Localizer.get("NOT.FOUND"));
   }
   
   protected void notallowed(
@@ -188,7 +188,7 @@
     String method, 
     String[] methods) 
       throws IOException {
-    sendError(request, response, 405, Messages.format("METHOD.NOT.ALLOWED", method));
+    sendError(request, response, 405, Localizer.sprintf("METHOD.NOT.ALLOWED", method));
     response.setHeader("Allow", combine(methods));;
   }
   

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/DefaultServiceContext.java Mon Dec 31 21:41:59 2007
@@ -19,13 +19,13 @@
 
 import javax.security.auth.Subject;
 
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.protocol.ItemManager;
 import org.apache.abdera.protocol.Resolver;
 import org.apache.abdera.protocol.server.Provider;
 import org.apache.abdera.protocol.server.RequestHandler;
 import org.apache.abdera.protocol.server.Target;
 import org.apache.abdera.protocol.server.util.ServerConstants;
-import org.apache.abdera.util.Messages;
 import org.apache.abdera.util.ServiceUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -46,7 +46,7 @@
   private Object instance(String id, String _default) {
     String instance = getProperty(id);
     Object obj =  ServiceUtil.newInstance( id, (instance!=null)?instance:_default, abdera);
-    logger.debug(Messages.format("RETURNING.INSTANCE", obj, id));
+    logger.debug(Localizer.sprintf("RETURNING.INSTANCE", obj, id));
     return obj;
   }
   

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java Mon Dec 31 21:41:59 2007
@@ -30,11 +30,11 @@
 
 import org.apache.abdera.Abdera;
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.protocol.Resolver;
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ServiceContext;
 import org.apache.abdera.protocol.server.Target;
-import org.apache.abdera.util.Messages;
 
 public class HttpServletRequestContext 
   extends AbstractRequestContext
@@ -89,7 +89,7 @@
       case SERVERNAME:        return request.getServerName();
       case SERVERPORT:        return request.getServerPort();
       default:
-        throw new UnsupportedOperationException(Messages.get("PROPERTY.NOT.SUPPORTED")); 
+        throw new UnsupportedOperationException(Localizer.get("PROPERTY.NOT.SUPPORTED")); 
     }
   }
   

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/ProviderSupport.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/ProviderSupport.java?rev=607806&r1=607805&r2=607806&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/ProviderSupport.java (original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/ProviderSupport.java Mon Dec 31 21:41:59 2007
@@ -9,6 +9,7 @@
 
 import org.apache.abdera.Abdera;
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.i18n.text.Localizer;
 import org.apache.abdera.model.Base;
 import org.apache.abdera.model.Content;
 import org.apache.abdera.model.Document;
@@ -21,7 +22,6 @@
 import org.apache.abdera.protocol.server.RequestContext;
 import org.apache.abdera.protocol.server.ResponseContext;
 import org.apache.abdera.protocol.util.EncodingUtil;
-import org.apache.abdera.util.Messages;
 import org.apache.abdera.util.MimeTypeHelper;
 import org.apache.abdera.writer.StreamWriter;
 import org.apache.commons.logging.Log;
@@ -100,7 +100,7 @@
     RequestContext request,
     String reason,
     Throwable t) {
-      log.debug(Messages.get("SERVER_ERROR"));
+      log.debug(Localizer.get("SERVER_ERROR"));
       return createErrorResponse(abdera,500,reason,t);
   }
 
@@ -111,7 +111,7 @@
     Abdera abdera,
     RequestContext request,
     String reason) {
-      log.debug(Messages.get("UNAUTHORIZED"));
+      log.debug(Localizer.get("UNAUTHORIZED"));
       return createErrorResponse(abdera,401,reason);
   }
 
@@ -122,7 +122,7 @@
     Abdera abdera,
     RequestContext request,
     String reason) {
-      log.debug(Messages.get("FORBIDDEN"));
+      log.debug(Localizer.get("FORBIDDEN"));
       return createErrorResponse(abdera,403,reason);
   }
 
@@ -133,7 +133,7 @@
     Abdera abdera,
     RequestContext request,
     String reason) {
-    log.debug(Messages.get("UNKNOWN"));
+    log.debug(Localizer.get("UNKNOWN"));
     return createErrorResponse(abdera,404,reason);
   }
 
@@ -145,7 +145,7 @@
     RequestContext request,
     String reason,
     String... methods) {
-      log.debug(Messages.get("NOT.ALLOWED")); 
+      log.debug(Localizer.get("NOT.ALLOWED")); 
       AbstractResponseContext resp = 
         createErrorResponse(abdera,405,reason);
       resp.setAllow(methods);
@@ -159,7 +159,7 @@
     Abdera abdera,
     RequestContext request,
     String reason) {
-      log.debug(Messages.get("BAD.REQUEST"));
+      log.debug(Localizer.get("BAD.REQUEST"));
       return createErrorResponse(abdera,400,reason);
   }
 
@@ -170,7 +170,7 @@
     Abdera abdera,
     RequestContext request,
     String reason) {
-    log.debug(Messages.get("CONFLICT"));
+    log.debug(Localizer.get("CONFLICT"));
     return createErrorResponse(abdera,409,reason);
   }
 
@@ -181,7 +181,7 @@
     Abdera abdera,
     RequestContext request,
     String reason) {
-      log.debug(Messages.get("UNAVAILABLE"));
+      log.debug(Localizer.get("UNAVAILABLE"));
       return createErrorResponse(abdera,503,reason);
   }
 
@@ -189,7 +189,7 @@
     Abdera abdera, 
     RequestContext request,
     String reason) {
-      log.debug(Messages.get("NOT.MODIFIED"));
+      log.debug(Localizer.get("NOT.MODIFIED"));
       return new EmptyResponseContext(304,reason);
   }
 
@@ -197,7 +197,7 @@
     Abdera abdera, 
     RequestContext request,
     String reason) {
-      log.debug(Messages.get("PRECONDITION.FAILED"));
+      log.debug(Localizer.get("PRECONDITION.FAILED"));
       return createErrorResponse(abdera,412,reason);
   }
 
@@ -208,7 +208,7 @@
     Abdera abdera,
     RequestContext request,
     String reason) {
-      log.debug(Messages.get("NOT.SUPPORTED"));
+      log.debug(Localizer.get("NOT.SUPPORTED"));
       return createErrorResponse(abdera,415,reason);
   }
 
@@ -219,7 +219,7 @@
     Abdera abdera,
     RequestContext request,
     String reason) {
-      log.debug(Messages.get("LOCKED"));
+      log.debug(Localizer.get("LOCKED"));
       return createErrorResponse(abdera,423,reason);
     }
 
@@ -231,7 +231,7 @@
     Base base, 
     int status,
     Date lastModified) {
-      log.debug(Messages.get("RETURNING.DOCUMENT"));
+      log.debug(Localizer.get("RETURNING.DOCUMENT"));
       BaseResponseContext response = new BaseResponseContext(base);
       response.setStatus(status);
       if (lastModified != null) response.setLastModified(lastModified);
@@ -250,14 +250,14 @@
    * the slug are replaced with an underscore
    */
   protected String sanitizeSlug(String slug) {
-    if (slug == null) throw new IllegalArgumentException(Messages.get("SLUG.NOT.NULL"));
+    if (slug == null) throw new IllegalArgumentException(Localizer.get("SLUG.NOT.NULL"));
     String sanitized = EncodingUtil.sanitize(slug);
-    log.debug(Messages.format("SLUG.SANITIZED", slug, sanitized));
+    log.debug(Localizer.sprintf("SLUG.SANITIZED", slug, sanitized));
     return sanitized;
   }
 
   protected int getDefaultPageSize() {
-    log.debug(Messages.format("DEFAULT.PAGE.SIZE",defaultpagesize));
+    log.debug(Localizer.sprintf("DEFAULT.PAGE.SIZE",defaultpagesize));
     return defaultpagesize;
   }
 
@@ -271,7 +271,7 @@
         size = (_ps != null) ? 
           Math.min(Math.max(Integer.parseInt(_ps),0),max) : max;
       } catch (Exception e) {}
-      log.debug(Messages.format("PAGE.SIZE",size));
+      log.debug(Localizer.sprintf("PAGE.SIZE",size));
       return size;
   }
 
@@ -286,7 +286,7 @@
         page = Math.max(page, 1) - 1;
         offset = pageSize * page;
       } catch (Exception e) {}
-      log.debug(Messages.format("OFFSET",offset));
+      log.debug(Localizer.sprintf("OFFSET",offset));
       return offset;
   }
 
@@ -314,15 +314,15 @@
             content.getContentType() == Content.Type.MEDIA || 
             content.getContentType() == Content.Type.XML) &&
             entry.getSummary() == null) {
-          log.debug(Messages.format("CHECKING.VALID.ENTRY",false));
+          log.debug(Localizer.sprintf("CHECKING.VALID.ENTRY",false));
           return false;
         }
       }
     } catch (Exception e) {
-      log.debug(Messages.format("CHECKING.VALID.ENTRY",false));
+      log.debug(Localizer.sprintf("CHECKING.VALID.ENTRY",false));
       return false;
     }
-    log.debug(Messages.format("CHECKING.VALID.ENTRY",true));
+    log.debug(Localizer.sprintf("CHECKING.VALID.ENTRY",true));
     return true;
   }
 
@@ -345,7 +345,7 @@
       ignore.add(org.apache.abdera.util.Constants.XML_NS);
       checkEntryAddAdditionalNamespaces(ignore);
       boolean answer = checkElement(entry,ignore);
-      log.debug(Messages.format("CHECKING.ENTRY.NAMESPACES",answer));
+      log.debug(Localizer.sprintf("CHECKING.ENTRY.NAMESPACES",answer));
       return answer;
   }
 



Mime
View raw message