WebInterface: в списке бандлов больше не отображается системный бандл и бандл веб интерфейса
Это связано с тем, что действия с системным бандлом вообще могут "грохнуть" весь АСис, а бандл веб интерфейса не может сам с собой что-либо делать.
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<groupId>asys</groupId>
|
<groupId>asys</groupId>
|
||||||
<artifactId>webinterface</artifactId>
|
<artifactId>webinterface</artifactId>
|
||||||
<version>0.7-SNAPSHOT</version>
|
<version>0.8-SNAPSHOT</version>
|
||||||
<packaging>bundle</packaging>
|
<packaging>bundle</packaging>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -21,9 +21,11 @@ import java.util.Map;
|
|||||||
public class AjaxHandler implements HttpHandler {
|
public class AjaxHandler implements HttpHandler {
|
||||||
private static final Charset defaultCharset = Charset.forName("UTF-8");
|
private static final Charset defaultCharset = Charset.forName("UTF-8");
|
||||||
private BundleContext context;
|
private BundleContext context;
|
||||||
|
private int selfId;
|
||||||
|
|
||||||
public AjaxHandler(BundleContext context) {
|
public AjaxHandler(BundleContext context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
selfId = (int) context.getBundle().getBundleId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -72,6 +74,9 @@ public class AjaxHandler implements HttpHandler {
|
|||||||
JsonArray jsonArray = new JsonArray();
|
JsonArray jsonArray = new JsonArray();
|
||||||
|
|
||||||
for (Bundle bundle : context.getBundle(0).getBundleContext().getBundles()) {
|
for (Bundle bundle : context.getBundle(0).getBundleContext().getBundles()) {
|
||||||
|
if (bundle.getBundleId() == 0 || bundle.getBundleId() == selfId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
jsonObject.addProperty("id", bundle.getBundleId());
|
jsonObject.addProperty("id", bundle.getBundleId());
|
||||||
jsonObject.addProperty("state", bundle.getState());
|
jsonObject.addProperty("state", bundle.getState());
|
||||||
@@ -88,7 +93,7 @@ public class AjaxHandler implements HttpHandler {
|
|||||||
private JsonObject bundleInfo(Bundle bundle) {
|
private JsonObject bundleInfo(Bundle bundle) {
|
||||||
JsonObject jsonObject = new JsonObject();
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
|
||||||
if (bundle != null) {
|
if (bundle != null && bundle.getBundleId() != 0 && bundle.getBundleId() != selfId) {
|
||||||
jsonObject.addProperty("id", bundle.getBundleId());
|
jsonObject.addProperty("id", bundle.getBundleId());
|
||||||
jsonObject.addProperty("state", bundle.getState());
|
jsonObject.addProperty("state", bundle.getState());
|
||||||
jsonObject.addProperty("name", bundle.getHeaders().get("Bundle-Name"));
|
jsonObject.addProperty("name", bundle.getHeaders().get("Bundle-Name"));
|
||||||
|
|||||||
Reference in New Issue
Block a user