@Override public Object execute() throws Exception { proxyService.addProxy(url, proxyTo); return null; }
@Override public void updated(Dictionary<String, ?> properties) { if (proxyService != null) { proxyService.initProxies(); } } }
@Override public Object execute() throws Exception { proxyService.removeProxy(prefix); return null; }
@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 Map<String, String> getProxies() throws MBeanException { return proxyService.getProxies(); }
@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 Map<String, String> getProxies() throws MBeanException { return proxyService.getProxies(); }
@Override public Object execute() throws Exception { proxyService.addProxy(url, proxyTo); return null; }
@Override public Object execute() throws Exception { proxyService.removeProxy(prefix); return null; }
@Override public void updated(Dictionary<String, ?> properties) { if (proxyService != null) { proxyService.initProxies(); } } }
@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 int complete(Session session, CommandLine commandLine, List<String> candidates) { StringsCompleter delegate = new StringsCompleter(); try { Set<String> urls = proxyService.getProxies().keySet(); for (String url : urls) { delegate.getStrings().add(url); } } catch (Exception e) { // nothing to do } return delegate.complete(session, commandLine, candidates); }
@Override public void addProxy(String url, String proxyTo) throws MBeanException { try { proxyService.addProxy(url, proxyTo); } catch (Exception e) { throw new MBeanException(null, e.toString()); } }
@Override public void removeProxy(String url) throws MBeanException { try { proxyService.removeProxy(url); } catch (Exception e) { throw new MBeanException(null, e.toString()); } }
@Override public int complete(Session session, CommandLine commandLine, List<String> candidates) { StringsCompleter delegate = new StringsCompleter(); try { Set<String> urls = proxyService.getProxies().keySet(); for (String url : urls) { delegate.getStrings().add(url); } } catch (Exception e) { // nothing to do } return delegate.complete(session, commandLine, candidates); }
@Override public void addProxy(String url, String proxyTo) throws MBeanException { try { proxyService.addProxy(url, proxyTo); } catch (Exception e) { throw new MBeanException(null, e.toString()); } }
@Override public void removeProxy(String url) throws MBeanException { try { proxyService.removeProxy(url); } catch (Exception e) { throw new MBeanException(null, e.toString()); } }
@Override public Object execute() throws Exception { ShellTable table = new ShellTable(); table.column("URL"); table.column("ProxyTo"); for (String url : proxyService.getProxies().keySet()) { table.addRow().addContent(url, proxyService.getProxies().get(url)); } table.print(System.out); return null; }
@Override public Object execute() throws Exception { ShellTable table = new ShellTable(); table.column("URL"); table.column("ProxyTo"); for (String url : proxyService.getProxies().keySet()) { table.addRow().addContent(url, proxyService.getProxies().get(url)); } table.print(System.out); return null; }