List of usage examples for java.util StringTokenizer nextElement
public Object nextElement()
From source file:org.pdfgal.pdfgalweb.services.impl.SplitServiceImpl.java
/** * This method splits the file, each new file will start at each one of the * pages./*from ww w . j a v a 2 s . c o m*/ * * @param file * @param pages * @return The list of URIs where files are saved. * @throws NumberFormatException * @throws IOException * @throws COSVisitorException */ private List<String> splitConcretePages(final MultipartFile file, final String pages, final String inputUri, final String outputUri) throws NumberFormatException, COSVisitorException, IOException { final List<Integer> pagesList = new ArrayList<Integer>(); final StringTokenizer stringTokenizer = new StringTokenizer(pages, ","); while (stringTokenizer.hasMoreElements()) { pagesList.add(Integer.parseInt((String) stringTokenizer.nextElement())); } // File is splitted return this.pdfGal.split(inputUri, outputUri, pagesList); }
From source file:org.apache.jcs.access.monitor.MonitorAccess.java
/** * Removes all./*from ww w. j a va 2s. c o m*/ * <p> * @param cacheName * @param key * @return an informative message about what was deleted. */ public String delete(String cacheName, String key) { // some junk to return for a synchronous call String result = ""; try { ICache cache = this.cacheMgr.getCache(cacheName); if (key != null) { if (key.toUpperCase().equals("ALL")) { cache.removeAll(); if (log.isDebugEnabled()) { log.debug("Removed all elements from " + cacheName); } result = "key = " + key; } else { if (log.isDebugEnabled()) { log.debug("key = " + key); } result = "key = " + key; StringTokenizer toke = new StringTokenizer(key, "_"); while (toke.hasMoreElements()) { String temp = (String) toke.nextElement(); cache.remove(key); if (log.isDebugEnabled()) { log.debug("Removed " + temp + " from " + cacheName); } } } } else { result = "key is null"; } } catch (Exception e) { log.error(e); } return result; }
From source file:org.xdi.oxauth.util.RedirectUri.java
public void parseQueryString(String queryString) { if (queryString != null) { StringTokenizer st = new StringTokenizer(queryString, "&", false); while (st.hasMoreElements()) { String nameValueToken = st.nextElement().toString(); StringTokenizer stParamValue = new StringTokenizer(nameValueToken, "=", false); if (stParamValue.countTokens() == 1) { String paramName = stParamValue.nextElement().toString(); responseParameters.put(paramName, null); } else if (stParamValue.countTokens() == 2) { try { String paramName = stParamValue.nextElement().toString(); String paramValue = URLDecoder.decode(stParamValue.nextElement().toString(), Util.UTF8_STRING_ENCODING); responseParameters.put(paramName, paramValue); } catch (UnsupportedEncodingException e) { e.printStackTrace(); }/*from w ww.j a v a2 s . c o m*/ } } } }
From source file:com.enonic.vertical.adminweb.handlers.xmlbuilders.ContentFileXMLBuilder.java
public void buildContentTypeXML(User user, Document doc, Element contentdata, ExtendedMap formItems) throws VerticalAdminException { // Name/*www. j a v a 2 s . c o m*/ Element tempElement = XMLTool.createElement(doc, contentdata, "name", formItems.getString("name")); // Description tempElement = XMLTool.createElement(doc, contentdata, "description"); XMLTool.createCDATASection(doc, tempElement, formItems.getString("description", "")); // Keywords Element keywords = XMLTool.createElement(doc, contentdata, "keywords"); if (formItems.containsKey("keywords")) { StringTokenizer stringTok = new StringTokenizer(formItems.getString("keywords"), " "); while (stringTok.hasMoreElements()) { tempElement = XMLTool.createElement(doc, keywords, "keyword", (String) stringTok.nextElement()); } } // File size int fileSize = formItems.getInt("filesize"); XMLTool.createElement(doc, contentdata, "filesize", String.valueOf(fileSize)); tempElement = XMLTool.createElement(doc, contentdata, "binarydata"); tempElement.setAttribute("key", (String) formItems.get("binarydatakey")); }
From source file:nl.nn.adapterframework.jdbc.MessageStoreSender.java
public String sendMessage(String correlationID, String message, ParameterResolutionContext prc) throws SenderException, TimeOutException { if (sessionKeys != null) { List<String> list = new ArrayList<String>(); list.add(StringEscapeUtils.escapeCsv(message)); StringTokenizer tokenizer = new StringTokenizer(sessionKeys, ","); while (tokenizer.hasMoreElements()) { String sessionKey = (String) tokenizer.nextElement(); list.add(StringEscapeUtils.escapeCsv((String) prc.getSession().get(sessionKey))); }//from w w w. j a va 2 s . c o m StrBuilder sb = new StrBuilder(); sb.appendWithSeparators(list, ","); message = sb.toString(); } String messageId = prc.getSession().getMessageId(); if (prc != null && paramList != null && paramList.findParameter("messageId") != null) { try { messageId = (String) prc.getValueMap(paramList).get("messageId"); } catch (ParameterException e) { throw new SenderException("Could not resolve parameter messageId", e); } } return storeMessage(messageId, correlationID, new Date(), null, null, message); }
From source file:org.wso2.carbon.apimgt.handlers.AuthenticationHandler.java
private String getDeviceType(String url) { StringTokenizer parts = new StringTokenizer(url, "/"); while (parts.hasMoreElements()) { if (parts.nextElement().equals("api")) { return (String) parts.nextElement(); }/*from w w w . jav a2 s . co m*/ } return null; }
From source file:nl.nn.adapterframework.jdbc.MessageStoreListener.java
public void configure() throws ConfigurationException { if (sessionKeys != null) { sessionKeysList = new ArrayList<String>(); StringTokenizer stringTokenizer = new StringTokenizer(sessionKeys, ","); while (stringTokenizer.hasMoreElements()) { sessionKeysList.add((String) stringTokenizer.nextElement()); }/*w w w .ja va 2 s . c o m*/ } setSelectQuery("SELECT MESSAGEKEY, MESSAGE FROM IBISSTORE " + "WHERE TYPE = '" + JdbcTransactionalStorage.TYPE_MESSAGESTORAGE + "' AND SLOTID = '" + slotId + "' "); // This class was initially developed as DelayStoreListener with // the following condition added. We could still add an // optional delay attribute but this functionality wasn't used // anymore and the condition is Oracle specific. // + "AND SYSTIMESTAMP >= MESSAGEDATE + INTERVAL '" + delay + "' SECOND"); String query = "UPDATE IBISSTORE SET TYPE = '" + JdbcTransactionalStorage.TYPE_MESSAGELOG_RECEIVER + "', COMMENTS = '" + ReceiverBase.RCV_MESSAGE_LOG_COMMENTS + "', EXPIRYDATE = ({fn now()} + 30) WHERE MESSAGEKEY = ?"; // Date date = new Date(); // Calendar cal = Calendar.getInstance(); // cal.setTime(date); // cal.add(Calendar.DAY_OF_MONTH, getRetention()); // stmt.setTimestamp(++parPos, new Timestamp(cal.getTime().getTime())); if (!isMoveToMessageLog()) { query = "DELETE FROM IBISSTORE WHERE MESSAGEKEY = ?"; } setUpdateStatusToProcessedQuery(query); setUpdateStatusToErrorQuery(query); setKeyField("MESSAGEKEY"); setMessageField("MESSAGE"); setMessageFieldType("blob"); setBlobSmartGet(true); super.configure(); }
From source file:org.trafodion.dtm.HBaseTmZK.java
/** * @param node/*from ww w. j a v a 2s .co m*/ * @param recovTable * @throws IOException */ public void postAllRegionEntries(HTable recovTable) throws IOException { LOG.info("HBaseTmZK:postAllRegionEntries: recovTable: " + recovTable); NavigableMap<HRegionInfo, ServerName> regionMap = recovTable.getRegionLocations(); Iterator<Map.Entry<HRegionInfo, ServerName>> it = regionMap.entrySet().iterator(); while (it.hasNext()) { // iterate entries. NavigableMap.Entry<HRegionInfo, ServerName> pairs = it.next(); HRegionInfo region = pairs.getKey(); LOG.info("postAllRegionEntries: region: " + region.getRegionNameAsString()); ServerName serverValue = regionMap.get(region); String hostAndPort = new String(serverValue.getHostAndPort()); StringTokenizer tok = new StringTokenizer(hostAndPort, ":"); String hostName = new String(tok.nextElement().toString()); int portNumber = Integer.parseInt(tok.nextElement().toString()); byte[] lv_byte_region_info = region.toByteArray(); try { LOG.info("Calling createRecoveryzNode for encoded region: " + region.getEncodedName()); createRecoveryzNode(hostName, portNumber, region.getEncodedName(), lv_byte_region_info); } catch (Exception e2) { LOG.error("postAllRegionEntries exception in createRecoveryzNode " + region.getTable().getNameAsString() + " exception: " + e2); } } // while }
From source file:org.apache.torque.engine.database.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.//w w w.java 2 s .c o m * @see org.apache.torque.engine.database.model.NameGenerator * @see #underscoreOmitSchemaMethod(String) */ protected String underscoreOmitSchemaMethod(String schemaName) { // 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(); }
From source file:org.apache.torque.engine.database.model.JavaNameGenerator.java
/** * Converts a database schema name to java object name. Operates * same as underscoreMethod but does not convert anything to * lowercase./*from ww w.jav a2s.c o m*/ * * @param schemaName name to be converted. * @return converted name. * @see org.apache.torque.engine.database.model.NameGenerator * @see #underscoreMethod(String) */ protected String javanameMethod(String schemaName) { StringBuffer name = new StringBuffer(); StringTokenizer tok = new StringTokenizer(schemaName, String.valueOf(STD_SEPARATOR_CHAR)); while (tok.hasMoreTokens()) { String namePart = (String) tok.nextElement(); name.append(StringUtils.capitalize(namePart)); } // remove the SCHEMA_SEPARATOR_CHARs and capitalize // the tokens schemaName = name.toString(); name = new StringBuffer(); tok = new StringTokenizer(schemaName, String.valueOf(SCHEMA_SEPARATOR_CHAR)); while (tok.hasMoreTokens()) { String namePart = (String) tok.nextElement(); name.append(StringUtils.capitalize(namePart)); } return name.toString(); }