private static DomainHostExcludeRegistry.VersionKey getVersionKey(OperationContext context, ModelNode model) throws OperationFailedException { ModelNode release = HOST_RELEASE.resolveModelAttribute(context, model); if (release.isDefined()) { KnownRelease kr = KnownRelease.fromName(release.asString()); ModelVersion modelVersion = kr.kernelAPIVersion.getModelVersion(); return new DomainHostExcludeRegistry.VersionKey(modelVersion.getMajor(), modelVersion.getMinor(), modelVersion.getMicro()); } else { int major = MANAGEMENT_MAJOR_VERSION.resolveModelAttribute(context, model).asInt(); int minor = MANAGEMENT_MINOR_VERSION.resolveModelAttribute(context, model).asInt(); ModelNode micro = MANAGEMENT_MICRO_VERSION.resolveModelAttribute(context, model); return new DomainHostExcludeRegistry.VersionKey(major, minor, micro.asIntOrNull()); } }
private static DomainHostExcludeRegistry.VersionKey getVersionKey(OperationContext context, ModelNode model) throws OperationFailedException { ModelNode release = HOST_RELEASE.resolveModelAttribute(context, model); if (release.isDefined()) { KnownRelease kr = KnownRelease.fromName(release.asString()); ModelVersion modelVersion = kr.kernelAPIVersion.getModelVersion(); return new DomainHostExcludeRegistry.VersionKey(modelVersion.getMajor(), modelVersion.getMinor(), modelVersion.getMicro()); } else { int major = MANAGEMENT_MAJOR_VERSION.resolveModelAttribute(context, model).asInt(); int minor = MANAGEMENT_MINOR_VERSION.resolveModelAttribute(context, model).asInt(); ModelNode micro = MANAGEMENT_MICRO_VERSION.resolveModelAttribute(context, model); return new DomainHostExcludeRegistry.VersionKey(major, minor, micro.asIntOrNull()); } }
static void installOutboundSocketBindingService(final OperationContext context, final ModelNode model) throws OperationFailedException { final CapabilityServiceTarget serviceTarget = context.getCapabilityServiceTarget(); // socket name final String outboundSocketName = context.getCurrentAddressValue(); final String socketBindingRef = LocalDestinationOutboundSocketBindingResourceDefinition.SOCKET_BINDING_REF.resolveModelAttribute(context, model).asString(); // (optional) source interface final String sourceInterfaceName = OutboundSocketBindingResourceDefinition.SOURCE_INTERFACE.resolveModelAttribute(context, model).asStringOrNull(); // (optional) source port final Integer sourcePort = OutboundSocketBindingResourceDefinition.SOURCE_PORT.resolveModelAttribute(context, model).asIntOrNull(); // (optional but defaulted) fixedSourcePort final boolean fixedSourcePort = OutboundSocketBindingResourceDefinition.FIXED_SOURCE_PORT.resolveModelAttribute(context, model).asBoolean(); // create the service final LocalDestinationOutboundSocketBindingService outboundSocketBindingService = new LocalDestinationOutboundSocketBindingService(outboundSocketName, sourcePort, fixedSourcePort); final CapabilityServiceBuilder<OutboundSocketBinding> serviceBuilder = serviceTarget.addCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY, outboundSocketBindingService); // if a source interface has been specified then add a dependency on it if (sourceInterfaceName != null) { serviceBuilder.addCapabilityRequirement("org.wildfly.network.interface", NetworkInterfaceBinding.class, outboundSocketBindingService.getSourceNetworkInterfaceBindingInjector(), sourceInterfaceName); } serviceBuilder.addCapabilityRequirement(SOCKET_BINDING_CAPABILITY_NAME, SocketBinding.class, outboundSocketBindingService.getLocalDestinationSocketBindingInjector(), socketBindingRef) .addCapabilityRequirement("org.wildfly.management.socket-binding-manager", SocketBindingManager.class, outboundSocketBindingService.getSocketBindingManagerInjector()) .setInitialMode(ServiceController.Mode.ON_DEMAND) .addAliases(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(outboundSocketName)) .install(); } }
static void installOutboundSocketBindingService(final OperationContext context, final ModelNode model) throws OperationFailedException { final CapabilityServiceTarget serviceTarget = context.getCapabilityServiceTarget(); // socket name final String outboundSocketName = context.getCurrentAddressValue(); // destination host final String destinationHost = RemoteDestinationOutboundSocketBindingResourceDefinition.HOST.resolveModelAttribute(context, model).asString(); // port final int destinationPort = RemoteDestinationOutboundSocketBindingResourceDefinition.PORT.resolveModelAttribute(context, model).asInt(); // (optional) source interface final String sourceInterfaceName = OutboundSocketBindingResourceDefinition.SOURCE_INTERFACE.resolveModelAttribute(context, model).asStringOrNull(); // (optional) source port final Integer sourcePort = OutboundSocketBindingResourceDefinition.SOURCE_PORT.resolveModelAttribute(context, model).asIntOrNull(); // (optional but defaulted) fixedSourcePort final boolean fixedSourcePort = OutboundSocketBindingResourceDefinition.FIXED_SOURCE_PORT.resolveModelAttribute(context, model).asBoolean(); // create the service final OutboundSocketBindingService outboundSocketBindingService = new RemoteDestinationOutboundSocketBindingService(outboundSocketName, destinationHost, destinationPort, sourcePort, fixedSourcePort); final CapabilityServiceBuilder<OutboundSocketBinding> serviceBuilder = serviceTarget.addCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY, outboundSocketBindingService); // if a source interface has been specified then add a dependency on it if (sourceInterfaceName != null) { serviceBuilder.addCapabilityRequirement("org.wildfly.network.interface", NetworkInterfaceBinding.class, outboundSocketBindingService.getSourceNetworkInterfaceBindingInjector(), sourceInterfaceName); } serviceBuilder.addCapabilityRequirement("org.wildfly.management.socket-binding-manager", SocketBindingManager.class, outboundSocketBindingService.getSocketBindingManagerInjector()) .setInitialMode(ServiceController.Mode.ON_DEMAND) .addAliases(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(outboundSocketName)) .install(); } }
static void installOutboundSocketBindingService(final OperationContext context, final ModelNode model) throws OperationFailedException { final CapabilityServiceTarget serviceTarget = context.getCapabilityServiceTarget(); // socket name final String outboundSocketName = context.getCurrentAddressValue(); final String socketBindingRef = LocalDestinationOutboundSocketBindingResourceDefinition.SOCKET_BINDING_REF.resolveModelAttribute(context, model).asString(); // (optional) source interface final String sourceInterfaceName = OutboundSocketBindingResourceDefinition.SOURCE_INTERFACE.resolveModelAttribute(context, model).asStringOrNull(); // (optional) source port final Integer sourcePort = OutboundSocketBindingResourceDefinition.SOURCE_PORT.resolveModelAttribute(context, model).asIntOrNull(); // (optional but defaulted) fixedSourcePort final boolean fixedSourcePort = OutboundSocketBindingResourceDefinition.FIXED_SOURCE_PORT.resolveModelAttribute(context, model).asBoolean(); // create the service final LocalDestinationOutboundSocketBindingService outboundSocketBindingService = new LocalDestinationOutboundSocketBindingService(outboundSocketName, sourcePort, fixedSourcePort); final CapabilityServiceBuilder<OutboundSocketBinding> serviceBuilder = serviceTarget.addCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY, outboundSocketBindingService); // if a source interface has been specified then add a dependency on it if (sourceInterfaceName != null) { serviceBuilder.addCapabilityRequirement("org.wildfly.network.interface", NetworkInterfaceBinding.class, outboundSocketBindingService.getSourceNetworkInterfaceBindingInjector(), sourceInterfaceName); } serviceBuilder.addCapabilityRequirement(SOCKET_BINDING_CAPABILITY_NAME, SocketBinding.class, outboundSocketBindingService.getLocalDestinationSocketBindingInjector(), socketBindingRef) .addCapabilityRequirement("org.wildfly.management.socket-binding-manager", SocketBindingManager.class, outboundSocketBindingService.getSocketBindingManagerInjector()) .setInitialMode(ServiceController.Mode.ON_DEMAND) .addAliases(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(outboundSocketName)) .install(); } }
static void installOutboundSocketBindingService(final OperationContext context, final ModelNode model) throws OperationFailedException { final CapabilityServiceTarget serviceTarget = context.getCapabilityServiceTarget(); // socket name final String outboundSocketName = context.getCurrentAddressValue(); // destination host final String destinationHost = RemoteDestinationOutboundSocketBindingResourceDefinition.HOST.resolveModelAttribute(context, model).asString(); // port final int destinationPort = RemoteDestinationOutboundSocketBindingResourceDefinition.PORT.resolveModelAttribute(context, model).asInt(); // (optional) source interface final String sourceInterfaceName = OutboundSocketBindingResourceDefinition.SOURCE_INTERFACE.resolveModelAttribute(context, model).asStringOrNull(); // (optional) source port final Integer sourcePort = OutboundSocketBindingResourceDefinition.SOURCE_PORT.resolveModelAttribute(context, model).asIntOrNull(); // (optional but defaulted) fixedSourcePort final boolean fixedSourcePort = OutboundSocketBindingResourceDefinition.FIXED_SOURCE_PORT.resolveModelAttribute(context, model).asBoolean(); // create the service final OutboundSocketBindingService outboundSocketBindingService = new RemoteDestinationOutboundSocketBindingService(outboundSocketName, destinationHost, destinationPort, sourcePort, fixedSourcePort); final CapabilityServiceBuilder<OutboundSocketBinding> serviceBuilder = serviceTarget.addCapability(OUTBOUND_SOCKET_BINDING_CAPABILITY, outboundSocketBindingService); // if a source interface has been specified then add a dependency on it if (sourceInterfaceName != null) { serviceBuilder.addCapabilityRequirement("org.wildfly.network.interface", NetworkInterfaceBinding.class, outboundSocketBindingService.getSourceNetworkInterfaceBindingInjector(), sourceInterfaceName); } serviceBuilder.addCapabilityRequirement("org.wildfly.management.socket-binding-manager", SocketBindingManager.class, outboundSocketBindingService.getSocketBindingManagerInjector()) .setInitialMode(ServiceController.Mode.ON_DEMAND) .addAliases(OutboundSocketBinding.OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME.append(outboundSocketName)) .install(); } }
String algorithm = ALGORITHM.resolveModelAttribute(context, operation).asStringOrNull(); String signatureAlgorithm = SIGNATURE_ALGORITHM.resolveModelAttribute(context, operation).asStringOrNull(); Integer keySize = KEY_SIZE.resolveModelAttribute(context, operation).asIntOrNull(); String distinguishedName = DISTINGUISHED_NAME.resolveModelAttribute(context, operation).asString(); String notBefore = NOT_BEFORE.resolveModelAttribute(context, operation).asStringOrNull();