org.apache.oozie.util
Class ELConstantsFunctions

java.lang.Object
  extended by org.apache.oozie.util.ELConstantsFunctions

public class ELConstantsFunctions
extends Object

Base EL constants and functions.


Field Summary
static long GB
          GigaByte constant (1024 MB).
static long KB
          KiloByte constant (1024).
static long MB
          MegaByte constant (1024 KB).
static long PB
          PetaByte constant (1024 TB).
static int SUBMIT_DAYS
           
static int SUBMIT_HOURS
           
static int SUBMIT_MINUTES
           
static long TB
          TeraByte constant (1024 GB).
 
Constructor Summary
ELConstantsFunctions()
           
 
Method Summary
static String appendAll(String src, String append, String delimeter)
          Add the append string into each splitted sub-strings of the first string ('src').
static String concat(String s1, String s2)
          Return the concatenation of 2 strings.
static Object firstNotNull(Object o1, Object o2)
          Return the first not null value, or null if both are null.
static String replaceAll(String src, String regex, String replacement)
          Replace each occurrence of regular expression match in the first string with the replacement string.
static String timestamp()
          Return the current datetime in ISO8601 using Oozie processing timezone, yyyy-MM-ddTHH:mmZ.
static String toConfigurationStr(Map<String,String> map)
           
static String toJsonStr(Map<String,String> map)
           
static String toPropertiesStr(Map<String,String> map)
           
static String trim(String input)
           
static String urlEncode(String input)
          Translates a string into application/x-www-form-urlencoded format using UTF-8 encoding scheme.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KB

public static final long KB
KiloByte constant (1024). Defined for EL as 'KB'.

See Also:
Constant Field Values

MB

public static final long MB
MegaByte constant (1024 KB). Defined for EL as 'MB'.

See Also:
Constant Field Values

GB

public static final long GB
GigaByte constant (1024 MB). Defined for EL as 'GB'.

See Also:
Constant Field Values

TB

public static final long TB
TeraByte constant (1024 GB). Defined for EL as 'TB'.

See Also:
Constant Field Values

PB

public static final long PB
PetaByte constant (1024 TB). Defined for EL as 'PB'.

See Also:
Constant Field Values

SUBMIT_MINUTES

public static final int SUBMIT_MINUTES
See Also:
Constant Field Values

SUBMIT_HOURS

public static final int SUBMIT_HOURS
See Also:
Constant Field Values

SUBMIT_DAYS

public static final int SUBMIT_DAYS
See Also:
Constant Field Values
Constructor Detail

ELConstantsFunctions

public ELConstantsFunctions()
Method Detail

firstNotNull

public static Object firstNotNull(Object o1,
                                  Object o2)
Return the first not null value, or null if both are null. Defined for EL as 'Object firstNotNull(Object, Object)'.

Parameters:
o1 - first value.
o2 - second value.
Returns:
the first not null value, or or null if both are null

concat

public static String concat(String s1,
                            String s2)
Return the concatenation of 2 strings.

A string with null value is considered as an empty string.

Parameters:
s1 - first string.
s2 - second string.
Returns:
the concatenation of s1 and s2.

replaceAll

public static String replaceAll(String src,
                                String regex,
                                String replacement)
Replace each occurrence of regular expression match in the first string with the replacement string. This EL function utilizes the java String class replaceAll method. For more details please see http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#replaceAll(java.lang.String,%20java.lang.String)

Parameters:
src - source string.
regex - the regular expression to which this string is to be matched. null means no replacement.
replacement - - the string to be substituted for each match. If null, it will considered as ""
Returns:
the replaced string.

appendAll

public static String appendAll(String src,
                               String append,
                               String delimeter)
Add the append string into each splitted sub-strings of the first string ('src'). The split is performed into src string using the delimiter. E.g. appendAll("/a/b/,/c/b/,/c/d/", "ADD", ",") will return "/a/b/ADD,/c/b/ADD,/c/d/ADD"

Parameters:
src - source string.
append - - the string to be appended for each match. If null, it will considered as ""
delimeter - the string that is used to split the 'src' into substring before the append. null means no append.
Returns:
the appended string.

trim

public static String trim(String input)
Parameters:
input - string to be trimmed
Returns:
the trimmed version of the given string or the empty string if the given string was null

timestamp

public static String timestamp()
Return the current datetime in ISO8601 using Oozie processing timezone, yyyy-MM-ddTHH:mmZ. i.e.: 1997-07-16T19:20Z

Returns:
the formatted time string.

urlEncode

public static String urlEncode(String input)
Translates a string into application/x-www-form-urlencoded format using UTF-8 encoding scheme. Bytes for unsafe characters are also obtained using UTF-8 scheme.

Parameters:
input - string to be encoded
Returns:
the encoded String

toJsonStr

public static String toJsonStr(Map<String,String> map)

toPropertiesStr

public static String toPropertiesStr(Map<String,String> map)

toConfigurationStr

public static String toConfigurationStr(Map<String,String> map)


Copyright © 2013 Apache Software Foundation. All Rights Reserved.