private void deployLBCluster( String loadBalancedService, LBDataContext lbDataCtxt, String tenantRange) throws ADCException, UnregisteredCartridgeException { if (lbDataCtxt.getLbCategory() == null || lbDataCtxt.getLbCategory().equals(Constants.NO_LOAD_BALANCER)) { // no load balancer required return; } LBService lbService = null; if (lbDataCtxt.getLbCategory().equals(Constants.EXISTING_LOAD_BALANCERS)) { lbService = new ExistingLBService( lbDataCtxt.getLbCartridgeInfo().getType(), lbDataCtxt.getAutoscalePolicy(), lbDataCtxt.getDeploymentPolicy(), -1234, lbDataCtxt.getLbCartridgeInfo(), tenantRange); } else if (lbDataCtxt.getLbCategory().equals(Constants.DEFAULT_LOAD_BALANCER)) { lbService = new DefaultLBService( lbDataCtxt.getLbCartridgeInfo().getType(), lbDataCtxt.getAutoscalePolicy(), lbDataCtxt.getDeploymentPolicy(), -1234, lbDataCtxt.getLbCartridgeInfo(), tenantRange); } else if (lbDataCtxt.getLbCategory().equals(Constants.SERVICE_AWARE_LOAD_BALANCER)) { lbService = new ServiceAwareLBService( lbDataCtxt.getLbCartridgeInfo().getType(), lbDataCtxt.getAutoscalePolicy(), lbDataCtxt.getDeploymentPolicy(), -1234, lbDataCtxt.getLbCartridgeInfo(), tenantRange); } if (lbService == null) { throw new ADCException( "The given Load Balancer category " + lbDataCtxt.getLbCategory() + " not found"); } // Set the load balanced service type lbService.setLoadBalancedServiceType(loadBalancedService); // Set if the load balanced service is multi tenant or not // lbService.setLoadBalancedServiceMultiTenant(true); // TODO --- temp hack // set the relevant deployment policy // log.info(" ******* Setting Deployment Policy name : ------> " + // lbDataCtxt.getDeploymentPolicy()); // loadBalancerCategory.setDeploymentPolicyName(lbDataCtxt.getDeploymentPolicy()); Properties lbProperties = null; if (lbDataCtxt.getLbProperperties() != null && !lbDataCtxt.getLbProperperties().isEmpty()) { lbProperties = new Properties(); lbProperties.setProperties(lbDataCtxt.getLbProperperties().toArray(new Property[0])); } // create service lbService.create(); // add LB category to the payload if (lbService.getPayloadData() != null) { lbService.getPayloadData().add(CartridgeConstants.LB_CATEGORY, lbDataCtxt.getLbCategory()); } // delpoy lbService.deploy(lbProperties); // persist persist(lbService); }