soap tutorial

adriani.jws.template.util
Class Utilities

java.lang.Object
  extended by adriani.jws.template.util.Utilities

public abstract class Utilities
extends java.lang.Object

General utilities class for conversion of different formats, typically date and time formats.
Let's recall the standard Java date and time lexicon:

Calendar.ZONE_OFFSET: this offset represent the offset of the date specified in the data string description, for example "+01:00" or "+02:00".
Example: the date "2010-02-26T15:40:00+00:00" will be converted into a calendar with offset equals 0, the date "2010-02-26T15:40:00+01:00" will be have an offset set to 3600000, while the date "2010-02-26T15:40:00+02:00" will be have an offset set to 7200000.

TimeZone: describes the time zone bound to a Calendar object.
If the user changes the machine setting (e.g. on Windows: setting daylight saving in the control panel) the default TimeZone object will immediately reflect this change, as visible for example by calling the useDaylightTime() method. Instead, the raw offset of the time zone will not be affected by such a change, since it describes the difference with respect of the UTC time. In other words, the raw offset for the Italian time zone is always 3600000, and will never change.
Notice that usually a calendar relies on the local default time zone instead of using the custom time zone depicting where the calendar was created (fortunately).


Field Summary
protected static java.lang.String leadingName
          Beginning of each logging message produced by this class.
protected static java.text.SimpleDateFormat sdf_date
          The data pattern used as output for the date, in this case: yyyy-MM-dd HH
protected static java.text.SimpleDateFormat sdf_ita
          The data pattern used by Log4j for the timestamp, in this case: yyyy-MM-dd HH:mm:ss,SSS
protected static java.text.SimpleDateFormat sdf_log
          The data pattern used by Log4j for the timestamp, in this case: yyyy-MM-dd HH:mm:ss,SSS
protected static java.text.SimpleDateFormat sdf_oracle
          The data pattern used by Oracle to describe dates
static java.text.SimpleDateFormat sdf_oracle_fs
          Java utility object using the pattern "yyyy-MM-dd"
protected static java.text.SimpleDateFormat sdf_summer
          SimpleDateFormat static reference for conversion from the format yyyy-MM-dd'T'HH:mm:ss'+02:00', used in Italy DURING the saving light season.
protected static java.text.SimpleDateFormat sdf_time
          The data pattern used as output for the time, in this case: HH:mm:ss,SSS
protected static java.text.SimpleDateFormat sdf_utc
          SimpleDateFormat static reference for conversion from the format yyyy-MM-dd'T'HH:mm:ss'+00:00', referred to the standard UTC time.
protected static java.text.SimpleDateFormat sdf_winter
          SimpleDateFormat static reference for conversion from the format yyyy-MM-dd'T'HH:mm:ss'+01:00', used in Italy when NOT in the saving light season.
 
Constructor Summary
Utilities()
           
 
Method Summary
static java.util.Calendar dateToCalendar(java.sql.Date date)
          Convert the input java.sql.date into a Calendar instance.
static java.lang.String formatDate(java.util.Date date, java.lang.String pattern)
          Convert the input java.util.Date to the string format, using the format dd-MMM-yy.
static java.lang.String formatDate(long timestamp, java.lang.String pattern)
          Convert the input timestamp to the string format, using the input pattern to define the conversion format.
static java.util.Calendar getCalendar(java.lang.String value)
          Due the Axis2 design the Calendar obtained from a SOAP REQUEST does not consider the time zone, but it's created using the local time zone, which for Italy is GMT+01:00 (Central Europe Time) in winter and GMT+02:00 (Central Europe Summer Time) in summer.
static java.lang.String getShortDate(java.util.Calendar calendar)
          Convert the input Calendar to the string format, using the format dd-MMM-yy.
static java.lang.String getShortDate(java.util.Date date)
          Convert the input java.util.Date to the string format, using the format dd-MMM-yy.
static java.lang.String getShortDate(long timestamp)
          Convert the input timestamp to the string format, using the format dd-MMM-yy.
static java.lang.String introspectElement(java.lang.Object object)
          Utility for printing introspection information about the ADBBeans elements.
static java.util.Date parseDate(java.lang.String date, java.lang.String pattern)
          Parse the string value of the input String date into a java.util.date value, using the input pattern.
static java.sql.Date shortValueOfSQLDate(java.lang.String string)
          Parse the string value of the input String into a java.sql.date value, using a pattern like 'yyyy-MM-dd'.
static java.sql.Date shortValueOfSQLDate(java.lang.StringBuffer buffer)
          Parse the string value of the input StringBuffer into a java.sql.date value, using a pattern like 'yyyy-MM-dd'.
static java.util.Date valueOfDate(java.lang.String string)
          Parse the string value of the input String into a java.util.date value, using a pattern like 'yyyy-MM-dd HH:mm:ss'.
static java.util.Date valueOfDate(java.lang.StringBuffer buffer)
          Parse the string value of the input StringBuffer into a java.util.date value using a pattern like 'yyyy-MM-dd HH:mm:ss'.
static java.sql.Date valueOfSQLDate(java.lang.String string)
          Parse the string value of the input String into a java.sql.date value, using a pattern like 'yyyy-MM-dd HH:mm:ss'.
static java.sql.Date valueOfSQLDate(java.lang.StringBuffer buffer)
          Parse the string value of the input StringBuffer into a java.sql.date value, using a pattern like 'yyyy-MM-dd HH:mm:ss'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sdf_log

protected static java.text.SimpleDateFormat sdf_log
The data pattern used by Log4j for the timestamp, in this case: yyyy-MM-dd HH:mm:ss,SSS


sdf_ita

protected static java.text.SimpleDateFormat sdf_ita
The data pattern used by Log4j for the timestamp, in this case: yyyy-MM-dd HH:mm:ss,SSS


sdf_time

protected static java.text.SimpleDateFormat sdf_time
The data pattern used as output for the time, in this case: HH:mm:ss,SSS


sdf_date

protected static java.text.SimpleDateFormat sdf_date
The data pattern used as output for the date, in this case: yyyy-MM-dd HH


sdf_oracle

protected static java.text.SimpleDateFormat sdf_oracle
The data pattern used by Oracle to describe dates


sdf_oracle_fs

public static final java.text.SimpleDateFormat sdf_oracle_fs
Java utility object using the pattern "yyyy-MM-dd"


sdf_utc

protected static java.text.SimpleDateFormat sdf_utc
SimpleDateFormat static reference for conversion from the format yyyy-MM-dd'T'HH:mm:ss'+00:00', referred to the standard UTC time.


sdf_winter

protected static java.text.SimpleDateFormat sdf_winter
SimpleDateFormat static reference for conversion from the format yyyy-MM-dd'T'HH:mm:ss'+01:00', used in Italy when NOT in the saving light season.


sdf_summer

protected static java.text.SimpleDateFormat sdf_summer
SimpleDateFormat static reference for conversion from the format yyyy-MM-dd'T'HH:mm:ss'+02:00', used in Italy DURING the saving light season.


leadingName

protected static java.lang.String leadingName
Beginning of each logging message produced by this class.

Constructor Detail

Utilities

public Utilities()
Method Detail

getCalendar

public static java.util.Calendar getCalendar(java.lang.String value)
                                      throws java.text.ParseException
Due the Axis2 design the Calendar obtained from a SOAP REQUEST does not consider the time zone, but it's created using the local time zone, which for Italy is GMT+01:00 (Central Europe Time) in winter and GMT+02:00 (Central Europe Summer Time) in summer. For this reason, the time zone of the input datetime parameter will be specified in the Calendar.ZONE_OFFSET field.
Example: if the SOAP input date is like "2010-02-26T15:40:00+02:00", then the calendar object will have an offset of 7200000 ms.

This method allows to emulate the Axis2 behavior when taking datetime values from another source, like an hard-coded string array or a properties file.

Parameters:
value - a string object describing a Date
Returns:
the same date converted into an equivalent Calendar object
Throws:
java.text.ParseException

getShortDate

public static java.lang.String getShortDate(java.util.Calendar calendar)
Convert the input Calendar to the string format, using the format dd-MMM-yy.

Parameters:
calendar - the Calendar to be converted
Returns:
the formatted version of the input calendar
See Also:
sdf_date

getShortDate

public static java.lang.String getShortDate(java.util.Date date)
Convert the input java.util.Date to the string format, using the format dd-MMM-yy.

Parameters:
date - the java.util.Date to be converted
Returns:
the formatted version of the input calendar
See Also:
sdf_date

getShortDate

public static java.lang.String getShortDate(long timestamp)
Convert the input timestamp to the string format, using the format dd-MMM-yy.

Parameters:
timestamp - the timestamp to be converted
Returns:
the formatted version of the input timestamp
See Also:
sdf_date

valueOfDate

public static java.util.Date valueOfDate(java.lang.StringBuffer buffer)
Parse the string value of the input StringBuffer into a java.util.date value using a pattern like 'yyyy-MM-dd HH:mm:ss'.

Parameters:
buffer - the input StringBuffer object
Returns:
the java.util.date value of the input string
See Also:
sdf_oracle

valueOfSQLDate

public static java.sql.Date valueOfSQLDate(java.lang.StringBuffer buffer)
Parse the string value of the input StringBuffer into a java.sql.date value, using a pattern like 'yyyy-MM-dd HH:mm:ss'.

Parameters:
buffer - the input StringBuffer object
Returns:
the java.util.date value of the input string
See Also:
sdf_oracle

valueOfSQLDate

public static java.sql.Date valueOfSQLDate(java.lang.String string)
Parse the string value of the input String into a java.sql.date value, using a pattern like 'yyyy-MM-dd HH:mm:ss'.

Parameters:
string - the input string object
Returns:
the java.sql.date value of the input string
See Also:
sdf_oracle

valueOfDate

public static java.util.Date valueOfDate(java.lang.String string)
Parse the string value of the input String into a java.util.date value, using a pattern like 'yyyy-MM-dd HH:mm:ss'.

Parameters:
string - the input string object
Returns:
the java.util.Date value of the input string
See Also:
sdf_oracle

shortValueOfSQLDate

public static java.sql.Date shortValueOfSQLDate(java.lang.String string)
Parse the string value of the input String into a java.sql.date value, using a pattern like 'yyyy-MM-dd'.

Parameters:
string - the input string object
Returns:
the java.sql.date value of the input string
See Also:
sdf_oracle_fs

shortValueOfSQLDate

public static java.sql.Date shortValueOfSQLDate(java.lang.StringBuffer buffer)
Parse the string value of the input StringBuffer into a java.sql.date value, using a pattern like 'yyyy-MM-dd'.

Parameters:
buffer - the input string object
Returns:
the java.sql.date value of the input string
See Also:
sdf_oracle_fs

dateToCalendar

public static java.util.Calendar dateToCalendar(java.sql.Date date)
Convert the input java.sql.date into a Calendar instance.

Parameters:
date - the input java.sql.date object
Returns:
the Calendar value of the input date

parseDate

public static java.util.Date parseDate(java.lang.String date,
                                       java.lang.String pattern)
Parse the string value of the input String date into a java.util.date value, using the input pattern.

Parameters:
date - the input date in string format
pattern - the string pattern to be used in the conversion (e.g. "dd-MMM-yy")
Returns:
the java.util.Date value of the input string
See Also:
sdf_oracle

formatDate

public static java.lang.String formatDate(java.util.Date date,
                                          java.lang.String pattern)
Convert the input java.util.Date to the string format, using the format dd-MMM-yy.

Parameters:
date - the java.util.Date to be converted
pattern - the string pattern to be used in the conversion (e.g. "dd-MMM-yy")
Returns:
the formatted version of the input date
See Also:
sdf_date

formatDate

public static java.lang.String formatDate(long timestamp,
                                          java.lang.String pattern)
Convert the input timestamp to the string format, using the input pattern to define the conversion format.

Parameters:
timestamp - the timestamp to be converted
pattern - the string pattern to be used in the conversion (e.g. "dd-MMM-yy")
Returns:
the formatted version of the input timestamp

introspectElement

public static java.lang.String introspectElement(java.lang.Object object)
Utility for printing introspection information about the ADBBeans elements. For the time being this method support introspection only for datetime objects, in order to investigate behavior of an Axis2 strange behavior:

Axis2 issue

Parameters:
object - the XML node value retrieved from a ADBBean object
Returns:
a formatted string ready to be printed on the output stream

Build 19/03/2014

Morpheus Technologies - making the Zion software
Copyright © 2009-2014 Morpheus Technologies. All Rights Reserved