// Path: zing-common/src/main/java/org/zxc/zing/common/constant/Constants.java
// public class Constants {
//     public final static int SERVER_DEFAULT_PORT = 4080;
// 
//     public final static String SERVER_IP_ADDRESS_CONFIG_KEY = "server.address.ip";
// 
//     public final static String SERVER_PORT_CONFIG_KEY = "server.address.port";
// 
//     public final static String ZOOKEEPER_ADDRESS = "registry.zookeeper.address";
// 
//     public final static String ZOOKEEPER_PATH_SEPARATOR = "/";
// 
//     public final static String SERVICE_ZK_PATH_PREFIX = "/zing/service";
// 
//     public final static String SERVICE_ZK_PATH_FORMAT = SERVICE_ZK_PATH_PREFIX+"/%s";
// }


import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.zxc.zing.common.constant.Constants;
import java.util.List;
package org.zxc.zing.common.util;



/**
 * Created by xuanchen.zhao on 16-1-24.
 */
public class ZookeeperPathUtils {

    private static final int PROVIDER_INFO_NODE_DEPTH = 4;
    private static final int SERVICE_NAME_ZK_PATH_DEPTH = 3;

    public static String formatProviderPath(String serviceName, String ip, int port) {
        StringBuilder pathBuilder = new StringBuilder();

// Path: zing-common/src/main/java/org/zxc/zing/common/constant/Constants.java
// public class Constants {
//     public final static int SERVER_DEFAULT_PORT = 4080;
// 
//     public final static String SERVER_IP_ADDRESS_CONFIG_KEY = "server.address.ip";
// 
//     public final static String SERVER_PORT_CONFIG_KEY = "server.address.port";
// 
//     public final static String ZOOKEEPER_ADDRESS = "registry.zookeeper.address";
// 
//     public final static String ZOOKEEPER_PATH_SEPARATOR = "/";
// 
//     public final static String SERVICE_ZK_PATH_PREFIX = "/zing/service";
// 
//     public final static String SERVICE_ZK_PATH_FORMAT = SERVICE_ZK_PATH_PREFIX+"/%s";
// }


// Path: zing-common/src/main/java/org/zxc/zing/common/util/ZookeeperPathUtils.java
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import org.zxc.zing.common.constant.Constants;
import java.util.List;

package org.zxc.zing.common.util;



/**
 * Created by xuanchen.zhao on 16-1-24.
 */
public class ZookeeperPathUtils {

    private static final int PROVIDER_INFO_NODE_DEPTH = 4;
    private static final int SERVICE_NAME_ZK_PATH_DEPTH = 3;

    public static String formatProviderPath(String serviceName, String ip, int port) {
        StringBuilder pathBuilder = new StringBuilder();

        String serviceZkPath = String.format(Constants.SERVICE_ZK_PATH_FORMAT, serviceName);