private ProtocolData[] addSingletonName(ProtocolData[] orig, String singletonName) throws ChannelException { ProtocolData[] result = null; ProtocolData transport=orig[0]; ProtocolParameter singletonParam = new ProtocolParameter(Global.SINGLETON_NAME, singletonName); transport.override(new ProtocolParameter[]{ singletonParam}); result = orig; return result; }
private Map<String, String> getTransportProperties(ProtocolData[] protocols) { Map<String, String> tpProps = null; ProtocolData transport=protocols[0]; Map<String,ProtocolParameter> tmp=transport.getParameters(); tpProps = new HashMap<String,String>(); for(Map.Entry<String,ProtocolParameter> entry: tmp.entrySet()) { tpProps.put(entry.getKey(), entry.getValue().getValue()); } return tpProps; }
public static void substituteVariables(ProtocolData[] protocols) { for (ProtocolData data : protocols) { if (data != null) { for (ProtocolParameter param : data.getParametersAsArray()) { String val = param.getValue(); // We use jboss-common-core here so we get the richer feature set // of that versus JGroups system property replacement String replacement = StringPropertyReplacer.replaceProperties(val); if (!replacement.equals(val)) { param.setValue(replacement); } } } } }
public String getProtocolString() { StringBuilder buf = new StringBuilder(mClassName); if (!mParameters.isEmpty()) { buf.append('('); Iterator<String> i = mParameters.keySet().iterator(); while (i.hasNext()) { String key = i.next(); ProtocolParameter param = mParameters.get(key); buf.append(param.getParameterString()); if (i.hasNext()) buf.append(';'); } buf.append(')'); } return buf.toString(); }
private static List<ProtocolParameter> parsePropertiesString(String protocol_name, String properties_str) throws Exception { List<ProtocolParameter> params = new ArrayList<ProtocolParameter>(); int index = 0; /* "in_port=5555;out_port=6666" */ if (properties_str.length() > 0) { String[] components = properties_str.split(";"); for (String property : components) { String name, value; index = property.indexOf('='); if (index == -1) { throw new Exception("'=' not found in " + property + " of " + protocol_name); } name = property.substring(0, index); value = property.substring(index + 1, property.length()); params.add(new ProtocolParameter(name, value)); } } return params; }
public void override(ProtocolParameter[] params) { for (ProtocolParameter param: params) { mParameters.put(param.getName(), param); } }
String value = attr.getValue(); params.add(new ProtocolParameter(name, value));
protParams.add(new ProtocolParameter(paramName, paramVal));