[jboss-svn-commits] JBL Code SVN: r24148 - in labs/jbossesb/workspace/skeagh: container/osgi/jmsbus and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sun Nov 30 08:43:02 EST 2008


Author: tfennelly
Date: 2008-11-30 08:43:01 -0500 (Sun, 30 Nov 2008)
New Revision: 24148

Modified:
   labs/jbossesb/workspace/skeagh/container/osgi/configloader/src/main/java/org/jboss/esb/osgi/configloader/PropertyLoaderService.java
   labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/pom.xml
   labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/pom.xml
   labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2182

Modified: labs/jbossesb/workspace/skeagh/container/osgi/configloader/src/main/java/org/jboss/esb/osgi/configloader/PropertyLoaderService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/configloader/src/main/java/org/jboss/esb/osgi/configloader/PropertyLoaderService.java	2008-11-30 10:17:54 UTC (rev 24147)
+++ labs/jbossesb/workspace/skeagh/container/osgi/configloader/src/main/java/org/jboss/esb/osgi/configloader/PropertyLoaderService.java	2008-11-30 13:43:01 UTC (rev 24148)
@@ -26,6 +26,7 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Bundle;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 
@@ -132,7 +133,7 @@
                                 Properties propertiesToAdd;
                                 Dictionary propsDictionary;
 
-                                config = configAdminService.getConfiguration(servicePid);
+                                config = configAdminService.getConfiguration(servicePid, getBundleLocation(servicePid, bundleContext));
                                 propsDictionary = config.getProperties();
 
                                 if(propsDictionary != null)
@@ -172,6 +173,38 @@
     }
 
     /**
+     * Get the bundle location.
+     * @param servicePid Service PID of the bundle to be searched for.
+     * @param bundleContext The bundle context.
+     * @return The bundle location corresponding to the supplied service PID.
+     */
+    private String getBundleLocation(final String servicePid, final BundleContext bundleContext)
+    {
+        Bundle[] bundles = bundleContext.getBundles();
+
+        for(Bundle bundle : bundles)
+        {
+            Dictionary headers = bundle.getHeaders();
+            String servicePIDHeader = (String) headers.get("Service-PID");
+
+            if(servicePIDHeader != null)
+            {
+                String[] servicePIDTokens = servicePIDHeader.split(",");
+
+                for(String pid : servicePIDTokens)
+                {
+                    if(servicePid.equals(pid.trim()))
+                    {
+                        return bundle.getLocation();
+                    }
+                }
+            }
+        }
+
+        return null;
+    }
+
+    /**
      * Get the properties files directory.
      * <p/>
      * Checks for the "org.jboss.esb.properties.dir" property in the System and the Bundle

Modified: labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/pom.xml	2008-11-30 10:17:54 UTC (rev 24147)
+++ labs/jbossesb/workspace/skeagh/container/osgi/jmsbus/pom.xml	2008-11-30 13:43:01 UTC (rev 24148)
@@ -44,6 +44,7 @@
                         <Bundle-Activator>org.jboss.esb.osgi.jmsbus.JmsBusProviderActivator</Bundle-Activator>
                         <Embed-Dependency>jbossesb-commons, commons-logging, log4j</Embed-Dependency>
                         <Embed-Transitive>true</Embed-Transitive>
+                        <Service-PID>org.jboss.esb.jmsbus</Service-PID>
                     </instructions>
                 </configuration>
             </plugin>

Modified: labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/pom.xml	2008-11-30 10:17:54 UTC (rev 24147)
+++ labs/jbossesb/workspace/skeagh/examples/jms-router/esb-jms-router/pom.xml	2008-11-30 13:43:01 UTC (rev 24148)
@@ -96,7 +96,7 @@
                         <Embed-Dependency>activemq-core, backport-util-concurrent, log4j, commons-logging, geronimo-j2ee-management_1.1_spec</Embed-Dependency>
                         <Embed-Transitive>true</Embed-Transitive>
                         <JBossESB-ConfigFile>/jboss-esb.xml</JBossESB-ConfigFile>
-                        <JBossESB-DeploymentName>TestDeploymentName</JBossESB-DeploymentName>
+                        <JBossESB-DeploymentName>JMS-Routing-Example-OSGi</JBossESB-DeploymentName>
                     </instructions>
                 </configuration>
             </plugin>

Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java	2008-11-30 10:17:54 UTC (rev 24147)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/main/java/org/jboss/esb/jms/JmsBus.java	2008-11-30 13:43:01 UTC (rev 24148)
@@ -208,7 +208,7 @@
             jmsMessage.setStringProperty(DEPLOYMENT_ID, targetDeploymentId);
             messageSender.send(jmsMessage);
         }
-        catch (JMSException e)
+        catch (Exception e)
         {
             throw new RoutingException("Error sending message to JMS Bus for deployment ID '" + targetDeploymentId + "'.", e);
         }
@@ -231,7 +231,7 @@
             {
                 notificationSender.send(notificationSender.getSession().createObjectMessage(notification));
             }
-            catch (JMSException e)
+            catch (Exception e)
             {
                 throw new RoutingException("Unable to send deployment notification onto JMS Bus.", e);
             }




More information about the jboss-svn-commits mailing list