use of org.wildfly.swarm.spi.api.config.SimpleKey in project wildfly-swarm by wildfly-swarm.
the class NetworkConfigurer method fixOutboundSocketBindings.
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);
});
}
use of org.wildfly.swarm.spi.api.config.SimpleKey in project wildfly-swarm by wildfly-swarm.
the class InterfaceExtension method afterBeanDiscovery.
@SuppressWarnings("unused")
void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager beanManager) throws Exception {
List<SimpleKey> configuredInterfaces = this.configView.simpleSubkeys(ROOT);
for (SimpleKey interfaceName : configuredInterfaces) {
Set<Bean<?>> ifaces = beanManager.getBeans(Interface.class, AnyLiteral.INSTANCE);
if (ifaces.stream().noneMatch(e -> e.getQualifiers().stream().anyMatch(anno -> anno instanceof Named && ((Named) anno).value().equals(interfaceName + "-interface")))) {
Interface iface = new Interface(interfaceName.name(), "0.0.0.0");
applyConfiguration(iface);
CommonBean<Interface> interfaceBean = CommonBeanBuilder.newBuilder(Interface.class).beanClass(InterfaceExtension.class).scope(ApplicationScoped.class).addQualifier(AnyLiteral.INSTANCE).addQualifier(new NamedLiteral(interfaceName.name() + "-interface")).createSupplier(() -> iface).addType(Interface.class).addType(Object.class).build();
abd.addBean(interfaceBean);
}
}
}
use of org.wildfly.swarm.spi.api.config.SimpleKey in project wildfly-swarm by wildfly-swarm.
the class ArtifactDeployer method deploy.
public void deploy() throws Exception {
List<SimpleKey> subkeys = configView.simpleSubkeys(ConfigKey.of("swarm", "deployment"));
for (SimpleKey subkey : subkeys) {
String spec = subkey.name();
if (spec.contains(":")) {
String[] parts = spec.split(":");
String groupId = parts[0];
parts = parts[1].split("\\.");
String artifactId = parts[0];
String packaging = parts[1];
JavaArchive artifact = Swarm.artifact(groupId + ":" + artifactId + ":" + packaging + ":*", artifactId + "." + packaging);
deployer.get().deploy(artifact, spec);
}
}
}
use of org.wildfly.swarm.spi.api.config.SimpleKey in project wildfly-swarm by wildfly-swarm.
the class ConfigNode method recursiveChild.
/**
* Set the value of a descendant.
*
* <p>Any intermediate leafs will be created as-needed.</p>
*
* @param key The possibly-complex key to a descendant.
* @param value The value to set.
*/
public void recursiveChild(ConfigKey key, Object value) {
SimpleKey head = key.head();
if (head == ConfigKey.EMPTY) {
value(value);
}
ConfigKey rest = key.subkey(1);
if (rest == ConfigKey.EMPTY) {
child(head, value);
} else {
ConfigNode child = child(head);
if (child == null) {
child = new ConfigNode();
child(head, child);
}
child.recursiveChild(rest, value);
}
}
use of org.wildfly.swarm.spi.api.config.SimpleKey in project wildfly-swarm by wildfly-swarm.
the class ConfigNode method descendant.
ConfigNode descendant(ConfigKey key) {
SimpleKey head = key.head();
if (head == ConfigKey.EMPTY) {
return this;
}
ConfigKey rest = key.subkey(1);
ConfigNode child = child(head);
if (child == null) {
return null;
}
return child.descendant(rest);
}
Aggregations