public void postConstruct() { nwListeners = networkConfig.getNetworkListeners(); } }
}, config.getNetworkListeners(), httpService.getVirtualServerByName(defaultVirtualServer), config.getProtocols()); } catch (TransactionFailure tf) { tf.printStackTrace();
private NetworkListener getAdminListener() { final NetworkConfig network = networkConfig(); final NetworkListener listener = network.getNetworkListener(ADMIN_LISTENER_NAME); return listener; }
public static Protocols getProtocols(NetworkConfig config) throws TransactionFailure { Protocols protocols = config.getProtocols(); if (protocols == null) { protocols = (Protocols) ConfigSupport.apply(new SingleConfigCode<NetworkConfig>() { public Object run(NetworkConfig param) throws TransactionFailure { final Protocols child = param.createChild(Protocols.class); param.setProtocols(child); return child; } }, config); } return protocols; }
public static Protocol findProtocol(NetworkListener listener) { return listener.getParent().getParent().findProtocol(listener.getProtocol()); }
public static ThreadPool findThreadPool(NetworkListener listener) { final NetworkListeners listeners = listener.getParent(); List<ThreadPool> list = listeners.getThreadPool(); if (list == null || list.isEmpty()) { final ConfigBeanProxy parent = listener.getParent().getParent().getParent(); final Dom proxy = Dom.unwrap(parent).element("thread-pools"); final List<Dom> domList = proxy.nodeElements("thread-pool"); list = new ArrayList<ThreadPool>(domList.size()); for (Dom dom : domList) { list.add(dom.<ThreadPool>createProxy()); } } for (ThreadPool pool : list) { if (listener.getThreadPool().equals(pool.getName())) { return pool; } } return null; }
public static Transport findTransport(NetworkListener listener) { List<Transport> list = listener.getParent().getParent().getTransports().getTransport(); for (Transport transport : list) { if (listener.getTransport().equals(transport.getName())) { return transport; } } return null; }
public static Protocol findProtocol(NetworkConfig config, String name) { for (final Protocol protocol : config.getProtocols().getProtocol()) { if (protocol.getName().equals(name)) { return protocol; } } return null; }
public static Protocol findProtocol(NetworkListener listener) { return listener.getParent().getParent().findProtocol(listener.getProtocol()); }
public static ThreadPool findThreadPool(NetworkListener listener) { final NetworkListeners listeners = listener.getParent(); List<ThreadPool> list = listeners.getThreadPool(); if (list == null || list.isEmpty()) { final ConfigBeanProxy parent = listener.getParent().getParent().getParent(); final Dom proxy = Dom.unwrap(parent).element("thread-pools"); final List<Dom> domList = proxy.nodeElements("thread-pool"); list = new ArrayList<ThreadPool>(domList.size()); for (Dom dom : domList) { list.add(dom.<ThreadPool>createProxy()); } } for (ThreadPool pool : list) { if (listener.getThreadPool().equals(pool.getName())) { return pool; } } return null; }
public static Transport findTransport(NetworkListener listener) { List<Transport> list = listener.getParent().getParent().getTransports().getTransport(); for (Transport transport : list) { if (listener.getTransport().equals(transport.getName())) { return transport; } } return null; }
public static NetworkListener getNetworkListener(NetworkConfig config, String name) { if (name != null) { for (final NetworkListener listener : config.getNetworkListeners().getNetworkListener()) { if (listener.getName().equals(name)) { return listener; } } } return null; } }
public static Protocol findProtocol(NetworkConfig config, String name) { for (final Protocol protocol : config.getProtocols().getProtocol()) { if (protocol.getName().equals(name)) { return protocol; } } return null; }
/** * Restart {@link NetworkListener}. * * @param networkListenerName * @param timeout restart timeout, if timeout value is negative - then no timeout will be applied. * @param timeUnit restart timeout unit * * @throws TimeoutException thrown if timeout had expired before server succeeded to restart * @throws IOException */ public void restartNetworkListener(String networkListenerName, long timeout, TimeUnit timeUnit) throws IOException, TimeoutException { restartNetworkListener( config.getNetworkConfig().getNetworkListener(networkListenerName), timeout, timeUnit); }
public Protocol findOrCreateProtocol(final String name, final boolean create) throws TransactionFailure { NetworkConfig networkConfig = config.getNetworkConfig(); Protocol protocol = networkConfig.findProtocol(name); if (protocol == null && create) { protocol = (Protocol) ConfigSupport.apply(new SingleConfigCode<Protocols>() { @Override public Object run(Protocols param) throws TransactionFailure { Protocol newProtocol = param.createChild(Protocol.class); newProtocol.setName(name); newProtocol.setSecurityEnabled("true"); param.getProtocol().add(newProtocol); return newProtocol; } }, habitat.<Protocols>getService(Protocols.class)); } return protocol; }
final NetworkConfig networkConfig = listener.getParent(NetworkListeners.class).getParent(NetworkConfig.class); for (VirtualServer vs : networkConfig.getParent(Config.class).getHttpService().getVirtualServer()) { List<String> vsListeners = StringUtils.parseStringList(vs.getNetworkListeners(), " ,");
public static NetworkListener getNetworkListener(NetworkConfig config, String name) { if (name != null) { for (final NetworkListener listener : config.getNetworkListeners().getNetworkListener()) { if (listener.getName().equals(name)) { return listener; } } } return null; } }
private Protocols writableProtocols() throws TransactionFailure { if (protocols_w == null) { final NetworkConfig nc = config_w.getNetworkConfig(); if (nc == null) { return null; } final Protocols p = nc.getProtocols(); protocols_w = t.enroll(p); } return protocols_w; }
public static List<NetworkListener> findNetworkListeners(VirtualServer server) { final String listeners = server.getNetworkListeners(); final String[] strings = listeners == null ? new String[0] : listeners.split(","); final NetworkConfig config = server.getParent().getParent(Config.class).getNetworkConfig(); List<NetworkListener> list = new ArrayList<NetworkListener>(); for (String s : strings) { final String name = s.trim(); final NetworkListener networkListener = config.getNetworkListener(name); if (networkListener != null) { list.add(networkListener); } } return list; } }
@Override public void delete(final DeleteSsl command, final ActionReport report) { try { NetworkConfig networkConfig = command.config.getNetworkConfig(); final Protocol protocol = networkConfig.findProtocol(command.listenerId); if (protocol != null) { ConfigSupport.apply(new SingleConfigCode<Protocol>() { public Object run(Protocol param) { param.setSecurityEnabled("false"); param.setSsl(null); return null; } }, protocol); } } catch (TransactionFailure transactionFailure) { command.reportError(report, transactionFailure); } } }