org.eclipse.osgi_3.7.2.v20120110-1415

t #171
    //   Java source line #859	-> byte code offset #176
    //   Java source line #860	-> byte code offset #185
    //   Java source line #861	-> byte code offset #194
    //   Java source line #862	-> byte code offset #200
    //   Java source line #863	-> byte code offset #209
    //   Java source line #861	-> byte code offset #220
    //   Java source line #866	-> byte code offset #234
    //   Java source line #867	-> byte code offset #243
    //   Java source line #870	-> byte code offset #252
    //   Java source line #871	-> byte code offset #258
    //   Java source line #872	-> byte code offset #263
    //   Java source line #873	-> byte code offset #272
    //   Java source line #874	-> byte code offset #281
    //   Java source line #875	-> byte code offset #287
    //   Java source line #876	-> byte code offset #296
    //   Java source line #874	-> byte code offset #307
    //   Java source line #879	-> byte code offset #321
    //   Java source line #880	-> byte code offset #330
    //   Java source line #883	-> byte code offset #339
    //   Java source line #884	-> byte code offset #353
    //   Java source line #885	-> byte code offset #358
    //   Java source line #886	-> byte code offset #364
    //   Java source line #887	-> byte code offset #369
    //   Java source line #889	-> byte code offset #372
    //   Java source line #890	-> byte code offset #381
    //   Java source line #891	-> byte code offset #392
    //   Java source line #892	-> byte code offset #401
    //   Java source line #894	-> byte code offset #413
    //   Java source line #896	-> byte code offset #416
    //   Java source line #897	-> byte code offset #422
    //   Java source line #898	-> byte code offset #427
    //   Java source line #899	-> byte code offset #436
    //   Java source line #900	-> byte code offset #445
    //   Java source line #902	-> byte code offset #448
    //   Java source line #903	-> byte code offset #457
    //   Java source line #904	-> byte code offset #473
    //   Java source line #905	-> byte code offset #482
    //   Java source line #906	-> byte code offset #498
    //   Java source line #907	-> byte code offset #507
    //   Java source line #908	-> byte code offset #517
    //   Java source line #910	-> byte code offset #529
    //   Java source line #896	-> byte code offset #538
    //   Java source line #914	-> byte code offset #549
    //   Java source line #915	-> byte code offset #554
    //   Java source line #916	-> byte code offset #563
    //   Java source line #919	-> byte code offset #572
    //   Java source line #920	-> byte code offset #575
    //   Java source line #921	-> byte code offset #580
    //   Java source line #924	-> byte code offset #589
    //   Java source line #925	-> byte code offset #598
    //   Java source line #926	-> byte code offset #604
    //   Java source line #927	-> byte code offset #616
    //   Java source line #928	-> byte code offset #622
    //   Java source line #927	-> byte code offset #635
    //   Java source line #925	-> byte code offset #646
    //   Java source line #934	-> byte code offset #657
    //   Java source line #935	-> byte code offset #667
    //   Java source line #936	-> byte code offset #676
    //   Java source line #938	-> byte code offset #692
    //   Java source line #939	-> byte code offset #698
    //   Java source line #938	-> byte code offset #708
    //   Java source line #942	-> byte code offset #719
    //   Java source line #943	-> byte code offset #724
    //   Java source line #944	-> byte code offset #730
    //   Java source line #943	-> byte code offset #750
    //   Java source line #947	-> byte code offset #768
    //   Java source line #951	-> byte code offset #777
    //   Java source line #952	-> byte code offset #783
    //   Java source line #955	-> byte code offset #805
    //   Java source line #957	-> byte code offset #814
    //   Java source line #958	-> byte code offset #820
    //   Java source line #959	-> byte code offset #842
    //   Java source line #960	-> byte code offset #855
    //   Java source line #962	-> byte code offset #871
    //   Java source line #963	-> byte code offset #893
    //   Java source line #967	-> byte code offset #896
    //   Java source line #968	-> byte code offset #902
    //   Java source line #969	-> byte code offset #920
    //   Java source line #967	-> byte code offset #923
    //   Java source line #973	-> byte code offset #934
    //   Java source line #974	-> byte code offset #939
    //   Java source line #957	-> byte code offset #952
    //   Java source line #979	-> byte code offset #963
    //   Java source line #981	-> byte code offset #974
    //   Java source line #982	-> byte code offset #994
    //   Java source line #983	-> byte code offset #1001
    //   Java source line #987	-> byte code offset #1004
    //   Java source line #988	-> byte code offset #1009
    //   Java source line #989	-> byte code offset #1018
    //   Java source line #992	-> byte code offset #1027
    //   Java source line #993	-> byte code offset #1043
    //   Java source line #994	-> byte code offset #1048
    //   Java source line #995	-> byte code offset #1057
    //   Java source line #996	-> byte code offset #1070
    //   Java source line #997	-> byte code offset #1080
    //   Java source line #998	-> byte code offset #1085
    //   Java source line #999	-> byte code offset #1094
    //   Java source line #1000	-> byte code offset #1100
    //   Java source line #1001	-> byte code offset #1109
    //   Java source line #999	-> byte code offset #1120
    //   Java source line #1004	-> byte code offset #1134
    //   Java source line #1007	-> byte code offset #1146
    //   Java source line #1008	-> byte code offset #1156
    //   Java source line #1009	-> byte code offset #1161
    //   Java source line #1010	-> byte code offset #1170
    //   Java source line #1011	-> byte code offset #1176
    //   Java source line #1012	-> byte code offset #1185
    //   Java source line #1010	-> byte code offset #1196
    //   Java source line #1015	-> byte code offset #1210
    //   Java source line #1019	-> byte code offset #1219
    //   Java source line #1020	-> byte code offset #1229
    //   Java source line #1021	-> byte code offset #1232
    //   Java source line #1022	-> byte code offset #1237
    //   Java source line #1023	-> byte code offset #1243
    //   Java source line #1024	-> byte code offset #1257
    //   Java source line #1025	-> byte code offset #1264
    //   Java source line #1022	-> byte code offset #1267
    //   Java source line #1030	-> byte code offset #1278
    //   Java source line #1031	-> byte code offset #1283
    //   Java source line #1032	-> byte code offset #1292
    //   Java source line #1034	-> byte code offset #1304
    //   Java source line #1035	-> byte code offset #1313
    //   Java source line #1036	-> byte code offset #1322
    //   Java source line #1037	-> byte code offset #1331
    //   Java source line #1038	-> byte code offset #1339
    //   Java source line #1039	-> byte code offset #1349
    //   Java source line #1041	-> byte code offset #1361
    //   Java source line #1044	-> byte code offset #1370
    //   Java source line #1045	-> byte code offset #1373
    //   Java source line #1046	-> byte code offset #1379
    //   Java source line #1047	-> byte code offset #1389
    //   Java source line #1049	-> byte code offset #1392
    //   Java source line #1050	-> byte code offset #1404
    //   Java source line #1051	-> byte code offset #1409
    //   Java source line #1053	-> byte code offset #1412
    //   Java source line #1054	-> byte code offset #1418
    //   Java source line #1055	-> byte code offset #1427
    //   Java source line #1056	-> byte code offset #1432
    //   Java source line #1057	-> byte code offset #1441
    //   Java source line #1058	-> byte code offset #1450
    //   Java source line #1060	-> byte code offset #1453
    //   Java source line #1061	-> byte code offset #1462
    //   Java source line #1063	-> byte code offset #1473
    //   Java source line #1064	-> byte code offset #1485
    //   Java source line #1065	-> byte code offset #1494
    //   Java source line #1066	-> byte code offset #1502
    //   Java source line #1053	-> byte code offset #1511
    //   Java source line #1045	-> byte code offset #1522
    //   Java source line #1070	-> byte code offset #1533
    //   Java source line #1071	-> byte code offset #1538
    //   Java source line #1072	-> byte code offset #1547
    //   Java source line #1076	-> byte code offset #1559
    //   Java source line #1077	-> byte code offset #1561
    //   Java source line #1078	-> byte code offset #1573
    //   Java source line #1077	-> byte code offset #1576
    //   Java source line #1081	-> byte code offset #1591
    //   Java source line #1082	-> byte code offset #1600
    //   Java source line #1085	-> byte code offset #1609
    //   Java source line #1086	-> byte code offset #1614
    //   Java source line #1087	-> byte code offset #1619
    //   Java source line #1089	-> byte code offset #1625
    //   Java source line #1092	-> byte code offset #1633
    //   Java source line #837	-> byte code offset #1640
    //   Java source line #1094	-> byte code offset #1644
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	1645	0	this	FrameworkCommandProvider
    //   0	1645	1	intp	CommandInterpreter
    //   6	1635	2	nextArg	String
    //   30	1590	3	bundle	AbstractBundle
    //   39	62	4	id	long
    //   118	12	6	dataRoot	File
    //   169	144	6	services	ServiceReference[]
    //   134	7	7	root	String
    //   195	29	7	j	int
    //   282	29	7	j	int
    //   351	1230	7	packageAdminRef	ServiceReference<?>
    //   362	613	8	desc	BundleDescription
    //   1612	3	8	sm	SecurityManager
    //   370	1164	9	title	boolean
    //   1623	4	9	domain	java.security.ProtectionDomain
    //   379	165	10	exports	ExportPackageDescription[]
    //   417	125	11	i	int
    //   587	169	11	fragmentsImportPackages	List<ImportPackageSpecification>
    //   1041	179	11	packageAdmin	PackageAdmin
    //   596	56	12	fragments	BundleDescription[]
    //   1078	48	12	hosts	Bundle[]
    //   1154	48	12	fragments	Bundle[]
    //   1227	301	12	requiredBundles	org.osgi.service.packageadmin.RequiredBundle[]
    //   599	51	13	i	int
    //   690	41	13	importPackages	ImportPackageSpecification[]
    //   775	183	13	importPackages	ImportPackageSpecification[]
    //   1095	29	13	i	int
    //   1171	29	13	i	int
    //   1230	155	13	requiredBundle	org.osgi.service.packageadmin.RequiredBundle
    //   614	27	14	fragmentImports	ImportPackageSpecification[]
    //   674	46	14	directImportPackages	ImportPackageSpecification[]
    //   781	184	14	imports	ExportPackageDescription[]
    //   1238	33	14	i	int
    //   1374	152	14	i	int
    //   617	22	15	j	int
    //   693	19	15	i	int
    //   722	11	15	offset	int
    //   812	184	15	unresolvedImports	List<ImportPackageSpecification>
    //   1402	115	15	depBundles	Bundle[]
    //   725	29	16	i	int
    //   815	141	16	i	int
    //   1413	102	16	j	int
    //   894	41	17	isResolvable	boolean
    //   1483	13	17	provider	Bundle
    //   897	30	18	j	int
    //   1559	15	19	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   372	1559	1559	finally
  }
  
  private boolean printImportedPackages(ExportPackageDescription[] importedPkgs, CommandInterpreter intp, boolean title)
  {
    for (int i = 0; i < importedPkgs.length; i++)
    {
      if (title)
      {
        intp.print("  ");
        intp.println(ConsoleMsg.CONSOLE_IMPORTED_PACKAGES_MESSAGE);
        title = false;
      }
      intp.print("    ");
      intp.print(importedPkgs[i].getName());
      intp.print("; version=\"");
      intp.print(importedPkgs[i].getVersion());
      intp.print("\"");
      Bundle exporter = context.getBundle(importedPkgs[i].getSupplier().getBundleId());
      if (exporter != null)
      {
        intp.print("<");
        intp.print(exporter);
        intp.println(">");
      }
      else
      {
        intp.print("<");
        intp.print(ConsoleMsg.CONSOLE_STALE_MESSAGE);
        intp.println(">");
      }
    }
    return title;
  }
  
  private void printUnwiredDynamicImports(List<ImportPackageSpecification> dynamicImports, CommandInterpreter intp)
  {
    for (int i = 0; i < dynamicImports.size(); i++)
    {
      ImportPackageSpecification importPackage = (ImportPackageSpecification)dynamicImports.get(i);
      intp.print("    ");
      intp.print(importPackage.getName());
      intp.print("; version=\"");
      intp.print(importPackage.getVersionRange());
      intp.print("\"");
      intp.print("<");
      intp.print("unwired");
      intp.print(">");
      intp.print("<");
      intp.print(importPackage.getDirective("resolution"));
      intp.println(">");
    }
  }
  
  public void _gc(CommandInterpreter intp)
    throws Exception
  {
    long before = Runtime.getRuntime().freeMemory();
    
    System.gc();
    System.gc();
    System.runFinalization();
    try
    {
      Thread.sleep(100L);
    }
    catch (InterruptedException localInterruptedException) {}
    long after = Runtime.getRuntime().freeMemory();
    intp.print(ConsoleMsg.CONSOLE_TOTAL_MEMORY_MESSAGE);
    intp.println(String.valueOf(Runtime.getRuntime().totalMemory()));
    intp.print(ConsoleMsg.CONSOLE_FREE_MEMORY_BEFORE_GARBAGE_COLLECTION_MESSAGE);
    intp.println(String.valueOf(before));
    intp.print(ConsoleMsg.CONSOLE_FREE_MEMORY_AFTER_GARBAGE_COLLECTION_MESSAGE);
    intp.println(String.valueOf(after));
    intp.print(ConsoleMsg.CONSOLE_MEMORY_GAINED_WITH_GARBAGE_COLLECTION_MESSAGE);
    intp.println(String.valueOf(after - before));
  }
  
  public void _init(CommandInterpreter intp)
    throws Exception
  {
    if (framework.isActive())
    {
      intp.print("\r\n");
      intp.println(ConsoleMsg.CONSOLE_FRAMEWORK_LAUNCHED_PLEASE_SHUTDOWN_MESSAGE);
      return;
    }
    AbstractBundle[] bundles = (AbstractBundle[])context.getBundles();
    
    int size = bundles.length;
    if (size > 0) {
      for (int i = 0; i < size; i++)
      {
        AbstractBundle bundle = bundles[i];
        if (bundle.getBundleId() != 0L) {
          try
          {
            bundle.uninstall();
          }
          catch (BundleException e)
          {
            intp.printStackTrace(e);
          }
        }
      }
    } else {
      intp.println(ConsoleMsg.CONSOLE_NO_INSTALLED_BUNDLES_ERROR);
    }
    if (securityAdmin != null)
    {
      securityAdmin.setDefaultPermissions(null);
      String[] permLocations = securityAdmin.getLocations();
      if (permLocations != null) {
        for (int i = 0; i < permLocations.length; i++) {
          securityAdmin.setPermissions(permLocations[i], null);
        }
      }
      ConditionalPermissionUpdate update = securityAdmin.newConditionalPermissionUpdate();
      update.getConditionalPermissionInfos().clear();
      update.commit();
    }
    if (securityAdmin != null) {
      for (Enumeration<ConditionalPermissionInfo> infos = securityAdmin.getConditionalPermissionInfos(); infos.hasMoreElements();) {
        ((ConditionalPermissionInfo)infos.nextElement()).delete();
      }
    }
  }
  
  public void _close(CommandInterpreter intp)
    throws Exception
  {
    intp.println();
    framework.close();
    System.exit(0);
  }
  
  public void _r(CommandInterpreter intp)
    throws Exception
  {
    _refresh(intp);
  }
  
  public void _refresh(CommandInterpreter intp)
    throws Exception
  {
    ServiceReference<?> packageAdminRef = context.getServiceReference("org.osgi.service.packageadmin.PackageAdmin");
    if (packageAdminRef != null)
    {
      PackageAdmin packageAdmin = (PackageAdmin)context.getService(packageAdminRef);
      if (packageAdmin != null)
      {
        try
        {
          Bundle[] refresh = (Bundle[])null;
          
          String token = intp.nextArgument();
          if (token != null)
          {
            List<Bundle> bundles = new ArrayList();
            while (token != null)
            {
              AbstractBundle bundle = getBundleFromToken(intp, token, true);
              if (bundle != null) {
                bundles.add(bundle);
              }
              token = intp.nextArgument();
            }
            int size = bundles.size();
            if (size == 0)
            {
              intp.println(ConsoleMsg.CONSOLE_INVALID_BUNDLE_SPECIFICATION_ERROR);
              return;
            }
            refresh = new Bundle[size];
            bundles.toArray(refresh);
          }
          packageAdmin.refreshPackages(refresh);
        }
        finally
        {
          context.ungetService(packageAdminRef);
        }
        context.ungetService(packageAdminRef);
      }
    }
    else
    {
      intp.println(ConsoleMsg.CONSOLE_CAN_NOT_REFRESH_NO_PACKAGE_ADMIN_ERROR);
    }
  }
  
  public void _exec(CommandInterpreter intp)
    throws Exception
  {
    String command = intp.nextArgument();
    if (command == null)
    {
      intp.println(ConsoleMsg.CONSOLE_NO_COMMAND_SPECIFIED_ERROR);
      return;
    }
    Process p = Runtime.getRuntime().exec(command);
    
    intp.println(NLS.bind(ConsoleMsg.CONSOLE_STARTED_IN_MESSAGE, command, String.valueOf(p)));
    int result = p.waitFor();
    intp.println(NLS.bind(ConsoleMsg.CONSOLE_EXECUTED_RESULT_CODE_MESSAGE, command, String.valueOf(result)));
  }
  
  public void _fork(CommandInterpreter intp)
    throws Exception
  {
    String command = intp.nextArgument();
    if (command == null)
    {
      intp.println(ConsoleMsg.CONSOLE_NO_COMMAND_SPECIFIED_ERROR);
      return;
    }
    Process p = Runtime.getRuntime().exec(command);
    intp.println(NLS.bind(ConsoleMsg.CONSOLE_STARTED_IN_MESSAGE, command, String.valueOf(p)));
  }
  
  public void _h(CommandInterpreter intp)
    throws Exception
  {
    _headers(intp);
  }
  
  public void _headers(CommandInterpreter intp)
    throws Exception
  {
    String nextArg = intp.nextArgument();
    if (nextArg == null) {
      intp.println(ConsoleMsg.CONSOLE_NO_BUNDLE_SPECIFIED_ERROR);
    }
    while (nextArg != null)
    {
      AbstractBundle bundle = getBundleFromToken(intp, nextArg, true);
      if (bundle != null) {
        intp.printDictionary(bundle.getHeaders(), ConsoleMsg.CONSOLE_BUNDLE_HEADERS_TITLE);
      }
      nextArg = intp.nextArgument();
    }
  }
  
  public void _pr(CommandInterpreter intp)
    throws Exception
  {
    _props(intp);
  }
  
  public void _props(CommandInterpreter intp)
    throws Exception
  {
    intp.printDictionary(FrameworkProperties.getProperties(), ConsoleMsg.CONSOLE_SYSTEM_PROPERTIES_TITLE);
  }
  
  public void _setp(CommandInterpreter intp)
    throws Exception
  {
    _setprop(intp);
  }
  
  /* Error */
  public void _setprop(CommandInterpreter intp)
    throws Exception
  {
    // Byte code:
    //   0: aload_1
    //   1: invokeinterface 1645 1 0
    //   6: astore_2
    //   7: aload_2
    //   8: ifnonnull +20 -> 28
    //   11: aload_1
    //   12: getstatic 1405	org/eclipse/osgi/framework/internal/core/ConsoleMsg:CONSOLE_NO_PARAMETERS_SPECIFIED_TITLE	Ljava/lang/String;
    //   15: invokeinterface 1644 2 0
    //   20: aload_0
    //   21: aload_1
    //   22: invokevirtual 1575	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:_props	(Lorg/eclipse/osgi/framework/console/CommandInterpreter;)V
    //   25: goto +168 -> 193
    //   28: new 741	java/io/ByteArrayInputStream
    //   31: dup
    //   32: aload_2
    //   33: invokevirtual 1479	java/lang/String:getBytes	()[B
    //   36: invokespecial 1455	java/io/ByteArrayInputStream:<init>	([B)V
    //   39: astore_3
    //   40: invokestatic 1601	org/eclipse/osgi/framework/internal/core/FrameworkProperties:getProperties	()Ljava/util/Properties;
    //   43: astore 4
    //   45: new 778	java/util/Properties
    //   48: dup
    //   49: invokespecial 1529	java/util/Properties:<init>	()V
    //   52: astore 5
    //   54: aload 5
    //   56: aload_3
    //   57: invokevirtual 1530	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   60: aload_1
    //   61: getstatic 1417	org/eclipse/osgi/framework/internal/core/ConsoleMsg:CONSOLE_SETTING_PROPERTIES_TITLE	Ljava/lang/String;
    //   64: invokeinterface 1644 2 0
    //   69: aload 5
    //   71: invokevirtual 1531	java/util/Properties:propertyNames	()Ljava/util/Enumeration;
    //   74: astore 6
    //   76: goto +71 -> 147
    //   79: aload 6
    //   81: invokeinterface 1624 1 0
    //   86: checkcast 760	java/lang/String
    //   89: astore 7
    //   91: aload 5
    //   93: aload 7
    //   95: invokevirtual 1533	java/util/Properties:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   98: checkcast 760	java/lang/String
    //   101: astore 8
    //   103: aload 4
    //   105: aload 7
    //   107: aload 8
    //   109: invokevirtual 1535	java/util/Properties:put	(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    //   112: pop
    //   113: aload_1
    //   114: new 761	java/lang/StringBuffer
    //   117: dup
    //   118: ldc 2
    //   120: invokespecial 1496	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   123: aload 7
    //   125: invokevirtual 1501	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   128: ldc_w 660
    //   131: invokevirtual 1501	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   134: aload 8
    //   136: invokevirtual 1501	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   139: invokevirtual 1495	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   142: invokeinterface 1644 2 0
    //   147: aload 6
    //   149: invokeinterface 1623 1 0
    //   154: ifne -75 -> 79
    //   157: goto +28 -> 185
    //   160: pop
    //   161: aload_3
    //   162: invokevirtual 1457	java/io/InputStream:close	()V
    //   165: goto +28 -> 193
    //   168: pop
    //   169: goto +24 -> 193
    //   172: astore 9
    //   174: aload_3
    //   175: invokevirtual 1457	java/io/InputStream:close	()V
    //   178: goto +4 -> 182
    //   181: pop
    //   182: aload 9
    //   184: athrow
    //   185: aload_3
    //   186: invokevirtual 1457	java/io/InputStream:close	()V
    //   189: goto +4 -> 193
    //   192: pop
    //   193: return
    // Line number table:
    //   Java source line #1383	-> byte code offset #0
    //   Java source line #1384	-> byte code offset #7
    //   Java source line #1385	-> byte code offset #11
    //   Java source line #1386	-> byte code offset #20
    //   Java source line #1388	-> byte code offset #28
    //   Java source line #1390	-> byte code offset #40
    //   Java source line #1391	-> byte code offset #45
    //   Java source line #1392	-> byte code offset #54
    //   Java source line #1393	-> byte code offset #60
    //   Java source line #1394	-> byte code offset #69
    //   Java source line #1395	-> byte code offset #76
    //   Java source line #1396	-> byte code offset #79
    //   Java source line #1397	-> byte code offset #91
    //   Java source line #1398	-> byte code offset #103
    //   Java source line #1399	-> byte code offset #113
    //   Java source line #1395	-> byte code offset #147
    //   Java source line #1401	-> byte code offset #160
    //   Java source line #1405	-> byte code offset #161
    //   Java source line #1406	-> byte code offset #168
    //   Java source line #1403	-> byte code offset #172
    //   Java source line #1405	-> byte code offset #174
    //   Java source line #1406	-> byte code offset #181
    //   Java source line #1409	-> byte code offset #182
    //   Java source line #1405	-> byte code offset #185
    //   Java source line #1406	-> byte code offset #192
    //   Java source line #1411	-> byte code offset #193
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	194	0	this	FrameworkCommandProvider
    //   0	194	1	intp	CommandInterpreter
    //   6	27	2	argument	String
    //   39	147	3	in	java.io.InputStream
    //   43	61	4	sysprops	Properties
    //   52	40	5	newprops	Properties
    //   74	74	6	keys	Enumeration<?>
    //   89	35	7	key	String
    //   101	34	8	value	String
    //   172	11	9	localObject	Object
    //   160	1	10	localIOException1	java.io.IOException
    //   168	1	11	localIOException2	java.io.IOException
    //   181	1	12	localIOException3	java.io.IOException
    //   192	1	13	localIOException4	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   40	157	160	java/io/IOException
    //   161	165	168	java/io/IOException
    //   40	161	172	finally
    //   174	178	181	java/io/IOException
    //   185	189	192	java/io/IOException
  }
  
  public void _ss(CommandInterpreter intp)
    throws Exception
  {
    if (framework.isActive())
    {
      intp.println();
      intp.println(ConsoleMsg.CONSOLE_FRAMEWORK_IS_LAUNCHED_MESSAGE);
    }
    else
    {
      intp.println();
      intp.println(ConsoleMsg.CONSOLE_FRAMEWORK_IS_SHUTDOWN_MESSAGE);
    }
    Object[] options = processOption(intp);
    if (options == null) {
      return;
    }
    AbstractBundle[] bundles = (AbstractBundle[])context.getBundles();
    if (bundles.length == 0)
    {
      intp.println(ConsoleMsg.CONSOLE_NO_INSTALLED_BUNDLES_ERROR);
    }
    else
    {
      intp.print("\r\n");
      intp.print(ConsoleMsg.CONSOLE_ID);
      intp.print("\t");
      intp.println(ConsoleMsg.CONSOLE_STATE_BUNDLE_TITLE);
      for (int i = 0; i < bundles.length; i++)
      {
        AbstractBundle b = bundles[i];
        if (match(b, (String)options[0], ((Integer)options[1]).intValue()))
        {
          String label = b.getSymbolicName();
          if ((label == null) || (label.length() == 0)) {
            label = b.toString();
          } else {
            label = label + "_" + b.getVersion();
          }
          intp.println(b.getBundleId() + "\t" + getStateName(b) + label);
          if (b.isFragment())
          {
            Bundle[] hosts = b.getHosts();
            if (hosts != null) {
              for (int j = 0; j < hosts.length; j++) {
                intp.println("\t            Master=" + hosts[j].getBundleId());
              }
            }
          }
          else
          {
            Bundle[] fragments = b.getFragments();
            if (fragments != null)
            {
              intp.print("\t            Fragments=");
              for (int f = 0; f < fragments.length; f++)
              {
                AbstractBundle fragment = (AbstractBundle)fragments[f];
                intp.print((f > 0 ? ", " : "") + fragment.getBundleId());
              }
              intp.println();
            }
          }
        }
      }
    }
  }
  
  private boolean match(Bundle toFilter, String searchedName, int searchedState)
  {
    if ((toFilter.getState() & searchedState) == 0) {
      return false;
    }
    if ((searchedName != null) && (toFilter.getSymbolicName() != null) && (toFilter.getSymbolicName().indexOf(searchedName) == -1)) {
      return false;
    }
    return true;
  }
  
  public void _t(CommandInterpreter intp)
    throws Exception
  {
    _threads(intp);
  }
  
  public void _threads(CommandInterpreter intp)
    throws Exception
  {
    ThreadGroup[] threadGroups = getThreadGroups();
    Util.sortByString(threadGroups);
    
    ThreadGroup tg = getTopThreadGroup();
    Thread[] threads = new Thread[tg.activeCount()];
    int count = tg.enumerate(threads, true);
    Util.sortByString(threads);
    
    StringBuffer sb = new StringBuffer(120);
    intp.println();
    intp.println(ConsoleMsg.CONSOLE_THREADGROUP_TITLE);
    for (int i = 0; i < threadGroups.length; i++)
    {
      tg = threadGroups[i];
      int all = tg.activeCount();
      int local = tg.enumerate(new Thread[all], false);
      ThreadGroup p = tg.getParent();
      String parent = p == null ? "-none-" : p.getName();
      sb.setLength(0);
      sb.append(Util.toString(simpleClassName(tg), 18)).append(" ").append(Util.toString(tg.getName(), 21)).append(" ").append(Util.toString(parent, 16)).append(Util.toString(new Integer(tg.getMaxPriority()), 3)).append(Util.toString(new Integer(local), 4)).append("/").append(Util.toString(String.valueOf(all), 6));
      intp.println(sb.toString());
    }
    intp.print("\r\n");
    intp.println(ConsoleMsg.CONSOLE_THREADTYPE_TITLE);
    for (int j = 0; j < count; j++)
    {
      Thread t = threads[j];
      if (t != null)
      {
        sb.setLength(0);
        sb.append(Util.toString(simpleClassName(t), 18)).append(" ").append(Util.toString(t.getName(), 21)).append(" ").append(Util.toString(t.getThreadGroup().getName(), 16)).append(Util.toString(new Integer(t.getPriority()), 3));
        if (t.isDaemon()) {
          sb.append(" [daemon]");
        }
        intp.println(sb.toString());
      }
    }
  }
  
  public void _sl(CommandInterpreter intp)
    throws Exception
  {
    if (isStartLevelSvcPresent(intp))
    {
      Bundle bundle = null;
      String token = intp.nextArgument();
      int value = 0;
      if (token != null)
      {
        bundle = getBundleFromToken(intp, token, true);
        if (bundle == null) {
          return;
        }
      }
      if (bundle == null)
      {
        value = slImpl.getStartLevel();
        intp.println(NLS.bind(ConsoleMsg.STARTLEVEL_FRAMEWORK_ACTIVE_STARTLEVEL, String.valueOf(value)));
      }
      else
      {
        value = slImpl.getBundleStartLevel(bundle);
        intp.println(NLS.bind(ConsoleMsg.STARTLEVEL_BUNDLE_STARTLEVEL, new Long(bundle.getBundleId()), new Integer(value)));
      }
    }
  }
  
  public void _setfwsl(CommandInterpreter intp)
    throws Exception
  {
    if (isStartLevelSvcPresent(intp))
    {
      int value = 0;
      String token = intp.nextArgument();
      if (token == null)
      {
        intp.println(ConsoleMsg.STARTLEVEL_NO_STARTLEVEL_GIVEN);
        value = slImpl.getStartLevel();
        intp.println(NLS.bind(ConsoleMsg.STARTLEVEL_FRAMEWORK_ACTIVE_STARTLEVEL, String.valueOf(value)));
      }
      else
      {
        value = getStartLevelFromToken(intp, token);
        if (value > 0) {
          try
          {
            slImpl.setStartLevel(value);
            intp.println(NLS.bind(ConsoleMsg.STARTLEVEL_FRAMEWORK_ACTIVE_STARTLEVEL, String.valueOf(value)));
          }
          catch (IllegalArgumentException e)
          {
            intp.println(e.getMessage());
          }
        }
      }
    }
  }
  
  public void _setbsl(CommandInterpreter intp)
    throws Exception
  {
    if (isStartLevelSvcPresent(intp))
    {
      AbstractBundle bundle = null;
      String token = intp.nextArgument();
      if (token == null)
      {
        intp.println(ConsoleMsg.STARTLEVEL_NO_STARTLEVEL_OR_BUNDLE_GIVEN);
        return;
      }
      int newSL = getStartLevelFromToken(intp, token);
      
      token = intp.nextArgument();
      if (token == null)
      {
        intp.println(ConsoleMsg.STARTLEVEL_NO_STARTLEVEL_OR_BUNDLE_GIVEN);
        return;
      }
      while (token != null)
      {
        bundle = getBundleFromToken(intp, token, true);
        if (bundle != null) {
          try
          {
            slImpl.setBundleStartLevel(bundle, newSL);
            intp.println(NLS.bind(ConsoleMsg.STARTLEVEL_BUNDLE_STARTLEVEL, new Long(bundle.getBundleId()), new Integer(newSL)));
          }
          catch (IllegalArgumentException e)
          {
            intp.println(e.getMessage());
          }
        }
        token = intp.nextArgument();
      }
    }
  }
  
  public void _setibsl(CommandInterpreter intp)
    throws Exception
  {
    if (isStartLevelSvcPresent(intp))
    {
      int value = 0;
      String token = intp.nextArgument();
      if (token == null)
      {
        intp.println(ConsoleMsg.STARTLEVEL_NO_STARTLEVEL_GIVEN);
        value = slImpl.getInitialBundleStartLevel();
        intp.println(NLS.bind(ConsoleMsg.STARTLEVEL_INITIAL_BUNDLE_STARTLEVEL, String.valueOf(value)));
      }
      else
      {
        value = getStartLevelFromToken(intp, token);
        if (value > 0) {
          try
          {
            slImpl.setInitialBundleStartLevel(value);
            intp.println(NLS.bind(ConsoleMsg.STARTLEVEL_INITIAL_BUNDLE_STARTLEVEL, String.valueOf(value)));
          }
          catch (IllegalArgumentException e)
          {
            intp.println(e.getMessage());
          }
        }
      }
    }
  }
  
  public void _requiredBundles(CommandInterpreter intp)
  {
    _classSpaces(intp);
  }
  
  /* Error */
  public void _classSpaces(CommandInterpreter intp)
  {
    // Byte code:
    //   0: aload_1
    //   1: invokeinterface 1645 1 0
    //   6: astore_2
    //   7: aload_0
    //   8: getfield 1453	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:context	Lorg/osgi/framework/BundleContext;
    //   11: ldc_w 703
    //   14: invokeinterface 1680 2 0
    //   19: astore_3
    //   20: aload_3
    //   21: ifnull +301 -> 322
    //   24: aload_0
    //   25: getfield 1453	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:context	Lorg/osgi/framework/BundleContext;
    //   28: aload_3
    //   29: invokeinterface 1678 2 0
    //   34: checkcast 813	org/osgi/service/packageadmin/PackageAdmin
    //   37: astore 4
    //   39: aload 4
    //   41: ifnull +290 -> 331
    //   44: aconst_null
    //   45: checkcast 740	[Lorg/osgi/service/packageadmin/RequiredBundle;
    //   48: astore 5
    //   50: aload 4
    //   52: aload_2
    //   53: invokeinterface 1698 2 0
    //   58: astore 5
    //   60: aload 5
    //   62: ifnonnull +15 -> 77
    //   65: aload_1
    //   66: getstatic 1404	org/eclipse/osgi/framework/internal/core/ConsoleMsg:CONSOLE_NO_NAMED_CLASS_SPACES_MESSAGE	Ljava/lang/String;
    //   69: invokeinterface 1644 2 0
    //   74: goto +234 -> 308
    //   77: iconst_0
    //   78: istore 6
    //   80: goto +201 -> 281
    //   83: aload 5
    //   85: iload 6
    //   87: aaload
    //   88: astore 7
    //   90: aload_1
    //   91: aload 7
    //   93: invokeinterface 1643 2 0
    //   98: aload 7
    //   100: invokeinterface 1699 1 0
    //   105: istore 8
    //   107: iload 8
    //   109: ifeq +30 -> 139
    //   112: aload_1
    //   113: ldc_w 663
    //   116: invokeinterface 1643 2 0
    //   121: aload_1
    //   122: getstatic 1413	org/eclipse/osgi/framework/internal/core/ConsoleMsg:CONSOLE_REMOVAL_PENDING_MESSAGE	Ljava/lang/String;
    //   125: invokeinterface 1643 2 0
    //   130: aload_1
    //   131: ldc_w 665
    //   134: invokeinterface 1644 2 0
    //   139: aload 7
    //   141: invokeinterface 1700 1 0
    //   146: astore 9
    //   148: aload 9
    //   150: ifnull +101 -> 251
    //   153: aload_1
    //   154: ldc_w 676
    //   157: invokeinterface 1643 2 0
    //   162: aload_1
    //   163: aload 9
    //   165: invokeinterface 1643 2 0
    //   170: aload_1
    //   171: ldc_w 679
    //   174: invokeinterface 1644 2 0
    //   179: aload 7
    //   181: invokeinterface 1701 1 0
    //   186: astore 10
    //   188: aload 10
    //   190: ifnull +88 -> 278
    //   193: iconst_0
    //   194: istore 11
    //   196: goto +44 -> 240
    //   199: aload_1
    //   200: ldc_w 657
    //   203: invokeinterface 1643 2 0
    //   208: aload_1
    //   209: aload 10
    //   211: iload 11
    //   213: aaload
    //   214: invokeinterface 1643 2 0
    //   219: aload_1
    //   220: ldc_w 656
    //   223: invokeinterface 1643 2 0
    //   228: aload_1
    //   229: getstatic 1415	org/eclipse/osgi/framework/internal/core/ConsoleMsg:CONSOLE_REQUIRES_MESSAGE	Ljava/lang/String;
    //   232: invokeinterface 1644 2 0
    //   237: iinc 11 1
    //   240: iload 11
    //   242: aload 10
    //   244: arraylength
    //   245: if_icmplt -46 -> 199
    //   248: goto +30 -> 278
    //   251: aload_1
    //   252: ldc_w 676
    //   255: invokeinterface 1643 2 0
    //   260: aload_1
    //   261: getstatic 1418	org/eclipse/osgi/framework/internal/core/ConsoleMsg:CONSOLE_STALE_MESSAGE	Ljava/lang/String;
    //   264: invokeinterface 1643 2 0
    //   269: aload_1
    //   270: ldc_w 679
    //   273: invokeinterface 1644 2 0
    //   278: iinc 6 1
    //   281: iload 6
    //   283: aload 5
    //   285: arraylength
    //   286: if_icmplt -203 -> 83
    //   289: goto +19 -> 308
    //   292: astore 12
    //   294: aload_0
    //   295: getfield 1453	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:context	Lorg/osgi/framework/BundleContext;
    //   298: aload_3
    //   299: invokeinterface 1677 2 0
    //   304: pop
    //   305: aload 12
    //   307: athrow
    //   308: aload_0
    //   309: getfield 1453	org/eclipse/osgi/framework/internal/core/FrameworkCommandProvider:context	Lorg/osgi/framework/BundleContext;
    //   312: aload_3
    //   313: invokeinterface 1677 2 0
    //   318: pop
    //   319: goto +12 -> 331
    //   322: aload_1
    //   323: getstatic 1399	org/eclipse/osgi/framework/internal/core/ConsoleMsg:CONSOLE_NO_EXPORTED_PACKAGES_NO_PACKAGE_ADMIN_MESSAGE	Ljava/lang/String;
    //   326: invokeinterface 1644 2 0
    //   331: return
    // Line number table:
    //   Java source line #1656	-> byte code offset #0
    //   Java source line #1658	-> byte code offset #7
    //   Java source line #1659	-> byte code offset #20
    //   Java source line #1660	-> byte code offset #24
    //   Java source line #1661	-> byte code offset #39
    //   Java source line #1663	-> byte code offset #44
    //   Java source line #1665	-> byte code offset #50
    //   Java source line #1667	-> byte code offset #60
    //   Java source line #1668	-> byte code offset #65
    //   Java source line #1670	-> byte code offset #77
    //   Java source line #1671	-> byte code offset #83
    //   Java source line #1672	-> byte code offset #90
    //   Java source line #1674	-> byte code offset #98
    //   Java source line #1675	-> byte code offset #107
    //   Java source line #1676	-> byte code offset #112
    //   Java source line #1677	-> byte code offset #121
    //   Java source line #1678	-> byte code offset #130
    //   Java source line #1681	-> byte code offset #139
    //   Java source line #1682	-> byte code offset #148
    //   Java source line #1683	-> byte code offset #153
    //   Java source line #1684	-> byte code offset #162
    //   Java source line #1685	-> byte code offset #170
    //   Java source line #1687	-> byte code offset #179
    //   Java source line #1688	-> byte code offset #188
    //   Java source line #1689	-> byte code offset #193
    //   Java source line #1690	-> byte code offset #199
    //   Java source line #1691	-> byte code offset #208
    //   Java source line #1692	-> byte code offset #219
    //   Java source line #1693	-> byte code offset #228
    //   Java source line #1689	-> byte code offset #237
    //   Java source line #1696	-> byte code offset #251
    //   Java source line #1697	-> byte code offset #260
    //   Java source line #1698	-> byte code offset #269
    //   Java source line #1670	-> byte code offset #278
    //   Java source line #1703	-> byte code offset #292
    //   Java source line #1704	-> byte code offset #294
    //   Java source line #1705	-> byte code offset #305
    //   Java source line #1704	-> byte code offset #308
    //   Java source line #1708	-> byte code offset #322
    //   Java source line #1710	-> byte code offset #331
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	332	0	this	FrameworkCommandProvider
    //   0	332	1	intp	CommandInterpreter
    //   6	47	2	token	String
    //   19	294	3	packageAdminRef	ServiceReference<?>
    //   37	14	4	packageAdmin	PackageAdmin
    //   48	236	5	symBundles	org.osgi.service.packageadmin.RequiredBundle[]
    //   78	204	6	i	in
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