You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by no...@apache.org on 2010/12/21 10:48:33 UTC

svn commit: r1051435 - in /incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url: Activator.java BlueprintURLContext.java

Author: not
Date: Tue Dec 21 09:48:33 2010
New Revision: 1051435

URL: http://svn.apache.org/viewvc?rev=1051435&view=rev
Log:
ARIES-520 Register the blueprint url context factory unconditionally and update the failure message when a blueprintcontainer service cannot be found to indicate which one couldn't be found.

Modified:
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java
    incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java

Modified: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java?rev=1051435&r1=1051434&r2=1051435&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java (original)
+++ incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/Activator.java Tue Dec 21 09:48:33 2010
@@ -43,6 +43,20 @@ public class Activator implements Bundle
         ctx = context;
         proxyManager = new SingleServiceTracker<ProxyManager>(context, ProxyManager.class, this);
         proxyManager.open();
+        // Blueprint URL scheme requires access to the BlueprintContainer service.
+        // We have an optional import
+        // on org.osgi.service.blueprint.container: only register the blueprint:comp/URL
+        // scheme if it's present
+        try {
+          ctx.getBundle().loadClass("org.osgi.service.blueprint.container.BlueprintContainer");
+          Hashtable<Object, Object> blueprintURlSchemeProps = new Hashtable<Object, Object>();
+          blueprintURlSchemeProps.put(JNDIConstants.JNDI_URLSCHEME, new String[] { "blueprint" });
+          blueprintUrlReg = ctx.registerService(ObjectFactory.class.getName(),
+              new BlueprintURLContextServiceFactory(), blueprintURlSchemeProps);
+        } catch (ClassNotFoundException cnfe) {
+          // The blueprint packages aren't available, so do nothing. That's fine.
+          cnfe.printStackTrace();
+        }
     }
 
     @Override
@@ -60,20 +74,6 @@ public class Activator implements Bundle
     osgiUrlprops.put(JNDIConstants.JNDI_URLSCHEME, new String[] { "osgi", "aries" });
     osgiUrlReg = ctx.registerService(ObjectFactory.class.getName(),
         new OsgiURLContextServiceFactory(), osgiUrlprops);
-
-    // Blueprint URL scheme requires access to the BlueprintContainer service.
-    // We have an optional import
-    // on org.osgi.service.blueprint.container: only register the blueprint:comp/URL
-    // scheme if it's present
-    try {
-      ctx.getBundle().loadClass("org.osgi.service.blueprint.container.BlueprintContainer");
-      Hashtable<Object, Object> blueprintURlSchemeProps = new Hashtable<Object, Object>();
-      blueprintURlSchemeProps.put(JNDIConstants.JNDI_URLSCHEME, new String[] { "blueprint" });
-      blueprintUrlReg = ctx.registerService(ObjectFactory.class.getName(),
-          new BlueprintURLContextServiceFactory(), blueprintURlSchemeProps);
-    } catch (ClassNotFoundException cnfe) {
-      // The blueprint packages aren't available, so do nothing. That's fine.
-    }
   }
 
   @Override
@@ -81,8 +81,6 @@ public class Activator implements Bundle
   {
     if (osgiUrlReg != null) osgiUrlReg.unregister();
     osgiUrlReg = null;
-    if (blueprintUrlReg != null) blueprintUrlReg.unregister();
-    blueprintUrlReg = null;
   }
 
   @Override

Modified: incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java?rev=1051435&r1=1051434&r2=1051435&view=diff
==============================================================================
--- incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java (original)
+++ incubator/aries/trunk/jndi/jndi-url/src/main/java/org/apache/aries/jndi/url/BlueprintURLContext.java Tue Dec 21 09:48:33 2010
@@ -444,7 +444,7 @@ public class BlueprintURLContext impleme
       st.close();
     }
     if (result == null) { 
-      throw new ServiceUnavailableException ("The BlueprintContainer service could not be located");
+      throw new ServiceUnavailableException ("The BlueprintContainer service for bundle: " + b.getSymbolicName() + '_' + b.getVersion() + " not be located");
     }
     return result;
   }