Package org.apache.stratos.lb.endpoint

Examples of org.apache.stratos.lb.endpoint.TenantLoadBalanceMembershipHandler


    /**
     * @param lbconfig
     */
    private void generateGroupMgtAgents(LoadBalancerConfiguration lbconfig) {
        TenantLoadBalanceMembershipHandler handler =
            ConfigHolder.getInstance()
                .getTenantLoadBalanceMembershipHandler();

        if (handler == null) {
            String msg =
                "TenantLoadBalanceMembershipHandler is null. Thus, We cannot proceed.";
            log.error(msg);
            throw new SynapseException(msg);
        }

        Map<String, HostContext> hostContexts = lbconfig.getHostContextMap();

        // Add the Axis2 GroupManagement agents
        if (hostContexts != null) {
            // iterate through each host context
            for (HostContext hostCtxt : hostContexts.values()) {
                // each host can has multiple Tenant Contexts, iterate through them
                for (TenantDomainContext tenantCtxt : hostCtxt
                    .getTenantDomainContexts()) {

                    String domain = tenantCtxt.getDomain();
                    String subDomain = tenantCtxt.getSubDomain();

                    // creates the group management agent
                    GroupMgtAgentBuilder.createGroupMgtAgent(domain,
                        subDomain);
                }

                // add to the handler
                handler.addHostContext(hostCtxt);
            }
        }
    }
View Full Code Here


    }

    @Override
  public void removeClusterDomain(String domain, String subDomain, String hostName) {

    TenantLoadBalanceMembershipHandler handler =
                                                 ConfigHolder.getInstance()
                                                             .getTenantLoadBalanceMembershipHandler();

    if (handler == null) {
      String msg = "TenantLoadBalanceMembershipHandler is null. Thus, We cannot proceed.";
      log.error(msg);
      throw new SynapseException(msg);
    }

    handler.removeHostContext(hostName);
   
    LoadBalancerConfiguration lbConfig = ConfigHolder.getInstance().getLbConfig();
   
    lbConfig.removeServiceConfiguration(domain, subDomain);
   
View Full Code Here

                log.debug("Group management agent is already available for cluster domain: " +
                          domain + " and sub domain: " + subDomain);
            }
        }

        TenantLoadBalanceMembershipHandler handler =
                                                     ConfigHolder.getInstance()
                                                                 .getTenantLoadBalanceMembershipHandler();

        if (handler == null) {
            String msg = "TenantLoadBalanceMembershipHandler is null. Thus, We cannot proceed.";
            log.error(msg);
            throw new SynapseException(msg);
        }

        HostContext hostCtxt;

        // if there's an already registered HostContext use it
        if((hostCtxt = handler.getHostContext(hostName)) == null){
            hostCtxt = new HostContext(hostName);
        }
       
        List<TenantDomainContext> ctxts;
        ctxts = new ArrayList<TenantDomainContext>(hostCtxt.getTenantDomainContexts());

        // default value is super tenant mode - which is defined by tenant id 0, in this context
        int tenantId = 0;
        if(!"*".equals(tenantRange)){
          tenantId = Integer.parseInt(tenantRange);
        }
               
        ctxts.add(new TenantDomainContext(tenantId, domain, subDomain));

        hostCtxt.addTenantDomainContexts(ctxts);

        handler.addHostContext(hostCtxt);

        return hostCtxt;
    }
View Full Code Here

                        }
                    }
                }

                tlbMembershipHandler =
                                       new TenantLoadBalanceMembershipHandler(hostContexts,
                                                                              algorithm, cfgCtx,
                                                                              isClusteringEnabled,
                                                                              getName());

                // set TenantLoadBalanceMembershipHandler for future reference
View Full Code Here

TOP

Related Classes of org.apache.stratos.lb.endpoint.TenantLoadBalanceMembershipHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.