org.eclipse.osgi_3.8.2.v20130124-134944

 return;
    }
    NativeCodeDescription[] nativeCodeDescs = nativeCode.getPossibleSuppliers();
    for (int i = 0; i < nativeCodeDescs.length; i++)
    {
      BaseStorageHook storageHook = (BaseStorageHook)data.getStorageHook(BaseStorageHook.KEY);
      if (storageHook != null) {
        try
        {
          storageHook.validateNativePaths(nativeCodeDescs[i].getNativePaths());
        }
        catch (BundleException localBundleException)
        {
          stateManager.getSystemState().setNativePathsInvalid(nativeCodeDescs[i], true);
        }
      }
    }
  }
  
  /* Error */
  public long getNextBundleId()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 1203	org/eclipse/osgi/internal/baseadaptor/BaseStorage:nextIdMonitor	Ljava/lang/Object;
    //   4: dup
    //   5: astore_1
    //   6: monitorenter
    //   7: aload_0
    //   8: dup
    //   9: getfield 1197	org/eclipse/osgi/internal/baseadaptor/BaseStorage:nextId	J
    //   12: dup2_x1
    //   13: lconst_1
    //   14: ladd
    //   15: putfield 1197	org/eclipse/osgi/internal/baseadaptor/BaseStorage:nextId	J
    //   18: aload_1
    //   19: monitorexit
    //   20: lreturn
    //   21: aload_1
    //   22: monitorexit
    //   23: athrow
    // Line number table:
    //   Java source line #1380	-> byte code offset #0
    //   Java source line #1381	-> byte code offset #7
    //   Java source line #1380	-> byte code offset #21
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	24	0	this	BaseStorage
    //   5	17	1	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   7	20	21	finally
    //   21	23	21	finally
  }
  
  private class StateSaver
    implements Runnable
  {
    private final long delay_interval;
    private final long max_total_delay_interval;
    private boolean shutdown = false;
    private long lastSaveTime = 0L;
    private Thread runningThread = null;
    private Thread shutdownHook = null;
    private final State lock;
    
    StateSaver(State lock)
    {
      this.lock = lock;
      String prop = FrameworkProperties.getProperty("eclipse.stateSaveDelayInterval");
      long delayValue = 30000L;
      long maxDelayValue = 1800000L;
      if (prop != null) {
        try
        {
          long val = Long.parseLong(prop);
          if ((val >= 1000L) && (val <= 1800000L))
          {
            delayValue = val;
            maxDelayValue = val * 60L;
          }
          else if (val == 0L)
          {
            delayValue = 0L;
            maxDelayValue = 0L;
          }
        }
        catch (NumberFormatException localNumberFormatException) {}
      }
      delay_interval = delayValue;
      max_total_delay_interval = maxDelayValue;
    }
    
    public void run()
    {
      synchronized (lock)
      {
        long firstSaveTime = lastSaveTime;
        long curSaveTime = 0L;
        do
        {
          do
          {
            if (System.currentTimeMillis() - firstSaveTime > max_total_delay_interval)
            {
              curSaveTime = lastSaveTime;
              
              break;
            }
            long delayTime = Math.min(delay_interval, lastSaveTime - curSaveTime);
            curSaveTime = lastSaveTime;
            try
            {
              if (!shutdown) {
                lock.wait(delayTime);
              }
            }
            catch (InterruptedException localInterruptedException)
            {
              curSaveTime = lastSaveTime;
              break;
            }
          } while ((!shutdown) && (curSaveTime < lastSaveTime));
          saveAllData(false);
        } while ((!shutdown) && (curSaveTime < lastSaveTime));
        runningThread = null;
        try
        {
          Runtime.getRuntime().removeShutdownHook(shutdownHook);
        }
        catch (IllegalStateException localIllegalStateException) {}
        shutdownHook = null;
      }
    }
    
    void shutdown()
    {
      synchronized (lock)
      {
        if (shutdown) {
          return;
        }
        shutdown = true;
        Thread joinWith = runningThread;
        lock.notifyAll();
      }
      try
      {
        Thread joinWith;
        if (joinWith != null)
        {
          if (Debug.DEBUG_GENERAL) {
            Debug.println("About to join saving thread");
          }
          joinWith.join();
          if (Debug.DEBUG_GENERAL) {
            Debug.println("Joined with saving thread");
          }
        }
      }
      catch (InterruptedException ie)
      {
        if (Debug.DEBUG_GENERAL)
        {
          Debug.println("Error shutdowning StateSaver: " + ie.getMessage());
          Debug.printStackTrace(ie);
        }
      }
    }
    
    void requestSave()
    {
      synchronized (lock)
      {
        if (shutdown) {
          return;
        }
        if (delay_interval == 0L)
        {
          saveAllData(false);
          return;
        }
        lastSaveTime = System.currentTimeMillis();
        if (runningThread == null)
        {
          shutdownHook = new Thread(new Runnable()
          {
            public void run()
            {
              shutdown();
            }
          });
          runningThread = new Thread(this, "State Saver");
          runningThread.start();
          try
          {
            Runtime.getRuntime().addShutdownHook(shutdownHook);
          }
          catch (IllegalStateException localIllegalStateException) {}
        }
      }
    }
  }
  
  public void bundleChanged(BundleEvent event)
  {
    if (event.getType() != 32) {
      return;
    }
    BaseData data = (BaseData)((AbstractBundle)event.getBundle()).getBundleData();
    try
    {
      if ((data.getType() & 0x2) != 0) {
        processFrameworkExtension(data, (byte)1);
      } else if ((data.getType() & 0x4) != 0) {
        processBootExtension(data, (byte)1);
      } else if ((data.getType() & 0x10) != 0) {
        processExtExtension(data, (byte)1);
      }
    }
    catch (BundleException localBundleException) {}
  }
  
  public String copyToTempLibrary(BaseData data, String absolutePath)
    throws IOException
  {
    File storageRoot = getBundleStoreRoot();
    File libTempDir = new File(storageRoot, "libtemp");
    
    File realLib = new File(absolutePath);
    String libName = realLib.getName();
    
    File bundleTempDir = null;
    File libTempFile = null;
    
    Long bundleID = new Long(data.getBundleID());
    for (int i = 0; i < Integer.MAX_VALUE; i++)
    {
      bundleTempDir = new File(libTempDir, bundleID.toString() + "_" + new Integer(i).toString());
      libTempFile = new File(bundleTempDir, libName);
      if ((!bundleTempDir.exists()) || 
        (!libTempFile.exists())) {
        break;
      }
    }
    if (!bundleTempDir.exists())
    {
      bundleTempDir.mkdirs();
      bundleTempDir.deleteOnExit();
      
      File deleteFlag = new File(libTempDir, ".delete");
      if (!deleteFlag.exists()) {
        try
        {
          FileOutputStream out = new FileOutputStream(deleteFlag);
          out.close();
        }
        catch (IOException localIOException) {}
      }
    }
    InputStream in = new FileInputStream(realLib);
    AdaptorUtil.readFile(in, libTempFile);
    
    BundleFile.setPermissions(libTempFile);
    libTempFile.deleteOnExit();
    
    return libTempFile.getAbsolutePath();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.BaseStorage
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLConnection;
import java.util.Dictionary;
import java.util.Properties;
import java.util.StringTokenizer;
import org.eclipse.core.runtime.adaptor.LocationManager;
import org.eclipse.osgi.baseadaptor.BaseAdaptor;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.baseadaptor.hooks.AdaptorHook;
import org.eclipse.osgi.baseadaptor.hooks.StorageHook;
import org.eclipse.osgi.framework.adaptor.FilePath;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.internal.core.AbstractBundle;
import org.eclipse.osgi.framework.internal.core.Constants;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.framework.util.KeyedElement;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osgi.util.ManifestElement;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Version;

public class BaseStorageHook
  implements StorageHook, AdaptorHook
{
  public static final String KEY = BaseStorageHook.class.getName();
  public static final int HASHCODE = KEY.hashCode();
  public static final int DEL_BUNDLE_STORE = 1;
  public static final int DEL_GENERATION = 2;
  private static final int STORAGE_VERSION = 1;
  public static final String EXTERNAL_LIB_PREFIX = "external:";
  public static final String VARIABLE_DELIM_STRING = "$";
  public static final char VARIABLE_DELIM_CHAR = '$';
  public static String COMPOSITE_HEADER = "Equinox-CompositeBundle";
  public static String COMPOSITE_BUNDLE = "composite";
  public static String SURROGATE_BUNDLE = "surrogate";
  private String fileName;
  private String[] nativePaths;
  private int generation = 1;
  private boolean reference;
  private BaseData bundleData;
  private BaseStorage storage;
  private File bundleStore;
  private File dataStore;
  
  public BaseStorageHook(BaseStorage storage)
  {
    this.storage = storage;
  }
  
  public int getStorageVersion()
  {
    return 1;
  }
  
  public StorageHook create(BaseData bundledata)
    throws BundleException
  {
    BaseStorageHook storageHook = new BaseStorageHook(storage);
    bundleData = bundledata;
    return storageHook;
  }
  
  public void initialize(Dictionary<String, String> manifest)
    throws BundleException
  {
    loadManifest(bundleData, manifest);
  }
  
  static void loadManifest(BaseData target, Dictionary<String, String> manifest)
    throws BundleException
  {
    try
    {
      target.setVersion(Version.parseVersion((String)manifest.get("Bundle-Version")));
    }
    catch (IllegalArgumentException localIllegalArgumentException)
    {
      target.setVersion(new InvalidVersion((String)manifest.get("Bundle-Version")));
    }
    ManifestElement[] bsnHeader = ManifestElement.parseHeader("Bundle-SymbolicName", (String)manifest.get("Bundle-SymbolicName"));
    int bundleType = 0;
    if (bsnHeader != null)
    {
      target.setSymbolicName(bsnHeader[0].getValue());
      String singleton = bsnHeader[0].getDirective("singleton");
      if (singleton == null) {
        singleton = bsnHeader[0].getAttribute("singleton");
      }
      if ("true".equals(singleton)) {
        bundleType |= 0x8;
      }
    }
    String classpath = (String)manifest.get("Bundle-ClassPath");
    ManifestElement.parseHeader("Bundle-ClassPath", classpath);
    target.setClassPathString(classpath);
    target.setActivator((String)manifest.get("Bundle-Activator"));
    String host = (String)manifest.get("Fragment-Host");
    if (host != null)
    {
      bundleType |= 0x1;
      ManifestElement[] hostElement = ManifestElement.parseHeader("Fragment-Host", host);
      if ((Constants.getInternalSymbolicName().equals(hostElement[0].getValue())) || ("system.bundle".equals(hostElement[0].getValue())))
      {
        String extensionType = hostElement[0].getDirective("extension");
        if ((extensionType == null) || (extensionType.equals("framework"))) {
          bundleType |= 0x2;
        } else if (extensionType.equals("bootclasspath")) {
          bundleType |= 0x4;
        } else if (extensionType.equals("extclasspath")) {
          bundleType |= 0x10;
        }
      }
    }
    else
    {
      String composite = (String)manifest.get(COMPOSITE_HEADER);
      if (composite != null) {
        if (COMPOSITE_BUNDLE.equals(composite)) {
          bundleType |= 0x20;
        } else {
          bundleType |= 0x40;
        }
      }
    }
    target.setType(bundleType);
    target.setExecutionEnvironment((String)manifest.get("Bundle-RequiredExecutionEnvironment"));
    target.setDynamicImports((String)manifest.get("DynamicImport-Package"));
  }
  
  public StorageHook load(BaseData target, DataInputStream in)
    throws IOException
  {
    target.setLocation(AdaptorUtil.readString(in, false));
    target.setSymbolicName(AdaptorUtil.readString(in, false));
    target.setVersion(AdaptorUtil.loadVersion(in));
    target.setActivator(AdaptorUtil.readString(in, false));
    target.setClassPathString(AdaptorUtil.readString(in, false));
    target.setExecutionEnvironment(AdaptorUtil.readString(in, false));
    target.setDynamicImports(AdaptorUtil.readString(in, false));
    target.setStartLevel(in.readInt());
    target.setStatus(in.readInt());
    target.setType(in.readInt());
    target.setLastModified(in.readLong());
    target.setDirty(false);
    
    BaseStorageHook storageHook = new BaseStorageHook(storage);
    bundleData = target;
    generation = in.readInt();
    reference = in.readBoolean();
    storageHook.setFileName(getAbsolute(reference, AdaptorUtil.readString(in, false)));
    int nativePathCount = in.readInt();
    nativePaths = (nativePathCount > 0 ? new String[nativePathCount] : null);
    for (int i = 0; i < nativePathCount; i++) {
      nativePaths[i] = in.readUTF();
    }
    return storageHook;
  }
  
  private String getAbsolute(boolean isReference, String path)
  {
    if (!isReference) {
      return path;
    }
    File storedPath = new File(path);
    if (!storedPath.isAbsolute()) {
      return new FilePath(storage.getInstallPath() + path).toString();
    }
    return path;
  }
  
  public void save(DataOutputStream out)
    throws IOException
  {
    if (bundleData == null) {
      throw new IllegalStateException();
    }
    AdaptorUtil.writeStringOrNull(out, bundleData.getLocation());
    AdaptorUtil.writeStringOrNull(out, bundleData.getSymbolicName());
    AdaptorUtil.writeStringOrNull(out, bundleData.getVersion().toString());
    AdaptorUtil.writeStringOrNull(out, bundleData.getActivator());
    AdaptorUtil.writeStringOrNull(out, bundleData.getClassPathString());
    AdaptorUtil.writeStringOrNull(out, bundleData.getExecutionEnvironment());
    AdaptorUtil.writeStringOrNull(out, bundleData.getDynamicImports());
    StorageHook[] hooks = bundleData.getStorageHooks();
    boolean forgetStartLevel = false;
    for (int i = 0; (i < hooks.length) && (!forgetStartLevel); i++) {
      forgetStartLevel = hooks[i].forgetStartLevelChange(bundleData.getStartLevel());
    }
    out.writeInt(!forgetStartLevel ? bundleData.getStartLevel() : 1);
    boolean forgetStatus = false;
    for (int i = 0; (i < hooks.length) && (!forgetStatus); i++) {
      forgetStatus = hooks[i].forgetStatusChange(bundleData.getStatus());
    }
    out.writeInt(!forgetStatus ? bundleData.getStatus() : 0xFFFFFFFE & bundleData.getStatus());
    out.writeInt(bundleData.getType());
    out.writeLong(bundleData.getLastModified());
    
    out.writeInt(getGeneration());
    out.writeBoolean(isReference());
    String storedFileName = isReference() ? new FilePath(storage.getInstallPath()).makeRelative(new FilePath(getFileName())) : getFileName();
    AdaptorUtil.writeStringOrNull(out, storedFileName);
    if (nativePaths == null)
    {
      out.writeInt(0);
    }
    else
    {
      out.writeInt(nativePaths.length);
      for (int i = 0; i < nativePaths.length; i++) {
        out.writeUTF(nativePaths[i]);
      }
    }
  }
  
  public int getKeyHashCode()
  {
    return HASHCODE;
  }
  
  public boolean compare(KeyedElement other)
  {
    return other.getKey() == KEY;
  }
  
  public Object getKey()
  {
    return KEY;
  }
  
  public String getFileName()
  {
    return fileName;
  }
  
  public int getGeneration()
  {
    return generation;
  }
  
  public String[] getNativePaths()
  {
    return nativePaths;
  }
  
  public void installNativePaths(String[] installPaths)
    throws BundleException
  {
    validateNativePaths(installPaths);
    nativePaths = installPaths;
  }
  
  public void validateNativePaths(String[] paths)
    throws BundleException
  {
    for (int i = 0; i < paths.length; i++) {
      if (paths[i].startsWith("external:"))
      {
        String path = substituteVars(paths[i].substring("external:".length()));
        File nativeFile = new File(path);
        if (!nativeFile.exists()) {
          throw new BundleException(NLS.bind(AdaptorMsg.BUNDLE_NATIVECODE_EXCEPTION, nativeFile.getAbsolutePath()), 8);
        }
      }
      else
      {
        BundleEntry nativeEntry = bundleData.getBundleFile().getEntry(paths[i]);
        if (nativeEntry == null) {
          throw new BundleException(NLS.bind(AdaptorMsg.BUNDLE_NATIVECODE_EXCEPTION, paths[i]), 8);
        }
      }
    }
  }
  
  public boolean isReference()
  {
    return reference;
  }
  
  public File getBundleStore()
  {
    if (bundleStore == null) {
      bundleStore = new File(storage.getBundleStoreRoot(), String.valueOf(bundleData.getBundleID()));
    }
    return bundleStore;
  }
  
  public File getDataFile(String path)
  {
    if (dataStore == null) {
      dataStore = new File(getBundleStore(), "data");
    }
    if ((path != null) && (!dataStore.exists()) && ((storage.isReadOnly()) || (!dataStore.mkdirs())) && 
      (Debug.DEBUG_GENERAL)) {
      Debug.println("Unable to create bundle data directory: " + dataStore.getPath());
    }
    return path == null ? dataStore : new File(dataStore, path);
  }
  
  void delete(boolean postpone, int type)
    throws IOException
  {
    File delete = null;
    switch (type)
    {
    case 2: 
      delete = getGenerationDir();
      break;
    case 1: 
      delete = getBundleStore();
    }
    if ((delete != null) && (delete.exists()) && ((postpone) || (!AdaptorUtil.rm(delete))))
    {
      FileOutputStream out = new FileOutputStream(new File(delete, ".delete"));
      out.close();
    }
  }
  
  File getGenerationDir()
  {
    return new File(getBundleStore(), String.valueOf(getGeneration()));
  }
  
  File getParentGenerationDir()
  {
    Location parentConfiguration = null;
    Location currentConfiguration = LocationManager.getConfigurationLocation();
    if ((currentConfiguration != null) && ((parentConfiguration = currentConfiguration.getParentLocation()) != null)) {
      return new File(parentConfiguration.getURL().getFile(), "org.eclipse.osgi/bundles/" + bundleData.getBundleID() + '/' + getGeneration());
    }
    return null;
  }
  
  File createGenerationDir()
  {
    File generationDir = getGenerationDir();
    if ((!generationDir.exists()) && ((storage.isReadOnly()) || (!generationDir.mkdirs())) && 
      (Debug.DEBUG_GENERAL)) {
      Debug.println("Unable to create bundle generation directory: " + generationDir.getPath());
    }
    return generationDir;
  }
  
  public void setReference(boolean reference)
  {
    this.reference = reference;
  }
  
  public void setFileName(String fileName)
  {
    this.fileName = fileName;
    
    bundleData.setFileName(fileName);
  }
  
  public void copy(StorageHook storageHook)
  {
    if (!(storageHook instanceof BaseStorageHook)) {
      throw new IllegalArgumentException();
    }
    BaseStorageHook hook = (BaseStorageHook)storageHook;
    bundleStore = bundleStore;
    dataStore = dataStore;
    generation += 1;
  }
  
  public void validate()
    throws IllegalArgumentException
  {}
  
  public Dictionary<String, String> getManifest(boolean firstLoad)
    throws BundleException
  {
    return null;
  }
  
  public boolean forgetStatusChange(int status)
  {
    return false;
  }
  
  public boolean forgetStartLevelChange(int startlevel)
  {
    return false;
  }
  
  public void initialize(BaseAdaptor adaptor) {}
  
  public void frameworkStart(BundleContext context)
    throws BundleException
  {}
  
  public void frameworkStop(BundleContext context)
    throws BundleException
  {}
  
  public void frameworkStopping(BundleContext context) {}
  
  public void addProperties(Properties properties) {}
  
  public URLConnection mapLocationToURLConnection(String location)
    throws IOException
  {
    if (location.startsWith("initial@"))
    {
      location = location.substring(8);
      return new URL(location).openConnection();
    }
    Bundle[] bundles = storage.getAdaptor().getContext().getBundles();
    AbstractBundle bundle = null;
    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(KEY);
    return hook.isReference() ? new URL("reference:file:" + hook.getFileName()).openConnection() : null;
  }
  
  public void handleRuntimeError(Throwable error) {}
  
  public FrameworkLog createFrameworkLog()
  {
    return null;
  }
  
  public BaseStorage getStorage()
  {
    return storage;
  }
  
  public static String substituteVars(String path)
  {
    StringBuffer buf = new StringBuffer(path.length());
    StringTokenizer st = new StringTokenizer(path, "$", true);
    boolean varStarted = false;
    String var = null;
    while (st.hasMoreElements())
    {
      String tok = st.nextToken();
      if ("$".equals(tok))
      {
        if (!varStarted)
        {
          varStarted = true;
          var = "";
        }
        else
        {
          String prop = null;
          if ((var != null) && (var.length() > 0)) {
            prop = FrameworkProperties.getProperty(var);
          }
          if (prop == null) {
            try
            {
              Method getenv = tmp93_90.getMethod("getenv", new Class[] { String.class });
              prop = (String)getenv.invoke(null, new Object[] { var });
            }
            catch (Throwable localThrowable) {}
          }
          if (prop != null) {
            buf.append(prop);
          } else {
            buf.append(var == null ? "" : var);
          }
          varStarted = false;
          var = null;
        }
      }
      else if (!varStarted) {
        buf.append(tok);
      } else {
        var = tok;
      }
    }
    if (var != null) {
      buf.append('$').append(var);
    }
    return buf.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.BaseStorageHook
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.IOException;
import java.net.URLConnection;
import org.eclipse.osgi.baseadaptor.BaseAdaptor;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.adaptor.BundleOperation;
import org.eclipse.osgi.framework.adaptor.EventPublisher;
import org.eclipse.osgi.framework.debug.Debug;
import org.osgi.framework.BundleException;

public class BundleInstall
  implements BundleOperation
{
  private BaseData data;
  private URLConnection source;
  private BaseStorage storage;
  
  public BundleInstall(BaseData data, URLConnection source, BaseStorage storage)
  {
    this.data = data;
    this.source = source;
    this.storage = storage;
  }
  
  /* Error */
  public org.eclipse.osgi.framework.adaptor.BundleData begin()
    throws BundleException
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_1
    //   2: aload_0
    //   3: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleInstall:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   6: invokestatic 254	java/lang/System:currentTimeMillis	()J
    //   9: invokevirtual 264	org/eclipse/osgi/baseadaptor/BaseData:setLastModified	(J)V
    //   12: aload_0
    //   13: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleInstall:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   16: aload_0
    //   17: getfield 239	org/eclipse/osgi/internal/baseadaptor/BundleInstall:storage	Lorg/eclipse/osgi/internal/baseadaptor/BaseStorage;
    //   20: invokevirtual 274	org/eclipse/osgi/internal/baseadaptor/BaseStorage:getInitialBundleStartLevel	()I
    //   23: invokevirtual 263	org/eclipse/osgi/baseadaptor/BaseData:setStartLevel	(I)V
    //   26: aload_0
    //   27: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleInstall:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   30: invokevirtual 265	org/eclipse/osgi/baseadaptor/BaseData:getAdaptor	()Lorg/eclipse/osgi/baseadaptor/BaseAdaptor;
    //   33: invokevirtual 259	org/eclipse/osgi/baseadaptor/BaseAdaptor:getHookRegistry	()Lorg/eclipse/osgi/baseadaptor/HookRegistry;
    //   36: invokevirtual 269	org/eclipse/osgi/baseadaptor/HookRegistry:getStorageHooks	()[Lorg/eclipse/osgi/baseadaptor/hooks/StorageHook;
    //   39: astore_2
    //   40: aload_2
    //   41: arraylength
    //   42: anewarray 123	org/eclipse/osgi/baseadaptor/hooks/StorageHook
    //   45: astore_3
    //   46: iconst_0
    //   47: istore 4
    //   49: goto +23 -> 72
    //   52: aload_3
    //   53: iload 4
    //   55: aload_2
    //   56: iload 4
    //   58: aaload
    //   59: aload_0
    //   60: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleInstall:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   63: invokeinterface 288 2 0
    //   68: aastore
    //   69: iinc 4 1
    //   72: iload 4
    //   74: aload_2
    //   75: arraylength
    //   76: if_icmplt -24 -> 52
    //   79: aload_0
    //   80: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleInstall:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   83: aload_3
    //   84: invokevirtual 266	org/eclipse/osgi/baseadaptor/BaseData:setStorageHooks	([Lorg/eclipse/osgi/baseadaptor/hooks/StorageHook;)V
    //   87: aload_0
    //   88: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleInstall:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   91: getstatic 236	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:KEY	Ljava/lang/String;
    //   94: invokevirtual 268	org/eclipse/osgi/baseadaptor/BaseData:getStorageHook	(Ljava/lang/String;)Lorg/eclipse/osgi/baseadaptor/hooks/StorageHook;
    //   97: checkcast 131	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook
    //   100: astore 4
    //   102: aload_0
    //   103: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleInstall:source	Ljava/net/URLConnection;
    //   106: invokevirtual 257	java/net/URLConnection:getInputStream	()Ljava/io/InputStream;
    //   109: astore_1
    //   110: aload_0
    //   111: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleInstall:source	Ljava/net/URLConnection;
    //   114: invokevirtual 258	java/net/URLConnection:getURL	()Ljava/net/URL;
    //   117: astore 5
    //   119: aload 5
    //   121: ifnonnull +7 -> 128
    //   124: aconst_null
    //   125: goto +8 -> 133
    //   128: aload 5
    //   130: invokevirtual 256	java/net/URL:getProtocol	()Ljava/lang/String;
    //   133: astore 6
    //   135: aload_1
    //   136: instanceof 127
    //   139: ifeq +60 -> 199
    //   142: aload_1
    //   143: checkcast 127	org/eclipse/osgi/framework/internal/core/ReferenceInputStream
    //   146: invokevirtual 271	org/eclipse/osgi/framework/internal/core/ReferenceInputStream:getReference	()Ljava/net/URL;
    //   149: astore 7
    //   151: ldc 4
    //   153: aload 7
    //   155: invokevirtual 256	java/net/URL:getProtocol	()Ljava/lang/String;
    //   158: invokevirtual 249	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   161: ifne +19 -> 180
    //   164: new 134	org/osgi/framework/BundleException
    //   167: dup
    //   168: getstatic 234	org/eclipse/osgi/internal/baseadaptor/AdaptorMsg:ADAPTOR_URL_CREATE_EXCEPTION	Ljava/lang/String;
    //   171: aload 7
    //   173: invokestatic 283	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   176: invokespecial 284	org/osgi/framework/BundleException:<init>	(Ljava/lang/String;)V
    //   179: athrow
    //   180: aload 4
    //   182: iconst_1
    //   183: invokevirtual 278	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:setReference	(Z)V
    //   186: aload 4
    //   188: aload 7
    //   190: invokevirtual 255	java/net/URL:getPath	()Ljava/lang/String;
    //   193: invokevirtual 282	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:setFileName	(Ljava/lang/String;)V
    //   196: goto +128 -> 324
    //   199: aload 4
    //   201: invokevirtual 280	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:createGenerationDir	()Ljava/io/File;
    //   204: astore 7
    //   206: aload 7
    //   208: invokevirtual 240	java/io/File:exists	()Z
    //   211: ifne +22 -> 233
    //   214: new 112	java/io/IOException
    //   217: dup
    //   218: getstatic 232	org/eclipse/osgi/internal/baseadaptor/AdaptorMsg:ADAPTOR_DIRECTORY_CREATE_EXCEPTION	Ljava/lang/String;
    //   221: aload 7
    //   223: invokevirtual 242	java/io/File:getPath	()Ljava/lang/String;
    //   226: invokestatic 283	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   229: invokespecial 246	java/io/IOException:<init>	(Ljava/lang/String;)V
    //   232: athrow
    //   233: aload 4
    //   235: iconst_0
    //   236: invokevirtual 278	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:setReference	(Z)V
    //   239: aload 4
    //   241: ldc 3
    //   243: invokevirtual 282	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:setFileName	(Ljava/lang/String;)V
    //   246: new 111	java/io/File
    //   249: dup
    //   250: aload 7
    //   252: aload 4
    //   254: invokevirtual 281	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:getFileName	()Ljava/lang/String;
    //   257: invokespecial 244	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   260: astore 8
    //   262: ldc 4
    //   264: aload 6
    //   266: invokevirtual 249	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   269: ifeq +49 -> 318
    //   272: new 111	java/io/File
    //   275: dup
    //   276: aload_0
    //   277: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleInstall:source	Ljava/net/URLConnection;
    //   280: invokevirtual 258	java/net/URLConnection:getURL	()Ljava/net/URL;
    //   283: invokevirtual 255	java/net/URL:getPath	()Ljava/lang/String;
    //   286: invokespecial 243	java/io/File:<init>	(Ljava/lang/String;)V
    //   289: astore 9
    //   291: aload 9
    //   293: invokevirtual 241	java/io/File:isDirectory	()Z
    //   296: ifeq +13 -> 309
    //   299: aload 9
    //   301: aload 8
    //   303: invokestatic 272	org/eclipse/osgi/internal/baseadaptor/AdaptorUtil:copyDir	(Ljava/io/File;Ljava/io/File;)V
    //   306: goto +18 -> 324
    //   309: aload_1
    //   310: aload 8
    //   312: invokestatic 273	org/eclipse/osgi/internal/baseadaptor/AdaptorUtil:readFile	(Ljava/io/InputStream;Ljava/io/File;)V
    //   315: goto +9 -> 324
    //   318: aload_1
    //   319: aload 8
    //   321: invokestatic 273	org/eclipse/osgi/internal/baseadaptor/AdaptorUtil:readFile	(Ljava/io/InputStream;Ljava/io/File;)V
    //   324: aload_0
    //   325: getfield 239	org/eclipse/osgi/internal/baseadaptor/BundleInstall:storage	Lorg/eclipse/osgi/internal/baseadaptor/BaseStorage;
    //   328: aload_0
    //   329: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleInstall:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   332: iconst_1
    //   333: invokevirtual 277	org/eclipse/osgi/internal/baseadaptor/BaseStorage:loadManifest	(Lorg/eclipse/osgi/baseadaptor/BaseData;Z)Ljava/util/Dictionary;
    //   336: astore 7
    //   338: iconst_0
    //   339: istore 8
    //   341: goto +17 -> 358
    //   344: aload_3
    //   345: iload 8
    //   347: aaload
    //   348: aload 7
    //   350: invokeinterface 287 2 0
    //   355: iinc 8 1
    //   358: iload 8
    //   360: aload_3
    //   361: arraylength
    //   362: if_icmplt -18 -> 344
    //   365: goto +20 -> 385
    //   368: astore 10
    //   370: aload_1
    //   371: ifnull +11 -> 382
    //   374: aload_1
    //   375: invokevirtual 247	java/io/InputStream:close	()V
    //   378: goto +4 -> 382
    //   381: pop
    //   382: aload 10
    //   384: athrow
    //   385: aload_1
    //   386: ifnull +29 -> 415
    //   389: aload_1
    //   390: invokevirtual 247	java/io/InputStream:close	()V
    //   393: goto +22 -> 415
    //   396: pop
    //   397: goto +18 -> 415
    //   400: astore_1
    //   401: new 134	org/osgi/framework/BundleException
    //   404: dup
    //   405: getstatic 235	org/eclipse/osgi/internal/baseadaptor/AdaptorMsg:BUNDLE_READ_EXCEPTION	Ljava/lang/String;
    //   408: bipush 11
    //   410: aload_1
    //   411: invokespecial 285	org/osgi/framework/BundleException:<init>	(Ljava/lang/String;ILjava/lang/Throwable;)V
    //   414: athrow
    //   415: aload_0
    //   416: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleInstall:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   419: areturn
    // Line number table:
    //   Java source line #46	-> byte code offset #0
    //   Java source line #48	-> byte code offset #2
    //   Java source line #49	-> byte code offset #12
    //   Java source line #50	-> byte code offset #26
    //   Java source line #51	-> byte code offset #40
    //   Java source line #52	-> byte code offset #46
    //   Java source line #53	-> byte code offset #52
    //   Java source line #52	-> byte code offset #69
    //   Java source line #54	-> byte code offset #79
    //   Java source line #55	-> byte code offset #87
    //   Java source line #56	-> byte code offset #102
    //   Java source line #57	-> byte code offset #110
    //   Java source line #58	-> byte code offset #119
    //   Java source line #59	-> byte code offset #135
    //   Java source line #60	-> byte code offset #142
    //   Java source line #61	-> byte code offset #151
    //   Java source line #62	-> byte code offset #164
    //   Java source line #63	-> byte code offset #180
    //   Java source line #64	-> byte code offset #186
    //   Java source line #65	-> byte code offset #196
    //   Java source line #66	-> byte code offset #199
    //   Java source line #67	-> byte code offset #206
    //   Java source line #68	-> byte code offset #214
    //   Java source line #69	-> byte code offset #233
    //   Java source line #70	-> byte code offset #239
    //   Java source line #71	-> byte code offset #246
    //   Java source line #72	-> byte code offset #262
    //   Java source line #73	-> byte code offset #272
    //   Java source line #74	-> byte code offset #291
    //   Java source line #75	-> byte code offset #299
    //   Java source line #77	-> byte code offset #309
    //   Java source line #78	-> byte code offset #315
    //   Java source line #79	-> byte code offset #318
    //   Java source line #82	-> byte code offset #324
    //   Java source line #83	-> byte code offset #338
    //   Java source line #84	-> byte code offset #344
    //   Java source line #83	-> byte code offset #355
    //   Java source line #85	-> byte code offset #365
    //   Java source line #87	-> byte code offset #370
    //   Java source line #88	-> byte code offset #374
    //   Java source line #89	-> byte code offset #378
    //   Java source line #92	-> byte code offset #382
    //   Java source line #87	-> byte code offset #385
    //   Java source line #88	-> byte code offset #389
    //   Java source line #89	-> byte code offset #393
    //   Java source line #93	-> byte code offset #397
    //   Java source line #94	-> byte code offset #401
    //   Java source line #97	-> byte code offset #415
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	420	0	this	BundleInstall
    //   1	389	1	in	java.io.InputStream
    //   400	11	1	ioe	IOException
    //   39	36	2	storageHooks	org.eclipse.osgi.baseadaptor.hooks.StorageHook[]
    //   45	316	3	instanceHooks	org.eclipse.osgi.baseadaptor.hooks.StorageHook[]
    //   47	26	4	i	int
    //   100	153	4	storageHook	BaseStorageHook
    //   117	12	5	sourceURL	java.net.URL
    //   133	132	6	protocol	String
    //   149	40	7	reference	java.net.URL
    //   204	47	7	genDir	java.io.File
    //   336	13	7	manifest	java.util.Dictionary<String, String>
    //   260	60	8	outFile	java.io.File
    //   339	20	8	i	int
    //   289	11	9	inFile	java.io.File
    //   368	15	10	localObject	Object
    //   381	1	16	localIOException1	IOException
    //   396	1	17	localIOException2	IOException
    // Exception table:
    //   from	to	target	type
    //   2	368	368	finally
    //   370	378	381	java/io/IOException
    //   385	393	396	java/io/IOException
    //   0	397	400	java/io/IOException
  }
  
  public void undo()
  {
    if (data != null) {
      try
      {
        data.close();
      }
      catch (IOException e)
      {
        if (Debug.DEBUG_GENERAL) {
          Debug.println("Unable to close " + data + ": " + e.getMessage());
        }
      }
    }
    if (data != null)
    {
      BaseStorageHook storageHook = (BaseStorageHook)data.getStorageHook(BaseStorageHook.KEY);
      try
      {
        if (storageHook != null) {
          storageHook.delete(false, 1);
        }
      }
      catch (IOException e)
      {
        data.getAdaptor().getEventPublisher().publishFrameworkEvent(2, data.getBundle(), e);
      }
    }
  }
  
  public void commit(boolean postpone)
    throws BundleException
  {
    storage.processExtension(data, (byte)2);
    storage.updateState(data, 1);
    try
    {
      data.save();
    }
    catch (IOException e)
    {
      throw new BundleException(AdaptorMsg.ADAPTOR_STORAGE_EXCEPTION, e);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.BundleInstall
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.IOException;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.BundleOperation;
import org.osgi.framework.BundleException;

public class BundleUninstall
  implements BundleOperation
{
  private BaseData data;
  private BaseStorage storage;
  
  public BundleUninstall(BaseData data, BaseStorage storage)
  {
    this.data = data;
    this.storage = storage;
  }
  
  public BundleData begin()
    throws BundleException
  {
    return data;
  }
  
  public void commit(boolean postpone)
    throws BundleException
  {
    BaseStorageHook storageHook = (BaseStorageHook)data.getStorageHook(BaseStorageHook.KEY);
    try
    {
      storageHook.delete(postpone, 1);
    }
    catch (IOException localIOException1) {}
    storage.processExtension(data, (byte)4);
    data.setLastModified(System.currentTimeMillis());
    storage.updateState(data, 16);
    data.setDirty(true);
    try
    {
      data.save();
    }
    catch (IOException e)
    {
      throw new BundleException(AdaptorMsg.ADAPTOR_STORAGE_EXCEPTION, e);
    }
  }
  
  public void undo()
    throws BundleException
  {}
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.BundleUninstall
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.IOException;
import java.net.URLConnection;
import org.eclipse.osgi.baseadaptor.BaseAdaptor;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osg
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-2019. Infinite Loop Ltd