Examples of LbConfig


Examples of com.sun.enterprise.config.serverbeans.LbConfig

        LbConfigs lbConfigs = getLbConfigs();
        if (lbConfigs == null ) {
            String msg =  _strMgr.getString("NoLbConfigsElement");
            throw new MBeanException (new ConfigException(msg));
        }
        LbConfig lbConfig = lbConfigs.getLbConfigByName(name);
        if (lbConfig == null) {
            // Nothing to be deleted
            String msg =  _strMgr.getString("InvalidLbConfigName",name);
            throw new MBeanException (new ConfigException(msg));
        }
        if ( (lbConfig.getServerRef() == null ||
             lbConfig.getServerRef().length == 0 ) &&
                ( lbConfig.getClusterRef() == null ||
                    lbConfig.getClusterRef() .length == 0 ) ) {
            lbConfigs.removeLbConfig(lbConfig);
            _logger.log(Level.INFO,_sMgr.getString(
                    "http_lb_admin.LbConfigDeleted", name));
        } else {
            String msg =  _strMgr.getString("LbConfigNotEmpty", name);
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.LbConfig

   public void createHealthChecker(String url, String interval,
            String timeout, String lbConfigName, String target)
            throws MBeanException
    {
        if (lbConfigName != null) {
            LbConfig lbConfig = getLbConfigs().getLbConfigByName(lbConfigName);
            createHealthCheckerInternal(url,interval,timeout,lbConfig,
            lbConfigName ,target, false);
        } else {
            LbConfig[] lbConfigs = getLbConfigs().getLbConfig();  
            if (lbConfigs == null) {
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.LbConfig

    }
    public void deleteHealthChecker(String lbConfigName, String target)
                throws MBeanException
    {
        if (lbConfigName != null) {
            LbConfig lbConfig = getLbConfigs().getLbConfigByName(lbConfigName);
            deleteHealthCheckerInternal(lbConfig, target, false);
        } else {
            LbConfig[] lbConfigs = getLbConfigs().getLbConfig();  
            if (lbConfigs == null) {
                String msg = _strMgr.getString("NoLbConfigsElement");
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.LbConfig

            _logger.log(Level.FINE,_sMgr.getString(
                    "http_lb_admin.NoLbConfigs"));
            String msg = _strMgr.getString("NoLbConfigsElement");
            throw new MBeanException ( new ConfigException(msg));
        }
        LbConfig lbConfig = lbConfigs.getLbConfigByName(configName);
        if (lbConfig == null ) {
            _logger.log(Level.FINE,_sMgr.getString(
                    "http_lb_admin.NoLbConfigs"));
            String msg = _strMgr.getString("InvalidLbConfigName", configName);
            throw new MBeanException (new ConfigException(msg));
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.LbConfig

            if(enableInstances) {
                enableServer(target);
            }
            if(enableApps || lbPolicy != null || lbPolicyModule != null ) {
                ApplicationRef[] appRefs = null;
                LbConfig lbConfig = getLbConfig(configName);
                if (ClusterHelper.isACluster(ctx, target)) {
                    appRefs = c.getApplicationRef();
                   
                }else{
                    appRefs = s.getApplicationRef();
                }
                if (appRefs != null && enableApps ) {
                    for(ApplicationRef ref:appRefs) {
                        //enable only user applications
                        if(!ApplicationHelper.isSystemApp(ctx, ref.getRef()))
                            ref.setLbEnabled(enableApps);
                    }
                }
                if(lbPolicy != null) {
                    ClusterRef cRef = lbConfig.getClusterRefByRef(target);
                    cRef.setLbPolicy(lbPolicy);
                }
                if(lbPolicyModule != null){
                    ClusterRef cRef = lbConfig.getClusterRefByRef(target);
                    cRef.setLbPolicyModule(lbPolicyModule);
                }
               
            }
        } catch(ConfigException ce) {
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.LbConfig

    }

    private void addServerToLBConfig(String configName,String serverName
            throws MBeanException
    {         
        LbConfig lbConfig = getLbConfig(configName);

        ServerRef sRef = lbConfig.getServerRefByRef(serverName);
        if (sRef != null) {
            // already exists
            return;
        }
        try {
            ConfigContext ctx = AdminService.getAdminService().getAdminContext()
                                    .getAdminConfigContext();

            if (!ServerHelper.isServerStandAlone(ctx, serverName)) {
                String msg = _strMgr.getString("NotStandAloneInstance",
                                                serverName);
                throw new MBeanException (new ConfigException(msg));
            }
            sRef = new ServerRef();
            sRef.setRef(serverName);
            lbConfig.addServerRef(sRef);
        } catch( ConfigException ce) {
            throw new MBeanException(ce);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.LbConfig

    }
   
    private void addClusterToLbConfig(String configName, String clusterName
            throws MBeanException
    {         
        LbConfig lbConfig = getLbConfig(configName);

        ClusterRef cRef = lbConfig.getClusterRefByRef(clusterName);
        if (cRef != null) {
            // already exists
            return;
        }
        cRef = new ClusterRef();
        cRef.setRef(clusterName);
        try {
            lbConfig.addClusterRef(cRef);
        } catch (ConfigException ce) {
            throw new MBeanException (ce);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.LbConfig

    }

    private void deleteServerFromLBConfig(String configName,String serverName)
            throws MBeanException
    {         
        LbConfig lbConfig = getLbConfig(configName);

        ServerRef  sRef = lbConfig.getServerRefByRef(serverName);
        if (sRef == null) {
            // does not exist, just return from here
            _logger.log(Level.FINEST," server " + serverName +
                    " does not exist in any cluster in the domain");
            String msg = _strMgr.getString("ServerNotDefined",
                    serverName);
            throw new MBeanException(new RuntimeException(msg));
        }
        if (sRef.isLbEnabled()) {
            String msg = _strMgr.getString("ServerNeedsToBeDisabled", serverName);
            throw new MBeanException ( new ConfigException(msg));
        }
        // check if its applications are LB disabled.
        Server s = null;
        try {
            ConfigContext ctx =AdminService.getAdminService().getAdminContext()
                                    .getAdminConfigContext();
            s = ServerHelper.getServerByName(ctx, sRef.getRef());
        } catch(ConfigException ce) {
            throw new MBeanException(ce);
        }
        if (s == null ) {
            String msg = _strMgr.getString("ServerNotDefined", serverName);
            throw new MBeanException ( new ConfigException(msg));
        }
        ApplicationRef[] appRef = s.getApplicationRef();
        if (appRef == null ) {
            String msg = _strMgr.getString("AppRefsNotDefined", serverName);
            throw new MBeanException ( new ConfigException(msg));
        }
        int i =0;
        for(i=0; i < appRef.length; i++) {
            if (appRef[i].isLbEnabled()) {
                break;
            }
        }
        if ( i < appRef.length) {
            String msg = _strMgr.getString("AppsNotDisabled");
            throw new MBeanException ( new ConfigException(msg));
        }

        lbConfig.removeServerRef(sRef);
    }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.LbConfig

    }
   
    private void deleteClusterFromLBConfig(String configName,
            String clusterName) throws MBeanException
    {         
        LbConfig lbConfig = getLbConfig(configName);

        ClusterRef cRef = lbConfig.getClusterRefByRef(clusterName);
        if (cRef == null) {
            // does not exist, just return from here
            return;
        }
        Cluster c = null;
        try {
            ConfigContext ctx = AdminService.getAdminService().getAdminContext()
                                    .getAdminConfigContext();
            c = ClusterHelper.getClusterByName(ctx, clusterName);
        } catch (ConfigException ce) {
            throw new MBeanException(ce);
        }
        if ( c == null ) {
            String msg = _strMgr.getString("ClusterNotDefined", clusterName);
            throw new MBeanException (new ConfigException(msg));
        }
        ServerRef[] sRefs = c.getServerRef();
        for (int i=0; i < sRefs.length; i++) {
            if (sRefs[i].isLbEnabled()) {
                String msg = _strMgr.getString("ServerNeedsToBeDisabled", clusterName);
                throw new MBeanException (new ConfigException(msg));
            }
        }
        lbConfig.removeClusterRef(cRef);
    }
View Full Code Here

Examples of com.sun.enterprise.config.serverbeans.LbConfig

        }
    }

    private void addServerToLBConfig(final String configName, final String serverName)
                throws CommandException {
        LbConfig lbConfig = lbconfigs.getLbConfig(configName);

        ServerRef sRef = lbConfig.getRefByRef(ServerRef.class, serverName);
        if (sRef != null) {
            String msg = localStrings.getLocalString("LBServerRefExists",
                   "LB config already contains a server-ref for target {0}", target);
            throw new CommandException(msg);
        }
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.