Package org.eclipse.osgi.baseadaptor.bundlefile

Examples of org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry


   * @param path the requested entry path.
   * @param classPathIndex the index of the ClasspathEntry to search
   * @return the requested entry or null if the entry does not exist
   */
  public BundleEntry findLocalEntry(String path, int classPathIndex) {
    BundleEntry result = null;
    int curIndex = 0;
    for (int i = 0; i < entries.length; i++) {
      if (entries[i] != null) {
        result = findEntryImpl(path, entries[i].getBundleFile());
        if (result != null && (classPathIndex == -1 || classPathIndex == curIndex))
View Full Code Here


   */
  public Enumeration findLocalEntries(String path) {
    Vector objects = new Vector(6); // use a Vector instead of ArrayList because we need an enumeration
    for (int i = 0; i < entries.length; i++) {
      if (entries[i] != null) {
        BundleEntry result = findEntryImpl(path, entries[i].getBundleFile());
        if (result != null)
          objects.addElement(result);
      }
    }
    // look in fragments
    for (int i = 0; i < fragments.length; i++) {
      ClasspathEntry[] fragEntries = fragments[i].getEntries();
      for (int j = 0; j < fragEntries.length; j++) {
        BundleEntry result = findEntryImpl(path, fragEntries[j].getBundleFile());
        if (result != null)
          objects.addElement(result);
      }
    }
    if (objects.size() > 0)
View Full Code Here

  private Class findClassImpl(String name, ClasspathEntry classpathEntry, ClassLoadingStatsHook[] hooks) {
    if (Debug.DEBUG && Debug.DEBUG_LOADER)
      Debug.println("BundleClassLoader[" + classpathEntry.getBundleFile() + "].findClass(" + name + ")"); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$
    String filename = name.replace('.', '/').concat(".class"); //$NON-NLS-1$
    BundleEntry entry = classpathEntry.getBundleFile().getEntry(filename);
    if (entry == null)
      return null;

    byte[] classbytes;
    try {
      classbytes = entry.getBytes();
    } catch (IOException e) {
      if (Debug.DEBUG && Debug.DEBUG_LOADER)
        Debug.println("  IOException reading " + filename + " from " + classpathEntry.getBundleFile()); //$NON-NLS-1$ //$NON-NLS-2$
      return null;
    }
View Full Code Here

  private Headers createManifest(File osgiBase) throws BundleException {
    InputStream in = null;

    if (osgiBase != null && osgiBase.exists())
      try {
        BundleEntry entry = getBundleFile().getEntry(Constants.OSGI_BUNDLE_MANIFEST);
        if (entry != null)
          in = entry.getInputStream();
      } catch (IOException e) {
        // do nothing here.  in == null
      }

    // If we cannot find the Manifest file from the baseBundleFile then
View Full Code Here

  protected BundleEntry findBundleEntry(URL url, AbstractBundle bundle) throws IOException {
    BaseClassLoader classloader = getBundleClassLoader(bundle);
    if (classloader == null)
      throw new FileNotFoundException(url.getPath());
    ClasspathManager cpManager = classloader.getClasspathManager();
    BundleEntry entry = cpManager.findLocalEntry(url.getPath(), url.getPort());
    if (entry == null)
      // this isn't strictly needed but is kept to maintain compatibility
      entry = cpManager.findLocalEntry(url.getPath());
    if (entry == null)
      throw new FileNotFoundException(url.getPath());
View Full Code Here

        if (!nativeFile.exists())
          throw new BundleException(NLS.bind(AdaptorMsg.BUNDLE_NATIVECODE_EXCEPTION, nativeFile.getAbsolutePath()), BundleException.NATIVECODE_ERROR);
        continue; // continue to next path
      }
      // ensure the file exists in the bundle; it will get extracted later on demand
      BundleEntry nativeEntry = bundleData.getBundleFile().getEntry(paths[i]);
      if (nativeEntry == null)
        throw new BundleException(NLS.bind(AdaptorMsg.BUNDLE_NATIVECODE_EXCEPTION, paths[i]), BundleException.NATIVECODE_ERROR);
    }
  }
View Full Code Here

  }

  private String searchVariants(BaseData bundledata, String path) {
    for (int i = 0; i < LIB_VARIANTS.length; i++) {
      BundleFile baseBundleFile = bundledata.getBundleFile();
      BundleEntry libEntry = baseBundleFile.getEntry(LIB_VARIANTS[i] + path);
      if (libEntry != null) {
        File libFile = baseBundleFile.getFile(LIB_VARIANTS[i] + path, true);
        if (libFile == null)
          return null;
        // see bug 88697 - HP requires libraries to have executable permissions
View Full Code Here

   * @return a new ClasspathEntry for the requested classpath or null if the source does not exist.
   */
  public ClasspathEntry getClasspath(String cp, BaseData sourcedata, ProtectionDomain sourcedomain) {
    BundleFile bundlefile = null;
    File file;
    BundleEntry cpEntry = sourcedata.getBundleFile().getEntry(cp);
    // check for internal library directories in a bundle jar file
    if (cpEntry != null && cpEntry.getName().endsWith("/")) //$NON-NLS-1$
      bundlefile = createBundleFile(cp, sourcedata);
    // check for internal library jars
    else if ((file = sourcedata.getBundleFile().getFile(cp, false)) != null)
      bundlefile = createBundleFile(file, sourcedata);
    if (bundlefile != null)
View Full Code Here

   * @param path the requested entry path.
   * @param classPathIndex the index of the ClasspathEntry to search
   * @return the requested entry or null if the entry does not exist
   */
  public BundleEntry findLocalEntry(String path, int classPathIndex) {
    BundleEntry result = null;
    int curIndex = 0;
    for (int i = 0; i < entries.length; i++) {
      if (entries[i] != null) {
        result = findEntryImpl(path, entries[i].getBundleFile());
        if (result != null && (classPathIndex == -1 || classPathIndex == curIndex))
View Full Code Here

   */
  public Enumeration<BundleEntry> findLocalEntries(String path) {
    List<BundleEntry> objects = new ArrayList<BundleEntry>(6);
    for (int i = 0; i < entries.length; i++) {
      if (entries[i] != null) {
        BundleEntry result = findEntryImpl(path, entries[i].getBundleFile());
        if (result != null)
          objects.add(result);
      }
    }
    // look in fragments
    for (int i = 0; i < fragments.length; i++) {
      ClasspathEntry[] fragEntries = fragments[i].getEntries();
      for (int j = 0; j < fragEntries.length; j++) {
        BundleEntry result = findEntryImpl(path, fragEntries[j].getBundleFile());
        if (result != null)
          objects.add(result);
      }
    }
    if (objects.size() > 0)
View Full Code Here

TOP

Related Classes of org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.