*/
public static String processUri(URI uri, OpenReplicator or) throws InvalidConfigException
{
String userInfo = uri.getUserInfo();
if (null == userInfo)
throw new InvalidConfigException("missing user info in: " + uri);
int slashPos = userInfo.indexOf('/');
if (slashPos < 0 )
slashPos = userInfo.length();
else if (0 == slashPos)
throw new InvalidConfigException("missing user name in user info: " + userInfo);
String userName = userInfo.substring(0, slashPos);
String userPass = slashPos < userInfo.length() - 1 ? userInfo.substring(slashPos + 1) : null;
String hostName = uri.getHost();
int port = uri.getPort();
if (port < 0) port = DEFAULT_MYSQL_PORT;
String path = uri.getPath();
if (null == path)
throw new InvalidConfigException("missing path: " + uri);
Matcher m = PATH_PATTERN.matcher(path);
if (!m.matches())
throw new InvalidConfigException("invalid path:" + path);
String[] gp = m.group().split("/");
if (gp.length != 3)
throw new InvalidConfigException("Invalid format " + Arrays.toString(gp));
String serverIdStr = gp[1];
int serverId = -1;
try
{
serverId = Integer.parseInt(serverIdStr);
}
catch (NumberFormatException e)
{
throw new InvalidConfigException("incorrect mysql serverid:" + serverId);
}
// Assign them to incoming variables
if (null != or)
{