Package org.eclipse.osgi.baseadaptor.bundlefile

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


  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 = wrappedBundleFile.getEntry(path);
    if ((supportFlags & SignedBundleHook.VERIFY_RUNTIME) == 0 || signedContent == null)
      return be;
    if (path.startsWith(META_INF)) {
      int lastSlash = path.lastIndexOf('/');
      if (lastSlash == META_INF.length() - 1) {
View Full Code Here


      }
    });
  }

  final URL getEntry0(String path) {
    BundleEntry entry = getBundleFile().getEntry(path);
    if (entry == null)
      return null;
    path = BundleFile.fixTrailingSlash(path, entry);
    try {
      //use the constant string for the protocol to prevent duplication
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(nativePaths[i]);
      if (nativeEntry == null)
        throw new BundleException(NLS.bind(AdaptorMsg.BUNDLE_NATIVECODE_EXCEPTION, nativePaths[i]), BundleException.NATIVECODE_ERROR);
    }
  }
View Full Code Here

    if (!hasPackageInfo(cpEntry, loader)) {
      initialized = true;
      manifest = null;
      return manifest;
    }
    BundleEntry mfEntry = cpEntry.getBundleFile().getEntry(org.eclipse.osgi.framework.internal.core.Constants.OSGI_BUNDLE_MANIFEST);
    if (mfEntry != null) {
      InputStream manIn = null;
      try {
        try {
          manIn = mfEntry.getInputStream();
          manifest = new Manifest(manIn);
        } finally {
          if (manIn != null)
            manIn.close();
        }
View Full Code Here

    public void verify() throws IOException, InvalidContentException {
      BundleFile currentContent = content;
      if (currentContent == null)
        throw new InvalidContentException("The content was not set", null); //$NON-NLS-1$
      BundleEntry entry = null;
      SecurityException exception = null;
      try {
        entry = currentContent.getEntry(entryName);
      } catch (SecurityException e) {
        exception = e;
      }
      if (entry == null)
        throw new InvalidContentException(NLS.bind(SignedContentMessages.file_is_removed_from_jar, entryName, currentContent.getBaseFile().toString()), exception);
      entry.getBytes();
    }
View Full Code Here

    this.supportFlags = supportFlags;
  }

  public SignedContentImpl process() throws IOException, InvalidKeyException, SignatureException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException {
    BundleFile wrappedBundleFile = signedBundle.getWrappedBundleFile();
    BundleEntry be = wrappedBundleFile.getEntry(META_INF_MANIFEST_MF);
    if (be == null)
      return createUnsignedContent();

    // read all the signature block file names into a list
    Enumeration en = wrappedBundleFile.getEntryPaths(META_INF);
View Full Code Here

    result.setContent(signedBundle);
    return result;
  }

  private void processSigner(BundleFile bf, byte[] manifestBytes, String signer) throws IOException, SignatureException, InvalidKeyException, CertificateException, NoSuchAlgorithmException, NoSuchProviderException {
    BundleEntry be = bf.getEntry(signer);
    byte pkcs7Bytes[] = readIntoArray(be);
    int dotIndex = signer.lastIndexOf('.');
    be = bf.getEntry(signer.substring(0, dotIndex) + DOT_SF);
    byte sfBytes[] = readIntoArray(be);
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

    super(bundleEntry, adaptor);
  }

  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

   * @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

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.