org.eclipse.osgi_3.8.2.v20130124-134944

ties.setProperty("osgi.configuration.area", osgiStorage);
    }
    installLocation = buildLocation("osgi.install.area", null, "", true, false, null);
    
    Location temp = buildLocation("osgi.user.area.default", null, "", false, false, null);
    URL defaultLocation = temp == null ? null : temp.getURL();
    if (defaultLocation == null) {
      defaultLocation = buildURL(new File(FrameworkProperties.getProperty("user.home"), "user").getAbsolutePath(), true);
    }
    userLocation = buildLocation("osgi.user.area", defaultLocation, "", false, false, null);
    
    temp = buildLocation("osgi.instance.area.default", null, "", false, false, ".metadata/.plugins/");
    defaultLocation = temp == null ? null : temp.getURL();
    if (defaultLocation == null) {
      defaultLocation = buildURL(new File(FrameworkProperties.getProperty("user.dir"), "workspace").getAbsolutePath(), true);
    }
    instanceLocation = buildLocation("osgi.instance.area", defaultLocation, "", false, false, ".metadata/.plugins/");
    
    mungeConfigurationLocation();
    
    temp = buildLocation("osgi.configuration.area.default", null, "", false, false, null);
    defaultLocation = temp == null ? null : temp.getURL();
    if ((defaultLocation == null) && (FrameworkProperties.getProperty("osgi.configuration.area") == null)) {
      defaultLocation = buildURL(computeDefaultConfigurationLocation(), true);
    }
    configurationLocation = buildLocation("osgi.configuration.area", defaultLocation, "", false, false, null);
    
    URL parentLocation = computeSharedConfigurationLocation();
    if ((parentLocation != null) && (!parentLocation.equals(configurationLocation.getURL())))
    {
      Location parent = new BasicLocation(null, parentLocation, true, null);
      ((BasicLocation)configurationLocation).setParent(parent);
    }
    initializeDerivedConfigurationLocations();
    if (FrameworkProperties.getProperty("eclipse.home.location") == null)
    {
      String eclipseLauncher = FrameworkProperties.getProperty("eclipse.launcher");
      String eclipseHomeLocationPath = getEclipseHomeLocation(eclipseLauncher);
      if (eclipseHomeLocationPath != null) {
        FrameworkProperties.setProperty("eclipse.home.location", eclipseHomeLocationPath);
      }
    }
    if ((FrameworkProperties.getProperty("eclipse.home.location") == null) && (FrameworkProperties.getProperty("osgi.install.area") != null)) {
      FrameworkProperties.setProperty("eclipse.home.location", FrameworkProperties.getProperty("osgi.install.area"));
    }
    eclipseHomeLocation = buildLocation("eclipse.home.location", null, "", true, true, null);
  }
  
  private static String getEclipseHomeLocation(String launcher)
  {
    if (launcher == null) {
      return null;
    }
    File launcherFile = new File(launcher);
    if (launcherFile.getParent() == null) {
      return null;
    }
    File launcherDir = new File(launcherFile.getParent());
    
    String macosx = "macosx";
    if (macosx.equals(EclipseEnvironmentInfo.getDefault().getOS())) {
      launcherDir = getMacOSEclipsoeHomeLocation(launcherDir);
    }
    return (launcherDir.exists()) && (launcherDir.isDirectory()) ? launcherDir.getAbsolutePath() : null;
  }
  
  private static File getMacOSEclipsoeHomeLocation(File launcherDir)
  {
    if (!launcherDir.getName().equalsIgnoreCase("macos")) {
      return launcherDir;
    }
    String launcherParent = launcherDir.getParent();
    if (launcherParent != null) {
      launcherParent = new File(launcherParent).getParent();
    }
    if (launcherParent != null) {
      launcherParent = new File(launcherParent).getParent();
    }
    return launcherParent == null ? null : new File(launcherParent);
  }
  
  private static Location buildLocation(String property, URL defaultLocation, String userDefaultAppendage, boolean readOnlyDefault, boolean computeReadOnly, String dataAreaPrefix)
  {
    String location = FrameworkProperties.clearProperty(property);
    
    String userReadOnlySetting = FrameworkProperties.getProperty(property + ".readOnly");
    boolean readOnly = userReadOnlySetting == null ? readOnlyDefault : Boolean.valueOf(userReadOnlySetting).booleanValue();
    if (location == null) {
      return new BasicLocation(property, defaultLocation, canWrite(defaultLocation) ? false : (userReadOnlySetting != null) || (!computeReadOnly) ? readOnly : true, dataAreaPrefix);
    }
    String trimmedLocation = location.trim();
    if (trimmedLocation.equalsIgnoreCase("@none")) {
      return null;
    }
    if (trimmedLocation.equalsIgnoreCase("@noDefault")) {
      return new BasicLocation(property, null, readOnly, dataAreaPrefix);
    }
    if (trimmedLocation.startsWith("@user.home"))
    {
      String base = substituteVar(location, "@user.home", "user.home");
      location = new File(base, userDefaultAppendage).getAbsolutePath();
    }
    else if (trimmedLocation.startsWith("@user.dir"))
    {
      String base = substituteVar(location, "@user.dir", "user.dir");
      location = new File(base, userDefaultAppendage).getAbsolutePath();
    }
    int idx = location.indexOf("@install.hash");
    if (idx == 0) {
      throw new RuntimeException("The location cannot start with '@install.hash': " + location);
    }
    if (idx > 0) {
      location = location.substring(0, idx) + getInstallDirHash() + location.substring(idx + "@install.hash".length());
    }
    URL url = buildURL(location, true);
    BasicLocation result = null;
    if (url != null)
    {
      result = new BasicLocation(property, null, canWrite(url) ? false : (userReadOnlySetting != null) || (!computeReadOnly) ? readOnly : true, dataAreaPrefix);
      result.setURL(url, false);
    }
    return result;
  }
  
  private static String substituteVar(String source, String var, String prop)
  {
    String value = FrameworkProperties.getProperty(prop, "");
    return value + source.substring(var.length());
  }
  
  private static void initializeDerivedConfigurationLocations()
  {
    if (FrameworkProperties.getProperty("osgi.manifest.cache") == null) {
      FrameworkProperties.setProperty("osgi.manifest.cache", getConfigurationFile("manifests").getAbsolutePath());
    }
  }
  
  private static URL computeInstallConfigurationLocation()
  {
    String property = FrameworkProperties.getProperty("osgi.install.area");
    if (property != null) {
      return LocationHelper.buildURL(property, true);
    }
    return null;
  }
  
  private static URL computeSharedConfigurationLocation()
  {
    String property = FrameworkProperties.getProperty("osgi.sharedConfiguration.area");
    if (property == null) {
      return null;
    }
    try
    {
      URL sharedConfigurationURL = LocationHelper.buildURL(property, true);
      if (sharedConfigurationURL == null) {
        return null;
      }
      if (sharedConfigurationURL.getPath().startsWith("/")) {
        return sharedConfigurationURL;
      }
      URL installURL = installLocation.getURL();
      if (!sharedConfigurationURL.getProtocol().equals(installURL.getProtocol())) {
        return sharedConfigurationURL;
      }
      sharedConfigurationURL = new URL(installURL, sharedConfigurationURL.getPath());
      FrameworkProperties.setProperty("osgi.sharedConfiguration.area", sharedConfigurationURL.toExternalForm());
    }
    catch (MalformedURLException localMalformedURLException) {}
    return null;
  }
  
  private static String computeDefaultConfigurationLocation()
  {
    URL installURL = computeInstallConfigurationLocation();
    if ((installURL != null) && ("file".equals(installURL.getProtocol())))
    {
      File installDir = new File(installURL.getFile());
      File defaultConfigDir = new File(installDir, "configuration");
      if (!defaultConfigDir.exists()) {
        defaultConfigDir.mkdirs();
      }
      if ((defaultConfigDir.exists()) && (AdaptorUtil.canWrite(defaultConfigDir))) {
        return defaultConfigDir.getAbsolutePath();
      }
    }
    return computeDefaultUserAreaLocation("configuration");
  }
  
  private static boolean canWrite(URL location)
  {
    if ((location != null) && ("file".equals(location.getProtocol())))
    {
      File locationDir = new File(location.getFile());
      if (!locationDir.exists()) {
        locationDir.mkdirs();
      }
      if ((locationDir.exists()) && (AdaptorUtil.canWrite(locationDir))) {
        return true;
      }
    }
    return false;
  }
  
  private static String computeDefaultUserAreaLocation(String pathAppendage)
  {
    String installProperty = FrameworkProperties.getProperty("osgi.install.area");
    URL installURL = buildURL(installProperty, true);
    if (installURL == null) {
      return null;
    }
    File installDir = new File(installURL.getFile());
    String installDirHash = getInstallDirHash();
    
    String appName = ".eclipse";
    File eclipseProduct = new File(installDir, ".eclipseproduct");
    if (eclipseProduct.exists())
    {
      Properties props = new Properties();
      try
      {
        props.load(new FileInputStream(eclipseProduct));
        String appId = props.getProperty("id");
        if ((appId == null) || (appId.trim().length() == 0)) {
          appId = "eclipse";
        }
        String appVersion = props.getProperty("version");
        if ((appVersion == null) || (appVersion.trim().length() == 0)) {
          appVersion = "";
        }
        appName = appName + File.separator + appId + "_" + appVersion + "_" + installDirHash;
      }
      catch (IOException localIOException)
      {
        appName = appName + File.separator + installDirHash;
      }
    }
    else
    {
      appName = appName + File.separator + installDirHash;
    }
    String userHome = FrameworkProperties.getProperty("user.home");
    return new File(userHome, appName + "/" + pathAppendage).getAbsolutePath();
  }
  
  private static String getInstallDirHash()
  {
    String installProperty = FrameworkProperties.getProperty("osgi.install.area");
    URL installURL = buildURL(installProperty, true);
    if (installURL == null) {
      return "";
    }
    File installDir = new File(installURL.getFile());
    int hashCode;
    try
    {
      hashCode = installDir.getCanonicalPath().hashCode();
    }
    catch (IOException localIOException)
    {
      int hashCode;
      hashCode = installDir.getAbsolutePath().hashCode();
    }
    if (hashCode < 0) {
      hashCode = -hashCode;
    }
    String installDirHash = String.valueOf(hashCode);
    return installDirHash;
  }
  
  public static Location getUserLocation()
  {
    return userLocation;
  }
  
  public static Location getConfigurationLocation()
  {
    return configurationLocation;
  }
  
  public static Location getInstallLocation()
  {
    return installLocation;
  }
  
  public static Location getInstanceLocation()
  {
    return instanceLocation;
  }
  
  public static Location getEclipseHomeLocation()
  {
    return eclipseHomeLocation;
  }
  
  public static File getOSGiConfigurationDir()
  {
    return new File(configurationLocation.getURL().getFile(), "org.eclipse.osgi");
  }
  
  public static File getConfigurationFile(String filename)
  {
    File dir = getOSGiConfigurationDir();
    if (!dir.exists()) {
      dir.mkdirs();
    }
    return new File(dir, filename);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.adaptor.LocationManager
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

import java.io.IOException;

class BasicLocation$MockLocker
  implements Locker
{
  public boolean lock()
    throws IOException
  {
    return true;
  }
  
  public boolean isLocked()
  {
    return false;
  }
  
  public void release() {}
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.adaptor.BasicLocation.MockLocker
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osgi.util.NLS;

public class BasicLocation
  implements Location
{
  private final boolean isReadOnly;
  
  static class MockLocker
    implements Locker
  {
    public boolean lock()
      throws IOException
    {
      return true;
    }
    
    public boolean isLocked()
    {
      return false;
    }
    
    public void release() {}
  }
  
  private URL location = null;
  private Location parent;
  private final URL defaultValue;
  private final String property;
  private final String dataAreaPrefix;
  private File lockFile;
  private Locker locker;
  public static final String PROP_OSGI_LOCKING = "osgi.locking";
  private static String DEFAULT_LOCK_FILENAME = ".metadata/.lock";
  public static boolean DEBUG;
  
  private static boolean isRunningWithNio()
  {
    try
    {
      Class.forName("java.nio.channels.FileLock");
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      return false;
    }
    return true;
  }
  
  public static Locker createLocker(File lock, String lockMode)
  {
    if (lockMode == null) {
      lockMode = FrameworkProperties.getProperty("osgi.locking");
    }
    if ("none".equals(lockMode)) {
      return new MockLocker();
    }
    if ("java.io".equals(lockMode)) {
      return new Locker_JavaIo(lock);
    }
    if ("java.nio".equals(lockMode))
    {
      if (isRunningWithNio()) {
        return new Locker_JavaNio(lock);
      }
      return new Locker_JavaIo(lock);
    }
    if (isRunningWithNio()) {
      return new Locker_JavaNio(lock);
    }
    return new Locker_JavaIo(lock);
  }
  
  public BasicLocation(String property, URL defaultValue, boolean isReadOnly, String dataAreaPrefix)
  {
    this.property = property;
    this.defaultValue = defaultValue;
    this.isReadOnly = isReadOnly;
    this.dataAreaPrefix = (dataAreaPrefix == null ? "" : dataAreaPrefix);
  }
  
  public boolean allowsDefault()
  {
    return defaultValue != null;
  }
  
  public URL getDefault()
  {
    return defaultValue;
  }
  
  public synchronized Location getParentLocation()
  {
    return parent;
  }
  
  public synchronized URL getURL()
  {
    if ((location == null) && (defaultValue != null)) {
      setURL(defaultValue, false);
    }
    return location;
  }
  
  public synchronized boolean isSet()
  {
    return location != null;
  }
  
  public boolean isReadOnly()
  {
    return isReadOnly;
  }
  
  /**
   * @deprecated
   */
  public boolean setURL(URL value, boolean lock)
    throws IllegalStateException
  {
    try
    {
      return set(value, lock);
    }
    catch (IOException localIOException) {}
    return false;
  }
  
  public synchronized boolean set(URL value, boolean lock)
    throws IllegalStateException, IOException
  {
    return set(value, lock, null);
  }
  
  public synchronized boolean set(URL value, boolean lock, String lockFilePath)
    throws IllegalStateException, IOException
  {
    if (location != null) {
      throw new IllegalStateException(EclipseAdaptorMsg.ECLIPSE_CANNOT_CHANGE_LOCATION);
    }
    File file = null;
    if (value.getProtocol().equalsIgnoreCase("file"))
    {
      try
      {
        String basePath = new File(value.getFile()).getCanonicalPath();
        value = LocationHelper.buildURL("file:" + basePath, true);
      }
      catch (IOException localIOException) {}
      if ((lockFilePath != null) && (lockFilePath.length() > 0))
      {
        File givenLockFile = new File(lockFilePath);
        if (givenLockFile.isAbsolute()) {
          file = givenLockFile;
        } else {
          file = new File(value.getFile(), lockFilePath);
        }
      }
      else
      {
        file = new File(value.getFile(), DEFAULT_LOCK_FILENAME);
      }
    }
    lock = (lock) && (!isReadOnly);
    if ((lock) && 
      (!lock(file, value))) {
      return false;
    }
    lockFile = file;
    location = value;
    if (property != null) {
      FrameworkProperties.setProperty(property, location.toExternalForm());
    }
    return lock;
  }
  
  public synchronized void setParent(Location value)
  {
    parent = value;
  }
  
  public synchronized boolean lock()
    throws IOException
  {
    if (!isSet()) {
      throw new IOException(EclipseAdaptorMsg.location_notSet);
    }
    return lock(lockFile, location);
  }
  
  public synchronized boolean isLocked()
    throws IOException
  {
    if (!isSet()) {
      return false;
    }
    return isLocked(lockFile);
  }
  
  private boolean lock(File lock, URL locationValue)
    throws IOException
  {
    if (isReadOnly) {
      throw new IOException(NLS.bind(EclipseAdaptorMsg.location_folderReadOnly, lock));
    }
    if (lock == null)
    {
      if ((locationValue != null) && (!"file".equalsIgnoreCase(locationValue.getProtocol()))) {
        throw new IOException(NLS.bind(EclipseAdaptorMsg.location_notFileProtocol, locationValue));
      }
      throw new IllegalStateException(EclipseAdaptorMsg.location_noLockFile);
    }
    if (isLocked()) {
      return false;
    }
    File parentFile = new File(lock.getParent());
    if ((!parentFile.exists()) && 
      (!parentFile.mkdirs())) {
      throw new IOException(NLS.bind(EclipseAdaptorMsg.location_folderReadOnly, parentFile));
    }
    setLocker(lock);
    if (locker == null) {
      return true;
    }
    boolean locked = false;
    try
    {
      locked = locker.lock();
      return locked;
    }
    finally
    {
      if (!locked) {
        locker = null;
      }
    }
  }
  
  private boolean isLocked(File lock)
    throws IOException
  {
    if ((lock == null) || (isReadOnly)) {
      return true;
    }
    if (!lock.exists()) {
      return false;
    }
    setLocker(lock);
    return locker.isLocked();
  }
  
  private void setLocker(File lock)
  {
    if (locker != null) {
      return;
    }
    String lockMode = FrameworkProperties.getProperty("osgi.locking");
    locker = createLocker(lock, lockMode);
  }
  
  public synchronized void release()
  {
    if (locker != null) {
      locker.release();
    }
  }
  
  public Location createLocation(Location parentLocation, URL defaultLocation, boolean readonly)
  {
    BasicLocation result = new BasicLocation(null, defaultLocation, readonly, dataAreaPrefix);
    result.setParent(parentLocation);
    return result;
  }
  
  public URL getDataArea(String filename)
    throws IOException
  {
    URL base = getURL();
    if (base == null) {
      throw new IOException(EclipseAdaptorMsg.location_notSet);
    }
    String prefix = base.toExternalForm();
    if ((prefix.length() > 0) && (prefix.charAt(prefix.length() - 1) != '/')) {
      prefix = prefix + '/';
    }
    filename = filename.replace('\\', '/');
    if ((filename.length() > 0) && (filename.charAt(0) == '/')) {
      filename.substring(1);
    }
    return new URL(prefix + dataAreaPrefix + filename);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.adaptor.BasicLocation
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

import java.util.ResourceBundle;
import org.eclipse.osgi.framework.internal.core.AbstractBundle;
import org.eclipse.osgi.service.localization.BundleLocalization;
import org.osgi.framework.Bundle;

public class BundleLocalizationImpl
  implements BundleLocalization
{
  public ResourceBundle getLocalization(Bundle bundle, String locale)
  {
    return ((AbstractBundle)bundle).getResourceBundle(locale);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.adaptor.BundleLocalizationImpl
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

import java.io.PrintStream;
import java.util.Dictionary;
import java.util.Enumeration;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import org.eclipse.osgi.framework.util.Headers;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;

public class CachedManifest
  extends Dictionary<String, String>
{
  static final String SERVICE_COMPONENT = "Service-Component";
  static boolean DEBUG = false;
  private Dictionary<String, String> manifest = null;
  private EclipseStorageHook storageHook;
  
  public CachedManifest(EclipseStorageHook storageHook)
  {
    this.storageHook = storageHook;
  }
  
  public Dictionary<String, String> getManifest()
  {
    if (manifest == null) {
      try
      {
        if (DEBUG) {
          System.out.println("Reading manifest for: " + storageHook.getBaseData());
        }
        manifest = storageHook.createCachedManifest(true);
      }
      catch (BundleException e)
      {
        String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_CACHEDMANIFEST_UNEXPECTED_EXCEPTION, storageHook.getBaseData().getLocation());
        FrameworkLogEntry entry = new FrameworkLogEntry("org.eclipse.osgi", 4, 0, message, 0, e, null);
        storageHook.getAdaptor().getFrameworkLog().log(entry);
      }
    }
    if (manifest == null)
    {
      Headers<String, String> empty = new Headers(0);
      empty.setReadOnly();
      manifest = empty;
      return empty;
    }
    return manifest;
  }
  
  public int size()
  {
    return getManifest().size();
  }
  
  public boolean isEmpty()
  {
    return size() == 0;
  }
  
  public Enumeration<String> elements()
  {
    return getManifest().elements();
  }
  
  public Enumeration<String> keys()
  {
    return getManifest().keys();
  }
  
  public String get(Object key)
  {
    if (manifest != null) {
      return (String)manifest.get(key);
    }
    String keyString = (String)key;
    if ("Bundle-Version".equalsIgnoreCase(keyString))
    {
      Version result = storageHook.getBaseData().getVersion();
      return result == null ? null : result.toString();
    }
    if ("Plugin-Class".equalsIgnoreCase(keyString)) {
      return storageHook.getPluginClass();
    }
    if ("Bundle-SymbolicName".equalsIgnoreCase(keyString))
    {
      if ((storageHook.getBaseData().getType() & 0x8) == 0) {
        return storageHook.getBaseData().getSymbolicName();
      }
      return storageHook.getBaseData().getSymbolicName() + ';' + "singleton" + ":=true";
    }
    if ("Eclipse-BuddyPolicy".equalsIgnoreCase(keyString)) {
      return storageHook.getBuddyList();
    }
    if ("Eclipse-RegisterBuddy".equalsIgnoreCase(keyString)) {
      return storageHook.getRegisteredBuddyList();
    }
    if ("Bundle-Activator".equalsIgnoreCase(keyString)) {
      return storageHook.getBaseData().getActivator();
    }
    if ("Bundle-ActivationPolicy".equals(keyString))
    {
      if (!storageHook.isAutoStartable()) {
        return null;
      }
      String[] excludes = storageHook.getLazyStartExcludes();
      String[] includes = storageHook.getLazyStartIncludes();
      if ((excludes == null) && (includes == null)) {
        return "lazy";
      }
      StringBuffer result = new StringBuffer("lazy");
      if (excludes != null)
      {
        result.append(';').append("exclude").append(":=\"");
        for (int i = 0; i < excludes.length; i++)
        {
          if (i > 0) {
            result.append(',');
          }
          result.append(excludes[i]);
        }
        result.append("\"");
      }
      if (includes != null)
      {
        result.append(';').append("include").append(":=\"");
        for (int i = 0; i < includes.length; i++)
        {
          if (i > 0) {
            result.append(',');
          }
          result.append(includes[i]);
        }
        result.append("\"");
      }
    }
    if (("Eclipse-LazyStart".equals(keyString)) || ("Eclipse-AutoStart".equals(keyString)))
    {
      if (!storageHook.isAutoStartable()) {
        return null;
      }
      if (storageHook.getLazyStartExcludes() == null) {
        return Boolean.TRUE.toString();
      }
      StringBuffer result = new StringBuffer(storageHook.isLazyStart() ? Boolean.TRUE.toString() : Boolean.FALSE.toString());
      result.append(";").append("exceptions").append("=\"");
      String[] exceptions = storageHook.getLazyStartExcludes();
      for (int i = 0; i < exceptions.length; i++)
      {
        if (i > 0) {
          result.append(",");
        }
        result.append(exceptions[i]);
      }
      result.append("\"");
      return result.toString();
    }
    if ("Bundle-ManifestVersion".equals(keyString)) {
      return storageHook.getBundleManifestVersion() == 0 ? null : Integer.toString(storageHook.getBundleManifestVersion());
    }
    if ("Service-Component".equals(keyString)) {
      return storageHook.getServiceComponent();
    }
    Dictionary<String, String> result = getManifest();
    if (DEBUG) {
      System.out.println("Manifest read because of header: " + key);
    }
    return result == null ? null : (String)result.get(key);
  }
  
  public String remove(Object key)
  {
    return (String)getManifest().remove(key);
  }
  
  public String put(String key, String value)
  {
    return (String)getManifest().put(key, value);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.adaptor.CachedManifest
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

import java.util.jar.Manifest;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
import org.eclipse.osgi.baseadaptor.loader.FragmentClasspath;
import org.eclipse.osgi.framework.util.KeyedElement;

public class ClasspathManifest
  implements KeyedElement
{
  public static final Object KEY = new Object();
  public static final int HASHCODE = KEY.hashCode();
  private Manifest manifest;
  private boolean initialized = false;
  
  public int getKeyHashCode()
  {
    return HASHCODE;
  }
  
  public boolean compare(KeyedElement other)
  {
    return other.getKey() == KEY;
  }
  
  public Object getKey()
  {
    return KEY;
  }
  
  /* Error */
  public synchronized Manifest getManifest(ClasspathEntry cpEntry, ClasspathManager loader)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 107	org/eclipse/core/runtime/internal/adaptor/ClasspathManifest:initialized	Z
    //   4: ifeq +8 -> 12
    //   7: aload_0
    //   8: getfield 109	org/eclipse/core/runtime/internal/adaptor/ClasspathManifest:manifest	Ljava/util/jar/Manifest;
    //   11: areturn
    //   12: aload_0
    //   13: aload_1
    //   14: aload_2
    //   15: invokespecial 115	org/eclipse/core/runtime/internal/adaptor/ClasspathManifest:hasPackageInfo	(Lorg/eclipse/osgi/baseadaptor/loader/ClasspathEntry;Lorg/eclipse/osgi/baseadaptor/loader/ClasspathManager;)Z
    //   18: ifne +18 -> 36
    //   21: aload_0
    //   22: iconst_1
    //   23: putfield 107	org/eclipse/core/runtime/internal/adaptor/ClasspathManifest:initialized	Z
    //   26: aload_0
    //   27: aconst_null
    //   28: putfield 109	org/eclipse/core/runtime/internal/adaptor/ClasspathManifest:manifest	Ljava/util/jar/Manifest;
    //   31: aload_0
    //   32: getfield 109	org/eclipse/core/runtime/internal/adaptor/ClasspathManifest:manifest	Ljava/util/jar/Manifest;
    //   35: areturn
    //   36: aload_1
    //   37: invokevirtual 121	org/eclipse/osgi/baseadaptor/loader/ClasspathEntry:getBundleFile	()Lorg/eclipse/osgi/baseadaptor/bundlefile/BundleFile;
    //   40: ldc 1
    //   42: invokevirtual 120	org/eclipse/osgi/baseadaptor/bundlefile/BundleFile:getEntry	(Ljava/lang/String;)Lorg/eclipse/osgi/baseadaptor/bundlefile/BundleEntry;
    //   45: astore_3
    //   46: aload_3
    //   47: ifnull +57 -> 104
    //   50: aconst_null
    //   51: astore 4
    //   53: aload_3
    //   54: invokevirtual 119	org/eclipse/osgi/baseadaptor/bundlefile/BundleEntry:getInputStream	()Ljava/io/InputStream;
    //   57: astore 4
    //   59: aload_0
    //   60: new 54	java/util/jar/Manifest
    //   63: dup
    //   64: aload 4
    //   66: invokespecial 114	java/util/jar/Manifest:<init>	(Ljava/io/InputStream;)V
    //   69: putfield 109	org/eclipse/core/runtime/internal/adaptor/ClasspathManifest:manifest	Ljava/util/jar/Manifest;
    //   72: goto +18 -> 90
    //   75: astore 5
    //   77: aload 4
    //   79: ifnull +8 -> 87
    //   82: aload 4
    //   84: invokevirtual 111	java/io/InputStream:close	()V
    //   87: aload 5
    //   89: athrow
    //   90: aload 4
    //   92: ifnull +12 -> 104
    //   95: aload 4
    //   97: invokevirtual 111	java/io/InputStream:close	()V
    //   100: goto +4 -> 104
    //   103: pop
    //   104: aload_0
    //   105: iconst_1
    //   106: putfield 107	org/eclipse/core/runtime/internal/adaptor/ClasspathManifest:initialized	Z
    //   109: aload_0
    //   110: getfield 109	org/eclipse/core/runtime/internal/adaptor/ClasspathManifest:manifest	Ljava/util/jar/Manifest;
    //   113: areturn
    // Line number table:
    //   Java source line #42	-> byte code offset #0
    //   Java source line #43	-> byte code offset #7
    //   Java source line #44	-> byte code offset #12
    //   Java source line #45	-> byte code offset #21
    //   Java source line #46	-> byte code offset #26
    //   Java source line #47	-> byte code offset #31
    //   Java source line #49	-> byte code offset #36
    //   Java source line #50	-> byte code offset #46
    //   Java source line #51	-> byte code offset #50
    //   Java source line #54	-> byte code offset #53
    //   Java source line #55	-> byte code offset #59
    //   Java source line #56	-> byte code offset #72
    //   Java source line #57	-> byte code offset #77
    //   Java source line #58	-> byte code offset #82
    //   Java source line #59	-> byte code offset #87
    //   Java source line #57	-> byte code offset #90
    //   Java source line #58	-> byte code offset #95
    //   Java source line #60	-> byte code offset #100
    //   Java source line #64	-> byte code offset #104
    //   Java source line #65	-> byte code offset #109
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	114	0	this	ClasspathManifest
    //   0	114	1	cpEntry	ClasspathEntry
    //   0	114	2	loader	ClasspathManager
    //   45	9	3	mfEntry	org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry
    //   51	45	4	manIn	java.io.InputStream
    //   75	13	5	localObject	Object
    //   103	1	6	localIOException	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   53	75	75	finally
    //   53	100	103	java/io/IOException
  }
  
  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();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.adaptor.ClasspathManifest
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

import java.security.PrivilegedAction;

class ContextFinder$1
  implements PrivilegedAction<Object>
{
  public Object run()
  {
    Class tmp3_0 = ContextFinder.class$0;
    if (tmp3_0 == null)
    {
      tmp3_0;
      try
      {
        tmpTernaryOp = (ContextFinder.class$0 = Class.forName("org.eclipse.core.runtime.internal.adaptor.ContextFinder"));
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
      }
    }
    ContextFinder.finderClassLoader = tmp3_0.getClassLoader();
    ContextFinder.contextFinder = new ContextFinder.Finder();
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.adaptor.ContextFinder.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

class ContextFinder$2
  extends ClassLoader
{
  final ContextFinder this$0;
  
  ContextFinder$2(ContextFinder paramContextFinder, ClassLoader $anonymous0)
  {
    super($anonymous0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.adaptor.ContextFinder.2
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

final class ContextFinder$Finder
  extends SecurityManager
{
  public Class<?>[] getClassContext()
  {
    return super.getClassContext();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.adaptor.ContextFinder.Finder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

import java.io.IOException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.osgi.framework.adaptor.BundleClassLoader;

public class ContextFinder
  extends ClassLoader
  implements PrivilegedAction<List<ClassLoader>>
{
  static final class Finder
    extends SecurityManager
  {
    public Class<?>[] getClassContext()
    {
      return super.getClassContext();
    }
  }
  
  private static ThreadLocal<Set<String>> cycleDetector = new ThreadLocal();
  static ClassLoader finderClassLoader;
  static Finder contextFinder;
  
  static
  {
    AccessController.doPrivileged(new PrivilegedAction()
    {
      public Object run()
      {
        Class tmp3_0 = ContextFinder.class$0;
        if (tmp3_0 == null)
        {
          tmp3_0;
          try
          {
            tmpTernaryOp = (ContextFinder.class$0 = Class.forName("org.eclipse.core.runtime.internal.adaptor.ContextFinder"));
          }
          catch (ClassNotFoundException localClassNotFoundException)
          {
            throw new NoClassDefFoundError(localClassNotFoundException.getMessage());
          }
        }
        ContextFinder.finderClassLoader = tmp3_0.getClassLoader();
        ContextFinder.contextFinder = new ContextFinder.Finder();
        return null;
      }
    });
  }
  
  private static Class<ContextFinder> THIS = ContextFinder.class;
  private final ClassLoader parentContextClassLoader;
  
  public ContextFinder(ClassLoader contextClassLoader)
  {
    super(contextClassLoader);
    parentContextClassLoader = (contextClassLoader != null ? contextClassLoader : new ClassLoader(Object.class.getClassLoader()) {});
  }
  
  List<ClassLoader> basicFindClassLoaders()
  {
    Class[] stack = contextFinder.getClassContext();
    List<ClassLoader> result = new ArrayList(1);
    ClassLoader previousLoader = null;
    for (int i = 1; i < stack.length; i++)
    {
      ClassLoader tmp = stack[i].getClassLoader();
      if ((stack[i] != THIS) && (tmp != null) && (tmp != this))
      {
        if ((checkClassLoader(tmp)) && 
          (previousLoader != tmp))
        {
          result.add(tmp);
          previousLoader = tmp;
        }
        if ((tmp == finderClassLoader) || ((tmp instanceof BundleClassLoader))) {
          break;
        }
      }
    }
    return result;
  }
  
  private boolean checkClassLoader(ClassLoader classloader)
  {
    if ((classloader == null) || (classloader == getParent())) {
      return false;
    }
    for (ClassLoader parent = classloader.getParent(); parent != null; parent = parent.getParent()) {
      if (parent == this) {
        return false;
      }
    }
    return true;
  }
  
  private List<ClassLoader> findClassLoaders()
  {
    if (System.getSecurityManager() == null) {
      return basicFindClassLoaders();
    }
    return (List)AccessController.doPrivileged(this);
  }
  
  public List<ClassLoader> run()
  {
    return basicFindClassLoaders();
  }
  
  private boolean startLoading(String name)
  {
    Set<String> classesAndResources = (Set)cycleDetector.get();
    if ((classesAndResources != null) && (classesAndResources.contains(name))) {
      return false;
    }
    if (classesAndResources == null)
    {
      classesAndResources = new HashSet(3);
      cycleDetector.set(classesAndResources);
    }
    classesAndResources.add(name);
    return true;
  }
  
  private void stopLoading(String name)
  {
    ((Set)cycleDetector.get()).remove(name);
  }
  
  protected Class<?> loadClass(String arg0, boolean arg1)
    throws ClassNotFoundException
  {
    if (!startLoading(arg0)) {
      throw new ClassNotFoundException(arg0);
    }
    try
    {
      List<ClassLoader> toConsult = findClassLoaders();
      Class localClass;
      for (Iterator<ClassLoader> loaders = toConsult.iterator(); loaders.hasNext();) {
        try
        {
          return ((ClassLoader)loaders.next()).loadClass(arg0);
        }
        catch (ClassNotFoundException localClassNotFoundException) {}
      }
      return parentContextClassLoader.loadClass(arg0);
    }
    finally
    {
      stopLoading(arg0);
    }
  }
  
  public URL getResource(String arg0)
  {
    if (!startLoading(arg0)) {
      return null;
    }
    try
    {
      List<ClassLoader> toConsult = findClassLoaders();
      URL localURL1;
      for (Iterator<ClassLoader> loaders = toConsult.iterator(); loaders.hasNext();)
      {
        URL result = ((ClassLoader)loaders.next()).getResource(arg0);
        if (result != null) {
          return result;
        }
      }
      return super.getResource(arg0);
    }
    finally
    {
      stopLoading(arg0);
    }
  }
  
  protected Enumeration<URL> findResources(String arg0)
    throws IOException
  {
    if (!startLoading(arg0))
    {
      Enumeration<URL> result = Collections.enumeration(Collections.EMPTY_LIST);
      return result;
    }
    try
    {
      List<ClassLoader> toConsult = findClassLoaders();
      Object localObject2;
      for (Iterator<ClassLoader> loaders = toConsult.iterator(); loaders.hasNext();)
      {
        Enumeration<URL> result = ((ClassLoader)loaders.next()).getResources(arg0);
        if ((result != null) && (result.hasMoreElements())) {
          return result;
        }
      }
      return super.findResources(arg0);
    }
    finally
    {
      stopLoading(arg0);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.core.runtime.internal.adaptor.ContextFinder
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.core.runtime.internal.adaptor;

import java.io.PrintStream;
import java.lang.reflect.Method;
import org.eclipse.core.runtime.adaptor.EclipseStarter;
import org.eclipse.core.runtime.internal.stats.StatsManager;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.service.runnable.StartupMonitor;

public class DefaultStartupMonitor
  implements StartupMonitor
{
  private Method updateMethod = null;
  private Runnable splashHandler = null;
  
  public DefaultStartupMonitor(Runnable splashHandler)
    throws IllegalStateException
  {
    this.splashHandler = splashHandler;
    try
    {
      updateMethod = splashHandler.getClass().getMethod("
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd