Examples of LbConfig


Examples of com.sun.appserv.management.config.LBConfig

           if (GuiUtil.isEmpty(lbConfigName)){
               handlerCtx.setOutputValue("result", result);
               return;
           }
          
           LBConfig lbConfig = AMXUtil.getDomainConfig().getLBConfigMap().get(lbConfigName);
           if (lbConfig == null){
               handlerCtx.setOutputValue("result", result);
               return;
           }
          
           Map<String, ServerRefConfig> serverRefMap = lbConfig.getServerRefConfigMap();
           Set<String> targets = serverRefMap.keySet();
           Boolean isCluster = false;
           if (serverRefMap.isEmpty()){
               Map<String, ClusterRefConfig> clusterRefMap = lbConfig.getClusterRefConfigMap();
               if (clusterRefMap.isEmpty()){
                   handlerCtx.setOutputValue("isCluster",isCluster);
                   handlerCtx.setOutputValue("result", result);
                    return;
               }else{
View Full Code Here

Examples of com.sun.appserv.management.config.LBConfig

            @HandlerOutput(name="advance", type=Map.class),
            @HandlerOutput(name="props", type=Map.class)}
     )
     public static void getLBConfigInfo(HandlerContext handlerCtx){
        String lbName = (String)handlerCtx.getInputValue("lbName");
        LBConfig lbConfig = getLBConfigOfLoadBalancer(lbName);
        if (lbConfig == null){
            GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.noSuchLB", new Object[]{lbName}));
            return;
        }
        String lbConfigName = lbConfig.getName();
        Map advance = new HashMap();
        handlerCtx.setOutputValue("lbConfigName", lbConfigName);
        advance.put("responseTimeoutInSeconds", lbConfig.getResponseTimeoutInSeconds());
        advance.put("reloadPollIntervalInSeconds", lbConfig.getReloadPollIntervalInSeconds());
        advance.put("httpsRouting",lbConfig.getHttpsRouting());
        advance.put("monitoringEnabled",lbConfig.getMonitoringEnabled());
        advance.put("routeCookieEnabled", lbConfig.getRouteCookieEnabled());
        handlerCtx.setOutputValue("advance", advance);
       
        Map<String, String> props = lbConfig.getProperties();
        handlerCtx.setOutputValue("props", props);
    }
View Full Code Here

Examples of com.sun.appserv.management.config.LBConfig

    )
    public static void saveLBConfig(HandlerContext handlerCtx){
        String lbConfigName = (String)handlerCtx.getInputValue("lbConfigName");
        Map advance = (Map) handlerCtx.getInputValue("advance");
        try{
            LBConfig lbConfig = AMXUtil.getDomainConfig().getLBConfigMap().get(lbConfigName);
            if (lbConfig == null){
                GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("loadBalancer.noSuchLBError"));
                return;
            }
            lbConfig.setResponseTimeoutInSeconds((String) advance.get("responseTimeoutInSeconds"));
            lbConfig.setReloadPollIntervalInSeconds((String)advance.get("reloadPollIntervalInSeconds"));

            Boolean temp = (Boolean) advance.get("httpsRouting");
            lbConfig.setHttpsRouting( (temp == null) ? false : temp);

            temp = (Boolean) advance.get("monitoringEnabled");
            lbConfig.setMonitoringEnabled( (temp == null) ? false : temp);

            temp = (Boolean)advance.get("routeCookieEnabled");
            lbConfig.setRouteCookieEnabled( (temp==null)? false: temp);

            AMXUtil.editProperties(handlerCtx, lbConfig);
       
        }catch (Exception ex){
            GuiUtil.handleException(handlerCtx, ex);
View Full Code Here

Examples of com.sun.appserv.management.config.LBConfig

            @HandlerOutput(name="result", type=java.util.List.class)}
     )
    public static void getLoadBalancerTargetTableList(HandlerContext handlerCtx){
       
        String lbName = (String)handlerCtx.getInputValue("lbName");
        LBConfig lbConfig = getLBConfigOfLoadBalancer(lbName);
        if (lbConfig == null){
            GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.noSuchLB", new Object[]{lbName}));
            return;
        }
        String[] targets = AMXUtil.getLBConfigHelper().listTargets(lbName);
        List result = new ArrayList();
        boolean isCluster = true;
        if(targets.length > 0)
            isCluster = TargetUtil.isCluster(targets[0])//all targets will either be cluster or instance.
       
        for(int i=0; i<targets.length; i++ ){
            HashMap oneRow = new HashMap();
            String targetName = targets[i];
            oneRow.put("targetName", targetName);
            oneRow.put("lbConfigName", lbConfig.getName());
            oneRow.put("selected", false);
            oneRow.put("appLink", ApplicationHandlers.getNumberLBAppsByTarget(targetName));
            if(isCluster){
                oneRow.put("policy", lbConfig.getClusterRefConfigMap().get(targetName).getLBPolicy());
                oneRow.put("targetLink", "/cluster/clusterGeneral.jsf?clusterName="+targetName);
                oneRow.put("clusterInstanceLink", TargetUtil.getNumberLBInstancesByTarget(targetName));
            }else{
                oneRow.put("lbEnabled", lbConfig.getServerRefConfigMap().get(targetName).getLBEnabled());
               
                oneRow.put("responseTimeoutInMinutes", ""+lbConfig.getServerRefConfigMap().get(targetName).getDisableTimeoutInMinutes());
                oneRow.put("targetLink", "/standalone/standaloneInstanceGeneral.jsf?instanceName="+targetName);
            }
            result.add(oneRow);
        }
        handlerCtx.setOutputValue("result", result);
View Full Code Here

Examples of com.sun.appserv.management.config.LBConfig

        String[] targetsArray = AMXUtil.getLBConfigHelper().listTargets(lbName);
        List<String> associatedTargets = Arrays.asList(targetsArray);
       
        LoadBalancerConfig lb = AMXUtil.getDomainConfig().getLoadBalancerConfigMap().get(lbName);
        String lbConfigName = lb.getLbConfigName();
        LBConfig lbConfig = AMXUtil.getDomainConfig().getLBConfigMap().get(lbConfigName);
       
        if (selTargets.size()>0){
            isCluster = TargetUtil.isCluster(selTargets.get(0));
            for(String sel: selTargets){
                AMXConfig sc = null;
                if(isCluster)
                    sc = AMXUtil.getDomainConfig().getClusterConfigMap().get(sel);
                else
                    sc = AMXUtil.getDomainConfig().getStandaloneServerConfigMap().get(sel);
                if (sc == null){
                    GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("loadBalancer.targetHelp"));
                    return;
                }
            }
        }
       
        try{
            //be sure to remove the old targets first. otherwise, if changing from all server to all cluster or visa versa
            //will result in error.
            for(String targetName: associatedTargets) {
                if(!(selTargets.contains(targetName))) {
                    if (TargetUtil.isCluster(targetName))
                        lbConfig.removeClusterRefConfig(targetName);
                    else
                        lbConfig.removeServerRefConfig(targetName);
                }
            }
            
            for(String targetName: selTargets) {
                if(!(associatedTargets.contains(targetName))) {
                    if (isCluster)
                        lbConfig.createClusterRefConfig(targetName, null);
                    else
                        lbConfig.createServerRefConfig(targetName, null);
                }
            }
        }catch(Exception ex){
            GuiUtil.handleException(handlerCtx, ex);
        }
View Full Code Here

Examples of com.sun.appserv.management.config.LBConfig

            @HandlerOutput(name="isInstance", type=Boolean.class)}
     )
     public static void getLBHealthAndPolicy(HandlerContext handlerCtx){
        String lbName = (String)handlerCtx.getInputValue("lbName");
        String targetName = (String)handlerCtx.getInputValue("targetName");
        LBConfig lbConfig = getLBConfigOfLoadBalancer(lbName);
        if (lbConfig == null){
            GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.noSuchLB", new Object[]{lbName}));
            return;
        }
        String lbConfigName = lbConfig.getName();
        Map advance = new HashMap();
        Boolean isCluster = TargetUtil.isCluster(targetName);
        handlerCtx.setOutputValue("lbConfigName", lbConfigName);
        handlerCtx.setOutputValue("isCluster", isCluster);
        handlerCtx.setOutputValue("isInstance", !isCluster);
        HealthCheckerConfig hcc = null;
        if(isCluster){
            ClusterRefConfig cref = lbConfig.getClusterRefConfigMap().get(targetName);
            advance.put("lBPolicy", ""+cref.getLBPolicy());
            String tmp = cref.getLBPolicyModule();
            advance.put("lBPolicyModule", (tmp == null) ? "" : tmp);
            hcc = cref.getHealthCheckerConfig();
        }else{
            ServerRefConfig sref = lbConfig.getServerRefConfigMap().get(targetName);
            advance.put("lbEnabled", sref.getLBEnabled());
            advance.put("enabled", sref.getEnabled());
            advance.put("disableTimeoutInMinutes", ""+sref.getDisableTimeoutInMinutes());
            hcc = sref.getHealthCheckerConfig();
        }
View Full Code Here

Examples of com.sun.appserv.management.config.LBConfig

        String lbConfigName = (String)handlerCtx.getInputValue("lbConfigName");
        String targetName = (String)handlerCtx.getInputValue("targetName");
        Boolean isCluster = TargetUtil.isCluster(targetName);
        Map advance = (Map) handlerCtx.getInputValue("advance");
        try{
            LBConfig lbConfig = AMXUtil.getDomainConfig().getLBConfigMap().get(lbConfigName);
            if (lbConfig == null){
                GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("loadBalancer.noSuchLBError"));
                return;
            }
            HealthCheckerConfig hcc = null;
            HealthCheckerConfigCR ref = null;
            if(isCluster){
                ClusterRefConfig cref = lbConfig.getClusterRefConfigMap().get(targetName);
                String policy = (String) advance.get("lBPolicy");
                cref.setLBPolicy(policy);
                if ("user-defined".equals(policy))
                    cref.setLBPolicyModule( "" + advance.get("lBPolicyModule"));
                else
                    cref.setLBPolicyModule("");
                hcc = cref.getHealthCheckerConfig();
                ref = cref;
            }else{
                ServerRefConfig sref = lbConfig.getServerRefConfigMap().get(targetName);
                Boolean temp = (Boolean) advance.get("lbEnabled");
                sref.setLBEnabled( (temp == null) ? false : temp);
                sref.setDisableTimeoutInMinutes( Integer.parseInt(""+advance.get("disableTimeoutInMinutes")));
                hcc = sref.getHealthCheckerConfig();
                ref = sref;
View Full Code Here

Examples of com.sun.appserv.management.config.LBConfig

        String  lbName = (String) handlerCtx.getInputValue("lbName");
        boolean enabled = ((Boolean)handlerCtx.getInputValue("enabled")).booleanValue();
       
        List selectedRows = (List) obj;
        try{
            LBConfig lbConfig = getLBConfigOfLoadBalancer(lbName);
            if (lbConfig == null){
                GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.noSuchLB", new Object[]{lbName}));
                return;
            }
            for(int i=0; i< selectedRows.size(); i++){
                Map oneRow = (Map) selectedRows.get(i);
                String target = (String) oneRow.get("targetName");
                ServerRefConfig sref = lbConfig.getServerRefConfigMap().get(target);
                if (sref != null)
                    sref.setLBEnabled(enabled);
            }
        }catch(Exception ex){
            GuiUtil.handleException(handlerCtx, ex);
View Full Code Here

Examples of com.sun.appserv.management.config.LBConfig

            @HandlerOutput(name="lastExport", type=String.class)}
    )
    public static void getLBExportInfo(HandlerContext handlerCtx){
        String lbName = (String)handlerCtx.getInputValue("lbName");
        LoadBalancer loadBalancer = AMXUtil.getDomainRoot().getLoadBalancerMap().get(lbName);
        LBConfig lBConfig = getLBConfigOfLoadBalancer(lbName);
        if (loadBalancer == null || lBConfig == null ){
            GuiUtil.prepareAlert(handlerCtx, "error", GuiUtil.getMessage("msg.loadBalancer.NoSuchLB", new Object[]{lbName}), null);
        }
        try{
            Date lastApplyDate = loadBalancer.getLastApplied();
            Date lastExportDate = loadBalancer.getLastExported();
            DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, GuiUtil.getLocale());
            String lastApply = (lastApplyDate == null)? "" : dateFormat.format(lastApplyDate);
            String lastExport = (lastExportDate == null)? "" : dateFormat.format(lastExportDate);
            handlerCtx.setOutputValue("lastApply", lastApply);
            handlerCtx.setOutputValue("lastExport", lastExport);
            handlerCtx.setOutputValue("lbConfigName", lBConfig.getName());
           
        }catch(Exception ex){
            GuiUtil.handleException(handlerCtx, ex);
        }
    }               
View Full Code Here

Examples of com.sun.appserv.management.config.LBConfig

        LoadBalancerConfig loadBalancerConfig = AMXUtil.getDomainConfig().getLoadBalancerConfigMap().get(lbName);
        if (loadBalancerConfig==null){
            return null;
        }
        String lbConfigName = loadBalancerConfig.getLbConfigName();
        LBConfig lbConfig = AMXUtil.getDomainConfig().getLBConfigMap().get(lbConfigName);
        return lbConfig;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.