From bfbe152e9c3861f5df6fee470457621e8749c9aa Mon Sep 17 00:00:00 2001 From: Ben Fortuna Date: Mon, 1 Apr 2024 13:25:40 +1100 Subject: [PATCH] Refactored property name sets --- .../dav/AbstractDavObjectCollection.java | 3 +- .../dav/CalDavCalendarCollection.java | 57 ++------- .../connector/dav/CalDavCalendarStore.java | 19 ++- .../connector/dav/CardDavCollection.java | 52 +------- .../ical4j/connector/dav/CardDavStore.java | 17 ++- .../connector/dav/DefaultDavClient.java | 39 +++--- .../ical4j/connector/dav/WebDavSupport.java | 2 + .../dav/property/PropertyNameSets.java | 115 ++++++++++++++++++ 8 files changed, 165 insertions(+), 139 deletions(-) create mode 100644 ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/property/PropertyNameSets.java diff --git a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/AbstractDavObjectCollection.java b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/AbstractDavObjectCollection.java index 7d45d4a..da7dfae 100644 --- a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/AbstractDavObjectCollection.java +++ b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/AbstractDavObjectCollection.java @@ -43,6 +43,7 @@ import org.ical4j.connector.ObjectStoreException; import org.ical4j.connector.dav.property.BaseDavPropertyName; import org.ical4j.connector.dav.property.CalDavPropertyName; +import org.ical4j.connector.dav.property.PropertyNameSets; import org.ical4j.connector.event.ListenerList; import org.ical4j.connector.event.ObjectCollectionListener; import org.w3c.dom.Element; @@ -308,7 +309,7 @@ public final void delete() throws ObjectStoreException { * @throws ObjectStoreException where an unexpected error occurs */ public final boolean exists() throws HttpResponseException, IOException, ObjectStoreException { - return !getStore().getClient().propFind(getPath(), CalDavCalendarCollection.propertiesForFetch()).isEmpty(); + return !getStore().getClient().propFind(getPath(), PropertyNameSets.PROPFIND_CALENDAR).isEmpty(); } @Override diff --git a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CalDavCalendarCollection.java b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CalDavCalendarCollection.java index 1636a6c..e0227b3 100644 --- a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CalDavCalendarCollection.java +++ b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CalDavCalendarCollection.java @@ -37,13 +37,13 @@ import net.fortuna.ical4j.model.property.Uid; import net.fortuna.ical4j.util.Calendars; import org.apache.jackrabbit.webdav.DavException; -import org.apache.jackrabbit.webdav.property.DavPropertyName; -import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.property.DavPropertySet; -import org.apache.jackrabbit.webdav.security.SecurityConstants; import org.apache.jackrabbit.webdav.version.report.ReportInfo; import org.ical4j.connector.*; -import org.ical4j.connector.dav.property.*; +import org.ical4j.connector.dav.property.CalDavPropertyName; +import org.ical4j.connector.dav.property.DavPropertyBuilder; +import org.ical4j.connector.dav.property.ICalPropertyName; +import org.ical4j.connector.dav.property.PropertyNameSets; import org.ical4j.connector.dav.request.CalendarQuery; import org.ical4j.connector.dav.request.EventQuery; import org.ical4j.connector.dav.response.GetCalendarData; @@ -157,10 +157,8 @@ public Iterable getTasks() { */ public Iterable getComponentsByType(String componentType) { try { - DavPropertyNameSet propertyNames = new DavPropertyNameSet(); - propertyNames.add(DavPropertyName.GETETAG); - propertyNames.add(CalDavPropertyName.CALENDAR_DATA); - ReportInfo info = new ReportInfo(CalDavPropertyName.CALENDAR_QUERY, 1, propertyNames); + ReportInfo info = new ReportInfo(CalDavPropertyName.CALENDAR_QUERY, 1, + PropertyNameSets.REPORT_CALENDAR); info.setContentElement(new CalendarQuery(componentType).build()); List calendars = getStore().getClient().report(getPath(), info, new GetCalendarData()); @@ -505,48 +503,7 @@ public Calendar[] getObjectsByMultiget(ArrayList hrefs, Element calData) public Calendar[] doFreeBusyQuery() { return new Calendar[0]; } - - public static final DavPropertyNameSet propertiesForFetch() { - DavPropertyNameSet principalsProps = new DavPropertyNameSet(); - - principalsProps.add(BaseDavPropertyName.QUOTA_AVAILABLE_BYTES); - principalsProps.add(BaseDavPropertyName.QUOTA_USED_BYTES); - principalsProps.add(SecurityConstants.CURRENT_USER_PRIVILEGE_SET); - principalsProps.add(BaseDavPropertyName.PROP); - principalsProps.add(DavPropertyName.RESOURCETYPE); - principalsProps.add(DISPLAYNAME); - principalsProps.add(SecurityConstants.OWNER); - - principalsProps.add(CalDavPropertyName.CALENDAR_DESCRIPTION); - principalsProps.add(CalDavPropertyName.SUPPORTED_CALENDAR_COMPONENT_SET); - principalsProps.add(CalDavPropertyName.FREE_BUSY_SET); - principalsProps.add(CalDavPropertyName.SCHEDULE_CALENDAR_TRANSP); - principalsProps.add(CalDavPropertyName.SCHEDULE_DEFAULT_CALENDAR_URL); - principalsProps.add(CalDavPropertyName.CALENDAR_TIMEZONE); - principalsProps.add(CalDavPropertyName.SUPPORTED_CALENDAR_DATA); - principalsProps.add(CalDavPropertyName.MAX_ATTENDEES_PER_INSTANCE); - principalsProps.add(CalDavPropertyName.MAX_DATE_TIME); - principalsProps.add(CalDavPropertyName.MIN_DATE_TIME); - principalsProps.add(CalDavPropertyName.MAX_INSTANCES); - principalsProps.add(CalDavPropertyName.MAX_RESOURCE_SIZE); - - principalsProps.add(CSDavPropertyName.XMPP_SERVER); - principalsProps.add(CSDavPropertyName.XMPP_URI); - principalsProps.add(CSDavPropertyName.CTAG); - principalsProps.add(CSDavPropertyName.SOURCE); - principalsProps.add(CSDavPropertyName.SUBSCRIBED_STRIP_ALARMS); - principalsProps.add(CSDavPropertyName.SUBSCRIBED_STRIP_ATTACHMENTS); - principalsProps.add(CSDavPropertyName.SUBSCRIBED_STRIP_TODOS); - principalsProps.add(CSDavPropertyName.REFRESHRATE); - principalsProps.add(CSDavPropertyName.PUSH_TRANSPORTS); - principalsProps.add(CSDavPropertyName.PUSHKEY); - - principalsProps.add(ICalPropertyName.CALENDAR_COLOR); - principalsProps.add(ICalPropertyName.CALENDAR_ORDER); - - return principalsProps; - } - + @Override public String toString() { return "Display Name: " + getDisplayName() + ", id: " + getId(); diff --git a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CalDavCalendarStore.java b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CalDavCalendarStore.java index 4f99d40..1d6a5ea 100644 --- a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CalDavCalendarStore.java +++ b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CalDavCalendarStore.java @@ -54,8 +54,10 @@ import org.ical4j.connector.dav.method.PrincipalPropertySearchInfo; import org.ical4j.connector.dav.property.BaseDavPropertyName; import org.ical4j.connector.dav.property.CalDavPropertyName; +import org.ical4j.connector.dav.property.PropertyNameSets; import org.ical4j.connector.dav.request.ExpandPropertyQuery; import org.ical4j.connector.dav.response.GetCalDavCollections; +import org.ical4j.connector.dav.response.GetCollections; import org.w3c.dom.Element; import org.xml.sax.SAXException; @@ -153,9 +155,9 @@ public CalDavCalendarCollection addCollection(String id, DavPropertySet properti public CalDavCalendarCollection getCollection(String id) throws ObjectStoreException, ObjectNotFoundException { try { String resourcePath = pathResolver.getCalendarPath(id, "test"); - DavPropertyNameSet principalsProps = CalDavCalendarCollection.propertiesForFetch(); - Map res = getClient().propFindResources(resourcePath, principalsProps, - CALENDAR, CALENDAR_PROXY_READ, CALENDAR_PROXY_WRITE); + Map res = getClient().propFind(resourcePath, + PropertyNameSets.PROPFIND_CALENDAR, + new GetCollections(CALENDAR, CALENDAR_PROXY_READ, CALENDAR_PROXY_WRITE)); if (!res.isEmpty()) { DavPropertySet props = res.entrySet().iterator().next().getValue(); return new CalDavCalendarCollection(this, id, props); @@ -198,11 +200,7 @@ public String findCalendarHomeSet() throws ParserConfigurationException, IOExcep * @throws DavException */ protected String findCalendarHomeSet(String propfindUri) throws IOException { - DavPropertyNameSet principalsProps = new DavPropertyNameSet(); - principalsProps.add(CalDavPropertyName.CALENDAR_HOME_SET); - principalsProps.add(DavPropertyName.DISPLAYNAME); - - DavPropertySet props = getClient().propFind(propfindUri, principalsProps); + DavPropertySet props = getClient().propFind(propfindUri, PropertyNameSets.PROPFIND_CALENDAR_HOME); if (props.contains(CalDavPropertyName.CALENDAR_HOME_SET)) { Element propElement = (Element) props.get(CalDavPropertyName.CALENDAR_HOME_SET).getValue(); return propElement.getFirstChild().getNodeValue(); @@ -241,9 +239,8 @@ public List getCollections(String workspace) throws Ob protected List getCollectionsForHomeSet(CalDavCalendarStore store, String urlForcalendarHomeSet) throws IOException, DavException { - DavPropertyNameSet principalsProps = CalDavCalendarCollection.propertiesForFetch(); - return getClient().propFindResources(urlForcalendarHomeSet, principalsProps, - CALENDAR, CALENDAR_PROXY_READ, CALENDAR_PROXY_WRITE).entrySet().stream() + return getClient().propFind(urlForcalendarHomeSet, PropertyNameSets.PROPFIND_CALENDAR, + new GetCollections(COLLECTION)).entrySet().stream() .map(e -> new CalDavCalendarCollection(this, e.getKey(), e.getValue())) .collect(Collectors.toList()); } diff --git a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CardDavCollection.java b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CardDavCollection.java index e958a0a..c7e483e 100644 --- a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CardDavCollection.java +++ b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CardDavCollection.java @@ -36,19 +36,16 @@ import net.fortuna.ical4j.vcard.VCard; import net.fortuna.ical4j.vcard.property.Uid; import org.apache.jackrabbit.webdav.DavException; -import org.apache.jackrabbit.webdav.property.DavPropertyName; -import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.property.DavPropertySet; -import org.apache.jackrabbit.webdav.security.SecurityConstants; import org.apache.jackrabbit.webdav.version.report.ReportInfo; import org.ical4j.connector.CardCollection; import org.ical4j.connector.FailedOperationException; import org.ical4j.connector.ObjectNotFoundException; import org.ical4j.connector.ObjectStoreException; -import org.ical4j.connector.dav.property.BaseDavPropertyName; import org.ical4j.connector.dav.property.CalDavPropertyName; import org.ical4j.connector.dav.property.CardDavPropertyName; import org.ical4j.connector.dav.property.DavPropertyBuilder; +import org.ical4j.connector.dav.property.PropertyNameSets; import org.ical4j.connector.dav.response.GetVCardData; import javax.xml.parsers.ParserConfigurationException; @@ -151,46 +148,6 @@ public long getMaxResourceSize() { public VCard[] export() { throw new UnsupportedOperationException("not implemented"); } - - public static final DavPropertyNameSet propertiesForFetch() { - DavPropertyNameSet principalsProps = new DavPropertyNameSet(); - - /* - * TODO : to add the following properties - - - - - */ - - principalsProps.add(DISPLAYNAME); - - - principalsProps.add(SecurityConstants.CURRENT_USER_PRIVILEGE_SET); - principalsProps.add(DavPropertyName.RESOURCETYPE); - principalsProps.add(SecurityConstants.OWNER); - principalsProps.add(CardDavPropertyName.MAX_RESOURCE_SIZE); - principalsProps.add(BaseDavPropertyName.RESOURCE_ID); - principalsProps.add(BaseDavPropertyName.SUPPORTED_REPORT_SET); - principalsProps.add(BaseDavPropertyName.SYNC_TOKEN); - principalsProps.add(BaseDavPropertyName.ADD_MEMBER); - principalsProps.add(CardDavPropertyName.MAX_IMAGE_SIZE); - - /** - * FIXME jackrabbit generates an error when quota-used-bytes is sent. - * I suspect the problem is that the response have this attribute: e:dt="int" - */ - //principalsProps.add(BaseDavPropertyName.QUOTA_USED_BYTES); - //principalsProps.add(BaseDavPropertyName.QUOTA_AVAILABLE_BYTES); - - /* In the absence of this property, the server MUST only accept data with the media type - * "text/vcard" and vCard version 3.0, and clients can assume that is - * all the server will accept. - */ - principalsProps.add(CardDavPropertyName.SUPPORTED_ADDRESS_DATA); - - return principalsProps; - } /* (non-Javadoc) * @see org.ical4j.connector.ObjectCollection#getDescription() @@ -211,11 +168,8 @@ public List listObjectUIDs() { */ public Iterable getAll() throws ObjectStoreException { try { - DavPropertyNameSet properties = new DavPropertyNameSet(); - properties.add(DavPropertyName.GETETAG); - properties.add(CardDavPropertyName.ADDRESS_DATA); - - ReportInfo info = new ReportInfo(CardDavPropertyName.ADDRESSBOOK_QUERY, 1, properties); + ReportInfo info = new ReportInfo(CardDavPropertyName.ADDRESSBOOK_QUERY, 1, + PropertyNameSets.REPORT_CARD); return getStore().getClient().report(getPath(), info, new GetVCardData()); } catch (IOException | ParserConfigurationException e) { diff --git a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CardDavStore.java b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CardDavStore.java index 2739511..c0f5103 100644 --- a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CardDavStore.java +++ b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/CardDavStore.java @@ -35,7 +35,6 @@ import net.fortuna.ical4j.vcard.VCard; import org.apache.jackrabbit.webdav.DavException; import org.apache.jackrabbit.webdav.property.DavPropertyName; -import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.property.DavPropertySet; import org.apache.jackrabbit.webdav.security.SecurityConstants; import org.apache.jackrabbit.webdav.version.report.ReportInfo; @@ -46,8 +45,10 @@ import org.ical4j.connector.dav.property.BaseDavPropertyName; import org.ical4j.connector.dav.property.CalDavPropertyName; import org.ical4j.connector.dav.property.CardDavPropertyName; +import org.ical4j.connector.dav.property.PropertyNameSets; import org.ical4j.connector.dav.request.ExpandPropertyQuery; import org.ical4j.connector.dav.response.GetCardDavCollections; +import org.ical4j.connector.dav.response.GetCollections; import javax.xml.parsers.ParserConfigurationException; import java.io.IOException; @@ -126,8 +127,8 @@ public CardDavCollection addCollection(String id, DavPropertySet properties) thr */ public CardDavCollection getCollection(String id) throws ObjectStoreException, ObjectNotFoundException { try { - DavPropertyNameSet principalsProps = CardDavCollection.propertiesForFetch(); - return getClient().propFindResources(id, principalsProps, ResourceType.ADRESSBOOK).entrySet().stream() + return getClient().propFind(id, PropertyNameSets.PROPFIND_CARD, + new GetCollections(ResourceType.ADRESSBOOK)).entrySet().stream() .map(e -> new CardDavCollection(this, e.getKey(), e.getValue())) .collect(Collectors.toList()).get(0); } catch (IOException e) { @@ -163,11 +164,7 @@ protected String findAddressBookHomeSet() throws ParserConfigurationException, I * @throws DavException */ protected String findAddressBookHomeSet(String propfindUri) throws IOException { - DavPropertyNameSet principalsProps = new DavPropertyNameSet(); - principalsProps.add(CardDavPropertyName.ADDRESSBOOK_HOME_SET); - principalsProps.add(DavPropertyName.DISPLAYNAME); - - DavPropertySet props = getClient().propFind(propfindUri, principalsProps); + DavPropertySet props = getClient().propFind(propfindUri, PropertyNameSets.PROPFIND_CARD_HOME); return (String) props.get(CardDavPropertyName.ADDRESSBOOK_HOME_SET).getValue(); } @@ -200,8 +197,8 @@ public List getCollections(String workspace) throws ObjectSto protected List getCollectionsForHomeSet(CardDavStore store, String urlForcalendarHomeSet) throws IOException, DavException { - DavPropertyNameSet principalsProps = CardDavCollection.propertiesForFetch(); - return getClient().propFindResources(urlForcalendarHomeSet, principalsProps, ResourceType.ADRESSBOOK).entrySet().stream() + return getClient().propFind(urlForcalendarHomeSet, PropertyNameSets.PROPFIND_CARD, + new GetCollections(ResourceType.ADRESSBOOK)).entrySet().stream() .map(e -> new CardDavCollection(this, e.getKey(), e.getValue())) .collect(Collectors.toList()); } diff --git a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/DefaultDavClient.java b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/DefaultDavClient.java index 0cdb2bd..fe79200 100644 --- a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/DefaultDavClient.java +++ b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/DefaultDavClient.java @@ -59,7 +59,6 @@ import org.apache.jackrabbit.webdav.DavException; import org.apache.jackrabbit.webdav.MultiStatusResponse; import org.apache.jackrabbit.webdav.client.methods.*; -import org.apache.jackrabbit.webdav.property.DavPropertyName; import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; import org.apache.jackrabbit.webdav.property.DavPropertySet; import org.apache.jackrabbit.webdav.property.PropEntry; @@ -67,8 +66,8 @@ import org.ical4j.connector.FailedOperationException; import org.ical4j.connector.ObjectStoreException; import org.ical4j.connector.dav.method.*; -import org.ical4j.connector.dav.property.CSDavPropertyName; import org.ical4j.connector.dav.property.CalDavPropertyName; +import org.ical4j.connector.dav.property.PropertyNameSets; import org.ical4j.connector.dav.request.CalendarQuery; import org.ical4j.connector.dav.request.MkCalendarEntity; import org.ical4j.connector.dav.request.MkColEntity; @@ -180,13 +179,8 @@ public DavClientConfiguration getClientConfiguration() { } public List getSupportedFeatures() throws IOException { - DavPropertyNameSet props = new DavPropertyNameSet(); - props.add(DavPropertyName.RESOURCETYPE); - props.add(CSDavPropertyName.CTAG); - DavPropertyName owner = DavPropertyName.create(DavPropertyName.XML_OWNER, DavConstants.NAMESPACE); - props.add(owner); - - HttpPropfind aGet = new HttpPropfind(repositoryPath, DavConstants.PROPFIND_BY_PROPERTY, props, 0); + HttpPropfind aGet = new HttpPropfind(repositoryPath, DavConstants.PROPFIND_BY_PROPERTY, + PropertyNameSets.PROPFIND_SUPPORTED_FEATURES, 0); RequestConfig.Builder builder = aGet.getConfig() == null ? RequestConfig.custom() : RequestConfig.copy(aGet.getConfig()); builder.setAuthenticationEnabled(true); @@ -226,20 +220,29 @@ public void mkCol(String path, DavPropertySet properties) throws ObjectStoreExce @Override public DavPropertySet propFind(String path, DavPropertyNameSet propertyNames) throws IOException { - HttpPropfind aGet = new HttpPropfind(resolvePath(path), propertyNames, 0); + return propFind(path, propertyNames, new GetResourceProperties()); + } -// RequestConfig config = RequestConfig.custom().setAuthenticationEnabled(true).build(); -// aGet.setConfig(config); - return execute(aGet, new GetResourceProperties()); + @Override + public T propFind(String path, DavPropertyNameSet propertyNames, ResponseHandler handler) + throws IOException { + HttpPropfind aGet = new HttpPropfind(resolvePath(path), propertyNames, 0); + return execute(aGet, handler); } + /** + * + * @param path + * @param propertyNames + * @param resourceTypes + * @return + * @throws IOException + * @deprecated use {@link WebDavSupport#propFind(String, DavPropertyNameSet, ResponseHandler)} instead + */ + @Deprecated public Map propFindResources(String path, DavPropertyNameSet propertyNames, ResourceType...resourceTypes) throws IOException { - HttpPropfind aGet = new HttpPropfind(resolvePath(path), propertyNames, 0); - -// RequestConfig config = RequestConfig.custom().setAuthenticationEnabled(true).build(); -// aGet.setConfig(config); - return execute(aGet, new GetCollections(resourceTypes)); + return propFind(path, propertyNames, new GetCollections(resourceTypes)); } @Override diff --git a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/WebDavSupport.java b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/WebDavSupport.java index 30d3aae..2d49c2b 100644 --- a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/WebDavSupport.java +++ b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/WebDavSupport.java @@ -115,6 +115,8 @@ default DavPropertySet propFind(String path, DavPropertyName... propertyNames) t return propFind(path, nameSet); } + T propFind(String path, DavPropertyNameSet propertyNames, ResponseHandler handler) throws IOException; + default DavPropertySet propFindAll(String path) throws IOException { return propFindType(path, DavPropertyName.PROPFIND_ALL_PROP); } diff --git a/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/property/PropertyNameSets.java b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/property/PropertyNameSets.java new file mode 100644 index 0000000..dc35919 --- /dev/null +++ b/ical4j-connector-dav/src/main/java/org/ical4j/connector/dav/property/PropertyNameSets.java @@ -0,0 +1,115 @@ +package org.ical4j.connector.dav.property; + +import org.apache.jackrabbit.webdav.DavConstants; +import org.apache.jackrabbit.webdav.property.DavPropertyName; +import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; +import org.apache.jackrabbit.webdav.security.SecurityConstants; + +import static org.apache.jackrabbit.webdav.property.DavPropertyName.DISPLAYNAME; + +public abstract class PropertyNameSets { + + public static final DavPropertyNameSet REPORT_CALENDAR = new DavPropertyNameSet(); + + public static final DavPropertyNameSet PROPFIND_CALENDAR = new DavPropertyNameSet(); + + public static final DavPropertyNameSet PROPFIND_CALENDAR_HOME = new DavPropertyNameSet(); + + public static final DavPropertyNameSet PROPFIND_CARD = new DavPropertyNameSet(); + + public static final DavPropertyNameSet PROPFIND_CARD_HOME = new DavPropertyNameSet(); + + public static final DavPropertyNameSet REPORT_CARD = new DavPropertyNameSet(); + + public static final DavPropertyNameSet PROPFIND_SUPPORTED_FEATURES = new DavPropertyNameSet(); + + static { + REPORT_CALENDAR.add(DavPropertyName.GETETAG); + REPORT_CALENDAR.add(CalDavPropertyName.CALENDAR_DATA); + + PROPFIND_CALENDAR.add(BaseDavPropertyName.QUOTA_AVAILABLE_BYTES); + PROPFIND_CALENDAR.add(BaseDavPropertyName.QUOTA_USED_BYTES); + PROPFIND_CALENDAR.add(SecurityConstants.CURRENT_USER_PRIVILEGE_SET); + PROPFIND_CALENDAR.add(BaseDavPropertyName.PROP); + PROPFIND_CALENDAR.add(DavPropertyName.RESOURCETYPE); + PROPFIND_CALENDAR.add(DISPLAYNAME); + PROPFIND_CALENDAR.add(SecurityConstants.OWNER); + + PROPFIND_CALENDAR.add(CalDavPropertyName.CALENDAR_DESCRIPTION); + PROPFIND_CALENDAR.add(CalDavPropertyName.SUPPORTED_CALENDAR_COMPONENT_SET); + PROPFIND_CALENDAR.add(CalDavPropertyName.FREE_BUSY_SET); + PROPFIND_CALENDAR.add(CalDavPropertyName.SCHEDULE_CALENDAR_TRANSP); + PROPFIND_CALENDAR.add(CalDavPropertyName.SCHEDULE_DEFAULT_CALENDAR_URL); + PROPFIND_CALENDAR.add(CalDavPropertyName.CALENDAR_TIMEZONE); + PROPFIND_CALENDAR.add(CalDavPropertyName.SUPPORTED_CALENDAR_DATA); + PROPFIND_CALENDAR.add(CalDavPropertyName.MAX_ATTENDEES_PER_INSTANCE); + PROPFIND_CALENDAR.add(CalDavPropertyName.MAX_DATE_TIME); + PROPFIND_CALENDAR.add(CalDavPropertyName.MIN_DATE_TIME); + PROPFIND_CALENDAR.add(CalDavPropertyName.MAX_INSTANCES); + PROPFIND_CALENDAR.add(CalDavPropertyName.MAX_RESOURCE_SIZE); + + PROPFIND_CALENDAR.add(CSDavPropertyName.XMPP_SERVER); + PROPFIND_CALENDAR.add(CSDavPropertyName.XMPP_URI); + PROPFIND_CALENDAR.add(CSDavPropertyName.CTAG); + PROPFIND_CALENDAR.add(CSDavPropertyName.SOURCE); + PROPFIND_CALENDAR.add(CSDavPropertyName.SUBSCRIBED_STRIP_ALARMS); + PROPFIND_CALENDAR.add(CSDavPropertyName.SUBSCRIBED_STRIP_ATTACHMENTS); + PROPFIND_CALENDAR.add(CSDavPropertyName.SUBSCRIBED_STRIP_TODOS); + PROPFIND_CALENDAR.add(CSDavPropertyName.REFRESHRATE); + PROPFIND_CALENDAR.add(CSDavPropertyName.PUSH_TRANSPORTS); + PROPFIND_CALENDAR.add(CSDavPropertyName.PUSHKEY); + + PROPFIND_CALENDAR.add(ICalPropertyName.CALENDAR_COLOR); + PROPFIND_CALENDAR.add(ICalPropertyName.CALENDAR_ORDER); + + PROPFIND_CALENDAR_HOME.add(CalDavPropertyName.CALENDAR_HOME_SET); + PROPFIND_CALENDAR_HOME.add(DavPropertyName.DISPLAYNAME); + + + /* + * TODO : to add the following properties + + + + + */ + + PROPFIND_CARD.add(DISPLAYNAME); + + + PROPFIND_CARD.add(SecurityConstants.CURRENT_USER_PRIVILEGE_SET); + PROPFIND_CARD.add(DavPropertyName.RESOURCETYPE); + PROPFIND_CARD.add(SecurityConstants.OWNER); + PROPFIND_CARD.add(CardDavPropertyName.MAX_RESOURCE_SIZE); + PROPFIND_CARD.add(BaseDavPropertyName.RESOURCE_ID); + PROPFIND_CARD.add(BaseDavPropertyName.SUPPORTED_REPORT_SET); + PROPFIND_CARD.add(BaseDavPropertyName.SYNC_TOKEN); + PROPFIND_CARD.add(BaseDavPropertyName.ADD_MEMBER); + PROPFIND_CARD.add(CardDavPropertyName.MAX_IMAGE_SIZE); + + /** + * FIXME jackrabbit generates an error when quota-used-bytes is sent. + * I suspect the problem is that the response have this attribute: e:dt="int" + */ + //PROPFIND_CARD.add(BaseDavPropertyName.QUOTA_USED_BYTES); + //PROPFIND_CARD.add(BaseDavPropertyName.QUOTA_AVAILABLE_BYTES); + + /* In the absence of this property, the server MUST only accept data with the media type + * "text/vcard" and vCard version 3.0, and clients can assume that is + * all the server will accept. + */ + PROPFIND_CARD.add(CardDavPropertyName.SUPPORTED_ADDRESS_DATA); + + REPORT_CARD.add(DavPropertyName.GETETAG); + REPORT_CARD.add(CardDavPropertyName.ADDRESS_DATA); + + PROPFIND_CARD_HOME.add(CardDavPropertyName.ADDRESSBOOK_HOME_SET); + PROPFIND_CARD_HOME.add(DavPropertyName.DISPLAYNAME); + + PROPFIND_SUPPORTED_FEATURES.add(DavPropertyName.RESOURCETYPE); + PROPFIND_SUPPORTED_FEATURES.add(CSDavPropertyName.CTAG); + DavPropertyName owner = DavPropertyName.create(DavPropertyName.XML_OWNER, DavConstants.NAMESPACE); + PROPFIND_SUPPORTED_FEATURES.add(owner); + + } +}