use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class TransportConfigurationBuilder method configure.
@Override
public Builder<TransportConfiguration<T>> configure(OperationContext context, ModelNode model) throws OperationFailedException {
this.socketBinding = new InjectedValueDependency<>(CommonUnaryRequirement.SOCKET_BINDING.getServiceName(context, SOCKET_BINDING.resolveModelAttribute(context, model).asString()), SocketBinding.class);
this.diagnosticsSocketBinding = ModelNodes.optionalString(DIAGNOSTICS_SOCKET_BINDING.resolveModelAttribute(context, model)).map(diagnosticsBinding -> new InjectedValueDependency<>(CommonUnaryRequirement.SOCKET_BINDING.getServiceName(context, diagnosticsBinding), SocketBinding.class)).orElse(null);
Optional<String> machine = ModelNodes.optionalString(MACHINE.resolveModelAttribute(context, model));
Optional<String> rack = ModelNodes.optionalString(RACK.resolveModelAttribute(context, model));
Optional<String> site = ModelNodes.optionalString(SITE.resolveModelAttribute(context, model));
if (site.isPresent() || rack.isPresent() || machine.isPresent()) {
this.topology = new Topology() {
@Override
public String getMachine() {
return machine.orElse(null);
}
@Override
public String getRack() {
return rack.orElse(null);
}
@Override
public String getSite() {
return site.orElse(null);
}
};
}
PathAddress address = context.getCurrentAddress();
EnumSet.complementOf(EnumSet.of(ThreadPoolResourceDefinition.TIMER)).forEach(pool -> this.threadPoolFactories.put(pool, new InjectedValueDependency<>(new ThreadPoolServiceNameProvider(address, pool.getPathElement()), ThreadPoolFactory.class)));
this.timerFactory = new InjectedValueDependency<>(new ThreadPoolServiceNameProvider(address, ThreadPoolResourceDefinition.TIMER.getPathElement()), TimerFactory.class);
return super.configure(context, model);
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class JGroupsSubsystemXMLReader method parseRelay.
private void parseRelay(XMLExtendedStreamReader reader, PathAddress stackAddress, Map<PathAddress, ModelNode> operations) throws XMLStreamException {
PathAddress address = stackAddress.append(RelayResourceDefinition.PATH);
ModelNode operation = Util.createAddOperation(address);
operations.put(address, operation);
for (int i = 0; i < reader.getAttributeCount(); i++) {
XMLAttribute attribute = XMLAttribute.forName(reader.getAttributeLocalName(i));
switch(attribute) {
case SITE:
{
readAttribute(reader, i, operation, RelayResourceDefinition.Attribute.SITE);
break;
}
default:
{
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
if (!operation.hasDefined(RelayResourceDefinition.Attribute.SITE.getName())) {
throw ParseUtils.missingRequired(reader, EnumSet.of(XMLAttribute.SITE));
}
while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
XMLElement element = XMLElement.forName(reader.getLocalName());
switch(element) {
case REMOTE_SITE:
{
this.parseRemoteSite(reader, address, operations);
break;
}
case PROPERTY:
{
this.parseProperty(reader, address, operations);
break;
}
default:
{
throw ParseUtils.unexpectedElement(reader);
}
}
}
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class JGroupsSubsystemXMLReader method parseChannel.
private void parseChannel(XMLExtendedStreamReader reader, PathAddress subsystemAddress, Map<PathAddress, ModelNode> operations) throws XMLStreamException {
String name = require(reader, XMLAttribute.NAME);
PathAddress address = subsystemAddress.append(ChannelResourceDefinition.pathElement(name));
ModelNode operation = Util.createAddOperation(address);
operations.put(address, operation);
for (int i = 0; i < reader.getAttributeCount(); i++) {
ParseUtils.requireNoNamespaceAttribute(reader, i);
XMLAttribute attribute = XMLAttribute.forName(reader.getAttributeLocalName(i));
switch(attribute) {
case NAME:
{
// Already parsed
break;
}
case STACK:
{
readAttribute(reader, i, operation, ChannelResourceDefinition.Attribute.STACK);
break;
}
case MODULE:
{
readAttribute(reader, i, operation, ChannelResourceDefinition.Attribute.MODULE);
break;
}
case CLUSTER:
{
if (this.schema.since(JGroupsSchema.VERSION_4_0)) {
readAttribute(reader, i, operation, ChannelResourceDefinition.Attribute.CLUSTER);
break;
}
}
case STATISTICS_ENABLED:
{
if (this.schema.since(JGroupsSchema.VERSION_4_1)) {
readAttribute(reader, i, operation, ChannelResourceDefinition.Attribute.STATISTICS_ENABLED);
break;
}
}
default:
{
throw ParseUtils.unexpectedAttribute(reader, i);
}
}
}
while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
XMLElement element = XMLElement.forName(reader.getLocalName());
switch(element) {
case FORK:
{
this.parseFork(reader, address, operations);
break;
}
default:
{
throw ParseUtils.unexpectedElement(reader);
}
}
}
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class JGroupsSubsystemXMLReader method parseSocketProtocol.
private void parseSocketProtocol(XMLExtendedStreamReader reader, PathAddress stackAddress, Map<PathAddress, ModelNode> operations) throws XMLStreamException {
String type = require(reader, XMLAttribute.TYPE);
PathAddress address = stackAddress.append(ProtocolResourceDefinition.pathElement(type));
ModelNode operation = Util.createAddOperation(address);
operations.put(address, operation);
for (int i = 0; i < reader.getAttributeCount(); i++) {
this.parseSocketProtocolAttribute(reader, i, operation);
}
while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
this.parseProtocolElement(reader, address, operations);
}
}
use of org.jboss.as.controller.PathAddress in project wildfly by wildfly.
the class JGroupsSubsystemXMLReader method parseStack.
private void parseStack(XMLExtendedStreamReader reader, PathAddress subsystemAddress, Map<PathAddress, ModelNode> operations) throws XMLStreamException {
String name = require(reader, XMLAttribute.NAME);
PathAddress address = subsystemAddress.append(StackResourceDefinition.pathElement(name));
ModelNode operation = Util.createAddOperation(address);
operations.put(address, operation);
while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) {
XMLElement element = XMLElement.forName(reader.getLocalName());
switch(element) {
case TRANSPORT:
{
this.parseTransport(reader, address, operations);
break;
}
case PROTOCOL:
{
this.parseProtocol(reader, address, operations);
break;
}
case RELAY:
{
if (this.schema.since(JGroupsSchema.VERSION_2_0)) {
this.parseRelay(reader, address, operations);
break;
}
}
case SOCKET_PROTOCOL:
{
if (this.schema.since(JGroupsSchema.VERSION_4_1)) {
this.parseSocketProtocol(reader, address, operations);
break;
}
}
case JDBC_PROTOCOL:
{
if (this.schema.since(JGroupsSchema.VERSION_4_1)) {
this.parseJDBCProtocol(reader, address, operations);
break;
}
}
case ENCRYPT_PROTOCOL:
{
if (this.schema.since(JGroupsSchema.VERSION_4_1)) {
this.parseEncryptProtocol(reader, address, operations);
break;
}
}
default:
{
throw ParseUtils.unexpectedElement(reader);
}
}
}
}
Aggregations