aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1103428 - in /aries/trunk/jndi: jndi-core/ jndi-core/src/main/java/org/apache/aries/jndi/ jndi-core/src/main/java/org/apache/aries/jndi/startup/ jndi-core/src/main/resources/ jndi-core/src/main/resources/org/ jndi-core/src/main/resources/o...
Date Sun, 15 May 2011 15:22:50 GMT
Author: not
Date: Sun May 15 15:22:49 2011
New Revision: 1103428

URL: http://svn.apache.org/viewvc?rev=1103428&view=rev
Log:
ARIES-467 Externalize error messages so translation is possible.

Added:
    aries/trunk/jndi/jndi-core/src/main/resources/
    aries/trunk/jndi/jndi-core/src/main/resources/org/
    aries/trunk/jndi/jndi-core/src/main/resources/org/apache/
    aries/trunk/jndi/jndi-core/src/main/resources/org/apache/aries/
    aries/trunk/jndi/jndi-core/src/main/resources/org/apache/aries/jndi/
    aries/trunk/jndi/jndi-core/src/main/resources/org/apache/aries/jndi/nls/
    aries/trunk/jndi/jndi-core/src/main/resources/org/apache/aries/jndi/nls/jndiMessages.properties
  (with props)
    aries/trunk/jndi/jndi-rmi/src/main/resources/
    aries/trunk/jndi/jndi-rmi/src/main/resources/org/
    aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/
    aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/aries/
    aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/aries/jndi/
    aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/aries/jndi/nls/
    aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/aries/jndi/nls/jndiRmiMessages.properties
  (with props)
    aries/trunk/jndi/jndi-url/src/main/resources/
    aries/trunk/jndi/jndi-url/src/main/resources/org/
    aries/trunk/jndi/jndi-url/src/main/resources/org/apache/
    aries/trunk/jndi/jndi-url/src/main/resources/org/apache/aries/
    aries/trunk/jndi/jndi-url/src/main/resources/org/apache/aries/jndi/
    aries/trunk/jndi/jndi-url/src/main/resources/org/apache/aries/jndi/nls/
    aries/trunk/jndi/jndi-url/src/main/resources/org/apache/aries/jndi/nls/jndiUrlMessages.properties
  (with props)
Modified:
    aries/trunk/jndi/jndi-core/pom.xml
    aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java
    aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiInitialContextFactoryBuilder.java
    aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java
    aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java
    aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
    aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java
    aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
    aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java
    aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryContext.java

Modified: aries/trunk/jndi/jndi-core/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/pom.xml?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/pom.xml (original)
+++ aries/trunk/jndi/jndi-core/pom.xml Sun May 15 15:22:49 2011
@@ -89,6 +89,11 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.aries</groupId>
+            <artifactId>org.apache.aries.util</artifactId>
+            <version>0.4-SNAPSHOT</version>
+        </dependency>
 
     </dependencies>
 

Modified: aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java (original)
+++ aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ContextHelper.java Sun
May 15 15:22:49 2011
@@ -124,7 +124,7 @@ public final class ContextHelper {
           if (contextFactoryClass == null) {
             return new DelegateContext(context, environment);
           } else {
-            throw new NoInitialContextException("We could not find a provider for the InitialContextFactory
" + contextFactoryClass);
+            throw new NoInitialContextException(Utils.MESSAGES.getMessage("no.initial.context.factory",
contextFactoryClass));
           }
         }
     }

Modified: aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiInitialContextFactoryBuilder.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiInitialContextFactoryBuilder.java?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiInitialContextFactoryBuilder.java
(original)
+++ aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/OSGiInitialContextFactoryBuilder.java
Sun May 15 15:22:49 2011
@@ -43,7 +43,7 @@ public class OSGiInitialContextFactoryBu
 	  
 	    BundleContext context = Utils.getBundleContext(environment, InitialContext.class);	
   
 	    if (context == null) {
-            throw new NoInitialContextException("Unable to determine caller's BundleContext");
+            throw new NoInitialContextException(Utils.MESSAGES.getMessage("cannot.find.callers.bundlecontext"));
 	    }
 	    	    
 	    return ContextHelper.getInitialContext(context, environment);

Modified: aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java
(original)
+++ aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/ObjectFactoryHelper.java
Sun May 15 15:22:49 2011
@@ -181,7 +181,7 @@ public class ObjectFactoryHelper impleme
 		            }
 		        } catch (InvalidSyntaxException e) {
 		            // should not happen
-		            throw new RuntimeException("Invalid filter", e);
+                    throw new RuntimeException(Utils.MESSAGES.getMessage("null.is.invalid.filter"),
e);
 		        }
 
 		        ObjectFactory factory = null;

Modified: aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java (original)
+++ aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/Utils.java Sun May 15 15:22:49
2011
@@ -30,6 +30,7 @@ import javax.naming.NamingException;
 
 import org.apache.aries.jndi.spi.EnvironmentAugmentation;
 import org.apache.aries.jndi.startup.Activator;
+import org.apache.aries.util.nls.MessageUtil;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleReference;
 import org.osgi.framework.InvalidSyntaxException;
@@ -42,6 +43,7 @@ public final class Utils {
 
     public static final Comparator<ServiceReference> SERVICE_REFERENCE_COMPARATOR =

         new ServiceReferenceComparator();
+    public static final MessageUtil MESSAGES = MessageUtil.createMessageUtil(Utils.class,
"org.apache.aries.jndi.nls.jndiMessages");
 
     /** Ensure no one constructs us */
     private Utils() {
@@ -172,7 +174,7 @@ public final class Utils {
     				return ctx.getServiceReferences(clazz.getName(), null);
     			} catch (InvalidSyntaxException ise) {
     				// should not happen
-    				throw new RuntimeException("Invalid filter", ise);
+    				throw new RuntimeException(MESSAGES.getMessage("null.is.invalid.filter"), ise);
     			}
     		}    		
 		});

Modified: aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
(original)
+++ aries/trunk/jndi/jndi-core/src/main/java/org/apache/aries/jndi/startup/Activator.java
Sun May 15 15:22:49 2011
@@ -76,9 +76,9 @@ public class Activator implements Bundle
             NamingManager.setInitialContextFactoryBuilder(builder);
             icfBuilder = builder;
         } catch (NamingException e) {
-            LOGGER.info("Cannot set the InitialContextFactoryBuilder.", e);
+            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB"), e);
         } catch (IllegalStateException e) {
-            LOGGER.info("Cannot set the InitialContextFactoryBuilder. Another builder " +
getClassName(InitialContextFactoryBuilder.class) + " is already installed", e);
+            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.ICFB.already.exists",
getClassName(InitialContextFactoryBuilder.class)), e);
         }
 
         try {
@@ -86,9 +86,9 @@ public class Activator implements Bundle
             NamingManager.setObjectFactoryBuilder(builder);
             ofBuilder = builder;
         } catch (NamingException e) {
-            LOGGER.info("Cannot set the ObjectFactoryBuilder.", e);
+            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.OFB"), e);
         } catch (IllegalStateException e) {
-            LOGGER.info("Cannot set the ObjectFactoryBuilder. Another builder " + getClassName(InitialContextFactoryBuilder.class)
+ " is already installed", e);
+            LOGGER.info(Utils.MESSAGES.getMessage("unable.to.set.static.OFB.already.exists",
getClassName(InitialContextFactoryBuilder.class)), e);
         }
 
         context.registerService(JNDIProviderAdmin.class.getName(),

Added: aries/trunk/jndi/jndi-core/src/main/resources/org/apache/aries/jndi/nls/jndiMessages.properties
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-core/src/main/resources/org/apache/aries/jndi/nls/jndiMessages.properties?rev=1103428&view=auto
==============================================================================
--- aries/trunk/jndi/jndi-core/src/main/resources/org/apache/aries/jndi/nls/jndiMessages.properties
(added)
+++ aries/trunk/jndi/jndi-core/src/main/resources/org/apache/aries/jndi/nls/jndiMessages.properties
Sun May 15 15:22:49 2011
@@ -0,0 +1,35 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# {0} The class name of the requested ICF
+no.initial.context.factory=Unable to find the InitialContextFactory {0}.
+null.is.invalid.filter=Unexpected error. The OSGi framework has decided null is no longer
a valid filter.
+cannot.find.callers.bundlecontext=The calling code's BundleContext could not be determined.
+unable.to.set.static.ICFB=A failure occurred when attempting to register an InitialContextFactoryBuilder
with the NamingManager. \
+ Support for calling new InitialContext() will not be enabled.
+# {0} The name of the registered ICFB
+unable.to.set.static.ICFB.already.exists=It was not possible to register an InitialContextFactoryBuilder
with the NamingManager because \
+ another builder called {0} was already registered. Support for calling new InitialContext()
will not be enabled.
+unable.to.set.static.OFB=A failure occurred when attempting to register an ObjectFactoryBuilder
with the NamingManager. \
+ Looking up certain objects may not work correctly.
+# {0} The name of the registered OFB
+unable.to.set.static.OFB.already.exists=It was not possible to register an ObjectFactoryBuilder
with the NamingManager because \
+ another builder called {0} was already registered. Looking up certain objects may not work
correctly.
+
+ 
\ No newline at end of file

Propchange: aries/trunk/jndi/jndi-core/src/main/resources/org/apache/aries/jndi/nls/jndiMessages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java (original)
+++ aries/trunk/jndi/jndi-rmi/src/main/java/org/apache/aries/jndi/rmi/Activator.java Sun May
15 15:22:49 2011
@@ -23,6 +23,7 @@ import java.util.Hashtable;
 import javax.naming.spi.ObjectFactory;
 
 import org.apache.aries.util.AriesFrameworkUtil;
+import org.apache.aries.util.nls.MessageUtil;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
@@ -50,7 +51,8 @@ public class Activator implements Bundle
         }
         catch (Exception e)
         {
-            LOGGER.info("Could not create the jndi rmi url factory.", e);
+            MessageUtil msg = MessageUtil.createMessageUtil(Activator.class, "org.apache.aries.jndi.nls.jndiRmiMessages");
+            LOGGER.info(msg.getMessage("rmi.factory.creation.failed"), e);
         }
     }
 

Added: aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/aries/jndi/nls/jndiRmiMessages.properties
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/aries/jndi/nls/jndiRmiMessages.properties?rev=1103428&view=auto
==============================================================================
--- aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/aries/jndi/nls/jndiRmiMessages.properties
(added)
+++ aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/aries/jndi/nls/jndiRmiMessages.properties
Sun May 15 15:22:49 2011
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+rmi.factory.creation.failed=A failure occurred while attempting to create the handler for
the rmi JNDI URL scheme.
\ No newline at end of file

Propchange: aries/trunk/jndi/jndi-rmi/src/main/resources/org/apache/aries/jndi/nls/jndiRmiMessages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
(original)
+++ aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/services/ServiceHelper.java
Sun May 15 15:22:49 2011
@@ -37,6 +37,7 @@ import org.apache.aries.jndi.url.Activat
 import org.apache.aries.jndi.url.OsgiName;
 import org.apache.aries.proxy.ProxyManager;
 import org.apache.aries.proxy.UnableToProxyException;
+import org.apache.aries.util.nls.MessageUtil;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
@@ -208,6 +209,7 @@ public final class ServiceHelper
   /** A cache of proxies returned to the client */
   private static final ConcurrentMap<ServiceKey, WeakReference<Object>> proxyCache
= new ConcurrentHashMap<ServiceKey, WeakReference<Object>>();
   private static final CacheClearoutListener cacheClearoutListener = new CacheClearoutListener(proxyCache);
+  public static final MessageUtil MESSAGES = MessageUtil.createMessageUtil(ServiceHelper.class,
"org.apache.aries.jndi.nls.jndiUrlMessages");
 
   public static Object getService(BundleContext ctx, OsgiName lookupName, String id,
                                   boolean dynamicRebind, Map<String, Object> env, boolean
requireProxy) throws NamingException
@@ -360,7 +362,7 @@ public final class ServiceHelper
     } catch (UnableToProxyException e) {
       throw new IllegalArgumentException(e);
     } catch (RuntimeException e) {
-      throw new IllegalArgumentException("Unable to create proxy for " + pair.ref, e);
+      throw new IllegalArgumentException(MESSAGES.getMessage("unable.to.create.proxy", pair.ref),
e);
     }
   }
 

Modified: aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java
(original)
+++ aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java
Sun May 15 15:22:49 2011
@@ -42,6 +42,7 @@ import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
 import javax.naming.ServiceUnavailableException;
 
+import org.apache.aries.jndi.services.ServiceHelper;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
@@ -444,7 +445,7 @@ public class BlueprintURLContext impleme
       st.close();
     }
     if (result == null) { 
-      throw new ServiceUnavailableException ("The BlueprintContainer service for bundle:
" + b.getSymbolicName() + '_' + b.getVersion() + " not be located");
+      throw new ServiceUnavailableException (ServiceHelper.MESSAGES.getMessage("no.blueprint.container",
b.getSymbolicName() + '/' + b.getVersion()));
     }
     return result;
   }

Modified: aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryContext.java
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryContext.java?rev=1103428&r1=1103427&r2=1103428&view=diff
==============================================================================
--- aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryContext.java
(original)
+++ aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/ServiceRegistryContext.java
Sun May 15 15:22:49 2011
@@ -90,7 +90,7 @@ public class ServiceRegistryContext exte
                     AccessController.checkPermission(adminPermission);
                     return callerContext;
                 } catch (AccessControlException accessControlException) {
-                    NamingException namingException = new NameNotFoundException("Caller does
not have permissions to get BundleContext.");
+                    NamingException namingException = new NameNotFoundException(ServiceHelper.MESSAGES.getMessage("caller.not.priviledged"));
                     namingException.setRootCause(accessControlException);
                     throw namingException;
                 }

Added: aries/trunk/jndi/jndi-url/src/main/resources/org/apache/aries/jndi/nls/jndiUrlMessages.properties
URL: http://svn.apache.org/viewvc/aries/trunk/jndi/jndi-url/src/main/resources/org/apache/aries/jndi/nls/jndiUrlMessages.properties?rev=1103428&view=auto
==============================================================================
--- aries/trunk/jndi/jndi-url/src/main/resources/org/apache/aries/jndi/nls/jndiUrlMessages.properties
(added)
+++ aries/trunk/jndi/jndi-url/src/main/resources/org/apache/aries/jndi/nls/jndiUrlMessages.properties
Sun May 15 15:22:49 2011
@@ -0,0 +1,24 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# {0} The service reference
+unable.to.create.proxy=Unable to create a proxy for {0}.
+# {0} The bundle identity (symbolic-name/version)
+no.blueprint.container=The BlueprintContainer service for bundle {0} not be located
+caller.not.priviledged=The Caller does not have permissions to get the BundleContext.
\ No newline at end of file

Propchange: aries/trunk/jndi/jndi-url/src/main/resources/org/apache/aries/jndi/nls/jndiUrlMessages.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message