Package org.eclipse.osgi.framework.util

Examples of org.eclipse.osgi.framework.util.Headers


  }

  private Dictionary generateManifest(Dictionary builtIn) throws BundleException {
    String cacheLocation = FrameworkProperties.getProperty(LocationManager.PROP_MANIFEST_CACHE);
    if (bundledata.getSymbolicName() != null) {
      Headers existingHeaders = checkManifestAndParent(cacheLocation, bundledata.getSymbolicName(), bundledata.getVersion().toString(), manifestType);
      if (existingHeaders != null)
        return existingHeaders;
    }

    PluginConverterImpl converter = PluginConverterImpl.getDefault();
    if (converter == null)
      converter = new PluginConverterImpl(bundledata.getAdaptor(), bundledata.getAdaptor().getContext());

    Dictionary generatedManifest;
    try {
      generatedManifest = converter.convertManifest(bundledata.getBundleFile().getBaseFile(), true, null, true, null);
    } catch (PluginConversionException pce) {
      String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONVERTER_ERROR_CONVERTING, bundledata.getBundleFile().getBaseFile());
      throw new BundleException(message, pce);
    }

    //Now we know the symbolicId and the version of the bundle, we check to see if don't have a manifest for it already
    Version version = Version.parseVersion((String) generatedManifest.get(Constants.BUNDLE_VERSION));
    String symbolicName = ManifestElement.parseHeader(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, (String) generatedManifest.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME))[0].getValue();
    ManifestElement generatedFrom = ManifestElement.parseHeader(PluginConverterImpl.GENERATED_FROM, (String) generatedManifest.get(PluginConverterImpl.GENERATED_FROM))[0];
    Headers existingHeaders = checkManifestAndParent(cacheLocation, symbolicName, version.toString(), Byte.parseByte(generatedFrom.getAttribute(PluginConverterImpl.MANIFEST_TYPE_ATTRIBUTE)));
    //We don't have a manifest.
    manifestTimeStamp = Long.parseLong(generatedFrom.getValue());
    manifestType = Byte.parseByte(generatedFrom.getAttribute(PluginConverterImpl.MANIFEST_TYPE_ATTRIBUTE));
    if (bundledata.getAdaptor().isReadOnly() || existingHeaders != null)
      return existingHeaders;
View Full Code Here


    ResourceBundle localeProperties = getResourceBundle(localeString);
    if (localeProperties == null && !isDefaultLocale)
      // could not find the requested locale use the default locale
      localeProperties = getResourceBundle(defaultLocale);
    Enumeration e = this.rawHeaders.keys();
    Headers localeHeaders = new Headers(this.rawHeaders.size());
    while (e.hasMoreElements()) {
      String key = (String) e.nextElement();
      String value = (String) this.rawHeaders.get(key);
      if (value.startsWith("%") && (value.length() > 1)) { //$NON-NLS-1$
        String propertiesKey = value.substring(1);
        try {
          value = localeProperties == null ? propertiesKey : (String) localeProperties.getObject(propertiesKey);
        } catch (MissingResourceException ex) {
          value = propertiesKey;
        }
      }
      localeHeaders.set(key, value);
    }
    localeHeaders.setReadOnly();
    if (isDefaultLocale) {
      defaultLocaleHeaders = localeHeaders;
    }
    return (localeHeaders);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.osgi.framework.util.Headers

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.