org.eclipse.osgi_3.7.2.v20120110-1415

 BundleLoader loader = ((BundleHost)bundles[i]).getBundleLoader();
        if (loader != null) {
          loader.getImportedSources(null);
        }
      }
    }
  }
  
  private boolean checkExtensionBundle(BundleDescription sameName, BundleDelta[] addDeltas)
  {
    if ((sameName.getHost() == null) || (!sameName.isResolved())) {
      return true;
    }
    if ((((BundleDescription)sameName.getHost().getSupplier()).getBundleId() != 0L) || (addDeltas.length > 0)) {
      return true;
    }
    return false;
  }
  
  private void resumeBundles(AbstractBundle[] bundles, boolean refreshPackages, int[] previousStates)
  {
    if (Debug.DEBUG_PACKAGEADMIN) {
      Debug.println("PackageAdminImpl: restart the bundles");
    }
    if (bundles == null) {
      return;
    }
    for (int i = 0; i < bundles.length; i++) {
      if ((bundles[i].isResolved()) && ((refreshPackages) || (((bundles[i].getBundleData().getStatus() & 0x2) != 0) && (!bundles[i].testStateChanging(Thread.currentThread()))))) {
        if (previousStates[i] == 32) {
          try
          {
            bundles[i].start(1);
          }
          catch (BundleException e)
          {
            framework.publishFrameworkEvent(2, bundles[i], e);
          }
        } else {
          framework.resumeBundle(bundles[i]);
        }
      }
    }
  }
  
  private void suspendBundle(AbstractBundle bundle)
  {
    if ((bundle.isActive()) && (!bundle.isFragment())) {
      framework.suspendBundle(bundle, true);
    } else if (bundle.getStateChanging() != Thread.currentThread()) {
      try
      {
        bundle.beginStateChange();
      }
      catch (BundleException e)
      {
        framework.publishFrameworkEvent(2, bundle, e);
      }
    }
    if ((Debug.DEBUG_PACKAGEADMIN) && 
      (stateChanging == null))
    {
      Debug.println("Bundle state change lock is clear! " + bundle);
      Debug.printStackTrace(new Exception("Stack trace"));
    }
  }
  
  private void applyRemovalPending(BundleDelta bundleDelta)
    throws BundleException
  {
    if ((bundleDelta.getType() & 0x100) != 0)
    {
      BundleDescription bundle = bundleDelta.getBundle();
      if ((bundle.getDependents() != null) && (bundle.getDependents().length > 0))
      {
        if (Debug.DEBUG_PACKAGEADMIN)
        {
          Debug.println("Bundles still depend on removed bundle! " + bundle);
          Debug.printStackTrace(new Exception("Stack trace"));
        }
        throw new BundleException(Msg.OSGI_INTERNAL_ERROR);
      }
      Object userObject = bundle.getUserObject();
      if ((userObject instanceof BundleLoaderProxy))
      {
        BundleLoader.closeBundleLoader((BundleLoaderProxy)userObject);
        try
        {
          ((BundleLoaderProxy)userObject).getBundleData().close();
        }
        catch (IOException localIOException1) {}
      }
      else if ((userObject instanceof BundleData))
      {
        try
        {
          ((BundleData)userObject).close();
        }
        catch (IOException localIOException2) {}
      }
    }
  }
  
  private AbstractBundle setResolved(BundleDescription bundleDescription)
  {
    if (!bundleDescription.isResolved()) {
      return null;
    }
    AbstractBundle bundle = framework.getBundle(bundleDescription.getBundleId());
    if (bundle == null)
    {
      BundleException be = new BundleException(NLS.bind(Msg.BUNDLE_NOT_IN_FRAMEWORK, bundleDescription));
      framework.publishFrameworkEvent(2, framework.systemBundle, be);
      return null;
    }
    boolean resolve = true;
    if (bundle.isFragment())
    {
      BundleDescription[] hosts = bundleDescription.getHost().getHosts();
      for (int i = 0; i < hosts.length; i++)
      {
        BundleHost host = (BundleHost)framework.getBundle(hosts[i].getBundleId());
        resolve = ((BundleFragment)bundle).addHost(host);
      }
    }
    if (resolve) {
      bundle.resolve();
    }
    return bundle;
  }
  
  private void applyDeltas(BundleDelta[] bundleDeltas)
    throws BundleException
  {
    Arrays.sort(bundleDeltas, new Comparator()
    {
      public int compare(BundleDelta delta0, BundleDelta delta1)
      {
        return (int)(delta0.getBundle().getBundleId() - delta1.getBundle().getBundleId());
      }
    });
    for (int i = 0; i < bundleDeltas.length; i++)
    {
      int type = bundleDeltas[i].getType();
      if ((type & 0x180) != 0) {
        applyRemovalPending(bundleDeltas[i]);
      }
      if ((type & 0x8) != 0)
      {
        AbstractBundle bundle = setResolved(bundleDeltas[i].getBundle());
        if ((bundle != null) && (bundle.isResolved()))
        {
          NativeCodeSpecification nativeCode = bundleDeltas[i].getBundle().getNativeCodeSpecification();
          if ((nativeCode != null) && (nativeCode.getSupplier() != null)) {
            try
            {
              BundleData data = bundle.getBundleData();
              data.installNativeCode(((NativeCodeDescription)nativeCode.getSupplier()).getNativePaths());
            }
            catch (BundleException e)
            {
              framework.publishFrameworkEvent(2, bundle, e);
            }
          }
        }
      }
    }
  }
  
  private AbstractBundle[] processDelta(BundleDelta[] bundleDeltas, boolean refreshPackages, State systemState)
  {
    List<AbstractBundle> bundlesList = new ArrayList(bundleDeltas.length);
    for (int i = 0; i < bundleDeltas.length; i++) {
      if (((bundleDeltas[i].getType() & 0x100) == 0) || ((bundleDeltas[i].getType() & 0x2) != 0))
      {
        AbstractBundle changedBundle = framework.getBundle(bundleDeltas[i].getBundle().getBundleId());
        if ((changedBundle != null) && (!bundlesList.contains(changedBundle))) {
          bundlesList.add(changedBundle);
        }
      }
    }
    AbstractBundle[] refresh = (AbstractBundle[])bundlesList.toArray(new AbstractBundle[bundlesList.size()]);
    
    Util.sort(refresh, 0, refresh.length);
    
    framework.startLevelManager.sortByDependency(refresh);
    boolean[] previouslyResolved = new boolean[refresh.length];
    int[] previousStates = new int[refresh.length];
    try
    {
      try
      {
        if (Debug.DEBUG_PACKAGEADMIN) {
          Debug.println("refreshPackages: Suspend each bundle and acquire its state change lock");
        }
        boolean restart = false;
        for (int i = refresh.length - 1; i >= 0; i--)
        {
          previouslyResolved[i] = refresh[i].isResolved();
          if (refresh[i] == framework.systemBundle) {
            restart = true;
          } else if (((bundledata.getType() & 0x2) != 0) && (previouslyResolved[i] != 0)) {
            restart = true;
          } else if ((bundledata.getType() & 0x4) != 0) {
            restart = true;
          } else if (((bundledata.getType() & 0x10) != 0) && (previouslyResolved[i] != 0)) {
            restart = true;
          }
        }
        if (restart)
        {
          FrameworkProperties.setProperty("osgi.forcedRestart", "true");
          framework.setForcedRestart(true);
          int i;
          AbstractBundle changedBundle;
          return null;
        }
        boolean restart;
        if (refreshPackages) {
          for (int i = refresh.length - 1; i >= 0; i--)
          {
            previousStates[i] = refresh[i].getState();
            suspendBundle(refresh[i]);
          }
        }
        if (Debug.DEBUG_PACKAGEADMIN) {
          Debug.println("refreshPackages: refresh the bundles");
        }
        synchronized (framework.bundles)
        {
          for (int i = refresh.length - 1; i >= 0; i--) {
            refresh[i].refresh();
          }
        }
        for (int i = refresh.length - 1; i >= 0; i--) {
          if (previouslyResolved[i] != 0) {
            framework.publishBundleEvent(64, refresh[i]);
          }
        }
        if (Debug.DEBUG_PACKAGEADMIN) {
          Debug.println("refreshPackages: applying deltas to bundles");
        }
        synchronized (framework.bundles)
        {
          applyDeltas(bundleDeltas);
        }
        int i;
        AbstractBundle changedBundle;
        if (!Debug.DEBUG_PACKAGEADMIN) {
          break label633;
        }
      }
      finally
      {
        if (Debug.DEBUG_PACKAGEADMIN) {
          Debug.println("refreshPackages: release the state change locks");
        }
        if (refreshPackages) {
          for (i = 0; i < refresh.length; i++)
          {
            changedBundle = refresh[i];
            changedBundle.completeStateChange();
          }
        }
      }
      Debug.println("refreshPackages: release the state change locks");
      label633:
      if (refreshPackages) {
        for (int i = 0; i < refresh.length; i++)
        {
          AbstractBundle changedBundle = refresh[i];
          changedBundle.completeStateChange();
        }
      }
      if (refreshPackages)
      {
        if (Debug.DEBUG_PACKAGEADMIN) {
          Debug.println("refreshPackages: clean up adaptor storage");
        }
        try
        {
          framework.adaptor.compactStorage();
        }
        catch (IOException e)
        {
          if (Debug.DEBUG_PACKAGEADMIN)
          {
            Debug.println("refreshPackages exception: " + e.getMessage());
            Debug.printStackTrace(e);
          }
          framework.publishFrameworkEvent(2, framework.systemBundle, new BundleException(Msg.BUNDLE_REFRESH_FAILURE, e));
        }
      }
      if (!Debug.DEBUG_PACKAGEADMIN) {
        break label856;
      }
    }
    catch (BundleException e)
    {
      if (Debug.DEBUG_PACKAGEADMIN)
      {
        Debug.println("refreshPackages exception: " + e.getMessage());
        Debug.printStackTrace(e.getNestedException() == null ? e : e.getNestedException());
      }
      framework.publishFrameworkEvent(2, framework.systemBundle, new BundleException(Msg.BUNDLE_REFRESH_FAILURE, e));
    }
    Debug.println("refreshPackages: send out RESOLVED events");
    label856:
    for (int i = 0; i < refresh.length; i++) {
      if (refresh[i].isResolved()) {
        framework.publishBundleEvent(32, refresh[i]);
      }
    }
    if (!framework.isActive()) {
      return refresh;
    }
    if (refreshPackages)
    {
      framework.securityAdmin.clearCaches();
      if (bundleDeltas.length > 0) {
        systemState.setTimeStamp(systemState.getTimeStamp() == Long.MAX_VALUE ? 0L : systemState.getTimeStamp() + 1L);
      }
    }
    resumeBundles(refresh, refreshPackages, previousStates);
    return refresh;
  }
  
  public RequiredBundle[] getRequiredBundles(String symbolicName)
  {
    AbstractBundle[] bundles;
    AbstractBundle[] bundles;
    if (symbolicName == null) {
      bundles = framework.getAllBundles();
    } else {
      bundles = framework.getBundleBySymbolicName(symbolicName);
    }
    if ((bundles == null) || (bundles.length == 0)) {
      return null;
    }
    List<RequiredBundle> result = new ArrayList(bundles.length);
    for (int i = 0; i < bundles.length; i++) {
      if ((!bundles[i].isFragment()) && (bundles[i].isResolved()) && (bundles[i].getSymbolicName() != null)) {
        if (bundles[i].hasPermission(new BundlePermission(bundles[i].getSymbolicName(), "provide"))) {
          result.add(((BundleHost)bundles[i]).getLoaderProxy());
        }
      }
    }
    return result.size() == 0 ? null : (RequiredBundle[])result.toArray(new RequiredBundle[result.size()]);
  }
  
  public Bundle[] getBundles(String symbolicName, String versionRange)
  {
    if (symbolicName == null) {
      throw new IllegalArgumentException();
    }
    AbstractBundle[] bundles = framework.getBundleBySymbolicName(symbolicName);
    if (bundles == null) {
      return null;
    }
    if (versionRange == null)
    {
      AbstractBundle[] result = new AbstractBundle[bundles.length];
      System.arraycopy(bundles, 0, result, 0, result.length);
      return result;
    }
    List<AbstractBundle> result = new ArrayList(bundles.length);
    VersionRange range = new VersionRange(versionRange);
    for (int i = 0; i < bundles.length; i++) {
      if (range.isIncluded(bundles[i].getVersion())) {
        result.add(bundles[i]);
      }
    }
    if (result.size() == 0) {
      return null;
    }
    return (Bundle[])result.toArray(new AbstractBundle[result.size()]);
  }
  
  public Bundle[] getFragments(Bundle bundle)
  {
    return ((AbstractBundle)bundle).getFragments();
  }
  
  public Bundle[] getHosts(Bundle bundle)
  {
    BundleHost[] hosts = ((AbstractBundle)bundle).getHosts();
    if (hosts == null) {
      return null;
    }
    Bundle[] result = new Bundle[hosts.length];
    for (int i = 0; i < hosts.length; i++) {
      result[i] = hosts[i];
    }
    return result;
  }
  
  Bundle getBundlePriv(Class<?> clazz)
  {
    ClassLoader cl = clazz.getClassLoader();
    if ((cl instanceof BundleClassLoader))
    {
      ClassLoaderDelegate delegate = ((BundleClassLoader)cl).getDelegate();
      if ((delegate instanceof BundleLoader)) {
        return ((BundleLoader)delegate).getBundle();
      }
    }
    if (cl == getClass().getClassLoader()) {
      return framework.systemBundle;
    }
    return null;
  }
  
  public Bundle getBundle(Class clazz)
  {
    if (System.getSecurityManager() == null) {
      return getBundlePriv(clazz);
    }
    return (Bundle)AccessController.doPrivileged(new GetBundleAction(this, clazz));
  }
  
  public int getBundleType(Bundle bundle)
  {
    return ((AbstractBundle)bundle).isFragment() ? 1 : 0;
  }
  
  protected void cleanup() {}
  
  protected void setResolvedBundles(InternalSystemBundle systemBundle)
  {
    checkSystemBundle(systemBundle);
    
    State state = framework.adaptor.getState();
    BundleDescription[] descriptions = state.getBundles();
    for (int i = 0; i < descriptions.length; i++) {
      if (descriptions[i].getBundleId() == 0L) {
        setFrameworkVersion(descriptions[i]);
      } else {
        setResolved(descriptions[i]);
      }
    }
  }
  
  private void checkSystemBundle(InternalSystemBundle systemBundle)
  {
    try
    {
      State state = framework.adaptor.getState();
      BundleDescription oldSystemBundle = state.getBundle(0L);
      boolean different = false;
      if ((oldSystemBundle == null) || (!systemBundle.getBundleData().getVersion().equals(oldSystemBundle.getVersion()))) {
        different = true;
      }
      if ((!different) && (FrameworkProperties.getProperty("osgi.dev") == null)) {
        return;
      }
      BundleDescription newSystemBundle = state.getFactory().createBundleDescription(state, systemBundle.getHeaders(""), systemBundle.getLocation(), 0L);
      if (newSystemBundle == null) {
        throw new BundleException(Msg.OSGI_SYSTEMBUNDLE_DESCRIPTION_ERROR);
      }
      if (!different)
      {
        ExportPackageDescription[] oldPackages = oldSystemBundle.getExportPackages();
        ExportPackageDescription[] newPackages = newSystemBundle.getExportPackages();
        if (oldPackages.length >= newPackages.length)
        {
          int i = 0;
          do
          {
            if (oldPackages[i].getName().equals(newPackages[i].getName()))
            {
              Object oldVersion = oldPackages[i].getVersion();
              Object newVersion = newPackages[i].getVersion();
              different = newVersion != null;
            }
            else
            {
              different = true;
            }
            i++;
            if (i >= newPackages.length) {
              break;
            }
          } while (!different);
        }
        else
        {
          different = true;
        }
      }
      if (different)
      {
        state.removeBundle(0L);
        state.addBundle(newSystemBundle);
        
        state.resolve(false);
      }
    }
    catch (BundleException e)
    {
      e.printStackTrace();
      throw new RuntimeException(NLS.bind(Msg.OSGI_SYSTEMBUNDLE_CREATE_EXCEPTION, e.getMessage()), e);
    }
  }
  
  private void setFrameworkVersion(BundleDescription systemBundle)
  {
    ExportPackageDescription[] packages = systemBundle.getExportPackages();
    for (int i = 0; i < packages.length; i++) {
      if (packages[i].getName().equals("org.osgi.framework"))
      {
        FrameworkProperties.setProperty("org.osgi.framework.version", packages[i].getVersion().toString());
        break;
      }
    }
    FrameworkProperties.setProperty("osgi.framework.version", systemBundle.getVersion().toString());
  }
  
  public Bundle getBundle()
  {
    return framework.getBundle(0L);
  }
  
  public void refreshBundles(Collection<Bundle> bundles, FrameworkListener[] listeners)
  {
    refreshPackages(bundles == null ? null : (Bundle[])bundles.toArray(new Bundle[bundles.size()]), false, listeners);
  }
  
  public boolean resolveBundles(Collection<Bundle> bundles)
  {
    return resolveBundles(bundles == null ? null : (Bundle[])bundles.toArray(new Bundle[bundles.size()]));
  }
  
  public Collection<Bundle> getRemovalPendingBundles()
  {
    BundleDescription[] removals = framework.adaptor.getState().getRemovalPending();
    Set<Bundle> result = new HashSet();
    for (int i = 0; i < removals.length; i++)
    {
      Object ref = removals[i].getUserObject();
      if ((ref instanceof BundleReference)) {
        result.add(((BundleReference)ref).getBundle());
      }
    }
    return result;
  }
  
  public Collection<Bundle> getDependencyClosure(Collection<Bundle> bundles)
  {
    Collection<BundleDescription> descriptions = getDescriptionClosure(bundles);
    Set<Bundle> result = new HashSet();
    for (Iterator localIterator = descriptions.iterator(); localIterator.hasNext();)
    {
      BundleDescription description = (BundleDescription)localIterator.next();
      Object userObject = description.getUserObject();
      if ((userObject instanceof BundleReference))
      {
        Bundle bundle = ((BundleReference)userObject).getBundle();
        if (bundle != null) {
          result.add(bundle);
        }
      }
    }
    return result;
  }
  
  private Collection<BundleDescription> getDescriptionClosure(Collection<Bundle> bundles)
  {
    State state = framework.adaptor.getState();
    Collection<BundleDescription> descriptions = new ArrayList();
    for (Iterator localIterator = bundles.iterator(); localIterator.hasNext();)
    {
      Bundle bundle = (Bundle)localIterator.next();
      BundleDescription description = state.getBundle(bundle.getBundleId());
      if (description != null) {
        descriptions.add(description);
      }
    }
    return state.getDependencyClosure(descriptions);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.PackageAdminImpl
 * 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.io.InputStream;
import java.net.URL;

public class ReferenceInputStream
  extends InputStream
{
  protected URL reference;
  
  public ReferenceInputStream(URL reference)
  {
    this.reference = reference;
  }
  
  public int read()
    throws IOException
  {
    throw new IOException();
  }
  
  public URL getReference()
  {
    return reference;
  }
}

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

import java.util.EventObject;
import org.osgi.framework.FrameworkListener;

class StartLevelEvent
  extends EventObject
{
  private static final long serialVersionUID = 3258125839085155891L;
  public static final int CHANGE_BUNDLE_SL = 0;
  public static final int CHANGE_FW_SL = 1;
  private final transient int type;
  private final transient int newSl;
  private final transient AbstractBundle bundle;
  private final transient FrameworkListener[] listeners;
  
  public StartLevelEvent(int type, int newSl, AbstractBundle bundle, FrameworkListener[] listeners)
  {
    super(bundle);
    this.type = type;
    this.newSl = newSl;
    this.bundle = bundle;
    this.listeners = listeners;
  }
  
  public int getType()
  {
    return type;
  }
  
  public int getNewSL()
  {
    return newSl;
  }
  
  public AbstractBundle getBundle()
  {
    return bundle;
  }
  
  public FrameworkListener[] getListeners()
  {
    return listeners;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.StartLevelEvent
 * 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.eclipse.osgi.framework.adaptor.BundleData;

class StartLevelManager$1
  implements PrivilegedExceptionAction<Object>
{
  final StartLevelManager this$0;
  
  StartLevelManager$1(StartLevelManager paramStartLevelManager, AbstractBundle paramAbstractBundle) {}
  
  public Object run()
    throws Exception
  {
    val$b.getBundleData().save();
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.StartLevelManager.1
 * 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.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.eventmgr.CopyOnWriteIdentityMap;
import org.eclipse.osgi.framework.eventmgr.EventDispatcher;
import org.eclipse.osgi.framework.eventmgr.EventManager;
import org.eclipse.osgi.framework.eventmgr.ListenerQueue;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.PlatformAdmin;
import org.eclipse.osgi.service.resolver.StateHelper;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.FrameworkListener;
import org.osgi.service.startlevel.StartLevel;

public class StartLevelManager
  implements EventDispatcher<Object, Object, StartLevelEvent>, StartLevel
{
  protected static EventManager eventManager;
  protected static Map<Object, Object> startLevelListeners;
  protected int initialBundleStartLevel = 1;
  private int activeSL = 0;
  private final Object lock = new Object();
  private final Framework framework;
  
  protected StartLevelManager(Framework framework)
  {
    this.framework = framework;
  }
  
  protected void initialize()
  {
    initialBundleStartLevel = framework.adaptor.getInitialBundleStartLevel();
    
    eventManager = new EventManager("Start Level Event Dispatcher");
    startLevelListeners = new CopyOnWriteIdentityMap();
    startLevelListeners.put(this, this);
  }
  
  protected void cleanup()
  {
    eventManager.close();
    eventManager = null;
    startLevelListeners.clear();
    startLevelListeners = null;
  }
  
  public int getInitialBundleStartLevel()
  {
    return initialBundleStartLevel;
  }
  
  public void setInitialBundleStartLevel(int startlevel)
  {
    framework.checkAdminPermission(framework.systemBundle, "startlevel");
    if (startlevel <= 0) {
      throw new IllegalArgumentException();
    }
    initialBundleStartLevel = startlevel;
    framework.adaptor.setInitialBundleStartLevel(startlevel);
  }
  
  public int getStartLevel()
  {
    return activeSL;
  }
  
  public void setStartLevel(int newSL, Bundle callerBundle, FrameworkListener[] listeners)
  {
    if (newSL <= 0) {
      throw new IllegalArgumentException(NLS.bind(Msg.STARTLEVEL_EXCEPTION_INVALID_REQUESTED_STARTLEVEL, newSL));
    }
    framework.checkAdminPermission(framework.systemBundle, "startlevel");
    if (Debug.DEBUG_STARTLEVEL) {
      Debug.println("StartLevelImpl: setStartLevel: " + newSL + "; callerBundle = " + callerBundle.getBundleId());
    }
    issueEvent(new StartLevelEvent(1, newSL, (AbstractBundle)callerBundle, listeners));
  }
  
  public void setStartLevel(int newSL)
  {
    setStartLevel(newSL, framework.systemBundle, new FrameworkListener[0]);
  }
  
  protected void shutdown()
  {
    doSetStartLevel(0, new FrameworkListener[0]);
  }
  
  /* Error */
  void doSetStartLevel(int newSL, FrameworkListener[] listeners)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 479	org/eclipse/osgi/framework/internal/core/StartLevelManager:lock	Ljava/lang/Object;
    //   4: dup
    //   5: astore_3
    //   6: monitorenter
    //   7: invokestatic 496	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   10: invokevirtual 494	java/lang/Thread:getContextClassLoader	()Ljava/lang/ClassLoader;
    //   13: astore 4
    //   15: aload_0
    //   16: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   19: invokevirtual 523	org/eclipse/osgi/framework/internal/core/Framework:getContextFinder	()Lorg/eclipse/core/runtime/internal/adaptor/ContextFinder;
    //   22: astore 5
    //   24: aload 5
    //   26: aload 4
    //   28: if_acmpne +9 -> 37
    //   31: aconst_null
    //   32: astore 5
    //   34: goto +11 -> 45
    //   37: invokestatic 496	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   40: aload 5
    //   42: invokevirtual 495	java/lang/Thread:setContextClassLoader	(Ljava/lang/ClassLoader;)V
    //   45: aload_0
    //   46: getfield 477	org/eclipse/osgi/framework/internal/core/StartLevelManager:activeSL	I
    //   49: istore 6
    //   51: iload_1
    //   52: iload 6
    //   54: if_icmple +131 -> 185
    //   57: iload 6
    //   59: ifne +7 -> 66
    //   62: iconst_1
    //   63: goto +4 -> 67
    //   66: iconst_0
    //   67: istore 7
    //   69: iload 6
    //   71: istore 8
    //   73: goto +55 -> 128
    //   76: getstatic 468	org/eclipse/osgi/framework/debug/Debug:DEBUG_STARTLEVEL	Z
    //   79: ifeq +23 -> 102
    //   82: new 240	java/lang/StringBuffer
    //   85: dup
    //   86: ldc 7
    //   88: invokespecial 488	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   91: iload 6
    //   93: invokevirtual 489	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   96: invokevirtual 487	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   99: invokestatic 501	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   102: iinc 6 1
    //   105: aload_0
    //   106: iload 8
    //   108: iconst_1
    //   109: iadd
    //   110: aload_0
    //   111: aload_0
    //   112: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   115: getfield 470	org/eclipse/osgi/framework/internal/core/Framework:bundles	Lorg/eclipse/osgi/framework/internal/core/BundleRepository;
    //   118: iconst_0
    //   119: invokevirtual 548	org/eclipse/osgi/framework/internal/core/StartLevelManager:getInstalledBundles	(Lorg/eclipse/osgi/framework/internal/core/BundleRepository;Z)[Lorg/eclipse/osgi/framework/internal/core/AbstractBundle;
    //   122: invokevirtual 538	org/eclipse/osgi/framework/internal/core/StartLevelManager:incFWSL	(I[Lorg/eclipse/osgi/framework/internal/core/AbstractBundle;)V
    //   125: iinc 8 1
    //   128: iload 8
    //   130: iload_1
    //   131: if_icmplt -55 -> 76
    //   134: iload 7
    //   136: ifeq +144 -> 280
    //   139: aload_0
    //   140: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   143: getfield 471	org/eclipse/osgi/framework/internal/core/Framework:systemBundle	Lorg/eclipse/osgi/framework/internal/core/InternalSystemBundle;
    //   146: bipush 32
    //   148: putfield 472	org/eclipse/osgi/framework/internal/core/InternalSystemBundle:state	I
    //   151: aload_0
    //   152: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   155: iconst_2
    //   156: aload_0
    //   157: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   160: getfield 471	org/eclipse/osgi/framework/internal/core/Framework:systemBundle	Lorg/eclipse/osgi/framework/internal/core/InternalSystemBundle;
    //   163: invokevirtual 526	org/eclipse/osgi/framework/internal/core/Framework:publishBundleEvent	(ILorg/osgi/framework/Bundle;)V
    //   166: aload_0
    //   167: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   170: iconst_1
    //   171: aload_0
    //   172: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   175: getfield 471	org/eclipse/osgi/framework/internal/core/Framework:systemBundle	Lorg/eclipse/osgi/framework/internal/core/InternalSystemBundle;
    //   178: aconst_null
    //   179: invokevirtual 528	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;)V
    //   182: goto +98 -> 280
    //   185: aload_0
    //   186: aload_0
    //   187: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   190: getfield 470	org/eclipse/osgi/framework/internal/core/Framework:bundles	Lorg/eclipse/osgi/framework/internal/core/BundleRepository;
    //   193: iconst_1
    //   194: invokevirtual 548	org/eclipse/osgi/framework/internal/core/StartLevelManager:getInstalledBundles	(Lorg/eclipse/osgi/framework/internal/core/BundleRepository;Z)[Lorg/eclipse/osgi/framework/internal/core/AbstractBundle;
    //   197: astore 7
    //   199: iload 6
    //   201: istore 8
    //   203: goto +45 -> 248
    //   206: getstatic 468	org/eclipse/osgi/framework/debug/Debug:DEBUG_STARTLEVEL	Z
    //   209: ifeq +23 -> 232
    //   212: new 240	java/lang/StringBuffer
    //   215: dup
    //   216: ldc 6
    //   218: invokespecial 488	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   221: iload 6
    //   223: invokevirtual 489	java/lang/StringBuffer:append	(I)Ljava/lang/StringBuffer;
    //   226: invokevirtual 487	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   229: invokestatic 501	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   232: iinc 6 -1
    //   235: aload_0
    //   236: iload 8
    //   238: iconst_1
    //   239: isub
    //   240: aload 7
    //   242: invokevirtual 537	org/eclipse/osgi/framework/internal/core/StartLevelManager:decFWSL	(I[Lorg/eclipse/osgi/framework/internal/core/AbstractBundle;)V
    //   245: iinc 8 -1
    //   248: iload 8
    //   250: iload_1
    //   251: if_icmpgt -45 -> 206
    //   254: iload_1
    //   255: ifne +25 -> 280
    //   258: aload_0
    //   259: aload_0
    //   260: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   263: getfield 470	org/eclipse/osgi/framework/internal/core/Framework:bundles	Lorg/eclipse/osgi/framework/internal/core/BundleRepository;
    //   266: invokespecial 543	org/eclipse/osgi/framework/internal/core/StartLevelManager:suspendAllBundles	(Lorg/eclipse/osgi/framework/internal/core/BundleRepository;)V
    //   269: aload_0
    //   270: aload_0
    //   271: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   274: getfield 470	org/eclipse/osgi/framework/internal/core/Framework:bundles	Lorg/eclipse/osgi/framework/internal/core/BundleRepository;
    //   277: invokespecial 544	org/eclipse/osgi/framework/internal/core/StartLevelManager:unloadAllBundles	(Lorg/eclipse/osgi/framework/internal/core/BundleRepository;)V
    //   280: aload_0
    //   281: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   284: bipush 8
    //   286: aload_0
    //   287: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   290: getfield 471	org/eclipse/osgi/framework/internal/core/Framework:systemBundle	Lorg/eclipse/osgi/framework/internal/core/InternalSystemBundle;
    //   293: aconst_null
    //   294: aload_2
    //   295: invokevirtual 529	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;[Lorg/osgi/framework/FrameworkListener;)V
    //   298: getstatic 468	org/eclipse/osgi/framework/debug/Debug:DEBUG_STARTLEVEL	Z
    //   301: ifeq +75 -> 376
    //   304: ldc 3
    //   306: invokestatic 501	org/eclipse/osgi/framework/debug/Debug:println	(Ljava/lang/String;)V
    //   309: goto +67 -> 376
    //   312: astore 6
    //   314: aload_0
    //   315: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   318: iconst_2
    //   319: aload_0
    //   320: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   323: getfield 471	org/eclipse/osgi/framework/internal/core/Framework:systemBundle	Lorg/eclipse/osgi/framework/internal/core/InternalSystemBundle;
    //   326: aload 6
    //   328: aload_2
    //   329: invokevirtual 529	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;[Lorg/osgi/framework/FrameworkListener;)V
    //   332: aload 6
    //   334: athrow
    //   335: astore 6
    //   337: aload_0
    //   338: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   341: iconst_2
    //   342: aload_0
    //   343: getfield 482	org/eclipse/osgi/framework/internal/core/StartLevelManager:framework	Lorg/eclipse/osgi/framework/internal/core/Framework;
    //   346: getfield 471	org/eclipse/osgi/framework/internal/core/Framework:systemBundle	Lorg/eclipse/osgi/framework/internal/core/InternalSystemBundle;
    //   349: aload 6
    //   351: aload_2
    //   352: invokevirtual 529	org/eclipse/osgi/framework/internal/core/Framework:publishFrameworkEvent	(ILorg/osgi/framework/Bundle;Ljava/lang/Throwable;[Lorg/osgi/framework/FrameworkListener;)V
    //   355: aload 6
    //   357: athrow
    //   358: astore 9
    //   360: aload 5
    //   362: ifnull +11 -> 373
    //   365: invokestatic 496	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   368: aload 4
    //   370: invokevirtual 495	java/lang/Thread:setContextClassLoader	(Ljava/lang/ClassLoader;)V
    //   373: aload 9
    //   375: athrow
    //   376: aload 5
    //   378: ifnull +11 -> 389
    //   381: invokestatic 496	java/lang/Thread:currentThread	()Ljava/lang/Thread;
    //   384: aload 4
    //   386: invokevirtual 495	java/lang/Thread:setContextClassLoader	(Ljava/lang/ClassLoader;)V
    //   389: aload_3
    //   390: monitorexit
    //   391: goto +6 -> 397
    //   394: aload_3
    //   395: monitorexit
    //   396: athrow
    //   397: return
    // Line number table:
    //   Java source line #225	-> byte code offset #0
    //   Java source line #226	-> byte code offset #7
    //   Java source line #227	-> byte code offset #15
    //   Java source line #228	-> byte code offset #24
    //   Java source line #229	-> byte code offset #31
    //   Java source line #231	-> byte code offset #37
    //   Java source line #233	-> byte code offset #45
    //   Java source line #234	-> byte code offset #51
    //   Java source line #235	-> byte code offset #57
    //   Java source line #236	-> byte code offset #69
    //   Java source line #237	-> byte code offset #76
    //   Java source line #238	-> byte code offset #82
    //   Java source line #240	-> byte code offset #102
    //   Java source line #243	-> byte code offset #105
    //   Java source line #236	-> byte code offset #125
    //   Java source line #245	-> byte code offset #134
    //   Java source line #246	-> byte code offset #139
    //   Java source line #247	-> byte code offset #151
    //   Java source line #248	-> byte code offset #166
    //   Java source line #251	-> byte code offset #185
    //   Java source line #252	-> byte code offset #199
    //   Java source line #253	-> byte code offset #206
    //   Java source line #254	-> byte code offset #212
    //   Java source line #256	-> byte code offset #232
    //   Java source line #257	-> byte code offset #235
    //   Java source line #252	-> byte code offset #245
    //   Java source line #259	-> byte code offset #254
    //   Java source line #261	-> byte code offset #258
    //   Java source line #262	-> byte code offset #269
    //   Java source line #265	-> byte code offset #280
    //   Java source line #266	-> byte code offset #298
    //   Java source line #267	-> byte code offset #304
    //   Java source line #269	-> byte code offset #312
    //   Java source line #270	-> byte code offset #314
    //   Java source line #271	-> byte code offset #332
    //   Java source line #272	-> byte code offset #335
    //   Java source line #273	-> byte code offset #337
    //   Java source line #274	-> byte code offset #355
    //   Java source line #275	-> byte code offset #358
    //   Java source line #276	-> byte code offset #360
    //   Java source line #277	-> byte code offset #365
    //   Java source line #278	-> byte code offset #373
    //   Java source line #276	-> byte code offset #376
    //   Java source line #277	-> byte code offset #381
    //   Java source line #225	-> byte code offset #389
    //   Java source line #280	-> byte code offset #397
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	398	0	this	StartLevelManager
    //   0	398	1	newSL	int
    //   0	398	2	listeners	FrameworkListener[]
    //   5	390	3	Ljava/lang/Object;	Object
    //   13	372	4	previousTCCL	ClassLoader
    //   22	355	5	contextFinder	ClassLoader
    //   49	184	6	tempSL	int
    //   312	21	6	e	Error
    //   335	21	6	e	RuntimeException
    //   67	68	7	launching	boolean
    //   197	44	7	sortedBundles	AbstractBundle[]
    //   71	58	8	i	int
    //   201	48	8	i	int
    //   358	16	9	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   45	309	312	java/lang/Error
    //   45	309	335	java/lang/RuntimeException
    //   45	358	358	finally
    //   7	391	394	finally
    //   394	396	394	finally
  }
  
  protected void saveActiveStartLevel(int newSL)
  {
    synchronized (lock)
    {
      activeSL = newSL;
    }
  }
  
  public boolean isBundlePersistentlyStarted(Bundle bundle)
  {
    return ((AbstractBundle)bundle).isPersistentlyStarted();
  }
  
  public boolean isBundleActivationPolicyUsed(Bundle bundle)
  {
    return ((AbstractBundle)bundle).isActivationPolicyUsed();
  }
  
  public int getBundleStartLevel(Bundle bundle)
  {
    return ((AbstractBundle)bundle).getStartLevel();
  }
  
  public void setBundleStartLevel(Bundle bundle, int newSL)
  {
    String exceptionText = null;
    if (bundle.getBundleId() == 0L) {
      exceptionText = Msg.STARTLEVEL_CANT_CHANGE_SYSTEMBUNDLE_STARTLEVEL;
    } else if (bundle.getState() == 1) {
      exceptionText = NLS.bind(Msg.BUNDLE_UNINSTALLED_EXCEPTION, ((AbstractBundle)bundle).getBundleData().getLocation());
    } else if (newSL <= 0) {
      exceptionText = NLS.bind(Msg.STARTLEVEL_EXCEPTION_INVALID_REQUESTED_STARTLEVEL, newSL);
    }
    if (ex
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-2017. Infinite Loop Ltd