com.alibaba.dubbo.container.page.Page Java Examples
The following examples show how to use
com.alibaba.dubbo.container.page.Page.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UnsubscribePageHandler.java From dubbo3 with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String consumer = url.getParameterAndDecoded("consumer"); if (consumer == null || consumer.length() == 0) { throw new IllegalArgumentException("Please input consumer parameter."); } URL consumerUrl = URL.valueOf(consumer); RegistryContainer.getInstance().getRegistry().unsubscribe(consumerUrl, NotifyListenerAdapter.NOTIFY_LISTENER); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + consumerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"consumers.html?" + parameter + "\";</script>"); }
Example #2
Source File: DependenciesPageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String application = url.getParameter("application"); if (application == null || application.length() == 0) { throw new IllegalArgumentException("Please input application parameter."); } boolean reverse = url.getParameter("reverse", false); List<List<String>> rows = new ArrayList<List<String>>(); Set<String> directly = RegistryContainer.getInstance().getDependencies(application, reverse); Set<String> indirectly = new HashSet<String>(); appendDependency(rows, reverse, application, 0, new HashSet<String>(), indirectly); indirectly.remove(application); return new Page("<a href=\"applications.html\">Applications</a> > " + application + " > <a href=\"providers.html?application=" + application + "\">Providers</a> | <a href=\"consumers.html?application=" + application + "\">Consumers</a> | " + (reverse ? "<a href=\"dependencies.html?application=" + application + "\">Depends On</a> | Used By" : "Depends On | <a href=\"dependencies.html?application=" + application + "&reverse=true\">Used By</a>"), (reverse ? "Used By" : "Depends On") + " (" + directly.size() + "/" + indirectly.size() + ")", new String[] { "Application Name:"}, rows); }
Example #3
Source File: DependenciesPageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String application = url.getParameter("application"); if (application == null || application.length() == 0) { throw new IllegalArgumentException("Please input application parameter."); } boolean reverse = url.getParameter("reverse", false); List<List<String>> rows = new ArrayList<List<String>>(); Set<String> directly = RegistryContainer.getInstance().getDependencies(application, reverse); Set<String> indirectly = new HashSet<String>(); appendDependency(rows, reverse, application, 0, new HashSet<String>(), indirectly); indirectly.remove(application); return new Page("<a href=\"applications.html\">Applications</a> > " + application + " > <a href=\"providers.html?application=" + application + "\">Providers</a> | <a href=\"consumers.html?application=" + application + "\">Consumers</a> | " + (reverse ? "<a href=\"dependencies.html?application=" + application + "\">Depends On</a> | Used By" : "Depends On | <a href=\"dependencies.html?application=" + application + "&reverse=true\">Used By</a>"), (reverse ? "Used By" : "Depends On") + " (" + directly.size() + "/" + indirectly.size() + ")", new String[] { "Application Name:"}, rows); }
Example #4
Source File: UnsubscribePageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String consumer = url.getParameterAndDecoded("consumer"); if (consumer == null || consumer.length() == 0) { throw new IllegalArgumentException("Please input consumer parameter."); } URL consumerUrl = URL.valueOf(consumer); RegistryContainer.getInstance().getRegistry().unsubscribe(consumerUrl, NotifyListenerAdapter.NOTIFY_LISTENER); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + consumerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"consumers.html?" + parameter + "\";</script>"); }
Example #5
Source File: UnregisterPageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String provider = url.getParameterAndDecoded("provider"); if (provider == null || provider.length() == 0) { throw new IllegalArgumentException("Please input provider parameter."); } URL providerUrl = URL.valueOf(provider); RegistryContainer.getInstance().getRegistry().unregister(providerUrl); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + providerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"providers.html?" + parameter + "\";</script>"); }
Example #6
Source File: UnsubscribePageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String consumer = url.getParameterAndDecoded("consumer"); if (consumer == null || consumer.length() == 0) { throw new IllegalArgumentException("Please input consumer parameter."); } URL consumerUrl = URL.valueOf(consumer); RegistryContainer.getInstance().getRegistry().unsubscribe(consumerUrl, NotifyListenerAdapter.NOTIFY_LISTENER); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + consumerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"consumers.html?" + parameter + "\";</script>"); }
Example #7
Source File: ServersPageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<List<String>>(); Collection<ExchangeServer> servers = DubboProtocol.getDubboProtocol().getServers(); int clientCount = 0; if (servers != null && servers.size() > 0) { for (ExchangeServer s : servers) { List<String> row = new ArrayList<String>(); String address = s.getUrl().getAddress(); row.add(NetUtils.getHostName(address) + "/" + address); int clientSize = s.getExchangeChannels().size(); clientCount += clientSize; row.add("<a href=\"clients.html?port=" + s.getUrl().getPort() + "\">Clients(" + clientSize + ")</a>"); rows.add(row); } } return new Page("Servers", "Servers (" + rows.size() + ")", new String[]{"Server Address:", "Clients(" + clientCount + ")"}, rows); }
Example #8
Source File: UnregisterPageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String provider = url.getParameterAndDecoded("provider"); if (provider == null || provider.length() == 0) { throw new IllegalArgumentException("Please input provider parameter."); } URL providerUrl = URL.valueOf(provider); RegistryContainer.getInstance().getRegistry().unregister(providerUrl); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + providerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"providers.html?" + parameter + "\";</script>"); }
Example #9
Source File: ServersPageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<List<String>>(); Collection<ExchangeServer> servers = DubboProtocol.getDubboProtocol().getServers(); int clientCount = 0; if (servers != null && servers.size() > 0) { for (ExchangeServer s : servers) { List<String> row = new ArrayList<String>(); String address = s.getUrl().getAddress(); row.add(NetUtils.getHostName(address) + "/" + address); int clientSize = s.getExchangeChannels().size(); clientCount += clientSize; row.add("<a href=\"clients.html?port=" + s.getUrl().getPort() + "\">Clients(" + clientSize + ")</a>"); rows.add(row); } } return new Page("Servers", "Servers (" + rows.size() + ")", new String[]{"Server Address:", "Clients(" + clientCount + ")"}, rows); }
Example #10
Source File: UnregisterPageHandler.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String provider = url.getParameterAndDecoded("provider"); if (provider == null || provider.length() == 0) { throw new IllegalArgumentException("Please input provider parameter."); } URL providerUrl = URL.valueOf(provider); RegistryContainer.getInstance().getRegistry().unregister(providerUrl); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + providerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"providers.html?" + parameter + "\";</script>"); }
Example #11
Source File: DependenciesPageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String application = url.getParameter("application"); if (application == null || application.length() == 0) { throw new IllegalArgumentException("Please input application parameter."); } boolean reverse = url.getParameter("reverse", false); List<List<String>> rows = new ArrayList<List<String>>(); Set<String> directly = RegistryContainer.getInstance().getDependencies(application, reverse); Set<String> indirectly = new HashSet<String>(); appendDependency(rows, reverse, application, 0, new HashSet<String>(), indirectly); indirectly.remove(application); return new Page("<a href=\"applications.html\">Applications</a> > " + application + " > <a href=\"providers.html?application=" + application + "\">Providers</a> | <a href=\"consumers.html?application=" + application + "\">Consumers</a> | " + (reverse ? "<a href=\"dependencies.html?application=" + application + "\">Depends On</a> | Used By" : "Depends On | <a href=\"dependencies.html?application=" + application + "&reverse=true\">Used By</a>"), (reverse ? "Used By" : "Depends On") + " (" + directly.size() + "/" + indirectly.size() + ")", new String[] { "Application Name:"}, rows); }
Example #12
Source File: ServersPageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<List<String>>(); Collection<ExchangeServer> servers = DubboProtocol.getDubboProtocol().getServers(); int clientCount = 0; if (servers != null && servers.size() > 0) { for (ExchangeServer s : servers) { List<String> row = new ArrayList<String>(); String address = s.getUrl().getAddress(); row.add(NetUtils.getHostName(address) + "/" + address); int clientSize = s.getExchangeChannels().size(); clientCount += clientSize; row.add("<a href=\"clients.html?port=" + s.getUrl().getPort() + "\">Clients(" + clientSize + ")</a>"); rows.add(row); } } return new Page("Servers", "Servers (" + rows.size() + ")", new String[]{"Server Address:", "Clients(" + clientCount + ")"}, rows); }
Example #13
Source File: UnregisterPageHandler.java From dubbo3 with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String provider = url.getParameterAndDecoded("provider"); if (provider == null || provider.length() == 0) { throw new IllegalArgumentException("Please input provider parameter."); } URL providerUrl = URL.valueOf(provider); RegistryContainer.getInstance().getRegistry().unregister(providerUrl); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + providerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"providers.html?" + parameter + "\";</script>"); }
Example #14
Source File: DependenciesPageHandler.java From dubbo3 with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String application = url.getParameter("application"); if (application == null || application.length() == 0) { throw new IllegalArgumentException("Please input application parameter."); } boolean reverse = url.getParameter("reverse", false); List<List<String>> rows = new ArrayList<List<String>>(); Set<String> directly = RegistryContainer.getInstance().getDependencies(application, reverse); Set<String> indirectly = new HashSet<String>(); appendDependency(rows, reverse, application, 0, new HashSet<String>(), indirectly); indirectly.remove(application); return new Page("<a href=\"applications.html\">Applications</a> > " + application + " > <a href=\"providers.html?application=" + application + "\">Providers</a> | <a href=\"consumers.html?application=" + application + "\">Consumers</a> | " + (reverse ? "<a href=\"dependencies.html?application=" + application + "\">Depends On</a> | Used By" : "Depends On | <a href=\"dependencies.html?application=" + application + "&reverse=true\">Used By</a>"), (reverse ? "Used By" : "Depends On") + " (" + directly.size() + "/" + indirectly.size() + ")", new String[] { "Application Name:"}, rows); }
Example #15
Source File: ServersPageHandler.java From dubbo3 with Apache License 2.0 | 6 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<>(); Collection<ExchangeServer> servers = DubboProtocol.getDubboProtocol().getServers(); int clientCount = 0; if (servers != null && servers.size() > 0) { for (ExchangeServer s : servers) { List<String> row = new ArrayList<>(); String address = s.getUrl().getAddress(); row.add(NetUtils.getHostName(address) + "/" + address); int clientSize = s.getExchangeChannels().size(); clientCount += clientSize; row.add("<a href=\"clients.html?port=" + s.getUrl().getPort() + "\">Clients(" + clientSize + ")</a>"); rows.add(row); } } return new Page("Servers", "Servers (" + rows.size() + ")", new String[]{"Server Address:", "Clients(" + clientCount + ")"}, rows); }
Example #16
Source File: ServersPageHandler.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<List<String>>(); Collection<ExchangeServer> servers = DubboProtocol.getDubboProtocol().getServers(); int clientCount = 0; if (servers != null && servers.size() > 0) { for (ExchangeServer s : servers) { List<String> row = new ArrayList<String>(); String address = s.getUrl().getAddress(); row.add(NetUtils.getHostName(address) + "/" + address); int clientSize = s.getExchangeChannels().size(); clientCount += clientSize; row.add("<a href=\"clients.html?port=" + s.getUrl().getPort() + "\">Clients(" + clientSize + ")</a>"); rows.add(row); } } return new Page("Servers", "Servers (" + rows.size() + ")", new String[]{"Server Address:", "Clients(" + clientCount + ")"}, rows); }
Example #17
Source File: UnregisterPageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String provider = url.getParameterAndDecoded("provider"); if (provider == null || provider.length() == 0) { throw new IllegalArgumentException("Please input provider parameter."); } URL providerUrl = URL.valueOf(provider); RegistryContainer.getInstance().getRegistry().unregister(providerUrl); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + providerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"providers.html?" + parameter + "\";</script>"); }
Example #18
Source File: UnsubscribePageHandler.java From dubbox with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String consumer = url.getParameterAndDecoded("consumer"); if (consumer == null || consumer.length() == 0) { throw new IllegalArgumentException("Please input consumer parameter."); } URL consumerUrl = URL.valueOf(consumer); RegistryContainer.getInstance().getRegistry().unsubscribe(consumerUrl, NotifyListenerAdapter.NOTIFY_LISTENER); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + consumerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"consumers.html?" + parameter + "\";</script>"); }
Example #19
Source File: DependenciesPageHandler.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String application = url.getParameter("application"); if (application == null || application.length() == 0) { throw new IllegalArgumentException("Please input application parameter."); } boolean reverse = url.getParameter("reverse", false); List<List<String>> rows = new ArrayList<List<String>>(); Set<String> directly = RegistryContainer.getInstance().getDependencies(application, reverse); Set<String> indirectly = new HashSet<String>(); appendDependency(rows, reverse, application, 0, new HashSet<String>(), indirectly); indirectly.remove(application); return new Page("<a href=\"applications.html\">Applications</a> > " + application + " > <a href=\"providers.html?application=" + application + "\">Providers</a> | <a href=\"consumers.html?application=" + application + "\">Consumers</a> | " + (reverse ? "<a href=\"dependencies.html?application=" + application + "\">Depends On</a> | Used By" : "Depends On | <a href=\"dependencies.html?application=" + application + "&reverse=true\">Used By</a>"), (reverse ? "Used By" : "Depends On") + " (" + directly.size() + "/" + indirectly.size() + ")", new String[] { "Application Name:"}, rows); }
Example #20
Source File: UnsubscribePageHandler.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
public Page handle(URL url) { String consumer = url.getParameterAndDecoded("consumer"); if (consumer == null || consumer.length() == 0) { throw new IllegalArgumentException("Please input consumer parameter."); } URL consumerUrl = URL.valueOf(consumer); RegistryContainer.getInstance().getRegistry().unsubscribe(consumerUrl, NotifyListenerAdapter.NOTIFY_LISTENER); String parameter; if (url.hasParameter("service")) { parameter = "service=" + url.getParameter("service"); } else if (url.hasParameter("host")) { parameter = "host=" + url.getParameter("host"); } else if (url.hasParameter("application")) { parameter = "application=" + url.getParameter("application"); } else { parameter = "service=" + consumerUrl.getServiceInterface(); } return new Page("<script type=\"text/javascript\">window.location.href=\"consumers.html?" + parameter + "\";</script>"); }
Example #21
Source File: ChartsPageHandler.java From dubbo3 with Apache License 2.0 | 5 votes |
public Page handle(URL url) { String service = url.getParameter("service"); if (service == null || service.length() == 0) { throw new IllegalArgumentException("Please input service parameter."); } String date = url.getParameter("date"); if (date == null || date.length() == 0) { date = new SimpleDateFormat("yyyyMMdd").format(new Date()); } List<List<String>> rows = new ArrayList<List<String>>(); String directory = SimpleMonitorService.getInstance().getChartsDirectory(); File chartsDir = new File(directory); String filename = directory + "/" + date + "/" + service; File serviceDir = new File(filename); if (serviceDir.exists()) { File[] methodDirs = serviceDir.listFiles(); for (File methodDir : methodDirs) { String methodUri = chartsDir.getName() + "/" + date + "/" + service + "/" + methodDir.getName() + "/"; rows.add(toRow(methodDir, methodUri)); } } StringBuilder nav = new StringBuilder(); nav.append("<a href=\"services.html\">Services</a> > "); nav.append(service); nav.append(" > <a href=\"providers.html?service="); nav.append(service); nav.append("\">Providers</a> | <a href=\"consumers.html?service="); nav.append(service); nav.append("\">Consumers</a> | <a href=\"statistics.html?service="); nav.append(service); nav.append("&date="); nav.append(date); nav.append("\">Statistics</a> | Charts > <input type=\"text\" style=\"width: 65px;\" name=\"date\" value=\""); nav.append(date); nav.append("\" onkeyup=\"if (event.keyCode == 10 || event.keyCode == 13) {window.location.href='charts.html?service="); nav.append(service); nav.append("&date=' + this.value;}\" />"); return new Page(nav.toString(), "Charts (" + rows.size() + ")", new String[] { "Method", "Requests per second (QPS)", "Average response time (ms)"}, rows); }
Example #22
Source File: LogPageHandler.java From dubbox with Apache License 2.0 | 5 votes |
public Page handle(URL url) { long size = 0; String content = ""; String modified = "Not exist"; if (file != null && file.exists()) { try { FileInputStream fis = new FileInputStream(file); FileChannel channel = fis.getChannel(); size = channel.size(); ByteBuffer bb; if (size <= SHOW_LOG_LENGTH) { bb = ByteBuffer.allocate((int) size); channel.read(bb, 0); } else { int pos = (int) (size - SHOW_LOG_LENGTH); bb = ByteBuffer.allocate(SHOW_LOG_LENGTH); channel.read(bb, pos); } bb.flip(); content = new String(bb.array()).replace("<", "<") .replace(">", ">").replace("\n", "<br/><br/>"); modified = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") .format(new Date(file.lastModified())); } catch (IOException e) { } } Level level = LogManager.getRootLogger().getLevel(); List<List<String>> rows = new ArrayList<List<String>>(); List<String> row = new ArrayList<String>(); row.add(content); rows.add(row); return new Page("Log", "Log", new String[] {(file == null ? "" : file.getName()) + ", " + size + " bytes, " + modified + ", " + level}, rows); }
Example #23
Source File: ServicesPageHandler.java From dubbox with Apache License 2.0 | 5 votes |
public Page handle(URL url) { Set<String> services = RegistryContainer.getInstance().getServices(); List<List<String>> rows = new ArrayList<List<String>>(); int providerCount = 0; int consumerCount = 0; if (services != null && services.size() > 0) { for (String service : services) { List<URL> providers = RegistryContainer.getInstance().getProvidersByService(service); int providerSize = providers == null ? 0 : providers.size(); providerCount += providerSize; List<URL> consumers = RegistryContainer.getInstance().getConsumersByService(service); int consumerSize = consumers == null ? 0 : consumers.size(); consumerCount += consumerSize; List<String> row = new ArrayList<String>(); row.add(service); if (providerSize > 0 || consumerSize > 0) { if (providerSize > 0) { URL provider = providers.iterator().next(); row.add(provider.getParameter(Constants.APPLICATION_KEY, "")); row.add(provider.getParameter("owner", "") + (provider.hasParameter("organization") ? " (" + provider.getParameter("organization") + ")" : "")); } else { row.add(""); row.add(""); } row.add(providerSize == 0 ? "<font color=\"red\">No provider</a>" : "<a href=\"providers.html?service=" + service + "\">Providers(" + providerSize + ")</a>"); row.add(consumerSize == 0 ? "<font color=\"blue\">No consumer</a>" : "<a href=\"consumers.html?service=" + service + "\">Consumers(" + consumerSize + ")</a>"); row.add("<a href=\"statistics.html?service=" + service + "\">Statistics</a>"); row.add("<a href=\"charts.html?service=" + service + "\">Charts</a>"); rows.add(row); } } } return new Page("Services", "Services (" + rows.size() + ")", new String[] { "Service Name:", "Application", "Owner", "Providers(" + providerCount + ")", "Consumers(" + consumerCount + ")", "Statistics", "Charts" }, rows); }
Example #24
Source File: HomePageHandler.java From dubbo3 with Apache License 2.0 | 5 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<List<String>>(); for (PageHandler handler : PageServlet.getInstance().getMenus()) { String uri = ExtensionLoader.getExtensionLoader(PageHandler.class).getExtensionName(handler); Menu menu = handler.getClass().getAnnotation(Menu.class); List<String> row = new ArrayList<String>(); row.add("<a href=\"" + uri + ".html\">" + menu.name() + "</a>"); row.add(menu.desc()); rows.add(row); } return new Page("Home", "Menus", new String[] {"Menu Name", "Menu Desc"}, rows); }
Example #25
Source File: RegistriesPageHandler.java From dubbox with Apache License 2.0 | 5 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<List<String>>(); Collection<Registry> registries = AbstractRegistryFactory.getRegistries(); int registeredCount = 0; int subscribedCount = 0; if (registries != null && registries.size() > 0) { for (Registry registry : registries) { String server = registry.getUrl().getAddress(); List<String> row = new ArrayList<String>(); row.add(NetUtils.getHostName(server) + "/" + server); if (registry.isAvailable()) { row.add("<font color=\"green\">Connected</font>"); } else { row.add("<font color=\"red\">Disconnected</font>"); } int registeredSize = 0; int subscribedSize = 0; if (registry instanceof AbstractRegistry) { registeredSize = ((AbstractRegistry) registry).getRegistered().size(); registeredCount += registeredSize; subscribedSize = ((AbstractRegistry) registry).getSubscribed().size(); subscribedCount += subscribedSize; } row.add("<a href=\"registered.html?registry=" + server + "\">Registered(" + registeredSize + ")</a>"); row.add("<a href=\"subscribed.html?registry=" + server + "\">Subscribed(" + subscribedSize + ")</a>"); rows.add(row); } } return new Page("Registries", "Registries (" + rows.size() + ")", new String[] { "Registry Address:", "Status", "Registered(" + registeredCount + ")", "Subscribed(" + subscribedCount + ")" }, rows); }
Example #26
Source File: RegistriesPageHandler.java From dubbo3 with Apache License 2.0 | 5 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<List<String>>(); Collection<Registry> registries = AbstractRegistryFactory.getRegistries(); int registeredCount = 0; int subscribedCount = 0; if (registries != null && registries.size() > 0) { for (Registry registry : registries) { String server = registry.getUrl().getAddress(); List<String> row = new ArrayList<String>(); row.add(NetUtils.getHostName(server) + "/" + server); if (registry.isAvailable()) { row.add("<font color=\"green\">Connected</font>"); } else { row.add("<font color=\"red\">Disconnected</font>"); } int registeredSize = 0; int subscribedSize = 0; if (registry instanceof AbstractRegistry) { registeredSize = ((AbstractRegistry) registry).getRegistered().size(); registeredCount += registeredSize; subscribedSize = ((AbstractRegistry) registry).getSubscribed().size(); subscribedCount += subscribedSize; } row.add("<a href=\"registered.html?registry=" + server + "\">Registered(" + registeredSize + ")</a>"); row.add("<a href=\"subscribed.html?registry=" + server + "\">Subscribed(" + subscribedSize + ")</a>"); rows.add(row); } } return new Page("Registries", "Registries (" + rows.size() + ")", new String[] { "Registry Address:", "Status", "Registered(" + registeredCount + ")", "Subscribed(" + subscribedCount + ")" }, rows); }
Example #27
Source File: ServicesPageHandler.java From dubbox with Apache License 2.0 | 5 votes |
public Page handle(URL url) { Set<String> services = RegistryContainer.getInstance().getServices(); List<List<String>> rows = new ArrayList<List<String>>(); int providerCount = 0; int consumerCount = 0; if (services != null && services.size() > 0) { for (String service : services) { List<URL> providers = RegistryContainer.getInstance().getProvidersByService(service); int providerSize = providers == null ? 0 : providers.size(); providerCount += providerSize; List<URL> consumers = RegistryContainer.getInstance().getConsumersByService(service); int consumerSize = consumers == null ? 0 : consumers.size(); consumerCount += consumerSize; List<String> row = new ArrayList<String>(); row.add(service); if (providerSize > 0 || consumerSize > 0) { if (providerSize > 0) { URL provider = providers.iterator().next(); row.add(provider.getParameter(Constants.APPLICATION_KEY, "")); row.add(provider.getParameter("owner", "") + (provider.hasParameter("organization") ? " (" + provider.getParameter("organization") + ")" : "")); } else { row.add(""); row.add(""); } row.add(providerSize == 0 ? "<font color=\"red\">No provider</a>" : "<a href=\"providers.html?service=" + service + "\">Providers(" + providerSize + ")</a>"); row.add(consumerSize == 0 ? "<font color=\"blue\">No consumer</a>" : "<a href=\"consumers.html?service=" + service + "\">Consumers(" + consumerSize + ")</a>"); row.add("<a href=\"statistics.html?service=" + service + "\">Statistics</a>"); row.add("<a href=\"charts.html?service=" + service + "\">Charts</a>"); rows.add(row); } } } return new Page("Services", "Services (" + rows.size() + ")", new String[] { "Service Name:", "Application", "Owner", "Providers(" + providerCount + ")", "Consumers(" + consumerCount + ")", "Statistics", "Charts" }, rows); }
Example #28
Source File: LogPageHandler.java From dubbox with Apache License 2.0 | 5 votes |
public Page handle(URL url) { long size = 0; String content = ""; String modified = "Not exist"; if (file != null && file.exists()) { try { FileInputStream fis = new FileInputStream(file); FileChannel channel = fis.getChannel(); size = channel.size(); ByteBuffer bb; if (size <= SHOW_LOG_LENGTH) { bb = ByteBuffer.allocate((int) size); channel.read(bb, 0); } else { int pos = (int) (size - SHOW_LOG_LENGTH); bb = ByteBuffer.allocate(SHOW_LOG_LENGTH); channel.read(bb, pos); } bb.flip(); content = new String(bb.array()).replace("<", "<") .replace(">", ">").replace("\n", "<br/><br/>"); modified = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") .format(new Date(file.lastModified())); } catch (IOException e) { } } Level level = LogManager.getRootLogger().getLevel(); List<List<String>> rows = new ArrayList<List<String>>(); List<String> row = new ArrayList<String>(); row.add(content); rows.add(row); return new Page("Log", "Log", new String[] {(file == null ? "" : file.getName()) + ", " + size + " bytes, " + modified + ", " + level}, rows); }
Example #29
Source File: HomePageHandler.java From dubbox with Apache License 2.0 | 5 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<List<String>>(); for (PageHandler handler : PageServlet.getInstance().getMenus()) { String uri = ExtensionLoader.getExtensionLoader(PageHandler.class).getExtensionName(handler); Menu menu = handler.getClass().getAnnotation(Menu.class); List<String> row = new ArrayList<String>(); row.add("<a href=\"" + uri + ".html\">" + menu.name() + "</a>"); row.add(menu.desc()); rows.add(row); } return new Page("Home", "Menus", new String[] {"Menu Name", "Menu Desc"}, rows); }
Example #30
Source File: HostsPageHandler.java From dubbox with Apache License 2.0 | 5 votes |
public Page handle(URL url) { List<List<String>> rows = new ArrayList<List<String>>(); Set<String> hosts = RegistryContainer.getInstance().getHosts(); int providersCount = 0; int consumersCount = 0; if (hosts != null && hosts.size() > 0) { for (String host : hosts) { List<String> row = new ArrayList<String>(); row.add(NetUtils.getHostName(host) + "/" + host); List<URL> providers = RegistryContainer.getInstance().getProvidersByHost(host); List<URL> consumers = RegistryContainer.getInstance().getConsumersByHost(host); if (providers != null && providers.size() > 0 || consumers != null && consumers.size() > 0) { URL provider = (providers != null && providers.size() > 0 ? providers.iterator().next() : consumers.iterator().next()); row.add(provider.getParameter(Constants.APPLICATION_KEY, "")); row.add(provider.getParameter("owner", "") + (provider.hasParameter("organization") ? " (" + provider.getParameter("organization") + ")" : "")); } else { row.add(""); row.add(""); } int proviedSize = providers == null ? 0 : providers.size(); providersCount += proviedSize; row.add(proviedSize == 0 ? "<font color=\"blue\">No provider</font>" : "<a href=\"providers.html?host=" + host + "\">Providers(" + proviedSize + ")</a>"); int consumersSize = consumers == null ? 0 : consumers.size(); consumersCount += consumersSize; row.add(consumersSize == 0 ? "<font color=\"blue\">No consumer</font>" : "<a href=\"consumers.html?host=" + host + "\">Consumers(" + consumersSize + ")</a>"); rows.add(row); } } return new Page("Hosts", "Hosts (" + rows.size() + ")", new String[] { "Host Name/IP:", "Application", "Owner", "Providers(" + providersCount + ")", "Consumers(" + consumersCount + ")" }, rows); }