name = null;
}
final String image = member.getImage();
if (image == null || image.trim().length() == 0) {
throw new ParameterProblem("Cluster member has no image");
}
final short quantity = member.getQuantity();
if (quantity < 1) {
throw new ParameterProblem("Illegal, requested less than 1 " +
"instance of cluster member '" + name + "'");
}
final Cloudnic_Type[] xmlnics = member.getNic();
if (xmlnics == null || xmlnics.length == 0) {
throw new ParameterProblem("Cluster member '" + name +
"' has no nic definition.");
}
final ClusterMemberNic[] nics = new ClusterMemberNic[xmlnics.length];
final boolean nicNamesRequired = nics.length > 1;
for (int i = 0; i < nics.length; i++) {
if (xmlnics[i] == null) {
throw new ParameterProblem("Cluster member '" + name +
"' has null nic element"); // ??
}
final String assoc = xmlnics[i].get_value();
if (assoc == null || assoc.trim().length() == 0) {
throw new ParameterProblem("Cluster member '" + name +
"' has \"<nic>\" element with no network name.");
}
String iface = xmlnics[i].get_interface();
if (iface == null || iface.trim().length() == 0) {
if (nicNamesRequired) {
throw new ParameterProblem("Cluster member '" + name +
"' has multiple NICs and a \"<nic>\" element with " +
"empty or missing interface name. With multiple " +
"NICs you need to explicitly name each one (either" +
"'publicnic' or 'localnic'), see " +
"samples.");
} else {
final String assocComp = assoc.toLowerCase().trim();
final String pubComp;
if (brokerPublicNicPrefix != null) {
pubComp = brokerPublicNicPrefix.toLowerCase().trim();
} else {
pubComp = "";
}
final String privComp;
if (brokerLocalNicPrefix != null) {
privComp = brokerLocalNicPrefix.toLowerCase().trim();
} else {
privComp = "";
}
final String nicName;
if (assocComp.startsWith(pubComp)) {
nicName = "publicnic";
} else if (assocComp.startsWith(privComp)) {
nicName = "localnic";
} else {
throw new ParameterProblem("Cannot pick a broker " +
"NIC name for the network '" + assocComp + "'");
}
iface = doctorContext(nicName,
member.getCtx(),