org.eclipse.osgi_3.7.2.v20120110-1415

eLimit; i++) {
        useStampList[i] = 0L;
      }
      curUseStamp = 0L;
    }
    useStampList[index] = (++curUseStamp);
  }
  
  /* Error */
  public final void dispatchEvent(Object eventListener, Object listenerObject, int eventAction, BundleFile eventObject)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 184	org/eclipse/osgi/baseadaptor/bundlefile/MRUBundleFileList:firstDispatch	Z
    //   4: ifeq +15 -> 19
    //   7: invokestatic 198	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   10: aconst_null
    //   11: invokevirtual 197	java/lang/Thread:setContextClassLoader	(Ljava/lang/ClassLoader;)V
    //   14: aload_0
    //   15: iconst_0
    //   16: putfield 184	org/eclipse/osgi/baseadaptor/bundlefile/MRUBundleFileList:firstDispatch	Z
    //   19: getstatic 186	org/eclipse/osgi/baseadaptor/bundlefile/MRUBundleFileList:closingBundleFile	Ljava/lang/ThreadLocal;
    //   22: aload 4
    //   24: invokevirtual 201	java/lang/ThreadLocal:set	(Ljava/lang/Object;)V
    //   27: aload 4
    //   29: invokevirtual 203	org/eclipse/osgi/baseadaptor/bundlefile/BundleFile:close	()V
    //   32: goto +26 -> 58
    //   35: pop
    //   36: getstatic 186	org/eclipse/osgi/baseadaptor/bundlefile/MRUBundleFileList:closingBundleFile	Ljava/lang/ThreadLocal;
    //   39: aconst_null
    //   40: invokevirtual 201	java/lang/ThreadLocal:set	(Ljava/lang/Object;)V
    //   43: goto +22 -> 65
    //   46: astore 5
    //   48: getstatic 186	org/eclipse/osgi/baseadaptor/bundlefile/MRUBundleFileList:closingBundleFile	Ljava/lang/ThreadLocal;
    //   51: aconst_null
    //   52: invokevirtual 201	java/lang/ThreadLocal:set	(Ljava/lang/Object;)V
    //   55: aload 5
    //   57: athrow
    //   58: getstatic 186	org/eclipse/osgi/baseadaptor/bundlefile/MRUBundleFileList:closingBundleFile	Ljava/lang/ThreadLocal;
    //   61: aconst_null
    //   62: invokevirtual 201	java/lang/ThreadLocal:set	(Ljava/lang/Object;)V
    //   65: return
    // Line number table:
    //   Java source line #176	-> byte code offset #0
    //   Java source line #178	-> byte code offset #7
    //   Java source line #179	-> byte code offset #14
    //   Java source line #182	-> byte code offset #19
    //   Java source line #183	-> byte code offset #27
    //   Java source line #184	-> byte code offset #35
    //   Java source line #187	-> byte code offset #36
    //   Java source line #186	-> byte code offset #46
    //   Java source line #187	-> byte code offset #48
    //   Java source line #188	-> byte code offset #55
    //   Java source line #187	-> byte code offset #58
    //   Java source line #189	-> byte code offset #65
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	66	0	this	MRUBundleFileList
    //   0	66	1	eventListener	Object
    //   0	66	2	listenerObject	Object
    //   0	66	3	eventAction	int
    //   0	66	4	eventObject	BundleFile
    //   46	10	5	localObject	Object
    //   35	1	6	localIOException	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   19	32	35	java/io/IOException
    //   19	36	46	finally
  }
  
  private void closeBundleFile(BundleFile toRemove)
  {
    if (toRemove == null) {
      return;
    }
    try
    {
      ListenerQueue<Object, Object, BundleFile> queue = new ListenerQueue(bundleFileCloserManager);
      
      queue.queueListeners(bundleFileCloser.entrySet(), this);
      
      queue.dispatchEventAsynchronous(0, toRemove);
    }
    catch (Throwable localThrowable) {}
  }
  
  public void shutdown()
  {
    if (bundleFileCloserManager != null) {
      bundleFileCloserManager.close();
    }
  }
  
  public boolean isClosing(BundleFile bundleFile)
  {
    if (fileLimit < 10) {
      return false;
    }
    return closingBundleFile.get() == bundleFile;
  }
  
  public boolean isEnabled()
  {
    return fileLimit >= 10;
  }
}

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

import java.util.Enumeration;

class NestedDirBundleFile$1
  implements Enumeration<String>
{
  final NestedDirBundleFile this$0;
  
  NestedDirBundleFile$1(NestedDirBundleFile paramNestedDirBundleFile, Enumeration paramEnumeration, int paramInt) {}
  
  public boolean hasMoreElements()
  {
    return val$basePaths.hasMoreElements();
  }
  
  public String nextElement()
  {
    String next = (String)val$basePaths.nextElement();
    return next.substring(val$cpLength);
  }
}

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

import java.io.File;
import java.io.IOException;
import java.util.Enumeration;

public class NestedDirBundleFile
  extends BundleFile
{
  private final BundleFile baseBundleFile;
  private final String cp;
  
  public NestedDirBundleFile(BundleFile baseBundlefile, String cp)
  {
    super(baseBundlefile.getBaseFile());
    baseBundleFile = baseBundlefile;
    if (cp.charAt(cp.length() - 1) != '/') {
      cp = cp + '/';
    }
    this.cp = cp;
  }
  
  public void close() {}
  
  public BundleEntry getEntry(String path)
  {
    return baseBundleFile.getEntry(prependNestedDir(path));
  }
  
  public boolean containsDir(String dir)
  {
    if (dir == null) {
      return false;
    }
    return baseBundleFile.containsDir(prependNestedDir(dir));
  }
  
  private String prependNestedDir(String path)
  {
    if ((path.length() > 0) && (path.charAt(0) == '/')) {
      path = path.substring(1);
    }
    return cp + path;
  }
  
  public Enumeration<String> getEntryPaths(String path)
  {
    final Enumeration<String> basePaths = baseBundleFile.getEntryPaths(prependNestedDir(path));
    final int cpLength = cp.length();
    if (basePaths == null) {
      return null;
    }
    new Enumeration()
    {
      public boolean hasMoreElements()
      {
        return basePaths.hasMoreElements();
      }
      
      public String nextElement()
      {
        String next = (String)basePaths.nextElement();
        return next.substring(cpLength);
      }
    };
  }
  
  public File getFile(String entry, boolean nativeCode)
  {
    return null;
  }
  
  public void open()
    throws IOException
  {}
}

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

import java.io.IOException;
import java.io.InputStream;

class ZipBundleEntry$ZipBundleEntryInputStream
  extends InputStream
{
  private final InputStream stream;
  private boolean closed = false;
  final ZipBundleEntry this$0;
  
  public ZipBundleEntry$ZipBundleEntryInputStream(ZipBundleEntry paramZipBundleEntry, InputStream stream)
  {
    this.stream = stream;
  }
  
  public int available()
    throws IOException
  {
    return stream.available();
  }
  
  /* Error */
  public void close()
    throws IOException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 62	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:stream	Ljava/io/InputStream;
    //   4: invokevirtual 67	java/io/InputStream:close	()V
    //   7: goto +43 -> 50
    //   10: astore_1
    //   11: aload_0
    //   12: dup
    //   13: astore_2
    //   14: monitorenter
    //   15: aload_0
    //   16: getfield 61	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:closed	Z
    //   19: ifeq +6 -> 25
    //   22: aload_2
    //   23: monitorexit
    //   24: return
    //   25: aload_0
    //   26: iconst_1
    //   27: putfield 61	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:closed	Z
    //   30: aload_2
    //   31: monitorexit
    //   32: goto +6 -> 38
    //   35: aload_2
    //   36: monitorexit
    //   37: athrow
    //   38: aload_0
    //   39: getfield 63	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:this$0	Lorg/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry;
    //   42: getfield 60	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry:bundleFile	Lorg/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile;
    //   45: invokevirtual 74	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile:decrementReference	()V
    //   48: aload_1
    //   49: athrow
    //   50: aload_0
    //   51: dup
    //   52: astore_2
    //   53: monitorenter
    //   54: aload_0
    //   55: getfield 61	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:closed	Z
    //   58: ifeq +6 -> 64
    //   61: aload_2
    //   62: monitorexit
    //   63: return
    //   64: aload_0
    //   65: iconst_1
    //   66: putfield 61	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:closed	Z
    //   69: aload_2
    //   70: monitorexit
    //   71: goto +6 -> 77
    //   74: aload_2
    //   75: monitorexit
    //   76: athrow
    //   77: aload_0
    //   78: getfield 63	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:this$0	Lorg/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry;
    //   81: getfield 60	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry:bundleFile	Lorg/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile;
    //   84: invokevirtual 74	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile:decrementReference	()V
    //   87: return
    // Line number table:
    //   Java source line #133	-> byte code offset #0
    //   Java source line #134	-> byte code offset #10
    //   Java source line #135	-> byte code offset #11
    //   Java source line #136	-> byte code offset #15
    //   Java source line #137	-> byte code offset #22
    //   Java source line #138	-> byte code offset #25
    //   Java source line #135	-> byte code offset #30
    //   Java source line #140	-> byte code offset #38
    //   Java source line #141	-> byte code offset #48
    //   Java source line #135	-> byte code offset #50
    //   Java source line #136	-> byte code offset #54
    //   Java source line #137	-> byte code offset #61
    //   Java source line #138	-> byte code offset #64
    //   Java source line #135	-> byte code offset #69
    //   Java source line #140	-> byte code offset #77
    //   Java source line #142	-> byte code offset #87
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	88	0	this	ZipBundleEntryInputStream
    //   10	39	1	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   0	10	10	finally
    //   15	24	35	finally
    //   25	32	35	finally
    //   35	37	35	finally
    //   54	63	74	finally
    //   64	71	74	finally
    //   74	76	74	finally
  }
  
  public void mark(int var0)
  {
    stream.mark(var0);
  }
  
  public boolean markSupported()
  {
    return stream.markSupported();
  }
  
  public int read()
    throws IOException
  {
    return stream.read();
  }
  
  public int read(byte[] var0, int var1, int var2)
    throws IOException
  {
    return stream.read(var0, var1, var2);
  }
  
  public int read(byte[] var0)
    throws IOException
  {
    return stream.read(var0);
  }
  
  public void reset()
    throws IOException
  {
    stream.reset();
  }
  
  public long skip(long var0)
    throws IOException
  {
    return stream.skip(var0);
  }
}

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

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class ZipBundleEntry
  extends BundleEntry
{
  protected final ZipEntry zipEntry;
  protected final ZipBundleFile bundleFile;
  
  ZipBundleEntry(ZipEntry zipEntry, ZipBundleFile bundleFile)
  {
    this.zipEntry = zipEntry;
    this.bundleFile = bundleFile;
  }
  
  public InputStream getInputStream()
    throws IOException
  {
    ZipBundleFile zipBundleFile = bundleFile;
    if (!zipBundleFile.isMruEnabled()) {
      return bundleFile.getZipFile().getInputStream(zipEntry);
    }
    zipBundleFile.incrementReference();
    InputStream result = null;
    try
    {
      return result = new ZipBundleEntryInputStream(zipBundleFile.getZipFile().getInputStream(zipEntry));
    }
    finally
    {
      if (result == null) {
        zipBundleFile.decrementReference();
      }
    }
  }
  
  public long getSize()
  {
    return zipEntry.getSize();
  }
  
  public String getName()
  {
    return zipEntry.getName();
  }
  
  public long getTime()
  {
    return zipEntry.getTime();
  }
  
  public URL getLocalURL()
  {
    try
    {
      return new URL("jar:" + bundleFile.basefile.toURL() + "!/" + zipEntry.getName());
    }
    catch (MalformedURLException localMalformedURLException) {}
    return null;
  }
  
  public URL getFileURL()
  {
    try
    {
      File file = bundleFile.getFile(zipEntry.getName(), false);
      if (file != null) {
        return file.toURL();
      }
    }
    catch (MalformedURLException localMalformedURLException) {}
    return null;
  }
  
  private class ZipBundleEntryInputStream
    extends InputStream
  {
    private final InputStream stream;
    private boolean closed = false;
    
    public ZipBundleEntryInputStream(InputStream stream)
    {
      this.stream = stream;
    }
    
    public int available()
      throws IOException
    {
      return stream.available();
    }
    
    /* Error */
    public void close()
      throws IOException
    {
      // Byte code:
      //   0: aload_0
      //   1: getfield 62	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:stream	Ljava/io/InputStream;
      //   4: invokevirtual 67	java/io/InputStream:close	()V
      //   7: goto +43 -> 50
      //   10: astore_1
      //   11: aload_0
      //   12: dup
      //   13: astore_2
      //   14: monitorenter
      //   15: aload_0
      //   16: getfield 61	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:closed	Z
      //   19: ifeq +6 -> 25
      //   22: aload_2
      //   23: monitorexit
      //   24: return
      //   25: aload_0
      //   26: iconst_1
      //   27: putfield 61	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:closed	Z
      //   30: aload_2
      //   31: monitorexit
      //   32: goto +6 -> 38
      //   35: aload_2
      //   36: monitorexit
      //   37: athrow
      //   38: aload_0
      //   39: getfield 63	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:this$0	Lorg/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry;
      //   42: getfield 60	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry:bundleFile	Lorg/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile;
      //   45: invokevirtual 74	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile:decrementReference	()V
      //   48: aload_1
      //   49: athrow
      //   50: aload_0
      //   51: dup
      //   52: astore_2
      //   53: monitorenter
      //   54: aload_0
      //   55: getfield 61	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:closed	Z
      //   58: ifeq +6 -> 64
      //   61: aload_2
      //   62: monitorexit
      //   63: return
      //   64: aload_0
      //   65: iconst_1
      //   66: putfield 61	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:closed	Z
      //   69: aload_2
      //   70: monitorexit
      //   71: goto +6 -> 77
      //   74: aload_2
      //   75: monitorexit
      //   76: athrow
      //   77: aload_0
      //   78: getfield 63	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry$ZipBundleEntryInputStream:this$0	Lorg/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry;
      //   81: getfield 60	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleEntry:bundleFile	Lorg/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile;
      //   84: invokevirtual 74	org/eclipse/osgi/baseadaptor/bundlefile/ZipBundleFile:decrementReference	()V
      //   87: return
      // Line number table:
      //   Java source line #133	-> byte code offset #0
      //   Java source line #134	-> byte code offset #10
      //   Java source line #135	-> byte code offset #11
      //   Java source line #136	-> byte code offset #15
      //   Java source line #137	-> byte code offset #22
      //   Java source line #138	-> byte code offset #25
      //   Java source line #135	-> byte code offset #30
      //   Java source line #140	-> byte code offset #38
      //   Java source line #141	-> byte code offset #48
      //   Java source line #135	-> byte code offset #50
      //   Java source line #136	-> byte code offset #54
      //   Java source line #137	-> byte code offset #61
      //   Java source line #138	-> byte code offset #64
      //   Java source line #135	-> byte code offset #69
      //   Java source line #140	-> byte code offset #77
      //   Java source line #142	-> byte code offset #87
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	88	0	this	ZipBundleEntryInputStream
      //   10	39	1	localObject1	Object
      // Exception table:
      //   from	to	target	type
      //   0	10	10	finally
      //   15	24	35	finally
      //   25	32	35	finally
      //   35	37	35	finally
      //   54	63	74	finally
      //   64	71	74	finally
      //   74	76	74	finally
    }
    
    public void mark(int var0)
    {
      stream.mark(var0);
    }
    
    public boolean markSupported()
    {
      return stream.markSupported();
    }
    
    public int read()
      throws IOException
    {
      return stream.read();
    }
    
    public int read(byte[] var0, int var1, int var2)
      throws IOException
    {
      return stream.read(var0, var1, var2);
    }
    
    public int read(byte[] var0)
      throws IOException
    {
      return stream.read(var0);
    }
    
    public void reset()
      throws IOException
    {
      stream.reset();
    }
    
    public long skip(long var0)
      throws IOException
    {
      return stream.skip(var0);
    }
  }
}

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

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.eclipse.osgi.baseadaptor.BaseAdaptor;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.adaptor.EventPublisher;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.util.SecureAction;
import org.eclipse.osgi.internal.baseadaptor.AdaptorMsg;
import org.eclipse.osgi.internal.baseadaptor.AdaptorUtil;
import org.eclipse.osgi.util.NLS;

public class ZipBundleFile
  extends BundleFile
{
  private final MRUBundleFileList mruList;
  protected BaseData bundledata;
  protected volatile ZipFile zipFile;
  protected volatile boolean closed = true;
  private int referenceCount = 0;
  
  public ZipBundleFile(File basefile, BaseData bundledata)
    throws IOException
  {
    this(basefile, bundledata, null);
  }
  
  public ZipBundleFile(File basefile, BaseData bundledata, MRUBundleFileList mruList)
    throws IOException
  {
    super(basefile);
    if (!BundleFile.secureAction.exists(basefile)) {
      throw new IOException(NLS.bind(AdaptorMsg.ADAPTER_FILEEXIST_EXCEPTION, basefile));
    }
    this.bundledata = bundledata;
    closed = true;
    this.mruList = mruList;
  }
  
  protected boolean checkedOpen()
  {
    try
    {
      return getZipFile() != null;
    }
    catch (IOException e)
    {
      if (bundledata != null) {
        bundledata.getAdaptor().getEventPublisher().publishFrameworkEvent(2, bundledata.getBundle(), e);
      }
    }
    return false;
  }
  
  protected ZipFile basicOpen()
    throws IOException
  {
    return BundleFile.secureAction.getZipFile(basefile);
  }
  
  protected synchronized ZipFile getZipFile()
    throws IOException
  {
    if (closed)
    {
      mruListAdd();
      zipFile = basicOpen();
      closed = false;
    }
    else
    {
      mruListUse();
    }
    return zipFile;
  }
  
  protected ZipEntry getZipEntry(String path)
  {
    if ((path.length() > 0) && (path.charAt(0) == '/')) {
      path = path.substring(1);
    }
    ZipEntry entry = zipFile.getEntry(path);
    if ((entry != null) && (entry.getSize() == 0L) && (!entry.isDirectory()))
    {
      ZipEntry dirEntry = zipFile.getEntry(path + '/');
      if (dirEntry != null) {
        entry = dirEntry;
      }
    }
    return entry;
  }
  
  protected synchronized File extractDirectory(String dirName)
  {
    if (!checkedOpen()) {
      return null;
    }
    Enumeration<? extends ZipEntry> entries = zipFile.entries();
    while (entries.hasMoreElements())
    {
      String entryPath = ((ZipEntry)entries.nextElement()).getName();
      if ((entryPath.startsWith(dirName)) && (!entryPath.endsWith("/"))) {
        getFile(entryPath, false);
      }
    }
    return getExtractFile(dirName);
  }
  
  protected File getExtractFile(String entryName)
  {
    if (bundledata == null) {
      return null;
    }
    String path = ".cp";
    String name = entryName.replace('/', File.separatorChar);
    if ((name.length() > 1) && (name.charAt(0) == File.separatorChar)) {
      path = path.concat(name);
    } else {
      path = path + File.separator + name;
    }
    return bundledata.getExtractFile(path);
  }
  
  public synchronized File getFile(String entry, boolean nativeCode)
  {
    if (!checkedOpen()) {
      return null;
    }
    ZipEntry zipEntry = getZipEntry(entry);
    if (zipEntry == null) {
      return null;
    }
    try
    {
      File nested = getExtractFile(zipEntry.getName());
      if (nested != null)
      {
        if (nested.exists())
        {
          if (Debug.DEBUG_GENERAL) {
            Debug.println("File already present: " + nested.getPath());
          }
          if (nested.isDirectory()) {
            extractDirectory(zipEntry.getName());
          }
        }
        else if (zipEntry.getName().endsWith("/"))
        {
          if (!nested.mkdirs())
          {
            if (Debug.DEBUG_GENERAL) {
              Debug.println("Unable to create directory: " + nested.getPath());
            }
            throw new IOException(NLS.bind(AdaptorMsg.ADAPTOR_DIRECTORY_CREATE_EXCEPTION, nested.getAbsolutePath()));
          }
          extractDirectory(zipEntry.getName());
        }
        else
        {
          InputStream in = zipFile.getInputStream(zipEntry);
          if (in == null) {
            return null;
          }
          if (Debug.DEBUG_GENERAL) {
            Debug.println("Creating file: " + nested.getPath());
          }
          File dir = new File(nested.getParent());
          if ((!dir.exists()) && (!dir.mkdirs()))
          {
            if (Debug.DEBUG_GENERAL) {
              Debug.println("Unable to create directory: " + dir.getPath());
            }
            throw new IOException(NLS.bind(AdaptorMsg.ADAPTOR_DIRECTORY_CREATE_EXCEPTION, dir.getAbsolutePath()));
          }
          AdaptorUtil.readFile(in, nested);
          if (nativeCode) {
            setPermissions(nested);
          }
        }
        return nested;
      }
    }
    catch (IOException e)
    {
      if (Debug.DEBUG_GENERAL) {
        Debug.printStackTrace(e);
      }
    }
    return null;
  }
  
  public synchronized boolean containsDir(String dir)
  {
    if (!checkedOpen()) {
      return false;
    }
    if (dir == null) {
      return false;
    }
    if (dir.length() == 0) {
      return true;
    }
    if (dir.charAt(0) == '/')
    {
      if (dir.length() == 1) {
        return true;
      }
      dir = dir.substring(1);
    }
    if ((dir.length() > 0) && (dir.charAt(dir.length() - 1) != '/')) {
      dir = dir + '/';
    }
    Enumeration<? extends ZipEntry> entries = zipFile.entries();
    while (entries.hasMoreElements())
    {
      ZipEntry zipEntry = (ZipEntry)entries.nextElement();
      String entryPath = zipEntry.getName();
      if (entryPath.startsWith(dir)) {
        return true;
      }
    }
    return false;
  }
  
  public synchronized BundleEntry getEntry(String path)
  {
    if (!checkedOpen()) {
      return null;
    }
    ZipEntry zipEntry = getZipEntry(path);
    if (zipEntry == null)
    {
      if ((path.length() == 0) || (path.charAt(path.length() - 1) == '/')) {
        if (containsDir(path)) {
          return new DirZipBundleEntry(this, path);
        }
      }
      return null;
    }
    return new ZipBundleEntry(zipEntry, this);
  }
  
  public synchronized Enumeration<String> getEntryPaths(String path)
  {
    if (!checkedOpen()) {
      return null;
    }
    if (path == null) {
      throw new NullPointerException();
    }
    if ((path.length() > 0) && (path.charAt(0) == '/')) {
      path = path.substring(1);
    }
    if ((path.length() > 0) && (path.charAt(path.length() - 1) != '/')) {
      path = path + "/";
    }
    List<String> vEntries = new ArrayList();
    Enumeration<? extends ZipEntry> entries = zipFile.entries();
    while (entries.hasMoreElements())
    {
      ZipEntry zipEntry = (ZipEntry)entries.nextElement();
      String entryPath = zipEntry.getName();
      if ((entryPath.startsWith(path)) && 
        (path.length() < entryPath.length())) {
        if (entryPath.lastIndexOf('/') < path.length())
        {
          vEntries.add(entryPath);
        }
        else
        {
          entryPath = entryPath.substring(path.length());
          int slash = entryPath.indexOf('/');
          entryPath = path + entryPath.substring(0, slash + 1);
          if (!vEntries.contains(entryPath)) {
            vEntries.add(entryPath);
          }
        }
      }
    }
    return vEntries.size() == 0 ? null : Collections.enumeration(vEntries);
  }
  
  public synchronized void close()
    throws IOException
  {
    if (!closed)
    {
      if ((referenceCount > 0) && (isMruListClosing()))
      {
        try
        {
          wait(1000L);
        }
        catch (InterruptedException localInterruptedException) {}
        if ((referenceCount != 0) || (closed)) {
          return;
        }
      }
      closed = true;
      zipFile.close();
      mruListRemove();
    }
  }
  
  private boolean isMruListClosing()
  {
    return (mruList != null) && (mruList.isClosing(this));
  }
  
  boolean isMruEnabled()
  {
    return (mruList != null) && (mruList.isEnabled());
  }
  
  private void mruListRemove()
  {
    if (mruList != null) {
      mruList.remove(this);
    }
  }
  
  private void mruListUse()
  {
    if (mruList != null) {
      mruList.use(this);
    }
  }
  
  private void mruListAdd()
  {
    if (mruList != null) {
      mruList.add(this);
    }
  }
  
  public void open() {}
  
  synchronized void incrementReference()
  {
    referenceCount += 1;
  }
  
  synchronized void decrementReference()
  {
    referenceCount = Math.max(0, referenceCount - 1);
    if (referenceCount == 0) {
      notify();
    }
  }
}

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

import java.io.IOException;
import java.net.URLConnection;
import java.util.Properties;
import org.eclipse.osgi.baseadaptor.BaseAdaptor;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;

public abstract interface AdaptorHook
{
  public abstract void initialize(BaseAdaptor paramBaseAdaptor);
  
  public abstract void frameworkStart(BundleContext paramBundleContext)
    throws BundleException;
  
  public abstract void frameworkStop(BundleContext paramBundleContext)
    throws BundleException;
  
  public abstract void frameworkStopping(BundleContext paramBundleContext);
  
  public abstract void addProperties(Properties paramProperties);
  
  public abstract URLConnection mapLocationToURLConnection(String paramString)
    throws IOException;
  
  public abstract void handleRuntimeError(Throwable paramThrowable);
  
  public abstract FrameworkLog createFrameworkLog();
}

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

import java.io.IOException;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;

public abstract interface BundleFileFactoryHook
{
  public abstract BundleFile createBundleFile(Object paramObject, BaseData paramBaseData, boolean paramBoolean)
    throws IOException;
}

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

import java.io.IOException;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;

public abstract interface BundleFileWrapperFactoryHook
{
  public abstract BundleFile wrapBundleFile(BundleFile paramBundleFile, Object paramObject, BaseData paramBaseData, boolean paramBoolean)
    throws IOException;
}

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

import java.security.ProtectionDomain;
import java.util.ArrayList;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.loader.BaseClassLoader;
import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
import org.eclipse.osgi.framework.adaptor.BundleProtectionDomain;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate;

public abstract interface ClassLoadingHook
{
  public abstract byte[] processClass(String paramString, byte[] paramArrayOfByte, ClasspathEntry paramClasspathEntry, BundleEntry paramBundleEntry, ClasspathManager paramClasspathManager);
  
  public abstract boolean addClassPathEntry(ArrayList<ClasspathEntry> paramArrayList, String paramString, ClasspathManager paramClasspathManager, BaseData paramBaseData, ProtectionDomain paramProtectionDomain);
  
  public abstract String findLibrary(BaseData paramBaseData, String paramString);
  
  public abstract ClassLoader getBundleClassLoaderParent();
  
  public abstract BaseClassLoader createClassLoader(ClassLoader paramClassLoader, ClassLoaderDelegate paramClassLoaderDelegate, BundleProtectionDomain paramBundleProtectionDomain, BaseData paramBaseData, String[] paramArrayOfString);
  
  public abstract void initializedClassLoader(BaseClassLoader paramBaseClassLoader, BaseData paramBaseData);
}

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

import java.net.URL;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;

public abstract interface ClassLoadingStatsHook
{
  public abstract void preFindLocalClass(String paramString, ClasspathManager paramClasspathManager)
    throws ClassNotFoundException;
  
  public abstract void postFindLocalClass(String paramString, Class<?> paramClass, ClasspathManager paramClasspathManager)
    throws ClassNotFoundException;
  
  public abstract void preFindLocalResource(String paramString, ClasspathManager paramClasspathManager);
  
  public abstract void postFindLocalResource(String paramString, URL paramURL, ClasspathManager paramClasspathManager);
  
  public abstract void recordClassDefine(String paramString, Class<?> paramClass, byte[] paramArrayOfByte, ClasspathEntry paramClasspathEntry, BundleEntry paramBundleEntry, ClasspathManager paramClasspathManager);
}

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

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Dictionary;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.framework.util.KeyedElement;
import org.osgi.framework.BundleException;

public abstract interface StorageHook
  extends KeyedElement
{
  public abstract int getStorageVersion();
  
  public abstract StorageHook create(BaseData paramBaseData)
    throws BundleException;
  
  public abstract void initialize(Dictionary<String, String> paramDictionary)
    throws BundleException;
  
  public abstract StorageHook load(BaseData paramBaseData, DataInputStream paramDataInputStream)
    throws IOException;
  
  public abstract void save(DataOutputStream paramDataOutputStream)
    throws IOException;
  
  public abstract void copy(StorageHook paramStorageHook);
  
  public abstract void validate()
    throws IllegalArgumentException;
  
  public abstract Dictionary<String, String> getManifest(boolean paramBoolean)
    throws BundleException;
  
  public abstract boolean forgetStatusChange(int paramInt);
  
  public abstract boolean forgetStartLevelChange(int paramInt);
}

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

import java.net.URL;
import java.security.ProtectionDomain;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.framework.adaptor.BundleClassLoader;

public abstract interface BaseClassLoader
  extends BundleClassLoader
{
  public abstract ProtectionDomain getDomain();
  
  public abstract ClasspathEntry createClassPathEntry(BundleFile paramBundleFile, ProtectionDomain paramProtectionDomain);
  
  public abstract Class<?> defineClass(String paramString, byte[] paramArrayOfByte, ClasspathEntry paramClasspathEntry, BundleEntry paramBundleEntry);
  
  public abstract Class<?> publicFindLoaded(String paramString);
  
  public abstract Object publicGetPackage(String paramString);
  
  public abstract Object publicDefinePackage(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6, String paramString7, URL paramURL);
  
  public abstract ClasspathManager getClasspathManager();
}

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

import java.security.ProtectionDomain;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.framework.util.KeyedElement;
import org.eclipse.osgi.framework.util.KeyedHashSet;

public class ClasspathEntry
{
  private final BundleFile bundlefile;
  private final ProtectionDomain domain;
  private KeyedHashSet userObjects = null;
  private volatile BaseData data;
  
  public ClasspathEntry(BundleFile bundlefile, ProtectionDomain domain)
  {
    this.bundlefile = bundlefile;
    this.domain = domain;
  }
  
  public BundleFile getBundleFile()
  {
    return bundlefile;
  }
  
  public BaseData getBaseData()
  {
    return data;
  }
  
  void setBaseData(BaseData data)
  {
    this.data = data;
  }
  
  public ProtectionDomain getDomain()
  {
    return domain;
  }
  
  /* Error */
  public Object getUserObject(Object key)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 52	org/eclipse/osgi/baseadaptor/loader/ClasspathEntry:userObjects	Lorg/eclipse/osgi/framework/util/KeyedHashSet;
    //   4: ifnonnull +5 -> 9
    //   7: aconst_null
    //   8: areturn
    //   9: aload_0
    //   10: getfield 52	org/eclipse/osgi/baseadaptor/loader/ClasspathEntry:userObjects	Lorg/eclipse/osgi/framework/util/KeyedHashSet;
    //   13: dup
    //   14: astore_2
    //   15: monitorenter
    //   16: aload_0
    //   17: getfield 52	org/eclipse/osgi/baseadaptor/loader/ClasspathEntry:userObjects	Lorg/eclipse/osgi/framework/util/KeyedHashSet;
    //   20: aload_1
    //   21: invokevirtual 56	org/eclipse/osgi/framework/util/KeyedHashSet:getByKey	(Ljava/lang/Object;)Lorg/eclipse/osgi/framework/util/KeyedElement;
    //   24: aload_2
    //   25: monitorexit
    //   26: areturn
    //   27: aload_2
    //   28: monitorexit
    //   29: athrow
    // Line number table:
    //   Java source line #78	-> byte code offset #0
    //   Java source line #79	-> byte code offset #7
    //   Java source line #80	-> byte code offset #9
    //   Java source line #81	-> byte code offset #16
    //   Java source line #80	-> byte code offset #27
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	30	0	this	ClasspathEntry
    //   0	30	1	key	Object
    //   14	14	2	Ljava/lang/Object;	Object
    // Exception table:
    //   from	to	target	type
    //   16	26	27	finally
    //   27	29	27	finally
  }
  
  public synchronized void addUserObject(KeyedElement userObject)
  {
    if (userObjects == null) {
      userObjects = new KeyedHashSet(5, false);
    }
    synchronized (userObjects)
    {
      userObjects.add(userObject);
    }
  }
}

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

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.eclipse.osgi.baseadaptor.BaseAdaptor;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.HookRegistry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook;
import org.eclipse.osgi.baseadaptor.hooks.ClassLoadingStatsHook;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.BundleProtectionDomain;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate;
import org.eclipse.osgi.framework.adaptor.EventPublisher;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.internal.baseadaptor.AdaptorMsg;
import org.eclipse.osgi.internal.baseadaptor.ArrayMap;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.BundleException;

public class ClasspathManager
{
  private static final FragmentClasspath[] emptyFragments = new FragmentClasspath[0];
  private static final String PROP_CLASSLOADER_LOCK = "osgi.classloader.lock";
  private static final String VALUE_CLASSNAME_LOCK = "classname";
  private static final boolean LOCK_CLASSNAME = "class
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

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