PicketLink Federation Core 2.1.6.Final-redhat-2

org.picketlink.identity.federation.core.saml.v2.util
Class XMLTimeUtil

java.lang.Object
  extended by org.picketlink.identity.federation.core.saml.v2.util.XMLTimeUtil

public class XMLTimeUtil
extends Object

Util class dealing with xml based time

Since:
Jan 6, 2009
Author:
Anil.Saldhana@redhat.com

Constructor Summary
XMLTimeUtil()
           
 
Method Summary
static XMLGregorianCalendar add(XMLGregorianCalendar value, long milis)
          Add additional time in miliseconds
static String getCurrentTimeZoneID()
           
static XMLGregorianCalendar getIssueInstant()
          Get the current instant of time
static XMLGregorianCalendar getIssueInstant(String timezone)
          Returns a XMLGregorianCalendar in the timezone specified.
static long inMilis(int valueInMins)
          Convert the minutes into miliseconds
static boolean isValid(XMLGregorianCalendar now, XMLGregorianCalendar notbefore, XMLGregorianCalendar notOnOrAfter)
          Validate that the current time falls between the two boundaries
static XMLGregorianCalendar parse(String timeString)
          Given a string representing xml time, parse into XMLGregorianCalendar
static Duration parseAsDuration(String timeValue)
          Given a string, get the Duration object.
static XMLGregorianCalendar subtract(XMLGregorianCalendar value, long milis)
          Subtract some miliseconds from the time value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLTimeUtil

public XMLTimeUtil()
Method Detail

add

public static XMLGregorianCalendar add(XMLGregorianCalendar value,
                                       long milis)
                                throws ConfigurationException
Add additional time in miliseconds

Parameters:
value - calendar whose value needs to be updated
milis -
Returns:
calendar value with the addition
Throws:
ConfigurationException

subtract

public static XMLGregorianCalendar subtract(XMLGregorianCalendar value,
                                            long milis)
                                     throws ConfigurationException
Subtract some miliseconds from the time value

Parameters:
value -
milis - miliseconds entered in a positive value
Returns:
Throws:
ConfigurationException

getIssueInstant

public static XMLGregorianCalendar getIssueInstant(String timezone)
                                            throws ConfigurationException
Returns a XMLGregorianCalendar in the timezone specified. If the timezone is not valid, then the timezone falls back to "GMT"

Parameters:
timezone -
Returns:
Throws:
ConfigurationException

getIssueInstant

public static XMLGregorianCalendar getIssueInstant()
                                            throws ConfigurationException
Get the current instant of time

Returns:
Throws:
ConfigurationException

getCurrentTimeZoneID

public static String getCurrentTimeZoneID()

inMilis

public static long inMilis(int valueInMins)
Convert the minutes into miliseconds

Parameters:
valueInMins -
Returns:

isValid

public static boolean isValid(XMLGregorianCalendar now,
                              XMLGregorianCalendar notbefore,
                              XMLGregorianCalendar notOnOrAfter)
Validate that the current time falls between the two boundaries

Parameters:
now -
notbefore -
notOnOrAfter -
Returns:

parseAsDuration

public static Duration parseAsDuration(String timeValue)
                                throws ParsingException
Given a string, get the Duration object. The string can be an ISO 8601 period representation (Eg.: P10M) or a numeric value. If a ISO 8601 period, the duration will reflect the defined format. If a numeric (Eg.: 1000) the duration will be calculated in milliseconds.

Parameters:
timeValue -
Returns:
Throws:
ParsingException

parse

public static XMLGregorianCalendar parse(String timeString)
                                  throws ParsingException
Given a string representing xml time, parse into XMLGregorianCalendar

Parameters:
timeString -
Returns:
Throws:
ParsingException

PicketLink Federation Core 2.1.6.Final-redhat-2

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.