org.eclipse.osgi_3.8.2.v20130124-134944

ariable table:
    //   start	length	slot	name	signature
    //   0	179	0	this	FrameworkCommandProvider
    //   0	179	1	intp	CommandInterpreter
    //   6	9	2	nextArg	String
    //   19	92	3	bundle	AbstractBundle
    //   32	139	4	ref	ServiceReference<?>
    //   54	50	5	platformAdmin	org.eclipse.osgi.service.resolver.PlatformAdmin
    //   73	68	6	exports	ExportPackageDescription[]
    //   76	63	7	i	int
    //   149	15	8	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   56	149	149	finally
  }
  
  public Object _help(CommandInterpreter intp)
  {
    String commandName = intp.nextArgument();
    if (commandName == null) {
      return new Boolean(false);
    }
    String help = getHelp(commandName);
    return help.length() > 0 ? help : new Boolean(false);
  }
  
  protected boolean isStartLevelSvcPresent(CommandInterpreter intp)
  {
    boolean retval = false;
    ServiceReference<?> slSvcRef = context.getServiceReference("org.osgi.service.startlevel.StartLevel");
    if (slSvcRef != null)
    {
      StartLevel slSvc = (StartLevel)context.getService(slSvcRef);
      if (slSvc != null) {
        retval = true;
      }
    }
    else
    {
      intp.println(ConsoleMsg.CONSOLE_CAN_NOT_USE_STARTLEVEL_NO_STARTLEVEL_SVC_ERROR);
    }
    return retval;
  }
  
  protected AbstractBundle getBundleFromToken(CommandInterpreter intp, String token, boolean error)
  {
    AbstractBundle bundle = null;
    String symbolicName;
    Version version;
    Bundle[] bundles;
    int i;
    int n;
    try
    {
      long id = Long.parseLong(token);
      bundle = (AbstractBundle)context.getBundle(id);
    }
    catch (NumberFormatException localNumberFormatException)
    {
      symbolicName = token;
      version = null;
      
      int ix = token.indexOf("@");
      if ((ix != -1) && 
        (ix + 1 != token.length())) {
        try
        {
          version = Version.parseVersion(token.substring(ix + 1, token.length()));
          symbolicName = token.substring(0, ix);
        }
        catch (IllegalArgumentException localIllegalArgumentException) {}
      }
      bundles = context.getBundles();
      i = 0;n = bundles.length;
    }
    for (; i < n; i++)
    {
      AbstractBundle b = (AbstractBundle)bundles[i];
      if (((symbolicName.equals(b.getSymbolicName())) && ((version == null) || (version.equals(b.getVersion())))) || (token.equals(b.getLocation())))
      {
        bundle = b;
        break;
      }
    }
    if ((bundle == null) && (error)) {
      intp.println(NLS.bind(ConsoleMsg.CONSOLE_CANNOT_FIND_BUNDLE_ERROR, token));
    }
    return bundle;
  }
  
  protected int getStartLevelFromToken(CommandInterpreter intp, String value)
  {
    int retval = -1;
    try
    {
      retval = Integer.parseInt(value);
      if (Integer.parseInt(value) <= 0) {
        intp.println(ConsoleMsg.STARTLEVEL_POSITIVE_INTEGER);
      }
    }
    catch (NumberFormatException localNumberFormatException)
    {
      intp.println(ConsoleMsg.STARTLEVEL_POSITIVE_INTEGER);
    }
    return retval;
  }
  
  protected String getStateName(Bundle bundle)
  {
    int state = bundle.getState();
    switch (state)
    {
    case 1: 
      return "UNINSTALLED ";
    case 2: 
      if (isDisabled(bundle)) {
        return "<DISABLED>  ";
      }
      return "INSTALLED   ";
    case 4: 
      return "RESOLVED    ";
    case 8: 
      synchronized (lazyActivation)
      {
        if (lazyActivation.contains(bundle)) {
          return "<<LAZY>>    ";
        }
        return "STARTING    ";
      }
    case 16: 
      return "STOPPING    ";
    case 32: 
      return "ACTIVE      ";
    }
    return Integer.toHexString(state);
  }
  
  /* Error */
  private boolean isDisabled(Bundle bundle)
  {
    // Byte code:
    //   0: iconst_0
    //   1: istore_2
    //   2: aconst_null
    //   3: astore_3
    //   4: aload_0
    //   5: getfield 1448	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:context	Lorg/osgi/framework/BundleContext;
    //   8: getstatic 1441	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:class$2	Ljava/lang/Class;
    //   11: dup
    //   12: ifnonnull +29 -> 41
    //   15: pop
    //   16: ldc_w 700
    //   19: invokestatic 1455	java/lang/Class:forName	(Ljava/lang/String;)Ljava/lang/Class;
    //   22: dup
    //   23: putstatic 1441	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:class$2	Ljava/lang/Class;
    //   26: goto +15 -> 41
    //   29: new 748	java/lang/NoClassDefFoundError
    //   32: dup_x1
    //   33: swap
    //   34: invokevirtual 1515	java/lang/Throwable:getMessage	()Ljava/lang/String;
    //   37: invokespecial 1464	java/lang/NoClassDefFoundError:<init>	(Ljava/lang/String;)V
    //   40: athrow
    //   41: invokevirtual 1454	java/lang/Class:getName	()Ljava/lang/String;
    //   44: invokeinterface 1675 2 0
    //   49: astore_3
    //   50: aload_3
    //   51: ifnull +95 -> 146
    //   54: aload_0
    //   55: getfield 1448	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:context	Lorg/osgi/framework/BundleContext;
    //   58: aload_3
    //   59: invokeinterface 1673 2 0
    //   64: checkcast 791	org/eclipse/osgi/service/resolver/PlatformAdmin
    //   67: astore 4
    //   69: aload 4
    //   71: ifnull +75 -> 146
    //   74: aload 4
    //   76: iconst_0
    //   77: invokeinterface 1658 2 0
    //   82: astore 5
    //   84: aload 5
    //   86: aload_1
    //   87: invokeinterface 1666 1 0
    //   92: invokeinterface 1660 3 0
    //   97: astore 6
    //   99: aload 5
    //   101: aload 6
    //   103: invokeinterface 1662 2 0
    //   108: astore 7
    //   110: aload 7
    //   112: ifnull +34 -> 146
    //   115: aload 7
    //   117: arraylength
    //   118: ifeq +28 -> 146
    //   121: iconst_1
    //   122: istore_2
    //   123: goto +23 -> 146
    //   126: astore 8
    //   128: aload_3
    //   129: ifnull +14 -> 143
    //   132: aload_0
    //   133: getfield 1448	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:context	Lorg/osgi/framework/BundleContext;
    //   136: aload_3
    //   137: invokeinterface 1672 2 0
    //   142: pop
    //   143: aload 8
    //   145: athrow
    //   146: aload_3
    //   147: ifnull +14 -> 161
    //   150: aload_0
    //   151: getfield 1448	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:context	Lorg/osgi/framework/BundleContext;
    //   154: aload_3
    //   155: invokeinterface 1672 2 0
    //   160: pop
    //   161: iload_2
    //   162: ireturn
    // Line number table:
    //   Java source line #1891	-> byte code offset #0
    //   Java source line #1892	-> byte code offset #2
    //   Java source line #1894	-> byte code offset #4
    //   Java source line #1895	-> byte code offset #50
    //   Java source line #1896	-> byte code offset #54
    //   Java source line #1897	-> byte code offset #69
    //   Java source line #1898	-> byte code offset #74
    //   Java source line #1899	-> byte code offset #84
    //   Java source line #1900	-> byte code offset #99
    //   Java source line #1901	-> byte code offset #110
    //   Java source line #1902	-> byte code offset #121
    //   Java source line #1906	-> byte code offset #123
    //   Java source line #1907	-> byte code offset #128
    //   Java source line #1908	-> byte code offset #132
    //   Java source line #1909	-> byte code offset #143
    //   Java source line #1907	-> byte code offset #146
    //   Java source line #1908	-> byte code offset #150
    //   Java source line #1910	-> byte code offset #161
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	163	0	this	FrameworkCommandProvider
    //   0	163	1	bundle	Bundle
    //   1	161	2	disabled	boolean
    //   3	152	3	platformAdminRef	ServiceReference<?>
    //   67	8	4	platAdmin	org.eclipse.osgi.service.resolver.PlatformAdmin
    //   82	18	5	state	org.eclipse.osgi.service.resolver.State
    //   97	5	6	bundleDesc	BundleDescription
    //   108	8	7	disabledInfos	org.eclipse.osgi.service.resolver.DisabledInfo[]
    //   126	18	8	localObject	Object
    //   29	1	9	localClassNotFoundException	ClassNotFoundException
    // Exception table:
    //   from	to	target	type
    //   16	22	29	java/lang/ClassNotFoundException
    //   4	126	126	finally
  }
  
  protected ThreadGroup[] getThreadGroups()
  {
    ThreadGroup tg = getTopThreadGroup();
    ThreadGroup[] groups = new ThreadGroup[tg.activeGroupCount()];
    int count = tg.enumerate(groups, true);
    if (count == groups.length) {
      return groups;
    }
    ThreadGroup[] ngroups = new ThreadGroup[count];
    System.arraycopy(groups, 0, ngroups, 0, count);
    return ngroups;
  }
  
  protected ThreadGroup getTopThreadGroup()
  {
    ThreadGroup topGroup = Thread.currentThread().getThreadGroup();
    if (topGroup != null) {
      while (topGroup.getParent() != null) {
        topGroup = topGroup.getParent();
      }
    }
    return topGroup;
  }
  
  public String simpleClassName(Object o)
  {
    StringTokenizer t = new StringTokenizer(o.getClass().getName(), ".");
    int ct = t.countTokens();
    for (int i = 1; i < ct; i++) {
      t.nextToken();
    }
    return t.nextToken();
  }
  
  public void _getprop(CommandInterpreter ci)
    throws Exception
  {
    Properties allProperties = FrameworkProperties.getProperties();
    String filter = ci.nextArgument();
    Iterator<?> propertyNames = new TreeSet(allProperties.keySet()).iterator();
    while (propertyNames.hasNext())
    {
      String prop = (String)propertyNames.next();
      if ((filter == null) || (prop.startsWith(filter))) {
        ci.println(prop + '=' + allProperties.getProperty(prop));
      }
    }
  }
  
  public void bundleChanged(BundleEvent event)
  {
    int type = event.getType();
    Bundle bundle = event.getBundle();
    synchronized (lazyActivation)
    {
      switch (type)
      {
      case 512: 
        if (!lazyActivation.contains(bundle)) {
          lazyActivation.add(bundle);
        }
        break;
      default: 
        lazyActivation.remove(bundle);
      }
    }
  }
}

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

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import org.eclipse.osgi.framework.console.CommandInterpreter;
import org.eclipse.osgi.framework.console.CommandProvider;
import org.eclipse.osgi.framework.console.ConsoleSession;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;

public class FrameworkConsole
  implements Runnable
{
  private final BufferedReader in;
  private final PrintWriter out;
  private final BundleContext context;
  private final ServiceTracker<CommandProvider, CommandProvider> cptracker;
  private final ConsoleSession consoleSession;
  private final boolean isSystemInOut;
  static final String defaultEncoding = "iso8859-1";
  static final String encoding = FrameworkProperties.getProperty("osgi.console.encoding", FrameworkProperties.getProperty("file.encoding", "iso8859-1"));
  private static final boolean blockOnready = (FrameworkProperties.getProperty("osgi.dev") != null) || (FrameworkProperties.getProperty("osgi.console.blockOnReady") != null);
  volatile boolean shutdown = false;
  
  public FrameworkConsole(BundleContext context, ConsoleSession consoleSession, boolean isSystemInOut, ServiceTracker<CommandProvider, CommandProvider> cptracker)
  {
    this.context = context;
    this.cptracker = cptracker;
    this.isSystemInOut = isSystemInOut;
    this.consoleSession = consoleSession;
    in = createBufferedReader(consoleSession.getInput());
    out = createPrintWriter(consoleSession.getOutput());
  }
  
  static BufferedReader createBufferedReader(InputStream _in)
  {
    BufferedReader reader;
    try
    {
      reader = new BufferedReader(new InputStreamReader(_in, encoding));
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException)
    {
      BufferedReader reader;
      reader = new BufferedReader(new InputStreamReader(_in));
    }
    return reader;
  }
  
  static PrintWriter createPrintWriter(OutputStream _out)
  {
    PrintWriter writer;
    try
    {
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(_out, encoding)), true);
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException)
    {
      PrintWriter writer;
      writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(_out)), true);
    }
    return writer;
  }
  
  public PrintWriter getWriter()
  {
    return out;
  }
  
  /* Error */
  public void run()
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 252	org/eclipse/osgi/framework/internal/core/FrameworkConsole:runConsole	()V
    //   4: goto +10 -> 14
    //   7: astore_1
    //   8: aload_0
    //   9: invokevirtual 253	org/eclipse/osgi/framework/internal/core/FrameworkConsole:shutdown	()V
    //   12: aload_1
    //   13: athrow
    //   14: aload_0
    //   15: invokevirtual 253	org/eclipse/osgi/framework/internal/core/FrameworkConsole:shutdown	()V
    //   18: return
    // Line number table:
    //   Java source line #104	-> byte code offset #0
    //   Java source line #105	-> byte code offset #4
    //   Java source line #107	-> byte code offset #8
    //   Java source line #108	-> byte code offset #12
    //   Java source line #107	-> byte code offset #14
    //   Java source line #109	-> byte code offset #18
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	19	0	this	FrameworkConsole
    //   7	6	1	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   0	7	7	finally
  }
  
  private void runConsole()
  {
    String consolePrompt = "\r\n" + ConsoleMsg.CONSOLE_PROMPT;
    while (!shutdown)
    {
      out.print(consolePrompt);
      out.flush();
      
      String cmdline = null;
      try
      {
        if ((blockOnready) && (isSystemInOut)) {
          try
          {
            while (!in.ready()) {
              Thread.sleep(300L);
            }
            cmdline = in.readLine();
          }
          catch (InterruptedException localInterruptedException) {}
        } else {
          cmdline = in.readLine();
        }
      }
      catch (IOException ioe)
      {
        if (!shutdown) {
          ioe.printStackTrace(out);
        }
      }
      if (cmdline == null) {
        break;
      }
      if (!shutdown) {
        docommand(cmdline);
      }
    }
  }
  
  protected void docommand(String cmdline)
  {
    if ((cmdline != null) && (cmdline.length() > 0))
    {
      CommandInterpreter intcp = new FrameworkCommandInterpreter(cmdline, getServices(), this);
      String command = intcp.nextArgument();
      if (command != null) {
        intcp.execute(command);
      }
    }
  }
  
  public String getInput()
  {
    String input;
    try
    {
      String input = in.readLine();
      System.out.println("<" + input + ">");
    }
    catch (IOException localIOException)
    {
      input = "";
    }
    return input;
  }
  
  public CommandProvider[] getServices()
  {
    ServiceReference[] serviceRefs = cptracker.getServiceReferences();
    if (serviceRefs == null) {
      return new CommandProvider[0];
    }
    Util.dsort(serviceRefs, 0, serviceRefs.length);
    
    CommandProvider[] serviceObjects = new CommandProvider[serviceRefs.length];
    for (int i = 0; i < serviceRefs.length; i++) {
      serviceObjects[i] = ((CommandProvider)context.getService(serviceRefs[i]));
    }
    return serviceObjects;
  }
  
  public synchronized void shutdown()
  {
    if (shutdown) {
      return;
    }
    shutdown = true;
    consoleSession.close();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.FrameworkConsole
 * 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.io.OutputStream;
import java.net.Socket;
import org.eclipse.osgi.framework.console.ConsoleSession;

public class FrameworkConsoleSession
  extends ConsoleSession
{
  private final Socket s;
  private final InputStream in;
  private final OutputStream out;
  
  public FrameworkConsoleSession(InputStream in, OutputStream out, Socket s)
  {
    this.in = in;
    this.out = out;
    this.s = s;
  }
  
  public synchronized InputStream getInput()
  {
    return in;
  }
  
  public synchronized OutputStream getOutput()
  {
    return out;
  }
  
  public void doClose()
  {
    if (s != null) {
      try
      {
        s.close();
      }
      catch (IOException localIOException1) {}
    }
    if (out != null) {
      try
      {
        out.close();
      }
      catch (IOException localIOException2) {}
    }
    if (in != null) {
      try
      {
        in.close();
      }
      catch (IOException localIOException3) {}
    }
  }
}

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

import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLDecoder;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.PropertyPermission;
import java.util.Set;
import org.eclipse.core.runtime.internal.adaptor.EclipseAdaptorMsg;
import org.eclipse.osgi.util.NLS;

public class FrameworkProperties
{
  private static Properties properties;
  private static final String USING_SYSTEM_PROPERTIES_KEY = "osgi.framework.useSystemProperties";
  private static final String PROP_FRAMEWORK = "osgi.framework";
  private static final String PROP_INSTALL_AREA = "osgi.install.area";
  
  public static Properties getProperties()
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
      sm.checkPropertiesAccess();
    }
    return internalGetProperties(null);
  }
  
  public static String getProperty(String key)
  {
    return getProperty(key, null);
  }
  
  public static String getProperty(String key, String defaultValue)
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
      sm.checkPropertyAccess(key);
    }
    return internalGetProperties(null).getProperty(key, defaultValue);
  }
  
  public static String setProperty(String key, String value)
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
      sm.checkPermission(new PropertyPermission(key, "write"));
    }
    return (String)internalGetProperties(null).put(key, value);
  }
  
  public static String clearProperty(String key)
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
      sm.checkPermission(new PropertyPermission(key, "write"));
    }
    return (String)internalGetProperties(null).remove(key);
  }
  
  private static synchronized Properties internalGetProperties(String usingSystemProperties)
  {
    if (properties == null)
    {
      Properties systemProperties = System.getProperties();
      if (usingSystemProperties == null) {
        usingSystemProperties = systemProperties.getProperty("osgi.framework.useSystemProperties");
      }
      if ((usingSystemProperties == null) || (usingSystemProperties.equalsIgnoreCase(Boolean.TRUE.toString())))
      {
        properties = systemProperties;
      }
      else
      {
        properties = new Properties();
        synchronized (systemProperties)
        {
          properties.putAll(systemProperties);
        }
      }
    }
    return properties;
  }
  
  public static synchronized void setProperties(Map<String, String> input)
  {
    if (input == null)
    {
      internalGetProperties("false");
      return;
    }
    properties = null;
    Properties toSet = internalGetProperties("false");
    for (Iterator<String> keys = input.keySet().iterator(); keys.hasNext();)
    {
      String key = (String)keys.next();
      Object value = input.get(key);
      if ((value instanceof String))
      {
        toSet.setProperty(key, (String)value);
      }
      else
      {
        value = input.get(key);
        if (value != null) {
          toSet.put(key, value);
        } else {
          toSet.remove(key);
        }
      }
    }
  }
  
  public static synchronized boolean inUse()
  {
    return properties != null;
  }
  
  public static void initializeProperties()
  {
    if ((getProperty("osgi.framework") == null) || (getProperty("osgi.install.area") == null))
    {
      CodeSource cs = FrameworkProperties.class.getProtectionDomain().getCodeSource();
      if (cs == null) {
        throw new IllegalArgumentException(NLS.bind(EclipseAdaptorMsg.ECLIPSE_STARTUP_PROPS_NOT_SET, "osgi.framework, osgi.install.area"));
      }
      URL url = cs.getLocation();
      if (getProperty("osgi.framework") == null) {
        setProperty("osgi.framework", url.toExternalForm());
      }
      if (getProperty("osgi.install.area") == null)
      {
        String filePart = url.getFile();
        setProperty("osgi.install.area", filePart.substring(0, filePart.lastIndexOf('/')));
      }
    }
    setProperty("osgi.framework", decode(getProperty("osgi.framework")));
    setProperty("osgi.install.area", decode(getProperty("osgi.install.area")));
  }
  
  public static String decode(String urlString)
  {
    try
    {
      Class<? extends URLDecoder> clazz = URLDecoder.class;
      Method method = clazz.getDeclaredMethod("decode", new Class[] { String.class, String.class });
      if (urlString.indexOf('+') >= 0)
      {
        int len = urlString.length();
        StringBuffer buf = new StringBuffer(len);
        for (int i = 0; i < len; i++)
        {
          char c = urlString.charAt(i);
          if (c == '+') {
            buf.append("%2B");
          } else {
            buf.append(c);
          }
        }
        urlString = buf.toString();
      }
      Object result = method.invoke(null, new Object[] { urlString, "UTF-8" });
      if (result != null) {
        return (String)result;
      }
    }
    catch (Exception localException)
    {
      boolean replaced = false;
      byte[] encodedBytes = urlString.getBytes();
      int encodedLength = encodedBytes.length;
      byte[] decodedBytes = new byte[encodedLength];
      int decodedLength = 0;
      for (int i = 0; i < encodedLength; i++)
      {
        byte b = encodedBytes[i];
        if (b == 37)
        {
          byte enc1 = encodedBytes[(++i)];
          byte enc2 = encodedBytes[(++i)];
          b = (byte)((hexToByte(enc1) << 4) + hexToByte(enc2));
          replaced = true;
        }
        decodedBytes[(decodedLength++)] = b;
      }
      if (!replaced) {
        return urlString;
      }
      try
      {
        return new String(decodedBytes, 0, decodedLength, "UTF-8");
      }
      catch (UnsupportedEncodingException localUnsupportedEncodingException) {}
      return new String(decodedBytes, 0, decodedLength);
    }
  }
  
  private static int hexToByte(byte b)
  {
    switch (b)
    {
    case 48: 
      return 0;
    case 49: 
      return 1;
    case 50: 
      return 2;
    case 51: 
      return 3;
    case 52: 
      return 4;
    case 53: 
      return 5;
    case 54: 
      return 6;
    case 55: 
      return 7;
    case 56: 
      return 8;
    case 57: 
      return 9;
    case 65: 
    case 97: 
      return 10;
    case 66: 
    case 98: 
      return 11;
    case 67: 
    case 99: 
      return 12;
    case 68: 
    case 100: 
      return 13;
    case 69: 
    case 101: 
      return 14;
    case 70: 
    case 102: 
      return 15;
    }
    throw new IllegalArgumentException("Switch error decoding URL");
  }
}

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

class InternalSystemBundle$1
  implements Runnable
{
  final InternalSystemBundle this$0;
  
  InternalSystemBundle$1(InternalSystemBundle paramInternalSystemBundle) {}
  
  public void run()
  {
    try
    {
      this$0.framework.close();
    }
    catch (Throwable t)
    {
      this$0.framework.adaptor.handleRuntimeError(t);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.InternalSystemBundle.1
 * 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 InternalSystemBundle$2
  implements Runnable
{
  final InternalSystemBundle this$0;
  
  InternalSystemBundle$2(InternalSystemBundle paramInternalSystemBundle) {}
  
  public void run()
  {
    int sl = this$0.framework.startLevelManager.getStartLevel();
    FrameworkProperties.setProperty("osgi.framework.relaunch", "");
    this$0.framework.shutdown(128);
    this$0.framework.launch();
    if (sl > 0) {
      this$0.framework.startLevelManager.doSetStartLevel(sl, new FrameworkListener[0]);
    }
    FrameworkProperties.clearProperty("osgi.framework.relaunch");
  }
}

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

import org.osgi.framework.Bundle;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.startlevel.FrameworkStartLevel;

class InternalSystemBundle$EquinoxStartLevel
  implements FrameworkStartLevel
{
  final InternalSystemBundle this$0;
  
  InternalSystemBundle$EquinoxStartLevel(InternalSystemBundle paramInternalSystemBundle) {}
  
  public void setStartLevel(int startlevel, FrameworkListener[] listeners)
  {
    this$0.framework.startLevelManager.setStartLevel(startlevel, this$0, listeners);
  }
  
  public int getInitialBundleStartLevel()
  {
    return this$0.framework.startLevelManager.getInitialBundleStartLevel();
  }
  
  public void setInitialBundleStartLevel(int startlevel)
  {
    this$0.framework.startLevelManager.setInitialBundleStartLevel(startlevel);
  }
  
  public Bundle getBundle()
  {
    return this$0;
  }
  
  public int getStartLevel()
  {
    return this$0.framework.startLevelManager.getStartLevel();
  }
}

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

import java.util.Dictionary;
import java.util.Enumeration;

class InternalSystemBundle$SystemBundleHeaders
  extends Dictionary<String, String>
{
  private final Dictionary<String, String> headers;
  final InternalSystemBundle this$0;
  
  public InternalSystemBundle$SystemBundleHeaders(Dictionary<String, String> arg1)
  {
    this.headers = headers;
  }
  
  public Enumeration<String> elements()
  {
    return headers.elements();
  }
  
  public String get(Object key)
  {
    if (!(key instanceof String)) {
      return null;
    }
    if ("Export-Package".equalsIgnoreCase((String)key)) {
      return getExtra("Export-Package", "org.osgi.framework.system.packages", "org.osgi.framework.system.packages.extra");
    }
    if ("Provide-Capability".equalsIgnoreCase((String)key)) {
      return getExtra("Provide-Capability", "org.osgi.framework.system.capabilities", "org.osgi.framework.system.capabilities.extra");
    }
    return (String)headers.get(key);
  }
  
  private String getExtra(String header, String systemProp, String systemExtraProp)
  {
    String systemValue = FrameworkProperties.getProperty(systemProp);
    String systemExtraValue = FrameworkProperties.getProperty(systemExtraProp);
    if (systemValue == null) {
      systemValue = systemExtraValue;
    } else if ((systemExtraValue != null) && (systemExtraValue.trim().length() > 0)) {
      systemValue = systemValue + ", " + systemExtraValue;
    }
    String result = (String)headers.get(header);
    if ((systemValue != null) && (systemValue.trim().length() > 0)) {
      if (result != null) {
        result = result + ", " + systemValue;
      } else {
        result = systemValue;
      }
    }
    return result;
  }
  
  public boolean isEmpty()
  {
    return headers.isEmpty();
  }
  
  public Enumeration<String> keys()
  {
    return headers.keys();
  }
  
  public String put(String key, String value)
  {
    return (String)headers.put(key, value);
  }
  
  public String remove(Object key)
  {
    return (String)headers.remove(key);
  }
  
  public int size()
  {
    return headers.size();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.framework.internal.core.InternalSystemBundle.SystemBundleHeaders
 * 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.security.Permission;
import java.security.ProtectionDomain;
import java.util.Dictionary;
import java.util.Enumeration;
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.util.SecureAction;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.startlevel.FrameworkStartLevel;
import org.osgi.framework.wiring.FrameworkWiring;

public class InternalSystemBundle
  extends BundleHost
  implements org.osgi.framework.launch.Framework
{
  private final FrameworkStartLevel fsl;
  ProtectionDomain systemDomain;
  
  class SystemBundleHeaders
    extends Dictionary<String, String>
  {
    private final Dictionary<String, String> headers;
    
    public SystemBundleHeaders()
    {
      this.headers = headers;
    }
    
    public Enumeration<String> elements()
    {
      return headers.elements();
    }
    
    public String get(Object key)
    {
      if (!(key instanceof String)) {
        return null;
      }
      if ("Export-Package".equalsIgnoreCase((String)key)) {
        return getExtra("Export-Package", "org.osgi.framework.system.packages", "org.osgi.framework.system.packages.extra");
      }
      if ("Provide-Capability".equalsIgnoreCase((String)key)) {
        return getExtra("Provide-Capability", "org.osgi.framework.system.capabilities", "org.osgi.framework.system.capabilities.extra");
      }
      return (String)headers.get(key);
    }
    
    private String getExtra(String header, String systemProp, String systemExtraProp)
    {
      String systemValue = FrameworkProperties.getProperty(systemProp);
      String systemExtraValue = FrameworkProperties.getProperty(systemExtraProp);
      if (systemValue == null) {
        systemValue = systemExtraValue;
      } else if ((systemExtraValue != null) && (systemExtraValue.trim().length() > 0)) {
        systemValue = systemValue + ", " + systemExtraValue;
      }
      String result = (String)headers.get(header);
      if ((systemValue != null) && (systemValue.trim().length() > 0)) {
        if (result != null) {
          result = result + ", " + systemValue;
        } else {
          result = systemValue;
        }
      }
      return result;
    }
    
    public boolean isEmpty()
    {
      return headers.isEmpty();
    }
    
    public Enumeration<String> keys()
    {
      return headers.keys();
    }
    
    public String put(String key, String value)
    {
      return (String)headers.put(key, value);
    }
    
    public String remove(Object key)
    {
      return (String)headers.remove(key);
    }
    
    public int size()
    {
      return headers.size();
    }
  }
  
  protected InternalSystemBundle(Framework framework)
    throws BundleException
  {
    super(adaptor.createSystemBundleData(), framework);
    Constants.setInternalSymbolicName(bundledata.getSymbolicName());
    state = 4;
    context = createContext();
    fsl = new EquinoxStartLevel();
  }
  
  protected void load()
  {
    SecurityManager sm = System.getSecurityManager();
    if (sm != null) {
      systemDomain = getClass().getProtectionDomain();
    }
  }
  
  protected boolean reload(AbstractBundle newBundle)
  {
    return false;
  }
  
  protected void refresh() {}
  
  protected boolean unload()
  {
    return false;
  }
  
  protected void close()
  {
    context.close();
    context = null;
  }
  
  protected Class<?> loadClass(String name, boolean checkPermission)
    throws ClassNotFoundException
  {
    if (checkPermission)
    {
      framework.checkAdminPermission(this, "class");
      checkValid();
    }
    return Class.forName(name);
  }
  
  public URL getResource(String name)
  {
    return null;
  }
  
  protected boolean isUnresolved()
  {
    return false;
  }
  
  public void start()
  {
    framework.checkAdminPermission(this, "execute");
  }
  
  public void start(int options)
  {
    framework.checkAdminPermission(this, "execute");
  }
  
  protected void resume()
  {
    framework.startLevelManager.initialize();
    
    loadInstalledBundles(framework.startLevelManager.getInstalledBundles(framework.bundles, false));
    try
    {
      framework.systemBundle.state = 8;
      framework.systemBundle.context.start();
      framework.publishBundleEvent(128, framework.systemBundle);
    }
    catch (BundleException be)
    {
      if (Debug.DEBUG_STARTLEVEL)
      {
        Debug.println("SLL: Bundle resume exception: " + be.getMessage());
        Debug.printStackTrace(be.getNestedException() == null ? be : be.getNestedException());
      }
      framework.publishFrameworkEvent(2, framework.systemBundle, be);
      throw new RuntimeException(be.getMessage(), be);
    }
  }
  
  private void loadInstalledBundles(AbstractBundle[] installedBundles)
  {
    for (int i = 0; i < installedBundles.length; i++)
    {
      AbstractBundle bundle = installedBundles[i];
      if (Debug.DEBUG_STARTLEVEL) {
        Debug.println("SLL: Trying to load bundle " + bundle);
      }
      bundle.load();
    }
  }
  
  public void stop()
  {
    framework.checkAdminPermission(this, "execute");
    if ((state & 0x28) != 0)
    {
      Thread shutdown = Framework.secureAction.createThread(new Runnable()
      {
        public void run()
        {
          try
          {
            framework.close();
          }
          catch (Throwable t)
          {
            framework.adaptor.handleRuntimeError(t);
          }
        }
      }, "System Bundle Shutdown", framework.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.Collections;
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 Collections.enumeration(Collections.EMPTY_LIST);
  }
  
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