org.eclipse.osgi_3.7.2.v20120110-1415

rk.getContextFinder());
      
      shutdown.start();
    }
  }
  
  public void stop(int options)
  {
    stop();
  }
  
  protected void suspend()
  {
    framework.startLevelManager.shutdown();
    framework.startLevelManager.cleanup();
    
    framework.packageAdmin.cleanup();
    if (Debug.DEBUG_GENERAL) {
      Debug.println("->Framework shutdown");
    }
    framework.publishBundleEvent(4, this);
  }
  
  protected void suspend(boolean lock) {}
  
  public void update()
  {
    framework.checkAdminPermission(this, "lifecycle");
    if ((state & 0x28) != 0)
    {
      Thread restart = framework.secureAction.createThread(new Runnable()
      {
        public void run()
        {
          int sl = framework.startLevelManager.getStartLevel();
          FrameworkProperties.setProperty("osgi.framework.relaunch", "");
          framework.shutdown(128);
          framework.launch();
          if (sl > 0) {
            framework.startLevelManager.doSetStartLevel(sl, new FrameworkListener[0]);
          }
          FrameworkProperties.clearProperty("osgi.framework.relaunch");
        }
      }, "System Bundle Update", framework.getContextFinder());
      
      restart.start();
    }
  }
  
  public void update(InputStream in)
  {
    update();
    try
    {
      in.close();
    }
    catch (IOException localIOException) {}
  }
  
  public void uninstall()
    throws BundleException
  {
    framework.checkAdminPermission(this, "lifecycle");
    
    throw new BundleException(Msg.BUNDLE_SYSTEMBUNDLE_UNINSTALL_EXCEPTION, 2);
  }
  
  public boolean hasPermission(Object permission)
  {
    if (systemDomain != null)
    {
      if ((permission instanceof Permission)) {
        return systemDomain.implies((Permission)permission);
      }
      return false;
    }
    return true;
  }
  
  protected void unresolvePermissions(AbstractBundle[] refreshedBundles) {}
  
  public Dictionary<String, String> getHeaders(String localeString)
  {
    return new SystemBundleHeaders(super.getHeaders(localeString));
  }
  
  public void init() {}
  
  public FrameworkEvent waitForStop(long timeout)
    throws InterruptedException
  {
    return framework.waitForStop(timeout);
  }
  
  public ClassLoader getClassLoader()
  {
    return getClass().getClassLoader();
  }
  
  protected <A> A adapt0(Class<A> adapterType)
  {
    if (FrameworkStartLevel.class.equals(adapterType)) {
      return fsl;
    }
    if (FrameworkWiring.class.equals(adapterType)) {
      return framework.getPackageAdmin();
    }
    return (A)super.adapt0(adapterType);
  }
  
  class EquinoxStartLevel
    implements FrameworkStartLevel
  {
    EquinoxStartLevel() {}
    
    public void setStartLevel(int startlevel, FrameworkListener[] listeners)
    {
      framework.startLevelManager.setStartLevel(startlevel, InternalSystemBundle.this, listeners);
    }
    
    public int getInitialBundleStartLevel()
    {
      return framework.startLevelManager.getInitialBundleStartLevel();
    }
    
    public void setInitialBundleStartLevel(int startlevel)
    {
      framework.startLevelManager.setInitialBundleStartLevel(startlevel);
    }
    
    public Bundle getBundle()
    {
      return InternalSystemBundle.this;
    }
    
    public int getStartLevel()
    {
      return framework.startLevelManager.getStartLevel();
    }
  }
}

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

import java.util.ResourceBundle;

abstract interface ManifestLocalization$BundleResourceBundle
{
  public abstract void setParent(ResourceBundle paramResourceBundle);
  
  public abstract boolean isEmpty();
  
  public abstract boolean isStemEmpty();
}

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

import java.util.Enumeration;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

class ManifestLocalization$EmptyResouceBundle
  extends ResourceBundle
  implements ManifestLocalization.BundleResourceBundle
{
  private final String localeString;
  final ManifestLocalization this$0;
  
  public ManifestLocalization$EmptyResouceBundle(ManifestLocalization paramManifestLocalization, String locale)
  {
    localeString = locale;
  }
  
  public Enumeration<String> getKeys()
  {
    return null;
  }
  
  protected Object handleGetObject(String arg0)
    throws MissingResourceException
  {
    return null;
  }
  
  public void setParent(ResourceBundle parent)
  {
    super.setParent(parent);
  }
  
  public boolean isEmpty()
  {
    if (parent == null) {
      return true;
    }
    return ((ManifestLocalization.BundleResourceBundle)parent).isEmpty();
  }
  
  public boolean isStemEmpty()
  {
    if (ManifestLocalization.DEFAULT_ROOT.equals(localeString)) {
      return false;
    }
    if (parent == null) {
      return true;
    }
    return ((ManifestLocalization.BundleResourceBundle)parent).isStemEmpty();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.ManifestLocalization.EmptyResouceBundle
 * 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.util.PropertyResourceBundle;
import java.util.ResourceBundle;

class ManifestLocalization$LocalizationResourceBundle
  extends PropertyResourceBundle
  implements ManifestLocalization.BundleResourceBundle
{
  final ManifestLocalization this$0;
  
  public ManifestLocalization$LocalizationResourceBundle(ManifestLocalization paramManifestLocalization, InputStream in)
    throws IOException
  {
    super(in);
  }
  
  public void setParent(ResourceBundle parent)
  {
    super.setParent(parent);
  }
  
  public boolean isEmpty()
  {
    return false;
  }
  
  public boolean isStemEmpty()
  {
    return parent == null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.ManifestLocalization.LocalizationResourceBundle
 * 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;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import org.eclipse.osgi.framework.util.Headers;

public class ManifestLocalization
{
  static final String DEFAULT_ROOT = FrameworkProperties.getProperty("equinox.root.locale", "en");
  private final AbstractBundle bundle;
  private final Dictionary<String, String> rawHeaders;
  private Dictionary<String, String> defaultLocaleHeaders = null;
  private final Hashtable<String, BundleResourceBundle> cache = new Hashtable(5);
  
  public ManifestLocalization(AbstractBundle bundle, Dictionary<String, String> rawHeaders)
  {
    this.bundle = bundle;
    this.rawHeaders = rawHeaders;
  }
  
  Dictionary<String, String> getHeaders(String localeString)
  {
    if (localeString.length() == 0) {
      return rawHeaders;
    }
    boolean isDefaultLocale = localeString.equals(Locale.getDefault().toString());
    Dictionary<String, String> currentDefault = defaultLocaleHeaders;
    if ((isDefaultLocale) && (currentDefault != null)) {
      return currentDefault;
    }
    try
    {
      bundle.checkValid();
    }
    catch (IllegalStateException localIllegalStateException)
    {
      if (currentDefault != null) {
        return currentDefault;
      }
      return rawHeaders;
    }
    ResourceBundle localeProperties = getResourceBundle(localeString, isDefaultLocale);
    Enumeration<String> e = rawHeaders.keys();
    Headers<String, String> localeHeaders = new Headers(rawHeaders.size());
    while (e.hasMoreElements())
    {
      String key = (String)e.nextElement();
      String value = (String)rawHeaders.get(key);
      if ((value.startsWith("%")) && (value.length() > 1))
      {
        String propertiesKey = value.substring(1);
        try
        {
          value = localeProperties == null ? propertiesKey : (String)localeProperties.getObject(propertiesKey);
        }
        catch (MissingResourceException localMissingResourceException)
        {
          value = propertiesKey;
        }
      }
      localeHeaders.set(key, value);
    }
    localeHeaders.setReadOnly();
    if (isDefaultLocale) {
      defaultLocaleHeaders = localeHeaders;
    }
    return localeHeaders;
  }
  
  private String[] buildNLVariants(String nl)
  {
    List<String> result = new ArrayList();
    while (nl.length() > 0)
    {
      result.add(nl);
      int i = nl.lastIndexOf('_');
      nl = i < 0 ? "" : nl.substring(0, i);
    }
    result.add("");
    return (String[])result.toArray(new String[result.size()]);
  }
  
  ResourceBundle getResourceBundle(String localeString, boolean isDefaultLocale)
  {
    BundleResourceBundle resourceBundle = lookupResourceBundle(localeString);
    if (isDefaultLocale) {
      return (ResourceBundle)resourceBundle;
    }
    if ((resourceBundle == null) || (resourceBundle.isStemEmpty())) {
      return (ResourceBundle)lookupResourceBundle(Locale.getDefault().toString());
    }
    return (ResourceBundle)resourceBundle;
  }
  
  /* Error */
  private BundleResourceBundle lookupResourceBundle(String localeString)
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 246	org/eclipse/osgi/framework/internal/core/ManifestLocalization:rawHeaders	Ljava/util/Dictionary;
    //   4: ldc 4
    //   6: invokevirtual 266	java/util/Dictionary:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   9: checkcast 124	java/lang/String
    //   12: astore_2
    //   13: aload_2
    //   14: ifnonnull +6 -> 20
    //   17: ldc 5
    //   19: astore_2
    //   20: aload_0
    //   21: getfield 247	org/eclipse/osgi/framework/internal/core/ManifestLocalization:cache	Ljava/util/Hashtable;
    //   24: dup
    //   25: astore_3
    //   26: monitorenter
    //   27: aload_0
    //   28: getfield 247	org/eclipse/osgi/framework/internal/core/ManifestLocalization:cache	Ljava/util/Hashtable;
    //   31: aload_1
    //   32: invokevirtual 268	java/util/Hashtable:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   35: checkcast 139	org/eclipse/osgi/framework/internal/core/ManifestLocalization$BundleResourceBundle
    //   38: astore 4
    //   40: aload 4
    //   42: ifnull +22 -> 64
    //   45: aload 4
    //   47: invokeinterface 299 1 0
    //   52: ifeq +7 -> 59
    //   55: aconst_null
    //   56: goto +5 -> 61
    //   59: aload 4
    //   61: aload_3
    //   62: monitorexit
    //   63: areturn
    //   64: aload_0
    //   65: aload_1
    //   66: invokespecial 283	org/eclipse/osgi/framework/internal/core/ManifestLocalization:buildNLVariants	(Ljava/lang/String;)[Ljava/lang/String;
    //   69: astore 5
    //   71: aconst_null
    //   72: astore 6
    //   74: aload 5
    //   76: arraylength
    //   77: iconst_1
    //   78: isub
    //   79: istore 7
    //   81: goto +238 -> 319
    //   84: aconst_null
    //   85: astore 8
    //   87: aload_0
    //   88: new 125	java/lang/StringBuffer
    //   91: dup
    //   92: aload_2
    //   93: invokestatic 258	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   96: invokespecial 260	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   99: aload 5
    //   101: iload 7
    //   103: aaload
    //   104: ldc 1
    //   106: invokevirtual 253	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   109: ifeq +11 -> 120
    //   112: aload 5
    //   114: iload 7
    //   116: aaload
    //   117: goto +26 -> 143
    //   120: new 125	java/lang/StringBuffer
    //   123: dup
    //   124: bipush 95
    //   126: invokestatic 254	java/lang/String:valueOf	(C)Ljava/lang/String;
    //   129: invokespecial 260	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   132: aload 5
    //   134: iload 7
    //   136: aaload
    //   137: invokevirtual 261	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   140: invokevirtual 259	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   143: invokevirtual 261	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   146: ldc 3
    //   148: invokevirtual 261	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   151: invokevirtual 259	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   154: invokespecial 284	org/eclipse/osgi/framework/internal/core/ManifestLocalization:findResource	(Ljava/lang/String;)Ljava/net/URL;
    //   157: astore 9
    //   159: aload 9
    //   161: ifnonnull +23 -> 184
    //   164: aload_0
    //   165: getfield 247	org/eclipse/osgi/framework/internal/core/ManifestLocalization:cache	Ljava/util/Hashtable;
    //   168: aload 5
    //   170: iload 7
    //   172: aaload
    //   173: invokevirtual 268	java/util/Hashtable:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   176: checkcast 139	org/eclipse/osgi/framework/internal/core/ManifestLocalization$BundleResourceBundle
    //   179: astore 8
    //   181: goto +79 -> 260
    //   184: aconst_null
    //   185: astore 10
    //   187: aload 9
    //   189: invokevirtual 262	java/net/URL:openStream	()Ljava/io/InputStream;
    //   192: astore 10
    //   194: new 141	org/eclipse/osgi/framework/internal/core/ManifestLocalization$LocalizationResourceBundle
    //   197: dup
    //   198: aload_0
    //   199: aload 10
    //   201: invokespecial 290	org/eclipse/osgi/framework/internal/core/ManifestLocalization$LocalizationResourceBundle:<init>	(Lorg/eclipse/osgi/framework/internal/core/ManifestLocalization;Ljava/io/InputStream;)V
    //   204: astore 8
    //   206: goto +40 -> 246
    //   209: pop
    //   210: aload 10
    //   212: ifnull +48 -> 260
    //   215: aload 10
    //   217: invokevirtual 249	java/io/InputStream:close	()V
    //   220: goto +40 -> 260
    //   223: pop
    //   224: goto +36 -> 260
    //   227: astore 11
    //   229: aload 10
    //   231: ifnull +12 -> 243
    //   234: aload 10
    //   236: invokevirtual 249	java/io/InputStream:close	()V
    //   239: goto +4 -> 243
    //   242: pop
    //   243: aload 11
    //   245: athrow
    //   246: aload 10
    //   248: ifnull +12 -> 260
    //   251: aload 10
    //   253: invokevirtual 249	java/io/InputStream:close	()V
    //   256: goto +4 -> 260
    //   259: pop
    //   260: aload 8
    //   262: ifnonnull +18 -> 280
    //   265: new 140	org/eclipse/osgi/framework/internal/core/ManifestLocalization$EmptyResouceBundle
    //   268: dup
    //   269: aload_0
    //   270: aload 5
    //   272: iload 7
    //   274: aaload
    //   275: invokespecial 289	org/eclipse/osgi/framework/internal/core/ManifestLocalization$EmptyResouceBundle:<init>	(Lorg/eclipse/osgi/framework/internal/core/ManifestLocalization;Ljava/lang/String;)V
    //   278: astore 8
    //   280: aload 6
    //   282: ifnull +15 -> 297
    //   285: aload 8
    //   287: aload 6
    //   289: checkcast 134	java/util/ResourceBundle
    //   292: invokeinterface 301 2 0
    //   297: aload_0
    //   298: getfield 247	org/eclipse/osgi/framework/internal/core/ManifestLocalization:cache	Ljava/util/Hashtable;
    //   301: aload 5
    //   303: iload 7
    //   305: aaload
    //   306: aload 8
    //   308: invokevirtual 269	java/util/Hashtable:put	(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    //   311: pop
    //   312: aload 8
    //   314: astore 6
    //   316: iinc 7 -1
    //   319: iload 7
    //   321: ifge -237 -> 84
    //   324: aload_0
    //   325: getfield 247	org/eclipse/osgi/framework/internal/core/ManifestLocalization:cache	Ljava/util/Hashtable;
    //   328: aload_1
    //   329: invokevirtual 268	java/util/Hashtable:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   332: checkcast 139	org/eclipse/osgi/framework/internal/core/ManifestLocalization$BundleResourceBundle
    //   335: astore 4
    //   337: aload 4
    //   339: invokeinterface 299 1 0
    //   344: ifeq +7 -> 351
    //   347: aconst_null
    //   348: goto +5 -> 353
    //   351: aload 4
    //   353: aload_3
    //   354: monitorexit
    //   355: areturn
    //   356: aload_3
    //   357: monitorexit
    //   358: athrow
    // Line number table:
    //   Java source line #104	-> byte code offset #0
    //   Java source line #105	-> byte code offset #13
    //   Java source line #106	-> byte code offset #17
    //   Java source line #107	-> byte code offset #20
    //   Java source line #108	-> byte code offset #27
    //   Java source line #109	-> byte code offset #40
    //   Java source line #110	-> byte code offset #45
    //   Java source line #111	-> byte code offset #64
    //   Java source line #112	-> byte code offset #71
    //   Java source line #113	-> byte code offset #74
    //   Java source line #114	-> byte code offset #84
    //   Java source line #115	-> byte code offset #87
    //   Java source line #116	-> byte code offset #159
    //   Java source line #117	-> byte code offset #164
    //   Java source line #119	-> byte code offset #184
    //   Java source line #121	-> byte code offset #187
    //   Java source line #122	-> byte code offset #194
    //   Java source line #123	-> byte code offset #209
    //   Java source line #126	-> byte code offset #210
    //   Java source line #128	-> byte code offset #215
    //   Java source line #129	-> byte code offset #223
    //   Java source line #125	-> byte code offset #227
    //   Java source line #126	-> byte code offset #229
    //   Java source line #128	-> byte code offset #234
    //   Java source line #129	-> byte code offset #242
    //   Java source line #133	-> byte code offset #243
    //   Java source line #126	-> byte code offset #246
    //   Java source line #128	-> byte code offset #251
    //   Java source line #129	-> byte code offset #259
    //   Java source line #136	-> byte code offset #260
    //   Java source line #137	-> byte code offset #265
    //   Java source line #139	-> byte code offset #280
    //   Java source line #140	-> byte code offset #285
    //   Java source line #141	-> byte code offset #297
    //   Java source line #142	-> byte code offset #312
    //   Java source line #113	-> byte code offset #316
    //   Java source line #144	-> byte code offset #324
    //   Java source line #145	-> byte code offset #337
    //   Java source line #107	-> byte code offset #356
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	359	0	this	ManifestLocalization
    //   0	359	1	localeString	String
    //   12	81	2	localizationHeader	String
    //   25	332	3	Ljava/lang/Object;	Object
    //   38	314	4	result	BundleResourceBundle
    //   69	233	5	nlVarients	String[]
    //   72	243	6	parent	BundleResourceBundle
    //   79	241	7	i	int
    //   85	228	8	varientBundle	BundleResourceBundle
    //   157	31	9	varientURL	URL
    //   185	67	10	resourceStream	InputStream
    //   227	17	11	localObject1	Object
    //   209	1	12	localIOException1	IOException
    //   223	1	13	localIOException2	IOException
    //   242	1	14	localIOException3	IOException
    //   259	1	15	localIOException4	IOException
    // Exception table:
    //   from	to	target	type
    //   187	206	209	java/io/IOException
    //   215	220	223	java/io/IOException
    //   187	210	227	finally
    //   234	239	242	java/io/IOException
    //   251	256	259	java/io/IOException
    //   27	63	356	finally
    //   64	355	356	finally
    //   356	358	356	finally
  }
  
  private URL findResource(String resource)
  {
    AbstractBundle searchBundle = bundle;
    if (bundle.isResolved())
    {
      if ((bundle.isFragment()) && (bundle.getHosts() != null))
      {
        searchBundle = bundle.getHosts()[0];
        if (searchBundle.getState() == 1) {
          searchBundle = bundle;
        }
      }
      return findInResolved(resource, searchBundle);
    }
    return searchBundle.getEntry0(resource);
  }
  
  private static URL findInResolved(String filePath, AbstractBundle bundleHost)
  {
    URL result = bundleHost.getEntry0(filePath);
    if (result != null) {
      return result;
    }
    return findInFragments(filePath, bundleHost);
  }
  
  private static URL findInFragments(String filePath, AbstractBundle searchBundle)
  {
    BundleFragment[] fragments = searchBundle.getFragments();
    URL fileURL = null;
    for (int i = 0; (fragments != null) && (i < fragments.length) && (fileURL == null); i++) {
      if (fragments[i].getState() != 1) {
        fileURL = fragments[i].getEntry0(filePath);
      }
    }
    return fileURL;
  }
  
  private class LocalizationResourceBundle
    extends PropertyResourceBundle
    implements ManifestLocalization.BundleResourceBundle
  {
    public LocalizationResourceBundle(InputStream in)
      throws IOException
    {
      super();
    }
    
    public void setParent(ResourceBundle parent)
    {
      super.setParent(parent);
    }
    
    public boolean isEmpty()
    {
      return false;
    }
    
    public boolean isStemEmpty()
    {
      return parent == null;
    }
  }
  
  class EmptyResouceBundle
    extends ResourceBundle
    implements ManifestLocalization.BundleResourceBundle
  {
    private final String localeString;
    
    public EmptyResouceBundle(String locale)
    {
      localeString = locale;
    }
    
    public Enumeration<String> getKeys()
    {
      return null;
    }
    
    protected Object handleGetObject(String arg0)
      throws MissingResourceException
    {
      return null;
    }
    
    public void setParent(ResourceBundle parent)
    {
      super.setParent(parent);
    }
    
    public boolean isEmpty()
    {
      if (parent == null) {
        return true;
      }
      return ((ManifestLocalization.BundleResourceBundle)parent).isEmpty();
    }
    
    public boolean isStemEmpty()
    {
      if (ManifestLocalization.DEFAULT_ROOT.equals(localeString)) {
        return false;
      }
      if (parent == null) {
        return true;
      }
      return ((ManifestLocalization.BundleResourceBundle)parent).isStemEmpty();
    }
  }
  
  private static abstract interface BundleResourceBundle
  {
    public abstract void setParent(ResourceBundle paramResourceBundle);
    
    public abstract boolean isEmpty();
    
    public abstract boolean isStemEmpty();
  }
}

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

import org.eclipse.osgi.util.NLS;

public class Msg
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.osgi.framework.internal.core.ExternalMessages";
  public static String MANIFEST_INVALID_HEADER_EXCEPTION;
  public static String BUNDLE_STATE_CHANGE_EXCEPTION;
  public static String BUNDLE_UNINSTALLED_EXCEPTION;
  public static String BUNDLE_UNRESOLVED_EXCEPTION;
  public static String BUNDLE_UNRESOLVED_STATE_CONFLICT;
  public static String BUNDLE_UNRESOLVED_UNSATISFIED_CONSTRAINT_EXCEPTION;
  public static String BUNDLE_INVALID_ACTIVATOR_EXCEPTION;
  public static String BUNDLE_EXTENSION_PERMISSION;
  public static String SERVICE_ARGUMENT_NULL_EXCEPTION;
  public static String SERVICE_EMPTY_CLASS_LIST_EXCEPTION;
  public static String SERVICE_NOT_INSTANCEOF_CLASS_EXCEPTION;
  public static String SERVICE_FACTORY_NOT_INSTANCEOF_CLASS_EXCEPTION;
  public static String BUNDLE_ACTIVATOR_EXCEPTION;
  public static String BUNDLE_CONTEXT_INVALID_EXCEPTION;
  public static String BUNDLE_READ_EXCEPTION;
  public static String BUNDLE_FRAGMENT_CNFE;
  public static String BUNDLE_FRAGMENT_START;
  public static String BUNDLE_FRAGMENT_STOP;
  public static String BUNDLE_TRANSIENT_START_ERROR;
  public static String BUNDLE_CNFE_NOT_RESOLVED;
  public static String BUNDLE_LOADER_ATTACHMENT_ERROR;
  public static String BUNDLE_NO_CLASSPATH_MATCH;
  public static String FILTER_TERMINATED_ABRUBTLY;
  public static String FILTER_TRAILING_CHARACTERS;
  public static String FILTER_MISSING_LEFTPAREN;
  public static String FILTER_MISSING_RIGHTPAREN;
  public static String FILTER_INVALID_OPERATOR;
  public static String FILTER_MISSING_ATTR;
  public static String FILTER_INVALID_VALUE;
  public static String FILTER_MISSING_VALUE;
  public static String OSGI_SYSTEMBUNDLE_CREATE_EXCEPTION;
  public static String BUNDLE_INSTALL_RECURSION_EXCEPTION;
  public static String BUNDLE_INSTALL_SAME_UNIQUEID;
  public static String OSGI_INTERNAL_ERROR;
  public static String BUNDLE_NOT_IN_FRAMEWORK;
  public static String BUNDLE_REFRESH_FAILURE;
  public static String OSGI_SYSTEMBUNDLE_DESCRIPTION_ERROR;
  public static String SERVICE_ALREADY_UNREGISTERED_EXCEPTION;
  public static String SERVICE_FACTORY_EXCEPTION;
  public static String SERVICE_OBJECT_NULL_EXCEPTION;
  public static String SERVICE_FACTORY_RECURSION;
  public static String STARTLEVEL_EXCEPTION_INVALID_REQUESTED_STARTLEVEL;
  public static String STARTLEVEL_CANT_CHANGE_SYSTEMBUNDLE_STARTLEVEL;
  public static String BUNDLE_SYSTEMBUNDLE_UNINSTALL_EXCEPTION;
  public static String HEADER_DUPLICATE_KEY_EXCEPTION;
  public static String MANIFEST_INVALID_SPACE;
  public static String MANIFEST_INVALID_LINE_NOCOLON;
  public static String MANIFEST_IOEXCEPTION;
  public static String CANNOT_SET_CONTEXTFINDER;
  public static String URL_HANDLER_INCORRECT_TYPE;
  
  static
  {
    NLS.initializeMessages("org.eclipse.osgi.framework.internal.core.ExternalMessages", Msg.class);
  }
}

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

import org.osgi.framework.FrameworkListener;

class PackageAdminImpl$1
  implements Runnable
{
  final PackageAdminImpl this$0;
  
  PackageAdminImpl$1(PackageAdminImpl paramPackageAdminImpl, AbstractBundle[] paramArrayOfAbstractBundle, FrameworkListener[] paramArrayOfFrameworkListener) {}
  
  public void run()
  {
    this$0.doResolveBundles(val$copy, true, val$listeners);
    if (this$0.framework.isForcedRestart()) {
      this$0.framework.shutdown(256);
    }
  }
}

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

import java.util.Comparator;
import org.eclipse.osgi.service.resolver.BundleDelta;
import org.eclipse.osgi.service.resolver.BundleDescription;

class PackageAdminImpl$2
  implements Comparator<BundleDelta>
{
  final PackageAdminImpl this$0;
  
  PackageAdminImpl$2(PackageAdminImpl paramPackageAdminImpl) {}
  
  public int compare(BundleDelta delta0, BundleDelta delta1)
  {
    return (int)(delta0.getBundle().getBundleId() - delta1.getBundle().getBundleId());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.PackageAdminImpl.2
 * 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 org.osgi.framework.Bundle;

class PackageAdminImpl$GetBundleAction
  implements PrivilegedAction<Bundle>
{
  private Class<?> clazz;
  private PackageAdminImpl impl;
  
  public PackageAdminImpl$GetBundleAction(PackageAdminImpl impl, Class<?> clazz)
  {
    this.impl = impl;
    this.clazz = clazz;
  }
  
  public Bundle run()
  {
    return impl.getBundlePriv(clazz);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.PackageAdminImpl.GetBundleAction
 * 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.PrivilegedAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.eclipse.osgi.framework.adaptor.BundleClassLoader;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate;
import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.util.SecureAction;
import org.eclipse.osgi.internal.loader.BundleLoader;
import org.eclipse.osgi.internal.loader.BundleLoaderProxy;
import org.eclipse.osgi.internal.permadmin.SecurityAdmin;
import org.eclipse.osgi.internal.profile.Profile;
import org.eclipse.osgi.service.resolver.BundleDelta;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
import org.eclipse.osgi.service.resolver.HostSpecification;
import org.eclipse.osgi.service.resolver.NativeCodeDescription;
import org.eclipse.osgi.service.resolver.NativeCodeSpecification;
import org.eclipse.osgi.service.resolver.ResolverHookException;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.StateDelta;
import org.eclipse.osgi.service.resolver.StateObjectFactory;
import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.BundlePermission;
import org.osgi.framework.BundleReference;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.Version;
import org.osgi.framework.wiring.FrameworkWiring;
import org.osgi.service.packageadmin.ExportedPackage;
import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.service.packageadmin.RequiredBundle;

public class PackageAdminImpl
  implements PackageAdmin, FrameworkWiring
{
  protected Framework framework;
  
  static
  {
    Class<?> c = GetBundleAction.class;
    c.getName();
  }
  
  static class GetBundleAction
    implements PrivilegedAction<Bundle>
  {
    private Class<?> clazz;
    private PackageAdminImpl impl;
    
    public GetBundleAction(PackageAdminImpl impl, Class<?> clazz)
    {
      this.impl = impl;
      this.clazz = clazz;
    }
    
    public Bundle run()
    {
      return impl.getBundlePriv(clazz);
    }
  }
  
  protected PackageAdminImpl(Framework framework)
  {
    this.framework = framework;
  }
  
  public ExportedPackage[] getExportedPackages(Bundle bundle)
  {
    List<ExportedPackage> allExports = new ArrayList();
    FrameworkAdaptor adaptor = framework.adaptor;
    if (adaptor == null) {
      return null;
    }
    ExportPackageDescription[] allDescriptions = adaptor.getState().getExportedPackages();
    for (int i = 0; i < allDescriptions.length; i++)
    {
      ExportedPackageImpl exportedPackage = createExportedPackage(allDescriptions[i]);
      if (exportedPackage != null) {
        if ((bundle == null) || (exportedPackage.getBundle() == bundle)) {
          allExports.add(exportedPackage);
        }
      }
    }
    return allExports.size() == 0 ? null : (ExportedPackage[])allExports.toArray(new ExportedPackage[allExports.size()]);
  }
  
  private ExportedPackageImpl createExportedPackage(ExportPackageDescription description)
  {
    BundleDescription exporter = description.getExporter();
    if ((exporter == null) || (exporter.getHost() != null)) {
      return null;
    }
    Object userObject = exporter.getUserObject();
    if (!(userObject instanceof BundleLoaderProxy))
    {
      BundleHost bundle = (BundleHost)framework.getBundle(exporter.getBundleId());
      if (bundle == null) {
        return null;
      }
      userObject = bundle.getLoaderProxy();
    }
    return new ExportedPackageImpl(description, (BundleLoaderProxy)userObject);
  }
  
  public ExportedPackage getExportedPackage(String name)
  {
    ExportedPackage[] allExports = getExportedPackages(null);
    if (allExports == null) {
      return null;
    }
    ExportedPackage result = null;
    for (int i = 0; i < allExports.length; i++) {
      if (name.equals(allExports[i].getName())) {
        if (result == null)
        {
          result = allExports[i];
        }
        else
        {
          Version curVersion = result.getVersion();
          Version newVersion = allExports[i].getVersion();
          if (newVersion.compareTo(curVersion) >= 0) {
            result = allExports[i];
          }
        }
      }
    }
    return result;
  }
  
  public ExportedPackage[] getExportedPackages(String name)
  {
    ExportedPackage[] allExports = getExportedPackages(null);
    if (allExports == null) {
      return null;
    }
    List<ExportedPackage> result = new ArrayList(1);
    for (int i = 0; i < allExports.length; i++) {
      if (name.equals(allExports[i].getName())) {
        result.add(allExports[i]);
      }
    }
    return result.size() == 0 ? null : (ExportedPackage[])result.toArray(new ExportedPackage[result.size()]);
  }
  
  public void refreshPackages(Bundle[] input)
  {
    refreshPackages(input, false, null);
  }
  
  public void refreshPackages(Bundle[] input, boolean synchronously, final FrameworkListener[] listeners)
  {
    framework.checkAdminPermission(framework.systemBundle, "resolve");
    if (input != null) {
      synchronized (input)
      {
        AbstractBundle[] copy = new AbstractBundle[input.length];
        System.arraycopy(input, 0, copy, 0, input.length);
      }
    }
    final AbstractBundle[] copy = (AbstractBundle[])null;
    if (synchronously)
    {
      doResolveBundles(copy, true, listeners);
      if (framework.isForcedRestart()) {
        framework.systemBundle.stop();
      }
    }
    else
    {
      Thread refresh = framework.secureAction.createThread(new Runnable()
      {
        public void run()
        {
          doResolveBundles(copy, true, listeners);
          if (framework.isForcedRestart()) {
            framework.shutdown(256);
          }
        }
      }, "Refresh Packages", framework.getContextFinder());
      refresh.start();
    }
  }
  
  public boolean resolveBundles(Bundle[] bundles)
  {
    return resolveBundles(bundles, false);
  }
  
  boolean resolveBundles(Bundle[] bundles, boolean propagateError)
  {
    framework.checkAdminPermission(framework.systemBundle, "resolve");
    if (bundles == null) {
      bundles = framework.getAllBundles();
    }
    try
    {
      doResolveBundles(bundles, false, null);
    }
    catch (ResolverHookException e)
    {
      if (propagateError) {
        throw e;
      }
    }
    for (int i = 0; i < bundles.length; i++) {
      if (!((AbstractBundle)bundles[i]).isResolved()) {
        return false;
      }
    }
    return true;
  }
  
  protected synchronized void doResolveBundles(Bundle[] bundles, boolean refreshPackages, FrameworkListener[] listeners)
  {
    try
    {
      if (Profile.STARTUP) {
        Profile.logEnter("resolve bundles");
      }
      framework.publishBundleEvent(-2147483647, framework.systemBundle);
      State systemState = framework.adaptor.getState();
      BundleDescription[] descriptions = (BundleDescription[])null;
      int numBundles = bundles == null ? 0 : bundles.length;
      if (!refreshPackages)
      {
        List<BundleDescription> resolving = new ArrayList();
        Bundle[] arrayOfBundle;
        int j = (arrayOfBundle = bundles).length;
        for (int i = 0; i < j; i++)
        {
          Bundle bundle = arrayOfBundle[i];
          BundleDescription description = ((AbstractBundle)bundle).getBundleDescription();
          if (((bundle.getState() & 0x2) != 0) && (description != null)) {
            resolving.add(description);
          }
        }
        descriptions = (BundleDescription[])resolving.toArray(new BundleDescription[resolving.size()]);
      }
      else if (numBundles > 0)
      {
        populateLoaders(framework.getAllBundles());
        synchronized (framework.bundles)
        {
          List<BundleDescription> results = new ArrayList(numBundles);
          BundleDelta[] addDeltas = (BundleDelta[])null;
          for (int i = 0; i < numBundles; i++)
          {
            BundleDescription description = ((AbstractBundle)bundles[i]).getBundleDescription();
            if ((description != null) && (description.getBundleId() != 0L) && (!results.contains(description))) {
              results.add(description);
            }
            if (framework.isRefreshDuplicateBSNAllowed())
            {
              AbstractBundle[] sameNames = framework.bundles.getBundles(bundles[i].getSymbolicName());
              if ((sameNames != null) && (sameNames.length > 1))
              {
                if (addDeltas == null) {
                  addDeltas = systemState.getChanges().getChanges(1, false);
                }
                for (int j = 0; j < sameNames.length; j++) {
                  if (sameNames[j] != bundles[i])
                  {
                    BundleDescription sameName = sameNames[j].getBundleDescription();
                    if ((sameName != null) && (sameName.getBundleId() != 0L) && (!results.contains(sameName)) && 
                      (checkExtensionBundle(sameName, addDeltas))) {
                      results.add(sameName);
                    }
                  }
                }
              }
            }
          }
          descriptions = results.size() == 0 ? null : (BundleDescription[])results.toArray(new BundleDescription[results.size()]);
        }
      }
      StateDelta stateDelta = systemState.resolve(descriptions, refreshPackages);
      BundleDelta[] delta = stateDelta.getChanges();
      processDelta(delta, refreshPackages, systemState);
      if (stateDelta.getResovlerHookException() != null) {
        throw stateDelta.getResovlerHookException();
      }
    }
    catch (Throwable t)
    {
      t = t;
      if (Debug.DEBUG_PACKAGEADMIN)
      {
        Debug.println("PackageAdminImpl.doResolveBundles: Error occured :");
        Debug.printStackTrace(t);
      }
      if ((t instanceof RuntimeException)) {
        throw ((RuntimeException)t);
      }
      if ((t instanceof Error)) {
        throw ((Error)t);
      }
      if (Profile.STARTUP) {
        Profile.logExit("resolve bundles");
      }
      if (!framework.isActive()) {
        return;
      }
      framework.publishBundleEvent(Integer.MIN_VALUE, framework.systemBundle);
      if (!refreshPackages) {
        return;
      }
      framework.publishFrameworkEvent(4, framework.systemBundle, null, listeners); return;
    }
    finally
    {
      localObject1 = 
      
        finally;
      if (Profile.STARTUP) {
        Profile.logExit("resolve bundles");
      }
      if (framework.isActive())
      {
        framework.publishBundleEvent(Integer.MIN_VALUE, framework.systemBundle);
        if (refreshPackages) {
          framework.publishFrameworkEvent(4, framework.systemBundle, null, listeners);
        }
      }
      throw ((Throwable)localObject1);
    }
    if (Profile.STARTUP) {
      Profile.logExit("resolve bundles");
    }
    if (framework.isActive())
    {
      framework.publishBundleEvent(Integer.MIN_VALUE, framework.systemBundle);
      if (refreshPackages) {
        framework.publishFrameworkEvent(4, framework.systemBundle, null, listeners);
      }
    }
  }
  
  private void populateLoaders(AbstractBundle[] bundles)
  {
    for (int i = 0; i < bundles.length; i++) {
      if (((bundles[i] instanceof BundleHost)) && (bundles[i].isResolved()))
      {
       
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