List of usage examples for java.util StringTokenizer nextElement
public Object nextElement()
From source file:Main.java
/** * This is basically the inverse of {@link #addAndDeHump(String)}. It will remove the 'replaceThis' parameter and * uppercase the next character afterwards. * * <pre>/* w w w .ja v a 2s . c om*/ * removeAndHump( "this-is-it", %quot;-" ); * </pre> * * will become 'ThisIsIt'. * * @param data * @param replaceThis * @return */ public static String removeAndHump(String data, String replaceThis) { String temp; StringBuilder out = new StringBuilder(); temp = data; StringTokenizer st = new StringTokenizer(temp, replaceThis); while (st.hasMoreTokens()) { String element = (String) st.nextElement(); out.append(capitalizeFirstLetter(element)); } return out.toString(); }
From source file:Main.java
/** * Checks if Element Node is same as a Element name String *//*www .j av a 2 s . c o m*/ public static boolean isStrElementNode(String elementName, Node elementNode, boolean ignoreCase) { if ((elementNode == null) || (elementName == null) || (elementName.trim().equals("")) || (elementNode.getNodeType() != Node.ELEMENT_NODE)) return false; StringTokenizer tokenizer = new StringTokenizer(":"); int numTokens = tokenizer.countTokens(); if (numTokens == 1) { String name = (String) tokenizer.nextElement(); Element element = (Element) elementNode; if (element.getNamespaceURI() != null) return false; if (ignoreCase) return element.getNodeName().trim().equalsIgnoreCase(elementName); return element.getNodeName().trim().equals(elementName); } else if (numTokens == 2) { String namespace = (String) tokenizer.nextElement(); String localName = (String) tokenizer.nextElement(); Element element = (Element) elementNode; if (element.getNamespaceURI() == null) return false; if (ignoreCase) return ((element.getLocalName().trim().equalsIgnoreCase(localName)) && (element.getNamespaceURI().equalsIgnoreCase(namespace.trim()))); return ((element.getLocalName().trim().equals(localName)) && (element.getNamespaceURI().equals(namespace.trim()))); } else return false; }
From source file:com.jaspersoft.jasperserver.export.RemoveDuplicatedDisplayName.java
private static List getPaths(String listOfXML) { ArrayList lst = new ArrayList(); StringTokenizer str = new StringTokenizer(listOfXML, ","); while (str.hasMoreElements()) { lst.add(str.nextElement()); }//w w w . ja va2 s . co m return lst; }
From source file:org.rivetlogic.utils.IntegrationUtils.java
public static String encodePath(String alfPath) { StringBuilder pathBuilder = new StringBuilder(100); StringTokenizer tokenizer = new StringTokenizer(alfPath, Character.toString(File.separatorChar)); while (tokenizer.hasMoreElements()) { String pStr = tokenizer.nextElement().toString(); if (!pStr.startsWith("/")) { for (String prefix : IntegrationConstants.NAMESPACE_PREFIX_RESOLVER.getPrefixes()) { if (pStr.startsWith(prefix)) { pStr = pStr.substring(0, prefix.length() + 1) + ISO9075.encode(pStr.substring(prefix.length() + 1)); }//from w w w . j a v a2 s. c o m } pathBuilder.append(File.separatorChar); pathBuilder.append(pStr); } } return pathBuilder.toString(); }
From source file:org.energy_home.jemma.internal.ah.hap.client.HapServiceConfiguration.java
private static String[] propertyValueToStringArray(String propertyValue) { propertyValue = propertyValue.replace("[", ""); propertyValue = propertyValue.replace("]", ""); propertyValue = propertyValue.trim(); StringTokenizer st = new StringTokenizer(propertyValue, ","); String[] result = new String[st.countTokens()]; int i = 0;/* w w w . j a v a 2 s. com*/ while (st.hasMoreElements()) { result[i] = ((String) st.nextElement()).trim(); i++; } return result; }
From source file:org.jbpm.formModeler.core.processing.fieldHandlers.SubformFieldHandler.java
public static boolean checkSubformDepthAllowed(Form form, String namesapce) { StringTokenizer token = new StringTokenizer(namesapce, FormProcessor.NAMESPACE_SEPARATOR, false); String _id = form.getId().toString(); int count = 0; while (token.hasMoreElements()) { String idToCompare = (String) token.nextElement(); if (idToCompare.equals(_id)) { count++;//from w w w .j a va2 s. c o m if (count >= maxDepth) { return false; } } } return true; }
From source file:org.squale.welcom.outils.Access.java
/** * Parse le token || pour la mise en place du ou * /*from w ww. j a va 2 s.c o m*/ * @param logonbean : Le bien de logon pour la verifieation de la clef * @param accessKey : Valeur a tester * @return Vrai si OK */ public static String getMultipleSecurityPage(final WILogonBeanSecurity logonbean, final String accessKey) { if (logonbean == null) { return READWRITE; } final StringTokenizer droitSplitter = new StringTokenizer(accessKey, "||"); String access = NONE; while (droitSplitter.hasMoreElements()) { final String item = (String) droitSplitter.nextElement(); final String acc = logonbean.getAccess(item); if (((checkAccessDroit(access, NONE) || checkAccessDroit(access, NO)) && checkAccessDroit(acc)) || (checkAccessDroit(access, READONLY) && checkAccessDroit(acc, READWRITE))) { access = acc; } } return access; }
From source file:net.antidot.semantic.rdf.rdb2rdf.r2rml.tools.R2RMLToolkit.java
/** * Every pair of unescaped curly braces in the inverse expression is a * column reference in an inverse expression. The string between the braces * MUST be a valid column name.//w w w .ja v a 2s . com * * @param value * @return */ public static Set<ColumnIdentifier> extractColumnNamesFromInverseExpression(String inverseExpression) { Set<ColumnIdentifier> result = new HashSet<ColumnIdentifier>(); if (inverseExpression != null) { StringTokenizer st = new StringTokenizer(inverseExpression, "{}"); while (st.hasMoreElements()) { String element = st.nextElement().toString(); int index = inverseExpression.indexOf(element); if (index > 0 && index < inverseExpression.length() && inverseExpression.charAt(index - 1) == '{' && (inverseExpression.charAt(index + element.length()) == '}')) { // result.add(deleteBackSlash(element)); result.add(ColumnIdentifierImpl.buildFromR2RMLConfigFile(element)); } } } return result; }
From source file:org.wso2.carbon.identity.application.authentication.endpoint.util.MutualSSLManager.java
/** * There can be sensitive information like passwords in configuration file. If they are encrypted using secure * vault, this method will resolve them and replace with original values. */// w w w . j a va2 s. co m private static void resolveSecrets(Properties properties) { String protectedTokens = (String) properties.get(PROTECTED_TOKENS); if (StringUtils.isNotBlank(protectedTokens)) { String secretProvider = (String) properties.get(SECRET_PROVIDER); SecretResolver secretResolver; if (StringUtils.isBlank(secretProvider)) { properties.put(SECRET_PROVIDER, DEFAULT_CALLBACK_HANDLER); } secretResolver = SecretResolverFactory.create(properties, ""); StringTokenizer st = new StringTokenizer(protectedTokens, ","); while (st.hasMoreElements()) { String element = st.nextElement().toString().trim(); if (secretResolver.isTokenProtected(element)) { if (log.isDebugEnabled()) { log.debug("Resolving and replacing secret for " + element); } // Replaces the original encrypted property with resolved property properties.put(element, secretResolver.resolve(element)); } else { if (log.isDebugEnabled()) { log.debug("No encryption done for value with key :" + element); } } } } else { if (log.isDebugEnabled()) { log.debug("Secure vault encryption ignored since no protected tokens available"); } } }
From source file:azkaban.utils.FileIOUtils.java
public static String getSourcePathFromClass(Class<?> containedClass) { File file = new File(containedClass.getProtectionDomain().getCodeSource().getLocation().getPath()); if (!file.isDirectory() && file.getName().endsWith(".class")) { String name = containedClass.getName(); StringTokenizer tokenizer = new StringTokenizer(name, "."); while (tokenizer.hasMoreTokens()) { tokenizer.nextElement(); file = file.getParentFile(); }// ww w . j a v a 2s .c om return file.getPath(); } else { return containedClass.getProtectionDomain().getCodeSource().getLocation().getPath(); } }