Search in sources :

Example 36 with ActiveMQServer

use of org.apache.activemq.artemis.core.server.ActiveMQServer in project wildfly by wildfly.

the class SecuritySettingRemove method performRuntime.

@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    final ActiveMQServer server = getServer(context, operation);
    if (server != null) {
        final PathAddress address = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR));
        final String match = address.getLastElement().getValue();
        server.getSecurityRepository().removeMatch(match);
    }
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) PathAddress(org.jboss.as.controller.PathAddress)

Example 37 with ActiveMQServer

use of org.apache.activemq.artemis.core.server.ActiveMQServer in project wildfly by wildfly.

the class BridgeRemove method performRuntime.

@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    final String name = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)).getLastElement().getValue();
    final ServiceRegistry registry = context.getServiceRegistry(true);
    final ServiceName serviceName = MessagingServices.getActiveMQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
    final ServiceController<?> service = registry.getService(serviceName);
    if (service != null && service.getState() == ServiceController.State.UP) {
        ActiveMQServer server = ActiveMQServer.class.cast(service.getValue());
        try {
            server.getActiveMQServerControl().destroyBridge(name);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            // TODO should this be an OFE instead?
            throw new RuntimeException(e);
        }
    }
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) ServiceName(org.jboss.msc.service.ServiceName) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) OperationFailedException(org.jboss.as.controller.OperationFailedException)

Aggregations

ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)37 ServiceName (org.jboss.msc.service.ServiceName)20 PathAddress (org.jboss.as.controller.PathAddress)19 OperationFailedException (org.jboss.as.controller.OperationFailedException)12 ModelNode (org.jboss.dmr.ModelNode)9 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)5 ActiveMQActivationService.getActiveMQServer (org.wildfly.extension.messaging.activemq.ActiveMQActivationService.getActiveMQServer)4 Role (org.apache.activemq.artemis.core.security.Role)3 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)3 HttpServerExchange (io.undertow.server.HttpServerExchange)2 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)2 ConnectionFactoryControl (org.apache.activemq.artemis.api.jms.management.ConnectionFactoryControl)2 JMSServerControl (org.apache.activemq.artemis.api.jms.management.JMSServerControl)2 TopicControl (org.apache.activemq.artemis.api.jms.management.TopicControl)2 RemotingService (org.apache.activemq.artemis.core.remoting.server.RemotingService)2 OperationContext (org.jboss.as.controller.OperationContext)2 Resource (org.jboss.as.controller.registry.Resource)2 ContextNames (org.jboss.as.naming.deployment.ContextNames)2 StartException (org.jboss.msc.service.StartException)2 SocketChannel (io.netty.channel.socket.SocketChannel)1