use of org.onosproject.ui.UiGlyph in project onos by opennetworkinglab.
the class UiWebSocket method sendBootstrapData.
// Sends initial information (username and cluster member information)
// to allow GUI to display logged-in user, and to be able to
// fail-over to an alternate cluster member if necessary.
private void sendBootstrapData() {
ClusterService service = directory.get(ClusterService.class);
ArrayNode instances = arrayNode();
for (ControllerNode node : service.getNodes()) {
IpAddress nodeIp = node.ip();
ObjectNode instance = objectNode().put(ID, node.id().toString()).put(IP, nodeIp != null ? nodeIp.toString() : node.host()).put(GlyphConstants.UI_ATTACHED, node.equals(service.getLocalNode()));
instances.add(instance);
}
ArrayNode glyphInstances = arrayNode();
UiExtensionService uiExtensionService = directory.get(UiExtensionService.class);
for (UiGlyph glyph : uiExtensionService.getGlyphs()) {
ObjectNode glyphInstance = objectNode().put(GlyphConstants.ID, glyph.id()).put(GlyphConstants.VIEWBOX, glyph.viewbox()).put(GlyphConstants.PATH, glyph.path());
glyphInstances.add(glyphInstance);
}
ObjectNode payload = objectNode();
payload.set(CLUSTER_NODES, instances);
payload.set(GLYPHS, glyphInstances);
payload.put(USER, userName);
sendMessage(BOOTSTRAP, payload);
}
use of org.onosproject.ui.UiGlyph in project onos by opennetworkinglab.
the class UiExtensionManager method unregister.
@Override
public synchronized void unregister(UiGlyphFactory glyphFactory) {
checkPermission(GLYPH_WRITE);
boolean glyphRemoved = false;
for (UiGlyph glyph : glyphFactory.glyphs()) {
glyphs.remove(glyph);
glyphRemoved = true;
}
if (glyphRemoved) {
UiWebSocketServlet.sendToAll(GLYPH_REMOVED, null);
}
}
use of org.onosproject.ui.UiGlyph in project onos by opennetworkinglab.
the class UiExtensionManager method register.
@Override
public synchronized void register(UiGlyphFactory glyphFactory) {
checkPermission(GLYPH_WRITE);
boolean glyphAdded = false;
for (UiGlyph glyph : glyphFactory.glyphs()) {
if (!glyphs.contains(glyph)) {
glyphs.add(glyph);
glyphAdded = true;
}
}
if (glyphAdded) {
UiWebSocketServlet.sendToAll(GLYPH_ADDED, null);
}
}
Aggregations