Пример #1
0
 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();
 }
Пример #2
0
 public static void closeCLI() {
   try {
     if (cli == null) {
       cli.quit();
     }
   } finally {
     cli = null;
   }
 }
Пример #3
0
 @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;
 }
Пример #4
0
 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();
 }
Пример #5
0
 public static CLIOpResult sendLine(String line) throws IOException {
   cli.sendLine(line);
   return cli.readAllAsOpResult(WAIT_TIMEOUT, WAIT_LINETIMEOUT);
 }
Пример #6
0
 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();
 }
Пример #7
0
 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();
 }