org.eclipse.osgi_3.7.2.v20120110-1415

name".equals(FrameworkProperties.getProperty("osgi.classloader.lock"));
  private static final Class<?>[] NULL_CLASS_RESULT = new Class[2];
  private final BaseData data;
  private final String[] classpath;
  private final BaseClassLoader classloader;
  private final boolean isParallelClassLoader;
  private final Map<String, Thread> classNameLocks = new HashMap(5);
  private ClasspathEntry[] entries;
  private FragmentClasspath[] fragments = emptyFragments;
  private ArrayMap<String, String> loadedLibraries = null;
  private ThreadLocal<Collection<String>> currentlyDefining = new ThreadLocal();
  
  public ClasspathManager(BaseData data, String[] classpath, BaseClassLoader classloader)
  {
    this.data = data;
    this.classpath = classpath;
    this.classloader = classloader;
    isParallelClassLoader = ((classloader instanceof ParallelClassLoader) ? ((ParallelClassLoader)classloader).isParallelCapable() : false);
  }
  
  public void initialize()
  {
    entries = buildClasspath(classpath, this, data, classloader == null ? null : classloader.getDomain());
    ClassLoadingHook[] hooks = data.getAdaptor().getHookRegistry().getClassLoadingHooks();
    if (classloader != null) {
      for (int i = 0; i < hooks.length; i++) {
        hooks[i].initializedClassLoader(classloader, data);
      }
    }
  }
  
  public void close()
  {
    if (entries != null) {
      for (int i = 0; i < entries.length; i++) {
        if (entries[i] != null) {
          try
          {
            entries[i].getBundleFile().close();
          }
          catch (IOException e)
          {
            data.getAdaptor().getEventPublisher().publishFrameworkEvent(2, data.getBundle(), e);
          }
        }
      }
    }
    for (int i = 0; i < fragments.length; i++) {
      fragments[i].close();
    }
  }
  
  public void attachFragment(BundleData sourcedata, ProtectionDomain sourcedomain, String[] sourceclasspath)
  {
    try
    {
      sourcedata.open();
    }
    catch (IOException e)
    {
      ((BaseData)sourcedata).getAdaptor().getEventPublisher().publishFrameworkEvent(2, ((BaseData)sourcedata).getBundle(), e);
    }
    ClasspathEntry[] fragEntries = buildClasspath(sourceclasspath, this, (BaseData)sourcedata, sourcedomain);
    FragmentClasspath fragClasspath = new FragmentClasspath((BaseData)sourcedata, fragEntries, sourcedomain);
    insertFragment(fragClasspath);
  }
  
  private synchronized void insertFragment(FragmentClasspath fragClasspath)
  {
    FragmentClasspath[] newFragments = new FragmentClasspath[fragments.length + 1];
    
    long fragID = fragClasspath.getBundleData().getBundleID();
    int insert = 0;
    for (int i = 0; i < fragments.length; i++)
    {
      long otherID = fragments[i].getBundleData().getBundleID();
      if ((insert == 0) && (fragID < otherID))
      {
        newFragments[i] = fragClasspath;
        insert = 1;
      }
      newFragments[(i + insert)] = fragments[i];
    }
    if (insert == 0) {
      newFragments[fragments.length] = fragClasspath;
    }
    fragments = newFragments;
  }
  
  private static ClasspathEntry[] buildClasspath(String[] cp, ClasspathManager hostloader, BaseData sourcedata, ProtectionDomain sourcedomain)
  {
    ArrayList<ClasspathEntry> result = new ArrayList(cp.length);
    for (int i = 0; i < cp.length; i++) {
      findClassPathEntry(result, cp[i], hostloader, sourcedata, sourcedomain);
    }
    return (ClasspathEntry[])result.toArray(new ClasspathEntry[result.size()]);
  }
  
  public static void findClassPathEntry(ArrayList<ClasspathEntry> result, String cp, ClasspathManager hostloader, BaseData sourcedata, ProtectionDomain sourcedomain)
  {
    ClassLoadingHook[] loaderHooks = sourcedata.getAdaptor().getHookRegistry().getClassLoadingHooks();
    boolean hookAdded = false;
    for (int i = 0; i < loaderHooks.length; i++) {
      hookAdded |= loaderHooks[i].addClassPathEntry(result, cp, hostloader, sourcedata, sourcedomain);
    }
    if ((!addClassPathEntry(result, cp, hostloader, sourcedata, sourcedomain)) && (!hookAdded))
    {
      BundleException be = new BundleException(NLS.bind(AdaptorMsg.BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION, cp, sourcedata.getLocation()), 3);
      sourcedata.getAdaptor().getEventPublisher().publishFrameworkEvent(32, sourcedata.getBundle(), be);
    }
  }
  
  public static boolean addClassPathEntry(ArrayList<ClasspathEntry> result, String cp, ClasspathManager hostloader, BaseData sourcedata, ProtectionDomain sourcedomain)
  {
    if (cp.equals("."))
    {
      result.add(hostloader.createClassPathEntry(sourcedata.getBundleFile(), sourcedomain, sourcedata));
      return true;
    }
    ClasspathEntry element = hostloader.getClasspath(cp, sourcedata, sourcedomain);
    if (element != null)
    {
      result.add(element);
      return true;
    }
    if (data == sourcedata) {
      for (int i = 0; i < fragments.length; i++)
      {
        FragmentClasspath fragCP = fragments[i];
        element = hostloader.getClasspath(cp, fragCP.getBundleData(), fragCP.getDomain());
        if (element != null)
        {
          result.add(element);
          return true;
        }
      }
    }
    return false;
  }
  
  public ClasspathEntry getClasspath(String cp, BaseData sourcedata, ProtectionDomain sourcedomain)
  {
    BundleFile bundlefile = null;
    
    BundleEntry cpEntry = sourcedata.getBundleFile().getEntry(cp);
    if ((cpEntry != null) && (cpEntry.getName().endsWith("/")))
    {
      bundlefile = createBundleFile(cp, sourcedata);
    }
    else
    {
      File file;
      if ((file = sourcedata.getBundleFile().getFile(cp, false)) != null) {
        bundlefile = createBundleFile(file, sourcedata);
      }
    }
    if (bundlefile != null) {
      return createClassPathEntry(bundlefile, sourcedomain, sourcedata);
    }
    return null;
  }
  
  public ClasspathEntry getExternalClassPath(String cp, BaseData sourcedata, ProtectionDomain sourcedomain)
  {
    File file = new File(cp);
    if (!file.isAbsolute()) {
      return null;
    }
    BundleFile bundlefile = createBundleFile(file, sourcedata);
    if (bundlefile != null) {
      return createClassPathEntry(bundlefile, sourcedomain, sourcedata);
    }
    return null;
  }
  
  private static BundleFile createBundleFile(Object content, BaseData sourcedata)
  {
    if ((content == null) || (((content instanceof File)) && (!((File)content).exists()))) {
      return null;
    }
    try
    {
      return sourcedata.getAdaptor().createBundleFile(content, sourcedata);
    }
    catch (IOException e)
    {
      sourcedata.getAdaptor().getEventPublisher().publishFrameworkEvent(2, sourcedata.getBundle(), e);
    }
    return null;
  }
  
  private ClasspathEntry createClassPathEntry(BundleFile bundlefile, ProtectionDomain cpDomain, BaseData cpData)
  {
    ClasspathEntry entry;
    ClasspathEntry entry;
    if (classloader != null) {
      entry = classloader.createClassPathEntry(bundlefile, cpDomain);
    } else {
      entry = new ClasspathEntry(bundlefile, null);
    }
    entry.setBaseData(cpData);
    Object domain = entry.getDomain();
    if ((domain instanceof BundleProtectionDomain)) {
      ((BundleProtectionDomain)domain).setBundle(cpData.getBundle());
    }
    return entry;
  }
  
  public URL findLocalResource(String resource)
  {
    ClassLoadingStatsHook[] hooks = data.getAdaptor().getHookRegistry().getClassLoadingStatsHooks();
    for (int i = 0; i < hooks.length; i++) {
      hooks[i].preFindLocalResource(resource, this);
    }
    URL result = null;
    try
    {
      result = findLocalResourceImpl(resource, -1);
      int i;
      return result;
    }
    finally
    {
      for (int i = 0; i < hooks.length; i++) {
        hooks[i].postFindLocalResource(resource, result, this);
      }
    }
  }
  
  private URL findLocalResourceImpl(String resource, int classPathIndex)
  {
    URL result = null;
    int curIndex = 0;
    for (int i = 0; i < entries.length; i++)
    {
      if (entries[i] != null)
      {
        result = findResourceImpl(resource, entries[i].getBundleFile(), curIndex);
        if ((result != null) && ((classPathIndex == -1) || (classPathIndex == curIndex))) {
          return result;
        }
      }
      curIndex++;
    }
    for (int i = 0; i < fragments.length; i++)
    {
      ClasspathEntry[] fragEntries = fragments[i].getEntries();
      for (int j = 0; j < fragEntries.length; j++)
      {
        result = findResourceImpl(resource, fragEntries[j].getBundleFile(), curIndex);
        if ((result != null) && ((classPathIndex == -1) || (classPathIndex == curIndex))) {
          return result;
        }
        curIndex++;
      }
    }
    return null;
  }
  
  public Enumeration<URL> findLocalResources(String resource)
  {
    List<URL> resources = new ArrayList(6);
    int classPathIndex = 0;
    for (int i = 0; i < entries.length; i++)
    {
      if (entries[i] != null)
      {
        URL url = findResourceImpl(resource, entries[i].getBundleFile(), classPathIndex);
        if (url != null) {
          resources.add(url);
        }
      }
      classPathIndex++;
    }
    for (int i = 0; i < fragments.length; i++)
    {
      ClasspathEntry[] fragEntries = fragments[i].getEntries();
      for (int j = 0; j < fragEntries.length; j++)
      {
        URL url = findResourceImpl(resource, fragEntries[j].getBundleFile(), classPathIndex);
        if (url != null) {
          resources.add(url);
        }
        classPathIndex++;
      }
    }
    if (resources.size() > 0) {
      return Collections.enumeration(resources);
    }
    return null;
  }
  
  private URL findResourceImpl(String name, BundleFile bundlefile, int index)
  {
    return bundlefile.getResourceURL(name, data, index);
  }
  
  public BundleEntry findLocalEntry(String path)
  {
    return findLocalEntry(path, -1);
  }
  
  public BundleEntry findLocalEntry(String path, int classPathIndex)
  {
    BundleEntry result = null;
    int curIndex = 0;
    for (int i = 0; i < entries.length; i++)
    {
      if (entries[i] != null)
      {
        result = findEntryImpl(path, entries[i].getBundleFile());
        if ((result != null) && ((classPathIndex == -1) || (classPathIndex == curIndex))) {
          return result;
        }
      }
      curIndex++;
    }
    for (int i = 0; i < fragments.length; i++)
    {
      ClasspathEntry[] fragEntries = fragments[i].getEntries();
      for (int j = 0; j < fragEntries.length; j++)
      {
        result = findEntryImpl(path, fragEntries[j].getBundleFile());
        if ((result != null) && ((classPathIndex == -1) || (classPathIndex == curIndex))) {
          return result;
        }
        curIndex++;
      }
    }
    return null;
  }
  
  public Enumeration<BundleEntry> findLocalEntries(String path)
  {
    List<BundleEntry> objects = new ArrayList(6);
    for (int i = 0; i < entries.length; i++) {
      if (entries[i] != null)
      {
        BundleEntry result = findEntryImpl(path, entries[i].getBundleFile());
        if (result != null) {
          objects.add(result);
        }
      }
    }
    for (int i = 0; i < fragments.length; i++)
    {
      ClasspathEntry[] fragEntries = fragments[i].getEntries();
      for (int j = 0; j < fragEntries.length; j++)
      {
        BundleEntry result = findEntryImpl(path, fragEntries[j].getBundleFile());
        if (result != null) {
          objects.add(result);
        }
      }
    }
    if (objects.size() > 0) {
      return Collections.enumeration(objects);
    }
    return null;
  }
  
  private BundleEntry findEntryImpl(String path, BundleFile bundleFile)
  {
    return bundleFile.getEntry(path);
  }
  
  public Class<?> findLocalClass(String classname)
    throws ClassNotFoundException
  {
    Class<?> result = null;
    ClassLoadingStatsHook[] hooks = data.getAdaptor().getHookRegistry().getClassLoadingStatsHooks();
    try
    {
      for (int i = 0; i < hooks.length; i++) {
        hooks[i].preFindLocalClass(classname, this);
      }
      result = findLoadedClass(classname);
      Class<?> localClass1;
      if (result != null)
      {
        int i;
        return result;
      }
      result = findLocalClassImpl(classname, hooks);
      int i;
      return result;
    }
    finally
    {
      for (int i = 0; i < hooks.length; i++) {
        hooks[i].postFindLocalClass(classname, result, this);
      }
    }
  }
  
  /* Error */
  private Class<?> findLoadedClass(String classname)
  {
    // Byte code:
    //   0: getstatic 538	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:LOCK_CLASSNAME	Z
    //   3: ifne +10 -> 13
    //   6: aload_0
    //   7: getfield 539	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:isParallelClassLoader	Z
    //   10: ifeq +45 -> 55
    //   13: aload_0
    //   14: aload_1
    //   15: invokespecial 606	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:lockClassName	(Ljava/lang/String;)Z
    //   18: istore_2
    //   19: aload_0
    //   20: getfield 545	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:classloader	Lorg/eclipse/osgi/baseadaptor/loader/BaseClassLoader;
    //   23: aload_1
    //   24: invokeinterface 659 2 0
    //   29: astore 4
    //   31: iload_2
    //   32: ifeq +8 -> 40
    //   35: aload_0
    //   36: aload_1
    //   37: invokespecial 605	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:unlockClassName	(Ljava/lang/String;)V
    //   40: aload 4
    //   42: areturn
    //   43: astore_3
    //   44: iload_2
    //   45: ifeq +8 -> 53
    //   48: aload_0
    //   49: aload_1
    //   50: invokespecial 605	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:unlockClassName	(Ljava/lang/String;)V
    //   53: aload_3
    //   54: athrow
    //   55: aload_0
    //   56: getfield 545	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:classloader	Lorg/eclipse/osgi/baseadaptor/loader/BaseClassLoader;
    //   59: dup
    //   60: astore_2
    //   61: monitorenter
    //   62: aload_0
    //   63: getfield 545	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:classloader	Lorg/eclipse/osgi/baseadaptor/loader/BaseClassLoader;
    //   66: aload_1
    //   67: invokeinterface 659 2 0
    //   72: aload_2
    //   73: monitorexit
    //   74: areturn
    //   75: aload_2
    //   76: monitorexit
    //   77: athrow
    // Line number table:
    //   Java source line #468	-> byte code offset #0
    //   Java source line #469	-> byte code offset #13
    //   Java source line #471	-> byte code offset #19
    //   Java source line #473	-> byte code offset #31
    //   Java source line #474	-> byte code offset #35
    //   Java source line #471	-> byte code offset #40
    //   Java source line #472	-> byte code offset #43
    //   Java source line #473	-> byte code offset #44
    //   Java source line #474	-> byte code offset #48
    //   Java source line #475	-> byte code offset #53
    //   Java source line #477	-> byte code offset #55
    //   Java source line #478	-> byte code offset #62
    //   Java source line #477	-> byte code offset #75
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	78	0	this	ClasspathManager
    //   0	78	1	classname	String
    //   18	27	2	initialLock	boolean
    //   60	16	2	Ljava/lang/Object;	Object
    //   43	11	3	localObject1	Object
    //   29	12	4	localClass	Class
    // Exception table:
    //   from	to	target	type
    //   19	31	43	finally
    //   62	74	75	finally
    //   75	77	75	finally
  }
  
  private Class<?> findLocalClassImpl(String classname, ClassLoadingStatsHook[] hooks)
    throws ClassNotFoundException
  {
    Class<?> result = null;
    for (int i = 0; i < entries.length; i++) {
      if (entries[i] != null)
      {
        result = findClassImpl(classname, entries[i], hooks);
        if (result != null) {
          return result;
        }
      }
    }
    for (int i = 0; i < fragments.length; i++)
    {
      ClasspathEntry[] fragEntries = fragments[i].getEntries();
      for (int j = 0; j < fragEntries.length; j++)
      {
        result = findClassImpl(classname, fragEntries[j], hooks);
        if (result != null) {
          return result;
        }
      }
    }
    throw new ClassNotFoundException(classname);
  }
  
  private boolean lockClassName(String classname)
  {
    synchronized (classNameLocks)
    {
      Object lockingThread = classNameLocks.get(classname);
      Thread current = Thread.currentThread();
      if (lockingThread == current) {
        return false;
      }
      for (;;)
      {
        if (lockingThread == null)
        {
          classNameLocks.put(classname, current);
          return true;
        }
        try
        {
          classNameLocks.wait();
          lockingThread = classNameLocks.get(classname);
        }
        catch (InterruptedException e)
        {
          current.interrupt();
          throw ((LinkageError)new LinkageError(classname).initCause(e));
        }
      }
    }
  }
  
  private void unlockClassName(String classname)
  {
    synchronized (classNameLocks)
    {
      classNameLocks.remove(classname);
      classNameLocks.notifyAll();
    }
  }
  
  private Class<?> findClassImpl(String name, ClasspathEntry classpathEntry, ClassLoadingStatsHook[] hooks)
  {
    if (Debug.DEBUG_LOADER) {
      Debug.println("BundleClassLoader[" + classpathEntry.getBundleFile() + "].findClassImpl(" + name + ")");
    }
    String filename = name.replace('.', '/').concat(".class");
    BundleEntry entry = classpathEntry.getBundleFile().getEntry(filename);
    if (entry == null) {
      return null;
    }
    try
    {
      classbytes = entry.getBytes();
    }
    catch (IOException localIOException)
    {
      byte[] classbytes;
      if (Debug.DEBUG_LOADER) {
        Debug.println("  IOException reading " + filename + " from " + classpathEntry.getBundleFile());
      }
      return null;
    }
    byte[] classbytes;
    if (Debug.DEBUG_LOADER)
    {
      Debug.println("  read " + classbytes.length + " bytes from " + classpathEntry.getBundleFile() + "/" + filename);
      Debug.println("  defining class " + name);
    }
    Collection<String> current = (Collection)currentlyDefining.get();
    if (current == null)
    {
      current = new ArrayList(5);
      currentlyDefining.set(current);
    }
    if (current.contains(name)) {
      return null;
    }
    try
    {
      current.add(name);
      return defineClass(name, classbytes, classpathEntry, entry, hooks);
    }
    catch (Error e)
    {
      if (Debug.DEBUG_LOADER) {
        Debug.println("  error defining class " + name);
      }
      throw e;
    }
    finally
    {
      current.remove(name);
    }
  }
  
  /* Error */
  private Class<?> defineClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClassLoadingStatsHook[] statsHooks)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 544	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   4: invokevirtual 590	org/eclipse/osgi/baseadaptor/BaseData:getAdaptor	()Lorg/eclipse/osgi/baseadaptor/BaseAdaptor;
    //   7: invokevirtual 583	org/eclipse/osgi/baseadaptor/BaseAdaptor:getHookRegistry	()Lorg/eclipse/osgi/baseadaptor/HookRegistry;
    //   10: invokevirtual 593	org/eclipse/osgi/baseadaptor/HookRegistry:getClassLoadingHooks	()[Lorg/eclipse/osgi/baseadaptor/hooks/ClassLoadingHook;
    //   13: astore 6
    //   15: aload_2
    //   16: astore 7
    //   18: getstatic 540	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:NULL_CLASS_RESULT	[Ljava/lang/Class;
    //   21: astore 8
    //   23: iconst_0
    //   24: istore 9
    //   26: goto +32 -> 58
    //   29: aload 6
    //   31: iload 9
    //   33: aaload
    //   34: aload_1
    //   35: aload_2
    //   36: aload_3
    //   37: aload 4
    //   39: aload_0
    //   40: invokeinterface 650 6 0
    //   45: astore 7
    //   47: aload 7
    //   49: ifnull +6 -> 55
    //   52: aload 7
    //   54: astore_2
    //   55: iinc 9 1
    //   58: iload 9
    //   60: aload 6
    //   62: arraylength
    //   63: if_icmplt -34 -> 29
    //   66: getstatic 538	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:LOCK_CLASSNAME	Z
    //   69: ifne +10 -> 79
    //   72: aload_0
    //   73: getfield 539	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:isParallelClassLoader	Z
    //   76: ifeq +52 -> 128
    //   79: aload_0
    //   80: aload_1
    //   81: invokespecial 606	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:lockClassName	(Ljava/lang/String;)Z
    //   84: istore 9
    //   86: aload_0
    //   87: aload_1
    //   88: aload_2
    //   89: aload_3
    //   90: aload 4
    //   92: invokespecial 618	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:defineClassHoldingLock	(Ljava/lang/String;[BLorg/eclipse/osgi/baseadaptor/loader/ClasspathEntry;Lorg/eclipse/osgi/baseadaptor/bundlefile/BundleEntry;)[Ljava/lang/Class;
    //   95: astore 8
    //   97: goto +18 -> 115
    //   100: astore 10
    //   102: iload 9
    //   104: ifeq +8 -> 112
    //   107: aload_0
    //   108: aload_1
    //   109: invokespecial 605	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:unlockClassName	(Ljava/lang/String;)V
    //   112: aload 10
    //   114: athrow
    //   115: iload 9
    //   117: ifeq +82 -> 199
    //   120: aload_0
    //   121: aload_1
    //   122: invokespecial 605	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:unlockClassName	(Ljava/lang/String;)V
    //   125: goto +74 -> 199
    //   128: aload_0
    //   129: getfield 545	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:classloader	Lorg/eclipse/osgi/baseadaptor/loader/BaseClassLoader;
    //   132: dup
    //   133: astore 9
    //   135: monitorenter
    //   136: aload_0
    //   137: aload_1
    //   138: aload_2
    //   139: aload_3
    //   140: aload 4
    //   142: invokespecial 618	org/eclipse/osgi/baseadaptor/loader/ClasspathManager:defineClassHoldingLock	(Ljava/lang/String;[BLorg/eclipse/osgi/baseadaptor/loader/ClasspathEntry;Lorg/eclipse/osgi/baseadaptor/bundlefile/BundleEntry;)[Ljava/lang/Class;
    //   145: astore 8
    //   147: aload 9
    //   149: monitorexit
    //   150: goto +49 -> 199
    //   153: aload 9
    //   155: monitorexit
    //   156: athrow
    //   157: astore 11
    //   159: iconst_0
    //   160: istore 12
    //   162: goto +26 -> 188
    //   165: aload 5
    //   167: iload 12
    //   169: aaload
    //   170: aload_1
    //   171: aload 8
    //   173: iconst_1
    //   174: aaload
    //   175: aload_2
    //   176: aload_3
    //   177: aload 4
    //   179: aload_0
    //   180: invokeinterface 656 7 0
    //   185: iinc 12 1
    //   188: iload 12
    //   190: aload 5
    //   192: arraylength
    //   193: if_icmplt -28 -> 165
    //   196: aload 11
    //   198: athrow
    //   199: iconst_0
    //   200: istore 12
    //   202: goto +26 -> 228
    //   205: aload 5
    //   207: iload 12
    //   209: aaload
    //   210: aload_1
    //   211: aload 8
    //   213: iconst_1
    //   214: aaload
    //   215: aload_2
    //   216: aload_3
    //   217: aload 4
    //   219: aload_0
    //   220: invokeinterface 656 7 0
    //   225: iinc 12 1
    //   228: iload 12
    //   230: aload 5
    //   232: arraylength
    //   233: if_icmplt -28 -> 205
    //   236: aload 8
    //   238: iconst_0
    //   239: aaload
    //   240: areturn
    // Line number table:
    //   Java source line #586	-> byte code offset #0
    //   Java source line #587	-> byte code offset #15
    //   Java source line #591	-> byte code offset #18
    //   Java source line #593	-> byte code offset #23
    //   Java source line #594	-> byte code offset #29
    //   Java source line #595	-> byte code offset #47
    //   Java source line #596	-> byte code offset #52
    //   Java source line #593	-> byte code offset #55
    //   Java source line #598	-> byte code offset #66
    //   Java source line #599	-> byte code offset #79
    //   Java source line #601	-> byte code offset #86
    //   Java source line #602	-> byte code offset #100
    //   Java source line #603	-> byte code offset #102
    //   Java source line #604	-> byte code offset #107
    //   Java source line #605	-> byte code offset #112
    //   Java source line #603	-> byte code offset #115
    //   Java source line #604	-> byte code offset #120
    //   Java source line #607	-> byte code offset #128
    //   Java source line #608	-> byte code offset #136
    //   Java source line #607	-> byte code offset #147
    //   Java source line #611	-> byte code offset #157
    //   Java source line #612	-> byte code offset #159
    //   Java source line #614	-> byte code offset #165
    //   Java source line #612	-> byte code offset #185
    //   Java source line #615	-> byte code offset #196
    //   Java source line #612	-> byte code offset #199
    //   Java source line #614	-> byte code offset #205
    //   Java source line #612	-> byte code offset #225
    //   Java source line #617	-> byte code offset #236
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	241	0	this	ClasspathManager
    //   0	241	1	name	String
    //   0	241	2	classbytes	byte[]
    //   0	241	3	classpathEntry	ClasspathEntry
    //   0	241	4	entry	BundleEntry
    //   0	241	5	statsHooks	ClassLoadingStatsHook[]
    //   13	48	6	hooks	ClassLoadingHook[]
    //   16	37	7	modifiedBytes	byte[]
    //   21	216	8	result	Class[]
    //   24	35	9	i	int
    //   84	32	9	initialLock	boolean
    //   100	13	10	localObject1	Object
    //   157	40	11	localObject2	Object
    //   160	29	12	i	int
    //   200	29	12	i	int
    // Exception table:
    //   from	to	target	type
    //   86	100	100	finally
    //   136	150	153	finally
    //   153	156	153	finally
    //   23	157	157	finally
  }
  
  private Class<?>[] defineClassHoldingLock(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry)
  {
    Class[] result = new Class[2];
    
    result[0] = classloader.publicFindLoaded(name);
    if (result[0] == null) {
      result[0] = (result[1] = classloader.defineClass(name, classbytes, classpathEntry, entry));
    }
    return result;
  }
  
  public BaseData getBaseData()
  {
    return data;
  }
  
  public FragmentClasspath[] getFragmentClasspaths()
  {
    return fragments;
  }
  
  public ClasspathEntry[] getHostClasspathEntries()
  {
    return entries;
  }
  
  public BaseClassLoader getBaseClassLoader()
  {
    return classloader;
  }
  
  public String findLibrary(String libname)
  {
    synchronized (this)
    {
      if (loadedLibraries == null) {
        loadedLibraries = new ArrayMap(1);
      }
    }
    synchronized (loadedLibraries)
    {
      String libpath = (String)loadedLibraries.get(libname);
      if (libpath != null) {
        return libpath;
      }
      libpath = classloader.getDelegate().findLibrary(libname);
      if (libpath != null) {
        loadedLibraries.put(libname, libpath);
      }
      return libpath;
    }
  }
  
  public List<URL> findEntries(String path, String filePattern, int options)
  {
    BaseAdaptor adaptor = getBaseData().getAdaptor();
    List<BundleData> datas = new ArrayList();
    
    datas.add(getBaseData());
    
    FragmentClasspath[] currentFragments = getFragmentClasspaths();
    FragmentClasspath[] arrayOfFragmentClasspath1;
    int j = (arrayOfFragmentClasspath1 = currentFragments).length;
    for (int i = 0; i < j; i++)
    {
      FragmentClasspath fragmentClasspath = arrayOfFragmentClasspath1[i];
      datas.add(fragmentClasspath.getBundleData());
    }
    List<URL> result = Collections.EMPTY_LIST;
    
    Object eURLs = adaptor.findEntries(datas, path, filePattern, options);
    if (eURLs == null) {
      return result;
    }
    result = new ArrayList();
    while (((Enumeration)eURLs).hasMoreElements()) {
      result.add((URL)((Enumeration)eURLs).nextElement());
    }
    return Collections.unmodifiableList(result);
  }
  
  public Collection<String> listLocalResources(String path, String filePattern, int options)
  {
    List<BundleFile> bundleFiles = new ArrayList();
    
    ClasspathEntry[] cpEntries = getHostClasspathEntries();
    ClasspathEntry[] arrayOfClasspathEntry1;
    int j = (arrayOfClasspathEntry1 = cpEntries).length;
    for (int i = 0; i < j; i++)
    {
      ClasspathEntry cpEntry = arrayOfClasspathEntry1[i];
      bundleFiles.add(cpEntry.getBundleFile());
    }
    FragmentClasspath[] currentFragments = getFragmentClasspaths();
    FragmentClasspath[] arrayOfFragmentClasspath1;
    int k = (arrayOfFragmentClasspath1 = currentFragments).length;
    for (j = 0; j < k; j++)
    {
      FragmentClasspath fragmentClasspath = arrayOfFragmentClasspath1[j];
      ClasspathEntry[] fragEntries = fragmentClasspath.getEntries();
      ClasspathEntry[] arrayOfClasspathEntry2;
      int n = (arrayOfClasspathEntry2 = fragEntries).length;
      for (int m = 0; m < n; m++)
      {
        ClasspathEntry cpEntry = arrayOfClasspathEntry2[m];
        bundleFiles.add(cpEntry.getBundleFile());
      }
    }
    return getBaseData().getAdaptor().listEntryPaths(bundleFiles, path, filePattern, options);
  }
}

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

import java.io.IOException;
import java.security.ProtectionDomain;
import org.eclipse.osgi.baseadaptor.BaseAdaptor;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.framework.adaptor.EventPublisher;

public class FragmentClasspath
{
  private BaseData bundledata;
  private ClasspathEntry[] entries;
  private ProtectionDomain domain;
  
  public FragmentClasspath(BaseData bundledata, ClasspathEntry[] entries, ProtectionDomain domain)
  {
    this.bundledata = bundledata;
    this.entries = entries;
    this.domain = domain;
  }
  
  public BaseData getBundleData()
  {
    return bundledata;
  }
  
  public ProtectionDomain getDomain()
  {
    return domain;
  }
  
  public ClasspathEntry[] getEntries()
  {
    return entries;
  }
  
  public void close()
  {
    for (int i = 0; i < entries.length; i++) {
      try
      {
        entries[i].getBundleFile().close();
      }
      catch (IOException e)
      {
        bundledata.getAdaptor().getEventPublisher().publishFrameworkEvent(2, bundledata.getBundle(), e);
      }
    }
  }
}

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

public abstract interface ParallelClassLoader
  extends BaseClassLoader
{
  public abstract boolean isParallelCapable();
}

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

import org.osgi.framework.BundleListener;

public abstract interface BatchBundleListener
  extends BundleListener
{
  public abstract void batchBegin();
  
  public abstract void batchEnd();
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.event.BatchBundleListener
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import java.io.IOException;
import java.net.URL;
import java.security.ProtectionDomain;
import java.util.Collection;
import java.util.Enumeration;
import java.util.List;
import org.osgi.framework.BundleReference;

public abstract interface BundleClassLoader
  extends BundleReference
{
  public abstract void initialize();
  
  public abstract URL findLocalResource(String paramString);
  
  public abstract Enumeration<URL> findLocalResources(String paramString);
  
  public abstract Class<?> findLocalClass(String paramString)
    throws ClassNotFoundException;
  
  public abstract URL getResource(String paramString);
  
  public abstract Enumeration<URL> getResources(String paramString)
    throws IOException;
  
  public abstract Class<?> loadClass(String paramString)
    throws ClassNotFoundException;
  
  public abstract void close();
  
  public abstract void attachFragment(BundleData paramBundleData, ProtectionDomain paramProtectionDomain, String[] paramArrayOfString);
  
  public abstract ClassLoaderDelegate getDelegate();
  
  public abstract ClassLoader getParent();
  
  public abstract List<URL> findEntries(String paramString1, String paramString2, int paramInt);
  
  public abstract Collection<String> listResources(String paramString1, String paramString2, int paramInt);
  
  public abstract Collection<String> listLocalResources(String paramString1, String paramString2, int paramInt);
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.BundleClassLoader
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.Dictionary;
import java.util.Enumeration;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.BundleReference;
import org.osgi.framework.Version;

public abstract interface BundleData
  extends BundleReference
{
  public static final int TYPE_FRAGMENT = 1;
  public static final int TYPE_FRAMEWORK_EXTENSION = 2;
  public static final int TYPE_BOOTCLASSPATH_EXTENSION = 4;
  public static final int TYPE_SINGLETON = 8;
  public static final int TYPE_EXTCLASSPATH_EXTENSION = 16;
  public static final int TYPE_COMPOSITEBUNDLE = 32;
  public static final int TYPE_SURROGATEBUNDLE = 64;
  
  public abstract BundleClassLoader createClassLoader(ClassLoaderDelegate paramClassLoaderDelegate, BundleProtectionDomain paramBundleProtectionDomain, String[] paramArrayOfString);
  
  public abstract URL getEntry(String paramString);
  
  public abstract Enumeration<String> getEntryPaths(String paramString);
  
  public abstract String findLibrary(String paramString);
  
  public abstract void installNativeCode(String[] paramArrayOfString)
    throws BundleException;
  
  public abstract File getDataFile(String paramString);
  
  public abstract Dictionary<String, String> getManifest()
    throws BundleException;
  
  public abstract long getBundleID();
  
  public abstract String getLocation();
  
  public abstract long getLastModified();
  
  public abstract void close()
    throws IOException;
  
  public abstract void open()
    throws IOException;
  
  public abstract void setBundle(Bundle paramBundle);
  
  public abstract int getStartLevel();
  
  public abstract int getStatus();
  
  public abstract void setStartLevel(int paramInt);
  
  public abstract void setStatus(int paramInt);
  
  public abstract void save()
    throws IOException;
  
  public abstract String getSymbolicName();
  
  public abstract Version getVersion();
  
  public abstract int getType();
  
  public abstract String[] getClassPath()
    throws BundleException;
  
  public abstract String getActivator();
  
  public abstract String getExecutionEnvironment();
  
  public abstract String getDynamicImports();
  
  public abstract Enumeration<URL> findLocalResources(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.BundleData
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import org.osgi.framework.BundleException;

public abstract interface BundleOperation
{
  public abstract BundleData begin()
    throws BundleException;
  
  public abstract void commit(boolean paramBoolean)
    throws BundleException;
  
  public abstract void undo()
    throws BundleException;
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.BundleOperation
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.ProtectionDomain;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;

public class BundleProtectionDomain
  extends ProtectionDomain
  implements BundleReference
{
  private volatile Bundle bundle;
  
  /**
   * @deprecated
   */
  public BundleProtectionDomain(PermissionCollection permCollection)
  {
    this(permCollection, null, null);
  }
  
  public BundleProtectionDomain(PermissionCollection permCollection, CodeSource codeSource, Bundle bundle)
  {
    super(codeSource, permCollection);
    this.bundle = bundle;
  }
  
  public void setBundle(Bundle bundle)
  {
    if ((this.bundle != null) || (bundle == null)) {
      return;
    }
    this.bundle = bundle;
  }
  
  public Bundle getBundle()
  {
    return bundle;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.BundleProtectionDomain
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import org.osgi.framework.Bundle;

public abstract interface BundleWatcher
{
  public static final int START_INSTALLING = 1;
  public static final int END_INSTALLING = 2;
  public static final int START_ACTIVATION = 4;
  public static final int END_ACTIVATION = 8;
  public static final int START_DEACTIVATION = 16;
  public static final int END_DEACTIVATION = 32;
  public static final int START_UNINSTALLING = 64;
  public static final int END_UNINSTALLING = 128;
  
  public abstract void watchBundle(Bundle paramBundle, int paramInt);
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.BundleWatcher
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.Enumeration;
import org.osgi.framework.BundleException;

public abstract interface ClassLoaderDelegate
{
  public abstract Class<?> findClass(String paramString)
    throws ClassNotFoundException;
  
  public abstract URL findResource(String paramString);
  
  public abstract Enumeration<URL> findResources(String paramString)
    throws IOException;
  
  public abstract String findLibrary(String paramString);
  
  public abstract boolean isLazyTriggerSet();
  
  public abstract void setLazyTrigger()
    throws BundleException;
  
  public abstract Collection<String> listResources(String paramString1, String paramString2, int paramInt);
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.framework.adaptor;

import java.io.FileNotFoundException;
import java.net.URL;
import java.util.Enumeration;

public abstract interface ClassLoaderDelegateHook
{
  public abstract Class<?> preFindClass(String paramString, BundleClassLoader paramBundleClassLoader, BundleData paramBundleData)
    throws ClassNotFoundException;
  
  public abstract Class<?> postFindClass(String paramString, BundleClassLoader paramBundleClassLoader, BundleData paramBundleData)
    throws ClassNotFoundException;
  
  public abstract URL preFindResource(String paramString, BundleClassLoader paramBundleClassLoader, BundleData paramBundleData)
    throws FileNotFoundException;
  
  public abstract URL postFindResource(String paramString, BundleClassLoader paramBundleClassLoader, BundleData paramBundleData)
    throws FileNotFoundException;
  
  public abstract Enumeration<URL> preFindResources(String paramString, BundleClassLoader paramBundleClassLoader, BundleData paramBundleData)
    throws FileNotFoundException;
  
  public abstract Enumeration<URL> postFindResources(String paramString, BundleClassLoader paramBundleClassLoader, BundleData paramBundleData)
    throw
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