}
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);