Package org.eclipse.osgi.baseadaptor.bundlefile

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


  private Class<?> findClassImpl(String name, ClasspathEntry classpathEntry, ClassLoadingStatsHook[] hooks) {
    if (Debug.DEBUG_LOADER)
      Debug.println("BundleClassLoader[" + classpathEntry.getBundleFile() + "].findClassImpl(" + 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_LOADER)
        Debug.println("  IOException reading " + filename + " from " + classpathEntry.getBundleFile()); //$NON-NLS-1$ //$NON-NLS-2$
      return null;
    }
View Full Code Here


  private Headers<String, String> 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

        }

        public BundleEntry getEntry(String path) {
          if (Constants.OSGI_BUNDLE_MANIFEST.equals(path)) {
            System.err.println("Getting system bundle manifest: " + path);
            return new BundleEntry() {

              public InputStream getInputStream() throws IOException {
                return getManifestURL().openStream();
              }
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

    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<String> 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

  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

   */
  void setBundleFile(BundleFile bundleFile, int supportFlags) throws IOException {
    this.bundleFile = bundleFile;
    if (certsInitialized)
      return;
    BundleEntry be = bundleFile.getEntry(META_INF_MANIFEST_MF);
    if (be == null)
      return;

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

    if (trustAuthority != null)
      signerPKCS7.determineTrust(trustAuthority);
  }

  private PKCS7Processor processSigner(BundleFile bf, byte[] manifestBytes, String signer, String latestSigner, int supportFlags) throws IOException, SignatureException {
    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

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.