コード例 #1
0
  private static synchronized String getSymbolicName(String path) {
    if (fCachedLocations == null) fCachedLocations = new HashMap();

    File file = new File(path);
    if (file.exists() && !fCachedLocations.containsKey(path)) {
      try {
        Dictionary dictionary = MinimalState.loadManifest(file);
        String value = (String) dictionary.get(Constants.BUNDLE_SYMBOLICNAME);
        if (value != null) {
          ManifestElement[] elements =
              ManifestElement.parseHeader(Constants.BUNDLE_SYMBOLICNAME, value);
          String id = elements.length > 0 ? elements[0].getValue() : null;
          if (id != null) fCachedLocations.put(path, elements[0].getValue());
        }
      } catch (IOException e) {
      } catch (BundleException e) {
      }
    }
    return (String) fCachedLocations.get(path);
  }
コード例 #2
0
  public static Dictionary[] getPlatformProperties(String[] profiles, MinimalState state) {
    if (profiles == null || profiles.length == 0)
      return new Dictionary[] {getTargetEnvironment(state)};

    // add java profiles for those EE's that have a .profile file in the current system bundle
    ArrayList result = new ArrayList(profiles.length);
    for (int i = 0; i < profiles.length; i++) {
      IExecutionEnvironment environment =
          JavaRuntime.getExecutionEnvironmentsManager().getEnvironment(profiles[i]);
      if (environment != null) {
        Properties profileProps = environment.getProfileProperties();
        if (profileProps != null) {
          Dictionary props = TargetPlatformHelper.getTargetEnvironment(state);
          String systemPackages = profileProps.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
          if (systemPackages != null) props.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackages);
          String ee = profileProps.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT);
          if (ee != null) props.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee);
          result.add(props);
        }
      }
    }
    if (result.size() > 0) return (Dictionary[]) result.toArray(new Dictionary[result.size()]);
    return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment(state)};
  }
コード例 #3
0
 public static Dictionary getTargetEnvironment() {
   Dictionary result = new Hashtable();
   result.put(ICoreConstants.OSGI_OS, TargetPlatform.getOS());
   result.put(ICoreConstants.OSGI_WS, TargetPlatform.getWS());
   result.put(ICoreConstants.OSGI_NL, TargetPlatform.getNL());
   result.put(ICoreConstants.OSGI_ARCH, TargetPlatform.getOSArch());
   result.put(ICoreConstants.OSGI_RESOLVE_OPTIONAL, "true"); // $NON-NLS-1$
   result.put(ICoreConstants.OSGI_RESOLVER_MODE, "development"); // $NON-NLS-1$
   return result;
 }
コード例 #4
0
 public static Dictionary getTargetEnvironment(MinimalState state) {
   Dictionary result = getTargetEnvironment();
   result.put(ICoreConstants.OSGI_SYSTEM_BUNDLE, state.getSystemBundle());
   return result;
 }