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

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

Introduction

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

Prototype

public static String[] splitByWholeSeparatorPreserveAllTokens(String str, String separator) 

Source Link

Document

Splits the provided text into an array, separator string specified.

Usage

From source file:com.ailk.oci.ocnosql.tools.load.mutiple.MutipleColumnImportTsv.java

public boolean execute(Connection conn, OciTableRef table) {
    if (conn == null) {
        msg = "Connection object must not be null";
        retMap.put(FAILED_REASON, msg);/* w  w  w  .  ja v a2  s  . c om*/
        LOG.error(msg);
        throw new ClientRuntimeException(msg);
    }
    Configuration conf = conn.getConf();
    if (table == null) {
        msg = "table must not be null";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ClientRuntimeException(msg);
    }

    String tableName = table.getName();
    String column = table.getColumns();
    String seperator = table.getSeperator();
    String inputPath = table.getInputPath();
    String tmpOutPut = table.getImportTmpOutputPath();
    String skipBadLine = table.getSkipBadLine();
    String compressor = table.getCompressor();
    String rowkeyUnique = table.getRowKeyUnique();
    String algoColumn = table.getAlgoColumn();
    String rowkeyGenerator = table.getRowkeyGenerator();
    String rowkeyColumn = table.getRowkeyColumn();
    String callback = table.getCallback();

    if (StringUtils.isEmpty(tableName)) {
        msg = "No " + CommonConstants.TABLE_NAME
                + " specified. Please check config,then try again after refreshing cache";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ConfigException(msg);
    }
    conf.set(CommonConstants.TABLE_NAME, tableName);

    if (StringUtils.isEmpty(seperator)) {
        msg = "No " + CommonConstants.SEPARATOR
                + " specified. Please check config,then try again after refreshing cache";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ConfigException(msg);
    }
    conf.set(CommonConstants.SEPARATOR, seperator);

    // Make sure columns are specified
    String columns[] = StringUtils.splitByWholeSeparatorPreserveAllTokens(column, ",");
    if (columns == null) {
        msg = "No " + CommonConstants.COLUMNS
                + " specified. Please check config,then try again after refreshing cache";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ConfigException(msg);
    }
    conf.set(CommonConstants.COLUMNS, column);

    //      int rowkeysFound = 0;
    //      for (String col : columns) {
    //         if (col.equals(CommonConstants.ROW_KEY))
    //            rowkeysFound++;
    //      }
    //      if (rowkeysFound != 1) {
    //         msg = "Must specify exactly one column as " + CommonConstants.ROW_KEY + ". Please check config,then again after refreshing cache";
    //         retMap.put(FAILED_REASON, msg);
    //         LOG.error(msg);
    //         throw new ConfigException(msg);
    //      }

    if (columns.length < 2) {
        msg = "One or more columns in addition to the row key are required. Please check config,then try again after refreshing cache";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ConfigException(msg);
    }

    String[] columnTmp = null;
    for (int i = 0; i < columns.length; i++) {
        columnTmp = columns[i].split(":");
        if (columnTmp != null && columnTmp.length == 2) {
            break;
        }
    }
    conf.set(CommonConstants.SINGLE_FAMILY, columnTmp[0]);
    if (!StringUtils.isEmpty(skipBadLine)) {
        conf.set(CommonConstants.SKIPBADLINE, skipBadLine);
    }
    //?
    conf.set(CommonConstants.COMPRESSOR, (compressor == null) ? DEFAULT_COMPRESSOR : compressor);
    conf.set(CommonConstants.ALGOCOLUMN, algoColumn);
    conf.set(CommonConstants.ROWKEY_GENERATOR, rowkeyGenerator);
    conf.set(CommonConstants.ROWKEYCOLUMN, rowkeyColumn);
    conf.set(CommonConstants.ROWKEYCALLBACK, callback);

    boolean ret = false;
    Counter failCounter = null;
    try {
        hbaseAdmin = new HBaseAdmin(conf);
        TableConfiguration.getInstance().writeTableConfiguration(tableName, column, seperator, conf);
        conf.set(CommonConstants.TABLE_NAME, tableName);
        String hdfs_url = conf.get(CommonConstants.HDFS_URL);
        FileSystem fs = FileSystem.get(URI.create(hdfs_url), conf);
        FileStatus[] fileStatusArr = fs.listStatus(new Path(hdfs_url + inputPath));
        if (fileStatusArr != null && fileStatusArr.length > 0) {
            if (fileStatusArr[0].isFile()) {
                ret = (Boolean) runJob(conf, tableName, inputPath, tmpOutPut)[0];
            }
            int inputPathNum = 0;
            for (FileStatus everyInputPath : fileStatusArr) {
                Path inputPathStr = everyInputPath.getPath();
                String absoluteInputPathStr = inputPath + "/" + inputPathStr.getName();
                boolean retCode = (Boolean) runJob(conf, tableName, absoluteInputPathStr,
                        tmpOutPut + "/" + inputPathStr.getName())[0];
                if (retCode) {
                    String base64Seperator = conf.get(CommonConstants.SEPARATOR);
                    conf.set(CommonConstants.SEPARATOR, new String(Base64.decode(base64Seperator))); //?separator
                    if (inputPathNum == fileStatusArr.length - 1) {
                        ret = true;
                    }
                    inputPathNum++;
                    continue;
                } else { //
                    ret = false;
                    inputPathNum++;
                    break;
                }
            }
        }
    } catch (Exception e) {
        msg = "job execute failed,nested exception is " + e;
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ClientRuntimeException(msg);
    }

    if (!ret) {
        msg = "execute job failed,please check map/reduce log in jobtracker page";
        retMap.put(FAILED_REASON, msg);
        return false;
    }
    return true;
}

From source file:com.ailk.oci.ocnosql.tools.load.mutiple.MutipleColumnImportTsv.java

public static String getWriteConfigColumn(String columns, String notNeedLoadColumns) throws BulkLoadException {
    String writeTableConfigColumns;
    if (!StringUtils.isEmpty(notNeedLoadColumns)) {
        String[] columnArr = StringUtils.splitByWholeSeparatorPreserveAllTokens(columns, ",");
        String[] writeTableConfigColumnArr = StringUtils
                .splitByWholeSeparatorPreserveAllTokens(notNeedLoadColumns, ",");
        StringBuilder bud = new StringBuilder();
        for (String column : columnArr) {
            boolean isWrite = true;
            for (String writeTableConfigColumn : writeTableConfigColumnArr) {
                if (column.equals(writeTableConfigColumn)) {
                    isWrite = false;/*from w w  w.  j av a  2s  . co m*/
                    break;
                }
            }
            if (isWrite) {
                bud.append(column).append(",");
            }
        }
        writeTableConfigColumns = bud.substring(0, bud.length() - 1);
    } else {
        writeTableConfigColumns = columns;
    }
    return writeTableConfigColumns;
}

From source file:com.ailk.oci.ocnosql.tools.load.single.SingleColumnImportTsv.java

public boolean execute(Connection conn, OciTableRef table) {
    if (conn == null) {
        msg = "Connection object must not be null";
        retMap.put(FAILED_REASON, msg);//ww  w .j a va 2s.  c o  m
        LOG.error(msg);
        throw new ClientRuntimeException(msg);
    }
    Configuration conf = conn.getConf();
    if (table == null) {
        msg = "table must not be null";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ClientRuntimeException(msg);
    }

    String tableName = table.getName();
    String column = table.getColumns();
    String seperator = table.getSeperator();
    String inputPath = table.getInputPath();
    String tmpOutPut = table.getImportTmpOutputPath();
    String skipBadLine = table.getSkipBadLine();
    String compressor = table.getCompressor();
    String rowkeyUnique = table.getRowKeyUnique();
    String algoColumn = table.getAlgoColumn();
    String rowkeyGenerator = table.getRowkeyGenerator();
    String rowkeyColumn = table.getRowkeyColumn();
    String callback = table.getCallback();

    if (StringUtils.isEmpty(tableName)) {
        msg = "No " + CommonConstants.TABLE_NAME
                + " specified. Please check config,then try again after refreshing cache";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ConfigException(msg);
    }
    conf.set(CommonConstants.TABLE_NAME, tableName);

    //      if(StringUtils.isEmpty(seperator)){
    //         msg = "No " + CommonConstants.SEPARATOR + " specified. Please check config,then try again after refreshing cache";
    //         retMap.put(FAILED_REASON, msg);
    //         LOG.error(msg);
    //         throw new ConfigException(msg);
    //      }
    //      conf.set(CommonConstants.SEPARATOR, seperator);

    if (StringUtils.isEmpty(seperator)) {
        conf.set(CommonConstants.SEPARATOR, CommonConstants.DEFAULT_SEPARATOR);
    }

    // Make sure columns are specified, splited by ","
    String columns[] = StringUtils.splitByWholeSeparatorPreserveAllTokens(column, ",");
    if (columns == null) {
        msg = "No " + CommonConstants.COLUMNS
                + " specified. Please check config,then try again after refreshing cache";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ConfigException(msg);
    }
    conf.set(CommonConstants.COLUMNS, column);

    if (StringUtils.isEmpty(rowkeyColumn) && StringUtils.isEmpty(algoColumn)) {
        msg = "No " + CommonConstants.ROW_KEY
                + " rule specified. Please check config,then try again after refreshing cache";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ConfigException(msg);
    }
    conf.set(CommonConstants.SEPARATOR, seperator);

    //      int rowkeysFound = 0;
    //      for (String col : columns) {
    //         if (col.equals(CommonConstants.ROW_KEY))
    //            rowkeysFound++;
    //      }
    //      //HBASE_ROW_KEY?
    //      if (rowkeysFound != 1) {
    //         msg = "Must specify exactly one column as " + CommonConstants.ROW_KEY + ". Please check config,then again after refreshing cache";
    //         retMap.put(FAILED_REASON, msg);
    //         LOG.error(msg);
    //         throw new ConfigException(msg);
    //      }

    //HBASE_ROW_KEY?column
    if (columns.length < 2) {
        msg = "One or more columns in addition to the row key are required. Please check config,then try again after refreshing cache";
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ConfigException(msg);
    }

    //":"
    String[] columnTmp = null;
    for (int i = 0; i < columns.length; i++) {
        columnTmp = columns[i].split(":");
        if (columnTmp != null && columnTmp.length == 2) {
            break;
        }
    }

    //???
    conf.set(CommonConstants.SINGLE_FAMILY, columnTmp[0]);

    //?
    if (!StringUtils.isEmpty(skipBadLine)) {
        conf.set(CommonConstants.SKIPBADLINE, skipBadLine);
    }
    //?
    conf.set(CommonConstants.COMPRESSOR, (compressor == null) ? DEFAULT_COMPRESSOR : compressor);
    conf.set(CommonConstants.ALGOCOLUMN, algoColumn);
    conf.set(CommonConstants.ROWKEY_GENERATOR, rowkeyGenerator);
    conf.set(CommonConstants.ROWKEYCOLUMN, rowkeyColumn);
    conf.set(CommonConstants.ROWKEYCALLBACK, callback);

    boolean ret = false;
    //      Counter failCounter = null;
    try {
        hbaseAdmin = new HBaseAdmin(conf);
        TableConfiguration.getInstance().writeTableConfiguration(tableName, column, seperator, conf);
        //         Job job = createSubmittableJob(conf, tableName, inputPath, tmpOutPut);
        //         //job
        //         ret = job.waitForCompletion(true);
        //         Counters counters = job.getCounters();
        //         for (String groupName : counters.getGroupNames()) {
        //            failCounter = counters.findCounter(groupName, "NUM_FAILED_MAPS");
        //            if(failCounter != null){
        //               break;
        //            }
        //         }
        conf.set(CommonConstants.TABLE_NAME, tableName);
        String hdfs_url = conf.get(CommonConstants.HDFS_URL);
        FileSystem fs = FileSystem.get(URI.create(hdfs_url), conf);
        FileStatus[] fileStatusArr = fs.listStatus(new Path(hdfs_url + inputPath));
        if (fileStatusArr != null && fileStatusArr.length > 0) {
            if (fileStatusArr[0].isFile()) {
                ret = runJob(conf, tableName, inputPath, tmpOutPut);
            }
            int inputPathNum = 0;
            for (FileStatus everyInputPath : fileStatusArr) {
                Path inputPathStr = everyInputPath.getPath();
                String absoluteInputPathStr = inputPath + "/" + inputPathStr.getName();
                boolean retCode = runJob(conf, tableName, absoluteInputPathStr,
                        tmpOutPut + "/" + inputPathStr.getName());
                if (retCode) {
                    String base64Seperator = conf.get(CommonConstants.SEPARATOR);
                    conf.set(CommonConstants.SEPARATOR, new String(Base64.decode(base64Seperator))); //?separator
                    if (inputPathNum == fileStatusArr.length - 1) {
                        ret = true;
                    }
                    inputPathNum++;
                    continue;
                } else { //
                    ret = false;
                    inputPathNum++;
                    break;
                }
            }
        }

    } catch (Exception e) {
        msg = "job execute failed,nested exception is " + e;
        retMap.put(FAILED_REASON, msg);
        LOG.error(msg);
        throw new ClientRuntimeException(msg);
    }

    boolean result = true;
    if (!ret) {
        msg = "execute job failed,please check map/reduce log in jobtracker page";
        retMap.put(FAILED_REASON, msg);
        result = false;
    }
    /*
    else {
     String[] params = new String[2];
     params[0] = tmpOutPut;
     params[1] = tableName;
     int retrunCode = -1;
     try {
    //bulkload complete
    retrunCode = ToolRunner.run(new LoadIncrementalHFiles(conf),
          params);
     } catch (Exception e) {
    msg = "job execute failed,nested exception is " + e;
    retMap.put(FAILED_REASON, msg);
    LOG.error(msg);
    throw new ClientRuntimeException(msg);
     }
     if(retrunCode != 0) result = false;
    }
    */
    return result;
}

From source file:adapter.gbase.signalling.SignallingAdapter.java

private Boolean procedureTypeExist(String procedureTypeArray, String val) {
    Boolean result = false;/*from   w  w  w . ja v a  2s  . co  m*/
    if (!StringUtils.isBlank(procedureTypeArray) && !StringUtils.isBlank(val)) {
        String[] dataArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(procedureTypeArray, ",");
        for (int i = 0; i < dataArray.length; i++) {
            String[] dataItemArray = StringUtils.splitByWholeSeparatorPreserveAllTokens(dataArray[i], "-");
            if (dataItemArray.length == 2) {
                if (dataItemArray[1].trim().equals(val)) {
                    result = true;
                    break;
                }
            }
        }
    }
    return result;
}

From source file:org.apache.shindig.gadgets.uri.DefaultProxyUriManager.java

@SuppressWarnings("deprecation")
public ProxyUri process(Uri uriIn) throws GadgetException {
    UriStatus status = UriStatus.BAD_URI;
    Uri uri = null;/*from  w  w w  .  j  a v a 2 s .  co m*/

    // First determine if the URI is chained-syntax or query-style.
    String container = uriIn.getQueryParameter(Param.CONTAINER.getKey());
    if (container == null) {
        container = uriIn.getQueryParameter(Param.SYND.getKey());
    }
    String uriStr = null;
    Uri queryUri = null;
    if (container != null && config.getString(container, PROXY_PATH_PARAM) != null
            && config.getString(container, PROXY_PATH_PARAM).equalsIgnoreCase(uriIn.getPath())) {
        // Query-style. Has container param and path matches.
        uriStr = uriIn.getQueryParameter(Param.URL.getKey());
        queryUri = uriIn;
    } else {
        // Check for chained query string in the path.
        String containerStr = Param.CONTAINER.getKey() + '=';
        String path = uriIn.getPath();
        // It is possible to get decoded url ('=' converted to %3d)
        // for example from CssResponseRewriter, so we should support it
        boolean doDecode = (!path.contains(containerStr));
        if (doDecode) {
            path = Utf8UrlCoder.decode(path);
        }
        int start = path.indexOf(containerStr);
        if (start > 0) {
            start += containerStr.length();
            int end = path.indexOf('&', start);
            if (end < start) {
                end = path.indexOf('/', start);
            }
            if (end > start) {
                // Looks like chained proxy syntax. Pull out params.
                container = path.substring(start, end);
            }
            if (container != null) {
                String proxyPath = config.getString(container, PROXY_PATH_PARAM);
                if (proxyPath != null) {
                    String[] chainedChunks = StringUtils.splitByWholeSeparatorPreserveAllTokens(proxyPath,
                            CHAINED_PARAMS_TOKEN);

                    // Parse out the URI of the actual resource. This URI is found as the
                    // substring of the "full" URI, after the chained proxy prefix. We
                    // first search for the pre- and post-fixes of the original /pre/%chained_params%/post
                    // ContainerConfig value, and take the URI as everything beyond that point.
                    String startToken = chainedChunks[0];
                    String endToken = "/";
                    if (chainedChunks.length == 2 && chainedChunks[1].length() > 0) {
                        endToken = chainedChunks[1];
                    }

                    // Pull URI out of original inUri's full representation.
                    String fullProxyUri = uriIn.toString();
                    int startIx = fullProxyUri.indexOf(startToken) + startToken.length();
                    int endIx = fullProxyUri.indexOf(endToken, startIx);
                    if (startIx > 0 && endIx > 0) {
                        String chainedQuery = fullProxyUri.substring(startIx, endIx);
                        if (doDecode) {
                            chainedQuery = Utf8UrlCoder.decode(chainedQuery);
                        }
                        queryUri = new UriBuilder().setQuery(chainedQuery).toUri();
                        uriStr = fullProxyUri.substring(endIx + endToken.length());
                        while (uriStr.startsWith("/")) {
                            uriStr = uriStr.substring(1);
                        }

                    }
                }
            }
        }
    }

    if (!strictParsing && container != null && StringUtils.isEmpty(uriStr)) {
        // Query-style despite the container being configured for chained style.
        uriStr = uriIn.getQueryParameter(Param.URL.getKey());
        queryUri = uriIn;
    }

    // Parameter validation.
    if (StringUtils.isEmpty(uriStr) || StringUtils.isEmpty(container)) {
        throw new GadgetException(GadgetException.Code.MISSING_PARAMETER,
                "Missing required parameter(s):" + (StringUtils.isEmpty(uriStr) ? ' ' + Param.URL.getKey() : "")
                        + (StringUtils.isEmpty(container) ? ' ' + Param.CONTAINER.getKey() : ""),
                HttpResponse.SC_BAD_REQUEST);
    }

    String queryHost = config.getString(container, PROXY_HOST_PARAM);
    if (strictParsing) {
        if (queryHost == null || !queryHost.equalsIgnoreCase(uriIn.getAuthority())) {
            throw new GadgetException(GadgetException.Code.INVALID_PATH, "Invalid proxy host",
                    HttpResponse.SC_BAD_REQUEST);
        }
    }

    try {
        uri = Uri.parse(uriStr);
    } catch (Exception e) {
        // NullPointerException or InvalidArgumentException.
        throw new GadgetException(GadgetException.Code.INVALID_PARAMETER,
                "Invalid " + Param.URL.getKey() + ": " + uriStr, HttpResponse.SC_BAD_REQUEST);
    }

    // URI is valid.
    status = UriStatus.VALID_UNVERSIONED;

    String version = queryUri.getQueryParameter(Param.VERSION.getKey());
    if (versioner != null && version != null) {
        status = versioner.validate(uri, container, version);
    }

    ProxyUri proxied = new ProxyUri(status, uri, queryUri);
    proxied.setHtmlTagContext(uriIn.getQueryParameter(Param.HTML_TAG_CONTEXT.getKey()));
    return proxied;
}

From source file:org.apache.sysml.runtime.io.IOUtilFunctions.java

/**
 * Splits a string by a specified delimiter into all tokens, including empty.
 * NOTE: This method is meant as a faster drop-in replacement of the regular 
 * string split./*  w  w w. ja va2s.  c  om*/
 * 
 * @param str string to split
 * @param delim delimiter
 * @return string array
 */
public static String[] split(String str, String delim) {
    //split by whole separator required for multi-character delimiters, preserve
    //all tokens required for empty cells and in order to keep cell alignment
    return StringUtils.splitByWholeSeparatorPreserveAllTokens(str, delim);
}

From source file:org.calrissian.accumulorecipes.commons.support.qfd.AttributeIndexKey.java

public AttributeIndexKey(Key key) {

    String row = key.getRow().toString();
    String parts[] = StringUtils.splitByWholeSeparatorPreserveAllTokens(row, INDEX_SEP);
    int firstNBIdx = parts[3].indexOf(NULL_BYTE);

    if (row.startsWith(INDEX_V)) {
        int lastNBIdx = parts[3].lastIndexOf(NULL_BYTE);
        this.alias = parts[2];
        this.key = parts[3].substring(0, firstNBIdx);
        this.normalizedValue = parts[3].substring(firstNBIdx + 1, lastNBIdx);
        this.shard = parts[3].substring(lastNBIdx + 1, parts[3].length());
    } else if (row.startsWith(INDEX_K)) {
        this.key = parts[2];
        this.alias = parts[3].substring(0, firstNBIdx);
        this.shard = parts[3].substring(firstNBIdx + 1, parts[3].length());
    }/*from www. j  a  v  a2 s  .c  om*/
}

From source file:org.carewebframework.common.StrUtil.java

/**
 * Splits a string using the specified delimiter.
 * /*from  www.  j a v a 2s.  co  m*/
 * @param text The string to split.
 * @param delimiter The delimiter for the split operation.
 * @param count Specifies a minimum number of elements to be returned. If the result of the
 *            split operation results in fewer elements, the returned array is expanded to
 *            contain the minimum number of elements.
 * @param nonull If true, the returned array is guaranteed not to contain null values by
 *            replacing every occurrence of a null value with an empty string.
 * @return A string array containing the split values.
 */
public static String[] split(String text, String delimiter, int count, boolean nonull) {
    String[] pcs = text == null ? new String[count]
            : StringUtils.splitByWholeSeparatorPreserveAllTokens(text, delimiter);
    pcs = pcs.length >= count ? pcs : Arrays.copyOf(pcs, count);

    if (nonull) {
        for (int i = 0; i < pcs.length; i++) {
            if (pcs[i] == null) {
                pcs[i] = "";
            }
        }
    }

    return pcs;
}

From source file:org.eclipse.smarthome.binding.homematic.internal.communicator.parser.CcuParamsetDescriptionParser.java

private String[] toOptionList(String options) {
    String[] result = StringUtils.splitByWholeSeparatorPreserveAllTokens(options, ";");
    return result == null || result.length == 0 ? null : result;
}

From source file:org.eclipse.smarthome.binding.homematic.internal.communicator.parser.CcuVariablesAndScriptsParser.java

@Override
public Void parse(TclScriptDataList resultList) throws IOException {
    if (resultList.getEntries() != null) {
        for (TclScriptDataEntry entry : resultList.getEntries()) {
            HmDatapoint dp = channel.getDatapoint(HmParamsetType.VALUES, entry.name);
            if (dp != null) {
                dp.setValue(convertToType(entry.value));
            } else {
                dp = new HmDatapoint();
                dp.setName(entry.name);/* w  ww.  j  a v  a2 s. c om*/
                dp.setInfo(entry.name);
                dp.setDescription(entry.description);
                dp.setType(HmValueType.parse(entry.valueType));
                dp.setValue(convertToType(entry.value));
                if (dp.isIntegerType()) {
                    dp.setMinValue(toInteger(entry.minValue));
                    dp.setMaxValue(toInteger(entry.maxValue));
                } else {
                    dp.setMinValue(toDouble(entry.minValue));
                    dp.setMaxValue(toDouble(entry.maxValue));
                }
                dp.setReadOnly(entry.readOnly);
                dp.setUnit(entry.unit);

                String[] result = StringUtils.splitByWholeSeparatorPreserveAllTokens(entry.options, ";");
                dp.setOptions(result == null || result.length == 0 ? null : result);

                if (dp.getOptions() != null) {
                    dp.setMinValue(0);
                    dp.setMaxValue(dp.getOptions().length - 1);
                }

                dp.setParamsetType(HmParamsetType.VALUES);
                channel.addDatapoint(dp);
            }
        }
    }
    return null;
}