From ac59128e4316805f9da0a1b5dd8102f4fb015758 Mon Sep 17 00:00:00 2001 From: Brian Rosenberger Date: Thu, 26 May 2011 15:02:05 +0000 Subject: [PATCH] Add more javadoc git-svn-id: https://brutex.net/svn/xservices/trunk@69 e7e49efb-446e-492e-b9ec-fcafc1997a86 --- .../brutex/xservices/ws/ArchiveService.java | 36 ++-- .../net/brutex/xservices/ws/DateService.java | 79 ++++++-- .../brutex/xservices/ws/ExecuteService.java | 4 +- test/DateService-soapui-project.xml | 180 ++++++++++++++++-- 4 files changed, 247 insertions(+), 52 deletions(-) diff --git a/src/java/net/brutex/xservices/ws/ArchiveService.java b/src/java/net/brutex/xservices/ws/ArchiveService.java index 619b263..100fa97 100644 --- a/src/java/net/brutex/xservices/ws/ArchiveService.java +++ b/src/java/net/brutex/xservices/ws/ArchiveService.java @@ -28,28 +28,30 @@ import net.brutex.xservices.util.BrutexNamespaces; /** - * + * Archiving related web service. + * * @author Brian Rosenberger, bru@brutex.de + * @since 0.4.0 */ @WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES) public interface ArchiveService { - public static final String WS_OPERATION_BZIP2 = "bzip2"; - public static final String WS_OPERATION_BZIP2_ARCHIVE = "bzip2FromArchive"; - public static final String WS_OPERATION_GZIP = "gzip"; - public static final String WS_OPERATION_GZIP_ARCHIVE = "gzipFromArchive"; - public static final String WS_OPERATION_UNZIP = "unzip"; - public static final String WS_OPERATION_GUNZIP = "gunzip"; - public static final String WS_OPERATION_BUNZIP2 = "bunzip2"; - public static final String WS_PARAM_SOURCEFILE = "source"; - public static final String WS_PARAM_SOURCEFILE_STRING = "srcfile"; - public static final String WS_PARAM_SOURCEURL = "srcurl"; - public static final String WS_PARAM_SOURCEARCHIVE = "archivesource"; - public static final String WS_PARAM_DESTFILE = "destfile"; - public static final String WS_PARAM_DESTDIR = "destdir"; - public static final String WS_PARAM_ENCODING = "encoding"; - public static final String WS_PARAM_OVERWRITE = "overwrite"; - public static final String WS_PARAM_COMPRESS = "compresslevel"; + final String WS_OPERATION_BZIP2 = "bzip2"; + final String WS_OPERATION_BZIP2_ARCHIVE = "bzip2FromArchive"; + final String WS_OPERATION_GZIP = "gzip"; + final String WS_OPERATION_GZIP_ARCHIVE = "gzipFromArchive"; + final String WS_OPERATION_UNZIP = "unzip"; + final String WS_OPERATION_GUNZIP = "gunzip"; + final String WS_OPERATION_BUNZIP2 = "bunzip2"; + final String WS_PARAM_SOURCEFILE = "source"; + final String WS_PARAM_SOURCEFILE_STRING = "srcfile"; + final String WS_PARAM_SOURCEURL = "srcurl"; + final String WS_PARAM_SOURCEARCHIVE = "archivesource"; + final String WS_PARAM_DESTFILE = "destfile"; + final String WS_PARAM_DESTDIR = "destdir"; + final String WS_PARAM_ENCODING = "encoding"; + final String WS_PARAM_OVERWRITE = "overwrite"; + final String WS_PARAM_COMPRESS = "compresslevel"; /** * @param src diff --git a/src/java/net/brutex/xservices/ws/DateService.java b/src/java/net/brutex/xservices/ws/DateService.java index b7f355e..0263d3a 100644 --- a/src/java/net/brutex/xservices/ws/DateService.java +++ b/src/java/net/brutex/xservices/ws/DateService.java @@ -45,21 +45,21 @@ import org.apache.cxf.annotations.WSDLDocumentationCollection; public interface DateService { public static final String SERVICE_NAME = "DateService"; - public static final String OPERATION_GETDATE = "getDate"; - public static final String OPERATION_GETTIMESTAMP = "getTimestamp"; - public static final String OPERATION_GETINTIMEZONE = "getInTimezone"; - public static final String OPERATION_FORMATDATE = "formatDate"; - public static final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced"; - public static final String OPERATION_PARSEDATE = "parseDate"; - public static final String OPERATION_PARSEDATEADVANCED = "parseDateAdvanced"; - public static final String OPERATION_DATETIMEDIFF = "dateTimeDiff"; - public static final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2"; - public static final String OPERATION_DATEADD = "dateAdd"; + final String OPERATION_GETDATE = "getDate"; + final String OPERATION_GETTIMESTAMP = "getTimestamp"; + final String OPERATION_GETINTIMEZONE = "getInTimezone"; + final String OPERATION_FORMATDATE = "formatDate"; + final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced"; + final String OPERATION_PARSEDATE = "parseDate"; + final String OPERATION_PARSEDATEADVANCED = "parseDateAdvanced"; + final String OPERATION_DATETIMEDIFF = "dateTimeDiff"; + final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2"; + final String OPERATION_DATEADD = "dateAdd"; - public static final String PARAM_TIMEZONE = "timezone"; - public static final String PARAM_DATETIME = "datetime"; - public static final String PARAM_FORMAT = "format"; - public static final String PARAM_UNIT = "unit"; + final String PARAM_TIMEZONE = "timezone"; + final String PARAM_DATETIME = "datetime"; + final String PARAM_FORMAT = "format"; + final String PARAM_UNIT = "unit"; /** * Get current date and time. @@ -97,8 +97,10 @@ public interface DateService { @WebParam(name=PARAM_TIMEZONE) @XmlElement(required=true) String timezone) throws XServicesFault; /** - * @param cal - * @param format + * Formats a date with pre-defined patterns. + * + * @param cal date time to be formatted + * @param format Pattern to be used for date formating * @return formatted date/time string * @throws XServicesFault */ @@ -107,6 +109,36 @@ public interface DateService { @WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal, @WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format) throws XServicesFault; + /** + * Formats a date with a free form pattern. + * Uses SimpleDateFormat patterns + * The following pattern letters are defined (all other characters from 'A' to 'Z' and from 'a' to 'z' are reserved): + + Letter Date or Time Component Presentation Examples + G Era designator Text AD + y Year Year 1996; 96 + M Month in year Month July; Jul; 07 + w Week in year Number 27 + W Week in month Number 2 + D Day in year Number 189 + d Day in month Number 10 + F Day of week in month Number 2 + E Day in week Text Tuesday; Tue + a Am/pm marker Text PM + H Hour in day (0-23) Number 0 + k Hour in day (1-24) Number 24 + K Hour in am/pm (0-11) Number 0 + h Hour in am/pm (1-12) Number 12 + m Minute in hour Number 30 + s Second in minute Number 55 + S Millisecond Number 978 + z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 + Z Time zone RFC 822 time zone -0800 + * @param cal Date time to be formatted + * @param format Format string + * @return Date time formatted according to format string + * @throws XServicesFault + */ @WebMethod(operationName=OPERATION_FORMATDATEADVANCED) public abstract String formatDateAdvanced( @WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal, @@ -124,6 +156,13 @@ public interface DateService { @WebParam(name=PARAM_FORMAT) @XmlElement(required=true) String format, @WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault; + /** + * Calculate elapsed time between two dates. + * @param fromCal First date. + * @param toCal Second date. + * @return Elapsed time in milliseconds + * @throws XServicesFault + */ @WebMethod(operationName=OPERATION_DATETIMEDIFF) public abstract BigInteger dateTimeDiff( @WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal, @@ -147,12 +186,14 @@ public interface DateService { @WebParam(name="PARAM_UNIT") DateTimeUnits unit) throws XServicesFault; /** - * Add or substract a time span from a date. + * Add or subtract a time span from a date. * - * @param cal - * @param unit + * @param cal The initial date. + * @param value The amount to add. + * @param unit The unit the amount is defined in. * @return New date and time. * @throws XServicesFault + * */ @WebMethod(operationName=OPERATION_DATEADD) @WSDLDocumentation(value="Add or substract a time span from a date.") diff --git a/src/java/net/brutex/xservices/ws/ExecuteService.java b/src/java/net/brutex/xservices/ws/ExecuteService.java index 121b2f1..67b9e85 100644 --- a/src/java/net/brutex/xservices/ws/ExecuteService.java +++ b/src/java/net/brutex/xservices/ws/ExecuteService.java @@ -25,7 +25,9 @@ import net.brutex.xservices.types.ReturnCode; import net.brutex.xservices.util.BrutexNamespaces; /** - * @author brosenberger + * Task execution web service + * @author Brian Rosenberger + * @since 0.1.0 * */ @WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES) diff --git a/test/DateService-soapui-project.xml b/test/DateService-soapui-project.xml index 2b31dc5..2c4964c 100644 --- a/test/DateService-soapui-project.xml +++ b/test/DateService-soapui-project.xml @@ -17,6 +17,12 @@ */ + + + + + + @@ -31,6 +37,18 @@ + + + + + + + + + + + + @@ -63,6 +81,18 @@ + + + + + + + + + + + + @@ -78,6 +108,7 @@ + @@ -89,6 +120,7 @@ + @@ -104,6 +136,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -123,17 +175,23 @@ + + + + + + - - + + @@ -141,15 +199,15 @@ - - - + + + @@ -162,14 +220,33 @@ + + + + + + + + + + + + + + Add or substract a time span from a date. + + + + + Get current date and time. @@ -184,6 +261,12 @@ + + Get elapsed time between to dates. + + + + @@ -200,12 +283,30 @@ + Get milliseconds since 01.01.1970 (Unix timestap). + + + + + + + + + + + + + + + + + @@ -242,6 +343,18 @@ + + + + + + + + + + + + @@ -278,6 +391,18 @@ + + + + + + + + + + + + @@ -328,15 +453,15 @@ mmddyyyy-WW -]]>UTF-8http://localhost:8080/XServices/DateService - - - - ? - ? - - -]]>UTF-8http://localhost:8080/XServices/DateService +]]><xml-fragment/>UTF-8http://localhost:8080/XServices/DateService + + + + 30.05..2011 + dd.mm.yyyy + + +]]>UTF-8http://localhost:8080/XServices/DateService @@ -344,4 +469,29 @@ ? -]]> \ No newline at end of file +]]><xml-fragment/>UTF-8http://localhost:8080/XServices/DateService + + + + 2011-05-24T19:59:29.233+02:00 + 2011-05-24T19:59:34.233+03:00 + + +]]><xml-fragment/>UTF-8http://localhost:8080/XServices/DateService + + + + 2012-05-24T19:59:29.233+02:00 + 2011-06-24T21:01:59.234+02:00 + + +]]><xml-fragment/>UTF-8http://localhost:8080/XServices/DateService + + + + 2012-05-24T19:59:29.233+02:00 + 365 + hours + + +]]> \ No newline at end of file