cascading.util
Class Util

java.lang.Object
  extended by cascading.util.Util

public class Util
extends Object

Class Util provides reusable operations.


Nested Class Summary
static interface Util.RetryOperator<T>
           
 
Constructor Summary
Util()
           
 
Method Summary
static String captureDebugTrace(Class type)
           
static Object createProtectedObject(Class type, Object[] parameters, Class[] parameterTypes)
           
static Object deserializeBase64(String string)
          This method deserializes the Base64 encoded String into an Object instance.
static Class findMainClass(Class defaultType)
           
static String formatTrace(Operation operation, String message)
           
static String formatTrace(Pipe pipe, String message)
           
static Thread getHDFSShutdownHook()
           
static
<A> A
getProperty(Map<Object,Object> properties, String key, A defaultValue)
           
static Object invokeStaticMethod(Class type, String methodName, Object[] parameters, Class[] parameterTypes)
           
static String join(Collection collection)
          This method joins each value in the collection with a tab character as the delimiter.
static String join(Collection collection, String delim)
          This method joins each valuein the collection with the given delimiter.
static String join(int[] list, String delim)
          This method joins the values in the given list with the delim String value.
static String join(Object[] list, String delim)
          This method joins the values in the given list with the delim String value.
static void join(StringBuffer buffer, Collection collection, String delim)
          This method joins each value in the collection with the given delimiter.
static String join(String delim, String... strings)
           
static String normalizeUrl(String url)
          This methdo attempts to remove duplicate consecutive forward slashes from the given url.
static String print(Collection collection, String delim)
           
static void print(StringBuffer buffer, Collection collection, String delim)
           
static void printGraph(PrintStream out, SimpleDirectedGraph graph)
           
static String printGraph(SimpleDirectedGraph graph)
           
static void printGraph(String filename, SimpleDirectedGraph graph)
           
static void printMatrix(PrintStream out,  graph)
           
static void removeAllNulls(List list)
          This method removes all nulls from the given List.
static
<T> T
retry(Logger logger, int retries, int secondsDelay, String message, Util.RetryOperator<T> operator)
           
static String sanitizeUrl(String url)
          This method attempts to remove any username and password from the given url String.
static String serializeBase64(Object object)
          This method serializes the given Object instance and retunrs a String Base64 representation.
static String toNull(Object object)
          This method returns the Object.toString() of the given object, or an empty String if the object is null.
static String truncate(String string, int maxSize)
          This method truncates the given String value to the given size, but appends an ellipse ("...") if the String is larger than maxSize.
static void writeDOT(Writer writer, SimpleDirectedGraph graph, IntegerNameProvider vertexIdProvider, VertexNameProvider vertexNameProvider, EdgeNameProvider edgeNameProvider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

serializeBase64

public static String serializeBase64(Object object)
                              throws IOException
This method serializes the given Object instance and retunrs a String Base64 representation.

Parameters:
object - to be serialized
Returns:
String
Throws:
IOException

deserializeBase64

public static Object deserializeBase64(String string)
                                throws IOException
This method deserializes the Base64 encoded String into an Object instance.

Parameters:
string -
Returns:
Throws:
IOException

join

public static String join(int[] list,
                          String delim)
This method joins the values in the given list with the delim String value.

Parameters:
list -
delim -
Returns:
String

join

public static String join(String delim,
                          String... strings)

join

public static String join(Object[] list,
                          String delim)
This method joins the values in the given list with the delim String value.

Parameters:
list -
delim -
Returns:

join

public static String join(Collection collection)
This method joins each value in the collection with a tab character as the delimiter.

Parameters:
collection -
Returns:

join

public static String join(Collection collection,
                          String delim)
This method joins each valuein the collection with the given delimiter.

Parameters:
collection -
delim -
Returns:

join

public static void join(StringBuffer buffer,
                        Collection collection,
                        String delim)
This method joins each value in the collection with the given delimiter. All results are appended to the given StringBuffer instance.

Parameters:
buffer -
collection -
delim -

print

public static String print(Collection collection,
                           String delim)

print

public static void print(StringBuffer buffer,
                         Collection collection,
                         String delim)

sanitizeUrl

public static String sanitizeUrl(String url)
This method attempts to remove any username and password from the given url String.

Parameters:
url -
Returns:

normalizeUrl

public static String normalizeUrl(String url)
This methdo attempts to remove duplicate consecutive forward slashes from the given url.

Parameters:
url -
Returns:

toNull

public static String toNull(Object object)
This method returns the Object.toString() of the given object, or an empty String if the object is null.

Parameters:
object -
Returns:

truncate

public static String truncate(String string,
                              int maxSize)
This method truncates the given String value to the given size, but appends an ellipse ("...") if the String is larger than maxSize.

Parameters:
string -
maxSize -
Returns:

getProperty

public static <A> A getProperty(Map<Object,Object> properties,
                                String key,
                                A defaultValue)

printGraph

public static String printGraph(SimpleDirectedGraph graph)

printGraph

public static void printGraph(PrintStream out,
                              SimpleDirectedGraph graph)

printGraph

public static void printGraph(String filename,
                              SimpleDirectedGraph graph)

printMatrix

public static void printMatrix(PrintStream out,
                                graph)

removeAllNulls

public static void removeAllNulls(List list)
This method removes all nulls from the given List.

Parameters:
list -

formatTrace

public static String formatTrace(Pipe pipe,
                                 String message)

formatTrace

public static String formatTrace(Operation operation,
                                 String message)

captureDebugTrace

public static String captureDebugTrace(Class type)

findMainClass

public static Class findMainClass(Class defaultType)

writeDOT

public static void writeDOT(Writer writer,
                            SimpleDirectedGraph graph,
                            IntegerNameProvider vertexIdProvider,
                            VertexNameProvider vertexNameProvider,
                            EdgeNameProvider edgeNameProvider)

retry

public static <T> T retry(Logger logger,
                          int retries,
                          int secondsDelay,
                          String message,
                          Util.RetryOperator<T> operator)
               throws Exception
Throws:
Exception

createProtectedObject

public static Object createProtectedObject(Class type,
                                           Object[] parameters,
                                           Class[] parameterTypes)

getHDFSShutdownHook

public static Thread getHDFSShutdownHook()

invokeStaticMethod

public static Object invokeStaticMethod(Class type,
                                        String methodName,
                                        Object[] parameters,
                                        Class[] parameterTypes)


Copyright © 2007-2009 Concurrent, Inc. All Rights Reserved.