Package com.sun.enterprise.config.serverbeans

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


                isCluster = true;
            }

            //get all converged lb configs
            Domain domain = (Domain) adminConfigContext.getRootConfigBean();
            ConvergedLbConfigs clbConfigs = domain.getConvergedLbConfigs();
            // Null in case of a DAS or developer profile instance.Hence no CLB
            // frontending  this instance.
            if( clbConfigs == null ) return false;
            ConvergedLbConfig[] clbConfigArray = clbConfigs.getConvergedLbConfig();
            //get all converged lb ref and determine if one points to this instance
            if (isCluster) {
                for (int i = 0; i < clbConfigArray.length && !matchFound; i++) {
                    ConvergedLbClusterRef[] clusterRefs =
                        clbConfigArray[i].getConvergedLbClusterRef();
View Full Code Here


        boolean isCluster = clusterName != null;

        ConfigContext ctx = AdminService.getAdminService().getAdminContext()
                                        .getAdminConfigContext();
        Domain domain = (Domain) ctx.getRootConfigBean();
        ConvergedLbConfigs clbConfigs = domain.getConvergedLbConfigs();
        // Null in case of a DAS/developer profile. Hence no CLB frontending
        // this instance.Hence no associated DCR file.
        if(clbConfigs == null ) return null;
        boolean matchFound = false;
        ConvergedLbConfig[] clbConfigArray = clbConfigs.getConvergedLbConfig();

        for (int i = 0; i < clbConfigArray.length; i++) {
            if (isCluster) {
                ConvergedLbClusterRef[] clusterRefs = clbConfigArray[i].getConvergedLbClusterRef();
View Full Code Here

    protected ConvergedLbConfigs getConvergedLbConfigs() {
        try {
            ConfigContext ctx = AdminService.getAdminService().getAdminContext()
                                            .getAdminConfigContext();
            Domain domain = (Domain) ctx.getRootConfigBean();
            ConvergedLbConfigs clbConfigs = domain.getConvergedLbConfigs();

            if (clbConfigs == null) {
                _logger.log(Level.INFO, _strMgr.getString("ClbConfigsNull"));
                clbConfigs = new ConvergedLbConfigs();
                domain.setConvergedLbConfigs(clbConfigs);
            } else {
                _logger.log(Level.INFO, _strMgr.getString("ClbConfigsNotNull"));
            }
View Full Code Here

        }
    }

    protected ConvergedLbConfig getConvergedLbConfig(String configName)
        throws MBeanException {
        ConvergedLbConfigs clbConfigs = getConvergedLbConfigs();

        if (clbConfigs == null) {
                _logger.log(Level.INFO, _strMgr.getString("ClbConfigsNull"));
            _logger.log(Level.FINE, _sMgr.getString("sip.clbadmin.NoLbConfigs"));

            String msg = _strMgr.getString("NoLbConfigsElement");
            throw new MBeanException(new ConfigException(msg));
        }

        ConvergedLbConfig clbConfig = clbConfigs.getConvergedLbConfigByName(configName);

        if (clbConfig == null) {
            _logger.log(Level.FINE, _sMgr.getString("sip.clbadmin.NoLbConfigs"));

            String msg = _strMgr.getString("InvalidLbConfigName", configName);
View Full Code Here

    }

    public String[] getConvergedLbConfigsForServer(String serverName)
        throws MBeanException {
        ArrayList sList = new ArrayList();
        ConvergedLbConfigs clbConfigs = getConvergedLbConfigs();

        if (clbConfigs == null) {
            // return, no lb configs
            return null;
        }

        ConvergedLbConfig[] clbConfigArray = clbConfigs.getConvergedLbConfig();

        for (int i = 0; i < clbConfigArray.length; i++) {
            ServerRef[] sRefs = clbConfigArray[i].getServerRef();

            for (int j = 0; j < sRefs.length; j++) {
View Full Code Here

    }

    public String[] getConvergedLbConfigsForCluster(String clusterName)
        throws MBeanException {
        ArrayList sList = new ArrayList();
        ConvergedLbConfigs clbConfigs = getConvergedLbConfigs();

        if (clbConfigs == null) {
            // return, no lb configs
            return null;
        }

        ConvergedLbConfig[] clbConfigArray = clbConfigs.getConvergedLbConfig();

        for (int i = 0; i < clbConfigArray.length; i++) {
            ConvergedLbClusterRef[] cRefs = clbConfigArray[i].getConvergedLbClusterRef();

            for (int j = 0; j < cRefs.length; j++) {
View Full Code Here

      }
    }
 
    public void createConvergedLbConfig(
        AttributeList attrList, Properties props, String clbConfigName) throws MBeanException {
        ConvergedLbConfigs clbConfigs = null;
        ConvergedLbConfig clbConfig = null;
  try {
              String dcrFileName = null;
              String httpLbPolicy = null;
              String sipLbPolicy = null;
              String lbenableallInstances = null;
              String targetName = null;
       
        for (int i = 0; i <attrList.size(); i++) {
                Attribute attr = (Attribute)attrList.get(i);
                if (isAttrNameMatch(attr, DCRFILE))
                    dcrFileName = (String)attr.getValue();
                else if (isAttrNameMatch(attr, HTTPLBPOLICY ))
                    httpLbPolicy = (String)attr.getValue();
                else if (isAttrNameMatch(attr, SIPLBPOLICY))
                    sipLbPolicy = (String)attr.getValue();
                else if (isAttrNameMatch(attr, LBENABLEINSTANCES))
                    lbenableallInstances = (String)attr.getValue();
               else if (isAttrNameMatch(attr, TARGET))
                   targetName = (String)attr.getValue();
         }

        if (targetName == null && clbConfigName == null) {
            String msg = _strMgr.getString("CLBConfigSpecifytargetOrCfgName");
            throw new MBeanException(new ConfigException(msg));
        }

        if (httpLbPolicy != null && !(httpLbPolicy.equals("round-robin") || httpLbPolicy.equals("weighted-round-robin") || httpLbPolicy.equals("user-defined"))) {
            String msg = _strMgr.getString("InvalidHttpValue");
            throw new MBeanException(new ConfigException(msg));
        }

        if (sipLbPolicy != null && !(sipLbPolicy.equals("from-tag,to-tag,call-id"))) {
                String msg = _strMgr.getString("InvalidSipValue");
                throw new MBeanException(new ConfigException(msg));
        }

            clbConfigs = getConvergedLbConfigs();
           
            // if clbConfigName is not specified, generate the same
            if (clbConfigName == null)
                clbConfigName = generateClbCfgName(clbConfigs);

            clbConfig = new ConvergedLbConfig();
            clbConfig.setName(clbConfigName);

            ConvergedLbPolicy clbPolicy = new ConvergedLbPolicy();
            clbPolicy.setHttp(httpLbPolicy);
            clbPolicy.setSip(sipLbPolicy);
            clbConfig.setConvergedLbPolicy(clbPolicy);
            //properties
            if (null != props)
                clbConfig.setElementProperty(convertPropertiesToElementProperties(props));

            clbConfigs.addConvergedLbConfig(clbConfig);
           
            if (targetName != null) {
                createConvergedLbRef(null, clbConfigName, true, false, targetName);
    setLbEnabledFlag(lbenableallInstances, clbConfigName);
     
            if (dcrFileName != null)
                setDcrFile(dcrFileName, clbConfigName, null);
        } catch (Exception ce) {
            if (clbConfigs != null)
                clbConfigs.removeConvergedLbConfig(clbConfig);
            throw new MBeanException(ce);
        }
    }
View Full Code Here

        return name;
    }

    public boolean deleteConvergedLbConfig(String configName)
        throws MBeanException {
        ConvergedLbConfigs clbConfigs = getConvergedLbConfigs();

        if (clbConfigs == null) {
            String msg = _strMgr.getString("NoLbConfigsElement");
            throw new MBeanException(new ConfigException(msg));
        }

        ConvergedLbConfig clbConfig = clbConfigs.getConvergedLbConfigByName(configName);

        if (clbConfig == null) {
            // Nothing to be deleted
            String msg = _strMgr.getString("InvalidLbConfigName", configName);
            throw new MBeanException(new ConfigException(msg));
        }

        if (((clbConfig.getServerRef() == null) ||
                (clbConfig.getServerRef().length == 0)) &&
                ((clbConfig.getConvergedLbClusterRef() == null) ||
                (clbConfig.getConvergedLbClusterRef().length == 0))) {
            clbConfigs.removeConvergedLbConfig(clbConfig);
            _logger.log(Level.INFO,
                _sMgr.getString("sip.clbadmin.LbConfigDeleted", configName));
        } else {
            String msg = _strMgr.getString("LbConfigNotEmpty", configName);
            throw new MBeanException(new ConfigException(msg));
View Full Code Here

    public String[] listConvergedLbConfigs(String target)
        throws MBeanException {
        _logger.log(Level.FINE, "[LBAdminMBean] listLBConfigs called");

        ConvergedLbConfigs clbConfigs = getConvergedLbConfigs();
        if (clbConfigs == null) {
            _logger.log(Level.INFO, _sMgr.getString("sip.clbadmin.NoLbConfigs"));

            return null;
        }

        String[] names = null;

        if (target == null) {
            ConvergedLbConfig[] clbConfigArray = clbConfigs.getConvergedLbConfig();

            if (clbConfigArray.length == 0) {
                _logger.log(Level.INFO,
                    _sMgr.getString("sip.clbadmin.NoLbConfigs"));
View Full Code Here

                    String msg = _strMgr.getString("ClbNameDoesNotExist", clbName);
                    throw new MBeanException(new ConfigException(msg));
                }
            }

            ConvergedLbConfigs clbConfigs = getConvergedLbConfigs();
            ConvergedLbConfig clbConfig = clbConfigs.getConvergedLbConfigByName(clbName + "_CLB_CONFIG");
            if (clbConfig != null) {
                _logger.log(Level.FINE, "Before deleting CLB Checking if it contains cluster references");
                ConvergedLbClusterRef[] clbClusterRefs = clbConfig.getConvergedLbClusterRef();
                if (clbClusterRefs.length != 0) {
                    String msg = _strMgr.getString("ClbContainsClusterRefs");
                    throw new MBeanException(new ConfigException(msg));
                }
                clbConfigs.removeConvergedLbConfig(clbConfig);
             }
             if (avSvc != null)
                avSvc.setConvergedLoadBalancer(null);
        } catch (Exception ce) {
            throw new MBeanException(ce);
View Full Code Here

TOP

Related Classes of com.sun.enterprise.config.serverbeans.ConvergedLbConfigs

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.