org.eclipse.osgi_3.8.2.v20130124-134944

yOnWriteIdentityMap.Entry<K, V>[] e)
    {
      entries = e;
    }
    
    CopyOnWriteIdentityMap.Entry<K, V>[] entries()
    {
      return entries;
    }
    
    synchronized void removeEntry(int i)
    {
      entries = CopyOnWriteIdentityMap.removeEntry(entries, i);
    }
    
    synchronized void clearEntries()
    {
      entries = CopyOnWriteIdentityMap.empty();
    }
    
    Set<Map.Entry<K, V>> entrySet()
    {
      return new EntrySet();
    }
    
    Set<K> keySet()
    {
      return new KeySet();
    }
    
    Collection<V> values()
    {
      return new ValueCollection();
    }
    
    private final class EntrySet
      extends AbstractSet<Map.Entry<K, V>>
    {
      EntrySet() {}
      
      public Iterator<Map.Entry<K, V>> iterator()
      {
        return new CopyOnWriteIdentityMap.Snapshot.EntryIterator(CopyOnWriteIdentityMap.Snapshot.this);
      }
      
      public int size()
      {
        return entries().length;
      }
      
      public boolean remove(Object o)
      {
        if (o == null) {
          throw new IllegalArgumentException();
        }
        synchronized (CopyOnWriteIdentityMap.Snapshot.this)
        {
          int size = entries.length;
          for (int i = 0; i < size; i++) {
            if (entries[i].equals(o))
            {
              removeEntry(i);
              return true;
            }
          }
        }
        return false;
      }
      
      public void clear()
      {
        clearEntries();
      }
    }
    
    private final class EntryIterator
      extends CopyOnWriteIdentityMap.Snapshot<K, V>.SnapshotIterator<Map.Entry<K, V>>
    {
      EntryIterator()
      {
        super();
      }
      
      public Map.Entry<K, V> next()
      {
        return nextEntry();
      }
    }
    
    private final class KeySet
      extends AbstractSet<K>
    {
      KeySet() {}
      
      public Iterator<K> iterator()
      {
        return new CopyOnWriteIdentityMap.Snapshot.KeyIterator(CopyOnWriteIdentityMap.Snapshot.this);
      }
      
      public int size()
      {
        return entries().length;
      }
      
      public boolean remove(Object o)
      {
        if (o == null) {
          throw new IllegalArgumentException();
        }
        synchronized (CopyOnWriteIdentityMap.Snapshot.this)
        {
          int size = entries.length;
          for (int i = 0; i < size; i++) {
            if (entries[i].key == o)
            {
              removeEntry(i);
              return true;
            }
          }
        }
        return false;
      }
      
      public void clear()
      {
        clearEntries();
      }
    }
    
    private final class KeyIterator
      extends CopyOnWriteIdentityMap.Snapshot<K, V>.SnapshotIterator<K>
    {
      KeyIterator()
      {
        super();
      }
      
      public K next()
      {
        return (K)nextEntrykey;
      }
    }
    
    private final class ValueCollection
      extends AbstractCollection<V>
    {
      ValueCollection() {}
      
      public Iterator<V> iterator()
      {
        return new CopyOnWriteIdentityMap.Snapshot.ValueIterator(CopyOnWriteIdentityMap.Snapshot.this);
      }
      
      public int size()
      {
        return entries().length;
      }
      
      public boolean remove(Object o)
      {
        if (o == null) {
          throw new IllegalArgumentException();
        }
        synchronized (CopyOnWriteIdentityMap.Snapshot.this)
        {
          int size = entries.length;
          for (int i = 0; i < size; i++) {
            if (entries[i].value == o)
            {
              removeEntry(i);
              return true;
            }
          }
        }
        return false;
      }
      
      public void clear()
      {
        clearEntries();
      }
    }
    
    private final class ValueIterator
      extends CopyOnWriteIdentityMap.Snapshot<K, V>.SnapshotIterator<V>
    {
      ValueIterator()
      {
        super();
      }
      
      public V next()
      {
        return (V)nextEntryvalue;
      }
    }
    
    private abstract class SnapshotIterator<E>
      implements Iterator<E>
    {
      private int length;
      private int cursor;
      
      SnapshotIterator()
      {
        length = entries().length;
        cursor = 0;
      }
      
      public final boolean hasNext()
      {
        return cursor < length;
      }
      
      protected final CopyOnWriteIdentityMap.Entry<K, V> nextEntry()
      {
        CopyOnWriteIdentityMap.Entry[] e = entries();
        if (length != e.length) {
          throw new ConcurrentModificationException();
        }
        if (cursor == length) {
          throw new NoSuchElementException();
        }
        return e[(cursor++)];
      }
      
      public final void remove()
      {
        if (length != entries().length) {
          throw new ConcurrentModificationException();
        }
        if (cursor == 0) {
          throw new IllegalStateException();
        }
        cursor -= 1;
        removeEntry(cursor);
        length = entries().length;
      }
    }
  }
}

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

public abstract interface EventDispatcher<K, V, E>
{
  public abstract void dispatchEvent(K paramK, V paramV, int paramInt, E paramE);
}

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

import java.util.Map.Entry;
import java.util.Set;

/**
 * @deprecated
 */
public class EventListeners<K, V>
{
  private final CopyOnWriteIdentityMap<K, V> list = new CopyOnWriteIdentityMap();
  
  public EventListeners() {}
  
  public EventListeners(int capacity)
  {
    this();
  }
  
  public void addListener(K listener, V listenerObject)
  {
    list.put(listener, listenerObject);
  }
  
  public void removeListener(V listener)
  {
    list.remove(listener);
  }
  
  public void removeAllListeners()
  {
    list.clear();
  }
  
  Set<Map.Entry<K, V>> entrySet()
  {
    return list.entrySet();
  }
}

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

import java.security.PrivilegedAction;

class EventManager$1
  implements PrivilegedAction<EventManager.EventThread<K, V, E>>
{
  final EventManager this$0;
  
  EventManager$1(EventManager paramEventManager) {}
  
  public EventManager.EventThread<K, V, E> run()
  {
    EventManager.EventThread<K, V, E> t = new EventManager.EventThread(this$0.threadGroup, this$0.threadName);
    return t;
  }
}

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

import java.util.Map.Entry;
import java.util.Set;

class EventManager$EventThread$Queued<K, V, E>
{
  final Set<Map.Entry<K, V>> listeners;
  final EventDispatcher<K, V, E> dispatcher;
  final int action;
  final E object;
  Queued<K, V, E> next;
  
  EventManager$EventThread$Queued(Set<Map.Entry<K, V>> l, EventDispatcher<K, V, E> d, int a, E o)
  {
    listeners = l;
    dispatcher = d;
    action = a;
    object = o;
    next = null;
  }
}

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

import java.util.Map.Entry;
import java.util.Set;

class EventManager$EventThread<K, V, E>
  extends Thread
{
  private static int nextThreadNumber;
  private Queued<K, V, E> head;
  private Queued<K, V, E> tail;
  private volatile boolean running;
  
  private static class Queued<K, V, E>
  {
    final Set<Map.Entry<K, V>> listeners;
    final EventDispatcher<K, V, E> dispatcher;
    final int action;
    final E object;
    Queued<K, V, E> next;
    
    Queued(Set<Map.Entry<K, V>> l, EventDispatcher<K, V, E> d, int a, E o)
    {
      listeners = l;
      dispatcher = d;
      action = a;
      object = o;
      next = null;
    }
  }
  
  EventManager$EventThread(ThreadGroup threadGroup, String threadName)
  {
    super(threadGroup, threadName == null ? getNextName() : threadName);
    running = true;
    head = null;
    tail = null;
    
    setDaemon(true);
  }
  
  private static synchronized String getNextName()
  {
    return "EventManagerThread-" + nextThreadNumber++;
  }
  
  EventManager$EventThread(String threadName)
  {
    this(null, threadName);
  }
  
  EventManager$EventThread()
  {
    this(null, null);
  }
  
  void close()
  {
    running = false;
    interrupt();
  }
  
  /* Error */
  public void run()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 131	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread:getNextEvent	()Lorg/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued;
    //   4: astore_1
    //   5: aload_1
    //   6: ifnonnull +4 -> 10
    //   9: return
    //   10: aload_1
    //   11: getfield 116	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued:listeners	Ljava/util/Set;
    //   14: aload_1
    //   15: getfield 117	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued:dispatcher	Lorg/eclipse/osgi/framework/eventmgr/EventDispatcher;
    //   18: aload_1
    //   19: getfield 114	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued:action	I
    //   22: aload_1
    //   23: getfield 115	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued:object	Ljava/lang/Object;
    //   26: invokestatic 126	org/eclipse/osgi/framework/eventmgr/EventManager:dispatchEvent	(Ljava/util/Set;Lorg/eclipse/osgi/framework/eventmgr/EventDispatcher;ILjava/lang/Object;)V
    //   29: aconst_null
    //   30: astore_1
    //   31: goto -31 -> 0
    //   34: astore_1
    //   35: aload_1
    //   36: athrow
    //   37: astore_1
    //   38: aload_1
    //   39: athrow
    // Line number table:
    //   Java source line #336	-> byte code offset #0
    //   Java source line #337	-> byte code offset #5
    //   Java source line #338	-> byte code offset #9
    //   Java source line #340	-> byte code offset #10
    //   Java source line #344	-> byte code offset #29
    //   Java source line #335	-> byte code offset #31
    //   Java source line #346	-> byte code offset #34
    //   Java source line #350	-> byte code offset #35
    //   Java source line #351	-> byte code offset #37
    //   Java source line #355	-> byte code offset #38
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	40	0	this	EventThread<K, V, E>
    //   4	27	1	item	Queued<K, V, E>
    //   34	2	1	e	RuntimeException
    //   37	2	1	e	Error
    // Exception table:
    //   from	to	target	type
    //   0	9	34	java/lang/RuntimeException
    //   10	34	34	java/lang/RuntimeException
    //   0	9	37	java/lang/Error
    //   10	34	37	java/lang/Error
  }
  
  synchronized void postEvent(Set<Map.Entry<K, V>> l, EventDispatcher<K, V, E> d, int a, E o)
  {
    if (!isAlive()) {
      throw new IllegalStateException();
    }
    Queued<K, V, E> item = new Queued(l, d, a, o);
    if (head == null)
    {
      head = item;
      tail = item;
    }
    else
    {
      tail.next = item;
      tail = item;
    }
    notify();
  }
  
  private synchronized Queued<K, V, E> getNextEvent()
  {
    while ((running) && (head == null)) {
      try
      {
        wait();
      }
      catch (InterruptedException localInterruptedException) {}
    }
    if (!running) {
      return null;
    }
    Queued<K, V, E> item = head;
    head = next;
    if (head == null) {
      tail = null;
    }
    return item;
  }
}

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

import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;

public class EventManager
{
  static final boolean DEBUG = false;
  private EventThread<?, ?, ?> thread;
  private boolean closed;
  protected final String threadName;
  protected final ThreadGroup threadGroup;
  
  public EventManager()
  {
    this(null, null);
  }
  
  public EventManager(String threadName)
  {
    this(threadName, null);
  }
  
  public EventManager(String threadName, ThreadGroup threadGroup)
  {
    thread = null;
    closed = false;
    this.threadName = threadName;
    this.threadGroup = threadGroup;
  }
  
  public synchronized void close()
  {
    if (closed) {
      return;
    }
    if (thread != null)
    {
      thread.close();
      thread = null;
    }
    closed = true;
  }
  
  synchronized <K, V, E> EventThread<K, V, E> getEventThread()
  {
    if (closed) {
      throw new IllegalStateException();
    }
    if (thread == null)
    {
      thread = ((EventThread)AccessController.doPrivileged(new PrivilegedAction()
      {
        public EventManager.EventThread<K, V, E> run()
        {
          EventManager.EventThread<K, V, E> t = new EventManager.EventThread(threadGroup, threadName);
          return t;
        }
      }));
      thread.start();
    }
    EventThread<K, V, E> result = thread;
    return result;
  }
  
  static <K, V, E> void dispatchEvent(Set<Map.Entry<K, V>> listeners, EventDispatcher<K, V, E> dispatcher, int eventAction, E eventObject)
  {
    for (Iterator localIterator = listeners.iterator(); localIterator.hasNext();)
    {
      Map.Entry<K, V> listener = (Map.Entry)localIterator.next();
      K eventListener = listener.getKey();
      V listenerObject = listener.getValue();
      try
      {
        dispatcher.dispatchEvent(eventListener, listenerObject, eventAction, eventObject);
      }
      catch (Throwable localThrowable) {}
    }
  }
  
  static class EventThread<K, V, E>
    extends Thread
  {
    private static int nextThreadNumber;
    private Queued<K, V, E> head;
    private Queued<K, V, E> tail;
    private volatile boolean running;
    
    private static class Queued<K, V, E>
    {
      final Set<Map.Entry<K, V>> listeners;
      final EventDispatcher<K, V, E> dispatcher;
      final int action;
      final E object;
      Queued<K, V, E> next;
      
      Queued(Set<Map.Entry<K, V>> l, EventDispatcher<K, V, E> d, int a, E o)
      {
        listeners = l;
        dispatcher = d;
        action = a;
        object = o;
        next = null;
      }
    }
    
    EventThread(ThreadGroup threadGroup, String threadName)
    {
      super(threadName == null ? getNextName() : threadName);
      running = true;
      head = null;
      tail = null;
      
      setDaemon(true);
    }
    
    private static synchronized String getNextName()
    {
      return "EventManagerThread-" + nextThreadNumber++;
    }
    
    EventThread(String threadName)
    {
      this(null, threadName);
    }
    
    EventThread()
    {
      this(null, null);
    }
    
    void close()
    {
      running = false;
      interrupt();
    }
    
    /* Error */
    public void run()
    {
      // Byte code:
      //   0: aload_0
      //   1: invokespecial 131	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread:getNextEvent	()Lorg/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued;
      //   4: astore_1
      //   5: aload_1
      //   6: ifnonnull +4 -> 10
      //   9: return
      //   10: aload_1
      //   11: getfield 116	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued:listeners	Ljava/util/Set;
      //   14: aload_1
      //   15: getfield 117	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued:dispatcher	Lorg/eclipse/osgi/framework/eventmgr/EventDispatcher;
      //   18: aload_1
      //   19: getfield 114	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued:action	I
      //   22: aload_1
      //   23: getfield 115	org/eclipse/osgi/framework/eventmgr/EventManager$EventThread$Queued:object	Ljava/lang/Object;
      //   26: invokestatic 126	org/eclipse/osgi/framework/eventmgr/EventManager:dispatchEvent	(Ljava/util/Set;Lorg/eclipse/osgi/framework/eventmgr/EventDispatcher;ILjava/lang/Object;)V
      //   29: aconst_null
      //   30: astore_1
      //   31: goto -31 -> 0
      //   34: astore_1
      //   35: aload_1
      //   36: athrow
      //   37: astore_1
      //   38: aload_1
      //   39: athrow
      // Line number table:
      //   Java source line #336	-> byte code offset #0
      //   Java source line #337	-> byte code offset #5
      //   Java source line #338	-> byte code offset #9
      //   Java source line #340	-> byte code offset #10
      //   Java source line #344	-> byte code offset #29
      //   Java source line #335	-> byte code offset #31
      //   Java source line #346	-> byte code offset #34
      //   Java source line #350	-> byte code offset #35
      //   Java source line #351	-> byte code offset #37
      //   Java source line #355	-> byte code offset #38
      // Local variable table:
      //   start	length	slot	name	signature
      //   0	40	0	this	EventThread<K, V, E>
      //   4	27	1	item	Queued<K, V, E>
      //   34	2	1	e	RuntimeException
      //   37	2	1	e	Error
      // Exception table:
      //   from	to	target	type
      //   0	9	34	java/lang/RuntimeException
      //   10	34	34	java/lang/RuntimeException
      //   0	9	37	java/lang/Error
      //   10	34	37	java/lang/Error
    }
    
    synchronized void postEvent(Set<Map.Entry<K, V>> l, EventDispatcher<K, V, E> d, int a, E o)
    {
      if (!isAlive()) {
        throw new IllegalStateException();
      }
      Queued<K, V, E> item = new Queued(l, d, a, o);
      if (head == null)
      {
        head = item;
        tail = item;
      }
      else
      {
        tail.next = item;
        tail = item;
      }
      notify();
    }
    
    private synchronized Queued<K, V, E> getNextEvent()
    {
      while ((running) && (head == null)) {
        try
        {
          wait();
        }
        catch (InterruptedException localInterruptedException) {}
      }
      if (!running) {
        return null;
      }
      Queued<K, V, E> item = head;
      head = next;
      if (head == null) {
        tail = null;
      }
      return item;
    }
  }
}

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

import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class ListenerQueue<K, V, E>
{
  protected final EventManager manager;
  private final Map<Set<Map.Entry<K, V>>, EventDispatcher<K, V, E>> queue;
  private boolean readOnly;
  
  public ListenerQueue(EventManager manager)
  {
    if (manager == null) {
      throw new IllegalArgumentException();
    }
    this.manager = manager;
    queue = new CopyOnWriteIdentityMap();
    readOnly = false;
  }
  
  /**
   * @deprecated
   */
  public void queueListeners(EventListeners<K, V> listeners, EventDispatcher<K, V, E> dispatcher)
  {
    queueListeners(listeners.entrySet(), dispatcher);
  }
  
  public synchronized void queueListeners(Set<Map.Entry<K, V>> listeners, EventDispatcher<K, V, E> dispatcher)
  {
    if (readOnly) {
      throw new IllegalStateException();
    }
    if (!listeners.isEmpty()) {
      queue.put(listeners, dispatcher);
    }
  }
  
  public void dispatchEventAsynchronous(int eventAction, E eventObject)
  {
    synchronized (this)
    {
      readOnly = true;
    }
    EventManager.EventThread<K, V, E> eventThread = manager.getEventThread();
    synchronized (eventThread)
    {
      for (Iterator localIterator = queue.entrySet().iterator(); localIterator.hasNext();)
      {
        Map.Entry<Set<Map.Entry<K, V>>, EventDispatcher<K, V, E>> entry = (Map.Entry)localIterator.next();
        eventThread.postEvent((Set)entry.getKey(), (EventDispatcher)entry.getValue(), eventAction, eventObject);
      }
    }
  }
  
  public void dispatchEventSynchronous(int eventAction, E eventObject)
  {
    synchronized (this)
    {
      readOnly = true;
    }
    for (Iterator localIterator = queue.entrySet().iterator(); localIterator.hasNext();)
    {
      Map.Entry<Set<Map.Entry<K, V>>, EventDispatcher<K, V, E>> entry = (Map.Entry)localIterator.next();
      EventManager.dispatchEvent((Set)entry.getKey(), (EventDispatcher)entry.getValue(), eventAction, eventObject);
    }
  }
}

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

import java.io.IOException;
import java.security.PrivilegedExceptionAction;
import org.eclipse.osgi.framework.adaptor.BundleData;

class AbstractBundle$1
  implements PrivilegedExceptionAction<Object>
{
  final AbstractBundle this$0;
  
  AbstractBundle$1(AbstractBundle paramAbstractBundle, int paramInt, boolean paramBoolean) {}
  
  public Object run()
    throws IOException
  {
    int status = this$0.bundledata.getStatus();
    boolean test = (status & val$mask) != 0;
    if (test != val$state)
    {
      this$0.bundledata.setStatus(val$state ? status | val$mask : status & (val$mask ^ 0xFFFFFFFF));
      this$0.bundledata.save();
    }
    return null;
  }
}

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

import java.io.InputStream;
import java.net.URLConnection;
import java.security.AccessControlContext;
import java.security.PrivilegedExceptionAction;
import java.util.Dictionary;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.eclipse.osgi.framework.debug.Debug;
import org.osgi.framework.BundleException;

class AbstractBundle$2
  implements PrivilegedExceptionAction<Object>
{
  final AbstractBundle this$0;
  
  AbstractBundle$2(AbstractBundle paramAbstractBundle, InputStream paramInputStream, AccessControlContext paramAccessControlContext) {}
  
  public Object run()
    throws BundleException
  {
    URLConnection source = null;
    if (val$in == null)
    {
      String updateLocation = (String)this$0.bundledata.getManifest().get("Bundle-UpdateLocation");
      if (updateLocation == null) {
        updateLocation = this$0.bundledata.getLocation();
      }
      if (Debug.DEBUG_GENERAL) {
        Debug.println("   from location: " + updateLocation);
      }
      source = this$0.framework.adaptor.mapLocationToURLConnection(updateLocation);
    }
    else
    {
      source = new BundleSource(val$in);
    }
    this$0.updateWorkerPrivileged(source, val$callerContext);
    return null;
  }
}

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

import java.security.PrivilegedExceptionAction;

class AbstractBundle$3
  implements PrivilegedExceptionAction<Object>
{
  final AbstractBundle this$0;
  
  AbstractBundle$3(AbstractBundle paramAbstractBundle1, AbstractBundle paramAbstractBundle2, boolean paramBoolean) {}
  
  public Object run()
    throws Exception
  {
    this$0.framework.checkAdminPermission(val$newBundle, "lifecycle");
    if (val$extension) {
      this$0.framework.checkAdminPermission(val$newBundle, "extensionLifecycle");
    }
    return null;
  }
}

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

import java.security.PrivilegedExceptionAction;
import org.osgi.framework.BundleException;

class AbstractBundle$4
  implements PrivilegedExceptionAction<Object>
{
  final AbstractBundle this$0;
  
  AbstractBundle$4(AbstractBundle paramAbstractBundle) {}
  
  public Object run()
    throws BundleException
  {
    this$0.uninstallWorkerPrivileged();
    return null;
  }
}

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

import java.security.PrivilegedAction;
import java.util.Enumeration;
import org.eclipse.osgi.framework.adaptor.BundleData;

class AbstractBundle$5
  implements PrivilegedAction<Enumeration<String>>
{
  final AbstractBundle this$0;
  
  AbstractBundle$5(AbstractBundle paramAbstractBundle, String paramString) {}
  
  public Enumeration<String> run()
  {
    return this$0.bundledata.getEntryPaths(val$path);
  }
}

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

import org.eclipse.osgi.framework.adaptor.StatusException;

class AbstractBundle$BundleStatusException
  extends Throwable
  implements StatusException
{
  private static final long serialVersionUID = 7201911791818929100L;
  private int code;
  private transient Object status;
  final AbstractBundle this$0;
  
  AbstractBundle$BundleStatusException(AbstractBundle paramAbstractBundle, String message, int code, Object status)
  {
    super(message);
    this.code = code;
    this.status = status;
  }
  
  public Object getStatus()
  {
    return status;
  }
  
  public int getStatusCode()
  {
    return code;
  }
}

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

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.net.URL;
import java.net.URLConnection;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.AllPermission;
import java.security.Permission;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.BundleOperation;
import org.eclipse.osgi.framework.adaptor.BundleProtectionDomain;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.eclipse.osgi.framework.adaptor.StatusException;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.util.KeyedElement;
import org.eclipse.osgi.internal.composite.CompositeImpl;
import org.eclipse.osgi.internal.composite.SurrogateImpl;
import org.eclipse.osgi.internal.loader.BundleLoader;
import org.eclipse.osgi.internal.permadmin.EquinoxSecurityManager;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ResolverError;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.signedcontent.SignedContent;
import org.eclipse.osgi.signedcontent.SignedContentFactory;
import org.eclipse.osgi.signedcontent.SignerInfo;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.AdaptPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.BundleReference;
import org.osgi.framework.Version;
import org.osgi.framework.startlevel.BundleStartLevel;
import org.osgi.framework.wiring.BundleRevision;
import org.osgi.framework.wiring.BundleRevisions;
import org.osgi.framework.wiring.BundleWiring;

public abstract class AbstractBundle
  implements Bundle, Comparable<Bundle>, KeyedElement, BundleStartLevel, BundleReference, BundleRevisions
{
  private static final long STATE_CHANGE_TIMEOUT;
  protected final Framework framework;
  protected volatile int state;
  protected volatile Thread stateChanging;
  protected BundleData bundledata;
  
  static
  {
    long stateChangeWait = 5000L;
    try
    {
      String prop = FrameworkProperties.getProperty("equinox.statechange.timeout");
      if (prop != null) {
        stateChangeWait = Long.parseLong(prop);
      }
    }
    catch (Throwable localThrowable)
    {
      stateChangeWait = 5000L;
    }
    STATE_CHANGE_TIMEOUT = stateChangeWait;
  }
  
  protected final Object statechangeLock = new Object();
  protected BundleProtectionDomain domain;
  protected volatile ManifestLocalization manifestLocalization = null;
  
  protected static AbstractBundle createBundle(BundleData bundledata, Framework framework, boolean setBundle)
    throws BundleException
  {
    AbstractBundle result;
    AbstractBundle result;
    if ((bundledata.getType() & 0x1) > 0)
    {
      result = new BundleFragment(bundledata, framework);
    }
    else
    {
      AbstractBundle result;
      if ((bundledata.getType() & 0x20) > 0)
      {
        result = new CompositeImpl(bundledata, framework);
      }
      else
      {
        AbstractBundle result;
        if ((bundledata.getType() & 0x40) > 0) {
          result = new SurrogateImpl(bundledata, framework);
        } else {
          result = new BundleHost(bundledata, framework);
        }
      }
    }
    if (setBundle) {
      bundledata.setBundle(result);
    }
    return result;
  }
  
  protected AbstractBundle(BundleData bundledata, Framework framework)
  {
    state = 2;
    stateChanging = null;
    this.bundledata = bundledata;
    this.framework = framework;
  }
  
  protected abstract void load();
  
  protected abstract boolean reload(AbstractBundle paramAbstractBundle);
  
  protected abstract void refresh();
  
  protected abstract boolean unload();
  
  protected void close()
  {
    if ((Debug.DEBUG_GENERAL) && 
      ((state & 0x2) == 0))
    {
      Debug.println("Bundle.close called when state != INSTALLED: " + this);
      Debug.printStackTrace(new Exception("Stack trace"));
    }
    state = 1;
  }
  
  protected BundleActivator loadBundleActivator()
    throws BundleException
  {
    String activatorClassName = bundledata.getActivator();
    if (activatorClassName != null) {
      try
      {
        Class<?> activatorClass = loadClass(activatorClassName, false);
        
        return (BundleActivator)activatorClass.newInstance();
      }
      catch (Throwable t)
      {
        if (Debug.DEBUG_GENERAL) {
          Debug.printStackTrace(t);
        }
        throw new BundleException(NLS.bind(Msg.BUNDLE_INVALID_ACTIVATOR_EXCEPTION, activatorClassName, bundledata.getSymbolicName()), 5, t);
      }
    }
    return null;
  }
  
  protected abstract Class<?> loadClass(String paramString, boolean paramBoolean)
    throws ClassNotFoundException;
  
  public int getState()
  {
    return state;
  }
  
  public Framework getFramework()
  {
    return framework;
  }
  
  protected boolean isActive()
  {
    return (state & 0x28) != 0;
  }
  
  boolean isLazyStart()
  {
    int status = bundledata.getStatus();
    return ((status & 0x4) != 0) && ((status & 0x2) != 0);
  }
  
  public boolean isResolved()
  {
    return (state & 0x3) == 0;
  }
  
  public void start()
    throws BundleException
  {
    start(0);
  }
  
  /* Error */
  public void start(int options)
    throws BundleException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   4: aload_0
    //   5: ldc 4
    //   7: invokevirtual 897	org/eclipse/osgi/framework/internal/core/Framework:checkAdminPermission	(Lorg/osgi/framework/Bundle;Ljava/lang/String;)V
    //   10: aload_0
    //   11: invokevirtual 846	org/eclipse/osgi/framework/internal/core/AbstractBundle:checkValid	()V
    //   14: aload_0
    //   15: invokevirtual 845	org/eclipse/osgi/framework/internal/core/AbstractBundle:beginStateChange	()V
    //   18: aload_0
    //   19: iload_1
    //   20: invokevirtual 855	org/eclipse/osgi/framework/internal/core/AbstractBundle:startWorker	(I)V
    //   23: goto +10 -> 33
    //   26: astore_2
    //   27: aload_0
    //   28: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   31: aload_2
    //   32: athrow
    //   33: aload_0
    //   34: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   37: return
    // Line number table:
    //   Java source line #296	-> byte code offset #0
    //   Java source line #297	-> byte code offset #10
    //   Java source line #298	-> byte code offset #14
    //   Java source line #300	-> byte code offset #18
    //   Java source line #301	-> byte code offset #23
    //   Java source line #302	-> byte code offset #27
    //   Java source line #303	-> byte code offset #31
    //   Java source line #302	-> byte code offset #33
    //   Java source line #304	-> byte code offset #37
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	38	0	this	AbstractBundle
    //   0	38	1	options	int
    //   26	6	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   18	26	26	finally
  }
  
  protected abstract void startWorker(int paramInt)
    throws BundleException;
  
  protected boolean readyToResume()
  {
    return false;
  }
  
  /* Error */
  protected void resume()
    throws BundleException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 770	org/eclipse/osgi/framework/internal/core/AbstractBundle:state	I
    //   4: iconst_1
    //   5: if_icmpne +4 -> 9
    //   8: return
    //   9: aload_0
    //   10: invokevirtual 845	org/eclipse/osgi/framework/internal/core/AbstractBundle:beginStateChange	()V
    //   13: aload_0
    //   14: invokevirtual 852	org/eclipse/osgi/framework/internal/core/AbstractBundle:readyToResume	()Z
    //   17: ifeq +18 -> 35
    //   20: aload_0
    //   21: iconst_1
    //   22: invokevirtual 855	org/eclipse/osgi/framework/internal/core/AbstractBundle:startWorker	(I)V
    //   25: goto +10 -> 35
    //   28: astore_1
    //   29: aload_0
    //   30: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   33: aload_1
    //   34: athrow
    //   35: aload_0
    //   36: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   39: return
    // Line number table:
    //   Java source line #384	-> byte code offset #0
    //   Java source line #385	-> byte code offset #8
    //   Java source line #387	-> byte code offset #9
    //   Java source line #389	-> byte code offset #13
    //   Java source line #390	-> byte code offset #20
    //   Java source line #391	-> byte code offset #25
    //   Java source line #392	-> byte code offset #29
    //   Java source line #393	-> byte code offset #33
    //   Java source line #392	-> byte code offset #35
    //   Java source line #394	-> byte code offset #39
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	40	0	this	AbstractBundle
    //   28	6	1	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   13	28	28	finally
  }
  
  public void stop()
    throws BundleException
  {
    stop(0);
  }
  
  /* Error */
  public void stop(int options)
    throws BundleException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 780	org/eclipse/osgi/framework/internal/core/AbstractBundle:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   4: aload_0
    //   5: ldc 4
    //   7: invokevirtual 897	org/eclipse/osgi/framework/internal/core/Framework:checkAdminPermission	(Lorg/osgi/framework/Bundle;Ljava/lang/String;)V
    //   10: aload_0
    //   11: invokevirtual 846	org/eclipse/osgi/framework/internal/core/AbstractBundle:checkValid	()V
    //   14: aload_0
    //   15: invokevirtual 845	org/eclipse/osgi/framework/internal/core/AbstractBundle:beginStateChange	()V
    //   18: aload_0
    //   19: iload_1
    //   20: invokevirtual 857	org/eclipse/osgi/framework/internal/core/AbstractBundle:stopWorker	(I)V
    //   23: goto +10 -> 33
    //   26: astore_2
    //   27: aload_0
    //   28: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   31: aload_2
    //   32: athrow
    //   33: aload_0
    //   34: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   37: return
    // Line number table:
    //   Java source line #461	-> byte code offset #0
    //   Java source line #462	-> byte code offset #10
    //   Java source line #463	-> byte code offset #14
    //   Java source line #465	-> byte code offset #18
    //   Java source line #466	-> byte code offset #23
    //   Java source line #467	-> byte code offset #27
    //   Java source line #468	-> byte code offset #31
    //   Java source line #467	-> byte code offset #33
    //   Java source line #469	-> byte code offset #37
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	38	0	this	AbstractBundle
    //   0	38	1	options	int
    //   26	6	2	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   18	26	26	finally
  }
  
  protected abstract void stopWorker(int paramInt)
    throws BundleException;
  
  protected void setStatus(final int mask, final boolean state)
  {
    try
    {
      AccessController.doPrivileged(new PrivilegedExceptionAction()
      {
        public Object run()
          throws IOException
        {
          int status = bundledata.getStatus();
          boolean test = (status & mask) != 0;
          if (test != state)
          {
            bundledata.setStatus(state ? status | mask : status & (mask ^ 0xFFFFFFFF));
            bundledata.save();
          }
          return null;
        }
      });
    }
    catch (PrivilegedActionException pae)
    {
      framework.publishFrameworkEvent(2, this, pae.getException());
    }
  }
  
  /* Error */
  protected void suspend(boolean lock)
    throws BundleException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 770	org/eclipse/osgi/framework/internal/core/AbstractBundle:state	I
    //   4: iconst_1
    //   5: if_icmpne +4 -> 9
    //   8: return
    //   9: aload_0
    //   10: invokevirtual 845	org/eclipse/osgi/framework/internal/core/AbstractBundle:beginStateChange	()V
    //   13: aload_0
    //   14: iconst_1
    //   15: invokevirtual 857	org/eclipse/osgi/framework/internal/core/AbstractBundle:stopWorker	(I)V
    //   18: goto +14 -> 32
    //   21: astore_2
    //   22: iload_1
    //   23: ifne +7 -> 30
    //   26: aload_0
    //   27: invokevirtual 848	org/eclipse/osgi/framework/internal/core/AbstractBundle:completeStateChange	()V
    //   30: aload_2
    //   31: athrow
    //   32: iload_1
    //   33: ifne +7 -> 40
    //   36: aload_0
    //   37: invokevirtual 848	org/eclipse/osgi/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

Further reading...

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

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd