void outboundSocketBinding(String groupName, OutboundSocketBinding binding) { List<OutboundSocketBinding> list = this.outboundSocketBindings.get(groupName); if (list == null) { list = new ArrayList<>(); this.outboundSocketBindings.put(groupName, list); } for (OutboundSocketBinding each : list) { if (each.name().equals(binding.name())) { throw new RuntimeException("Outbound socket binding '" + binding.name() + "' already configured for '" + each.remoteHostExpression() + ":" + each.remotePortExpression() + "'"); } } list.add(binding); }
protected void applyConfiguration(ConfigKey root, OutboundSocketBinding binding) { ConfigKey key = root.append(binding.name()); applyConfiguration(key.append("remote-host"), (host) -> { binding.remoteHost(host.toString()); }); applyConfiguration(key.append("remote-port"), (port) -> { binding.remotePort(port.toString()); }); }
@Override public void customize() { List<Server> servers = fraction.subresources().servers(); servers.stream() .filter(e -> e instanceof EnhancedServer) .forEach(server -> { ((EnhancedServer) server).remoteConnections() .forEach(connection -> { OutboundSocketBinding binding = new OutboundSocketBinding(connection.name()); binding.remoteHost(connection.host()) .remotePort(connection.port()); group.outboundSocketBinding(binding); }); }); } }
protected void fixOutboundSocketBindings(SocketBindingGroup group) { ConfigKey key = ROOT.append(group.name()).append("outbound-socket-bindings"); List<SimpleKey> names = this.configView.simpleSubkeys(key); names.stream() .map(e -> e.name()) .map(name -> group.outboundSocketBindings() .stream() .filter(e -> e.name().equals(name)) .findFirst() .orElseGet(() -> { OutboundSocketBinding binding = new OutboundSocketBinding(name); group.outboundSocketBinding(binding); return binding; })) .forEach(e -> { applyConfiguration(key, e); }); }
@Override public void customize() { if (!mailInstance.isUnsatisfied()) { MailFraction mailFraction = mailInstance.get(); for (MailSession session : mailFraction.subresources().mailSessions()) { SMTPServer server = session.subresources().smtpServer(); if (server != null && server instanceof EnhancedSMTPServer) { if (server.outboundSocketBindingRef() == null) { String ref = "mail-smtp-" + ((EnhancedSMTPServer) server).sessionKey(); this.group.outboundSocketBinding( new OutboundSocketBinding(ref) .remoteHost(((EnhancedSMTPServer) server).host()) .remotePort(((EnhancedSMTPServer) server).port())); ((EnhancedSMTPServer) server).outboundSocketBindingRef(ref); } } } } } }
protected void fixOutboundSocketBindings(SocketBindingGroup group) { ConfigKey key = ROOT.append(group.name()).append("outbound-socket-bindings"); List<SimpleKey> names = this.configView.simpleSubkeys(key); names.stream() .map(e -> e.name()) .map(name -> group.outboundSocketBindings() .stream() .filter(e -> e.name().equals(name)) .findFirst() .orElseGet(() -> { OutboundSocketBinding binding = new OutboundSocketBinding(name); group.outboundSocketBinding(binding); return binding; })) .forEach(e -> { applyConfiguration(key, e); }); }
private void configureSocketBinding(PathAddress address, OutboundSocketBinding binding, List<ModelNode> list) { ModelNode node = new ModelNode(); node.get(OP_ADDR).set(address.append("remote-destination-outbound-socket-binding", binding.name()).toModelNode()); node.get(OP).set(ADD); node.get(HOST).set(new ValueExpression(binding.remoteHostExpression())); node.get(PORT).set(new ValueExpression(binding.remotePortExpression())); list.add(node); }
protected void applyConfiguration(ConfigKey root, OutboundSocketBinding binding) { ConfigKey key = root.append(binding.name()); applyConfiguration(key.append("remote-host"), (host) -> { binding.remoteHost(host.toString()); }); applyConfiguration(key.append("remote-port"), (port) -> { binding.remotePort(port.toString()); }); }
protected void fixOutboundSocketBindings(SocketBindingGroup group) { ConfigKey key = ROOT.append(group.name()).append("outbound-socket-bindings"); List<SimpleKey> names = this.configView.simpleSubkeys(key); names.stream() .map(e -> e.name()) .map(name -> group.outboundSocketBindings() .stream() .filter(e -> e.name().equals(name)) .findFirst() .orElseGet(() -> { OutboundSocketBinding binding = new OutboundSocketBinding(name); group.outboundSocketBinding(binding); return binding; })) .forEach(e -> { applyConfiguration(key, e); }); }
private void configureSocketBinding(PathAddress address, OutboundSocketBinding binding, List<ModelNode> list) { ModelNode node = new ModelNode(); node.get(OP_ADDR).set(address.append("remote-destination-outbound-socket-binding", binding.name()).toModelNode()); node.get(OP).set(ADD); node.get(HOST).set(new ValueExpression(binding.remoteHostExpression())); node.get(PORT).set(new ValueExpression(binding.remotePortExpression())); list.add(node); }
protected void applyConfiguration(ConfigKey root, OutboundSocketBinding binding) { ConfigKey key = root.append(binding.name()); applyConfiguration(key.append("remote-host"), (host) -> { binding.remoteHost(host.toString()); }); applyConfiguration(key.append("remote-port"), (port) -> { binding.remotePort(port.toString()); }); }
private void configureSocketBinding(PathAddress address, OutboundSocketBinding binding, List<ModelNode> list) { ModelNode node = new ModelNode(); node.get(OP_ADDR).set(address.append("remote-destination-outbound-socket-binding", binding.name()).toModelNode()); node.get(OP).set(ADD); node.get(HOST).set(new ValueExpression(binding.remoteHostExpression())); node.get(PORT).set(new ValueExpression(binding.remotePortExpression())); list.add(node); }
private void configureSocketBinding(PathAddress address, OutboundSocketBinding binding, List<ModelNode> list) { ModelNode node = new ModelNode(); node.get(OP_ADDR).set(address.append("remote-destination-outbound-socket-binding", binding.name()).toModelNode()); node.get(OP).set(ADD); node.get(HOST).set(new ValueExpression(binding.remoteHostExpression())); node.get(PORT).set(new ValueExpression(binding.remotePortExpression())); list.add(node); }