Java Code Examples for org.jboss.as.controller.OperationContext#removeService()
The following examples show how to use
org.jboss.as.controller.OperationContext#removeService() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LocalOutboundConnectionWriteHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private boolean applyModelToRuntime(OperationContext context, ModelNode operation) throws OperationFailedException { boolean reloadRequired = false; final String connectionName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue(); final ServiceName serviceName = LocalOutboundConnectionResourceDefinition.OUTBOUND_CONNECTION_CAPABILITY.getCapabilityServiceName(connectionName); final ServiceRegistry registry = context.getServiceRegistry(true); ServiceController sc = registry.getService(serviceName); if (sc != null && sc.getState() == ServiceController.State.UP) { reloadRequired = true; } else { // Service isn't up so we can bounce it context.removeService(serviceName); // safe even if the service doesn't exist // install the service with new values LocalOutboundConnectionAdd.INSTANCE.installRuntimeService(context, operation); } return reloadRequired; }
Example 2
Source File: LdapConnectionRemoveHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR)); String name = address.getLastElement().getValue(); ServiceName svcName = LdapConnectionManagerService.ServiceUtil.createServiceName(name); ServiceRegistry registry = context.getServiceRegistry(true); ServiceController<?> controller = registry.getService(svcName); boolean removeIt; ServiceController.State state = controller == null ? null : controller.getState(); if (state == ServiceController.State.UP) { removeIt = operation.hasDefined(OPERATION_HEADERS) && operation.get(OPERATION_HEADERS).hasDefined(ALLOW_RESOURCE_SERVICE_RESTART) && operation.get(OPERATION_HEADERS, ALLOW_RESOURCE_SERVICE_RESTART).asBoolean(); } else { removeIt = true; } if (removeIt) { context.removeService(svcName); } else { context.reloadRequired(); } }
Example 3
Source File: RemoteOutboundConnectionWriteHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 6 votes |
private boolean applyModelToRuntime(OperationContext context, ModelNode operation, ModelNode fullModel) throws OperationFailedException { boolean reloadRequired = false; final String connectionName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue(); final ServiceName serviceName = RemoteOutboundConnectionResourceDefinition.OUTBOUND_CONNECTION_CAPABILITY.getCapabilityServiceName(connectionName); final ServiceRegistry registry = context.getServiceRegistry(true); ServiceController sc = registry.getService(serviceName); if (sc != null && sc.getState() == ServiceController.State.UP) { reloadRequired = true; } else { // Service isn't up so we can bounce it context.removeService(serviceName); // safe even if the service doesn't exist // install the service with new values RemoteOutboundConnectionAdd.INSTANCE.installRuntimeService(context, operation, fullModel); } return reloadRequired; }
Example 4
Source File: JMXSubsystemRemove.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { if (isRemoveService(context)) { //Since so many things can depend on this, only remove if the user set the ALLOW_RESOURCE_SERVICE_RESTART operation header context.removeService(MBeanServerService.SERVICE_NAME); } else { context.reloadRequired(); } }
Example 5
Source File: OutboundSocketBindingWriteHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void handleBindingReinstall(OperationContext context, ModelNode bindingModel, ServiceName serviceName) throws OperationFailedException { context.removeService(serviceName); if (remoteDestination) { RemoteDestinationOutboundSocketBindingAddHandler.installOutboundSocketBindingService(context, bindingModel); } else { LocalDestinationOutboundSocketBindingAddHandler.installOutboundSocketBindingService(context, bindingModel); } }
Example 6
Source File: AbstractBindingWriteHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private void handleBindingReinstall(OperationContext context, String bindingName, ModelNode bindingModel, ServiceName serviceName) throws OperationFailedException { context.removeService(serviceName); try { BindingAddHandler.installBindingService(context, bindingModel, bindingName); } catch (UnknownHostException e) { throw new OperationFailedException(e.toString()); } }
Example 7
Source File: JMXSubsystemRemove.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private boolean isRemoveService(OperationContext context) { if (context.isNormalServer()) { if (context.isResourceServiceRestartAllowed()) { context.removeService(MBeanServerService.SERVICE_NAME); return true; } } return false; }
Example 8
Source File: ElytronDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
private static SecurityPropertyService uninstallSecurityPropertyService(OperationContext context) { ServiceRegistry serviceRegistry = context.getServiceRegistry(true); ServiceController<?> service = serviceRegistry.getService(SecurityPropertyService.SERVICE_NAME); if (service != null) { Object serviceImplementation = service.getService(); context.removeService(service); if (serviceImplementation != null && serviceImplementation instanceof SecurityPropertyService) { return (SecurityPropertyService) serviceImplementation; } } return null; }
Example 9
Source File: BindingRemoveHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 5 votes |
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { String name = context.getCurrentAddressValue(); ServiceName svcName = SOCKET_BINDING_CAPABILITY.getCapabilityServiceName(name); ServiceRegistry registry = context.getServiceRegistry(true); ServiceController<?> controller = registry.getService(svcName); ServiceController.State state = controller == null ? null : controller.getState(); if (!context.isResourceServiceRestartAllowed() || (state == ServiceController.State.UP)) { context.reloadRequired(); } else { context.removeService(svcName); } }
Example 10
Source File: TestHostCapableExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { context.removeService(createServiceName(context.getCurrentAddress())); }
Example 11
Source File: CustomContextExtension.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { context.removeService(CustomContextService.SERVICE_NAME); }
Example 12
Source File: JobAcquisitionRemove.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { String jobAcquisitionName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).getLastElement().getValue(); context.removeService(ServiceNames.forMscRuntimeContainerJobExecutorService(jobAcquisitionName)); }
Example 13
Source File: DomainDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void removeServices(final OperationContext context, final ServiceName parentService, final ModelNode parentModel) throws OperationFailedException { // WFCORE-2632, just for security-domain, remove also service with initial suffix. context.removeService(parentService.append(INITIAL)); super.removeServices(context, parentService, parentModel); }
Example 14
Source File: JobExecutorRemove.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { ServiceName name = ServiceNames.forMscExecutorService(); context.removeService(name); }
Example 15
Source File: SyslogAuditLogHandlerResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
static SyslogAuditLogHandler createHandler(final PathManagerService pathManager, final OperationContext context, final String name, final Resource handlerResource, final EnvironmentNameReader environmentReader) throws OperationFailedException { ServiceName serviceName = SYSLOG_AUDIT_HANDLER.append(name); if(context.getServiceRegistry(true).getService(serviceName) != null) { context.removeService(serviceName); } SyslogAuditLogHandlerService service = SyslogAuditLogHandlerService.installService(context, serviceName, handlerResource); final ModelNode handlerModel = handlerResource.getModel(); final String formatterName = FORMATTER.resolveModelAttribute(context, handlerModel).asString(); final int maxFailureCount = MAX_FAILURE_COUNT.resolveModelAttribute(context, handlerModel).asInt(); final SyslogAuditLogHandler handler = new SyslogAuditLogHandler(name, formatterName, maxFailureCount, pathManager, service); handler.setFacility(SyslogAuditLogHandler.Facility.valueOf(FACILITY.resolveModelAttribute(context, handlerModel).asString())); if (environmentReader.isServer()) { handler.setHostName(environmentReader.getHostName() != null ? environmentReader.getHostName() + ":" + environmentReader.getServerName() : environmentReader.getServerName()); } else { handler.setHostName(environmentReader.getHostName()); } handler.setAppName(resolveAppName(context, handlerModel.get(APP_NAME.getName()), environmentReader)); handler.setSyslogType(SyslogHandler.SyslogType.valueOf(SYSLOG_FORMAT.resolveModelAttribute(context, handlerModel).asString())); handler.setTruncate(TRUNCATE.resolveModelAttribute(context, handlerModel).asBoolean()); if (handlerModel.hasDefined(MAX_LENGTH.getName())) { handler.setMaxLength(MAX_LENGTH.resolveModelAttribute(context, handlerModel).asInt()); } final Set<ResourceEntry> protocols = handlerResource.getChildren(PROTOCOL); if (protocols.isEmpty()) { //We already check in SyslogAuditLogProtocolResourceDefinition that there is only one protocol throw DomainManagementLogger.ROOT_LOGGER.noSyslogProtocol(); } final ResourceEntry protocol = protocols.iterator().next(); final SyslogAuditLogHandler.Transport transport = SyslogAuditLogHandler.Transport.valueOf(protocol.getPathElement().getValue().toUpperCase(Locale.ENGLISH)); handler.setTransport(transport); try { handler.setSyslogServerAddress( InetAddress.getByName( SyslogAuditLogProtocolResourceDefinition.HOST.resolveModelAttribute(context, protocol.getModel()).asString())); } catch (UnknownHostException e) { throw new OperationFailedException(e); } handler.setPort(SyslogAuditLogProtocolResourceDefinition.PORT.resolveModelAttribute(context, protocol.getModel()).asInt()); if (transport != SyslogAuditLogHandler.Transport.UDP) { handler.setMessageTransfer( SyslogAuditLogHandler.MessageTransfer.valueOf( SyslogAuditLogProtocolResourceDefinition.Tcp.MESSAGE_TRANSFER.resolveModelAttribute(context, protocol.getModel()).asString())); handler.setReconnectTimeout(SyslogAuditLogProtocolResourceDefinition.Tcp.RECONNECT_TIMEOUT.resolveModelAttribute(context, protocol.getModel()).asInt()); } if (transport == SyslogAuditLogHandler.Transport.TLS) { final Set<ResourceEntry> tlsStores = protocol.getChildren(AUTHENTICATION); for (ResourceEntry storeEntry : tlsStores) { final ModelNode storeModel = storeEntry.getModel(); String type = storeEntry.getPathElement().getValue(); if (type.equals(CLIENT_CERT_STORE)) { handler.setTlsClientCertStorePassword( resolveUndefinableAttribute(context, SyslogAuditLogProtocolResourceDefinition.TlsKeyStore.KEYSTORE_PASSWORD, storeModel)); handler.setTlsClientCertStorePath( SyslogAuditLogProtocolResourceDefinition.TlsKeyStore.KEYSTORE_PATH.resolveModelAttribute(context, storeModel).asString()); handler.setTlsClientCertStoreRelativeTo( resolveUndefinableAttribute(context, SyslogAuditLogProtocolResourceDefinition.TlsKeyStore.KEYSTORE_RELATIVE_TO, storeModel)); handler.setTlsClientCertStoreKeyPassword( resolveUndefinableAttribute(context, SyslogAuditLogProtocolResourceDefinition.TlsKeyStore.KEY_PASSWORD, storeModel)); } else if (type.equals(TRUSTSTORE)) { handler.setTlsTruststorePassword( resolveUndefinableAttribute(context, SyslogAuditLogProtocolResourceDefinition.TlsKeyStore.KEYSTORE_PASSWORD, storeModel)); handler.setTlsTrustStorePath( SyslogAuditLogProtocolResourceDefinition.TlsKeyStore.KEYSTORE_PATH.resolveModelAttribute(context, storeModel).asString()); handler.setTlsTrustStoreRelativeTo( resolveUndefinableAttribute(context, SyslogAuditLogProtocolResourceDefinition.TlsKeyStore.KEYSTORE_RELATIVE_TO, storeModel)); } } } return handler; }
Example 16
Source File: SyslogAuditLogHandlerResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { String name = Util.getNameFromAddress(operation.require(OP_ADDR)); auditLogger.getUpdater().removeHandler(name); context.removeService(SYSLOG_AUDIT_HANDLER.append(name)); }
Example 17
Source File: LegacyConfigurationChangeResourceDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { super.performRuntime(context, operation, model); ConfigurationChangesCollector.INSTANCE.deactivate(); context.removeService(CONFIGURATION_CHANGES_CAPABILITY.getCapabilityServiceName()); }
Example 18
Source File: SpecifiedInterfaceRemoveHandler.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) { String name = context.getCurrentAddressValue(); context.removeService(InterfaceResourceDefinition.INTERFACE_CAPABILITY.getCapabilityServiceName(name)); }
Example 19
Source File: ElytronDefinition.java From wildfly-core with GNU Lesser General Public License v2.1 | 4 votes |
@Override protected void rollbackRuntime(OperationContext context, ModelNode operation, Resource resource) { uninstallSecurityPropertyService(context); context.removeService(ProviderRegistrationService.SERVICE_NAME); AUTHENITCATION_CONTEXT_PROCESSOR.setDefaultAuthenticationContext(null); }
Example 20
Source File: JobAcquisitionRemove.java From camunda-bpm-platform with Apache License 2.0 | 3 votes |
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { String jobAcquisitionName = PathAddress.pathAddress(operation.get(ModelDescriptionConstants.ADDRESS)).getLastElement().getValue(); context.removeService(ServiceNames.forMscRuntimeContainerJobExecutorService(jobAcquisitionName)); }