@Override public TabularData getServlets() throws MBeanException { try { CompositeType servletType = new CompositeType("Servlet", "HTTP Servlet", new String[]{"Bundle-ID", "Servlet", "Servlet Name", "State", "Alias", "URL"}, new String[]{"ID of the bundle that registered the servlet", "Class name of the servlet", "Servlet Name", "Current state of the servlet", "Aliases of the servlet", "URL of the servlet"}, new OpenType[]{SimpleType.LONG, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); TabularType tableType = new TabularType("Servlets", "Table of all HTTP servlets", servletType, new String[]{"Bundle-ID", "Servlet Name", "State"}); TabularData table = new TabularDataSupport(tableType); List<ServletInfo> servletInfos = servletService.getServlets(); for (ServletInfo info : servletInfos) { CompositeData data = new CompositeDataSupport(servletType, new String[]{"Bundle-ID", "Servlet", "Servlet Name", "State", "Alias", "URL"}, new Object[]{info.getBundleId(), info.getClassName(), info.getName(), info.getStateString(), info.getAlias(), Arrays.toString(info.getUrls())}); table.put(data); } return table; } catch (Exception e) { throw new MBeanException(null, e.toString()); } }
@Override public TabularData getServlets() throws MBeanException { try { CompositeType servletType = new CompositeType("Servlet", "HTTP Servlet", new String[]{"Bundle-ID", "Servlet", "Servlet Name", "State", "Alias", "URL"}, new String[]{"ID of the bundle that registered the servlet", "Class name of the servlet", "Servlet Name", "Current state of the servlet", "Aliases of the servlet", "URL of the servlet"}, new OpenType[]{SimpleType.LONG, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING}); TabularType tableType = new TabularType("Servlets", "Table of all HTTP servlets", servletType, new String[]{"Bundle-ID", "Servlet Name", "State"}); TabularData table = new TabularDataSupport(tableType); List<ServletInfo> servletInfos = servletService.getServlets(); for (ServletInfo info : servletInfos) { CompositeData data = new CompositeDataSupport(servletType, new String[]{"Bundle-ID", "Servlet", "Servlet Name", "State", "Alias", "URL"}, new Object[]{info.getBundleId(), info.getClassName(), info.getName(), info.getStateString(), info.getAlias(), Arrays.toString(info.getUrls())}); table.put(data); } return table; } catch (Exception e) { throw new MBeanException(null, e.toString()); } }
@Override protected Object doExecute() throws Exception { ShellTable table = new ShellTable(); table.column(new Col("ID")); table.column(new Col("Servlet")); table.column(new Col("Servlet-Name")); table.column(new Col("State")); table.column(new Col("Alias")); table.column(new Col("Url")); for (ServletInfo info : servletService.getServlets()) { table.addRow().addContent(info.getBundle().getBundleId(), info.getClassName(), info.getName(), info.getStateString(), info.getAlias(), Arrays.toString(info.getUrls())); } table.print(System.out, !noFormat); return null; }
@Override public Object execute() throws Exception { ShellTable table = new ShellTable(); table.column(new Col("ID")); table.column(new Col("Servlet")); table.column(new Col("Servlet-Name")); table.column(new Col("State")); table.column(new Col("Alias")); table.column(new Col("Url")); for (ServletInfo info : servletService.getServlets()) { table.addRow().addContent(info.getBundleId(), info.getClassName(), info.getName(), info.getStateString(), info.getAlias(), Arrays.toString(info.getUrls())); } table.print(System.out, !noFormat); return null; }
@Override public Object execute() throws Exception { ShellTable table = new ShellTable(); table.column(new Col("ID")); table.column(new Col("Servlet")); table.column(new Col("Servlet-Name")); table.column(new Col("State")); table.column(new Col("Alias")); table.column(new Col("Url")); for (ServletInfo info : servletService.getServlets()) { table.addRow().addContent(info.getBundleId(), info.getClassName(), info.getName(), info.getStateString(), info.getAlias(), Arrays.toString(info.getUrls())); } table.print(System.out, !noFormat); return null; }