List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:December 27 2007 3:10am
Subject:Rev 297: * Removed *tuple() methods and replaced them with get*Operation() methods. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/telc...
View as plain text  
At http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/telco-6.3

------------------------------------------------------------
revno: 297
revision-id:mtaylor@stripped
parent: mtaylor@stripped
parent: mtaylor@stripped
committer: Monty Taylor <mtaylor@stripped>
branch nick: telco-6.3
timestamp: Wed 2007-12-26 21:10:37 -0600
message:
  * Removed *tuple() methods and replaced them with get*Operation() methods.
  * Moved code from javacode blocks to abstract mixin classes. 
  * Updated examples and testsuite to work with new code.
modified:
  debian/changelog               changelog-20071219024048-xwcgy5oe2wb2dk64-2
  java/testsuite/BaseTestCase.java basetestcase.java-20070523000102-ggam3j202kmrm4es-5
    ------------------------------------------------------------
    revno: 192.1.25.1.107.1.73
    revision-id:mtaylor@stripped
    parent: mtaylor@stripped
    committer: Monty Taylor <mtaylor@stripped>
    branch nick: devel
    timestamp: Wed 2007-12-26 20:56:16 -0600
    message:
      * Removed *tuple() methods and replaced them with get*Operation() methods.
      * Moved code from javacode blocks to abstract mixin classes. 
      * Updated examples and testsuite to work with new code.
    modified:
      configure.in                   configure.in-20070228020914-u2pk759xg7thauwf-13
      debian/changelog               changelog-20071219024048-xwcgy5oe2wb2dk64-2
    ------------------------------------------------------------
    revno: 192.1.25.1.107.1.72
    revision-id:mtaylor@stripped
    parent: mtaylor@stripped
    committer: Monty Taylor <mtaylor@stripped>
    branch nick: devel
    timestamp: Wed 2007-12-26 20:47:27 -0600
    message:
      Copied in split method from connector/j to parameterize the generic types.
    modified:
      java/testsuite/BaseTestCase.java basetestcase.java-20070523000102-ggam3j202kmrm4es-5
=== modified file 'debian/changelog'
--- a/debian/changelog	2007-12-20 02:25:04 +0000
+++ b/debian/changelog	2007-12-27 03:10:37 +0000
@@ -1,5 +1,13 @@
 ndb-connectors (0.5.6.3.6.9-1) gutsy; urgency=low
 
+  * Removed *tuple() methods and replaced them with get*Operation() methods.
+  * Moved code from javacode blocks to abstract mixin classes. 
+  * Updated examples and testsuite to work with new code.
+
+ -- Monty Taylor <monty@stripped>  Wed, 26 Dec 2007 20:55:08 -0600
+
+ndb-connectors (0.5.1.22.19-1) gutsy; urgency=low
+
   * Split ndbj.i into a whole bunch of smaller files for easy of brain.
   * Initial work on JTA Transaction support for better integration.
   * Fixed a place in NdbOperationResultsImpl where I really should have been

=== modified file 'java/testsuite/BaseTestCase.java'
--- a/java/testsuite/BaseTestCase.java	2007-12-27 02:37:27 +0000
+++ b/java/testsuite/BaseTestCase.java	2007-12-27 02:47:27 +0000
@@ -16,6 +16,7 @@
 import java.util.List;
 import java.util.Locale;
 import java.util.Properties;
+import java.util.StringTokenizer;
 
 import junit.framework.TestCase;
 
@@ -187,13 +188,13 @@
 		Properties props = new Properties();
 		
 		if (propsList != null) {
-			List<String> keyValuePairs = StringUtils.split(propsList, ",", false);
+			List<String> keyValuePairs = split(propsList, ",", false);
 			
 			Iterator<String> iter = keyValuePairs.iterator();
 			
 			while (iter.hasNext()) {
 				String kvp = iter.next();
-				List<String> splitUp = StringUtils.split(kvp, "=", false);
+				List<String> splitUp = split(kvp, "=", false);
 				props.setProperty(splitUp.get(0).toString().trim(), splitUp.get(1).toString());
 			}
 		}
@@ -597,4 +598,102 @@
 		
 		return buf.toString();
 	}
+	
+	/**
+	 * Splits stringToSplit into a list, using the given delimitter
+	 * 
+	 * @param stringToSplit
+	 *            the string to split
+	 * @param delimitter
+	 *            the string to split on
+	 * @param trim
+	 *            should the split strings be whitespace trimmed?
+	 * 
+	 * @return the list of strings, split by delimitter
+	 * 
+	 * @throws IllegalArgumentException
+	 *             DOCUMENT ME!
+	 */
+	public static final List<String> split(String stringToSplit, String delimitter,
+			boolean trim) {
+		if (stringToSplit == null) {
+			return new ArrayList<String>();
+		}
+
+		if (delimitter == null) {
+			throw new IllegalArgumentException();
+		}
+
+		StringTokenizer tokenizer = new StringTokenizer(stringToSplit,
+				delimitter, false);
+
+		List<String> splitTokens = new ArrayList<String>(tokenizer.countTokens());
+
+		while (tokenizer.hasMoreTokens()) {
+			String token = tokenizer.nextToken();
+
+			if (trim) {
+				token = token.trim();
+			}
+
+			splitTokens.add(token);
+		}
+
+		return splitTokens;
+	}
+
+	/**
+	 * Splits stringToSplit into a list, using the given delimitter
+	 * 
+	 * @param stringToSplit
+	 *            the string to split
+	 * @param delimitter
+	 *            the string to split on
+	 * @param trim
+	 *            should the split strings be whitespace trimmed?
+	 * 
+	 * @return the list of strings, split by delimiter
+	 * 
+	 * @throws IllegalArgumentException
+	 *             DOCUMENT ME!
+	 */
+	public static final List<String> split(String stringToSplit, String delimiter,
+			String markers, String markerCloses, boolean trim) {
+		if (stringToSplit == null) {
+			return new ArrayList<String>();
+		}
+
+		if (delimiter == null) {
+			throw new IllegalArgumentException();
+		}
+
+		int delimPos = 0;
+		int currentPos = 0;
+
+		List<String> splitTokens = new ArrayList<String>();
+
+		while ((delimPos = StringUtils.indexOfIgnoreCaseRespectMarker(currentPos,
+				stringToSplit, delimiter, markers, markerCloses, false)) != -1) {
+			String token = stringToSplit.substring(currentPos, delimPos);
+
+			if (trim) {
+				token = token.trim();
+			}
+
+			splitTokens.add(token);
+			currentPos = delimPos + 1;
+		}
+
+		if (currentPos < stringToSplit.length()) {
+			String token = stringToSplit.substring(currentPos);
+
+			if (trim) {
+				token = token.trim();
+			}
+
+			splitTokens.add(token);
+		}
+
+		return splitTokens;
+	}
 }

Thread
Rev 297: * Removed *tuple() methods and replaced them with get*Operation() methods. in http://bazaar.launchpad.net/~ndb-connectors/ndb-connectors/telc...Monty Taylor27 Dec