Example usage for org.apache.commons.lang.text StrTokenizer next

List of usage examples for org.apache.commons.lang.text StrTokenizer next

Introduction

In this page you can find the example usage for org.apache.commons.lang.text StrTokenizer next.

Prototype

public Object next() 

Source Link

Document

Gets the next token.

Usage

From source file:com.odiago.flumebase.io.CharBufferUtils.java

/**
 * Parses a CharSequence into a list of values, all of some other type.
 *//*from w w  w .  j  a va  2  s .  c  o m*/
public static List<Object> parseList(CharBuffer chars, Type listItemType, String nullStr, String listDelim)
        throws ColumnParseException {
    StrTokenizer tokenizer = new StrTokenizer(chars.toString(), listDelim.charAt(0));
    List<Object> out = new ArrayList<Object>();

    while (tokenizer.hasNext()) {
        String part = (String) tokenizer.next();
        out.add(parseType(CharBuffer.wrap(part), listItemType, nullStr, listDelim));
    }

    return Collections.unmodifiableList(out);
}

From source file:de.sub.goobi.forms.ModuleServerForm.java

/**
 * Eine Shortsession fr einen Schritt starten.
 *//*from  w ww  .  j  ava2 s  .  c  o  m*/
public String startShortSession(Task inSchritt) throws GoobiException, XmlRpcException {
    myModule = null;
    if (inSchritt.getTypeModuleName() == null || inSchritt.getTypeModuleName().length() == 0) {
        Helper.setFehlerMeldung("this step has no mudule");
        return null;
    }

    /*
     * zustzliche Parameter neben dem Modulnamen
     */
    HashMap<String, Object> typeParameters = new HashMap<>();
    String schrittModuleName = inSchritt.getTypeModuleName();
    StrTokenizer tokenizer = new StrTokenizer(inSchritt.getTypeModuleName());
    int counter = 0;
    while (tokenizer.hasNext()) {
        String tok = (String) tokenizer.next();
        if (counter == 0) {
            schrittModuleName = tok;
        } else {
            if (tok.contains(":")) {
                String key = tok.split(":")[0];
                String value = tok.split(":")[1];
                typeParameters.put(key, value);
            }
        }
        counter++;
    }

    /*
     * Modulserver luft noch nicht
     */
    if (modulmanager == null) {
        throw new GoobiException(0, "Der Modulserver luft nicht");
    }

    /*
     * ohne gewhltes Modul gleich wieder raus
     */
    for (ModuleDesc md : modulmanager) {
        if (md.getName().equals(schrittModuleName)) {
            myModule = md;
        }
    }
    if (myModule == null) {
        Helper.setFehlerMeldung("Module not found");
        return null;
    }

    /*
     * Verbindung zum Modul aufbauen und url zurckgeben
     */
    String processId = String.valueOf(inSchritt.getProcess().getId().intValue());
    String tempID = UniqueID.generate_session();
    myRunningShortSessions.put(tempID, processId);

    GoobiModuleParameter gmp1 = new GoobiModuleParameter(processId, tempID,
            myModule.getModuleClient().longsessionID, typeParameters);
    HttpSession insession = (HttpSession) FacesContext.getCurrentInstance().getExternalContext()
            .getSession(false);

    String applicationUrl = new HelperForm().getServletPathWithHostAsUrl();
    gmp1.put("return_url", applicationUrl + HelperForm.MAIN_JSF_PATH
            + "/AktuelleSchritteBearbeiten.jsf?jsessionId=" + insession.getId());
    myModule.getGmps().add(gmp1); // add session in den Manager
    return myModule.getModuleClient().start(gmp1);
}

From source file:nl.nn.adapterframework.jdbc.MessageStoreListener.java

@Override
public Object getRawMessage(Map threadContext) throws ListenerException {
    Object rawMessage = super.getRawMessage(threadContext);
    if (rawMessage != null && sessionKeys != null) {
        MessageWrapper messageWrapper = (MessageWrapper) rawMessage;
        StrTokenizer strTokenizer = StrTokenizer.getCSVInstance().reset(messageWrapper.getText());
        messageWrapper.setText((String) strTokenizer.next());
        int i = 0;
        while (strTokenizer.hasNext()) {
            threadContext.put(sessionKeysList.get(i), strTokenizer.next());
            i++;//  ww w.j  a  va2s  .  c  o m
        }
    }
    return rawMessage;
}