com.shephertz.app42.paas.sdk.jme.util
Class Util

java.lang.Object
  extended by com.shephertz.app42.paas.sdk.jme.util.Util

public class Util
extends java.lang.Object


Field Summary
static java.lang.String TRUE
           
 
Constructor Summary
Util()
           
 
Method Summary
static java.lang.String computeHmac(java.lang.String baseString, java.lang.String key)
          Encoding and decoding of the queries are done using the Hmac Algorithm.
static java.lang.String extractFileExtension(java.lang.String fileName)
          Taking extension out
static java.util.Date getDateFromUTCTimeStamp(java.lang.String timeStamp)
           
static java.lang.String getUTCFormattedTimestamp()
          Finds the current time
static java.lang.String getUTCFormattedTimestamp(java.util.Date date)
          Finds the particular time for a particular date
static boolean isNull(java.lang.Object obj, java.lang.String name)
          An exception to check whether the object is null or not.
static void main(java.lang.String[] args)
           
static java.lang.String multiPartRequest(java.lang.String name, java.io.InputStream fileInputStream, java.lang.String fileName, java.util.Hashtable queryParams, java.util.Hashtable postParams, java.lang.String urlPost, java.lang.String accept)
          Multipart request for all the methods
static java.lang.String sign(java.lang.String secretKey, java.util.Hashtable params)
          It signs the request that has to be sent in the Hmac format.
static boolean strToBool(java.lang.String s)
           
static void throwExceptionIfEmailNotValid(java.lang.Object obj, java.lang.String name)
          An exception to check whether the email entered is valid or not.
static void throwExceptionIfHowManyNotValid(int obj, java.lang.String name)
          To check whether the value of how many is less than 1000 or not.
static void throwExceptionIfNotValidExtension(java.lang.String fileName)
          An exception to check if the file has valid extension or not
static void throwExceptionIfNotValidImageExtension(java.lang.String fileName, java.lang.String name)
          To check if the image has a valid extension or not.
static void throwExceptionIfNullOrBlank(java.lang.Object obj, java.lang.String name)
          An exception to check whether the object is null or blank.
static void validateMax(java.lang.Integer max)
          To check whether the max value is greater than zero or not.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRUE

public static final java.lang.String TRUE
See Also:
Constant Field Values
Constructor Detail

Util

public Util()
Method Detail

computeHmac

public static java.lang.String computeHmac(java.lang.String baseString,
                                           java.lang.String key)
Encoding and decoding of the queries are done using the Hmac Algorithm.

Parameters:
baseString -
key -
Throws:
java.security.NoSuchAlgorithmException
java.security.InvalidKeyException
java.lang.IllegalStateException
java.io.UnsupportedEncodingException

extractFileExtension

public static java.lang.String extractFileExtension(java.lang.String fileName)
Taking extension out

Parameters:
fileName -
Returns:
extension

getDateFromUTCTimeStamp

public static java.util.Date getDateFromUTCTimeStamp(java.lang.String timeStamp)

getUTCFormattedTimestamp

public static java.lang.String getUTCFormattedTimestamp()
Finds the current time

Returns:
time format

getUTCFormattedTimestamp

public static java.lang.String getUTCFormattedTimestamp(java.util.Date date)
Finds the particular time for a particular date

Parameters:
date -
Returns:
time format

isNull

public static boolean isNull(java.lang.Object obj,
                             java.lang.String name)
An exception to check whether the object is null or not.

Parameters:
obj -
name -
Returns:
True if null, else false

main

public static void main(java.lang.String[] args)

multiPartRequest

public static java.lang.String multiPartRequest(java.lang.String name,
                                                java.io.InputStream fileInputStream,
                                                java.lang.String fileName,
                                                java.util.Hashtable queryParams,
                                                java.util.Hashtable postParams,
                                                java.lang.String urlPost,
                                                java.lang.String accept)
                                         throws java.lang.Exception
Multipart request for all the methods

Parameters:
name -
file -
queryParams -
postParams -
urlPost -
accept -
Returns:
string
Throws:
java.lang.Exception

sign

public static java.lang.String sign(java.lang.String secretKey,
                                    java.util.Hashtable params)
                             throws java.security.InvalidKeyException,
                                    java.security.NoSuchAlgorithmException,
                                    java.lang.IllegalStateException,
                                    java.io.UnsupportedEncodingException
It signs the request that has to be sent in the Hmac format.

Parameters:
secretKey -
params -
Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.lang.IllegalStateException
java.io.UnsupportedEncodingException

strToBool

public static boolean strToBool(java.lang.String s)

throwExceptionIfEmailNotValid

public static void throwExceptionIfEmailNotValid(java.lang.Object obj,
                                                 java.lang.String name)
An exception to check whether the email entered is valid or not.

Parameters:
obj -
name -

throwExceptionIfHowManyNotValid

public static void throwExceptionIfHowManyNotValid(int obj,
                                                   java.lang.String name)
To check whether the value of how many is less than 1000 or not.

Parameters:
howMany -

throwExceptionIfNotValidExtension

public static void throwExceptionIfNotValidExtension(java.lang.String fileName)
An exception to check if the file has valid extension or not

Parameters:
fileName -

throwExceptionIfNotValidImageExtension

public static void throwExceptionIfNotValidImageExtension(java.lang.String fileName,
                                                          java.lang.String name)
To check if the image has a valid extension or not.

Parameters:
fileName -
name -

throwExceptionIfNullOrBlank

public static void throwExceptionIfNullOrBlank(java.lang.Object obj,
                                               java.lang.String name)
An exception to check whether the object is null or blank.

Parameters:
obj -
name -

validateMax

public static void validateMax(java.lang.Integer max)
To check whether the max value is greater than zero or not.

Parameters:
max -