private NetworkConfig getNetworkConfig() throws TransactionFailure { NetworkConfig config = currentConfig.getNetworkConfig(); if (config == null) { config = (NetworkConfig) ConfigSupport.apply(new SingleConfigCode<Config>() { public Object run(Config param) throws PropertyVetoException, TransactionFailure { final NetworkConfig netConfig = param.createChild(NetworkConfig.class); netConfig.setProtocols(netConfig.createChild(Protocols.class)); netConfig.setNetworkListeners(netConfig.createChild(NetworkListeners.class)); netConfig.setTransports(netConfig.createChild(Transports.class)); param.setNetworkConfig(netConfig); return netConfig; } }, currentConfig); } return config; }
private NetworkConfig getNetworkConfig() throws TransactionFailure { NetworkConfig config = currentConfig.getNetworkConfig(); if (config == null) { config = (NetworkConfig) ConfigSupport.apply(new SingleConfigCode<Config>() { public Object run(Config param) throws PropertyVetoException, TransactionFailure { final NetworkConfig netConfig = param.createChild(NetworkConfig.class); netConfig.setProtocols(netConfig.createChild(Protocols.class)); netConfig.setNetworkListeners(netConfig.createChild(NetworkListeners.class)); netConfig.setTransports(netConfig.createChild(Transports.class)); param.setNetworkConfig(netConfig); return netConfig; } }, currentConfig); } return config; }
public static NetworkListener getAdminListener(Config config) { NetworkConfig nwc = config.getNetworkConfig(); if (nwc == null) throw new IllegalStateException("Can't operate without <http-service>"); List<NetworkListener> lss = nwc.getNetworkListeners().getNetworkListener(); if (lss == null || lss.isEmpty()) throw new IllegalStateException("Can't operate without at least one <network-listener>"); for (NetworkListener ls : lss) { if (ServerTags.ADMIN_LISTENER_ID.equals(ls.getName())) { return ls; } } // if we can't find the admin-listener, then use the first one return lss.get(0); }
public static NetworkListener getAdminListener(Config config) { NetworkConfig nwc = config.getNetworkConfig(); if (nwc == null) throw new IllegalStateException("Can't operate without <http-service>"); List<NetworkListener> lss = nwc.getNetworkListeners().getNetworkListener(); if (lss == null || lss.isEmpty()) throw new IllegalStateException("Can't operate without at least one <network-listener>"); for (NetworkListener ls : lss) { if (ServerTags.ADMIN_LISTENER_ID.equals(ls.getName())) { return ls; } } // if we can't find the admin-listener, then use the first one return lss.get(0); }
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; }
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; }
private Protocol findProtocol(final String protocolName) { final NetworkConfig nc = config_w.getNetworkConfig(); if (nc == null) { return null; } final Protocols ps = nc.getProtocols(); if (ps == null) { return null; } return ps.findProtocol(protocolName); }
private Protocol findProtocol(final String protocolName) { final NetworkConfig nc = config_w.getNetworkConfig(); if (nc == null) { return null; } final Protocols ps = nc.getProtocols(); if (ps == null) { return null; } return ps.findProtocol(protocolName); }
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; } }
/** * 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); }
private NetworkListener writableNetworkListener( final Transaction t, final Config config_w, final String listenerName) throws TransactionFailure { NetworkListener nl_w = null; final NetworkConfig nc = config_w.getNetworkConfig(); if (nc == null) { return null; } NetworkListener nl = nc.getNetworkListener(listenerName); if (nl == null) { return null; } else { nl_w = t.enroll(nl); } return nl_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 name : strings) { final NetworkListener networkListener = config.getNetworkListener(name); if (networkListener != null) { list.add(networkListener); } } return list; } }
public static NetworkListener findNetworkListener(VirtualServer server, String name) { final String listeners = server.getNetworkListeners(); if (listeners != null && listeners.contains(name)) { final NetworkConfig config = server.getParent().getParent(Config.class).getNetworkConfig(); return config.getNetworkListener(name); } else { return null; } }
public static NetworkListener findNetworkListener(VirtualServer server, String name) { final String listeners = server.getNetworkListeners(); if (listeners != null && listeners.contains(name)) { final NetworkConfig config = server.getParent().getParent(Config.class).getNetworkConfig(); return config.getNetworkListener(name); } else { return null; } }
private void migrateThreadPools(ThreadPools threadPools) throws TransactionFailure { final Config config = threadPools.getParent(Config.class); final NetworkListeners networkListeners = config.getNetworkConfig().getNetworkListeners(); threadPools.getThreadPool().addAll(networkListeners.getThreadPool()); ConfigSupport.apply(new SingleConfigCode<NetworkListeners>() { public Object run(NetworkListeners param) { param.getThreadPool().clear(); return null; } }, networkListeners); }
private void migrateThreadPools(ThreadPools threadPools) throws TransactionFailure { final Config config = threadPools.getParent(Config.class); final NetworkListeners networkListeners = config.getNetworkConfig().getNetworkListeners(); threadPools.getThreadPool().addAll(networkListeners.getThreadPool()); ConfigSupport.apply(new SingleConfigCode<NetworkListeners>() { public Object run(NetworkListeners param) { param.getThreadPool().clear(); return null; } }, networkListeners); }
private void updateHttp(final String maxTransactionTimeout) throws TransactionFailure { for (Protocol protocol : currentConfig.getNetworkConfig().getProtocols().getProtocol()) { final Http http = protocol.getHttp(); if (http != null) { ConfigSupport.apply(new SingleConfigCode<Http>() { @Override public Object run(Http param) { if (param != null) { param.setRequestTimeoutSeconds(maxTransactionTimeout); } return null; } }, http); } } }
private void updateHttp(final String maxTransactionTimeout) throws TransactionFailure { for (Protocol protocol : currentConfig.getNetworkConfig().getProtocols().getProtocol()) { final Http http = protocol.getHttp(); if (http != null) { ConfigSupport.apply(new SingleConfigCode<Http>() { @Override public Object run(Http param) { if (param != null) { param.setRequestTimeoutSeconds(maxTransactionTimeout); } return null; } }, http); } } }
private void prepareDASConfig() throws TransactionFailure, PropertyVetoException { final Config dasConfig = writableConfig(configs.getConfigByName(DAS_CONFIG_NAME)); final NetworkConfig nc = dasConfig.getNetworkConfig(); final NetworkListener nl_w = transaction().enroll(nc.getNetworkListener(SecureAdminCommand.ADMIN_LISTENER_NAME)); nl_w.setProtocol(SecureAdminCommand.ADMIN_LISTENER_NAME); }
private void ensureConfigReady(final Config c, final String adminListenerProtocol) throws TransactionFailure, PropertyVetoException { final NetworkConfig nc = c.getNetworkConfig(); final NetworkListener nl = nc.getNetworkListener(SecureAdminCommand.ADMIN_LISTENER_NAME); if (nl != null) { return; } /* * Create an admin-listener for this configuration. */ final Config config_w = writableConfig(c); createAdminNetworkListener(transaction(), nc, adminListenerProtocol); createAdminVirtualServer(transaction(), config_w); }