From 0d1131524cfbba81cafaab90ffcda86af50c1682 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Tue, 02 Oct 2007 16:38:40 +0000
Subject: [PATCH] Partially addressed issues 2335 and 2336 which call for support of task notifications and dependencies in client task scheduling tools.

---
 opends/src/server/org/opends/server/util/StaticUtils.java |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/util/StaticUtils.java b/opends/src/server/org/opends/server/util/StaticUtils.java
index e944ad7..ebb7be3 100644
--- a/opends/src/server/org/opends/server/util/StaticUtils.java
+++ b/opends/src/server/org/opends/server/util/StaticUtils.java
@@ -52,6 +52,8 @@
 import java.util.StringTokenizer;
 import java.util.Date;
 import java.util.TimeZone;
+import java.util.Collection;
+import java.util.Iterator;
 
 import org.opends.messages.Message;
 import org.opends.messages.MessageBuilder;
@@ -3321,6 +3323,29 @@
   }
 
   /**
+   * Creates a string representation of the elements in the
+   * <code>collection</code> separated by <code>separator</code>.
+   *
+   * @param collection to print
+   * @param separator to use between elements
+   *
+   * @return String representing the collection
+   */
+  static public String collectionToString(Collection<?> collection,
+                                          String separator)
+  {
+    StringBuilder sb = new StringBuilder();
+    for (Iterator<?> iter = collection.iterator(); iter.hasNext();) {
+      sb.append(iter.next());
+      if (iter.hasNext()) {
+        sb.append(separator);
+      }
+    }
+    return sb.toString();
+  }
+
+
+  /**
    * Retrieves an array list containing the contents of the provided array.
    *
    * @param  stringArray  The string array to convert to an array list.
@@ -4036,5 +4061,20 @@
     return timeStr;
   }
 
+  /**
+   * Indicates whether or not a string represents a syntactically correct
+   * email address.
+   *
+   * @param addr to validate
+   * @return boolean where <code>true</code> indicates that the string is a
+   *         syntactically correct email address
+   */
+  public static boolean isEmailAddress(String addr) {
+
+    // This just does basic syntax checking.  Perhaps we
+    // might want to be stricter about this.
+    return addr != null && addr.contains("@") && addr.contains(".");
+
+  }
 }
 

--
Gitblit v1.10.0