[jboss-svn-commits] JBL Code SVN: r23419 - labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/osgi.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Oct 10 05:44:48 EDT 2008


Author: beve
Date: 2008-10-10 05:44:48 -0400 (Fri, 10 Oct 2008)
New Revision: 23419

Modified:
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java
Log:
Added a deployment name to the runtime.

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java	2008-10-10 06:30:58 UTC (rev 23418)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/osgi/DeploymentRegistry.java	2008-10-10 09:44:48 UTC (rev 23419)
@@ -31,6 +31,13 @@
     private static final String CONFIG_FILE_HEADER = "JBossESB-ConfigFile";
 
     /**
+     * Header that can be placed in the MANIFEST.MF file to
+     * specify a different deployment name then the default, which
+     * is the bundle name.
+     */
+    private static final String DEPLOYMENT_NAME_HEADER = "JBossESB-DeploymentName";
+
+    /**
      * Set of activated deployments.
      */
     private HashMap<Bundle,DeploymentRuntime> activated = new HashMap<Bundle,DeploymentRuntime>();
@@ -62,6 +69,7 @@
             //TODO: Use logging service
             System.out.println("Found config : " + configUrl + " for bundle : " + bundle);
             DeploymentRuntime runtime = DeploymentUtil.createRuntime(configUrl.openStream(), new BundleResourceLocator(bundle));
+            runtime.setDeploymentName(getDeploymentName(bundle));
             runtime.deploy();
 
             synchronized (activated)
@@ -127,6 +135,17 @@
         return bundle.getEntry(configFileName);
     }
 
+    private String getDeploymentName(final Bundle bundle)
+    {
+        final Dictionary headers = bundle.getHeaders();
+        String deploymentName = (String)headers.get(DEPLOYMENT_NAME_HEADER);
+        if (deploymentName == null)
+        {
+            deploymentName = bundle.getSymbolicName();
+        }
+        return deploymentName;
+    }
+
     /**
      * Close this registry.
      */




More information about the jboss-svn-commits mailing list