Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * To change this license header, choose License Headers in Project Properties.
  * To change this template file, choose Tools | Templates
  * and open the template in the editor.
  */
 package org.jboss.legacy.jnp.infinispan;
 
import  org.infinispan.Cache;
import  org.jboss.as.clustering.infinispan.subsystem.CacheService;
import  org.jboss.as.controller.AbstractBoottimeAddStepHandler;
import  org.jboss.as.controller.OperationContext;
import  org.jboss.as.controller.OperationFailedException;
import  org.jboss.as.controller.ServiceVerificationHandler;
import  org.jboss.dmr.ModelNode;
import  org.jboss.msc.service.ServiceBuilder;
import  org.jboss.msc.service.ServiceController;
import  org.jboss.msc.service.ServiceTarget;

Author(s):
Emmanuel Hugonnet (c) 2013 Red Hat, inc.
public class DistributedTreeManagerServiceAddStepHandler extends AbstractBoottimeAddStepHandler {
    }
    @Override
    protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model,
            ServiceVerificationHandler verificationHandlerList<ServiceController<?>> newControllers)
            throws OperationFailedException {
        newControllers.addAll(this.installRuntimeServices(contextoperationmodelverificationHandler));
    }
    Collection<ServiceController<?>> installRuntimeServices(final OperationContext contextfinal ModelNode operation,
            final ModelNode modelfinal ServiceVerificationHandler verificationHandlerthrows OperationFailedException {
        final String cacheRef = ..resolveModelAttribute(contextoperation).asString();
        final String containerRef = ..resolveModelAttribute(contextoperation).asString();
        final DistributedTreeManagerService service = new DistributedTreeManagerService();
        final ServiceTarget serviceTarget = context.getServiceTarget();
        final ServiceBuilder<InfinispanDistributedTreeManagerserviceBuilder = serviceTarget.addService(.service);
        serviceBuilder.addDependency(CacheService.getServiceName(containerRefcacheRef), Cache.classservice.getCache());
        final ServiceController<InfinispanDistributedTreeManagerdistributedTreeManagerController = serviceBuilder.install();
        final List<ServiceController<?>> installedServices = new ArrayList<ServiceController<?>>();
        installedServices.add(distributedTreeManagerController);
        return installedServices;
    }
New to GrepCode? Check out our FAQ X