public static Map<String, Object> getBundleInfo(Long bundleId) throws IOException {
   cli.sendLine(
       "/subsystem=osgi/bundle="
           + bundleId
           + ":read-resource(include-runtime=true,recursive=true)");
   CLIOpResult cliresult = cli.readAllAsOpResult(WAIT_TIMEOUT, WAIT_LINETIMEOUT);
   return cliresult.getResultAsMap();
 }
 @SuppressWarnings("unchecked")
 public static Long getBundleId(String symbolicName, Version version) throws IOException {
   Long result = null;
   cli.sendLine("/subsystem=osgi:read-resource(include-runtime=true,recursive=true)");
   CLIOpResult cliresult = cli.readAllAsOpResult(WAIT_TIMEOUT, WAIT_LINETIMEOUT);
   assertTrue(cliresult.isIsOutcomeSuccess());
   Map<String, Object> bundlemap = cliresult.getNamedResultAsMap("bundle");
   for (Entry<String, Object> entry : bundlemap.entrySet()) {
     String auxid = entry.getKey();
     Map<String, Object> bundle = (Map<String, Object>) entry.getValue();
     if (bundle.get("symbolic-name").equals(symbolicName)) {
       Version auxver = Version.parseVersion((String) bundle.get("version"));
       if (version == null || version.equals(auxver)) {
         result = Long.valueOf(auxid);
         break;
       }
     }
   }
   return result;
 }
 public static String getFrameworkStartLevel() throws IOException {
   cli.sendLine("/subsystem=osgi:read-attribute(name=startlevel)");
   CLIOpResult cliresult = cli.readAllAsOpResult(WAIT_TIMEOUT, WAIT_LINETIMEOUT);
   assertTrue(cliresult.isIsOutcomeSuccess());
   return (String) cliresult.getResult();
 }
 public static String getBundleState(Object resId) throws IOException {
   cli.sendLine("/subsystem=osgi/bundle=" + resId + ":read-attribute(name=state)");
   CLIOpResult cliresult = cli.readAllAsOpResult(WAIT_TIMEOUT, WAIT_LINETIMEOUT);
   return (String) cliresult.getResult();
 }
 public static boolean bundleStop(Object resId) throws IOException {
   cli.sendLine("/subsystem=osgi/bundle=" + resId + ":stop");
   CLIOpResult cliresult = cli.readAllAsOpResult(WAIT_TIMEOUT, WAIT_LINETIMEOUT);
   return cliresult.isIsOutcomeSuccess();
 }