Package org.eclipse.osgi.baseadaptor.bundlefile

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


  private String findLatestSigner(BundleFile bf, List names) {
    String result = null;
    long latestTime = Long.MIN_VALUE;
    for (Iterator iNames = names.iterator(); iNames.hasNext();) {
      String name = (String) iNames.next();
      BundleEntry entry = bf.getEntry(name);
      if (entry.getTime() > latestTime) {
        result = name;
        latestTime = entry.getTime();
      }
    }
    return result;
  }
View Full Code Here


  public BundleEntry getEntry(String path) {
    // strip off leading slashes so we can ensure the path matches the one provided in the manifest.
    if (path.length() > 0 && path.charAt(0) == '/')
      path = path.substring(1);
    BundleEntry be = bundleFile.getEntry(path);
    if (digests4entries == null)
      return be;
    if (be == null) {
      if (digests4entries.get(path) == null)
        return null;
      throw new SecurityException(NLS.bind(JarVerifierMessages.file_is_removed_from_jar, getBaseFile().toString(), path));
    }
    if (be.getName().startsWith(META_INF))
      return be;
    if (!isSigned())
      // If there is no signatures, we just return the regular bundle entry
      return be;
    return new SignedBundleEntry(be);
View Full Code Here

    if (!isSigned() || digests4entries == null)
      return;

    for (Enumeration entries = digests4entries.keys(); entries.hasMoreElements();) {
      String name = (String) entries.nextElement();
      BundleEntry entry = getEntry(name);
      if (entry == null) {
        throw new SecurityException(NLS.bind(JarVerifierMessages.Jar_Is_Tampered, bundleFile.getBaseFile().getName()));
      }
      try {
        entry.getBytes();
      } catch (IOException e) {
        SignedBundleHook.log(e.getMessage(), FrameworkLogEntry.ERROR, e);
        throw new SecurityException(NLS.bind(JarVerifierMessages.File_In_Jar_Is_Tampered, new String[] {name, bundleFile.getBaseFile().toString()}));
      }
    }
View Full Code Here

    if (!isSigned() || digests4entries == null)
      return EMPTY_STRING;
    ArrayList corrupted = new ArrayList(0); // be optimistic
    for (Enumeration entries = digests4entries.keys(); entries.hasMoreElements();) {
      String name = (String) entries.nextElement();
      BundleEntry entry = getEntry(name);
      if (entry == null)
        corrupted.add(name); // we expected the entry to be here
      else
        try {
          entry.getBytes();
        } catch (IOException e) {
          // must be invalid
          corrupted.add(name);
        }
    }
View Full Code Here

    super(bundleEntry);
  }

  protected BundleEntry findBundleEntry(URL url, AbstractBundle bundle) throws IOException {
    BaseData bundleData = (BaseData) bundle.getBundleData();
    BundleEntry entry = bundleData.getBundleFile().getEntry(url.getPath());
    if (entry == null)
      throw new FileNotFoundException(url.getPath());
    return entry;

  }
View Full Code Here

    BaseClassLoader classloader = getBundleClassLoader(bundle);
    if (classloader == null)
      throw new FileNotFoundException(url.getPath());
    ClasspathManager cpManager = classloader.getClasspathManager();
    int index = url.getPort();
    BundleEntry entry = null;
    if (index == 0) {
      entry = cpManager.findLocalEntry(url.getPath());
    } else {
      Enumeration entries = cpManager.findLocalEntries(url.getPath());
      if (entries != 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

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

      cl = new DefaultClassLoader(parent, delegate, domain, this, bundleclasspath);
    return cl;
  }

  public final URL getEntry(String path) {
    BundleEntry entry = getBundleFile().getEntry(path);
    if (entry == null)
      return null;
    if (path.length() == 0 || path.charAt(0) != '/')
      path = '/' + path;
    try {
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

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.