Example usage for org.apache.commons.lang StringUtils chomp

List of usage examples for org.apache.commons.lang StringUtils chomp

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils chomp.

Prototype

public static String chomp(String str, String separator) 

Source Link

Document

Removes separator from the end of str if it's there, otherwise leave it alone.

Usage

From source file:com.linkedin.pinot.controller.helix.ControllerRequestURLBuilder.java

public String forInstanceCreate() {
    return StringUtil.join("/", StringUtils.chomp(_baseUrl, "/"), "instances/");
}

From source file:com.linkedin.pinot.controller.helix.ControllerRequestURLBuilder.java

public String forInstanceState(String instanceName) {
    return StringUtil.join("/", StringUtils.chomp(_baseUrl, "/"), "instances", instanceName, "state");
}

From source file:at.tuwien.ifs.somtoolbox.apps.helper.VectorFileToRandomAccessFileConverter.java

public VectorFileToRandomAccessFileConverter(String inputVectorFile) throws IOException {
    String outputFile = StringUtils.chomp(inputVectorFile, ".gz") + ".bin";
    if (new File(outputFile).exists()) {
        new File(outputFile).delete();
    }//from   www .  j  av a 2 s .  c  om
    file = new RandomAccessFile(outputFile, "rw");
    // write all the vectors
    readVectorFile(inputVectorFile, false);
    // write the vector labels in the end of the file
    RandomAccessFileSOMLibInputData.writeVectorLabels(file, dataNames);
    file.close();
}

From source file:com.egt.ejb.toolkit.ToolKitUtils.java

public static String mkEjbSrcDir(String root, String project, String subproject) {
    String sep = System.getProperties().getProperty("file.separator");
    String com = PREFIJO_PAQUETE.replace(".", sep);
    String ejb = getEjbPackageName(project).replace(".", sep);
    String sub = StringUtils.isBlank(subproject) ? "" : sep + subproject.replace("-", sep).replace(".", sep);
    String dir = StringUtils.chomp(root, sep) + sep + project + sep + "src" + sep + "java" + sep + com + sep
            + ejb + sub;//  www .j  a v  a  2s  .  co  m
    mkdirs(dir);
    return dir + sep;
}

From source file:com.haulmont.cuba.portal.config.SiteSettings.java

/**
 * @param path path relative to the root of webapp
 * @return Full absolute path including protocol, domain and webapp prefix
 *///  ww  w  . j  a v  a2s  . c  o  m
public String composeFullAbsolutePath(String path) {
    Configuration configuration = AppBeans.get(Configuration.NAME);
    String webAppUrl = configuration.getConfig(GlobalConfig.class).getWebAppUrl();
    webAppUrl = StringUtils.chomp(webAppUrl, "/"); //remove last slash
    return path.startsWith("/") ? webAppUrl.concat(path) : webAppUrl.concat("/").concat(path);
}

From source file:com.linkedin.pinot.broker.routing.TimeBoundaryServiceTest.java

@BeforeTest
public void beforeTest() {
    _zookeeperInstance = ZkStarter.startLocalZkServer();

    _zkClient = new ZkClient(StringUtil.join("/", StringUtils.chomp(ZkStarter.DEFAULT_ZK_STR, "/")),
            ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
    String helixClusterName = "TestTimeBoundaryService";
    _zkClient.deleteRecursive("/" + helixClusterName + "/PROPERTYSTORE");
    _zkClient.createPersistent("/" + helixClusterName + "/PROPERTYSTORE", true);
    _propertyStore = new ZkHelixPropertyStore<>(new ZkBaseDataAccessor<ZNRecord>(_zkClient),
            "/" + helixClusterName + "/PROPERTYSTORE", null);
}

From source file:com.linkedin.pinot.controller.helix.ControllerRequestURLBuilder.java

public String forInstanceInformation(String instanceName) {
    return StringUtil.join("/", StringUtils.chomp(_baseUrl, "/"), "instances", instanceName);
}

From source file:net.sf.firemox.database.data.CollectionData.java

@Override
public String getValue() {
    return StringUtils.chomp(Arrays.toString(values).substring(1), "]");
}

From source file:com.linkedin.pinot.controller.helix.ControllerRequestURLBuilder.java

public String forInstanceList() {
    return StringUtil.join("/", StringUtils.chomp(_baseUrl, "/"), "instances");
}

From source file:com.linkedin.pinot.transport.common.TimeBoundaryServiceTest.java

@BeforeTest
public void beforeTest() {
    _zookeeperInstance = ZkStarter.startLocalZkServer();

    _zkClient = new ZkClient(StringUtil.join("/", StringUtils.chomp(ZkStarter.DEFAULT_ZK_STR, "/")),
            ZkClient.DEFAULT_SESSION_TIMEOUT, ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
    String helixClusterName = "TestTimeBoundaryService";
    _zkClient.deleteRecursive("/" + helixClusterName + "/PROPERTYSTORE");
    _zkClient.createPersistent("/" + helixClusterName + "/PROPERTYSTORE", true);
    _propertyStore = new ZkHelixPropertyStore<ZNRecord>(new ZkBaseDataAccessor<ZNRecord>(_zkClient),
            "/" + helixClusterName + "/PROPERTYSTORE", null);

}