/* * Licensed Materials - Property of Perforce Software, Inc. * © Copyright Perforce Software, Inc. 2014, 2021 * © Copyright IBM Corp. 2009, 2014 * © Copyright ILOG 1996, 2009 * All Rights Reserved. * * Note to U.S. Government Users Restricted Rights: * The Software and Documentation were developed at private expense and * are "Commercial Items" as that term is defined at 48 CFR 2.101, * consisting of "Commercial Computer Software" and * "Commercial Computer Software Documentation", as such terms are * used in 48 CFR 12.212 or 48 CFR 227.7202-1 through 227.7202-4, * as applicable. */ package service; import java.util.Enumeration; import java.util.Vector; import ilog.views.sdm.IlvSDMModel; import ilog.views.sdm.model.IlvJavaBeanSDMModel; /** * The model * * @since JViews 8.1 */ public class ServiceMonitoringModel { /** * Creates the SDM model. * * @return SDM model */ static public IlvSDMModel makeModel() { // Here we use the java bean model that basically read properties from // instances // through introspection. IlvSDMModel model = new SDMModelContainer(); fillModel(model); return model; } /** * Fills the model with data * * @param model * the model to fill */ static private void fillModel(IlvSDMModel model) { ServiceNode n; ServiceLink l; n = new ServiceNode("node1", false, false, 98, 50, "Web Server #1", "WebApps", "ko"); model.addObject(n, null, null); n = new ServiceNode("node2", false, false, 30, 60, "Root Server", "WebServer", "ok"); model.addObject(n, null, null); n = new ServiceNode("node4", false, false, 35, 50, "Music Server", "Music", "ok"); model.addObject(n, null, null); n = new ServiceNode("node16", false, false, 35, 50, "Search Services", "Search", "ok"); model.addObject(n, null, null); n = new ServiceNode("node210", false, false, 30, 60, "Server #3", "WebServer", "ok"); model.addObject(n, null, null); n = new ServiceNode("node212", false, false, 30, 60, "Server #2", "WebServer", "ok"); model.addObject(n, null, null); n = new ServiceNode("node1618", false, false, 35, 50, "Web Server #2", "WebApps", "ok"); model.addObject(n, null, null); n = new ServiceNode("node422", false, false, 35, 50, "Chat Server", "ChatApps", "ok"); model.addObject(n, null, null); n = new ServiceNode("node1626", false, true, 97, 50, "Web Server #3", "WebApps", "ok"); model.addObject(n, null, null); n = new ServiceNode("node430", false, false, 35, 50, "Music Server", "Music", "ok"); model.addObject(n, null, null); n = new ServiceNode("node446", false, false, 35, 50, "Music Server", "Music", "ok"); model.addObject(n, null, null); n = new ServiceNode("node1648", false, false, 35, 50, "Search Services", "Search", "ok"); model.addObject(n, null, null); n = new ServiceNode("node21050", false, false, 30, 60, "Server #2", "WebServer", "ok"); model.addObject(n, null, null); n = new ServiceNode("node42252", false, false, 35, 50, "Chat Server", "ChatApps", "ok"); model.addObject(n, null, null); n = new ServiceNode("node162654", false, false, 35, 50, "Web Server #4", "WebApps", "ok"); model.addObject(n, null, null); n = new ServiceNode("node43056", false, true, 98, 50, "Music Server", "Music", "ok"); model.addObject(n, null, null); n = new ServiceNode("node470", false, false, 35, 94, "Music Server", "Music", "ok"); model.addObject(n, null, null); n = new ServiceNode("node1672", true, true, 35, 94, "Search Services", "Search", "ok"); model.addObject(n, null, null); n = new ServiceNode("node21074", false, false, 30, 60, "Server #1", "WebServer", "ok"); model.addObject(n, null, null); n = new ServiceNode("node42276", false, false, 35, 50, "Chat Server", "ChatApps", "ok"); model.addObject(n, null, null); n = new ServiceNode("node162678", false, false, 98, 96, "Web Server #5", "WebApps", "ok"); model.addObject(n, null, null); n = new ServiceNode("node43080", false, false, 35, 50, "Music Server", "Music", "ok"); model.addObject(n, null, null); n = new ServiceNode("node167282", false, false, 35, 50, "Search Services", "Search", "ok"); model.addObject(n, null, null); n = new ServiceNode("node161885", false, false, 35, 50, "Web Server #6", "WebApps", "ok"); model.addObject(n, null, null); n = new ServiceNode("node161889", false, false, 35, 50, "Web Server #7", "WebApps", "ok"); model.addObject(n, null, null); l = new ServiceLink("link9", (ServiceNode) model.getObject("node2"), (ServiceNode) model.getObject("node1"), true, true, ""); model.addObject(l, null, null); l = new ServiceLink("link13", (ServiceNode) model.getObject("node2"), (ServiceNode) model.getObject("node210"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link15", (ServiceNode) model.getObject("node2"), (ServiceNode) model.getObject("node212"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link16", (ServiceNode) model.getObject("node210"), (ServiceNode) model.getObject("node16"), false, true, ""); model.addObject(l, null, null); l = new ServiceLink("link19", (ServiceNode) model.getObject("node212"), (ServiceNode) model.getObject("node1618"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link20", (ServiceNode) model.getObject("node210"), (ServiceNode) model.getObject("node4"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link2024", (ServiceNode) model.getObject("node210"), (ServiceNode) model.getObject("node422"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link1628", (ServiceNode) model.getObject("node210"), (ServiceNode) model.getObject("node1626"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link2032", (ServiceNode) model.getObject("node210"), (ServiceNode) model.getObject("node430"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link1334", (ServiceNode) model.getObject("node2"), (ServiceNode) model.getObject("node21050"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link1636", (ServiceNode) model.getObject("node21050"), (ServiceNode) model.getObject("node1648"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link2038", (ServiceNode) model.getObject("node21050"), (ServiceNode) model.getObject("node446"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link202440", (ServiceNode) model.getObject("node21050"), (ServiceNode) model.getObject("node42252"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link162842", (ServiceNode) model.getObject("node21050"), (ServiceNode) model.getObject("node162654"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link203244", (ServiceNode) model.getObject("node21050"), (ServiceNode) model.getObject("node43056"), false, true, ""); model.addObject(l, null, null); l = new ServiceLink("link1358", (ServiceNode) model.getObject("node2"), (ServiceNode) model.getObject("node21074"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link1660", (ServiceNode) model.getObject("node21074"), (ServiceNode) model.getObject("node1672"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link2062", (ServiceNode) model.getObject("node21074"), (ServiceNode) model.getObject("node470"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link202464", (ServiceNode) model.getObject("node21074"), (ServiceNode) model.getObject("node42276"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link162866", (ServiceNode) model.getObject("node21074"), (ServiceNode) model.getObject("node162678"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link203268", (ServiceNode) model.getObject("node21074"), (ServiceNode) model.getObject("node43080"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link83", (ServiceNode) model.getObject("node2"), (ServiceNode) model.getObject("node167282"), false, false, "Backup Link"); model.addObject(l, null, null); l = new ServiceLink("link1987", (ServiceNode) model.getObject("node212"), (ServiceNode) model.getObject("node161885"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link1991", (ServiceNode) model.getObject("node212"), (ServiceNode) model.getObject("node161889"), false, false, ""); model.addObject(l, null, null); l = new ServiceLink("link1", (ServiceNode) model.getObject("node2"), (ServiceNode) model.getObject("node1"), false, false, "Backup Link"); model.addObject(l, null, null); l = new ServiceLink("link2", (ServiceNode) model.getObject("node2"), (ServiceNode) model.getObject("node167282"), true, true, ""); model.addObject(l, null, null); } /** * A SDM model implementation that introspects ServiceNode and ServiceLink as * Java beans. */ static class SDMModelContainer extends IlvJavaBeanSDMModel { // we need a container for the objects Vector<Object> _objects = new Vector<Object>(); /** * Construct the SDM model from the business data. * */ public SDMModelContainer() { // ID is a regular property of ServiceNode or ServiceLink setIDProperty("id"); // set "from" and "to" properties of ServiceLink setFromProperty("from"); setToProperty("to"); } /* * (non-Javadoc) * * @see ilog.views.sdm.IlvSDMModel#clear() */ Override public void clear() { _objects.clear(); } /* * (non-Javadoc) * * @see ilog.views.sdm.IlvSDMModel#getObjects() */ Override public Enumeration<?> getObjects() { return _objects.elements(); } /* * (non-Javadoc) * * @see * ilog.views.sdm.model.IlvBasicSDMModel#addObjectImpl(java.lang.Object, * java.lang.Object, java.lang.Object) */ Override protected void addObjectImpl(Object object, Object parent, Object before) { _objects.add(object); } /* * (non-Javadoc) * * @see ilog.views.sdm.model.IlvBasicSDMModel#removeObject(java.lang.Object) */ Override public void removeObject(Object object) { _objects.remove(object); } } }