{
// About to gather the bandwidth nodes, so get rid of the old ones.
int i = 0;
while (i < parameters.getChildCount())
{
ConfigNode node = parameters.getChild(i);
if (node.getType().equals(SolrConfig.NODE_ZOOKEEPER))
parameters.removeChild(i);
else
i++;
}
int count = Integer.parseInt(x);
i = 0;
while (i < count)
{
String postfix = "zookeeper_"+Integer.toString(i);
String op = variableContext.getParameter("op_"+postfix);
if (op == null || !op.equals("Delete"))
{
// Gather the host etc.
String host = variableContext.getParameter("host_"+postfix);
String zkport = variableContext.getParameter("port_"+postfix);
ConfigNode node = new ConfigNode(SolrConfig.NODE_ZOOKEEPER);
node.setAttribute(SolrConfig.ATTR_HOST,host);
node.setAttribute(SolrConfig.ATTR_PORT,zkport);
parameters.addChild(parameters.getChildCount(),node);
}
i++;
}
String addop = variableContext.getParameter("op_zookeeper");
if (addop != null && addop.equals("Add"))
{
String host = variableContext.getParameter("host_zookeeper");
String zkport = variableContext.getParameter("port_zookeeper");
ConfigNode node = new ConfigNode(SolrConfig.NODE_ZOOKEEPER);
node.setAttribute(SolrConfig.ATTR_HOST,host);
node.setAttribute(SolrConfig.ATTR_PORT,zkport);
parameters.addChild(parameters.getChildCount(),node);
}
}
x = variableContext.getParameter("argument_count");
if (x != null && x.length() > 0)
{
// About to gather the argument nodes, so get rid of the old ones.
int i = 0;
while (i < parameters.getChildCount())
{
ConfigNode node = parameters.getChild(i);
if (node.getType().equals(SolrConfig.NODE_ARGUMENT))
parameters.removeChild(i);
else
i++;
}
int count = Integer.parseInt(x);
i = 0;
while (i < count)
{
String prefix = "argument_"+Integer.toString(i);
String op = variableContext.getParameter(prefix+"_op");
if (op == null || !op.equals("Delete"))
{
// Gather the name and value.
String name = variableContext.getParameter(prefix+"_name");
String value = variableContext.getParameter(prefix+"_value");
ConfigNode node = new ConfigNode(SolrConfig.NODE_ARGUMENT);
node.setAttribute(SolrConfig.ATTRIBUTE_NAME,name);
node.setAttribute(SolrConfig.ATTRIBUTE_VALUE,value);
parameters.addChild(parameters.getChildCount(),node);
}
i++;
}
String addop = variableContext.getParameter("argument_op");
if (addop != null && addop.equals("Add"))
{
String name = variableContext.getParameter("argument_name");
String value = variableContext.getParameter("argument_value");
ConfigNode node = new ConfigNode(SolrConfig.NODE_ARGUMENT);
node.setAttribute(SolrConfig.ATTRIBUTE_NAME,name);
node.setAttribute(SolrConfig.ATTRIBUTE_VALUE,value);
parameters.addChild(parameters.getChildCount(),node);
}
}
String configOp = variableContext.getParameter("configop");