Archived
0

WebInterface: в списке бандлов больше не отображается системный бандл и бандл веб интерфейса

Это связано с тем, что действия с системным бандлом вообще могут "грохнуть" весь АСис, а
бандл веб интерфейса не может сам с собой что-либо делать.
This commit is contained in:
2016-12-18 14:03:36 +03:00
parent ae3689f408
commit 103f7df297
2 changed files with 7 additions and 2 deletions

View File

@@ -19,7 +19,7 @@
<groupId>asys</groupId>
<artifactId>webinterface</artifactId>
<version>0.7-SNAPSHOT</version>
<version>0.8-SNAPSHOT</version>
<packaging>bundle</packaging>
<dependencies>

View File

@@ -21,9 +21,11 @@ import java.util.Map;
public class AjaxHandler implements HttpHandler {
private static final Charset defaultCharset = Charset.forName("UTF-8");
private BundleContext context;
private int selfId;
public AjaxHandler(BundleContext context) {
this.context = context;
selfId = (int) context.getBundle().getBundleId();
}
@Override
@@ -72,6 +74,9 @@ public class AjaxHandler implements HttpHandler {
JsonArray jsonArray = new JsonArray();
for (Bundle bundle : context.getBundle(0).getBundleContext().getBundles()) {
if (bundle.getBundleId() == 0 || bundle.getBundleId() == selfId) {
continue;
}
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("id", bundle.getBundleId());
jsonObject.addProperty("state", bundle.getState());
@@ -88,7 +93,7 @@ public class AjaxHandler implements HttpHandler {
private JsonObject bundleInfo(Bundle bundle) {
JsonObject jsonObject = new JsonObject();
if (bundle != null) {
if (bundle != null && bundle.getBundleId() != 0 && bundle.getBundleId() != selfId) {
jsonObject.addProperty("id", bundle.getBundleId());
jsonObject.addProperty("state", bundle.getState());
jsonObject.addProperty("name", bundle.getHeaders().get("Bundle-Name"));