incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1378151 - in /sling/trunk/contrib/extensions/i18n: pom.xml src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
Date Tue, 28 Aug 2012 14:36:28 GMT
Author: cziegeler
Date: Tue Aug 28 14:36:28 2012
New Revision: 1378151

URL: http://svn.apache.org/viewvc?rev=1378151&view=rev
Log:
SLING-2576 : I18n: Allow multiple ResourceBundleProviders, use the first one responding for
a given locale

Modified:
    sling/trunk/contrib/extensions/i18n/pom.xml
    sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java

Modified: sling/trunk/contrib/extensions/i18n/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/i18n/pom.xml?rev=1378151&r1=1378150&r2=1378151&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/i18n/pom.xml (original)
+++ sling/trunk/contrib/extensions/i18n/pom.xml Tue Aug 28 14:36:28 2012
@@ -71,7 +71,7 @@
                             SLING-INF/nodetypes/message.cnd
                         </Sling-Nodetypes>
                         <Embed-Dependency>
-                            org.apache.sling.commons.osgi;inline="org/apache/sling/commons/osgi/ServiceUtil*"
+                            org.apache.sling.commons.osgi;inline="org/apache/sling/commons/osgi/ServiceUtil*|org/apache/sling/commons/osgi/PropertiesUtil*"
                         </Embed-Dependency>
 
                     </instructions>

Modified: sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java?rev=1378151&r1=1378150&r2=1378151&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
(original)
+++ sling/trunk/contrib/extensions/i18n/src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java
Tue Aug 28 14:36:28 2012
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.i18n.impl;
 
+import static org.apache.sling.i18n.impl.JcrResourceBundle.PROP_BASENAME;
+import static org.apache.sling.i18n.impl.JcrResourceBundle.PROP_LANGUAGE;
+
 import java.util.ArrayList;
 import java.util.Dictionary;
 import java.util.HashMap;
@@ -48,7 +51,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceResolverFactory;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.i18n.ResourceBundleProvider;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
@@ -56,8 +59,6 @@ import org.osgi.service.component.Compon
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.sling.i18n.impl.JcrResourceBundle.*;
-
 /**
  * The <code>JcrResourceBundleProvider</code> implements the
  * <code>ResourceBundleProvider</code> interface creating
@@ -192,21 +193,21 @@ public class JcrResourceBundleProvider i
     protected void activate(ComponentContext context) {
         Dictionary<?, ?> props = context.getProperties();
 
-        String user = OsgiUtil.toString(props.get(PROP_USER), null);
+        String user = PropertiesUtil.toString(props.get(PROP_USER), null);
         if (user == null || user.length() == 0) {
             repoCredentials = null;
         } else {
-            String pass = OsgiUtil.toString(props.get(PROP_PASS), null);
+            String pass = PropertiesUtil.toString(props.get(PROP_PASS), null);
             char[] pwd = (pass == null) ? new char[0] : pass.toCharArray();
             repoCredentials = new HashMap<String, Object>();
             repoCredentials.put(ResourceResolverFactory.USER, user);
             repoCredentials.put(ResourceResolverFactory.PASSWORD, pwd);
         }
 
-        String localeString = OsgiUtil.toString(props.get(PROP_DEFAULT_LOCALE),
+        String localeString = PropertiesUtil.toString(props.get(PROP_DEFAULT_LOCALE),
             null);
         this.defaultLocale = toLocale(localeString);
-        this.preloadBundles = OsgiUtil.toBoolean(props.get(PROP_PRELOAD_BUNDLES), DEFAULT_PRELOAD_BUNDLES);
+        this.preloadBundles = PropertiesUtil.toBoolean(props.get(PROP_PRELOAD_BUNDLES), DEFAULT_PRELOAD_BUNDLES);
 
         this.bundleContext = context.getBundleContext();
         this.bundleServiceRegistrations = new ArrayList<ServiceRegistration>();



Mime
View raw message