/xservices/trunk/src/java/net/brutex/xservices/types/DateTimeUnits.java |
---|
53,8 → 53,11 |
* days |
*/ |
@XmlEnumValue("days") |
DAYS("days"); |
DAYS("days"), |
@XmlEnumValue("years") |
YEARS("years"); |
private String value; |
DateTimeUnits(String value) { |
/xservices/trunk/src/java/net/brutex/xservices/types/DateFormatType.java |
---|
15,34 → 15,54 |
*/ |
package net.brutex.xservices.types; |
import java.text.ParseException; |
import java.text.SimpleDateFormat; |
import java.util.Date; |
import java.util.Locale; |
import java.util.TimeZone; |
import javax.xml.bind.annotation.XmlEnum; |
import javax.xml.bind.annotation.XmlEnumValue; |
import javax.xml.bind.annotation.XmlType; |
import net.brutex.xservices.util.BrutexNamespaces; |
/** |
* Different pre-defined date formats. |
* |
* @author Brian Rosenberger, bru@brutex.de |
*/ |
@XmlEnum(value = String.class) |
@XmlEnum() |
public enum DateFormatType { |
/** |
* ISO 8601 format (2011-05-24T14:39Z) |
* ISO 8601 format (2011-05-24T14:39+01:00) |
*/ |
@XmlEnumValue("ISO 8601") |
ISO8601("ISO 8601", "yyyy-MM-dd'T'HH:mm:ssZ"), |
@XmlEnumValue("ISO 8601") |
ISO8601("ISO 8601", "yyyy-MM-dd'T'HH:mm:ss.SSSZ"), |
/** |
* RFC822 format (2011-05-24T14:39+0100) |
*/ |
@XmlEnumValue("RFC 822") |
RFC822("RFC 822", "yyyy-MM-dd'T'HH:mm:ss.SSSZ"), |
/** |
* yyyy/mm/dd |
*/ |
@XmlEnumValue("yyyy/mm/dd") |
YYYYMMDD("yyyy/mm/dd", "yyyy/MM/dd"), |
@XmlEnumValue("DateOnly-slashed") |
YYYYMMDD("DateOnly-slashed", "yyyy/MM/dd"), |
/** |
* dd.mm.yyyy |
*/ |
@XmlEnumValue("dd.mm.yyyy") |
DDMMYY("dd.mm.yyyy", "dd.MM.yyyy"); |
@XmlEnumValue("DateOnly-dotted") |
DDMMYYYY("DateOnly-dotted", "dd.MM.yyyy"), |
/** |
* dd.mm.yyyy |
*/ |
@XmlEnumValue("DateOnly-dashed") |
DDMMYYYYdashed("DateOnly-dashed", "dd-MM-yyyy"); |
private String value; |
private String format; |
59,7 → 79,33 |
return value; |
} |
public String format() { |
return format; |
public String format(Date date, Locale locale, TimeZone timezone) { |
if(date==null) return ""; |
if(locale==null) locale = Locale.getDefault(); |
if(timezone==null) timezone = TimeZone.getDefault(); |
String result = ""; |
SimpleDateFormat f; |
if(this.equals(ISO8601)) { |
//apply ISO8061 hack |
f = new SimpleDateFormat(RFC822.format, locale); |
f.setTimeZone(timezone); |
result = f.format(date); |
result = result.substring(0, 26) + ":" + result.substring(26); |
} else { |
f = new SimpleDateFormat(this.format, locale); |
f.setTimeZone(timezone); |
result = f.format(date); |
} |
return result; |
} |
public Date parse(String s, Locale locale, TimeZone timezone) |
throws ParseException { |
if(locale==null) locale = Locale.getDefault(); |
if(timezone==null) timezone = TimeZone.getDefault(); |
SimpleDateFormat fin = new SimpleDateFormat(this.format, locale); |
fin.setTimeZone(timezone); |
Date date = fin.parse(s); |
return date; |
} |
} |
/xservices/trunk/src/java/net/brutex/xservices/types/DateInfoType.java |
---|
0,0 → 1,96 |
/* |
* Copyright 2012 Brian Rosenberger (Brutex Network) |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
package net.brutex.xservices.types; |
import java.text.SimpleDateFormat; |
import java.util.Date; |
import java.util.GregorianCalendar; |
import java.util.TimeZone; |
import javax.xml.bind.annotation.XmlElement; |
import javax.xml.bind.annotation.XmlType; |
import net.brutex.xservices.util.BrutexNamespaces; |
/** |
* Date object representation with different formats |
* |
* @author Brian Rosenberger, bru@brutex.de |
*/ |
@XmlType(name=DateInfoType.XML_NAME, namespace=BrutexNamespaces.WS_XSERVICES, |
propOrder={"isoDate","rfcDate", "millis"}) |
public class DateInfoType { |
public static final String XML_NAME="DateInfoType"; |
private final GregorianCalendar date; |
private final TimeZone zone; |
/** |
* Create a new DateInfoType |
* @param date date/time |
*/ |
public DateInfoType(GregorianCalendar date, TimeZone zone) { |
this.date = date; |
this.zone = zone; |
} |
/** |
* Create a new DateInfoType with current date/time |
*/ |
public DateInfoType() { |
this.zone = TimeZone.getDefault(); |
this.date = new GregorianCalendar(zone); |
} |
/** |
* @return milliseconds since 01.01.1970 |
*/ |
@XmlElement(name="timestamp") |
public long getMillis() { |
return date.getTimeInMillis(); |
} |
/** |
* Get date formated according to ISO8601 (done by jaxb->xsd:datetime conversion) |
* @return date |
*/ |
@XmlElement(name="iso8601date") |
public Date getIsoDate() { |
//String format = DateFormatType.ISO8601.format(); |
//SimpleDateFormat f = new SimpleDateFormat(format); |
//String text = f.format(date.getTime()); |
//Fix missing colon in java timezone |
//return text.substring(0, 22) + ":" + text.substring(22); |
return date.getTime(); |
} |
/** |
* Get date formated according to RFC822 (also java standard) |
* @return date string |
*/ |
@XmlElement(name="rfc822date") |
public String getRfcDate() { |
return DateFormatType.RFC822.format(date.getTime(), null, null); |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/xservices/trunk/src/java/net/brutex/xservices/types/DateInfoExtendedType.java |
---|
0,0 → 1,69 |
/* |
* Copyright 2011 Brian Rosenberger (Brutex Network) |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
package net.brutex.xservices.types; |
import java.text.SimpleDateFormat; |
import java.util.GregorianCalendar; |
import java.util.TimeZone; |
import javax.xml.bind.annotation.XmlElement; |
import javax.xml.bind.annotation.XmlType; |
import net.brutex.xservices.util.BrutexNamespaces; |
/** |
* @author Brian Rosenberger |
* |
*/ |
@XmlType(namespace=BrutexNamespaces.WS_XSERVICES) |
public class DateInfoExtendedType extends DateInfoType { |
private GregorianCalendar date = null; |
private TimeZone zone = null; |
@SuppressWarnings("unused") |
public DateInfoExtendedType() { |
super(); |
} |
public DateInfoExtendedType(GregorianCalendar date, TimeZone zone) { |
this.date = date; |
this.zone = zone; |
} |
@XmlElement(name = "format1") |
public String getFormat1() { |
return DateFormatType.DDMMYYYY.format(date.getTime(), null, null); |
} |
/** |
* @return |
*/ |
@XmlElement(name = "format2") |
public String getFormat2() { |
return DateFormatType.YYYYMMDD.format(date.getTime(), null, null); |
} |
@XmlElement(name = "format3") |
public String getFormat3() { |
String format = "HH:mm:ss"; |
SimpleDateFormat f = new SimpleDateFormat(format); |
return f.format(date.getTime()); |
} |
// yyyy-MM-dd'T'HH:mm:ssZ |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/xservices/trunk/src/java/net/brutex/xservices/types/TimeZoneType.java |
---|
0,0 → 1,81 |
/* |
* Copyright 2012 Brian Rosenberger (Brutex Network) |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
package net.brutex.xservices.types; |
import java.util.TimeZone; |
import javax.xml.bind.annotation.XmlElement; |
import javax.xml.bind.annotation.XmlType; |
import net.brutex.xservices.util.BrutexNamespaces; |
/** |
* Different pre-defined date formats. |
* |
* @author Brian Rosenberger, bru@brutex.de |
*/ |
@XmlType(name=TimeZoneType.XML_NAME, namespace=BrutexNamespaces.WS_XSERVICES) |
public class TimeZoneType { |
public static final String XML_NAME = "timezone"; |
private String id; |
private String displayname; |
private TimeZone timezone; |
private long offset; |
public TimeZoneType(TimeZone timezone) { |
this.timezone = timezone; |
this.id = timezone.getID(); |
this.displayname = timezone.getDisplayName(); |
this.offset = timezone.getRawOffset()/1000; |
} |
public TimeZoneType() { |
this(TimeZone.getDefault()); |
} |
/** |
* @return the id |
*/ |
@XmlElement |
public String getId() { |
return id; |
} |
/** |
* @return the displayname |
*/ |
@XmlElement |
public String getDisplayname() { |
return displayname; |
} |
/** |
* @return the timezone |
*/ |
public TimeZone getTimezone() { |
return timezone; |
} |
/** |
* @return the offset |
*/ |
@XmlElement |
public long getOffset() { |
return offset; |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/xservices/trunk/src/java/net/brutex/xservices/ws/FileService.java |
---|
26,12 → 26,12 |
import org.apache.cxf.annotations.WSDLDocumentation; |
import org.apache.cxf.annotations.WSDLDocumentationCollection; |
import net.brutex.xservices.types.ArchiveResource; |
import net.brutex.xservices.types.AttachmentType; |
import net.brutex.xservices.types.FileResource; |
import net.brutex.xservices.types.FileSetResource; |
import net.brutex.xservices.types.ReplacePattern; |
import net.brutex.xservices.types.ReturnCode; |
import net.brutex.xservices.types.ant.ArchiveResource; |
import net.brutex.xservices.types.ant.AttachmentType; |
import net.brutex.xservices.types.ant.FileResource; |
import net.brutex.xservices.types.ant.FileSetResource; |
import net.brutex.xservices.util.BrutexNamespaces; |
import net.brutex.xservices.util.XServicesDocumentation; |
/** |
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/DateServiceImpl.java |
---|
18,107 → 18,108 |
import java.math.BigInteger; |
import java.text.ParseException; |
import java.text.SimpleDateFormat; |
import java.util.ArrayList; |
import java.util.Date; |
import java.util.GregorianCalendar; |
import java.util.List; |
import java.util.TimeZone; |
import javax.jws.WebService; |
import net.brutex.xservices.types.DateFormatType; |
import net.brutex.xservices.types.DateInfoExtendedType; |
import net.brutex.xservices.types.DateInfoType; |
import net.brutex.xservices.types.DateTimeUnits; |
import net.brutex.xservices.types.TimeZoneType; |
import net.brutex.xservices.util.BrutexNamespaces; |
import net.brutex.xservices.ws.DateService; |
import net.brutex.xservices.ws.XServicesFault; |
/** |
* @author Brian Rosenberger |
* |
* |
*/ |
@WebService( |
targetNamespace = BrutexNamespaces.WS_XSERVICES, |
endpointInterface = "net.brutex.xservices.ws.DateService", |
serviceName = DateService.SERVICE_NAME |
) |
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.DateService", serviceName = DateService.SERVICE_NAME) |
public class DateServiceImpl implements DateService { |
private static String ERR_INVALIDFORMAT = "Invalid format pattern."; |
private static String ERR_INVALIDTIMEZONE = "Invalid timezone."; |
public GregorianCalendar getDate(String timezone) throws XServicesFault { |
if (! isValidTimezone(timezone) ) { |
String valid_ids = ""; |
String[] tid = TimeZone.getAvailableIDs(); |
for (String s : tid) { |
valid_ids += s + "\n"; |
} |
throw new XServicesFault("Please supply a valid timezone id or none. Valid timezones are:\n" + valid_ids, |
new Exception( )); |
} |
if (timezone == null || timezone.length()<1 ) timezone = "GMT0"; |
GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone(timezone)); |
return c; |
public DateInfoType getDate() throws XServicesFault { |
GregorianCalendar c = new GregorianCalendar(); |
DateInfoType dateinfo = new DateInfoType(c, TimeZone.getDefault()); |
return dateinfo; |
} |
public DateInfoExtendedType getDateExtended() throws XServicesFault { |
GregorianCalendar c = new GregorianCalendar(); |
DateInfoExtendedType dateinfo = new DateInfoExtendedType(c, |
TimeZone.getDefault()); |
return dateinfo; |
} |
public BigInteger getTimestamp() { |
Date d = new Date(); |
long l = d.getTime(); |
return new BigInteger(Long.toString(l)); |
} |
public BigInteger getTimestamp2() { |
Date d = new Date(); |
long l = d.getTime()/1000; |
long l = d.getTime() / 1000; |
return new BigInteger(Long.toString(l)); |
} |
public GregorianCalendar getInTimezone(GregorianCalendar cal, |
String timezone) throws XServicesFault { |
if(! isValidTimezone(timezone)) throw new XServicesFault(ERR_INVALIDTIMEZONE); |
GregorianCalendar c = new GregorianCalendar(TimeZone.getTimeZone(timezone)); |
c.setTimeInMillis(cal.getTimeInMillis()); |
return c; |
public String getInTimezone(Date date, String timezone) |
throws XServicesFault { |
if (!isValidTimezone(timezone)) |
throw new XServicesFault(ERR_INVALIDTIMEZONE); |
TimeZone targetzone = TimeZone.getTimeZone(timezone); |
String targetstring = DateFormatType.ISO8601.format(date, null, targetzone); |
return targetstring; |
} |
public String formatDate(GregorianCalendar cal, DateFormatType format) throws XServicesFault { |
return formatDateAdvanced(cal, format.format()); |
public String formatDate(Date cal, DateFormatType format) |
throws XServicesFault { |
return format.format(cal, null, null); |
} |
public String formatDateAdvanced(GregorianCalendar cal, String format) |
public String formatDateAdvanced(Date cal, String format) |
throws XServicesFault { |
String result= null; |
String result = null; |
SimpleDateFormat f = new SimpleDateFormat(format); |
result = f.format(cal); |
return result; |
} |
public Date parseDate(String s, DateFormatType format, String timezone) |
throws XServicesFault { |
if (timezone == null | timezone.equals("")) |
timezone = TimeZone.getDefault().getID(); |
if (!isValidTimezone(timezone)) |
throw new XServicesFault(ERR_INVALIDTIMEZONE); |
try { |
SimpleDateFormat f = new SimpleDateFormat(format); |
result = f.format(cal.getTime()); |
} catch (IllegalArgumentException e) { |
throw new XServicesFault(ERR_INVALIDFORMAT + e.getMessage()); |
return format.parse(s, null, TimeZone.getTimeZone(timezone)); |
} catch (ParseException e) { |
throw new XServicesFault(e); |
} |
return result; |
} |
public GregorianCalendar parseDate(String s, DateFormatType format, String timezone) throws XServicesFault { |
return parseDateAdvanced(s, format.format(), timezone); |
} |
public GregorianCalendar parseDateAdvanced(String s, String format, String timezone) throws XServicesFault { |
public GregorianCalendar parseDateAdvanced(String s, String format, |
String timezone) throws XServicesFault { |
SimpleDateFormat f = null; |
Date date = null; |
if(timezone==null | timezone.equals("")) timezone = TimeZone.getDefault().getID(); |
if(! isValidTimezone(timezone)) throw new XServicesFault(ERR_INVALIDTIMEZONE); |
if (timezone == null | timezone.equals("")) |
timezone = TimeZone.getDefault().getID(); |
if (!isValidTimezone(timezone)) |
throw new XServicesFault(ERR_INVALIDTIMEZONE); |
try { |
f = new SimpleDateFormat(format); |
date = f.parse(s); |
} catch(IllegalArgumentException e) { |
} catch (IllegalArgumentException e) { |
throw new XServicesFault(ERR_INVALIDFORMAT + e.getMessage()); |
} catch (ParseException e) { |
throw new XServicesFault("Cannot parse date: "+ e.getMessage()); |
throw new XServicesFault("Cannot parse date: " + e.getMessage()); |
} |
GregorianCalendar cal = new GregorianCalendar(); |
cal.setTimeZone(TimeZone.getTimeZone(timezone)); |
125,18 → 126,16 |
cal.setTime(date); |
return cal; |
} |
public BigInteger dateTimeDiff(GregorianCalendar fromCal, |
GregorianCalendar toCal) throws XServicesFault { |
long diff = toCal.getTimeInMillis() - fromCal.getTimeInMillis(); |
public BigInteger dateTimeDiff(Date fromCal, Date toCal) |
throws XServicesFault { |
long diff = toCal.getTime() - fromCal.getTime(); |
BigInteger d = new BigInteger(String.valueOf(diff), 10); |
return d; |
} |
public BigInteger dateTimeDiff2(GregorianCalendar fromCal, |
GregorianCalendar toCal, DateTimeUnits unit) throws XServicesFault { |
public BigInteger dateTimeDiff2(Date fromCal, Date toCal, DateTimeUnits unit) |
throws XServicesFault { |
BigInteger d = dateTimeDiff(fromCal, toCal); |
switch (unit) { |
case SECONDS: |
150,13 → 149,16 |
break; |
case DAYS: |
d = d.divide(new BigInteger("86400000")); |
break; |
case YEARS: |
d = d.divide(new BigInteger("31536000000")); |
break; |
} |
return d; |
} |
public GregorianCalendar dateAdd(GregorianCalendar cal, BigInteger value, DateTimeUnits unit) |
throws XServicesFault { |
public GregorianCalendar dateAdd(GregorianCalendar cal, BigInteger value, |
DateTimeUnits unit) throws XServicesFault { |
switch (unit) { |
case SECONDS: |
cal.add(GregorianCalendar.SECOND, value.intValue()); |
170,16 → 172,19 |
case DAYS: |
cal.add(GregorianCalendar.DAY_OF_MONTH, value.intValue()); |
break; |
case YEARS: |
cal.add(GregorianCalendar.YEAR, value.intValue()); |
break; |
default: |
cal.add(GregorianCalendar.MILLISECOND, value.intValue()); |
} |
return cal; |
} |
private boolean isValidTimezone(String id) { |
boolean yes = false; |
for( String s: TimeZone.getAvailableIDs()) { |
if(s.equals(id)) { |
for (String s : TimeZone.getAvailableIDs()) { |
if (s.equals(id)) { |
yes = true; |
break; |
} |
187,4 → 192,11 |
return yes; |
} |
public List<TimeZoneType> getTimezones() { |
List<TimeZoneType> output = new ArrayList<TimeZoneType>(); |
for (String s : TimeZone.getAvailableIDs()) { |
output.add(new TimeZoneType(TimeZone.getTimeZone(s))); |
} |
return output; |
} |
} |
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/FileServiceImpl.java |
---|
27,12 → 27,12 |
import javax.jws.WebParam; |
import javax.jws.WebService; |
import net.brutex.xservices.types.ArchiveResource; |
import net.brutex.xservices.types.AttachmentType; |
import net.brutex.xservices.types.FileResource; |
import net.brutex.xservices.types.FileSetResource; |
import net.brutex.xservices.types.ReplacePattern; |
import net.brutex.xservices.types.ReturnCode; |
import net.brutex.xservices.types.ant.ArchiveResource; |
import net.brutex.xservices.types.ant.AttachmentType; |
import net.brutex.xservices.types.ant.FileResource; |
import net.brutex.xservices.types.ant.FileSetResource; |
import net.brutex.xservices.util.BrutexNamespaces; |
import net.brutex.xservices.util.RunTask; |
import net.brutex.xservices.ws.FileService; |
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/ArchiveServiceImpl.java |
---|
19,11 → 19,11 |
import javax.jws.WebMethod; |
import javax.jws.WebParam; |
import javax.jws.WebService; |
import net.brutex.xservices.types.ArchiveResource; |
import net.brutex.xservices.types.CompressionType; |
import net.brutex.xservices.types.FileResource; |
import net.brutex.xservices.types.ResourceInterface; |
import net.brutex.xservices.types.ReturnCode; |
import net.brutex.xservices.types.ant.ArchiveResource; |
import net.brutex.xservices.types.ant.FileResource; |
import net.brutex.xservices.types.ant.ResourceInterface; |
import net.brutex.xservices.util.BrutexNamespaces; |
import net.brutex.xservices.util.RunTask; |
import net.brutex.xservices.util.UnRarTask; |
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/StorageServiceImpl.java |
---|
0,0 → 1,56 |
/* |
* Copyright 2011 Brian Rosenberger (Brutex Network) |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
package net.brutex.xservices.ws.impl; |
import javax.jws.WebService; |
import net.brutex.xservices.types.TargetNodeType; |
import net.brutex.xservices.types.ant.AttachmentType; |
import net.brutex.xservices.types.ant.CollectionType; |
import net.brutex.xservices.util.BrutexNamespaces; |
import net.brutex.xservices.ws.StorageService; |
import net.brutex.xservices.ws.XServicesFault; |
/** |
* @author Brian Rosenberger |
* @since 0.5.0 |
* |
*/ |
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.StorageService", serviceName = StorageService.SERVICE_NAME) |
public class StorageServiceImpl implements StorageService { |
public String storeText(String text) throws XServicesFault { |
// TODO Auto-generated method stub |
return null; |
} |
public String storeBinary(AttachmentType binary) throws XServicesFault { |
// TODO Auto-generated method stub |
return null; |
} |
public String createCollection(CollectionType collection) |
throws XServicesFault { |
return collection.getUuid(); |
} |
public void deliverCollection(CollectionType collection, |
TargetNodeType targetnode, boolean isFiring) throws XServicesFault { |
// TODO Auto-generated method stub |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/xservices/trunk/src/java/net/brutex/xservices/ws/impl/MiscServiceImpl.java |
---|
21,11 → 21,11 |
import java.util.UUID; |
import javax.jws.WebService; |
import net.brutex.xservices.types.FileSetResource; |
import net.brutex.xservices.types.HostConnection; |
import net.brutex.xservices.types.HostinfoType; |
import net.brutex.xservices.types.MailMimeType; |
import net.brutex.xservices.types.ReturnCode; |
import net.brutex.xservices.types.ant.FileSetResource; |
import net.brutex.xservices.util.BrutexNamespaces; |
import net.brutex.xservices.util.RunTask; |
import net.brutex.xservices.ws.MiscService; |
/xservices/trunk/src/java/net/brutex/xservices/ws/ArchiveService.java |
---|
18,12 → 18,12 |
import javax.jws.WebMethod; |
import javax.jws.WebParam; |
import javax.jws.WebService; |
import net.brutex.xservices.types.ArchiveResource; |
import net.brutex.xservices.types.CompressionType; |
import net.brutex.xservices.types.FileResource; |
import net.brutex.xservices.types.FileSetResource; |
import net.brutex.xservices.types.ReturnCode; |
import net.brutex.xservices.types.ant.ArchiveResource; |
import net.brutex.xservices.types.ant.FileResource; |
import net.brutex.xservices.types.ant.FileSetResource; |
import net.brutex.xservices.util.BrutexNamespaces; |
/xservices/trunk/src/java/net/brutex/xservices/ws/StorageService.java |
---|
0,0 → 1,84 |
/* |
* Copyright 2011 Brian Rosenberger (Brutex Network) |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
* You may obtain a copy of the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
* See the License for the specific language governing permissions and |
* limitations under the License. |
*/ |
package net.brutex.xservices.ws; |
import javax.jws.WebMethod; |
import javax.jws.WebParam; |
import javax.jws.WebService; |
import net.brutex.xservices.types.TargetNodeType; |
import net.brutex.xservices.types.ant.AttachmentType; |
import net.brutex.xservices.types.ant.CollectionType; |
import net.brutex.xservices.util.BrutexNamespaces; |
import org.apache.cxf.annotations.WSDLDocumentation; |
/** |
* Storage management services. |
* @author Brian Rosenberger |
* @since 0.5.0 |
* |
*/ |
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES) |
public interface StorageService { |
public static final String SERVICE_NAME = "StorageService"; |
final String OPERATION_STORETEXT = "storeText"; |
final String OPERATION_STOREBINARY = "storeBinary"; |
final String OPERATION_CREATECOLLECTION = "createCollection"; |
final String OPERATION_DELIVERCOLLECTION = "deliverCollection"; |
final String PARAM_TEXT = "text"; |
final String PARAM_BINARY = "binary"; |
final String PARAM_NAME = "name"; |
final String PARAM_COLLECTION = "collection"; |
final String PARAM_TARGETNODE = "target"; |
final String PARAM_RAISEEVENT = "event"; |
; |
/** |
* Store text based data. |
* @param text text to be stored |
* |
* @return uuid reference to stored object |
* @throws XServicesFault |
*/ |
@WebMethod(operationName=OPERATION_STORETEXT) |
@WSDLDocumentation(value="Store text based data") |
public abstract String storeText(@WebParam(name = PARAM_TEXT) String text) throws XServicesFault; |
@WebMethod(operationName=OPERATION_STOREBINARY) |
@WSDLDocumentation(value="Store binary data") |
public abstract String storeBinary( |
@WebParam(name= PARAM_BINARY) AttachmentType binary) |
throws XServicesFault; |
@WebMethod(operationName=OPERATION_CREATECOLLECTION) |
@WSDLDocumentation(value="Create a new Collection by name.") |
public abstract String createCollection( |
@WebParam(name= PARAM_COLLECTION) CollectionType collection) |
throws XServicesFault; |
@WebMethod(operationName=OPERATION_DELIVERCOLLECTION) |
@WSDLDocumentation(value="Deliver a collection to a target node (asynchronous).") |
public abstract void deliverCollection( |
@WebParam(name= PARAM_COLLECTION) CollectionType collection, |
@WebParam(name= PARAM_TARGETNODE) TargetNodeType targetnode, |
@WebParam(name= PARAM_RAISEEVENT) boolean isFiring) |
throws XServicesFault; |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |
/xservices/trunk/src/java/net/brutex/xservices/ws/MiscService.java |
---|
18,14 → 18,15 |
import javax.jws.WebMethod; |
import javax.jws.WebParam; |
import javax.jws.WebService; |
import net.brutex.xservices.types.FileSetResource; |
import net.brutex.xservices.types.HostConnection; |
import net.brutex.xservices.types.HostinfoType; |
import net.brutex.xservices.types.MailMimeType; |
import net.brutex.xservices.types.ReturnCode; |
import net.brutex.xservices.types.ant.FileSetResource; |
import net.brutex.xservices.util.BrutexNamespaces; |
import org.apache.cxf.aegis.type.java5.XmlElement; |
import org.apache.cxf.aegis.type.java5.XmlReturnType; |
import org.apache.cxf.annotations.WSDLDocumentation; |
/** |
/xservices/trunk/src/java/net/brutex/xservices/ws/DateService.java |
---|
17,17 → 17,24 |
package net.brutex.xservices.ws; |
import java.math.BigInteger; |
import java.util.Date; |
import java.util.GregorianCalendar; |
import java.util.List; |
import javax.jws.WebMethod; |
import javax.jws.WebParam; |
import javax.jws.WebService; |
import javax.xml.bind.annotation.XmlElement; |
import javax.xml.datatype.XMLGregorianCalendar; |
import net.brutex.xservices.types.DateFormatType; |
import net.brutex.xservices.types.DateInfoExtendedType; |
import net.brutex.xservices.types.DateInfoType; |
import net.brutex.xservices.types.DateTimeUnits; |
import net.brutex.xservices.types.TimeZoneType; |
import net.brutex.xservices.util.BrutexNamespaces; |
import org.apache.cxf.annotations.WSDLDocumentation; |
import org.apache.cxf.annotations.WSDLDocumentationCollection; |
45,7 → 52,9 |
public interface DateService { |
public static final String SERVICE_NAME = "DateService"; |
final String OPERATION_GETDATE = "getDate"; |
final String OPERATION_GETDATEEXTENDED = "getDateExtended"; |
final String OPERATION_GETTIMESTAMP = "getTimestamp"; |
final String OPERATION_GETTIMESTAMP2 = "getTimestamp2"; |
final String OPERATION_GETINTIMEZONE = "getInTimezone"; |
56,7 → 65,7 |
final String OPERATION_DATETIMEDIFF = "dateTimeDiff"; |
final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2"; |
final String OPERATION_DATEADD = "dateAdd"; |
final String OPERATION_GETTIMEZONES = "getTimezones"; |
final String PARAM_TIMEZONE = "timezone"; |
final String PARAM_DATETIME = "datetime"; |
final String PARAM_FORMAT = "format"; |
65,16 → 74,26 |
/** |
* Get current date and time. |
* |
* @param timezone Optional timezone. Defaults to server timezone. |
* @return Current date and time. |
* @throws XServicesFault |
*/ |
@WebMethod(operationName=OPERATION_GETDATE) |
@WSDLDocumentation(value="Get current date and time.") |
public abstract GregorianCalendar getDate( |
@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault; |
public abstract DateInfoType getDate() |
throws XServicesFault; |
/** |
* Get current date and time (extended version). |
* |
* @return Current date and time. |
* @throws XServicesFault |
*/ |
@WebMethod(operationName=OPERATION_GETDATEEXTENDED) |
@WSDLDocumentation(value="Get current date and time in different formats.") |
public abstract DateInfoExtendedType getDateExtended() |
throws XServicesFault; |
/** |
* Get milliseconds since 01.01.1970. |
* |
* @return timestamp milliseconds |
102,14 → 121,14 |
* @throws XServicesFault |
*/ |
@WebMethod(operationName=OPERATION_GETINTIMEZONE) |
public abstract GregorianCalendar getInTimezone( |
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal, |
public abstract String getInTimezone( |
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) Date cal, |
@WebParam(name=PARAM_TIMEZONE) @XmlElement(required=true) String timezone) throws XServicesFault; |
/** |
* Formats a date with pre-defined patterns. |
* |
* @param cal date time to be formatted |
* @param cal date time to be formatted in ISO8601 |
* @param format Pattern to be used for date formating |
* @return formatted date/time string |
* @throws XServicesFault |
116,9 → 135,12 |
*/ |
@WebMethod(operationName=OPERATION_FORMATDATE) |
public abstract String formatDate( |
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal, |
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) Date cal, |
@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format) throws XServicesFault; |
@WebMethod(operationName=OPERATION_GETTIMEZONES) |
public abstract List<TimeZoneType> getTimezones() throws XServicesFault; |
/** |
* Formats a date with a free form pattern. |
* Uses SimpleDateFormat patterns |
151,7 → 173,7 |
*/ |
@WebMethod(operationName=OPERATION_FORMATDATEADVANCED) |
public abstract String formatDateAdvanced( |
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal, |
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) Date cal, |
@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) String format) throws XServicesFault; |
/** |
164,7 → 186,8 |
* @throws XServicesFault |
*/ |
@WebMethod(operationName=OPERATION_PARSEDATE) |
public abstract GregorianCalendar parseDate( |
@WSDLDocumentation(value="Converts a string into date using pre-defined date formats.") |
public abstract Date parseDate( |
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) String s, |
@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format, |
@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault; |
192,8 → 215,8 |
*/ |
@WebMethod(operationName=OPERATION_DATETIMEDIFF) |
public abstract BigInteger dateTimeDiff( |
@WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal, |
@WebParam(name="toDateTime") @XmlElement(required=true) GregorianCalendar toCal) throws XServicesFault; |
@WebParam(name="fromDateTime") @XmlElement(required=true) Date fromCal, |
@WebParam(name="toDateTime") @XmlElement(required=true) Date toCal) throws XServicesFault; |
/** |
* Fully elapsed units between two dates. |
208,9 → 231,9 |
@WebMethod(operationName=OPERATION_DATETIMEDIFF2) |
@WSDLDocumentation(value="Get elapsed time between to dates.") |
public abstract BigInteger dateTimeDiff2( |
@WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal, |
@WebParam(name="toDateTime") @XmlElement(required=true) GregorianCalendar toCal, |
@WebParam(name="PARAM_UNIT") DateTimeUnits unit) throws XServicesFault; |
@WebParam(name="fromDateTime") @XmlElement(required=true) Date fromCal, |
@WebParam(name="toDateTime") @XmlElement(required=true) Date toCal, |
@WebParam(name=PARAM_UNIT) DateTimeUnits unit) throws XServicesFault; |
/** |
* Add or subtract a time span from a date. |
/xservices/trunk/src/java/net/brutex/xservices/util/RunTask.java |
---|
19,8 → 19,9 |
import java.io.PrintStream; |
import java.util.HashMap; |
import java.util.Map; |
import net.brutex.xservices.types.AntProperty; |
import net.brutex.xservices.types.ReturnCode; |
import net.brutex.xservices.types.ant.AntProperty; |
import org.apache.tools.ant.BuildException; |
import org.apache.tools.ant.Project; |
import org.apache.tools.ant.Target; |
/xservices/trunk/src/java/net/brutex/xservices/agent/AgentServlet.java |
---|
0,0 → 1,39 |
package net.brutex.xservices.agent; |
import java.io.IOException; |
import javax.servlet.GenericServlet; |
import javax.servlet.ServletConfig; |
import javax.servlet.ServletException; |
import javax.servlet.ServletRequest; |
import javax.servlet.ServletResponse; |
/** |
* Servlet implementation class AgentServlet |
*/ |
public class AgentServlet extends GenericServlet { |
private static final long serialVersionUID = 1L; |
/** |
* @see GenericServlet#GenericServlet() |
*/ |
public AgentServlet() { |
super(); |
// TODO Auto-generated constructor stub |
} |
/** |
* @see Servlet#init(ServletConfig) |
*/ |
public void init(ServletConfig config) throws ServletException { |
// TODO Auto-generated method stub |
} |
/** |
* @see Servlet#service(ServletRequest request, ServletResponse response) |
*/ |
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException { |
// TODO Auto-generated method stub |
System.out.println("Yep. I am here."); |
} |
} |
Property changes: |
Added: svn:mime-type |
+text/plain |
\ No newline at end of property |