[gatein-commits] gatein SVN: r611 - in portal/trunk: component/common/src/main/java/org/exoplatform/services/resources and 20 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Nov 16 07:53:31 EST 2009


Author: julien_viet
Date: 2009-11-16 07:53:30 -0500 (Mon, 16 Nov 2009)
New Revision: 611

Added:
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationData.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationService.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationServiceImpl.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/InputStreamURLConnection.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/InputStreamURLStreamHandler.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/LocaleConfig.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/LocaleConfigService.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/Orientation.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/PropertiesClassLoader.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/Query.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleDescription.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleLoader.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleService.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/XMLResourceBundleParser.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundlePlugin.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigImpl.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigServiceImpl.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/SimpleResourceBundleService.java
   portal/trunk/component/resources/src/test/java/locale/test/myRB1-2.xml
   portal/trunk/component/resources/src/test/java/locale/test/myRB1.xml
   portal/trunk/component/resources/src/test/java/locale/test/myRB1_en-2.xml
   portal/trunk/component/resources/src/test/java/locale/test/myRB1_en.xml
   portal/trunk/component/resources/src/test/java/locale/test/myRB1_fr-2.xml
   portal/trunk/component/resources/src/test/java/locale/test/myRB1_fr.xml
   portal/trunk/component/resources/src/test/java/locale/test/myRB2-2.properties
   portal/trunk/component/resources/src/test/java/locale/test/myRB2.properties
   portal/trunk/component/resources/src/test/java/locale/test/myRB2_en-2.properties
   portal/trunk/component/resources/src/test/java/locale/test/myRB2_en.properties
   portal/trunk/component/resources/src/test/java/locale/test/myRB2_fr-2.properties
   portal/trunk/component/resources/src/test/java/locale/test/myRB2_fr.properties
   portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java
   portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestLocaleConfigService.java
   portal/trunk/component/resources/src/test/java/resources/
   portal/trunk/component/resources/src/test/java/resources/locales-config.xml
Removed:
   portal/trunk/component/common/src/main/java/org/exoplatform/services/config/
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLConnection.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLStreamHandler.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfig.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfigService.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Orientation.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/PropertiesClassLoader.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Query.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleDescription.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleLoader.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleService.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/XMLResourceBundleParser.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundlePlugin.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigImpl.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigServiceImpl.java
   portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/hibernate/ResourceBundleServiceImpl.java
   portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java
   portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestLocaleConfigService.java
   portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/impl/TesBaseResourceBundleService.java
   portal/trunk/component/common/src/test/resources/locale/test/
   portal/trunk/component/common/src/test/resources/resources/
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationData.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationService.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationServiceImpl.java
   portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/jcr/
   portal/trunk/component/resources/src/test/java/resources/locales-config.xml
Modified:
   portal/trunk/component/pc/src/main/java/org/exoplatform/portal/pc/ExoKernelIntegration.java
   portal/trunk/component/resources/pom.xml
   portal/trunk/component/resources/src/main/java/conf/portal/configuration.xml
   portal/trunk/component/resources/src/test/java/conf/portal/test-configuration.xml
   portal/trunk/component/web/pom.xml
   portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
Log:
GTNPORTAL-253 : Remove resource bundle persistence


Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,161 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.ListResourceBundle;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * May 7, 2004
- * 
- * @author: Tuan Nguyen
- * @email: tuan08 at users.sourceforge.net
- * @version: $Id: ExoResourceBundle.java 9439 2006-10-12 03:28:53Z thuannd $
- **/
- at SuppressWarnings("serial")
-public class ExoResourceBundle extends ListResourceBundle implements Serializable
-{
-
-   private static Pattern LINE_SEPARATOR = Pattern.compile("[\\r]?\\n");
-
-   private static Pattern UNICODE_CHARACTER = Pattern.compile("\\\\u[\\p{XDigit}]{4}+");
-
-   private Object[][] contents;
-
-   public ExoResourceBundle(String data)
-   {
-      String[] tokens = LINE_SEPARATOR.split(data);
-      List<String[]> properties = new ArrayList<String[]>();
-      for (String token : tokens)
-      {
-         int idx = token.indexOf('=');
-         if (idx < 0 || idx >= token.length() - 1)
-         {
-            continue;
-         }
-         String key = token.substring(0, idx);
-         if (key.trim().startsWith("#"))
-         {
-            continue;
-         }
-         String value = convert(token.substring(idx + 1, token.length()));
-         properties.add(new String[]{key, value});
-      }
-      String[][] aProperties = new String[properties.size()][2];
-      contents = (String[][])properties.toArray(aProperties);
-   }
-
-   public ExoResourceBundle(String data, ResourceBundle parent)
-   {
-      this(data);
-      setParent(parent);
-   }
-
-   public Object[][] getContents()
-   {
-      return contents;
-   }
-
-   public void putAll(Map<? super Object, ? super Object> map)
-   {
-      Enumeration<String> keys = getKeys();
-      while (keys.hasMoreElements())
-      {
-         String key = keys.nextElement();
-         if (key != null)
-         {
-            map.put(key, getString(key));
-         }
-      }
-   }
-
-   static String convert(String content)
-   {
-      Matcher matcher = UNICODE_CHARACTER.matcher(content);
-      StringBuilder buffer = new StringBuilder(content.length());
-      int start = 0;
-      while (matcher.find(start))
-      {
-         buffer.append(content.substring(start, matcher.start()));
-         buffer.append(unicode2Char(matcher.group()));
-         start = matcher.end();
-      }
-      if (start >= 0 && start < content.length())
-      {
-         buffer.append(content.substring(start));
-      }
-      return buffer.toString();
-   }
-
-   static char unicode2Char(String unicodeChar)
-   {
-      int value = 0;
-      char aChar;
-      for (int i = 0; i < 4; i++)
-      {
-         aChar = unicodeChar.charAt(i + 2);
-         switch (aChar)
-         {
-            case '0' :
-            case '1' :
-            case '2' :
-            case '3' :
-            case '4' :
-            case '5' :
-            case '6' :
-            case '7' :
-            case '8' :
-            case '9' : {
-               value = (value << 4) + aChar - '0';
-               break;
-            }
-            case 'a' :
-            case 'b' :
-            case 'c' :
-            case 'd' :
-            case 'e' :
-            case 'f' : {
-               value = (value << 4) + 10 + aChar - 'a';
-               break;
-            }
-            case 'A' :
-            case 'B' :
-            case 'C' :
-            case 'D' :
-            case 'E' :
-            case 'F' : {
-               value = (value << 4) + 10 + aChar - 'A';
-               break;
-            }
-            default : {
-               throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
-            }
-         }
-      }
-      return (char)value;
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,58 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import java.util.Enumeration;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.Vector;
-
-/**
- * A resource bundle that returns the queried key. It returns an empty enumeration when the keys are queried.
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class IdentityResourceBundle extends ResourceBundle
-{
-
-   public static final String MAGIC_LANGUAGE = "ma".intern();
-
-   public static final Locale MAGIC_LOCALE = new Locale(MAGIC_LANGUAGE);
-
-   private static final Vector<String> EMPTY_KEYS = new Vector<String>();
-
-   private static final IdentityResourceBundle instance = new IdentityResourceBundle();
-
-   public static ResourceBundle getInstance()
-   {
-      return instance;
-   }
-
-   protected Object handleGetObject(String key)
-   {
-      return key;
-   }
-
-   public Enumeration<String> getKeys()
-   {
-      return EMPTY_KEYS.elements();
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLConnection.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLConnection.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLConnection.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,68 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-
-/**
- * An URLConnection extension that use a local {@link java.io.InputStream} object.
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class InputStreamURLConnection extends URLConnection
-{
-
-   private final InputStream in;
-
-   /**
-    * Creates a new connection.
-    *
-    * @param url the original URL
-    * @param in the input stream
-    * @throws IllegalArgumentException if the stream is null
-    */
-   public InputStreamURLConnection(URL url, InputStream in) throws IllegalArgumentException
-   {
-      super(url);
-
-      //
-      if (in == null)
-      {
-         throw new IllegalArgumentException("No null input stream accepted");
-      }
-
-      //
-      this.in = in;
-   }
-
-   public void connect() throws IOException
-   {
-      // no op
-   }
-
-   public InputStream getInputStream() throws IOException
-   {
-      return in;
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLStreamHandler.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLStreamHandler.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLStreamHandler.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,62 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLStreamHandler;
-
-/**
- * An URLStreamHandler extension that use a local {@link java.io.InputStream} object. This object will always use
- * the stream provided and nothing else. So the life time of an instance is very limited.
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class InputStreamURLStreamHandler extends URLStreamHandler
-{
-
-   private final InputStream in;
-
-   /**
-    * Creates a new handler.
-    *
-    * @param in the input stream
-    * @throws IllegalArgumentException if the stream is null
-    */
-   public InputStreamURLStreamHandler(InputStream in) throws IllegalArgumentException
-   {
-      if (in == null)
-      {
-         throw new IllegalArgumentException("No null input stream accepted");
-      }
-
-      //
-      this.in = in;
-   }
-
-   protected URLConnection openConnection(URL u) throws IOException
-   {
-      return new InputStreamURLConnection(u, in);
-   }
-
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfig.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfig.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfig.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,84 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * May 3, 2004
- * 
- * @author: Tuan Nguyen
- * @email: tuan08 at users.sourceforge.net
- * @version: $Id: LocaleConfig.java 5799 2006-05-28 17:55:42Z geaz $
- **/
-public interface LocaleConfig
-{
-
-   public String getDescription();
-
-   public void setDescription(String desc);
-
-   public String getOutputEncoding();
-
-   public void setOutputEncoding(String enc);
-
-   public String getInputEncoding();
-
-   public void setInputEncoding(String enc);
-
-   public Locale getLocale();
-
-   public void setLocale(Locale locale);
-
-   public void setLocale(String localeName);
-
-   public String getLanguage();
-
-   public String getLocaleName();
-
-   public ResourceBundle getResourceBundle(String name);
-
-   public ResourceBundle getMergeResourceBundle(String[] names);
-
-   public ResourceBundle getNavigationResourceBundle(String ownerType, String ownerId);
-
-   public void setInput(HttpServletRequest req) throws java.io.UnsupportedEncodingException;
-
-   public void setOutput(HttpServletResponse res);
-
-   /**
-    * Returns the orientation of the locale config.
-    *
-    * @return the orientation
-    */
-   public Orientation getOrientation();
-
-   /**
-    * Updates the orientation of the locale config.
-    *
-    * @param orientation the new orientation
-    */
-   public void setOrientation(Orientation orientation);
-
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfigService.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfigService.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfigService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,47 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import java.util.Collection;
-
-/**
- * @author Benjamin Mestrallet benjamin.mestrallet at exoplatform.com This Service
- *         is used to manage the locales that the applications can handle
- */
-public interface LocaleConfigService
-{
-
-   /**
-    * @return Return the default LocaleConfig
-    */
-   public LocaleConfig getDefaultLocaleConfig();
-
-   /**
-    * @param lang a locale language
-    * @return The LocalConfig
-    */
-   public LocaleConfig getLocaleConfig(String lang);
-
-   /**
-    * @return All the LocalConfig that manage by the service
-    */
-   public Collection<LocaleConfig> getLocalConfigs();
-
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Orientation.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Orientation.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Orientation.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,85 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-/**
- * An orientation.
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public enum Orientation {
-
-   LT(0), // Western Europe
-
-   RT(1), // Middle East (Arabic, Hebrew)
-
-   TL(2), // Japanese, Chinese, Korean
-
-   TR(3); // Mongolian
-
-   private final int ordinal;
-
-   Orientation(int ordinal)
-   {
-      this.ordinal = ordinal;
-   }
-
-   /**
-    * Indicates whether the Locale correspond to an LT orientation.
-    *  
-    * @return true if the orientation is LT
-    */
-   public boolean isLT()
-   {
-      return ordinal == 0;
-   }
-
-   /**
-    * Indicates whether the Locale correspond to an RT orientation.
-    * 
-    * @return true if the orientation is RT
-    */
-   public boolean isRT()
-   {
-      return ordinal == 1;
-   }
-
-   /**
-    * Indicates whether the Locale correspond to an TL orientation.
-    * 
-    * @return true if the orientation is TL
-    */
-   public boolean isTL()
-   {
-      return ordinal == 2;
-   }
-
-   /**
-    * Indicates whether the Locale correspond to an TR orientation.
-    *  
-    * @return true if the orientation is TR
-    */
-   public boolean isTR()
-   {
-      return ordinal == 3;
-   }
-
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/PropertiesClassLoader.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/PropertiesClassLoader.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/PropertiesClassLoader.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,200 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import org.exoplatform.commons.utils.IOUtil;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
-
-/**
- * A {@link ClassLoader} extension that will retrieve resources from the parent
- * classloader. For each resource having a ".properties" suffix it the
- * classloader will try first to locate a corresponding resource using the same
- * base name but with an ".xml" suffix. If such a resource is found, it will be
- * loaded using {@link XMLResourceBundleParser}
- * 
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class PropertiesClassLoader extends ClassLoader
-{
-
-   /**
-    * Logger.
-    */
-   private static final Log LOG = ExoLogger.getLogger(PropertiesClassLoader.class);
-
-   /**
-    * Indicates whether the resource must be encoded into UTF-8
-    */
-   private boolean unicode;
-
-   public PropertiesClassLoader(ClassLoader parent)
-   {
-      this(parent, false);
-   }
-
-   public PropertiesClassLoader(ClassLoader parent, boolean unicode)
-   {
-      super(parent);
-      this.unicode = unicode;
-   }
-
-   public PropertiesClassLoader()
-   {
-   }
-
-   @Override
-   public URL getResource(String name)
-   {
-      if (name.endsWith(".properties"))
-      {
-         URL url = null;
-         ClassLoader parent = getParent();
-         while (parent != null)
-         {
-            url = getResource(parent, name, unicode);
-            if (url != null)
-            {
-               return url;
-            }
-            parent = parent.getParent();
-         }
-         if (url == null)
-         {
-            url = getResource(this, name, unicode);
-         }
-         return url;
-      }
-      return super.getResource(name);
-   }
-
-   private static URL getResource(ClassLoader cl, String name, boolean unicode)
-   {
-      String xmlName = name.substring(0, name.length() - ".properties".length()) + ".xml";
-      URL url = getResource(cl, xmlName, unicode, true);
-      if (url == null)
-      {
-         url = getResource(cl, name, unicode, false);
-      }
-      return url;
-   }
-
-   private static URL getResource(ClassLoader cl, String name, boolean unicode, boolean xml)
-   {
-      Enumeration<URL> urls = null;
-      try
-      {
-         urls = cl.getResources(name);
-      }
-      catch (Exception e)
-      {
-         LOG.error("An error occured while seeking all the resources with the name " + name, e);
-         return null;
-      }
-      if (urls != null && urls.hasMoreElements())
-      {
-         // At least one such resource has been found
-         ByteArrayOutputStream out = new ByteArrayOutputStream();
-         URL url = null;
-         Map<Object, Object> props = unicode ? new TreeMap<Object, Object>() : new Properties();
-         while (urls.hasMoreElements())
-         {
-            url = urls.nextElement();
-            InputStream in = null;
-            try
-            {
-               // Load content
-               in = url.openStream();
-               if (xml)
-               {
-                  props.putAll(XMLResourceBundleParser.asProperties(in));
-               }
-               else
-               {
-                  byte[] buf = IOUtil.getStreamContentAsBytes(in);
-                  ExoResourceBundle bundle = new ExoResourceBundle(new String(buf, "UTF-8"));
-                  bundle.putAll(props);
-               }
-            }
-            catch (Exception e)
-            {
-               LOG.error("An error occured while loading the content of " + url, e);
-               return null;
-            }
-            finally
-            {
-               if (in != null)
-               {
-                  try
-                  {
-                     in.close();
-                  }
-                  catch (IOException e)
-                  {
-                     // Do nothing
-                  }
-               }
-            }
-         }
-         try
-         {
-            // Now serialize as binary
-            if (unicode)
-            {
-               // Encoded into UTF-8
-               for (Map.Entry<Object, Object> entry : props.entrySet())
-               {
-                  out.write(((String)entry.getKey()).getBytes("UTF-8"));
-                  out.write('=');
-                  out.write(((String)entry.getValue()).getBytes("UTF-8"));
-                  out.write('\n');
-               }
-            }
-            else
-            {
-               // Properties format : encoded into ISO-8859-1 with unicode characters
-               ((Properties)props).store(out, null);
-            }
-            out.close();
-            InputStream in = new ByteArrayInputStream(out.toByteArray());
-
-            //
-            return new URL(url, "", new InputStreamURLStreamHandler(in));
-         }
-         catch (Exception e)
-         {
-            LOG.error("An error occured while creating the content of " + url, e);
-            return null;
-         }
-      }
-      return null;
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Query.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Query.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Query.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,71 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-/**
- * Created by The eXo Platform SAS . Author : Tuan Nguyen
- * tuan08 at users.sourceforge.net Date: Jun 14, 2003 Time: 1:12:22 PM
- */
-public class Query
-{
-
-   private String name_;
-
-   private String languages_;
-
-   private int maxSize_;
-
-   public Query(String name, String language)
-   {
-      name_ = name;
-      languages_ = language;
-      maxSize_ = 100;
-   }
-
-   public String getName()
-   {
-      return name_;
-   }
-
-   public void setName(String s)
-   {
-      name_ = s;
-   }
-
-   public String getLanguage()
-   {
-      return languages_;
-   }
-
-   public void setLanguage(String s)
-   {
-      languages_ = s;
-   }
-
-   public int getMaxSize()
-   {
-      return maxSize_;
-   }
-
-   public void setMaxSize(int s)
-   {
-      maxSize_ = s;
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,53 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import java.io.Serializable;
-
-/**
- * Created by The eXo Platform SAS . Author : Tuan Nguyen
- * tuan08 at users.sourceforge.net Date: May 14, 2004 Time: 1:12:22 PM
- */
- at SuppressWarnings("serial")
-public class ResourceBundleData extends ResourceBundleDescription implements Serializable
-{
-
-   private String data_;
-
-   public ResourceBundleData()
-   {
-      setResourceType("-");
-      setLanguage(DEFAULT_LANGUAGE);
-   }
-
-   /**
-    * @hibernate.property length="65535"
-    *                     type="org.exoplatform.services.database.impl.TextClobType"
-    **/
-   public String getData()
-   {
-      return data_;
-   }
-
-   public void setData(String data)
-   {
-      data_ = data;
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleDescription.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleDescription.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleDescription.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,138 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import java.io.Serializable;
-
-/**
- * Created by The eXo Platform SAS . Author : Tuan Nguyen
- * tuan08 at users.sourceforge.net Date: May 14, 2004 Time: 1:12:22 PM
- */
- at SuppressWarnings("serial")
-public class ResourceBundleDescription implements Serializable
-{
-
-   protected String id_;
-
-   protected String name_;
-
-   protected String language_;
-
-   protected String country_;
-
-   protected String variant_;
-
-   protected String resourceType_;
-
-   public ResourceBundleDescription()
-   {
-   }
-
-   /**
-    * @hibernate.id generator-class="assigned"
-    **/
-   public String getId()
-   {
-      if (id_ == null)
-      {
-         StringBuffer b = new StringBuffer();
-         b.append(name_);
-         if (language_ != null)
-            b.append('_').append(language_);
-         // if(country_ != null) b.append('_').append(country_);
-         // if(variant_ != null) b.append('_').append(variant_);
-         id_ = b.toString();
-      }
-      return id_;
-   }
-
-   public void setId(String id)
-   {
-      id_ = id;
-   }
-
-   /**
-    * @hibernate.property
-    **/
-   public String getName()
-   {
-      return name_;
-   }
-
-   public void setName(String name)
-   {
-      name_ = name;
-   }
-
-   /**
-    * @hibernate.property
-    **/
-   public String getLanguage()
-   {
-      return language_;
-   }
-
-   public void setLanguage(String s)
-   {
-      language_ = s;
-   }
-
-   /**
-    * @hibernate.property
-    **/
-   public String getCountry()
-   {
-      return country_;
-   }
-
-   public void setCountry(String s)
-   {
-      country_ = s;
-   }
-
-   /**
-    * @hibernate.property
-    **/
-   public String getVariant()
-   {
-      return variant_;
-   }
-
-   public void setVariant(String s)
-   {
-      variant_ = s;
-   }
-
-   /**
-    * @hibernate.property
-    **/
-   public String getResourceType()
-   {
-      return resourceType_;
-   }
-
-   public void setResourceType(String s)
-   {
-      resourceType_ = s;
-   }
-
-   final static public String DEFAULT_LANGUAGE = "en";
-
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleLoader.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleLoader.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleLoader.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,43 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * A facade for obtaining resource bundles.
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class ResourceBundleLoader
-{
-
-   public static ResourceBundle load(String baseName, Locale locale, ClassLoader classLoader)
-   {
-      if (IdentityResourceBundle.MAGIC_LANGUAGE.equals(locale.getLanguage()))
-      {
-         return IdentityResourceBundle.getInstance();
-      }
-      PropertiesClassLoader pcl = new PropertiesClassLoader(classLoader);
-      return ResourceBundle.getBundle(baseName, locale, pcl);
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleService.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleService.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,128 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import org.exoplatform.commons.utils.PageList;
-
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * May 7, 2004
- * 
- * @author: Tuan Nguyen
- * @email: tuan08 at users.sourceforge.net
- * @version: $Id: ResourceBundleService.java 5799 2006-05-28 17:55:42Z geaz $
- *           This class is used to manage the Resoucebunlde. It should work like
- *           the java.util.ResourceBundle class except that the properties file
- *           can be in the database or a a directory. The class
- *           java.util.ResourceBundle require that the properties file has to be
- *           in the classpath.
- **/
-public interface ResourceBundleService
-{
-   /**
-    * This method should search for a template in the database that the service
-    * manage or the resource in the classpath of the current thread class loader
-    * 
-    * @param name The name of the resource bunlde
-    * @param locale the locale
-    * @return A ResourceBunlde or null if no ResourceBundle is found
-    */
-   public ResourceBundle getResourceBundle(String name, Locale locale);
-
-   /**
-    * This method should search for a template in the database that the service
-    * manage or the resource in the classpath of the specified class loader
-    * 
-    * @param name the name of the resource
-    * @param locale the locale
-    * @param cl The classloader
-    * @return
-    */
-   public ResourceBundle getResourceBundle(String name, Locale locale, ClassLoader cl);
-
-   /**
-    * This method will call the method public ResourceBundle
-    * getResourceBundle(String[] name, Locale locale, ClassLoader cl) and using
-    * the the classloader of the current thread
-    */
-   public ResourceBundle getResourceBundle(String[] name, Locale locale);
-
-   /**
-    * This method will look for all the resources with the given names and merge
-    * into one resource bundle, the properties in the later resource bundle name
-    * will have the higher priority than the previous one.
-    */
-   public ResourceBundle getResourceBundle(String[] name, Locale locale, ClassLoader cl);
-
-   /**
-    * This method should look for a resource bundle in the database that match
-    * the given id. The ResourceBundleData store the data as text instead of a
-    * properties map.
-    * 
-    * @param id The id of the resource bundle data
-    * @return A ResourceBundleData instance or no record is found.
-    * @throws Exception
-    */
-   public ResourceBundleData getResourceBundleData(String id) throws Exception;
-
-   /**
-    * This method remove the data record in the databas and return the data
-    * instance after it has been removed
-    * 
-    * @param id The id of the data record
-    * @return A ResourceBundleData instance
-    * @throws Exception
-    */
-   public ResourceBundleData removeResourceBundleData(String id) throws Exception;
-
-   /**
-    * This method shoudl create or update a ResourceBundleData instance
-    * 
-    * @param data the ResourceBundleData instance to update or create
-    * @throws Exception
-    */
-   public void saveResourceBundle(ResourceBundleData data) throws Exception;
-
-   /**
-    * This method search and return a page description iterator
-    * 
-    * @param q The search criteria
-    * @return A PageDescription Iterator
-    * @throws Exception
-    */
-   public PageList findResourceDescriptions(Query q) throws Exception;
-
-   /**
-    * This method is acted as a factory of
-    * 
-    * @return
-    */
-   public ResourceBundleData createResourceBundleDataInstance();
-
-   /**
-    * The developer can store the common properties in certain resource bundles
-    * so later he can merge a resource bundle with the shared resource bunldes
-    * 
-    * @return the name of the shared resource bundle
-    */
-   public String[] getSharedResourceBundleNames();
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/XMLResourceBundleParser.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/XMLResourceBundleParser.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/XMLResourceBundleParser.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,205 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-/**
- * A parser for XML resource bundle having the following rules:
- *
- * <ul>
- * <li>The root document element is named "bundle"</li>
- * <li>Any non root element can have any name</li>
- * <li>Any non root element content must not have mixed content (i.e text and children elements)</li>
- * <li>Any element having textual content is considered as a bundle entry with they key formed by the
- *     dot concatenation of its parent element name except the root element and the value is the text content</li>
- * </ul>
- *
- * For instance the following document:
- *
- * &lt;bundle&gt;
- * &lt;foo&gt;
- * &lt;A&gt;1&lt;A&gt;
- * &lt;B&gt;2&lt;B&gt;
- * &lt;/foo&gt;
- * &lt;C&gt;3&lt;C&gt;
- * &lt;/bundle&gt;
- *
- * will give the bundle with entries:
- *
- * <ul>
- * <li>foo.A=1</li>
- * <li>foo.B=2</li>
- * <li>C=3</li>
- * </ul>
- *
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class XMLResourceBundleParser
-{
-
-   /**
-    * @see #asMap(org.xml.sax.InputSource)
-    */
-   public static Properties asProperties(InputStream in) throws IOException, SAXException,
-      ParserConfigurationException, IllegalArgumentException
-   {
-      if (in == null)
-      {
-         throw new IllegalArgumentException("No null input stream allowed");
-      }
-      return asProperties(new InputSource(in));
-   }
-
-   /**
-    * @see #asMap(org.xml.sax.InputSource)
-    */
-   public static Properties asProperties(Reader in) throws IOException, SAXException, ParserConfigurationException,
-      IllegalArgumentException
-   {
-      if (in == null)
-      {
-         throw new IllegalArgumentException("No null reader allowed");
-      }
-      return asProperties(new InputSource(in));
-   }
-
-   /**
-    * @see #asMap(org.xml.sax.InputSource)
-    */
-   public static Properties asProperties(InputSource in) throws IOException, SAXException,
-      ParserConfigurationException, IllegalArgumentException
-   {
-      if (in == null)
-      {
-         throw new IllegalArgumentException("No null input source allowed");
-      }
-      Map<String, String> bundle = asMap(in);
-      Properties props = new Properties();
-      props.putAll(bundle);
-      return props;
-   }
-
-   /**
-    * @see #asMap(org.xml.sax.InputSource)
-    */
-   public static Map<String, String> asMap(InputStream in) throws IOException, SAXException,
-      ParserConfigurationException, IllegalArgumentException
-   {
-      if (in == null)
-      {
-         throw new IllegalArgumentException("No null input stream allowed");
-      }
-      return asMap(new InputSource(in));
-   }
-
-   /**
-    * @see #asMap(org.xml.sax.InputSource)
-    */
-   public static Map<String, String> asMap(Reader in) throws IOException, SAXException, ParserConfigurationException,
-      IllegalArgumentException
-   {
-      if (in == null)
-      {
-         throw new IllegalArgumentException("No null reader allowed");
-      }
-      return asMap(new InputSource(in));
-   }
-
-   /**
-    * Load an xml resource bundle as a {@link Map<String,String>} object.
-    *
-    * @param in the input source
-    * @return the properties object
-    * @throws IOException any IOException
-    * @throws SAXException any SAXException
-    * @throws ParserConfigurationException any ParserConfigurationException
-    * @throws IllegalArgumentException if the argument is null
-    */
-   public static Map<String, String> asMap(InputSource in) throws IOException, SAXException,
-      ParserConfigurationException, IllegalArgumentException
-   {
-      if (in == null)
-      {
-         throw new IllegalArgumentException("No null input source allowed");
-      }
-      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-      DocumentBuilder builder = factory.newDocumentBuilder();
-      Document document = builder.parse(in);
-      Element bundleElt = document.getDocumentElement();
-      HashMap<String, String> bundle = new HashMap<String, String>();
-      collect(new LinkedList<String>(), bundleElt, bundle);
-      return bundle;
-   }
-
-   private static void collect(LinkedList<String> path, Element currentElt, Map<String, String> bundle)
-   {
-      NodeList children = currentElt.getChildNodes();
-      boolean text = true;
-      for (int i = children.getLength() - 1; i >= 0; i--)
-      {
-         Node child = children.item(i);
-         if (child.getNodeType() == Node.ELEMENT_NODE)
-         {
-            text = false;
-            Element childElt = (Element)child;
-            String name = childElt.getTagName();
-            path.addLast(name);
-            collect(path, childElt, bundle);
-            path.removeLast();
-         }
-      }
-      if (text && path.size() > 0)
-      {
-         String value = currentElt.getTextContent();
-         StringBuffer sb = new StringBuffer();
-         for (Iterator<String> i = path.iterator(); i.hasNext();)
-         {
-            String name = i.next();
-            sb.append(name);
-            if (i.hasNext())
-            {
-               sb.append('.');
-            }
-         }
-         String key = sb.toString();
-         bundle.put(key, value);
-      }
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundlePlugin.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundlePlugin.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundlePlugin.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,75 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources.impl;
-
-import org.exoplatform.container.component.BaseComponentPlugin;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.ValuesParam;
-
-import java.util.List;
-
-/**
- * This class is used to define new resource bundles
- * 
- * Created by The eXo Platform SAS
- * Author : Nicolas Filotto 
- *          nicolas.filotto at exoplatform.com
- * 24 sept. 2009
- */
-public class BaseResourceBundlePlugin extends BaseComponentPlugin
-{
-
-   private final InitParams params;
-
-   public BaseResourceBundlePlugin(InitParams params)
-   {
-      this.params = params;
-   }
-
-   /**
-    * @return the list of enclosed "classpath" resource bundles
-    */
-   @SuppressWarnings("unchecked")
-   public List<String> getClasspathResources()
-   {
-      ValuesParam vParam = params.getValuesParam("classpath.resources");
-      return vParam == null ? null : vParam.getValues();
-   }
-
-   /**
-    * @return the list of enclosed "portal" resource bundles
-    */
-   @SuppressWarnings("unchecked")
-   public List<String> getPortalResources()
-   {
-      ValuesParam vParam = params.getValuesParam("portal.resource.names");
-      return vParam == null ? null : vParam.getValues();
-   }
-
-   /**
-    * @return the list of enclosed "init" resource bundles
-    */
-   @SuppressWarnings("unchecked")
-   public List<String> getInitResources()
-   {
-      ValuesParam vParam = params.getValuesParam("init.resources");
-      return vParam == null ? null : vParam.getValues();
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,341 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources.impl;
-
-import org.exoplatform.commons.utils.IOUtil;
-import org.exoplatform.commons.utils.MapResourceBundle;
-import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.services.cache.ExoCache;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.services.resources.IdentityResourceBundle;
-import org.exoplatform.services.resources.LocaleConfig;
-import org.exoplatform.services.resources.LocaleConfigService;
-import org.exoplatform.services.resources.PropertiesClassLoader;
-import org.exoplatform.services.resources.Query;
-import org.exoplatform.services.resources.ResourceBundleData;
-import org.exoplatform.services.resources.ResourceBundleLoader;
-import org.exoplatform.services.resources.ResourceBundleService;
-import org.picocontainer.Startable;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * Created by The eXo Platform SAS Mar 9, 2007
- */
-abstract public class BaseResourceBundleService implements ResourceBundleService, Startable
-{
-
-   protected Log log_;
-
-   protected volatile List<String> classpathResources_;
-
-   protected volatile String[] portalResourceBundleNames_;
-
-   protected LocaleConfigService localeService_;
-
-   protected ExoCache<String, ResourceBundle> cache_;
-
-   private volatile List<String> initResources_;
-
-   @SuppressWarnings("unchecked")
-   protected void initParams(InitParams params)
-   {
-      classpathResources_ = params.getValuesParam("classpath.resources").getValues();
-
-      // resources name can use for portlets
-      List prnames = params.getValuesParam("portal.resource.names").getValues();
-      portalResourceBundleNames_ = new String[prnames.size()];
-      for (int i = 0; i < prnames.size(); i++)
-      {
-         portalResourceBundleNames_[i] = (String)prnames.get(i);
-      }
-
-      initResources_ = params.getValuesParam("init.resources").getValues();
-   }
-
-   /**
-    * Add new resources bundles
-    */
-   public synchronized void addResourceBundle(BaseResourceBundlePlugin plugin)
-   {
-      List<String> classpathResources = plugin.getClasspathResources();
-      if (classpathResources != null && !classpathResources.isEmpty())
-      {
-         List<String> result = new ArrayList<String>(classpathResources);
-         if (classpathResources_ != null)
-         {
-            result.addAll(classpathResources_);
-         }
-         this.classpathResources_ = Collections.unmodifiableList(result);
-      }
-      List<String> portalResources = plugin.getPortalResources();
-      if (portalResources != null && !portalResources.isEmpty())
-      {
-         List<String> result = new ArrayList<String>(portalResources);
-         if (portalResourceBundleNames_ != null)
-         {
-            result.addAll(Arrays.asList(portalResourceBundleNames_));
-         }
-         this.portalResourceBundleNames_ = (String[])result.toArray(new String[result.size()]);
-      }
-      List<String> initResources = plugin.getInitResources();
-      if (initResources != null && !initResources.isEmpty())
-      {
-         List<String> result = new ArrayList<String>(initResources);
-         if (initResources_ != null)
-         {
-            result.addAll(initResources_);
-         }
-         this.initResources_ = Collections.unmodifiableList(result);
-      }
-   }
-
-   /**
-    * Loads all the "init" resource bundles 
-    * @see org.picocontainer.Startable#start()
-    */
-   public void start()
-   {
-      PageList pl = null;
-      try
-      {
-         pl = findResourceDescriptions(new Query(null, null));
-      }
-      catch (Exception e)
-      {
-         throw new RuntimeException("Cannot check if a resource already exists", e);
-      }
-      if (pl.getAvailable() > 0)
-         return;
-
-      // init resources
-      List<String> initResources = initResources_;
-      for (String resource : initResources)
-      {
-         initResources(resource, Thread.currentThread().getContextClassLoader());
-      }
-   }
-
-   /**
-    * @see org.picocontainer.Startable#stop()
-    */
-   public void stop()
-   {
-   }
-
-   public ResourceBundle getResourceBundle(String[] name, Locale locale)
-   {
-      ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      return getResourceBundle(name, locale, cl);
-   }
-
-   public ResourceBundle getResourceBundle(String name, Locale locale)
-   {
-      ClassLoader cl = Thread.currentThread().getContextClassLoader();
-      return getResourceBundle(name, locale, cl);
-   }
-
-   public String[] getSharedResourceBundleNames()
-   {
-      return portalResourceBundleNames_;
-   }
-
-   public ResourceBundleData createResourceBundleDataInstance()
-   {
-      return new ResourceBundleData();
-   }
-
-   protected boolean isClasspathResource(String name)
-   {
-      if (classpathResources_ == null)
-         return false;
-      for (int i = 0; i < classpathResources_.size(); i++)
-      {
-         String pack = classpathResources_.get(i);
-         if (name.startsWith(pack))
-            return true;
-      }
-      return false;
-   }
-
-   protected void initResources(String baseName, ClassLoader cl)
-   {
-      String name = baseName.replace('.', '/');
-      try
-      {
-         Collection<LocaleConfig> localeConfigs = localeService_.getLocalConfigs();
-         String defaultLang = localeService_.getDefaultLocaleConfig().getLanguage();
-         for (Iterator<LocaleConfig> iter = localeConfigs.iterator(); iter.hasNext();)
-         {
-            LocaleConfig localeConfig = iter.next();
-            String language = localeConfig.getLanguage();
-            String content = getResourceBundleContent(name, language, defaultLang, cl);
-            if (content != null)
-            {
-               // save the content
-               ResourceBundleData data = new ResourceBundleData();
-               data.setId(baseName + "_" + language);
-               data.setName(baseName);
-               data.setLanguage(language);
-               data.setData(content);
-               saveResourceBundle(data);
-            }
-         }
-      }
-      catch (Exception ex)
-      {
-         log_.error("Error while reading the resource bundle : " + baseName, ex);
-      }
-   }
-
-   protected String getResourceBundleContent(String name, String language, String defaultLang, ClassLoader cl)
-      throws Exception
-   {
-      String fileName = null;
-      try
-      {
-         cl = new PropertiesClassLoader(cl, true);
-         fileName = name + "_" + language + ".properties";
-         URL url = cl.getResource(fileName);
-         if (url == null && defaultLang.equals(language))
-         {
-            url = cl.getResource(name + ".properties");
-         }
-         if (url != null)
-         {
-            InputStream is = url.openStream();
-            try
-            {
-               byte[] buf = IOUtil.getStreamContentAsBytes(is);
-               return new String(buf, "UTF-8");
-            }
-            finally
-            {
-               try
-               {
-                  is.close();
-               }
-               catch (IOException e)
-               {
-                  // Do nothing
-               }
-            }
-         }
-      }
-      catch (Exception e)
-      {
-         throw new Exception("Error while reading the file: " + fileName, e);
-      }
-      return null;
-   }
-
-   public ResourceBundle getResourceBundle(String name, Locale locale, ClassLoader cl)
-   {
-      if (IdentityResourceBundle.MAGIC_LANGUAGE.equals(locale.getLanguage()))
-      {
-         return IdentityResourceBundle.getInstance();
-      }
-      if (isClasspathResource(name))
-         return ResourceBundleLoader.load(name, locale, cl);
-      String id = name + "_" + locale.getLanguage();
-      try
-      {
-         ResourceBundle rb = cache_.get(id);
-         if (rb != null)
-            return rb;
-      }
-      catch (Exception ex)
-      {
-      }
-
-      try
-      {
-         ResourceBundle res = null;
-         String rootId = name + "_" + localeService_.getDefaultLocaleConfig().getLanguage();
-         ResourceBundle parent = getResourceBundleFromDb(rootId, null, locale);
-         if (parent != null)
-         {
-            res = getResourceBundleFromDb(id, parent, locale);
-            if (res == null)
-               res = parent;
-            cache_.put(id, res);
-            return res;
-         }
-      }
-      catch (Exception ex)
-      {
-         log_.error("Error: " + id, ex);
-      }
-      return null;
-   }
-
-   public ResourceBundle getResourceBundle(String[] name, Locale locale, ClassLoader cl)
-   {
-      if (IdentityResourceBundle.MAGIC_LANGUAGE.equals(locale.getLanguage()))
-      {
-         return IdentityResourceBundle.getInstance();
-      }
-      StringBuilder idBuf = new StringBuilder("merge:");
-      for (String n : name)
-         idBuf.append(n).append("_");
-      idBuf.append(locale);
-      String id = idBuf.toString();
-      try
-      {
-         ResourceBundle res = cache_.get(id);
-         if (res != null)
-            return res;
-         MapResourceBundle outputBundled = new MapResourceBundle(locale);
-         for (int i = 0; i < name.length; i++)
-         {
-            ResourceBundle temp = getResourceBundle(name[i], locale, cl);
-            if (temp != null)
-            {
-               outputBundled.merge(temp);
-               continue;
-            }
-            log_.warn("Cannot load and merge the bundle: " + name[i]);
-         }
-         outputBundled.resolveDependencies();
-         cache_.put(id, outputBundled);
-         return outputBundled;
-      }
-      catch (Exception ex)
-      {
-         log_.error("Cannot load and merge the bundle: " + id, ex);
-      }
-      return null;
-   }
-
-   abstract protected ResourceBundle getResourceBundleFromDb(String id, ResourceBundle parent, Locale locale)
-      throws Exception;
-
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigImpl.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigImpl.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigImpl.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,183 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources.impl;
-
-import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.services.resources.LocaleConfig;
-import org.exoplatform.services.resources.Orientation;
-import org.exoplatform.services.resources.ResourceBundleService;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @author Benjamin Mestrallet benjamin.mestrallet at exoplatform.com
- */
-public class LocaleConfigImpl implements LocaleConfig
-{
-
-   static private Map<String, Locale> predefinedLocaleMap_ = null;
-
-   static
-   {
-      predefinedLocaleMap_ = new HashMap<String, Locale>(10);
-      predefinedLocaleMap_.put("us", Locale.US);
-      predefinedLocaleMap_.put("en", Locale.ENGLISH);
-      predefinedLocaleMap_.put("fr", Locale.FRANCE);
-      predefinedLocaleMap_.put("zh", Locale.SIMPLIFIED_CHINESE);
-   }
-
-   private Locale locale_;
-
-   private String outputEncoding_;
-
-   private String inputEncoding_;
-
-   private String description_;
-
-   private String localeName_;
-
-   private Orientation orientation;
-
-   public LocaleConfigImpl()
-   {
-   }
-
-   public final String getDescription()
-   {
-      return description_;
-   }
-
-   public final void setDescription(String desc)
-   {
-      description_ = desc;
-   }
-
-   public final String getOutputEncoding()
-   {
-      return outputEncoding_;
-   }
-
-   public final void setOutputEncoding(String enc)
-   {
-      outputEncoding_ = enc;
-   }
-
-   public final String getInputEncoding()
-   {
-      return inputEncoding_;
-   }
-
-   public final void setInputEncoding(String enc)
-   {
-      inputEncoding_ = enc;
-   }
-
-   public final Locale getLocale()
-   {
-      return locale_;
-   }
-
-   public final void setLocale(Locale locale)
-   {
-      locale_ = locale;
-      if (localeName_ == null)
-         localeName_ = locale.getLanguage();
-   }
-
-   public final void setLocale(String localeName)
-   {
-      localeName_ = localeName;
-      locale_ = predefinedLocaleMap_.get(localeName);
-      if (locale_ == null)
-         locale_ = new Locale(localeName);
-   }
-
-   public final String getLanguage()
-   {
-      return locale_.getLanguage();
-   }
-
-   public final String getLocaleName()
-   {
-      return localeName_;
-   }
-
-   public final void setLocaleName(String localeName)
-   {
-      localeName_ = localeName;
-   }
-
-   public ResourceBundle getResourceBundle(String name)
-   {
-      ResourceBundleService service =
-         (ResourceBundleService)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(
-            ResourceBundleService.class);
-      ResourceBundle res = service.getResourceBundle(name, locale_);
-      return res;
-   }
-
-   public ResourceBundle getMergeResourceBundle(String[] names)
-   {
-      ResourceBundleService service =
-         (ResourceBundleService)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(
-            ResourceBundleService.class);
-      ResourceBundle res = service.getResourceBundle(names, locale_);
-      return res;
-   }
-
-   public ResourceBundle getNavigationResourceBundle(String ownerType, String ownerId)
-   {
-      return getResourceBundle("locale.navigation." + ownerType + "." + ownerId.replaceAll("/", "."));
-   }
-
-   public void setInput(HttpServletRequest req) throws java.io.UnsupportedEncodingException
-   {
-      req.setCharacterEncoding(inputEncoding_);
-   }
-
-   public void setOutput(HttpServletResponse res)
-   {
-      res.setContentType("text/html; charset=" + outputEncoding_);
-      res.setLocale(locale_);
-   }
-
-   public Orientation getOrientation()
-   {
-      return orientation;
-   }
-
-   public void setOrientation(Orientation orientation)
-   {
-      this.orientation = orientation;
-   }
-
-   @Override
-   public String toString()
-   {
-      return "LocaleConfig[" + "localeName=" + localeName_ + ",locale=" + locale_ + ",description=" + description_
-         + ",inputEncoding=" + inputEncoding_ + ",outputEncoding=" + outputEncoding_ + "]";
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigServiceImpl.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigServiceImpl.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigServiceImpl.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,181 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources.impl;
-
-import org.exoplatform.commons.utils.PropertyManager;
-import org.exoplatform.container.configuration.ConfigurationManager;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.log.Log;
-import org.exoplatform.services.resources.IdentityResourceBundle;
-import org.exoplatform.services.resources.LocaleConfig;
-import org.exoplatform.services.resources.LocaleConfigService;
-import org.exoplatform.services.resources.Orientation;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-/**
- * @author Benjamin Mestrallet benjamin.mestrallet at exoplatform.com This Service
- *         is used to manage the locales that the applications can handle
- */
-public class LocaleConfigServiceImpl implements LocaleConfigService
-{
-
-   private static Log log = ExoLogger.getLogger(LocaleConfigServiceImpl.class);
-
-   private LocaleConfig defaultConfig_;
-
-   private Map<String, LocaleConfig> configs_;
-
-   private static final Map<String, Orientation> orientations = new HashMap<String, Orientation>();
-
-   static
-   {
-      orientations.put("lt", Orientation.LT);
-      orientations.put("rt", Orientation.RT);
-      orientations.put("tl", Orientation.TL);
-      orientations.put("tr", Orientation.TR);
-   }
-
-   public LocaleConfigServiceImpl(InitParams params, ConfigurationManager cmanager) throws Exception
-   {
-      configs_ = new HashMap<String, LocaleConfig>(10);
-      String confResource = params.getValueParam("locale.config.file").getValue();
-      InputStream is = cmanager.getInputStream(confResource);
-      parseConfiguration(is);
-   }
-
-   /**
-    * @return Return the default LocaleConfig
-    */
-   public LocaleConfig getDefaultLocaleConfig()
-   {
-      return defaultConfig_;
-   }
-
-   /**
-    * @param lang a locale language
-    * @return The LocalConfig
-    */
-   public LocaleConfig getLocaleConfig(String lang)
-   {
-      LocaleConfig config = configs_.get(lang);
-      if (config != null)
-         return config;
-      return defaultConfig_;
-   }
-
-   /**
-    * @return All the LocalConfig that manage by the service
-    */
-   public Collection<LocaleConfig> getLocalConfigs()
-   {
-      return configs_.values();
-   }
-
-   private void parseConfiguration(InputStream is) throws Exception
-   {
-      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-      factory.setIgnoringComments(true);
-      factory.setCoalescing(true);
-      factory.setNamespaceAware(false);
-      factory.setValidating(false);
-      DocumentBuilder parser = factory.newDocumentBuilder();
-      Document document = parser.parse(is);
-      NodeList nodes = document.getElementsByTagName("locale-config");
-      for (int i = 0; i < nodes.getLength(); i++)
-      {
-         Node node = nodes.item(i);
-         NodeList children = node.getChildNodes();
-         LocaleConfig config = new LocaleConfigImpl();
-         for (int j = 0; j < children.getLength(); j++)
-         {
-            Node element = children.item(j);
-            if ("locale".equals(element.getNodeName()))
-            {
-               config.setLocale(element.getFirstChild().getNodeValue());
-            }
-            else if ("output-encoding".equals(element.getNodeName()))
-            {
-               config.setOutputEncoding(element.getFirstChild().getNodeValue());
-            }
-            else if ("input-encoding".equals(element.getNodeName()))
-            {
-               config.setInputEncoding(element.getFirstChild().getNodeValue());
-            }
-            else if ("description".equals(element.getNodeName()))
-            {
-               config.setDescription(element.getFirstChild().getNodeValue());
-            }
-            else if ("orientation".equals(element.getNodeName()))
-            {
-               String s = element.getFirstChild().getNodeValue();
-               Orientation orientation = orientations.get(s);
-               if (orientation == null)
-               {
-                  log.error("Wrong orientation value " + s);
-               }
-               else
-               {
-                  config.setOrientation(orientation);
-               }
-            }
-         }
-
-         //
-         if (config.getOrientation() == null)
-         {
-            log.debug("No orientation found on the locale config, use the LT default");
-            config.setOrientation(Orientation.LT);
-         }
-
-         //
-         log.debug("Added locale config " + config + " to the set of locale configs");
-
-         //
-         configs_.put(config.getLanguage(), config);
-         if (i == 0)
-            defaultConfig_ = config;
-      }
-
-      //
-      if (PropertyManager.isDevelopping())
-      {
-         LocaleConfig magicConfig = new LocaleConfigImpl();
-         magicConfig.setLocale(IdentityResourceBundle.MAGIC_LOCALE);
-         magicConfig.setDescription("Magic locale");
-         magicConfig.setInputEncoding("UTF-8");
-         magicConfig.setOutputEncoding("UTF-8");
-         magicConfig.setDescription("Default configuration for the debugging locale");
-         magicConfig.setOrientation(Orientation.LT);
-         configs_.put(magicConfig.getLanguage(), magicConfig);
-         log.debug("Added magic locale for debugging bundle usage at runtime");
-      }
-   }
-}

Deleted: portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/hibernate/ResourceBundleServiceImpl.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/hibernate/ResourceBundleServiceImpl.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/hibernate/ResourceBundleServiceImpl.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,176 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources.impl.hibernate;
-
-import org.exoplatform.commons.utils.MapResourceBundle;
-import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.services.cache.CacheService;
-import org.exoplatform.services.database.DBObjectPageList;
-import org.exoplatform.services.database.HibernateService;
-import org.exoplatform.services.database.ObjectQuery;
-import org.exoplatform.services.log.ExoLogger;
-import org.exoplatform.services.resources.ExoResourceBundle;
-import org.exoplatform.services.resources.LocaleConfigService;
-import org.exoplatform.services.resources.Query;
-import org.exoplatform.services.resources.ResourceBundleData;
-import org.exoplatform.services.resources.ResourceBundleDescription;
-import org.exoplatform.services.resources.impl.BaseResourceBundleService;
-import org.hibernate.Session;
-
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Created by The eXo Platform SAS. Author : Roman Pedchenko
- * roman.pedchenko at exoplatform.com.ua Apr 10, 2007
- */
-public class ResourceBundleServiceImpl extends BaseResourceBundleService
-{
-
-   /**
-    * Hibernate service.
-    */
-   private final HibernateService hService;
-
-   /**
-    * @param service hibernate service
-    * @param localeService locale service
-    * @param cService cache service
-    * @param params init parameters
-    * @throws Exception exception
-    */
-   public ResourceBundleServiceImpl(final HibernateService service, final LocaleConfigService localeService,
-      final CacheService cService, final InitParams params) throws Exception
-   {
-
-      log_ = ExoLogger.getLogger("org.exoplatform.services.portletcontainer");
-      cache_ = cService.getCacheInstance(getClass().getName());
-      localeService_ = localeService;
-      hService = service;
-
-      initParams(params);
-   }
-
-   /**
-    * Overridden method.
-    * 
-    * @param name name
-    * @return data
-    * @throws Exception exception
-    * @see org.exoplatform.services.resources.ResourceBundleService#getResourceBundleData(java.lang.String)
-    */
-   public final ResourceBundleData getResourceBundleData(final String name) throws Exception
-   {
-      return (ResourceBundleData)hService.findOne(ResourceBundleData.class, name);
-   }
-
-   /**
-    * Overridden method.
-    * 
-    * @param id id
-    * @return data
-    * @throws Exception exception
-    * @see org.exoplatform.services.resources.ResourceBundleService#removeResourceBundleData(java.lang.String)
-    */
-   public final ResourceBundleData removeResourceBundleData(final String id) throws Exception
-   {
-      ResourceBundleData data = (ResourceBundleData)hService.remove(ResourceBundleData.class, id);
-      cache_.remove(data.getId());
-      return data;
-   }
-
-   /**
-    * Overridden method.
-    * 
-    * @param q query
-    * @return page list
-    * @throws Exception exception
-    * @see org.exoplatform.services.resources.ResourceBundleService#findResourceDescriptions(org.exoplatform.services.resources.Query)
-    */
-   public final PageList findResourceDescriptions(final Query q) throws Exception
-   {
-      String name = q.getName();
-      if ((name == null) || (name.length() == 0))
-         name = "%";
-      ObjectQuery oq = new ObjectQuery(ResourceBundleDescription.class);
-      oq.addLIKE("name", name);
-      oq.addLIKE("language", q.getLanguage());
-      oq.setDescOrderBy("name");
-      return new DBObjectPageList(hService, oq);
-   }
-
-   /**
-    * Overridden method.
-    * 
-    * @param data data
-    * @throws Exception exception
-    * @see org.exoplatform.services.resources.ResourceBundleService#saveResourceBundle(org.exoplatform.services.resources.ResourceBundleData)
-    */
-   public final void saveResourceBundle(final ResourceBundleData data) throws Exception
-   {
-      hService.save(data);
-      cache_.remove(data.getId());
-   }
-
-   /**
-    * Overridden method.
-    * 
-    * @param id id
-    * @param parent parent
-    * @param locale locale
-    * @returnresource bundle
-    * @throws Exception exception
-    * @see org.exoplatform.services.resources.impl.BaseResourceBundleService#getResourceBundleFromDb(java.lang.String,
-    *      java.util.ResourceBundle, java.util.Locale)
-    */
-   protected final ResourceBundle getResourceBundleFromDb(final String id, final ResourceBundle parent,
-      final Locale locale) throws Exception
-   {
-
-      Session session = hService.openSession();
-      ResourceBundleData data = (ResourceBundleData)session.get(ResourceBundleData.class, id);
-      if (data != null)
-      {
-         ResourceBundle res = new ExoResourceBundle(data.getData(), parent);
-         MapResourceBundle mres = new MapResourceBundle(res, locale);
-         return mres;
-      }
-      // return null;
-
-      ResourceBundle rB;
-      try
-      {
-         rB = ResourceBundle.getBundle(id, locale, Thread.currentThread().getContextClassLoader());
-      }
-      catch (MissingResourceException e)
-      {
-         rB = null;
-      }
-      if (rB != null)
-      {
-         return new MapResourceBundle(rB, locale);
-
-      }
-      else
-         return null;
-   }
-}

Deleted: portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java
===================================================================
--- portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,84 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import junit.framework.TestCase;
-
-public class TestExoResourceBundle extends TestCase
-{
-
-   public void testConstructor()
-   {
-      ExoResourceBundle bundle;
-      bundle = new ExoResourceBundle("key1=value");
-      assertEquals(1, bundle.getContents().length);
-      assertEquals("value", bundle.getString("key1"));
-      bundle = new ExoResourceBundle("key1=value\nkey2=value");
-      assertEquals(2, bundle.getContents().length);
-      assertEquals("value", bundle.getString("key1"));
-      assertEquals("value", bundle.getString("key2"));
-      bundle = new ExoResourceBundle("key1=value\r\nkey2=value");
-      assertEquals(2, bundle.getContents().length);
-      assertEquals("value", bundle.getString("key1"));
-      assertEquals("value", bundle.getString("key2"));
-      bundle = new ExoResourceBundle("#comment\r\nkey2=value");
-      assertEquals(1, bundle.getContents().length);
-      assertEquals("value", bundle.getString("key2"));
-      bundle = new ExoResourceBundle("  #comment\r\nkey2=value");
-      assertEquals(1, bundle.getContents().length);
-      assertEquals("value", bundle.getString("key2"));
-      bundle = new ExoResourceBundle("  bad entry\r\nkey2=value");
-      assertEquals(1, bundle.getContents().length);
-      assertEquals("value", bundle.getString("key2"));
-      bundle = new ExoResourceBundle("#key1 =value\r\nkey2=value");
-      assertEquals(1, bundle.getContents().length);
-      assertEquals("value", bundle.getString("key2"));
-      bundle = new ExoResourceBundle(" key1 =value\r\n key2 =value");
-      assertEquals(2, bundle.getContents().length);
-      assertEquals("value", bundle.getString(" key1 "));
-      assertEquals("value", bundle.getString(" key2 "));
-   }
-
-   public void testUnicode2Char()
-   {
-      for (int i = 0; i < (1 << 16); i++)
-      {
-         String value = Integer.toHexString(i);
-         while (value.length() < 4)
-         {
-            value = "0" + value;
-         }
-         assertEquals((char)i, ExoResourceBundle.unicode2Char("\\u" + value));
-      }
-   }
-
-   public void testConvert()
-   {
-      assertEquals("Normal Value", ExoResourceBundle.convert("Normal Value"));
-      assertEquals("\u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", ExoResourceBundle
-         .convert("\\u00E9\\u00E7\\u00E0\\u00F9\\u0194\\u0BF5"));
-      assertEquals("before \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", ExoResourceBundle
-         .convert("before \\u00E9\\u00E7\\u00E0\\u00F9\\u0194\\u0BF5"));
-      assertEquals("\u00E9\u00E7\u00E0\u00F9\u0194\u0BF5 after", ExoResourceBundle
-         .convert("\\u00E9\\u00E7\\u00E0\\u00F9\\u0194\\u0BF5 after"));
-      assertEquals("before \u00E9\u00E7\u00E0 between \u00F9\u0194\u0BF5 after", ExoResourceBundle
-         .convert("before \\u00E9\\u00E7\\u00E0 between \\u00F9\\u0194\\u0BF5 after"));
-   }
-}

Deleted: portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestLocaleConfigService.java
===================================================================
--- portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestLocaleConfigService.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestLocaleConfigService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,134 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources;
-
-import junit.framework.TestCase;
-
-import org.exoplatform.commons.utils.PropertyManager;
-import org.exoplatform.container.configuration.ConfigurationManagerImpl;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.ValueParam;
-import org.exoplatform.services.resources.impl.LocaleConfigImpl;
-import org.exoplatform.services.resources.impl.LocaleConfigServiceImpl;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestLocaleConfigService extends TestCase
-{
-
-   public TestLocaleConfigService()
-   {
-   }
-
-   public TestLocaleConfigService(String s)
-   {
-      super(s);
-   }
-
-   public void testFoo() throws Exception
-   {
-      PropertyManager.setProperty(PropertyManager.DEVELOPING, "false");
-      LocaleConfigService service = createService();
-      Map<String, LocaleConfig> map = createMap(service);
-      assertEquals(4, map.size());
-      assertCommonConfigs(service);
-   }
-
-   public void testBar() throws Exception
-   {
-      PropertyManager.setProperty(PropertyManager.DEVELOPING, "true");
-      LocaleConfigService service = createService();
-      Map<String, LocaleConfig> map = createMap(service);
-      assertEquals(5, map.size());
-      assertCommonConfigs(service);
-      LocaleConfig ma = service.getLocaleConfig("ma");
-      assertLocaleConfig(ma, "ma", "Default configuration for the debugging locale", "UTF-8", "UTF-8", Orientation.LT,
-         IdentityResourceBundle.MAGIC_LOCALE);
-   }
-
-   public void testLocaleConfig() throws Exception
-   {
-      LocaleConfig ma = new LocaleConfigImpl();
-      ma.setLocale("ma");
-      assertEquals("ma", ma.getLocaleName());
-
-      LocaleConfig ma1 = new LocaleConfigImpl();
-      ma1.setLocale(new Locale("ma"));
-      assertEquals("ma", ma1.getLocaleName());
-   }
-
-   private Map<String, LocaleConfig> createMap(LocaleConfigService service)
-   {
-      Map<String, LocaleConfig> map = new HashMap<String, LocaleConfig>();
-      for (LocaleConfig config : service.getLocalConfigs())
-      {
-         map.put(config.getLanguage(), config);
-      }
-      return map;
-   }
-
-   private LocaleConfigService createService() throws Exception
-   {
-      ConfigurationManagerImpl cm = new ConfigurationManagerImpl();
-      InitParams params = new InitParams();
-      ValueParam param = new ValueParam();
-      param.setName("locale.config.file");
-      param.setValue("classpath:/resources/locales-config.xml");
-      params.addParameter(param);
-
-      //
-      LocaleConfigService service = new LocaleConfigServiceImpl(params, cm);
-      return service;
-   }
-
-   private void assertCommonConfigs(LocaleConfigService service)
-   {
-      LocaleConfig en = service.getLocaleConfig("en");
-      LocaleConfig fr = service.getLocaleConfig("fr");
-      LocaleConfig ar = service.getLocaleConfig("ar");
-      LocaleConfig vi = service.getLocaleConfig("vi");
-      assertLocaleConfig(en, "en", "Default configuration for english locale", "UTF-8", "UTF-8", Orientation.LT,
-         Locale.ENGLISH);
-      assertLocaleConfig(fr, "fr", "Default configuration for the french locale", "UTF-8", "UTF-8", Orientation.LT,
-         Locale.FRANCE);
-      assertLocaleConfig(ar, "ar", "Default configuration for the arabic locale", "UTF-8", "UTF-8", Orientation.RT,
-         new Locale("ar"));
-      assertLocaleConfig(vi, "vi", "Default configuration for the vietnam locale", "UTF-8", "UTF-8", Orientation.LT,
-         new Locale("vi"));
-   }
-
-   private void assertLocaleConfig(LocaleConfig config, String language, String description, String inputEncoding,
-      String outputEncoding, Orientation orientation, Locale locale)
-   {
-      assertNotNull(config);
-      assertEquals(language, config.getLanguage());
-      assertEquals(description, config.getDescription());
-      assertEquals(inputEncoding, config.getInputEncoding());
-      assertEquals(outputEncoding, config.getOutputEncoding());
-      assertEquals(orientation, config.getOrientation());
-      assertEquals(locale, config.getLocale());
-   }
-}

Deleted: portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/impl/TesBaseResourceBundleService.java
===================================================================
--- portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/impl/TesBaseResourceBundleService.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/impl/TesBaseResourceBundleService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,483 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.resources.impl;
-
-import junit.framework.TestCase;
-
-import org.exoplatform.commons.utils.MapResourceBundle;
-import org.exoplatform.commons.utils.PageList;
-import org.exoplatform.container.configuration.ConfigurationManagerImpl;
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.container.xml.ValueParam;
-import org.exoplatform.services.cache.CacheListener;
-import org.exoplatform.services.cache.CachedObjectSelector;
-import org.exoplatform.services.cache.ExoCache;
-import org.exoplatform.services.resources.ExoResourceBundle;
-import org.exoplatform.services.resources.LocaleConfigService;
-import org.exoplatform.services.resources.Query;
-import org.exoplatform.services.resources.ResourceBundleData;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-public class TesBaseResourceBundleService extends TestCase
-{
-
-   @Override
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      // Any language
-      Locale.setDefault(new Locale("xxx", "xxx"));
-   }
-
-   public void testResourceBundleContent() throws Exception
-   {
-      BaseResourceBundleService service = new MyResourceBundleService(false);
-      String content;
-      // Simple resource bundle
-      content =
-         service.getResourceBundleContent("locale/test/myRB1", "en", "en", Thread.currentThread()
-            .getContextClassLoader());
-      assertTrue(content.contains("my.key1=My New Value In English"));
-      assertTrue(content.contains("my.key3=My New Value In English"));
-      content =
-         service.getResourceBundleContent("locale/test/myRB1", "fr", "en", Thread.currentThread()
-            .getContextClassLoader());
-      assertTrue(content
-         .contains("my.key1=My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-      assertTrue(content
-         .contains("my.key2=My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-      content =
-         service.getResourceBundleContent("locale/test/myRB2", "en", "en", Thread.currentThread()
-            .getContextClassLoader());
-      assertTrue(content.contains("my.key1=My New Value In English"));
-      assertTrue(content.contains("my.key3=My New Value In English"));
-      content =
-         service.getResourceBundleContent("locale/test/myRB2", "fr", "en", Thread.currentThread()
-            .getContextClassLoader());
-      assertTrue(content
-         .contains("my.key1=My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-      assertTrue(content
-         .contains("my.key2=My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-      // Multiple resources bundles
-      content = service.getResourceBundleContent("locale/test/myRB1", "en", "en", new MyClassLoader());
-      assertTrue(content.contains("my.key1=My New Value In English"));
-      assertTrue(content.contains("my.key2=My New Value In English v2"));
-      assertTrue(content.contains("my.key3=My New Value In English v2"));
-      content = service.getResourceBundleContent("locale/test/myRB1", "fr", "en", new MyClassLoader());
-      assertTrue(content
-         .contains("my.key1=My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-      assertTrue(content
-         .contains("my.key2=My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-      assertTrue(content
-         .contains("my.key3=My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-      content = service.getResourceBundleContent("locale/test/myRB2", "en", "en", new MyClassLoader());
-      assertTrue(content.contains("my.key1=My New Value In English"));
-      assertTrue(content.contains("my.key2=My New Value In English v2"));
-      assertTrue(content.contains("my.key3=My New Value In English v2"));
-      content = service.getResourceBundleContent("locale/test/myRB2", "fr", "en", new MyClassLoader());
-      assertTrue(content
-         .contains("my.key1=My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-      assertTrue(content
-         .contains("my.key2=My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-      assertTrue(content
-         .contains("my.key3=My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5"));
-   }
-
-   public void testGetResourceBundle() throws Exception
-   {
-      BaseResourceBundleService service = new MyResourceBundleService(true);
-      ResourceBundle rb;
-      rb =
-         service.getResourceBundle("locale.test.myRB1", Locale.ENGLISH, Thread.currentThread().getContextClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My Default Value In English", rb.getString("my.key2"));
-      assertEquals("My New Value In English", rb.getString("my.key3"));
-      rb =
-         service.getResourceBundle("locale.test.myRB1", Locale.FRENCH, Thread.currentThread().getContextClassLoader());
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key1"));
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key2"));
-      assertEquals("My Default Value In English", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB1", Locale.JAPAN, Thread.currentThread().getContextClassLoader());
-      assertEquals("My Default Value In English", rb.getString("my.key1"));
-      assertEquals("My Default Value In English", rb.getString("my.key2"));
-      assertEquals("My Default Value In English", rb.getString("my.key3"));
-      rb =
-         service.getResourceBundle("locale.test.myRB2", Locale.ENGLISH, Thread.currentThread().getContextClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My Default Value In English", rb.getString("my.key2"));
-      assertEquals("My New Value In English", rb.getString("my.key3"));
-      rb =
-         service.getResourceBundle("locale.test.myRB2", Locale.FRENCH, Thread.currentThread().getContextClassLoader());
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key1"));
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key2"));
-      assertEquals("My Default Value In English", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB2", Locale.JAPAN, Thread.currentThread().getContextClassLoader());
-      assertEquals("My Default Value In English", rb.getString("my.key1"));
-      assertEquals("My Default Value In English", rb.getString("my.key2"));
-      assertEquals("My Default Value In English", rb.getString("my.key3"));
-      service = new MyResourceBundleService(false);
-      rb =
-         service.getResourceBundle("locale.test.myRB1", Locale.ENGLISH, Thread.currentThread().getContextClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English", rb.getString("my.key3"));
-      rb =
-         service.getResourceBundle("locale.test.myRB1", Locale.FRENCH, Thread.currentThread().getContextClassLoader());
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key1"));
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key2"));
-      assertEquals("My New Value In English", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB1", Locale.JAPAN, Thread.currentThread().getContextClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English", rb.getString("my.key3"));
-      rb =
-         service.getResourceBundle("locale.test.myRB2", Locale.ENGLISH, Thread.currentThread().getContextClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English", rb.getString("my.key3"));
-      rb =
-         service.getResourceBundle("locale.test.myRB2", Locale.FRENCH, Thread.currentThread().getContextClassLoader());
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key1"));
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key2"));
-      assertEquals("My New Value In English", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB2", Locale.JAPAN, Thread.currentThread().getContextClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English", rb.getString("my.key3"));
-      // Multiple resources bundles
-      service = new MyResourceBundleService(new MyClassLoader(), true);
-      rb = service.getResourceBundle("locale.test.myRB1", Locale.ENGLISH, new MyClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English v2", rb.getString("my.key2"));
-      assertEquals("My New Value In English v2", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB1", Locale.FRENCH, new MyClassLoader());
-      assertEquals("My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key1"));
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key2"));
-      assertEquals("My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB1", Locale.JAPAN, new MyClassLoader());
-      assertEquals("My Default Value In English v2", rb.getString("my.key1"));
-      assertEquals("My Default Value In English", rb.getString("my.key2"));
-      assertEquals("My Default Value In English", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB2", Locale.ENGLISH, new MyClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English v2", rb.getString("my.key2"));
-      assertEquals("My New Value In English v2", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB2", Locale.FRENCH, new MyClassLoader());
-      assertEquals("My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key1"));
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key2"));
-      assertEquals("My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB2", Locale.JAPAN, new MyClassLoader());
-      assertEquals("My Default Value In English v2", rb.getString("my.key1"));
-      assertEquals("My Default Value In English", rb.getString("my.key2"));
-      assertEquals("My Default Value In English", rb.getString("my.key3"));
-      service = new MyResourceBundleService(new MyClassLoader(), false);
-      rb = service.getResourceBundle("locale.test.myRB1", Locale.ENGLISH, new MyClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English v2", rb.getString("my.key2"));
-      assertEquals("My New Value In English v2", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB1", Locale.FRENCH, new MyClassLoader());
-      assertEquals("My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key1"));
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key2"));
-      assertEquals("My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB1", Locale.JAPAN, new MyClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English v2", rb.getString("my.key2"));
-      assertEquals("My New Value In English v2", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB2", Locale.ENGLISH, new MyClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English v2", rb.getString("my.key2"));
-      assertEquals("My New Value In English v2", rb.getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB2", Locale.FRENCH, new MyClassLoader());
-      assertEquals("My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key1"));
-      assertEquals("My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key2"));
-      assertEquals("My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", rb
-         .getString("my.key3"));
-      rb = service.getResourceBundle("locale.test.myRB2", Locale.JAPAN, new MyClassLoader());
-      assertEquals("My New Value In English", rb.getString("my.key1"));
-      assertEquals("My New Value In English v2", rb.getString("my.key2"));
-      assertEquals("My New Value In English v2", rb.getString("my.key3"));
-   }
-
-   public void testInitResources() throws Exception
-   {
-      MyResourceBundleService service = new MyResourceBundleService(true);
-      service.initResources("locale.test.myRB1", Thread.currentThread().getContextClassLoader());
-      assertEquals(2, service.getRbs().size());
-      service.getRbs().clear();
-      service.initResources("locale.test.myRB2", Thread.currentThread().getContextClassLoader());
-      assertEquals(2, service.getRbs().size());
-   }
-
-   private static class MyResourceBundleService extends BaseResourceBundleService
-   {
-
-      private ClassLoader classLoader;
-
-      private boolean isClasspathResource;
-
-      private List<ResourceBundleData> rbs = new ArrayList<ResourceBundleData>();
-
-      public MyResourceBundleService(boolean isClasspathResource) throws Exception
-      {
-         this(Thread.currentThread().getContextClassLoader(), isClasspathResource);
-      }
-
-      public MyResourceBundleService(ClassLoader classLoader, boolean isClasspathResource) throws Exception
-      {
-         this.classLoader = classLoader;
-         this.isClasspathResource = isClasspathResource;
-         this.localeService_ = createService();
-         this.cache_ = new ExoCache()
-         {
-
-            public void addCacheListener(CacheListener arg0)
-            {
-            }
-
-            public void clearCache()
-            {
-            }
-
-            public Object get(Serializable arg0)
-            {
-               return null;
-            }
-
-            public int getCacheHit()
-            {
-               return 0;
-            }
-
-            public int getCacheMiss()
-            {
-               return 0;
-            }
-
-            public int getCacheSize()
-            {
-               return 0;
-            }
-
-            public List getCachedObjects()
-            {
-               return null;
-            }
-
-            public String getLabel()
-            {
-               return null;
-            }
-
-            public long getLiveTime()
-            {
-               return 0;
-            }
-
-            public int getMaxSize()
-            {
-               return 0;
-            }
-
-            public String getName()
-            {
-               return null;
-            }
-
-            public boolean isDistributed()
-            {
-               return false;
-            }
-
-            public boolean isLogEnabled()
-            {
-               return false;
-            }
-
-            public boolean isReplicated()
-            {
-               return false;
-            }
-
-            public void put(Serializable arg0, Object arg1)
-            {
-            }
-
-            public void putMap(Map arg0)
-            {
-            }
-
-            public Object remove(Serializable arg0)
-            {
-               return null;
-            }
-
-            public List removeCachedObjects()
-            {
-               return null;
-            }
-
-            public void select(CachedObjectSelector arg0) throws Exception
-            {
-            }
-
-            public void setDistributed(boolean arg0)
-            {
-            }
-
-            public void setLabel(String arg0)
-            {
-            }
-
-            public void setLiveTime(long arg0)
-            {
-            }
-
-            public void setLogEnabled(boolean arg0)
-            {
-            }
-
-            public void setMaxSize(int arg0)
-            {
-            }
-
-            public void setName(String arg0)
-            {
-            }
-
-            public void setReplicated(boolean arg0)
-            {
-            }
-
-         };
-      }
-
-      private LocaleConfigService createService() throws Exception
-      {
-         ConfigurationManagerImpl cm = new ConfigurationManagerImpl();
-         InitParams params = new InitParams();
-         ValueParam param = new ValueParam();
-         param.setName("locale.config.file");
-         param.setValue("classpath:/resources/locales-config.xml");
-         params.addParameter(param);
-
-         //
-         LocaleConfigService service = new LocaleConfigServiceImpl(params, cm);
-         return service;
-      }
-
-      @Override
-      protected boolean isClasspathResource(String name)
-      {
-         return isClasspathResource;
-      }
-
-      @Override
-      protected ResourceBundle getResourceBundleFromDb(String id, ResourceBundle parent, Locale locale)
-         throws Exception
-      {
-         String language = locale.getLanguage();
-         int index = id.indexOf('_');
-         if (index >= 0)
-         {
-            language = id.substring(index + 1);
-            id = id.substring(0, index);
-         }
-         String content = getResourceBundleContent(id.replace('.', '/'), language, "en", classLoader);
-         if (content == null)
-         {
-            return null;
-         }
-         ResourceBundle result = new ExoResourceBundle(content, parent);
-         return new MapResourceBundle(result, locale);
-      }
-
-      public PageList findResourceDescriptions(Query q) throws Exception
-      {
-         return null;
-      }
-
-      public ResourceBundleData getResourceBundleData(String id) throws Exception
-      {
-         return null;
-      }
-
-      public ResourceBundleData removeResourceBundleData(String id) throws Exception
-      {
-         return null;
-      }
-
-      public void saveResourceBundle(ResourceBundleData data) throws Exception
-      {
-         rbs.add(data);
-      }
-
-      public List<ResourceBundleData> getRbs()
-      {
-         return rbs;
-      }
-   }
-
-   private static class MyClassLoader extends ClassLoader
-   {
-
-      public MyClassLoader()
-      {
-         super(Thread.currentThread().getContextClassLoader());
-      }
-
-      @Override
-      public Enumeration<URL> getResources(String name) throws IOException
-      {
-         List<URL> result = new ArrayList<URL>();
-         URL url = super.getResource(name);
-         if (url != null)
-         {
-            result.add(url);
-            result.add(super.getResource(name.replace(".", "-2.")));
-         }
-         return Collections.enumeration(result);
-      }
-   }
-}

Modified: portal/trunk/component/pc/src/main/java/org/exoplatform/portal/pc/ExoKernelIntegration.java
===================================================================
--- portal/trunk/component/pc/src/main/java/org/exoplatform/portal/pc/ExoKernelIntegration.java	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/pc/src/main/java/org/exoplatform/portal/pc/ExoKernelIntegration.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -21,7 +21,6 @@
 
 import org.exoplatform.container.ExoContainer;
 import org.exoplatform.container.ExoContainerContext;
-import org.exoplatform.services.resources.ResourceBundleService;
 import org.gatein.pc.api.PortletInvoker;
 import org.gatein.pc.federation.FederatingPortletInvoker;
 import org.gatein.pc.federation.impl.FederatingPortletInvokerService;
@@ -61,7 +60,7 @@
     * We enforce the dependency with the ResourceBundleService since it must be stared before the
     * <code>portletApplicationRegistry</code>
     */
-   public ExoKernelIntegration(ExoContainerContext context, ResourceBundleService resourceBundleService)
+   public ExoKernelIntegration(ExoContainerContext context)
    {
       this.container = context.getContainer();
    }

Modified: portal/trunk/component/resources/pom.xml
===================================================================
--- portal/trunk/component/resources/pom.xml	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/resources/pom.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -32,10 +32,6 @@
   <name>GateIn Portal Component Resources</name>
   <description>resources data service...</description>
 
-  <properties>
-    <maven.test.skip>true</maven.test.skip>
-  </properties>
-
   <dependencies>
     <dependency>
       <groupId>org.exoplatform.kernel</groupId>
@@ -90,5 +86,12 @@
       <artifactId>exo.portal.component.common</artifactId>
       <version>3.0.0-CR01-SNAPSHOT</version>
     </dependency>
+
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>3.8.1</version>
+        <scope>test</scope>
+      </dependency>
   </dependencies>
 </project>

Modified: portal/trunk/component/resources/src/main/java/conf/portal/configuration.xml
===================================================================
--- portal/trunk/component/resources/src/main/java/conf/portal/configuration.xml	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/resources/src/main/java/conf/portal/configuration.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -30,7 +30,7 @@
   
   <component>
     <key>org.exoplatform.services.resources.ResourceBundleService</key>
-    <type>org.exoplatform.services.resources.jcr.ResourceBundleServiceImpl</type>
+    <type>org.exoplatform.services.resources.impl.SimpleResourceBundleService</type>
     <init-params>
       <values-param>
         <name>classpath.resources</name>

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/config (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/config)

Deleted: portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationData.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/config/ConfigurationData.java	2009-11-13 22:36:33 UTC (rev 597)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationData.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,63 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.config;
-
-/**
- * @author Tuan Nguyen (tuan08 at users.sourceforge.net)
- * @since Dec 5, 2004
- * @version $Id: ConfigurationDataImpl.java 5799 2006-05-28 17:55:42Z geaz $
- * @hibernate.class table="EXO_SERVICE_CONFIG"
- * @hibernate.cache usage="read-write"
- */
-public class ConfigurationData
-{
-
-   private String serviceType;
-
-   private String data;
-
-   /**
-    * @hibernate.id generator-class="assigned" unsaved-value="null"
-    ***/
-   public String getServiceType()
-   {
-      return serviceType;
-   }
-
-   public void setServiceType(String s)
-   {
-      serviceType = s;
-   }
-
-   /**
-    * @hibernate.property length="65535"
-    *                     type="org.exoplatform.services.database.impl.TextClobType"
-    **/
-   public String getData()
-   {
-      return data;
-   }
-
-   public String setData(String s)
-   {
-      return data = s;
-   }
-
-}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationData.java (from rev 610, portal/trunk/component/common/src/main/java/org/exoplatform/services/config/ConfigurationData.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationData.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationData.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,63 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.config;
+
+/**
+ * @author Tuan Nguyen (tuan08 at users.sourceforge.net)
+ * @since Dec 5, 2004
+ * @version $Id: ConfigurationDataImpl.java 5799 2006-05-28 17:55:42Z geaz $
+ * @hibernate.class table="EXO_SERVICE_CONFIG"
+ * @hibernate.cache usage="read-write"
+ */
+public class ConfigurationData
+{
+
+   private String serviceType;
+
+   private String data;
+
+   /**
+    * @hibernate.id generator-class="assigned" unsaved-value="null"
+    ***/
+   public String getServiceType()
+   {
+      return serviceType;
+   }
+
+   public void setServiceType(String s)
+   {
+      serviceType = s;
+   }
+
+   /**
+    * @hibernate.property length="65535"
+    *                     type="org.exoplatform.services.database.impl.TextClobType"
+    **/
+   public String getData()
+   {
+      return data;
+   }
+
+   public String setData(String s)
+   {
+      return data = s;
+   }
+
+}

Deleted: portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationService.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/config/ConfigurationService.java	2009-11-13 22:36:33 UTC (rev 597)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,34 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.config;
-
-/**
- * @author Tuan Nguyen (tuan08 at users.sourceforge.net)
- * @since Dec 5, 2004
- * @version $Id: ConfigurationService.java 5799 2006-05-28 17:55:42Z geaz $
- */
-public interface ConfigurationService
-{
-   public Object getServiceConfiguration(Class serviceType) throws Exception;
-
-   public void saveServiceConfiguration(Class serviceType, Object config) throws Exception;
-
-   public void removeServiceConfiguration(Class serviceType) throws Exception;
-}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationService.java (from rev 610, portal/trunk/component/common/src/main/java/org/exoplatform/services/config/ConfigurationService.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationService.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,34 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.config;
+
+/**
+ * @author Tuan Nguyen (tuan08 at users.sourceforge.net)
+ * @since Dec 5, 2004
+ * @version $Id: ConfigurationService.java 5799 2006-05-28 17:55:42Z geaz $
+ */
+public interface ConfigurationService
+{
+   public Object getServiceConfiguration(Class serviceType) throws Exception;
+
+   public void saveServiceConfiguration(Class serviceType, Object config) throws Exception;
+
+   public void removeServiceConfiguration(Class serviceType) throws Exception;
+}

Deleted: portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationServiceImpl.java
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/services/config/ConfigurationServiceImpl.java	2009-11-13 22:36:33 UTC (rev 597)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationServiceImpl.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,96 +0,0 @@
-/**
- * Copyright (C) 2009 eXo Platform SAS.
- * 
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.exoplatform.services.config;
-
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.XppDriver;
-
-import org.exoplatform.services.database.HibernateService;
-
-/**
- * @author Tuan Nguyen (tuan08 at users.sourceforge.net)
- * @since Dec 5, 2004
- * @version $Id: ConfigurationServiceImpl.java 5799 2006-05-28 17:55:42Z geaz $
- */
-public class ConfigurationServiceImpl implements ConfigurationService
-{
-
-   private HibernateService hservice_;
-
-   private XStream xstream_;
-
-   public ConfigurationServiceImpl(HibernateService service)
-   {
-      hservice_ = service;
-      xstream_ = new XStream(new XppDriver());
-   }
-
-   public Object getServiceConfiguration(Class serviceType) throws Exception
-   {
-      ConfigurationData impl = (ConfigurationData)hservice_.findOne(ConfigurationData.class, serviceType.getName());
-      Object obj = null;
-      if (impl == null)
-      {
-         obj = loadDefaultConfig(serviceType);
-         saveServiceConfiguration(serviceType, obj);
-      }
-      else
-      {
-         obj = xstream_.fromXML(impl.getData());
-      }
-      return obj;
-   }
-
-   public void saveServiceConfiguration(Class serviceType, Object config) throws Exception
-   {
-      ConfigurationData configData =
-         (ConfigurationData)hservice_.findOne(ConfigurationData.class, serviceType.getName());
-      String xml = xstream_.toXML(config);
-      if (configData == null)
-      {
-         configData = new ConfigurationData();
-         configData.setServiceType(serviceType.getName());
-         configData.setData(xml);
-         hservice_.create(configData);
-      }
-      else
-      {
-         configData.setData(xml);
-         hservice_.update(configData);
-      }
-   }
-
-   public void removeServiceConfiguration(Class serviceType) throws Exception
-   {
-      hservice_.remove(serviceType, serviceType.getName());
-   }
-
-   @SuppressWarnings("unused")
-   private Object loadDefaultConfig(Class serviceType) throws Exception
-   {
-      // ServiceConfiguration sconf =
-      // manager_.getServiceConfiguration(serviceType) ;
-      // Iterator i = sconf.values().iterator() ;
-      // ObjectParam param = (ObjectParam) i.next() ;
-      // return param.getObject() ;
-      return null;
-   }
-
-}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationServiceImpl.java (from rev 610, portal/trunk/component/common/src/main/java/org/exoplatform/services/config/ConfigurationServiceImpl.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationServiceImpl.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/config/ConfigurationServiceImpl.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,96 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.config;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.xml.XppDriver;
+
+import org.exoplatform.services.database.HibernateService;
+
+/**
+ * @author Tuan Nguyen (tuan08 at users.sourceforge.net)
+ * @since Dec 5, 2004
+ * @version $Id: ConfigurationServiceImpl.java 5799 2006-05-28 17:55:42Z geaz $
+ */
+public class ConfigurationServiceImpl implements ConfigurationService
+{
+
+   private HibernateService hservice_;
+
+   private XStream xstream_;
+
+   public ConfigurationServiceImpl(HibernateService service)
+   {
+      hservice_ = service;
+      xstream_ = new XStream(new XppDriver());
+   }
+
+   public Object getServiceConfiguration(Class serviceType) throws Exception
+   {
+      ConfigurationData impl = (ConfigurationData)hservice_.findOne(ConfigurationData.class, serviceType.getName());
+      Object obj = null;
+      if (impl == null)
+      {
+         obj = loadDefaultConfig(serviceType);
+         saveServiceConfiguration(serviceType, obj);
+      }
+      else
+      {
+         obj = xstream_.fromXML(impl.getData());
+      }
+      return obj;
+   }
+
+   public void saveServiceConfiguration(Class serviceType, Object config) throws Exception
+   {
+      ConfigurationData configData =
+         (ConfigurationData)hservice_.findOne(ConfigurationData.class, serviceType.getName());
+      String xml = xstream_.toXML(config);
+      if (configData == null)
+      {
+         configData = new ConfigurationData();
+         configData.setServiceType(serviceType.getName());
+         configData.setData(xml);
+         hservice_.create(configData);
+      }
+      else
+      {
+         configData.setData(xml);
+         hservice_.update(configData);
+      }
+   }
+
+   public void removeServiceConfiguration(Class serviceType) throws Exception
+   {
+      hservice_.remove(serviceType, serviceType.getName());
+   }
+
+   @SuppressWarnings("unused")
+   private Object loadDefaultConfig(Class serviceType) throws Exception
+   {
+      // ServiceConfiguration sconf =
+      // manager_.getServiceConfiguration(serviceType) ;
+      // Iterator i = sconf.values().iterator() ;
+      // ObjectParam param = (ObjectParam) i.next() ;
+      // return param.getObject() ;
+      return null;
+   }
+
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ExoResourceBundle.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,161 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.ListResourceBundle;
+import java.util.Map;
+import java.util.ResourceBundle;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * May 7, 2004
+ * 
+ * @author: Tuan Nguyen
+ * @email: tuan08 at users.sourceforge.net
+ * @version: $Id: ExoResourceBundle.java 9439 2006-10-12 03:28:53Z thuannd $
+ **/
+ at SuppressWarnings("serial")
+public class ExoResourceBundle extends ListResourceBundle implements Serializable
+{
+
+   private static Pattern LINE_SEPARATOR = Pattern.compile("[\\r]?\\n");
+
+   private static Pattern UNICODE_CHARACTER = Pattern.compile("\\\\u[\\p{XDigit}]{4}+");
+
+   private Object[][] contents;
+
+   public ExoResourceBundle(String data)
+   {
+      String[] tokens = LINE_SEPARATOR.split(data);
+      List<String[]> properties = new ArrayList<String[]>();
+      for (String token : tokens)
+      {
+         int idx = token.indexOf('=');
+         if (idx < 0 || idx >= token.length() - 1)
+         {
+            continue;
+         }
+         String key = token.substring(0, idx);
+         if (key.trim().startsWith("#"))
+         {
+            continue;
+         }
+         String value = convert(token.substring(idx + 1, token.length()));
+         properties.add(new String[]{key, value});
+      }
+      String[][] aProperties = new String[properties.size()][2];
+      contents = (String[][])properties.toArray(aProperties);
+   }
+
+   public ExoResourceBundle(String data, ResourceBundle parent)
+   {
+      this(data);
+      setParent(parent);
+   }
+
+   public Object[][] getContents()
+   {
+      return contents;
+   }
+
+   public void putAll(Map<? super Object, ? super Object> map)
+   {
+      Enumeration<String> keys = getKeys();
+      while (keys.hasMoreElements())
+      {
+         String key = keys.nextElement();
+         if (key != null)
+         {
+            map.put(key, getString(key));
+         }
+      }
+   }
+
+   static String convert(String content)
+   {
+      Matcher matcher = UNICODE_CHARACTER.matcher(content);
+      StringBuilder buffer = new StringBuilder(content.length());
+      int start = 0;
+      while (matcher.find(start))
+      {
+         buffer.append(content.substring(start, matcher.start()));
+         buffer.append(unicode2Char(matcher.group()));
+         start = matcher.end();
+      }
+      if (start >= 0 && start < content.length())
+      {
+         buffer.append(content.substring(start));
+      }
+      return buffer.toString();
+   }
+
+   static char unicode2Char(String unicodeChar)
+   {
+      int value = 0;
+      char aChar;
+      for (int i = 0; i < 4; i++)
+      {
+         aChar = unicodeChar.charAt(i + 2);
+         switch (aChar)
+         {
+            case '0' :
+            case '1' :
+            case '2' :
+            case '3' :
+            case '4' :
+            case '5' :
+            case '6' :
+            case '7' :
+            case '8' :
+            case '9' : {
+               value = (value << 4) + aChar - '0';
+               break;
+            }
+            case 'a' :
+            case 'b' :
+            case 'c' :
+            case 'd' :
+            case 'e' :
+            case 'f' : {
+               value = (value << 4) + 10 + aChar - 'a';
+               break;
+            }
+            case 'A' :
+            case 'B' :
+            case 'C' :
+            case 'D' :
+            case 'E' :
+            case 'F' : {
+               value = (value << 4) + 10 + aChar - 'A';
+               break;
+            }
+            default : {
+               throw new IllegalArgumentException("Malformed \\uxxxx encoding.");
+            }
+         }
+      }
+      return (char)value;
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/IdentityResourceBundle.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,58 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Vector;
+
+/**
+ * A resource bundle that returns the queried key. It returns an empty enumeration when the keys are queried.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class IdentityResourceBundle extends ResourceBundle
+{
+
+   public static final String MAGIC_LANGUAGE = "ma".intern();
+
+   public static final Locale MAGIC_LOCALE = new Locale(MAGIC_LANGUAGE);
+
+   private static final Vector<String> EMPTY_KEYS = new Vector<String>();
+
+   private static final IdentityResourceBundle instance = new IdentityResourceBundle();
+
+   public static ResourceBundle getInstance()
+   {
+      return instance;
+   }
+
+   protected Object handleGetObject(String key)
+   {
+      return key;
+   }
+
+   public Enumeration<String> getKeys()
+   {
+      return EMPTY_KEYS.elements();
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/InputStreamURLConnection.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLConnection.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/InputStreamURLConnection.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/InputStreamURLConnection.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,68 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+/**
+ * An URLConnection extension that use a local {@link java.io.InputStream} object.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InputStreamURLConnection extends URLConnection
+{
+
+   private final InputStream in;
+
+   /**
+    * Creates a new connection.
+    *
+    * @param url the original URL
+    * @param in the input stream
+    * @throws IllegalArgumentException if the stream is null
+    */
+   public InputStreamURLConnection(URL url, InputStream in) throws IllegalArgumentException
+   {
+      super(url);
+
+      //
+      if (in == null)
+      {
+         throw new IllegalArgumentException("No null input stream accepted");
+      }
+
+      //
+      this.in = in;
+   }
+
+   public void connect() throws IOException
+   {
+      // no op
+   }
+
+   public InputStream getInputStream() throws IOException
+   {
+      return in;
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/InputStreamURLStreamHandler.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/InputStreamURLStreamHandler.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/InputStreamURLStreamHandler.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/InputStreamURLStreamHandler.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,62 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+/**
+ * An URLStreamHandler extension that use a local {@link java.io.InputStream} object. This object will always use
+ * the stream provided and nothing else. So the life time of an instance is very limited.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class InputStreamURLStreamHandler extends URLStreamHandler
+{
+
+   private final InputStream in;
+
+   /**
+    * Creates a new handler.
+    *
+    * @param in the input stream
+    * @throws IllegalArgumentException if the stream is null
+    */
+   public InputStreamURLStreamHandler(InputStream in) throws IllegalArgumentException
+   {
+      if (in == null)
+      {
+         throw new IllegalArgumentException("No null input stream accepted");
+      }
+
+      //
+      this.in = in;
+   }
+
+   protected URLConnection openConnection(URL u) throws IOException
+   {
+      return new InputStreamURLConnection(u, in);
+   }
+
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/LocaleConfig.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfig.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/LocaleConfig.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/LocaleConfig.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,84 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * May 3, 2004
+ * 
+ * @author: Tuan Nguyen
+ * @email: tuan08 at users.sourceforge.net
+ * @version: $Id: LocaleConfig.java 5799 2006-05-28 17:55:42Z geaz $
+ **/
+public interface LocaleConfig
+{
+
+   public String getDescription();
+
+   public void setDescription(String desc);
+
+   public String getOutputEncoding();
+
+   public void setOutputEncoding(String enc);
+
+   public String getInputEncoding();
+
+   public void setInputEncoding(String enc);
+
+   public Locale getLocale();
+
+   public void setLocale(Locale locale);
+
+   public void setLocale(String localeName);
+
+   public String getLanguage();
+
+   public String getLocaleName();
+
+   public ResourceBundle getResourceBundle(String name);
+
+   public ResourceBundle getMergeResourceBundle(String[] names);
+
+   public ResourceBundle getNavigationResourceBundle(String ownerType, String ownerId);
+
+   public void setInput(HttpServletRequest req) throws java.io.UnsupportedEncodingException;
+
+   public void setOutput(HttpServletResponse res);
+
+   /**
+    * Returns the orientation of the locale config.
+    *
+    * @return the orientation
+    */
+   public Orientation getOrientation();
+
+   /**
+    * Updates the orientation of the locale config.
+    *
+    * @param orientation the new orientation
+    */
+   public void setOrientation(Orientation orientation);
+
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/LocaleConfigService.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/LocaleConfigService.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/LocaleConfigService.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/LocaleConfigService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import java.util.Collection;
+
+/**
+ * @author Benjamin Mestrallet benjamin.mestrallet at exoplatform.com This Service
+ *         is used to manage the locales that the applications can handle
+ */
+public interface LocaleConfigService
+{
+
+   /**
+    * @return Return the default LocaleConfig
+    */
+   public LocaleConfig getDefaultLocaleConfig();
+
+   /**
+    * @param lang a locale language
+    * @return The LocalConfig
+    */
+   public LocaleConfig getLocaleConfig(String lang);
+
+   /**
+    * @return All the LocalConfig that manage by the service
+    */
+   public Collection<LocaleConfig> getLocalConfigs();
+
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/Orientation.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Orientation.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/Orientation.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/Orientation.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,85 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+/**
+ * An orientation.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public enum Orientation {
+
+   LT(0), // Western Europe
+
+   RT(1), // Middle East (Arabic, Hebrew)
+
+   TL(2), // Japanese, Chinese, Korean
+
+   TR(3); // Mongolian
+
+   private final int ordinal;
+
+   Orientation(int ordinal)
+   {
+      this.ordinal = ordinal;
+   }
+
+   /**
+    * Indicates whether the Locale correspond to an LT orientation.
+    *  
+    * @return true if the orientation is LT
+    */
+   public boolean isLT()
+   {
+      return ordinal == 0;
+   }
+
+   /**
+    * Indicates whether the Locale correspond to an RT orientation.
+    * 
+    * @return true if the orientation is RT
+    */
+   public boolean isRT()
+   {
+      return ordinal == 1;
+   }
+
+   /**
+    * Indicates whether the Locale correspond to an TL orientation.
+    * 
+    * @return true if the orientation is TL
+    */
+   public boolean isTL()
+   {
+      return ordinal == 2;
+   }
+
+   /**
+    * Indicates whether the Locale correspond to an TR orientation.
+    *  
+    * @return true if the orientation is TR
+    */
+   public boolean isTR()
+   {
+      return ordinal == 3;
+   }
+
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/PropertiesClassLoader.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/PropertiesClassLoader.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/PropertiesClassLoader.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/PropertiesClassLoader.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,200 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import org.exoplatform.commons.utils.IOUtil;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+
+/**
+ * A {@link ClassLoader} extension that will retrieve resources from the parent
+ * classloader. For each resource having a ".properties" suffix it the
+ * classloader will try first to locate a corresponding resource using the same
+ * base name but with an ".xml" suffix. If such a resource is found, it will be
+ * loaded using {@link XMLResourceBundleParser}
+ * 
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PropertiesClassLoader extends ClassLoader
+{
+
+   /**
+    * Logger.
+    */
+   private static final Log LOG = ExoLogger.getLogger(PropertiesClassLoader.class);
+
+   /**
+    * Indicates whether the resource must be encoded into UTF-8
+    */
+   private boolean unicode;
+
+   public PropertiesClassLoader(ClassLoader parent)
+   {
+      this(parent, false);
+   }
+
+   public PropertiesClassLoader(ClassLoader parent, boolean unicode)
+   {
+      super(parent);
+      this.unicode = unicode;
+   }
+
+   public PropertiesClassLoader()
+   {
+   }
+
+   @Override
+   public URL getResource(String name)
+   {
+      if (name.endsWith(".properties"))
+      {
+         URL url = null;
+         ClassLoader parent = getParent();
+         while (parent != null)
+         {
+            url = getResource(parent, name, unicode);
+            if (url != null)
+            {
+               return url;
+            }
+            parent = parent.getParent();
+         }
+         if (url == null)
+         {
+            url = getResource(this, name, unicode);
+         }
+         return url;
+      }
+      return super.getResource(name);
+   }
+
+   private static URL getResource(ClassLoader cl, String name, boolean unicode)
+   {
+      String xmlName = name.substring(0, name.length() - ".properties".length()) + ".xml";
+      URL url = getResource(cl, xmlName, unicode, true);
+      if (url == null)
+      {
+         url = getResource(cl, name, unicode, false);
+      }
+      return url;
+   }
+
+   private static URL getResource(ClassLoader cl, String name, boolean unicode, boolean xml)
+   {
+      Enumeration<URL> urls = null;
+      try
+      {
+         urls = cl.getResources(name);
+      }
+      catch (Exception e)
+      {
+         LOG.error("An error occured while seeking all the resources with the name " + name, e);
+         return null;
+      }
+      if (urls != null && urls.hasMoreElements())
+      {
+         // At least one such resource has been found
+         ByteArrayOutputStream out = new ByteArrayOutputStream();
+         URL url = null;
+         Map<Object, Object> props = unicode ? new TreeMap<Object, Object>() : new Properties();
+         while (urls.hasMoreElements())
+         {
+            url = urls.nextElement();
+            InputStream in = null;
+            try
+            {
+               // Load content
+               in = url.openStream();
+               if (xml)
+               {
+                  props.putAll(XMLResourceBundleParser.asProperties(in));
+               }
+               else
+               {
+                  byte[] buf = IOUtil.getStreamContentAsBytes(in);
+                  ExoResourceBundle bundle = new ExoResourceBundle(new String(buf, "UTF-8"));
+                  bundle.putAll(props);
+               }
+            }
+            catch (Exception e)
+            {
+               LOG.error("An error occured while loading the content of " + url, e);
+               return null;
+            }
+            finally
+            {
+               if (in != null)
+               {
+                  try
+                  {
+                     in.close();
+                  }
+                  catch (IOException e)
+                  {
+                     // Do nothing
+                  }
+               }
+            }
+         }
+         try
+         {
+            // Now serialize as binary
+            if (unicode)
+            {
+               // Encoded into UTF-8
+               for (Map.Entry<Object, Object> entry : props.entrySet())
+               {
+                  out.write(((String)entry.getKey()).getBytes("UTF-8"));
+                  out.write('=');
+                  out.write(((String)entry.getValue()).getBytes("UTF-8"));
+                  out.write('\n');
+               }
+            }
+            else
+            {
+               // Properties format : encoded into ISO-8859-1 with unicode characters
+               ((Properties)props).store(out, null);
+            }
+            out.close();
+            InputStream in = new ByteArrayInputStream(out.toByteArray());
+
+            //
+            return new URL(url, "", new InputStreamURLStreamHandler(in));
+         }
+         catch (Exception e)
+         {
+            LOG.error("An error occured while creating the content of " + url, e);
+            return null;
+         }
+      }
+      return null;
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/Query.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/Query.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/Query.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/Query.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,71 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+/**
+ * Created by The eXo Platform SAS . Author : Tuan Nguyen
+ * tuan08 at users.sourceforge.net Date: Jun 14, 2003 Time: 1:12:22 PM
+ */
+public class Query
+{
+
+   private String name_;
+
+   private String languages_;
+
+   private int maxSize_;
+
+   public Query(String name, String language)
+   {
+      name_ = name;
+      languages_ = language;
+      maxSize_ = 100;
+   }
+
+   public String getName()
+   {
+      return name_;
+   }
+
+   public void setName(String s)
+   {
+      name_ = s;
+   }
+
+   public String getLanguage()
+   {
+      return languages_;
+   }
+
+   public void setLanguage(String s)
+   {
+      languages_ = s;
+   }
+
+   public int getMaxSize()
+   {
+      return maxSize_;
+   }
+
+   public void setMaxSize(int s)
+   {
+      maxSize_ = s;
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleData.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,53 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import java.io.Serializable;
+
+/**
+ * Created by The eXo Platform SAS . Author : Tuan Nguyen
+ * tuan08 at users.sourceforge.net Date: May 14, 2004 Time: 1:12:22 PM
+ */
+ at SuppressWarnings("serial")
+public class ResourceBundleData extends ResourceBundleDescription implements Serializable
+{
+
+   private String data_;
+
+   public ResourceBundleData()
+   {
+      setResourceType("-");
+      setLanguage(DEFAULT_LANGUAGE);
+   }
+
+   /**
+    * @hibernate.property length="65535"
+    *                     type="org.exoplatform.services.database.impl.TextClobType"
+    **/
+   public String getData()
+   {
+      return data_;
+   }
+
+   public void setData(String data)
+   {
+      data_ = data;
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleDescription.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleDescription.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleDescription.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleDescription.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,138 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import java.io.Serializable;
+
+/**
+ * Created by The eXo Platform SAS . Author : Tuan Nguyen
+ * tuan08 at users.sourceforge.net Date: May 14, 2004 Time: 1:12:22 PM
+ */
+ at SuppressWarnings("serial")
+public class ResourceBundleDescription implements Serializable
+{
+
+   protected String id_;
+
+   protected String name_;
+
+   protected String language_;
+
+   protected String country_;
+
+   protected String variant_;
+
+   protected String resourceType_;
+
+   public ResourceBundleDescription()
+   {
+   }
+
+   /**
+    * @hibernate.id generator-class="assigned"
+    **/
+   public String getId()
+   {
+      if (id_ == null)
+      {
+         StringBuffer b = new StringBuffer();
+         b.append(name_);
+         if (language_ != null)
+            b.append('_').append(language_);
+         // if(country_ != null) b.append('_').append(country_);
+         // if(variant_ != null) b.append('_').append(variant_);
+         id_ = b.toString();
+      }
+      return id_;
+   }
+
+   public void setId(String id)
+   {
+      id_ = id;
+   }
+
+   /**
+    * @hibernate.property
+    **/
+   public String getName()
+   {
+      return name_;
+   }
+
+   public void setName(String name)
+   {
+      name_ = name;
+   }
+
+   /**
+    * @hibernate.property
+    **/
+   public String getLanguage()
+   {
+      return language_;
+   }
+
+   public void setLanguage(String s)
+   {
+      language_ = s;
+   }
+
+   /**
+    * @hibernate.property
+    **/
+   public String getCountry()
+   {
+      return country_;
+   }
+
+   public void setCountry(String s)
+   {
+      country_ = s;
+   }
+
+   /**
+    * @hibernate.property
+    **/
+   public String getVariant()
+   {
+      return variant_;
+   }
+
+   public void setVariant(String s)
+   {
+      variant_ = s;
+   }
+
+   /**
+    * @hibernate.property
+    **/
+   public String getResourceType()
+   {
+      return resourceType_;
+   }
+
+   public void setResourceType(String s)
+   {
+      resourceType_ = s;
+   }
+
+   final static public String DEFAULT_LANGUAGE = "en";
+
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleLoader.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleLoader.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleLoader.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleLoader.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * A facade for obtaining resource bundles.
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class ResourceBundleLoader
+{
+
+   public static ResourceBundle load(String baseName, Locale locale, ClassLoader classLoader)
+   {
+      if (IdentityResourceBundle.MAGIC_LANGUAGE.equals(locale.getLanguage()))
+      {
+         return IdentityResourceBundle.getInstance();
+      }
+      PropertiesClassLoader pcl = new PropertiesClassLoader(classLoader);
+      return ResourceBundle.getBundle(baseName, locale, pcl);
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleService.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/ResourceBundleService.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleService.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/ResourceBundleService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,128 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import org.exoplatform.commons.utils.PageList;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * May 7, 2004
+ * 
+ * @author: Tuan Nguyen
+ * @email: tuan08 at users.sourceforge.net
+ * @version: $Id: ResourceBundleService.java 5799 2006-05-28 17:55:42Z geaz $
+ *           This class is used to manage the Resoucebunlde. It should work like
+ *           the java.util.ResourceBundle class except that the properties file
+ *           can be in the database or a a directory. The class
+ *           java.util.ResourceBundle require that the properties file has to be
+ *           in the classpath.
+ **/
+public interface ResourceBundleService
+{
+   /**
+    * This method should search for a template in the database that the service
+    * manage or the resource in the classpath of the current thread class loader
+    * 
+    * @param name The name of the resource bunlde
+    * @param locale the locale
+    * @return A ResourceBunlde or null if no ResourceBundle is found
+    */
+   public ResourceBundle getResourceBundle(String name, Locale locale);
+
+   /**
+    * This method should search for a template in the database that the service
+    * manage or the resource in the classpath of the specified class loader
+    * 
+    * @param name the name of the resource
+    * @param locale the locale
+    * @param cl The classloader
+    * @return
+    */
+   public ResourceBundle getResourceBundle(String name, Locale locale, ClassLoader cl);
+
+   /**
+    * This method will call the method public ResourceBundle
+    * getResourceBundle(String[] name, Locale locale, ClassLoader cl) and using
+    * the the classloader of the current thread
+    */
+   public ResourceBundle getResourceBundle(String[] name, Locale locale);
+
+   /**
+    * This method will look for all the resources with the given names and merge
+    * into one resource bundle, the properties in the later resource bundle name
+    * will have the higher priority than the previous one.
+    */
+   public ResourceBundle getResourceBundle(String[] name, Locale locale, ClassLoader cl);
+
+   /**
+    * This method should look for a resource bundle in the database that match
+    * the given id. The ResourceBundleData store the data as text instead of a
+    * properties map.
+    * 
+    * @param id The id of the resource bundle data
+    * @return A ResourceBundleData instance or no record is found.
+    * @throws Exception
+    */
+   public ResourceBundleData getResourceBundleData(String id) throws Exception;
+
+   /**
+    * This method remove the data record in the databas and return the data
+    * instance after it has been removed
+    * 
+    * @param id The id of the data record
+    * @return A ResourceBundleData instance
+    * @throws Exception
+    */
+   public ResourceBundleData removeResourceBundleData(String id) throws Exception;
+
+   /**
+    * This method shoudl create or update a ResourceBundleData instance
+    * 
+    * @param data the ResourceBundleData instance to update or create
+    * @throws Exception
+    */
+   public void saveResourceBundle(ResourceBundleData data) throws Exception;
+
+   /**
+    * This method search and return a page description iterator
+    * 
+    * @param q The search criteria
+    * @return A PageDescription Iterator
+    * @throws Exception
+    */
+   public PageList<ResourceBundleData> findResourceDescriptions(Query q) throws Exception;
+
+   /**
+    * This method is acted as a factory of
+    * 
+    * @return
+    */
+   public ResourceBundleData createResourceBundleDataInstance();
+
+   /**
+    * The developer can store the common properties in certain resource bundles
+    * so later he can merge a resource bundle with the shared resource bunldes
+    * 
+    * @return the name of the shared resource bundle
+    */
+   public String[] getSharedResourceBundleNames();
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/XMLResourceBundleParser.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/XMLResourceBundleParser.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/XMLResourceBundleParser.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/XMLResourceBundleParser.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,205 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+/**
+ * A parser for XML resource bundle having the following rules:
+ *
+ * <ul>
+ * <li>The root document element is named "bundle"</li>
+ * <li>Any non root element can have any name</li>
+ * <li>Any non root element content must not have mixed content (i.e text and children elements)</li>
+ * <li>Any element having textual content is considered as a bundle entry with they key formed by the
+ *     dot concatenation of its parent element name except the root element and the value is the text content</li>
+ * </ul>
+ *
+ * For instance the following document:
+ *
+ * &lt;bundle&gt;
+ * &lt;foo&gt;
+ * &lt;A&gt;1&lt;A&gt;
+ * &lt;B&gt;2&lt;B&gt;
+ * &lt;/foo&gt;
+ * &lt;C&gt;3&lt;C&gt;
+ * &lt;/bundle&gt;
+ *
+ * will give the bundle with entries:
+ *
+ * <ul>
+ * <li>foo.A=1</li>
+ * <li>foo.B=2</li>
+ * <li>C=3</li>
+ * </ul>
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class XMLResourceBundleParser
+{
+
+   /**
+    * @see #asMap(org.xml.sax.InputSource)
+    */
+   public static Properties asProperties(InputStream in) throws IOException, SAXException,
+      ParserConfigurationException, IllegalArgumentException
+   {
+      if (in == null)
+      {
+         throw new IllegalArgumentException("No null input stream allowed");
+      }
+      return asProperties(new InputSource(in));
+   }
+
+   /**
+    * @see #asMap(org.xml.sax.InputSource)
+    */
+   public static Properties asProperties(Reader in) throws IOException, SAXException, ParserConfigurationException,
+      IllegalArgumentException
+   {
+      if (in == null)
+      {
+         throw new IllegalArgumentException("No null reader allowed");
+      }
+      return asProperties(new InputSource(in));
+   }
+
+   /**
+    * @see #asMap(org.xml.sax.InputSource)
+    */
+   public static Properties asProperties(InputSource in) throws IOException, SAXException,
+      ParserConfigurationException, IllegalArgumentException
+   {
+      if (in == null)
+      {
+         throw new IllegalArgumentException("No null input source allowed");
+      }
+      Map<String, String> bundle = asMap(in);
+      Properties props = new Properties();
+      props.putAll(bundle);
+      return props;
+   }
+
+   /**
+    * @see #asMap(org.xml.sax.InputSource)
+    */
+   public static Map<String, String> asMap(InputStream in) throws IOException, SAXException,
+      ParserConfigurationException, IllegalArgumentException
+   {
+      if (in == null)
+      {
+         throw new IllegalArgumentException("No null input stream allowed");
+      }
+      return asMap(new InputSource(in));
+   }
+
+   /**
+    * @see #asMap(org.xml.sax.InputSource)
+    */
+   public static Map<String, String> asMap(Reader in) throws IOException, SAXException, ParserConfigurationException,
+      IllegalArgumentException
+   {
+      if (in == null)
+      {
+         throw new IllegalArgumentException("No null reader allowed");
+      }
+      return asMap(new InputSource(in));
+   }
+
+   /**
+    * Load an xml resource bundle as a {@link Map<String,String>} object.
+    *
+    * @param in the input source
+    * @return the properties object
+    * @throws IOException any IOException
+    * @throws SAXException any SAXException
+    * @throws ParserConfigurationException any ParserConfigurationException
+    * @throws IllegalArgumentException if the argument is null
+    */
+   public static Map<String, String> asMap(InputSource in) throws IOException, SAXException,
+      ParserConfigurationException, IllegalArgumentException
+   {
+      if (in == null)
+      {
+         throw new IllegalArgumentException("No null input source allowed");
+      }
+      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+      DocumentBuilder builder = factory.newDocumentBuilder();
+      Document document = builder.parse(in);
+      Element bundleElt = document.getDocumentElement();
+      HashMap<String, String> bundle = new HashMap<String, String>();
+      collect(new LinkedList<String>(), bundleElt, bundle);
+      return bundle;
+   }
+
+   private static void collect(LinkedList<String> path, Element currentElt, Map<String, String> bundle)
+   {
+      NodeList children = currentElt.getChildNodes();
+      boolean text = true;
+      for (int i = children.getLength() - 1; i >= 0; i--)
+      {
+         Node child = children.item(i);
+         if (child.getNodeType() == Node.ELEMENT_NODE)
+         {
+            text = false;
+            Element childElt = (Element)child;
+            String name = childElt.getTagName();
+            path.addLast(name);
+            collect(path, childElt, bundle);
+            path.removeLast();
+         }
+      }
+      if (text && path.size() > 0)
+      {
+         String value = currentElt.getTextContent();
+         StringBuffer sb = new StringBuffer();
+         for (Iterator<String> i = path.iterator(); i.hasNext();)
+         {
+            String name = i.next();
+            sb.append(name);
+            if (i.hasNext())
+            {
+               sb.append('.');
+            }
+         }
+         String key = sb.toString();
+         bundle.put(key, value);
+      }
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundlePlugin.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundlePlugin.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundlePlugin.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundlePlugin.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,75 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources.impl;
+
+import org.exoplatform.container.component.BaseComponentPlugin;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValuesParam;
+
+import java.util.List;
+
+/**
+ * This class is used to define new resource bundles
+ * 
+ * Created by The eXo Platform SAS
+ * Author : Nicolas Filotto 
+ *          nicolas.filotto at exoplatform.com
+ * 24 sept. 2009
+ */
+public class BaseResourceBundlePlugin extends BaseComponentPlugin
+{
+
+   private final InitParams params;
+
+   public BaseResourceBundlePlugin(InitParams params)
+   {
+      this.params = params;
+   }
+
+   /**
+    * @return the list of enclosed "classpath" resource bundles
+    */
+   @SuppressWarnings("unchecked")
+   public List<String> getClasspathResources()
+   {
+      ValuesParam vParam = params.getValuesParam("classpath.resources");
+      return vParam == null ? null : vParam.getValues();
+   }
+
+   /**
+    * @return the list of enclosed "portal" resource bundles
+    */
+   @SuppressWarnings("unchecked")
+   public List<String> getPortalResources()
+   {
+      ValuesParam vParam = params.getValuesParam("portal.resource.names");
+      return vParam == null ? null : vParam.getValues();
+   }
+
+   /**
+    * @return the list of enclosed "init" resource bundles
+    */
+   @SuppressWarnings("unchecked")
+   public List<String> getInitResources()
+   {
+      ValuesParam vParam = params.getValuesParam("init.resources");
+      return vParam == null ? null : vParam.getValues();
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/BaseResourceBundleService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,353 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources.impl;
+
+import org.exoplatform.commons.utils.IOUtil;
+import org.exoplatform.commons.utils.MapResourceBundle;
+import org.exoplatform.commons.utils.PageList;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.services.cache.ExoCache;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.services.resources.IdentityResourceBundle;
+import org.exoplatform.services.resources.LocaleConfig;
+import org.exoplatform.services.resources.LocaleConfigService;
+import org.exoplatform.services.resources.PropertiesClassLoader;
+import org.exoplatform.services.resources.Query;
+import org.exoplatform.services.resources.ResourceBundleData;
+import org.exoplatform.services.resources.ResourceBundleLoader;
+import org.exoplatform.services.resources.ResourceBundleService;
+import org.picocontainer.Startable;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+/**
+ * Created by The eXo Platform SAS Mar 9, 2007
+ */
+abstract public class BaseResourceBundleService implements ResourceBundleService, Startable
+{
+
+   protected Log log_;
+
+   protected volatile List<String> classpathResources_;
+
+   protected volatile String[] portalResourceBundleNames_;
+
+   protected LocaleConfigService localeService_;
+
+   protected ExoCache<String, ResourceBundle> cache_;
+
+   private volatile List<String> initResources_;
+
+   @SuppressWarnings("unchecked")
+   protected void initParams(InitParams params)
+   {
+      classpathResources_ = params.getValuesParam("classpath.resources").getValues();
+
+      // resources name can use for portlets
+      List prnames = params.getValuesParam("portal.resource.names").getValues();
+      portalResourceBundleNames_ = new String[prnames.size()];
+      for (int i = 0; i < prnames.size(); i++)
+      {
+         portalResourceBundleNames_[i] = (String)prnames.get(i);
+      }
+
+      initResources_ = params.getValuesParam("init.resources").getValues();
+   }
+
+   /**
+    * Add new resources bundles
+    */
+   public synchronized void addResourceBundle(BaseResourceBundlePlugin plugin)
+   {
+      List<String> classpathResources = plugin.getClasspathResources();
+      if (classpathResources != null && !classpathResources.isEmpty())
+      {
+         List<String> result = new ArrayList<String>(classpathResources);
+         if (classpathResources_ != null)
+         {
+            result.addAll(classpathResources_);
+         }
+         this.classpathResources_ = Collections.unmodifiableList(result);
+      }
+      List<String> portalResources = plugin.getPortalResources();
+      if (portalResources != null && !portalResources.isEmpty())
+      {
+         List<String> result = new ArrayList<String>(portalResources);
+         if (portalResourceBundleNames_ != null)
+         {
+            result.addAll(Arrays.asList(portalResourceBundleNames_));
+         }
+         this.portalResourceBundleNames_ = (String[])result.toArray(new String[result.size()]);
+      }
+      List<String> initResources = plugin.getInitResources();
+      if (initResources != null && !initResources.isEmpty())
+      {
+         List<String> result = new ArrayList<String>(initResources);
+         if (initResources_ != null)
+         {
+            result.addAll(initResources_);
+         }
+         this.initResources_ = Collections.unmodifiableList(result);
+      }
+   }
+
+   /**
+    * Loads all the "init" resource bundles 
+    * @see org.picocontainer.Startable#start()
+    */
+   public void start()
+   {
+      PageList pl = null;
+      try
+      {
+         pl = findResourceDescriptions(new Query(null, null));
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Cannot check if a resource already exists", e);
+      }
+      if (pl.getAvailable() > 0)
+         return;
+
+      // init resources
+      List<String> initResources = initResources_;
+      for (String resource : initResources)
+      {
+         initResources(resource, Thread.currentThread().getContextClassLoader());
+      }
+   }
+
+   /**
+    * @see org.picocontainer.Startable#stop()
+    */
+   public void stop()
+   {
+   }
+
+   public ResourceBundle getResourceBundle(String[] name, Locale locale)
+   {
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      return getResourceBundle(name, locale, cl);
+   }
+
+   public ResourceBundle getResourceBundle(String name, Locale locale)
+   {
+      ClassLoader cl = Thread.currentThread().getContextClassLoader();
+      return getResourceBundle(name, locale, cl);
+   }
+
+   public String[] getSharedResourceBundleNames()
+   {
+      return portalResourceBundleNames_;
+   }
+
+   public ResourceBundleData createResourceBundleDataInstance()
+   {
+      return new ResourceBundleData();
+   }
+
+   protected boolean isClasspathResource(String name)
+   {
+      if (classpathResources_ == null)
+         return false;
+      for (int i = 0; i < classpathResources_.size(); i++)
+      {
+         String pack = classpathResources_.get(i);
+         if (name.startsWith(pack))
+            return true;
+      }
+      return false;
+   }
+
+   protected void initResources(String baseName, ClassLoader cl)
+   {
+      String name = baseName.replace('.', '/');
+      try
+      {
+         Collection<LocaleConfig> localeConfigs = localeService_.getLocalConfigs();
+         String defaultLang = localeService_.getDefaultLocaleConfig().getLanguage();
+         for (Iterator<LocaleConfig> iter = localeConfigs.iterator(); iter.hasNext();)
+         {
+            LocaleConfig localeConfig = iter.next();
+            String language = localeConfig.getLanguage();
+            String content = getResourceBundleContent(name, language, defaultLang, cl);
+            if (content != null)
+            {
+               // save the content
+               ResourceBundleData data = new ResourceBundleData();
+               data.setId(baseName + "_" + language);
+               data.setName(baseName);
+               data.setLanguage(language);
+               data.setData(content);
+               saveResourceBundle(data);
+            }
+         }
+      }
+      catch (Exception ex)
+      {
+         log_.error("Error while reading the resource bundle : " + baseName, ex);
+      }
+   }
+
+   protected String getResourceBundleContent(String name, String language, String defaultLang, ClassLoader cl)
+      throws Exception
+   {
+      String fileName = null;
+      try
+      {
+         cl = new PropertiesClassLoader(cl, true);
+         fileName = name + "_" + language + ".properties";
+         URL url = cl.getResource(fileName);
+         if (url == null && defaultLang.equals(language))
+         {
+            url = cl.getResource(name + ".properties");
+         }
+         if (url != null)
+         {
+            InputStream is = url.openStream();
+            try
+            {
+               byte[] buf = IOUtil.getStreamContentAsBytes(is);
+               return new String(buf, "UTF-8");
+            }
+            finally
+            {
+               try
+               {
+                  is.close();
+               }
+               catch (IOException e)
+               {
+                  // Do nothing
+               }
+            }
+         }
+      }
+      catch (Exception e)
+      {
+         throw new Exception("Error while reading the file: " + fileName, e);
+      }
+      return null;
+   }
+
+   /**
+    * Invalidate an entry in the cache at this level. Normally this is called by the subclass.
+    *
+    * @param name the bundle name
+    */
+   protected final void invalidate(String name)
+   {
+      cache_.remove(name);
+   }
+
+   public ResourceBundle getResourceBundle(String name, Locale locale, ClassLoader cl)
+   {
+      if (IdentityResourceBundle.MAGIC_LANGUAGE.equals(locale.getLanguage()))
+      {
+         return IdentityResourceBundle.getInstance();
+      }
+      if (isClasspathResource(name))
+         return ResourceBundleLoader.load(name, locale, cl);
+      String id = name + "_" + locale.getLanguage();
+      try
+      {
+         ResourceBundle rb = cache_.get(id);
+         if (rb != null)
+            return rb;
+      }
+      catch (Exception ex)
+      {
+      }
+
+      try
+      {
+         ResourceBundle res = null;
+         String rootId = name + "_" + localeService_.getDefaultLocaleConfig().getLanguage();
+         ResourceBundle parent = getResourceBundleFromDb(rootId, null, locale);
+         if (parent != null)
+         {
+            res = getResourceBundleFromDb(id, parent, locale);
+            if (res == null)
+               res = parent;
+            cache_.put(id, res);
+            return res;
+         }
+      }
+      catch (Exception ex)
+      {
+         log_.error("Error: " + id, ex);
+      }
+      return null;
+   }
+
+   public ResourceBundle getResourceBundle(String[] name, Locale locale, ClassLoader cl)
+   {
+      if (IdentityResourceBundle.MAGIC_LANGUAGE.equals(locale.getLanguage()))
+      {
+         return IdentityResourceBundle.getInstance();
+      }
+      StringBuilder idBuf = new StringBuilder("merge:");
+      for (String n : name)
+         idBuf.append(n).append("_");
+      idBuf.append(locale);
+      String id = idBuf.toString();
+      try
+      {
+         ResourceBundle res = cache_.get(id);
+         if (res != null)
+            return res;
+         MapResourceBundle outputBundled = new MapResourceBundle(locale);
+         for (int i = 0; i < name.length; i++)
+         {
+            ResourceBundle temp = getResourceBundle(name[i], locale, cl);
+            if (temp != null)
+            {
+               outputBundled.merge(temp);
+               continue;
+            }
+            log_.warn("Cannot load and merge the bundle: " + name[i]);
+         }
+         outputBundled.resolveDependencies();
+         cache_.put(id, outputBundled);
+         return outputBundled;
+      }
+      catch (Exception ex)
+      {
+         log_.error("Cannot load and merge the bundle: " + id, ex);
+      }
+      return null;
+   }
+
+   abstract protected ResourceBundle getResourceBundleFromDb(String id, ResourceBundle parent, Locale locale)
+      throws Exception;
+
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigImpl.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigImpl.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigImpl.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigImpl.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,183 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources.impl;
+
+import org.exoplatform.container.ExoContainerContext;
+import org.exoplatform.services.resources.LocaleConfig;
+import org.exoplatform.services.resources.Orientation;
+import org.exoplatform.services.resources.ResourceBundleService;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author Benjamin Mestrallet benjamin.mestrallet at exoplatform.com
+ */
+public class LocaleConfigImpl implements LocaleConfig
+{
+
+   static private Map<String, Locale> predefinedLocaleMap_ = null;
+
+   static
+   {
+      predefinedLocaleMap_ = new HashMap<String, Locale>(10);
+      predefinedLocaleMap_.put("us", Locale.US);
+      predefinedLocaleMap_.put("en", Locale.ENGLISH);
+      predefinedLocaleMap_.put("fr", Locale.FRANCE);
+      predefinedLocaleMap_.put("zh", Locale.SIMPLIFIED_CHINESE);
+   }
+
+   private Locale locale_;
+
+   private String outputEncoding_;
+
+   private String inputEncoding_;
+
+   private String description_;
+
+   private String localeName_;
+
+   private Orientation orientation;
+
+   public LocaleConfigImpl()
+   {
+   }
+
+   public final String getDescription()
+   {
+      return description_;
+   }
+
+   public final void setDescription(String desc)
+   {
+      description_ = desc;
+   }
+
+   public final String getOutputEncoding()
+   {
+      return outputEncoding_;
+   }
+
+   public final void setOutputEncoding(String enc)
+   {
+      outputEncoding_ = enc;
+   }
+
+   public final String getInputEncoding()
+   {
+      return inputEncoding_;
+   }
+
+   public final void setInputEncoding(String enc)
+   {
+      inputEncoding_ = enc;
+   }
+
+   public final Locale getLocale()
+   {
+      return locale_;
+   }
+
+   public final void setLocale(Locale locale)
+   {
+      locale_ = locale;
+      if (localeName_ == null)
+         localeName_ = locale.getLanguage();
+   }
+
+   public final void setLocale(String localeName)
+   {
+      localeName_ = localeName;
+      locale_ = predefinedLocaleMap_.get(localeName);
+      if (locale_ == null)
+         locale_ = new Locale(localeName);
+   }
+
+   public final String getLanguage()
+   {
+      return locale_.getLanguage();
+   }
+
+   public final String getLocaleName()
+   {
+      return localeName_;
+   }
+
+   public final void setLocaleName(String localeName)
+   {
+      localeName_ = localeName;
+   }
+
+   public ResourceBundle getResourceBundle(String name)
+   {
+      ResourceBundleService service =
+         (ResourceBundleService)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(
+            ResourceBundleService.class);
+      ResourceBundle res = service.getResourceBundle(name, locale_);
+      return res;
+   }
+
+   public ResourceBundle getMergeResourceBundle(String[] names)
+   {
+      ResourceBundleService service =
+         (ResourceBundleService)ExoContainerContext.getCurrentContainer().getComponentInstanceOfType(
+            ResourceBundleService.class);
+      ResourceBundle res = service.getResourceBundle(names, locale_);
+      return res;
+   }
+
+   public ResourceBundle getNavigationResourceBundle(String ownerType, String ownerId)
+   {
+      return getResourceBundle("locale.navigation." + ownerType + "." + ownerId.replaceAll("/", "."));
+   }
+
+   public void setInput(HttpServletRequest req) throws java.io.UnsupportedEncodingException
+   {
+      req.setCharacterEncoding(inputEncoding_);
+   }
+
+   public void setOutput(HttpServletResponse res)
+   {
+      res.setContentType("text/html; charset=" + outputEncoding_);
+      res.setLocale(locale_);
+   }
+
+   public Orientation getOrientation()
+   {
+      return orientation;
+   }
+
+   public void setOrientation(Orientation orientation)
+   {
+      this.orientation = orientation;
+   }
+
+   @Override
+   public String toString()
+   {
+      return "LocaleConfig[" + "localeName=" + localeName_ + ",locale=" + locale_ + ",description=" + description_
+         + ",inputEncoding=" + inputEncoding_ + ",outputEncoding=" + outputEncoding_ + "]";
+   }
+}

Copied: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigServiceImpl.java (from rev 597, portal/trunk/component/common/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigServiceImpl.java)
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigServiceImpl.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/LocaleConfigServiceImpl.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,181 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources.impl;
+
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.container.configuration.ConfigurationManager;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.exoplatform.services.resources.IdentityResourceBundle;
+import org.exoplatform.services.resources.LocaleConfig;
+import org.exoplatform.services.resources.LocaleConfigService;
+import org.exoplatform.services.resources.Orientation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+/**
+ * @author Benjamin Mestrallet benjamin.mestrallet at exoplatform.com This Service
+ *         is used to manage the locales that the applications can handle
+ */
+public class LocaleConfigServiceImpl implements LocaleConfigService
+{
+
+   private static Log log = ExoLogger.getLogger(LocaleConfigServiceImpl.class);
+
+   private LocaleConfig defaultConfig_;
+
+   private Map<String, LocaleConfig> configs_;
+
+   private static final Map<String, Orientation> orientations = new HashMap<String, Orientation>();
+
+   static
+   {
+      orientations.put("lt", Orientation.LT);
+      orientations.put("rt", Orientation.RT);
+      orientations.put("tl", Orientation.TL);
+      orientations.put("tr", Orientation.TR);
+   }
+
+   public LocaleConfigServiceImpl(InitParams params, ConfigurationManager cmanager) throws Exception
+   {
+      configs_ = new HashMap<String, LocaleConfig>(10);
+      String confResource = params.getValueParam("locale.config.file").getValue();
+      InputStream is = cmanager.getInputStream(confResource);
+      parseConfiguration(is);
+   }
+
+   /**
+    * @return Return the default LocaleConfig
+    */
+   public LocaleConfig getDefaultLocaleConfig()
+   {
+      return defaultConfig_;
+   }
+
+   /**
+    * @param lang a locale language
+    * @return The LocalConfig
+    */
+   public LocaleConfig getLocaleConfig(String lang)
+   {
+      LocaleConfig config = configs_.get(lang);
+      if (config != null)
+         return config;
+      return defaultConfig_;
+   }
+
+   /**
+    * @return All the LocalConfig that manage by the service
+    */
+   public Collection<LocaleConfig> getLocalConfigs()
+   {
+      return configs_.values();
+   }
+
+   private void parseConfiguration(InputStream is) throws Exception
+   {
+      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+      factory.setIgnoringComments(true);
+      factory.setCoalescing(true);
+      factory.setNamespaceAware(false);
+      factory.setValidating(false);
+      DocumentBuilder parser = factory.newDocumentBuilder();
+      Document document = parser.parse(is);
+      NodeList nodes = document.getElementsByTagName("locale-config");
+      for (int i = 0; i < nodes.getLength(); i++)
+      {
+         Node node = nodes.item(i);
+         NodeList children = node.getChildNodes();
+         LocaleConfig config = new LocaleConfigImpl();
+         for (int j = 0; j < children.getLength(); j++)
+         {
+            Node element = children.item(j);
+            if ("locale".equals(element.getNodeName()))
+            {
+               config.setLocale(element.getFirstChild().getNodeValue());
+            }
+            else if ("output-encoding".equals(element.getNodeName()))
+            {
+               config.setOutputEncoding(element.getFirstChild().getNodeValue());
+            }
+            else if ("input-encoding".equals(element.getNodeName()))
+            {
+               config.setInputEncoding(element.getFirstChild().getNodeValue());
+            }
+            else if ("description".equals(element.getNodeName()))
+            {
+               config.setDescription(element.getFirstChild().getNodeValue());
+            }
+            else if ("orientation".equals(element.getNodeName()))
+            {
+               String s = element.getFirstChild().getNodeValue();
+               Orientation orientation = orientations.get(s);
+               if (orientation == null)
+               {
+                  log.error("Wrong orientation value " + s);
+               }
+               else
+               {
+                  config.setOrientation(orientation);
+               }
+            }
+         }
+
+         //
+         if (config.getOrientation() == null)
+         {
+            log.debug("No orientation found on the locale config, use the LT default");
+            config.setOrientation(Orientation.LT);
+         }
+
+         //
+         log.debug("Added locale config " + config + " to the set of locale configs");
+
+         //
+         configs_.put(config.getLanguage(), config);
+         if (i == 0)
+            defaultConfig_ = config;
+      }
+
+      //
+      if (PropertyManager.isDevelopping())
+      {
+         LocaleConfig magicConfig = new LocaleConfigImpl();
+         magicConfig.setLocale(IdentityResourceBundle.MAGIC_LOCALE);
+         magicConfig.setDescription("Magic locale");
+         magicConfig.setInputEncoding("UTF-8");
+         magicConfig.setOutputEncoding("UTF-8");
+         magicConfig.setDescription("Default configuration for the debugging locale");
+         magicConfig.setOrientation(Orientation.LT);
+         configs_.put(magicConfig.getLanguage(), magicConfig);
+         log.debug("Added magic locale for debugging bundle usage at runtime");
+      }
+   }
+}

Added: portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/SimpleResourceBundleService.java
===================================================================
--- portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/SimpleResourceBundleService.java	                        (rev 0)
+++ portal/trunk/component/resources/src/main/java/org/exoplatform/services/resources/impl/SimpleResourceBundleService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,146 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources.impl;
+
+import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.commons.utils.MapResourceBundle;
+import org.exoplatform.commons.utils.PageList;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.services.cache.CacheService;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.resources.ExoResourceBundle;
+import org.exoplatform.services.resources.LocaleConfigService;
+import org.exoplatform.services.resources.Query;
+import org.exoplatform.services.resources.ResourceBundleData;
+import org.exoplatform.services.resources.impl.BaseResourceBundleService;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * Created by The eXo Platform SARL
+ * Author : Tung Pham
+ *          thanhtungty at gmail.com
+ * Dec 1, 2007
+ */
+public class SimpleResourceBundleService extends BaseResourceBundleService
+{
+
+   private final ConcurrentMap<String, ResourceBundleData> bundles = new ConcurrentHashMap<String, ResourceBundleData>();
+
+   public SimpleResourceBundleService(InitParams params, CacheService cService, LocaleConfigService localeService) throws Exception
+   {
+      log_ = ExoLogger.getLogger("org.exoplatform.services.resources");
+      localeService_ = localeService;
+      cache_ = cService.getCacheInstance(ResourceBundleData.class.getName());
+      initParams(params);
+   }
+
+   public ResourceBundleData getResourceBundleData(String id) throws Exception
+   {
+      return bundles.get(id);
+   }
+
+   public ResourceBundleData removeResourceBundleData(String id) throws Exception
+   {
+      if (id == null)
+      {
+         return null;
+      }
+      ResourceBundleData data = bundles.remove(id);
+      invalidate(id);
+      return data;
+   }
+
+   public void saveResourceBundle(ResourceBundleData resourceData) throws Exception
+   {
+      String id = resourceData.getId();
+      bundles.put(id, resourceData);
+      invalidate(id);
+   }
+
+   public PageList<ResourceBundleData> findResourceDescriptions(Query q) throws Exception
+   {
+      final ArrayList<ResourceBundleData> list = new ArrayList<ResourceBundleData>();
+      for (ResourceBundleData data : bundles.values())
+      {
+         boolean matches = true;
+         if (q.getName() != null)
+         {
+            matches &= q.getName().equals(data.getName());
+         }
+         if (q.getLanguage() != null)
+         {
+            matches &= q.getLanguage().equals(data.getLanguage());
+         }
+         if (matches)
+         {
+            list.add(data);
+         }
+      }
+      Collections.sort(list, new Comparator<ResourceBundleData>()
+      {
+         public int compare(ResourceBundleData o1, ResourceBundleData o2)
+         {
+            String l1 = o1.getLanguage();
+            String l2 = o2.getLanguage();
+            if (l1 == null)
+            {
+               return l2 == null ? 0 : 1;
+            }
+            else
+            {
+               return l1 == null ? -1 : l1.compareTo(l2);
+            }
+         }
+      });
+      return new LazyPageList<ResourceBundleData>(new ListAccess<ResourceBundleData>()
+      {
+         public ResourceBundleData[] load(int index, int length) throws Exception, IllegalArgumentException
+         {
+            List<ResourceBundleData> sub = list.subList(index, index + length);
+            return sub.toArray(new ResourceBundleData[sub.size()]);
+         }
+
+         public int getSize() throws Exception
+         {
+            return list.size();
+         }
+      }, 20);
+   }
+
+   @Override
+   protected ResourceBundle getResourceBundleFromDb(String id, ResourceBundle parent, Locale locale) throws Exception
+   {
+      ResourceBundleData data = getResourceBundleData(id);
+      if (data == null)
+      {
+         return null;
+      }
+      return new MapResourceBundle(new ExoResourceBundle(data.getData(), parent), locale);
+   }
+}
\ No newline at end of file

Modified: portal/trunk/component/resources/src/test/java/conf/portal/test-configuration.xml
===================================================================
--- portal/trunk/component/resources/src/test/java/conf/portal/test-configuration.xml	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/resources/src/test/java/conf/portal/test-configuration.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -70,5 +70,31 @@
     <type>org.exoplatform.services.resources.ResourceBundleManager</type>
   </component>
 
+    <component>
+      <key>org.exoplatform.services.resources.ResourceBundleService</key>
+      <type>org.exoplatform.services.resources.impl.SimpleResourceBundleService</type>
+        <init-params>
+          <values-param>
+            <name>classpath.resources</name>
+            <description>The resources  that start with the following package name should be load from file system</description>
+            <value>locale.portlet</value>
+          </values-param>
+
+          <values-param>
+            <name>init.resources</name>
+            <description>Store the following resources into the db for  the first launch </description>
+            <value>locale.test.resources.test</value>
+          </values-param>
+
+          <values-param>
+            <name>portal.resource.names</name>
+            <description>The properties files of  the portal ,  those file will be merged
+              into one ResoruceBundle properties </description>
+            <value>local.portal.portal</value>
+            <value>local.portal.custom</value>
+          </values-param>
+        </init-params>
+    </component>
+
   <import>jar:/conf/portal/testjcr/test-jcr-configuration.xml</import>
 </configuration>

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB1-2.xml (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB1-2.xml)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB1-2.xml	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB1-2.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,28 @@
+<?xml version="1.0" ?>
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+    
+    This is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation; either version 2.1 of
+    the License, or (at your option) any later version.
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public
+    License along with this software; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+    02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<bundle>
+	<my>
+		<!-- Key 1 -->
+		<key1>My Default Value In English v2</key1>
+	</my>
+</bundle>
\ No newline at end of file

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB1.xml (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB1.xml)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB1.xml	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB1.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,32 @@
+<?xml version="1.0" ?>
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+    
+    This is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation; either version 2.1 of
+    the License, or (at your option) any later version.
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public
+    License along with this software; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+    02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<bundle>
+	<my>
+		<!-- Key 1 -->
+		<key1>My Default Value In English</key1>
+		<!-- Key 2 -->
+		<key2>My Default Value In English</key2>
+		<!-- Key 3 -->
+		<key3>My Default Value In English</key3>
+	</my>
+</bundle>
\ No newline at end of file

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB1_en-2.xml (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB1_en-2.xml)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB1_en-2.xml	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB1_en-2.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,30 @@
+<?xml version="1.0" ?>
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+    
+    This is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation; either version 2.1 of
+    the License, or (at your option) any later version.
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public
+    License along with this software; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+    02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<bundle>
+	<my>
+		<!-- Key 2 -->
+		<key2>My New Value In English v2</key2>
+		<!-- Key 3 -->
+		<key3>My New Value In English v2</key3>
+	</my>
+</bundle>
\ No newline at end of file

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB1_en.xml (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB1_en.xml)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB1_en.xml	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB1_en.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,30 @@
+<?xml version="1.0" ?>
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+    
+    This is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation; either version 2.1 of
+    the License, or (at your option) any later version.
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public
+    License along with this software; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+    02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<bundle>
+	<my>
+		<!-- Key 1 -->
+		<key1>My New Value In English</key1>
+		<!-- Key 3 -->
+		<key3>My New Value In English</key3>
+	</my>
+</bundle>
\ No newline at end of file

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB1_fr-2.xml (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB1_fr-2.xml)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB1_fr-2.xml	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB1_fr-2.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,30 @@
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+    
+    This is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation; either version 2.1 of
+    the License, or (at your option) any later version.
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public
+    License along with this software; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+    02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<?xml version="1.0" encoding="UTF-8"?>
+<bundle>
+	<my>
+		<!-- Key 1 -->
+		<key1>My Value In French v2 with special characters such as éçàùƔ௵</key1>
+		<!-- Key 3 -->
+		<key3>My Value In French v2 with special characters such as éçàùƔ௵</key3>
+	</my>
+</bundle>
\ No newline at end of file

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB1_fr.xml (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB1_fr.xml)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB1_fr.xml	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB1_fr.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,30 @@
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+    
+    This is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation; either version 2.1 of
+    the License, or (at your option) any later version.
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public
+    License along with this software; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+    02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<?xml version="1.0" encoding="UTF-8"?>
+<bundle>
+	<my>
+		<!-- Key 1 -->
+		<key1>My Value In French with special characters such as éçàùƔ௵</key1>
+		<!-- Key 2 -->
+		<key2>My Value In French with special characters such as éçàùƔ௵</key2>
+	</my>
+</bundle>
\ No newline at end of file

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB2-2.properties (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB2-2.properties)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB2-2.properties	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB2-2.properties	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,21 @@
+#
+# Copyright (C) 2009 eXo Platform SAS.
+# 
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+# 
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+# key1
+my.key1=My Default Value In English v2

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB2.properties (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB2.properties)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB2.properties	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB2.properties	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2009 eXo Platform SAS.
+# 
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+# 
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+# key1
+my.key1=My Default Value In English
+# key2
+my.key2=My Default Value In English
+# key3
+my.key3=My Default Value In English
\ No newline at end of file

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB2_en-2.properties (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB2_en-2.properties)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB2_en-2.properties	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB2_en-2.properties	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2009 eXo Platform SAS.
+# 
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+# 
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+# key2
+my.key2=My New Value In English v2
+# key3
+my.key3=My New Value In English v2

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB2_en.properties (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB2_en.properties)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB2_en.properties	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB2_en.properties	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2009 eXo Platform SAS.
+# 
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+# 
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+# key1
+my.key1=My New Value In English
+# key3
+my.key3=My New Value In English

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB2_fr-2.properties (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB2_fr-2.properties)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB2_fr-2.properties	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB2_fr-2.properties	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2009 eXo Platform SAS.
+# 
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+# 
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+# key1
+my.key1=My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5
+# key3
+my.key3=My Value In French v2 with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5

Copied: portal/trunk/component/resources/src/test/java/locale/test/myRB2_fr.properties (from rev 597, portal/trunk/component/common/src/test/resources/locale/test/myRB2_fr.properties)
===================================================================
--- portal/trunk/component/resources/src/test/java/locale/test/myRB2_fr.properties	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/locale/test/myRB2_fr.properties	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2009 eXo Platform SAS.
+# 
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+# 
+# This software is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+# 
+# You should have received a copy of the GNU Lesser General Public
+# License along with this software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+# key1
+my.key1=My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5
+# key2
+my.key2=My Value In French with special characters such as \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5

Copied: portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java (from rev 597, portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java)
===================================================================
--- portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestExoResourceBundle.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,84 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import junit.framework.TestCase;
+
+public class TestExoResourceBundle extends TestCase
+{
+
+   public void testConstructor()
+   {
+      ExoResourceBundle bundle;
+      bundle = new ExoResourceBundle("key1=value");
+      assertEquals(1, bundle.getContents().length);
+      assertEquals("value", bundle.getString("key1"));
+      bundle = new ExoResourceBundle("key1=value\nkey2=value");
+      assertEquals(2, bundle.getContents().length);
+      assertEquals("value", bundle.getString("key1"));
+      assertEquals("value", bundle.getString("key2"));
+      bundle = new ExoResourceBundle("key1=value\r\nkey2=value");
+      assertEquals(2, bundle.getContents().length);
+      assertEquals("value", bundle.getString("key1"));
+      assertEquals("value", bundle.getString("key2"));
+      bundle = new ExoResourceBundle("#comment\r\nkey2=value");
+      assertEquals(1, bundle.getContents().length);
+      assertEquals("value", bundle.getString("key2"));
+      bundle = new ExoResourceBundle("  #comment\r\nkey2=value");
+      assertEquals(1, bundle.getContents().length);
+      assertEquals("value", bundle.getString("key2"));
+      bundle = new ExoResourceBundle("  bad entry\r\nkey2=value");
+      assertEquals(1, bundle.getContents().length);
+      assertEquals("value", bundle.getString("key2"));
+      bundle = new ExoResourceBundle("#key1 =value\r\nkey2=value");
+      assertEquals(1, bundle.getContents().length);
+      assertEquals("value", bundle.getString("key2"));
+      bundle = new ExoResourceBundle(" key1 =value\r\n key2 =value");
+      assertEquals(2, bundle.getContents().length);
+      assertEquals("value", bundle.getString(" key1 "));
+      assertEquals("value", bundle.getString(" key2 "));
+   }
+
+   public void testUnicode2Char()
+   {
+      for (int i = 0; i < (1 << 16); i++)
+      {
+         String value = Integer.toHexString(i);
+         while (value.length() < 4)
+         {
+            value = "0" + value;
+         }
+         assertEquals((char)i, ExoResourceBundle.unicode2Char("\\u" + value));
+      }
+   }
+
+   public void testConvert()
+   {
+      assertEquals("Normal Value", ExoResourceBundle.convert("Normal Value"));
+      assertEquals("\u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", ExoResourceBundle
+         .convert("\\u00E9\\u00E7\\u00E0\\u00F9\\u0194\\u0BF5"));
+      assertEquals("before \u00E9\u00E7\u00E0\u00F9\u0194\u0BF5", ExoResourceBundle
+         .convert("before \\u00E9\\u00E7\\u00E0\\u00F9\\u0194\\u0BF5"));
+      assertEquals("\u00E9\u00E7\u00E0\u00F9\u0194\u0BF5 after", ExoResourceBundle
+         .convert("\\u00E9\\u00E7\\u00E0\\u00F9\\u0194\\u0BF5 after"));
+      assertEquals("before \u00E9\u00E7\u00E0 between \u00F9\u0194\u0BF5 after", ExoResourceBundle
+         .convert("before \\u00E9\\u00E7\\u00E0 between \\u00F9\\u0194\\u0BF5 after"));
+   }
+}

Copied: portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestLocaleConfigService.java (from rev 597, portal/trunk/component/common/src/test/java/org/exoplatform/services/resources/TestLocaleConfigService.java)
===================================================================
--- portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestLocaleConfigService.java	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/org/exoplatform/services/resources/TestLocaleConfigService.java	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,134 @@
+/**
+ * Copyright (C) 2009 eXo Platform SAS.
+ * 
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.services.resources;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.commons.utils.PropertyManager;
+import org.exoplatform.container.configuration.ConfigurationManagerImpl;
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.container.xml.ValueParam;
+import org.exoplatform.services.resources.impl.LocaleConfigImpl;
+import org.exoplatform.services.resources.impl.LocaleConfigServiceImpl;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestLocaleConfigService extends TestCase
+{
+
+   public TestLocaleConfigService()
+   {
+   }
+
+   public TestLocaleConfigService(String s)
+   {
+      super(s);
+   }
+
+   public void testFoo() throws Exception
+   {
+      PropertyManager.setProperty(PropertyManager.DEVELOPING, "false");
+      LocaleConfigService service = createService();
+      Map<String, LocaleConfig> map = createMap(service);
+      assertEquals(4, map.size());
+      assertCommonConfigs(service);
+   }
+
+   public void testBar() throws Exception
+   {
+      PropertyManager.setProperty(PropertyManager.DEVELOPING, "true");
+      LocaleConfigService service = createService();
+      Map<String, LocaleConfig> map = createMap(service);
+      assertEquals(5, map.size());
+      assertCommonConfigs(service);
+      LocaleConfig ma = service.getLocaleConfig("ma");
+      assertLocaleConfig(ma, "ma", "Default configuration for the debugging locale", "UTF-8", "UTF-8", Orientation.LT,
+         IdentityResourceBundle.MAGIC_LOCALE);
+   }
+
+   public void testLocaleConfig() throws Exception
+   {
+      LocaleConfig ma = new LocaleConfigImpl();
+      ma.setLocale("ma");
+      assertEquals("ma", ma.getLocaleName());
+
+      LocaleConfig ma1 = new LocaleConfigImpl();
+      ma1.setLocale(new Locale("ma"));
+      assertEquals("ma", ma1.getLocaleName());
+   }
+
+   private Map<String, LocaleConfig> createMap(LocaleConfigService service)
+   {
+      Map<String, LocaleConfig> map = new HashMap<String, LocaleConfig>();
+      for (LocaleConfig config : service.getLocalConfigs())
+      {
+         map.put(config.getLanguage(), config);
+      }
+      return map;
+   }
+
+   private LocaleConfigService createService() throws Exception
+   {
+      ConfigurationManagerImpl cm = new ConfigurationManagerImpl();
+      InitParams params = new InitParams();
+      ValueParam param = new ValueParam();
+      param.setName("locale.config.file");
+      param.setValue("classpath:/resources/locales-config.xml");
+      params.addParameter(param);
+
+      //
+      LocaleConfigService service = new LocaleConfigServiceImpl(params, cm);
+      return service;
+   }
+
+   private void assertCommonConfigs(LocaleConfigService service)
+   {
+      LocaleConfig en = service.getLocaleConfig("en");
+      LocaleConfig fr = service.getLocaleConfig("fr");
+      LocaleConfig ar = service.getLocaleConfig("ar");
+      LocaleConfig vi = service.getLocaleConfig("vi");
+      assertLocaleConfig(en, "en", "Default configuration for english locale", "UTF-8", "UTF-8", Orientation.LT,
+         Locale.ENGLISH);
+      assertLocaleConfig(fr, "fr", "Default configuration for the french locale", "UTF-8", "UTF-8", Orientation.LT,
+         Locale.FRANCE);
+      assertLocaleConfig(ar, "ar", "Default configuration for the arabic locale", "UTF-8", "UTF-8", Orientation.RT,
+         new Locale("ar"));
+      assertLocaleConfig(vi, "vi", "Default configuration for the vietnam locale", "UTF-8", "UTF-8", Orientation.LT,
+         new Locale("vi"));
+   }
+
+   private void assertLocaleConfig(LocaleConfig config, String language, String description, String inputEncoding,
+      String outputEncoding, Orientation orientation, Locale locale)
+   {
+      assertNotNull(config);
+      assertEquals(language, config.getLanguage());
+      assertEquals(description, config.getDescription());
+      assertEquals(inputEncoding, config.getInputEncoding());
+      assertEquals(outputEncoding, config.getOutputEncoding());
+      assertEquals(orientation, config.getOrientation());
+      assertEquals(locale, config.getLocale());
+   }
+}

Copied: portal/trunk/component/resources/src/test/java/resources (from rev 597, portal/trunk/component/common/src/test/resources/resources)

Deleted: portal/trunk/component/resources/src/test/java/resources/locales-config.xml
===================================================================
--- portal/trunk/component/common/src/test/resources/resources/locales-config.xml	2009-11-13 22:36:33 UTC (rev 597)
+++ portal/trunk/component/resources/src/test/java/resources/locales-config.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Copyright (C) 2009 eXo Platform SAS.
-    
-    This is free software; you can redistribute it and/or modify it
-    under the terms of the GNU Lesser General Public License as
-    published by the Free Software Foundation; either version 2.1 of
-    the License, or (at your option) any later version.
-    
-    This software is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-    Lesser General Public License for more details.
-    
-    You should have received a copy of the GNU Lesser General Public
-    License along with this software; if not, write to the Free
-    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-    02110-1301 USA, or see the FSF site: http://www.fsf.org.
-
--->
-
-<locales-config>
-
-  <locale-config>
-    <locale>en</locale>
-    <output-encoding>UTF-8</output-encoding>
-    <input-encoding>UTF-8</input-encoding>
-    <description>Default configuration for english locale</description>
-  </locale-config>
-
-  <locale-config>
-    <locale>fr</locale>
-    <output-encoding>UTF-8</output-encoding>
-    <input-encoding>UTF-8</input-encoding>
-    <description>Default configuration for the french locale</description>
-  </locale-config>
-
-	<locale-config>
-		<locale>ar</locale>
-		<output-encoding>UTF-8</output-encoding>
-		<input-encoding>UTF-8</input-encoding>
-		<description>Default configuration for the arabic locale</description>
-		<orientation>rt</orientation>
-	</locale-config>
-
-  <locale-config>
-    <locale>vi</locale>
-    <output-encoding>UTF-8</output-encoding>
-    <input-encoding>UTF-8</input-encoding>
-    <description>Default configuration for the vietnam locale</description>
-    <orientation>lt</orientation>
-  </locale-config>
-</locales-config>

Copied: portal/trunk/component/resources/src/test/java/resources/locales-config.xml (from rev 610, portal/trunk/component/common/src/test/resources/resources/locales-config.xml)
===================================================================
--- portal/trunk/component/resources/src/test/java/resources/locales-config.xml	                        (rev 0)
+++ portal/trunk/component/resources/src/test/java/resources/locales-config.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (C) 2009 eXo Platform SAS.
+    
+    This is free software; you can redistribute it and/or modify it
+    under the terms of the GNU Lesser General Public License as
+    published by the Free Software Foundation; either version 2.1 of
+    the License, or (at your option) any later version.
+    
+    This software is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+    Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public
+    License along with this software; if not, write to the Free
+    Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+    02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+
+<locales-config>
+
+  <locale-config>
+    <locale>en</locale>
+    <output-encoding>UTF-8</output-encoding>
+    <input-encoding>UTF-8</input-encoding>
+    <description>Default configuration for english locale</description>
+  </locale-config>
+
+  <locale-config>
+    <locale>fr</locale>
+    <output-encoding>UTF-8</output-encoding>
+    <input-encoding>UTF-8</input-encoding>
+    <description>Default configuration for the french locale</description>
+  </locale-config>
+
+	<locale-config>
+		<locale>ar</locale>
+		<output-encoding>UTF-8</output-encoding>
+		<input-encoding>UTF-8</input-encoding>
+		<description>Default configuration for the arabic locale</description>
+		<orientation>rt</orientation>
+	</locale-config>
+
+  <locale-config>
+    <locale>vi</locale>
+    <output-encoding>UTF-8</output-encoding>
+    <input-encoding>UTF-8</input-encoding>
+    <description>Default configuration for the vietnam locale</description>
+    <orientation>lt</orientation>
+  </locale-config>
+</locales-config>

Modified: portal/trunk/component/web/pom.xml
===================================================================
--- portal/trunk/component/web/pom.xml	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/component/web/pom.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -55,6 +55,12 @@
     </dependency>
 
     <dependency>
+      <groupId>org.exoplatform.portal</groupId>
+      <artifactId>exo.portal.component.resources</artifactId>
+      <version>3.0.0-CR01-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
       <groupId>org.gatein.wci</groupId>
       <artifactId>wci-wci</artifactId>
       <version>${org.gatein.wci.version}</version>

Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml	2009-11-16 11:44:02 UTC (rev 610)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml	2009-11-16 12:53:30 UTC (rev 611)
@@ -79,7 +79,7 @@
   
   <component>
     <key>org.exoplatform.services.resources.ResourceBundleService</key>
-    <type>org.exoplatform.services.resources.jcr.ResourceBundleServiceImpl</type>
+    <type>org.exoplatform.services.resources.impl.SimpleResourceBundleService</type>
     <init-params>
       <values-param>
         <name>classpath.resources</name>



More information about the gatein-commits mailing list