Example usage for java.util StringTokenizer nextElement

List of usage examples for java.util StringTokenizer nextElement

Introduction

In this page you can find the example usage for java.util StringTokenizer nextElement.

Prototype

public Object nextElement() 

Source Link

Document

Returns the same value as the nextToken method, except that its declared return value is Object rather than String .

Usage

From source file:net.sourceforge.dvb.projectx.xinput.ftp.FtpVO.java

public void fromString(String string) {
    // Don't use String.split(), because it is not available on jdk 1.2
    StringTokenizer st = new StringTokenizer(string, "|");
    String[] tokens = new String[6];

    for (int i = 0; st.hasMoreTokens() && i < 6; i++)
        tokens[i] = st.nextElement().toString();

    server = tokens[1];/*  w  w w.  j  a  v  a 2 s.  c om*/
    directory = tokens[3];
    user = tokens[4];
    password = tokens[5];

    try {
        Integer.parseInt(tokens[2]);
        port = tokens[2];
    } catch (Exception e) {
        port = null;
    }
}

From source file:org.squale.welcom.outils.jdbc.WConnectionString.java

/**
 * Initialise un objet connectionString a partir d'une string
 * //from   ww  w  . j  a  va 2s.  c  o  m
 * @param connectionString la chaine
 */
public void setConnectionString(final String connectionString) {
    final StringTokenizer st = new StringTokenizer(connectionString, ";");

    while (st.hasMoreElements()) {
        final String element = (String) st.nextElement();
        final int posEqual = element.indexOf("=");
        String key = "";
        String value = "";

        if (posEqual != -1) {
            key = element.substring(0, posEqual);
            value = element.substring(element.indexOf("=") + 1, element.length());
        } else {
            key = element;
        }

        // Set les valeurs dans le bean
        setAttribute(key, value);
    }
}

From source file:org.apache.cocoon.portal.coplet.CopletData.java

/**
 * Return the list of roles that are allowed to access this coplet
 * @return A list of roles or null if everyone is allowed.
 *///from  w  w  w.j a v a 2s . co  m
public List getAllowedRolesList() {
    if (StringUtils.isBlank(this.allowedRoles)) {
        return null;
    }
    if (this.allowedRolesList == null) {
        this.allowedRolesList = new ArrayList();
        final StringTokenizer tokenizer = new StringTokenizer(this.allowedRoles, ",");
        while (tokenizer.hasMoreElements()) {
            String token = (String) tokenizer.nextElement();
            this.allowedRolesList.add(token);
        }
        if (this.allowedRolesList.size() == 0) {
            this.allowedRoles = null;
            this.allowedRolesList = null;
        }
    }
    return this.allowedRolesList;
}

From source file:com.esri.gpt.control.rest.search.DistributedSearchServlet.java

/**
 * Gets the RIDs specified within the request.
 * /*from w  ww  .j a  va 2s  . co  m*/
 * @param request
 *          the HTTP request
 * @return the RIDs
 */
@SuppressWarnings("unchecked")
private StringSet getRids(HttpServletRequest request) {
    StringSet rids = new StringSet();
    Map<String, String[]> requestParameterMap = request.getParameterMap();
    for (Map.Entry<String, String[]> e : requestParameterMap.entrySet()) {
        if (e.getKey().equalsIgnoreCase("rids")) {
            String[] values = e.getValue();
            if (values != null) {
                for (String tokens : values) {
                    StringTokenizer st = new StringTokenizer(tokens, ",");
                    while (st.hasMoreElements()) {
                        String value = Val.chkStr((String) st.nextElement());
                        if (value.length() > 0) {
                            try {
                                rids.add(URLDecoder.decode(value, "UTF-8"));
                            } catch (UnsupportedEncodingException e1) {
                                // Should never happen
                                LOG.log(Level.WARNING, "Could not decde uuid", e1);
                            }
                        }
                    }
                }
            }
        }
    }

    String arrRids[] = request.getParameterValues("rid");
    for (int i = 0; arrRids != null && i < arrRids.length; i++) {
        rids.add(arrRids[i]);
    }
    return rids;
}

From source file:Main.java

/**
 * Parses the given name and returns the name elements as List of Strings.
 *
 * @param name the name, that should be parsed.
 * @return the parsed name.//from  w ww . j a  va 2s.co  m
 */
private List parseName(final String name) {
    final ArrayList list = new ArrayList();
    final StringTokenizer strTok = new StringTokenizer(name, "/");
    while (strTok.hasMoreElements()) {
        final String s = (String) strTok.nextElement();
        if (s.length() != 0) {
            list.add(s);
        }
    }
    return list;
}

From source file:org.exoplatform.wiki.rendering.macro.jira.JiraIssueMacroParameters.java

@PropertyDescription("JIRA Field Columns to Display. Sample: type,key,summary")
public void setColumns(String columns) {
    if (StringUtils.isEmpty(columns)) {
        return;//  ww w  .  java  2 s  . c  o m
    }

    StringTokenizer tokenizer = new StringTokenizer(columns, ",");
    if (this.columns == null) {
        this.columns = new ArrayList<String>();
    } else {
        this.columns.clear();
    }

    while (tokenizer.hasMoreElements()) {
        String field = ((String) tokenizer.nextElement()).trim();
        if (!StringUtils.isEmpty(field)) {
            this.columns.add(field);
        }
    }
}

From source file:gtu._work.ui.RetryByPassUI.java

private void readMessageId() {
    StringBuilder sb = new StringBuilder();
    try {/*ww w.  java2 s.c om*/
        String county = (String) countryComboBox.getSelectedItem();
        if (StringUtils.isBlank(county)) {
            showMessage("??");
        }
        String type = (String) passRetryComboBox.getSelectedItem();
        if (StringUtils.isBlank(type)) {
            showMessage("???");
        }
        String messageIdAreaStr = messageIdArea.getText();
        if (StringUtils.isBlank(messageIdAreaStr)) {
            showMessage("messageId");
        }
        String ip = "";
        String region = "";
        String port = "";
        for (CountyEnum e : CountyEnum.values()) {
            if (e.countyLabel.equals(county)) {
                ip = e.ip;
                region = e.region;
                port = e.port;
                break;
            }
        }

        List<String> messageIdList = new ArrayList<String>();
        StringTokenizer tokenizer = new StringTokenizer(messageIdAreaStr);
        for (; tokenizer.hasMoreElements();) {
            String val = (String) tokenizer.nextElement();
            messageIdList.add(val);
        }

        for (String messageId : messageIdList) {
            String urlStr = String.format("http://%1$s:%2$s/%3$s/version?MQ=%4$s:%5$s", ip, port, region, type,
                    messageId);
            setLog("URL ==> " + urlStr, sb);

            URL url_address = new URL(urlStr);
            BufferedReader br = new BufferedReader(new InputStreamReader(url_address.openStream(), "UTF-8"));
            for (String line = null; (line = br.readLine()) != null;) {
                setLog(line, sb);
            }
            setLog("***************************************************************", sb);
            setLog("***************************************************************", sb);
            br.close();
        }

        showMessage("?!!");
    } catch (Exception e) {
        //            JCommonUtil.handleException(e);
        showMessage(e.toString());
    }
}

From source file:com.frameworkset.orm.engine.model.JavaNameGenerator.java

/**
 * Converts a database schema name to java object name. 
 * First, it removes all characters before the last occurence of 
 * .<code>SCHEMA_SEPARATOR_CHAR</code>. Then, in a second step, removes
 * <code>STD_SEPARATOR_CHAR</code>, capitilizes first letter of
 * name and each letter after the <code>STD_SEPERATOR</code>,
 * and converts the rest of the letters to lowercase.
 *
 * @param schemaName name to be converted.
 * @return converted name.//from   w ww.j a  va2  s.c o  m
 * @see com.frameworkset.orm.engine.model.NameGenerator
 * @see #underscoreOmitSchemaMethod(String)
 */
protected String underscoreOmitSchemaMethod(String schemaName, boolean IGNORE_FIRST_TOKEN) {
    // take only part after last dot
    int lastDotPos = schemaName.lastIndexOf(SCHEMA_SEPARATOR_CHAR);
    if (lastDotPos != -1) {
        schemaName = schemaName.substring(lastDotPos + 1);
    }
    StringBuffer name = new StringBuffer();
    StringTokenizer tok = new StringTokenizer(schemaName, String.valueOf(STD_SEPARATOR_CHAR));
    while (tok.hasMoreTokens()) {
        String namePart = ((String) tok.nextElement()).toLowerCase();
        name.append(StringUtils.capitalize(namePart));
    }
    return name.toString();
}