Package com.sun.enterprise.config.serverbeans

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


    public String getConsistentHashKey(SipServletMessage message) {
        return ((SipServletMessageImpl)message).getBeKey();
    }

    private void setProperties() {
        ConvergedLbConfig clbConfig = null;
        try {
            ConfigContext ctx = AdminService.getAdminService().
                    getAdminContext().getAdminConfigContext();
            ServerContext sc = com.sun.enterprise.server.ondemand.
                    OnDemandServer.getServerContext();
            ConfigContext instanceConfigContext = sc.getConfigContext();
            Config instanceConfig = ServerBeansFactory.
                    getConfigBean(instanceConfigContext);
            AvailabilityService haService = instanceConfig.
                    getAvailabilityService();
            ConvergedLoadBalancer clb = haService.getConvergedLoadBalancer();
            String clbConfigName = clb.getConvergedLbConfigName();
            clbConfig = ((Domain) ctx.getRootConfigBean()).
                    getConvergedLbConfigs().getConvergedLbConfigByName(
                    clbConfigName);
        } catch (Exception ex) {
            logger.log(Level.WARNING,
                    "clb.configexception_will_getting_instance_config",
                    ex.toString());
            if(logger.isLoggable(Level.FINE)){
                logger.log(Level.FINE,"clb.caught_an_exception", ex);
            }
            return;
        }
       
        ElementProperty[] elementProperties=
                clbConfig.getElementProperty();
       
        HashMap<String, String> propertiesMap = new HashMap<String, String>();
        for(int i=0; i < elementProperties.length; i++){
            propertiesMap.put(elementProperties[i].getName(),
                    elementProperties[i].getValue());
View Full Code Here


                if (!found) {
                    String msg = _strMgr.getString("ClbNameDoesNotExist");
                    throw new MBeanException(new ConfigException(msg));
                }
            }
            ConvergedLbConfig lbCfg = getConvergedLbConfig(clbCfgName);
            ConvergedLbPolicy clbLbPolicy = lbCfg.getConvergedLbPolicy();
            String dcrFileName = clbLbPolicy.getDcrFile();
            // Before unsetting dcr file delete the physical file
            String iRoot = System.getProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY);
            String dcrFilePath = iRoot + File.separator + PEFileLayout.CONFIG_DIR
                                                + File.separator + cfgName + File.separator + dcrFileName;
View Full Code Here

                }
                // Check if the instance provided is a stand alone instance
                ConvergedLbConfigs lbConfigs = getConvergedLbConfigs();
                ConvergedLbConfig[]  lbConfig = lbConfigs.getConvergedLbConfig();
                for (int i=0; i < lbConfig.length; i++) {
                    ConvergedLbConfig clbConfig = lbConfig[i];
                    ServerRef sRef = clbConfig.getServerRefByRef(target);
                    if (sRef != null) {
                        sRef.setLbEnabled(false);
                        sRef.setDisableTimeoutInMinutes(time);
                        found = true;
                        break;
View Full Code Here

                }
                // Check if the instance provided is a stand alone instance
                ConvergedLbConfigs lbConfigs = getConvergedLbConfigs();
                ConvergedLbConfig[]  lbConfig = lbConfigs.getConvergedLbConfig();
                for (int i=0; i < lbConfig.length; i++) {
                    ConvergedLbConfig clbConfig = lbConfig[i];
                    ServerRef sRef = clbConfig.getServerRefByRef(target);
                    if (sRef != null) {
                        sRef.setLbEnabled(true);
                        found = true;
                        break;
                    }
View Full Code Here

        final Domain domain = ConfigAPIHelper.getDomainConfigBean(acc);
        ConvergedLbConfigs clbConfigs = new ConvergedLbConfigs();
        domain.setConvergedLbConfigs(clbConfigs);

        ConvergedLbConfig clbConfig = new ConvergedLbConfig();
        clbConfig.setName("converged-lb-config-1");

        ConvergedLbPolicy clbPolicy = new ConvergedLbPolicy();
        clbPolicy.setHttp("round-robin");
        clbPolicy.setSip("from-tag,to-tag,call-id");

        ConvergedLbClusterRef clbRef = new ConvergedLbClusterRef();
        clbRef.setRef(DEFAULT_CLUSTER);
        clbRef.setSelfLoadbalance(true);

        clbConfig.setConvergedLbPolicy(clbPolicy);
        clbConfig.addConvergedLbClusterRef(clbRef);

        clbConfigs.addConvergedLbConfig(clbConfig);
    }
View Full Code Here

    }

    public LoadbalancerReader getLbReader(ConfigContext ctx,
        String clbConfigName) throws ConfigException {
        // reads the load balancer related data
        ConvergedLbConfig clbConfig = ((Domain) ctx.getRootConfigBean()).getConvergedLbConfigs()
                                       .getConvergedLbConfigByName(clbConfigName);

        return new LoadbalancerReaderImpl(ctx, clbConfig);
    }
View Full Code Here

            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

  throws MBeanException {
       try {
  ConfigContext ctx = AdminService.getAdminService().getAdminContext().getAdminConfigContext();
  Domain domain = (Domain) ctx.getRootConfigBean();
  Clusters clusters = domain.getClusters();
  ConvergedLbConfig clbConfig = domain.getConvergedLbConfigs().getConvergedLbConfigByName(clbConfigName);
  ConvergedLbClusterRef[] clbRef = clbConfig.getConvergedLbClusterRef();
  ServerRef[] servRefs = clbConfig.getServerRef();
  if ((lbenableallInstances != null) && (lbenableallInstances.equals("true")))
  {
    //Set LbEnabled flag for Cluster Instances
    for (int ref=0; ref < clbRef.length; ref++) {
        String clusterName = clbRef[ref].getRef();
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);
View Full Code Here

        }
    }
  
    public String generateClbCfgName(ConvergedLbConfigs cfgs) {
        String name = null;
        ConvergedLbConfig clbConfig = null;
        for (int i=0; ; i++) {
            name = "CLB_CONFIG_" + i;
            clbConfig = cfgs.getConvergedLbConfigByName(name);
            if (clbConfig == null)
                break;
View Full Code Here

TOP

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

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.