Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2013, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.wildfly.extension.rts;
 
 import java.util.List;
 

Author(s):
Gytis Trikleris
 
 
     static final RTSSubsystemAdd INSTANCE = new RTSSubsystemAdd();
 
     private RTSSubsystemAdd() {
     }
 
     @Override
     protected void populateModel(ModelNode operationModelNode modelthrows OperationFailedException {
         if (..isTraceEnabled()) {
             ..trace("RTSSubsystemAdd.populateModel");
         }
 
         ..validateAndSet(operationmodel);
         ..validateAndSet(operationmodel);
         ..validateAndSet(operationmodel);
     }
 
     @Override
     public void performBoottime(OperationContext contextModelNode operationModelNode model,
             ServiceVerificationHandler verificationHandlerList<ServiceController<?>> newControllers)
             throws OperationFailedException {
 
         if (..isTraceEnabled()) {
             ..trace("RTSSubsystemAdd.performBoottime");
         }
 
         registerCoordinatorService(contextmodelverificationHandlernewControllers);
         registerParticipantService(contextmodelverificationHandlernewControllers);
         registerVolatileParticipantService(contextmodelverificationHandlernewControllers);
         registerInboundBridgeService(contextverificationHandlernewControllers);
 
         registerDeploymentProcessors(context);
     }
 
     private void registerInboundBridgeService(final OperationContext context,
               final ServiceVerificationHandler verificationHandlerfinal List<ServiceController<?>> newControllers) {
 
         final InboundBridgeService inboundBridgeService = new InboundBridgeService();
         final ServiceBuilder<InboundBridgeServiceinboundBridgeServiceBuilder = context
                 .getServiceTarget()
                 .addService(.inboundBridgeService)
                 .addListener(verificationHandler)
 
         inboundBridgeServiceBuilder.setInitialMode(..);
 
        final ServiceController<InboundBridgeServiceinboundBridgeServiceController = inboundBridgeServiceBuilder.install();
        if (newControllers != null) {
            newControllers.add(inboundBridgeServiceController);
        }
    }
    private void registerCoordinatorService(final OperationContext contextfinal ModelNode model,
            final ServiceVerificationHandler verificationHandlerfinal List<ServiceController<?>> newControllers) {
        final String socketBindingName = model.get(..getLocalName()).asString();
        final String serverName = model.get(..getLocalName()).asString();
        final String hostName = model.get(..getLocalName()).asString();
        final CoordinatorService coordinatorService = new CoordinatorService();
        final ServiceBuilder<CoordinatorServicecoordinatorServiceBuilder = context
                .getServiceTarget()
                .addService(.coordinatorService)
                .addListener(verificationHandler)
                .addDependency(..append(socketBindingName), SocketBinding.class,
                        coordinatorService.getInjectedSocketBinding())
                .addDependency(UndertowService.virtualHostName(serverNamehostName), Host.class,
                        coordinatorService.getInjectedHost());
        coordinatorServiceBuilder.setInitialMode(..);
        final ServiceController<CoordinatorServicecoordinatorServiceController = coordinatorServiceBuilder.install();
        if (newControllers != null) {
            newControllers.add(coordinatorServiceController);
        }
    }
    private void registerParticipantService(final OperationContext contextfinal ModelNode model,
            final ServiceVerificationHandler verificationHandlerfinal List<ServiceController<?>> newControllers) {
        final String socketBindingName = model.get(..getLocalName()).asString();
        final String serverName = model.get(..getLocalName()).asString();
        final String hostName = model.get(..getLocalName()).asString();
        final ParticipantService participantService = new ParticipantService();
        final ServiceBuilder<ParticipantServiceparticipantServiceBuilder = context
                .getServiceTarget()
                .addService(.participantService)
                .addListener(verificationHandler)
                .addDependency(..append(socketBindingName), SocketBinding.class,
                        participantService.getInjectedSocketBinding())
                .addDependency(UndertowService.virtualHostName(serverNamehostName), Host.class,
                        participantService.getInjectedHost());
        participantServiceBuilder.setInitialMode(..);
        final ServiceController<ParticipantServiceparticipantServiceController = participantServiceBuilder.install();
        if (newControllers != null) {
            newControllers.add(participantServiceController);
        }
    }
    private void registerVolatileParticipantService(final OperationContext contextfinal ModelNode model,
            final ServiceVerificationHandler verificationHandlerfinal List<ServiceController<?>> newControllers) {
        final String socketBindingName = model.get(..getLocalName()).asString();
        final String serverName = model.get(..getLocalName()).asString();
        final String hostName = model.get(..getLocalName()).asString();
        final VolatileParticipantService volatileParticipantService = new VolatileParticipantService();
        final ServiceBuilder<VolatileParticipantServicevolatileParticipantServiceBuilder = context
                .getServiceTarget()
                .addService(.volatileParticipantService)
                .addListener(verificationHandler)
                .addDependency(..append(socketBindingName), SocketBinding.class,
                        volatileParticipantService.getInjectedSocketBinding())
                .addDependency(UndertowService.virtualHostName(serverNamehostName), Host.class,
                        volatileParticipantService.getInjectedHost());
        volatileParticipantServiceBuilder.setInitialMode(..);
        final ServiceController<VolatileParticipantServicevolatileParticipantServiceController =
                volatileParticipantServiceBuilder.install();
        if (newControllers != null) {
            newControllers.add(volatileParticipantServiceController);
        }
    }
    private void registerDeploymentProcessors(final OperationContext context) {
        context.addStep(new AbstractDeploymentChainStep() {
            public void execute(final DeploymentProcessorTarget processorTarget) {
                processorTarget.addDeploymentProcessor(..,
                        .new InboundBridgeDeploymentProcessor());
            }
        }, ..);
    }
New to GrepCode? Check out our FAQ X