BundleDescription.<init>
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.apache.xbean.osgi.bundle.util.BundleDescription.<init> (Showing top 13 results out of 315)

  • Common ways to obtain BundleDescription
private void myMethod () {
BundleDescription b =
  • Bundle bundle;new BundleDescription(bundle.getHeaders())
  • Smart code suggestions by Codota
}
origin: org.apache.xbean/xbean-finder-shaded

private void initialize() {
  BundleDescription description = new BundleDescription(bundle.getHeaders());
  List<BundleDescription.ImportPackage> imports = description.getExternalImports();
  for (BundleDescription.ImportPackage packageImport : imports) {
    String packageName = packageImport.getName();
    ExportedPackage[] exports = packageAdmin.getExportedPackages(packageName);
    Bundle wiredBundle = isWired(bundle, exports);
    if (wiredBundle != null) {
      wiredImportedPackageNames.add(packageName.replace('.', '/'));
      break;
    }
  }
}
origin: org.apache.openejb.patch/xbean-finder-shaded

private void initialize() {
  BundleDescription description = new BundleDescription(bundle.getHeaders());
  List<BundleDescription.ImportPackage> imports = description.getExternalImports();
  for (BundleDescription.ImportPackage packageImport : imports) {
    String packageName = packageImport.getName();
    ExportedPackage[] exports = packageAdmin.getExportedPackages(packageName);
    Bundle wiredBundle = isWired(bundle, exports);
    if (wiredBundle != null) {
      wiredImportedPackageNames.add(packageName.replace('.', '/'));
      break;
    }
  }
}
origin: org.apache.xbean/xbean-finder

private void initialize() {
  BundleDescription description = new BundleDescription(bundle.getHeaders());
  List<BundleDescription.ImportPackage> imports = description.getExternalImports();
  for (BundleDescription.ImportPackage packageImport : imports) {
    String packageName = packageImport.getName();
    ExportedPackage[] exports = packageAdmin.getExportedPackages(packageName);
    Bundle wiredBundle = isWired(bundle, exports);
    if (wiredBundle != null) {
      wiredImportedPackageNames.add(packageName.replace('.', '/'));
      break;
    }
  }
}
origin: org.apache.xbean/xbean-bundleutils

private void scanRequireBundles(Collection<String> classes, Bundle bundle) {
  BundleDescription description = new BundleDescription(bundle.getHeaders());
  List<RequireBundle> requiredBundleList = description.getRequireBundle();
  for (RequireBundle requiredBundle : requiredBundleList) {
    RequiredBundle[] requiredBundles = packageAdmin.getRequiredBundles(requiredBundle.getName());
    Bundle wiredBundle = isWired(bundle, requiredBundles);
    if (wiredBundle != null) {
      BundleDescription wiredBundleDescription = new BundleDescription(wiredBundle.getHeaders());
      List<ExportPackage> exportPackages = wiredBundleDescription.getExportPackage();
      Set<String> exportedPackageNames = new HashSet<String>();
      for (ExportPackage exportPackage : exportPackages) {
        exportedPackageNames.add(exportPackage.getName());
      }
      Set<String> allClasses = findAllClasses(wiredBundle, discoveryFilter, exportedPackageNames);
      classes.addAll(allClasses);
    }
  }
}
origin: org.apache.geronimo.plugins/console-base-portlets

private Set<PackageBundlePair> getDynamicImportingPairs(PackageAdmin packageAdmin, Bundle bundle, Set<String> wiredPackages) {
  BundleDescription description = new BundleDescription(bundle.getHeaders());
  
  Set<PackageBundlePair> dynamicImportingPairs = new HashSet<PackageBundlePair>();
  
  if (!description.getDynamicImportPackage().isEmpty()) {
    for (Bundle b : bundle.getBundleContext().getBundles()) {
      
      // find the packages that importing from the bundle
      ExportedPackage[] exportedPackages = packageAdmin.getExportedPackages(b);
      if (exportedPackages != null) {
        for (ExportedPackage exportedPackage : exportedPackages) {
          if (wiredPackages.contains(toString(exportedPackage))) {
            continue;
          }
          Bundle[] importingBundles = exportedPackage.getImportingBundles();                        
          if (containsBundle(importingBundles, bundle)) {
            dynamicImportingPairs.add(new PackageBundlePair(exportedPackage, b));
          }
        }
      }
      
    }
  }
  
  return dynamicImportingPairs;
}

origin: org.apache.geronimo.modules/geronimo-aries-jpa

if (persistenceBundle.getState() == Bundle.INSTALLED && providerReference != null) {
  Bundle providerBundle = providerReference.getBundle();
  BundleDescription providerDescription = new BundleDescription(providerBundle.getHeaders());            
  if (needsProviderImports(persistenceBundle, providerDescription)) {
origin: org.apache.geronimo.plugins/console-base-portlets

BundleDescription description = new BundleDescription(bundle.getHeaders());
origin: org.apache.xbean/xbean-bundleutils

private void scanBundleClassPath(Collection<String> resources, Bundle bundle) {
  BundleDescription description = new BundleDescription(bundle.getHeaders());
  List<HeaderEntry> paths = description.getBundleClassPath();
  if (paths.isEmpty()) {
    scanDirectory(resources, bundle, "/");
  } else {
    for (HeaderEntry path : paths) {
      String name = path.getName();
      if (name.equals(".") || name.equals("/")) {
        // scan root
        scanDirectory(resources, bundle, "/");
      } else if (name.endsWith(".jar") || name.endsWith(".zip")) {
        // scan embedded jar/zip
        scanZip(resources, bundle, name);
      } else {
        // assume it's a directory
        scanDirectory(resources, bundle, "/" + name);
      }
    }
  }
}
origin: org.apache.xbean/xbean-bundleutils

private boolean scanBundleClassPath(ResourceFinderCallback callback, Bundle bundle) throws Exception {
  BundleDescription desc = new BundleDescription(bundle.getHeaders());
  List<HeaderEntry> paths = desc.getBundleClassPath();
  boolean continueScanning = true;
  if (paths.isEmpty()) {
    continueScanning = scanDirectory(callback, bundle, prefix);
  } else {
    for (HeaderEntry path : paths) {
      String name = path.getName();
      if (name.equals(".") || name.equals("/")) {
        // scan root
        continueScanning = scanDirectory(callback, bundle, prefix);
      } else if (name.endsWith(".jar") || name.endsWith(".zip")) {
        // scan embedded jar/zip
        continueScanning = scanZip(callback, bundle, name);
      } else {
        // assume it's a directory                    
        continueScanning = scanDirectory(callback, bundle, prefix.startsWith("/") ? name + prefix : name + "/" + prefix);
      }
      if (!continueScanning) {
        break;
      }
    }
  }
  return continueScanning;
}
origin: org.apache.xbean/xbean-bundleutils

public static LinkedHashSet<Bundle> getWiredBundles(PackageAdmin packageAdmin, Bundle bundle) {
  BundleDescription description = new BundleDescription(bundle.getHeaders());
  // handle static wire via Import-Package
  List<BundleDescription.ImportPackage> imports = description.getExternalImports();
  LinkedHashSet<Bundle> wiredBundles = new LinkedHashSet<Bundle>();
  for (BundleDescription.ImportPackage packageImport : imports) {
    ExportedPackage[] exports = packageAdmin.getExportedPackages(packageImport.getName());
    Bundle wiredBundle = getWiredBundle(bundle, exports);
    if (wiredBundle != null) {
      wiredBundles.add(wiredBundle);
    }
  }
  // handle dynamic wire via DynamicImport-Package
  if (!description.getDynamicImportPackage().isEmpty()) {
    for (Bundle b : bundle.getBundleContext().getBundles()) {
      if (!wiredBundles.contains(b)) {
        ExportedPackage[] exports = packageAdmin.getExportedPackages(b);
        Bundle wiredBundle = getWiredBundle(bundle, exports);
        if (wiredBundle != null) {
          wiredBundles.add(wiredBundle);
        }
      }
    }
  }
  return wiredBundles;
}
origin: org.apache.geronimo.modules/geronimo-aries-jpa

private boolean needsProviderImports(Bundle persistenceBundle, BundleDescription providerDescription) {
  BundleDescription description = new BundleDescription(persistenceBundle.getHeaders());
  
  for (HeaderEntry importPackage : description.getDynamicImportPackage()) {
    if ("*".equals(importPackage.getName())) {
      LOG.debug("Persistence bundle {} can load any class.", 
           persistenceBundle.getSymbolicName());
      return false;
    }
  }
  
  for (ImportPackage importPackage : description.getImportPackage()) {
    for (ExportPackage exportPackage : providerDescription.getExportPackage()) {
      if (importPackage.getName().equals(exportPackage.getName())
        && importPackage.getVersionRange().isInRange(exportPackage.getVersion())) {
        LOG.debug("Persistence bundle {} already imports at least one package from JPA provider bundle.",
             persistenceBundle.getSymbolicName());
        return false;
      }
    }
  }
  
  return true;
}

origin: org.apache.xbean/xbean-bundleutils

private void scanImportPackages(Collection<String> classes, Bundle host, Bundle fragment) {
  BundleDescription description = new BundleDescription(fragment.getHeaders());
  List<BundleDescription.ImportPackage> imports = description.getExternalImports();
  for (BundleDescription.ImportPackage packageImport : imports) {
    String packageName = packageImport.getName();
    if (discoveryFilter.packageDiscoveryRequired(packageName)) {
      ExportedPackage[] exports = packageAdmin.getExportedPackages(packageName);
      Bundle wiredBundle = isWired(host, exports);
      if (wiredBundle != null) {
        Set<String> allClasses = findAllClasses(wiredBundle, packageName);
        classes.addAll(allClasses);
      }
    }
  }
}
origin: org.apache.geronimo.plugins/console-base-portlets

private Set<PackageBundlePair> getImportingPairs(PackageAdmin packageAdmin, Bundle bundle, Set<String> wiredPackages) {
      
  BundleDescription description = new BundleDescription(bundle.getHeaders());
  
  Set<PackageBundlePair> importingPairs = new HashSet<PackageBundlePair>();
  List<BundleDescription.ImportPackage> imports = description.getImportPackage();
  for (BundleDescription.ImportPackage packageImport : imports) {
    //find the packages that we are importing
    ExportedPackage[] exportedPackages = packageAdmin.getExportedPackages(packageImport.getName());
    if (exportedPackages == null) {
      importingPairs.add(new PackageBundlePair(packageImport.getName(), packageImport.getVersionRange().toString(), null));
    } else {
      for (ExportedPackage exportedPackage : exportedPackages) {
        Bundle exportingBundle = exportedPackage.getExportingBundle();
        if (exportingBundle != bundle && containsBundle(exportedPackage.getImportingBundles(), bundle)) {
          importingPairs.add(new PackageBundlePair(packageImport.getName(), packageImport.getVersionRange().toString(), exportedPackage.getExportingBundle()));
          wiredPackages.add(toString(exportedPackage));
        }                    
      }
    }
    
  }
  return importingPairs;
}
org.apache.xbean.osgi.bundle.utilBundleDescription<init>

Popular methods of BundleDescription

  • getExternalImports
    Returns a list of packages that are listed in Import-Package header and are not listed in Export-Pa
  • getDynamicImportPackage
    Returns a list of packages that are listed in DynamicImport-Package header.
  • getImportPackage
    Returns a list of packages that are listed in Import-Package header.
  • getExportPackage
    Returns a list of packages that are listed in Export-Package header.
  • getRequireBundle
    Returns a list of bundle names that are listed in Require-Bundle header.
  • getBundleClassPath
    Returns a list of paths that are listed in Bundle-ClassPath header.
  • getVersionRange
  • isExported
  • manifestToMap
  • parseStandardHeader

Popular in Java

  • Parsing JSON documents to java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)