Package com.sun.appserv.management.ext.lb

Examples of com.sun.appserv.management.ext.lb.LoadBalancer


        for(String key : loadBalancerConfigMap.keySet()){
            try{
                String status = GuiUtil.getMessage("loadBalancer.unknown");
                HashMap oneRow = new HashMap();
                oneRow.put("name", key);
                LoadBalancer lb = AMXUtil.getDomainRoot().getLoadBalancerMap().get(key);
                if( lb != null){
                    status = GuiUtil.getMessage(lb.isApplyChangeRequired()? "loadBalancer.needApply" : "loadBalancer.upToDate");
                }
                oneRow.put("status", status);
                oneRow.put("selected", false);
                result.add(oneRow);
            }catch (Exception ex){
View Full Code Here


        if ( lbMap == null){
                System.out.println("testLoadBalancerConnection(): AMX getLoadBalancerMap() returns null");
                GuiUtil.prepareAlert(handlerCtx, "error", GuiUtil.getMessage("msg.loadBalancer.NoSuchLB", new Object[]{lbName}), null);
                return;
            }
        LoadBalancer loadBalancer = (LoadBalancer) lbMap.get(lbName);
        try {
        if (loadBalancer == null){
            GuiUtil.prepareAlert(handlerCtx, "error", GuiUtil.getMessage("msg.loadBalancer.NoSuchLB", new Object[]{lbName}), null);
            System.out.println("testLoadBalancerConnection(): lbMap.get(" + lbName+ ")returns null");
            System.out.println("loadbalancer map returned from getLoadBalancerMap() : " + lbMap);
        }else{
            Boolean ok = loadBalancer.testConnection();
            if (ok)
                GuiUtil.prepareAlert(handlerCtx, "success", GuiUtil.getMessage("msg.loadBalancer.TestConnectionSuccess"), null);
            else
                GuiUtil.prepareAlert(handlerCtx, "error", GuiUtil.getMessage("msg.loadBalancer.TestConnectionFailed"), null);
        }
View Full Code Here

            @HandlerOutput(name="lastApply", type=String.class),
            @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);
View Full Code Here

        input={
            @HandlerInput(name="lbName", type=String.class, required=true)}
    )
    public static void applyLBChanges(HandlerContext handlerCtx){
        String lbName = (String)handlerCtx.getInputValue("lbName");
        LoadBalancer loadBalancer = AMXUtil.getDomainRoot().getLoadBalancerMap().get(lbName);
        if (loadBalancer == null){
            GuiUtil.prepareAlert(handlerCtx, "error", GuiUtil.getMessage("msg.loadBalancer.NoSuchLB", new Object[]{lbName}), null);
        }
        try{
            loadBalancer.applyLBChanges();
            GuiUtil.prepareAlert(handlerCtx, "success", GuiUtil.getMessage("msg.ApplyLBSuccessful"), null);
        }catch(Exception ex){
            GuiUtil.handleException(handlerCtx, ex);
        }
    }          
View Full Code Here

        final LoadBalancerConfig loadBalancerConfig =
            getProxy( loadBalancerConfigObjectName, LoadBalancerConfig.class);
           
        final LoadBalancerImpl loadBalancerImpl =
            new LoadBalancerImpl(mMBeanServer, loadBalancerConfig);
        LoadBalancer loadBalancerProxy = null;
        try
        {
            final ObjectName actualObjectName = mMBeanServer.registerMBean(
                loadBalancerImpl, loadBalancerObjName).getObjectName();
               
View Full Code Here

   
    private LoadBalancer createLoadBalancer(final String configName) {
        mDomainConfig.createLoadBalancerConfig(
            configName+LB_SUFFIX, configName, false, null);
        Map<String,LoadBalancer> lbs = mDomainRoot.getLoadBalancerMap();
        LoadBalancer lb = lbs.get(configName+LB_SUFFIX);
        return lb;
    }
View Full Code Here

        {
            MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), getPort(),
                                                                  getUser(), getPassword());
            DomainRoot domainRoot = ProxyFactory.getInstance(mbsc).getDomainRoot();
            String lbName = (String) getOperands().get(0);
            LoadBalancer loadBalancer = domainRoot.getLoadBalancerMap().get(lbName);
            if (loadBalancer == null)
            {
                throw new CommandException(_strMgr.getString("NoLBFound",
                                            new Object[]{lbName}));
            }
            loadBalancer.applyLBChanges();
            CLILogger.getInstance().printDetailMessage(getLocalizedString(
                   "CommandSuccessful",
                   new Object[] {name}));
        }
        catch(Exception e)
View Full Code Here

                } catch ( MalformedObjectNameException e ){
                    if(_logger.isLoggable(Level.FINE))
                        e.printStackTrace();
                    continue;
                }
                LoadBalancer loadBalancer =
                        (LoadBalancer) ProxyFactory.getInstance(
                        MBeanServerFactory.getMBeanServer()).getProxy(loadBalancerObjName);
               
                //apply changes if required
                if(loadBalancer.isApplyChangeRequired()) {
                    loadBalancer.applyLBChanges();
                    _logger.log(Level.INFO, "http_lb_admin_applychanges_done",lbName);
                }  
            }
        }catch(Exception e){
            Throwable rootException = ExceptionUtil.getRootCause(e);
View Full Code Here

TOP

Related Classes of com.sun.appserv.management.ext.lb.LoadBalancer

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.