Package org.eclipse.osgi.baseadaptor

Examples of org.eclipse.osgi.baseadaptor.BaseData


    for (int i = 0; i < bundles.length && bundle == null; i++)
      if (location.equals(bundles[i].getLocation()))
        bundle = (AbstractBundle) bundles[i];
    if (bundle == null)
      return null;
    BaseData data = (BaseData) bundle.getBundleData();
    BaseStorageHook hook = (BaseStorageHook) data.getStorageHook(BaseStorageHook.KEY);
    return hook.isReference() ? new URL("reference:file:" + hook.getFileName()).openConnection() : null; //$NON-NLS-1$
  }
View Full Code Here


        ArrayList result = new ArrayList(bundleCount);
        long id = -1;
        boolean bundleDiscarded = false;
        for (int i = 0; i < bundleCount; i++) {
          boolean error = false;
          BaseData data = null;
          try {
            id = in.readLong();
            if (id != 0) {
              data = loadBaseData(id, in);
              data.getBundleFile();
              StorageHook[] dataStorageHooks = data.getStorageHooks();
              for (int j = 0; j < dataStorageHooks.length; j++)
                dataStorageHooks[j].validate();
              if (Debug.DEBUG && Debug.DEBUG_GENERAL)
                Debug.println("BundleData created: " + data); //$NON-NLS-1$
              processExtension(data, EXTENSION_INITIALIZE);
              result.add(data);
            }
          } catch (IllegalArgumentException e) {
            // may be from data.getBundleFile()
            bundleDiscarded = true;
            error = true;
          } catch (BundleException e) {
            // should never happen
            bundleDiscarded = true;
            error = true;
          } catch (IOException e) {
            bundleDiscarded = true;
            error = true;
            if (Debug.DEBUG && Debug.DEBUG_GENERAL) {
              Debug.println("Error reading framework metadata: " + e.getMessage()); //$NON-NLS-1$
              Debug.printStackTrace(e);
            }
          }
          if (error && data != null) {
            BaseStorageHook storageHook = (BaseStorageHook) data.getStorageHook(BaseStorageHook.KEY);
            storageHook.delete(true, BaseStorageHook.DEL_BUNDLE_STORE);
          }
        }
        if (bundleDiscarded)
          FrameworkProperties.setProperty(EclipseStarter.PROP_REFRESH_BUNDLES, "true"); //$NON-NLS-1$
View Full Code Here

      data.setDirty(false);
    }
  }

  public BundleOperation installBundle(String location, URLConnection source) {
    BaseData data = createBaseData(getNextBundleId(), location);
    return new BundleInstall(data, source, this);
  }
View Full Code Here

      hooks[i].save(out);
    }
  }

  protected BaseData loadBaseData(long id, DataInputStream in) throws IOException {
    BaseData result = new BaseData(id, adaptor);
    int numHooks = in.readInt();
    StorageHook[] hooks = new StorageHook[numHooks];
    for (int i = 0; i < numHooks; i++) {
      String hookKey = in.readUTF();
      StorageHook storageHook = (StorageHook) storageHooks.getByKey(hookKey);
      if (storageHook == null)
        throw new IOException();
      hooks[i] = storageHook.load(result, in);
    }
    result.setStorageHooks(hooks);
    return result;
  }
View Full Code Here

    result.setStorageHooks(hooks);
    return result;
  }

  protected BaseData createBaseData(long id, String location) {
    BaseData result = new BaseData(id, adaptor);
    result.setLocation(location);
    return result;
  }
View Full Code Here

  }

  public void bundleChanged(BundleEvent event) {
    if (event.getType() != BundleEvent.RESOLVED)
      return;
    BaseData data = (BaseData) ((AbstractBundle) event.getBundle()).getBundleData();
    try {
      if ((data.getType() & BundleData.TYPE_FRAMEWORK_EXTENSION) != 0)
        processFrameworkExtension(data, EXTENSION_INITIALIZE);
      else if ((data.getType() & BundleData.TYPE_BOOTCLASSPATH_EXTENSION) != 0)
        processBootExtension(data, EXTENSION_INITIALIZE);
      else if ((data.getType() & BundleData.TYPE_EXTCLASSPATH_EXTENSION) != 0)
        processExtExtension(data, EXTENSION_INITIALIZE);
    } catch (BundleException e) {
      // do nothing;
    }
  }
View Full Code Here

    initialized = true;
    return manifest;
  }

  private boolean hasPackageInfo(ClasspathEntry cpEntry, ClasspathManager loader) {
    BaseData bundledata = null;
    if (cpEntry.getBundleFile() == loader.getBaseData().getBundleFile())
      bundledata = loader.getBaseData();
    if (bundledata == null) {
      FragmentClasspath[] fragCPs = loader.getFragmentClasspaths();
      if (fragCPs != null)
        for (int i = 0; i < fragCPs.length; i++)
          if (cpEntry.getBundleFile() == fragCPs[i].getBundleData().getBundleFile()) {
            bundledata = fragCPs[i].getBundleData();
            break;
          }
    }
    if (bundledata == null)
      return true;
    EclipseStorageHook storageHook = (EclipseStorageHook) bundledata.getStorageHook(EclipseStorageHook.KEY);
    return storageHook == null ? true : storageHook.hasPackageInfo();
  }
View Full Code Here

  public Handler(BundleEntry bundleEntry, BaseAdaptor adaptor) {
    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

        // fall through to INSTALLED
      case BundleEvent.INSTALLED :
        TrustEngineListener listener = TrustEngineListener.getInstance();
        AuthorizationEngine authEngine = listener == null ? null : listener.getAuthorizationEngine();
        if (authEngine != null) {
          BaseData baseData = (BaseData) ((AbstractBundle) bundle).getBundleData();
          SignedStorageHook hook = (SignedStorageHook) baseData.getStorageHook(SignedStorageHook.KEY);
          SignedContent signedContent = hook != null ? hook.signedContent : null;
          authEngine.authorize(signedContent, bundle);
        }
        break;
      default :
View Full Code Here

    if (usingAnchor.size() > 0)
      resolveBundles((Bundle[]) usingAnchor.toArray(new Bundle[usingAnchor.size()]), true);
  }

  private SignedContentImpl getSignedContent(Bundle bundle) {
    BaseData data = (BaseData) ((AbstractBundle) bundle).getBundleData();
    SignedStorageHook hook = (SignedStorageHook) data.getStorageHook(SignedStorageHook.KEY);
    if (hook == null)
      return null;
    return (SignedContentImpl) hook.getSignedContent();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.osgi.baseadaptor.BaseData

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.