Exemplo n.º 1
0
 final PackageSource createExportPackageSource(
     ExportPackageDescription export, KeyedHashSet visited) {
   BundleLoaderProxy exportProxy = getLoaderProxy(export.getExporter());
   if (exportProxy == null)
     // TODO log error!!
     return null;
   PackageSource requiredSource =
       exportProxy.getBundleLoader().findRequiredSource(export.getName(), visited);
   PackageSource exportSource = exportProxy.createPackageSource(export, false);
   if (requiredSource == null) return exportSource;
   return createMultiSource(export.getName(), new PackageSource[] {requiredSource, exportSource});
 }
Exemplo n.º 2
0
  /**
   * This will iterate over the "Export-Package" manifest header of the given bundle and search a
   * bundle corresponding to the given qualified class name.
   *
   * <p>For example, if the qualified name we're given is "org.eclipse.acceleo.sample.Test", we'll
   * search for a bundle exporting the package "org.eclipse.acceleo.sample".
   *
   * @param model The bundle model that is to be checked.
   * @param qualifiedName Qualified name of the class we search the exported package of.
   * @return <code>true</code> iff <code>model</code> has an entry for a package corresponding to
   *     <code>qualifiedName</code>.
   */
  private static boolean hasCorrespondingExportPackage(
      IPluginModelBase model, String qualifiedName) {
    String packageName = ""; // $NON-NLS-1$
    final int end = qualifiedName.lastIndexOf('.');
    if (end != -1) {
      packageName = qualifiedName.substring(0, end);
    }

    for (ExportPackageDescription exported : model.getBundleDescription().getExportPackages()) {
      if (packageName.startsWith(exported.getName())) {
        return true;
      }
    }

    return false;
  }
 public void checkWiringState_6() {
   ExportPackageDescription[] exports = bundle_6.getResolvedImports();
   assertNotNull("export array is unexpectedly null", exports);
   assertTrue("export array is unexpectedly empty", exports.length > 0);
   for (int i = 0; i < exports.length; i++) {
     ExportPackageDescription exp = exports[i];
     String exportPackageName = exp.getName();
     assertNotNull("package name is null", exportPackageName);
     if (exportPackageName.equals("org.w3c.dom")) {
       assertNotNull("Package [org.w3c.dom] is not wired when it should be ", exp.getExporter());
       assertEquals("Package [org.w3c.dom] is wired incorrectly ", exp.getExporter(), bundle_4);
     } else if (exportPackageName.equals("org.xml.sax")) {
       assertNotNull("Package [org.xml.sax] is not wired when it should be ", exp.getExporter());
       assertEquals("Package [org.xml.sax] is wired incorrectly ", exp.getExporter(), bundle_3);
     }
   } // end for
 } // end method
Exemplo n.º 4
0
 public ExportPackageInfo(ExportPackageDescription exportPackageDescription) {
   name = exportPackageDescription.getName();
   version = exportPackageDescription.getVersion().toString();
   attributes = exportPackageDescription.getAttributes();
   directives = exportPackageDescription.getDirectives();
 }