[ 
https://issues.apache.org/jira/browse/GERONIMO-6305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13239548#comment-13239548
 ] 

Jarek Gawor commented on GERONIMO-6305:
---------------------------------------

John,

I was thinking about using the following algorithm (as shown below) that relies 
on PackageAdmin to get the accurate bundle dependencies. I'm concerned that 
relying on BundleInfo especially from OBR might return out-of-date / inaccurate 
dependency information.

Example sorting code (not tested):

Set<Bundle> applicationBundles;

Set<Bundle> sort() {
 Set<Bundle> sorted = new LinkedHashSet<Bundle>();
 for (Bundle b : applicationBundles) { 
   add(b, sorted);
 }
 return sorted;
}

add(Bundle bundle, Set<Bundle> sorted) {
  ExportPackage[] packages = packageAdmin.getExportedPackages(bundle);
  if (packages is non null) {
     for (ExportedPackage exportedPackage : packages) {
        Bundle[] importingBundles = exportedPackage.getImportingBundles();
        for (Bundle importingBundle : importingBundles) {
            if (sorted.contains(importingBundle) {
                // already processed - skip it
            } else if (applicationBundles.contains(importingBundle) {
                add(importingBundle, sorted);
            } else {
               // dependency outside of applicationBundles - ignore it
            }            
       }
     }
  }
  sorted.add(bundle);
}

                
> Start bundles in EBA according to bundle dependencies
> -----------------------------------------------------
>
>                 Key: GERONIMO-6305
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-6305
>             Project: Geronimo
>          Issue Type: New Feature
>      Security Level: public(Regular issues) 
>          Components: osgi-bundles
>            Reporter: Yi Xiao
>            Assignee: Yi Xiao
>         Attachments: startBundlesInOrder_6305.patch
>
>
> As the bundles have the dependency, so need to provide the correct order when 
> they start up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to