Changeset 508
- Timestamp:
- 05/28/06 16:24:07
- Files:
-
- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java (modified) (1 diff)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java (modified) (6 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWServlet.java (modified) (1 diff)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavComponentNode.java (modified) (2 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavPropFindMethod.java (added)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/ReportMethod.java (modified) (8 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/calquery/CalendarData.java (modified) (4 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/PropFindMethod.java (modified) (7 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsIntf.java (modified) (4 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/shared/WebdavProperty.java (modified) (5 diffs)
- trunk/calendar3/caldav/war/WEB-INF/userweb.xml (modified) (1 diff)
- trunk/calendar3/config/configs/democal.properties (modified) (1 diff)
- trunk/calendar3/test/caldavTestData/eg/content/eg02.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java
r477 r508 169 169 int calType) { 170 170 super(owner, publick, creator, access); 171 this.name = name;172 this.path = path;173 this.summary = summary;174 this.description = description;175 this.mailListId = mailListId;176 this.calendarCollection = calendarCollection;171 setName(name); 172 setPath(path); 173 setSummary(summary); 174 setDescription(description); 175 setMailListId(mailListId); 176 setCalendarCollection(calendarCollection); 177 177 setCalendar(parent); 178 this.children = children;179 this.calType = calType;178 setChildren(children); 179 setCalType(calType); 180 180 } 181 181 trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java
r507 r508 75 75 76 76 import edu.rpi.cct.uwcal.caldav.filter.Filter; 77 import edu.rpi.cct.uwcal.caldav.calquery.CalendarData; 77 78 import edu.rpi.cct.uwcal.caldav.calquery.FreeBusyQuery; 78 79 … … 96 97 import java.util.ArrayList; 97 98 import java.util.Collection; 98 import java.util.Enumeration;99 99 import java.util.HashMap; 100 100 import java.util.Iterator; … … 393 393 } 394 394 395 public Enumeration getProperties(WebdavNsNode node) 396 throws WebdavIntfException { 395 public Iterator iterateProperties(WebdavNsNode node) throws WebdavIntfException { 397 396 try { 398 397 CaldavBwNode uwnode = getBwnode(node); 399 398 400 return WebdavProperty. getEnumeration(uwnode.getProperties(namespace));399 return WebdavProperty.iterator(uwnode.getProperties(namespace)); 401 400 } catch (WebdavIntfException we) { 402 401 throw we; … … 1094 1093 xml.property(tag, pr.getPval()); 1095 1094 closePropstat(); 1095 } else if (tag.equals(CaldavTags.calendarData)) { 1096 // pr should be a CalendarData object 1097 if (!(pr instanceof CalendarData)) { 1098 // XXX software error 1099 } else { 1100 CalendarData caldata = (CalendarData)pr; 1101 String content = null; 1102 openPropstat(); 1103 int status = HttpServletResponse.SC_OK; 1104 1105 try { 1106 content = caldata.process(node); 1107 } catch (WebdavException wde) { 1108 status = wde.getStatusCode();; 1109 if (debug && (status != HttpServletResponse.SC_NOT_FOUND)) { 1110 error(wde); 1111 } 1112 } 1113 1114 if (status != HttpServletResponse.SC_OK) { 1115 xml.emptyTag(tag); 1116 } else { 1117 /* Output the (transformed) node. 1118 */ 1119 1120 xml.property(CaldavTags.calendarData, content); 1121 } 1122 closePropstat(status); 1123 } 1096 1124 } else if (tag.equals(CaldavTags.calendarDescription)) { 1097 1125 if ((cal != null) && (cal.getDescription() != null)) { … … 1300 1328 */ 1301 1329 public CalSvcI getSvci() throws WebdavIntfException { 1302 boolean publicMode = (account == null);1303 1304 1330 if (svci != null) { 1305 1331 if (!svci.isOpen()) { … … 1323 1349 account, 1324 1350 envPrefix, 1325 publicMode,1351 false, // publicAdmin 1326 1352 true, // caldav 1327 1353 null, // synchId trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWServlet.java
r507 r508 108 108 methods.put("MKCALENDAR", new MkcalendarMethod()); 109 109 methods.put("OPTIONS", new CalDavOptionsMethod()); 110 methods.put("PROPFIND", new CaldavPropFindMethod()); 110 111 methods.put("REPORT", new ReportMethod()); 111 112 } trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavComponentNode.java
r426 r508 59 59 60 60 import org.bedework.calsvci.CalSvcI; 61 import org.bedework.davdefs.CaldavTags; 61 62 import org.bedework.icalendar.ComponentWrapper; 62 63 import org.bedework.icalendar.IcalTranslator; 63 64 //import org.bedework.icalendar.IcalUtil; 64 65 66 import edu.rpi.cct.uwcal.caldav.calquery.CalendarData; 65 67 import edu.rpi.cct.webdav.servlet.shared.WebdavIntfException; 66 68 import edu.rpi.cct.webdav.servlet.shared.WebdavProperty; … … 298 300 addProp(al, ICalTags.hasAttachment, "0"); 299 301 302 /* Default property calendar-data returns all of the object */ 303 al.add(new CalendarData(CaldavTags.calendarData, debug)); 304 300 305 return al; 301 306 } trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/ReportMethod.java
r490 r508 93 93 /* The parsed results go here. We see: 94 94 * 1. Free-busy request 95 * 2. Query - optional props + optional calendar data +filter96 * 3. Multi-get - optional props + o ptional calendar data + one or more hrefs95 * 2. Query - optional props + filter 96 * 3. Multi-get - optional props + one or more hrefs 97 97 */ 98 98 99 99 private FreeBusyQuery freeBusy; 100 100 private PropFindMethod.PropRequest preq; 101 private CalendarData caldata;101 //private CalendarData caldata; 102 102 private Filter filter; 103 103 private ArrayList hrefs; 104 104 105 CalendarData caldata; 106 107 // ENUM 105 108 private final static int reportTypeQuery = 0; 106 109 private final static int reportTypeMultiGet = 1; … … 209 212 } else { 210 213 /* Two possibilities: 211 <!ELEMENT calendar-multiget 212 (DAV:allprop | DAV:propname | DAV:prop)?213 calendar-data? DAV:href+>214 215 <!ELEMENT calendar-query 216 (DAV:allprop | DAV:propname | DAV:prop)?217 calendar-data? filter>214 <!ELEMENT calendar-multiget ((DAV:allprop | 215 DAV:propname | 216 DAV:prop)?, DAV:href+)> 217 218 <!ELEMENT calendar-query ((DAV:allprop | 219 DAV:propname | 220 DAV:prop)?, filter, timezone?)> 218 221 */ 219 222 … … 229 232 } 230 233 preq = pr; 231 } else if (nodeMatches(curnode, CaldavTags.calendarData)) {232 if (caldata != null) {233 if (debug) {234 trace("REPORT: caldata not null");235 }236 throw new WebdavBadRequest();237 }238 caldata = new CalendarData(debug);239 caldata.parse(curnode);240 234 } else if ((reportType == reportTypeQuery) && 241 235 nodeMatches(curnode, CaldavTags.filter)) { … … 282 276 } 283 277 } else if (reportType == reportTypeQuery) { 284 if (caldata == null) {285 // same as empty element?286 caldata = new CalendarData(debug);287 }288 278 if (filter == null) { 289 279 // filter required 290 280 throw new WebdavBadRequest(); 281 } 282 } 283 284 if (preq != null) { 285 // Look for a calendar-data property 286 Iterator it = preq.iterateProperties(); 287 while (it.hasNext()) { 288 Object o = it.next(); 289 if (o instanceof CalendarData) { 290 caldata = (CalendarData)o; 291 } 291 292 } 292 293 } … … 298 299 freeBusy.dump(); 299 300 } else if (reportType == reportTypeQuery) { 300 // Query - optional props + optional calendar data + filter 301 if (caldata != null) { 302 caldata.dump(); 303 } else { 304 trace("No caldata"); 305 } 306 301 // Query - optional props + filter 307 302 filter.dump(); 308 303 } else if (reportType == reportTypeMultiGet) { 309 // Multi-get - optional props + optional calendar data + one or more hrefs 310 if (caldata != null) { 311 caldata.dump(); 312 } else { 313 trace("No caldata"); 314 } 304 // Multi-get - optional props + one or more hrefs 315 305 316 306 Iterator it = hrefs.iterator(); … … 363 353 int retrieveRecur; 364 354 365 if (caldata.getErs() != null) { 355 if (caldata == null) { 356 retrieveRecur = CalFacadeDefs.retrieveRecurMaster; 357 } else if (caldata.getErs() != null) { 366 358 /* expand XXX use range */ 367 359 retrieveRecur = CalFacadeDefs.retrieveRecurExpanded; … … 513 505 WebdavMethods.propFind); 514 506 int status = node.getStatus(); 515 String content = null;516 507 517 508 openTag(WebdavTags.response); 518 519 if (status == HttpServletResponse.SC_OK) {520 if ((reportType == reportTypeQuery) ||521 (reportType == reportTypeMultiGet)) {522 try {523 content = caldata.process(node);524 } catch (WebdavException wde) {525 status = wde.getStatusCode();;526 if (debug && (status != HttpServletResponse.SC_NOT_FOUND)) {527 error(wde);528 }529 }530 }531 }532 509 533 510 if (status != HttpServletResponse.SC_OK) { … … 541 518 } else { 542 519 pm.doNodeProperties(node, preq); 543 544 /* Output the (transformed) node.545 */546 547 property(CaldavTags.calendarData, content);548 520 } 549 521 trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/calquery/CalendarData.java
r423 r508 65 65 import edu.rpi.cct.webdav.servlet.shared.WebdavException; 66 66 import edu.rpi.cct.webdav.servlet.shared.WebdavNsNode; 67 import edu.rpi.cct.webdav.servlet.shared.WebdavProperty; 68 import edu.rpi.sss.util.xml.QName; 67 69 import edu.rpi.sss.util.xml.XmlUtil; 68 70 … … 88 90 * @author Mike Douglass douglm@rpi.edu 89 91 */ 90 public class CalendarData {92 public class CalendarData extends WebdavProperty { 91 93 /* 92 94 <!ELEMENT calendar-data ((comp?, (expand | … … 118 120 <!ATTLIST expand-recurrence-set start CDATA #REQUIRED 119 121 end CDATA #REQUIRED> 122 ---------------------------------------------------------------------- 123 <!ELEMENT calendar-data ((comp?, (expand | 124 limit-recurrence-set)?, 125 limit-freebusy-set?) | 126 #PCDATA)?> 127 PCDATA value: iCalendar object 128 129 <!ATTLIST calendar-data content-type CDATA "text/calendar"> 130 version CDATA "2.0"> 131 content-type value: a MIME media type 132 version value: a version string 133 134 <!ELEMENT comp ((allprop | prop*), (allcomp | comp*))> 135 136 <!ATTLIST comp name CDATA #REQUIRED> 137 name value: a calendar component name 138 139 <!ELEMENT allcomp EMPTY> 140 141 <!ELEMENT allprop EMPTY> 142 143 <!ELEMENT prop EMPTY> 144 145 <!ATTLIST prop name CDATA #REQUIRED 146 novalue (yes | no) "no"> 147 name value: a calendar property name 148 novalue value: "yes" or "no" 149 150 <!ELEMENT expand EMPTY> 151 152 <!ATTLIST expand start CDATA #REQUIRED 153 end CDATA #REQUIRED> 154 start value: an iCalendar "date with UTC time" 155 end value: an iCalendar "date with UTC time" 156 157 <!ELEMENT limit-recurrence-set EMPTY> 158 159 <!ATTLIST limit-recurrence-set start CDATA #REQUIRED 160 end CDATA #REQUIRED> 161 start value: an iCalendar "date with UTC time" 162 end value: an iCalendar "date with UTC time" 163 164 <!ELEMENT limit-freebusy-set EMPTY> 165 166 <!ATTLIST limit-freebusy-set start CDATA #REQUIRED 167 end CDATA #REQUIRED> 168 start value: an iCalendar "date with UTC time" 169 end value: an iCalendar "date with UTC time" 120 170 121 171 */ … … 132 182 /** Constructor 133 183 * 184 * @param tag QName name 134 185 * @param debug 135 186 */ 136 public CalendarData(boolean debug) { 187 public CalendarData(QName tag, 188 boolean debug) { 189 super(tag, null); 137 190 this.debug = debug; 138 191 } trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/PropFindMethod.java
r418 r508 71 71 import java.util.ArrayList; 72 72 import java.util.Collection; 73 import java.util.Enumeration;74 73 import java.util.Iterator; 75 74 import javax.servlet.http.HttpServletRequest; … … 84 83 */ 85 84 public static class PropRequest { 85 // ENUM 86 86 //private static final int reqPropNone = 0; 87 87 private static final int reqProp = 1; … … 97 97 /** For the prop element we build a Collection of WebdavProperty 98 98 */ 99 Collection props; 99 private Collection props; 100 101 /** 102 * @return Iterator 103 */ 104 public Iterator iterateProperties() { 105 if (props == null) { 106 return new ArrayList().iterator(); 107 } 108 109 return props.iterator(); 110 } 100 111 } 101 112 … … 214 225 Element propnode = children[i]; 215 226 216 WebdavProperty prop = new WebdavProperty( 217 new QName(propnode.getNamespaceURI(), 218 propnode.getLocalName()), 219 null); 227 WebdavProperty prop = makeProp(propnode); 220 228 221 229 if (debug) { … … 228 236 229 237 return pr; 238 } 239 240 /** Override this to create namespace specific property objects. 241 * 242 * @param propnode 243 * @return WebdavProperty 244 * @throws WebdavException 245 */ 246 public WebdavProperty makeProp(Element propnode) throws WebdavException { 247 return new WebdavProperty(new QName(propnode.getNamespaceURI(), 248 propnode.getLocalName()), 249 null); 230 250 } 231 251 … … 307 327 } 308 328 309 /* Build the response for a single node for a propfind request 310 */ 311 /** 329 /** Build the response for a single node for a propfind request 330 * 312 331 * @param node 313 332 * @param preq … … 368 387 */ 369 388 private void doNodeNsProperties(WebdavNsNode node) throws WebdavException { 370 Enumeration en = getNsIntf().getProperties(node);389 Iterator it = getNsIntf().iterateProperties(node); 371 390 WebdavNsIntf intf = getNsIntf(); 372 391 373 while ( en.hasMoreElements()) {374 WebdavProperty prop = (WebdavProperty) en.nextElement();392 while (it.hasNext()) { 393 WebdavProperty prop = (WebdavProperty)it.next(); 375 394 376 395 intf.generatePropValue(node, prop); trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsIntf.java
r418 r508 66 66 import java.io.Serializable; 67 67 import java.net.URL; 68 import java.util.Enumeration;69 68 import java.util.HashMap; 70 69 import java.util.Iterator; … … 389 388 * included. 390 389 * 391 * @param node node in question392 * @return Enumeration proeprties393 * @throws WebdavIntfException 394 */ 395 public abstract Enumeration getProperties(WebdavNsNode node)390 * @param node node in question 391 * @return Iterator over proprrties 392 * @throws WebdavIntfException 393 */ 394 public abstract Iterator iterateProperties(WebdavNsNode node) 396 395 throws WebdavIntfException; 397 396 … … 601 600 */ 602 601 public void generatePropValue(WebdavNsNode node, 603 WebdavProperty pr) throws WebdavIntfException {602 WebdavProperty pr) throws WebdavIntfException { 604 603 QName tag = pr.getTag(); 605 604 String ns = tag.getNamespaceURI(); … … 612 611 xml.emptyTag(tag); 613 612 closePropstat(HttpServletResponse.SC_NOT_FOUND); 613 return; 614 614 } 615 615 trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/shared/WebdavProperty.java
r2 r508 59 59 import java.io.Serializable; 60 60 import java.util.Collection; 61 import java.util. Enumeration;61 import java.util.Iterator; 62 62 63 63 /** One of these for each property in a request. … … 108 108 } 109 109 110 /** Convenience method to provide an enumeration ofthese objects110 /** Convenience method to provide an Iterator over these objects 111 111 * 112 112 * @param c 113 * @return Enumeration113 * @return Iterator 114 114 */ 115 public static Enumeration getEnumeration(Collection c) {115 public static Iterator iterator(Collection c) { 116 116 WebdavProperty[] ps = (WebdavProperty[])c.toArray( 117 117 new WebdavProperty[c.size()]); 118 return new Property Enumeration(ps);118 return new PropertyIterator(ps); 119 119 } 120 120 121 private static class Property Enumeration implements Enumeration{121 private static class PropertyIterator implements Iterator { 122 122 WebdavProperty[] ps = null; 123 123 int index; … … 127 127 * @param ps 128 128 */ 129 public Property Enumeration(WebdavProperty[] ps) {129 public PropertyIterator(WebdavProperty[] ps) { 130 130 this.ps = ps; 131 131 } 132 132 133 public boolean has MoreElements() {133 public boolean hasNext() { 134 134 if ((ps == null) || 135 135 (index >= ps.length)) { … … 140 140 } 141 141 142 public Object next Element() {142 public Object next() { 143 143 if ((ps == null) || 144 144 (index >= ps.length)) { … … 151 151 return p; 152 152 } 153 154 public void remove() { 155 throw new RuntimeException("Unimplemented"); 156 } 153 157 } 154 158 } trunk/calendar3/caldav/war/WEB-INF/userweb.xml
r310 r508 73 73 <login-config> 74 74 <auth-method>BASIC</auth-method> 75 <realm-name> rpiLdap</realm-name>75 <realm-name>@SECURITY-DOMAIN@</realm-name> 76 76 </login-config> 77 77 trunk/calendar3/config/configs/democal.properties
r469 r508 190 190 org.bedework.app.Usercaldav.context.root=ucaldav 191 191 192 org.bedework.app.Usercaldav.security.domain= null193 org.bedework.app.Usercaldav.security.prefix= null192 org.bedework.app.Usercaldav.security.domain=demo 193 org.bedework.app.Usercaldav.security.prefix=demo 194 194 org.bedework.app.Usercaldav.transport.guarantee=NONE 195 195 trunk/calendar3/test/caldavTestData/eg/content/eg02.xml
r507 r508 4 4 <D:prop> 5 5 <D:getetag/> 6 <C:calendar-data> 7 <C:comp name="VCALENDAR"> 8 <C:allprop/> 9 <C:comp name="VEVENT"> 10 <C:prop name="X-ABC-GUID"/> 11 <C:prop name="UID"/> 12 <C:prop name="DTSTART"/> 13 <C:prop name="DTEND"/> 14 <C:prop name="DURATION"/> 15 <C:prop name="EXDATE"/> 16 <C:prop name="EXRULE"/> 17 <C:prop name="RDATE"/> 18 <C:prop name="RRULE"/> 19 <C:prop name="LOCATION"/> 20 <C:prop name="SUMMARY"/> 21 </C:comp> 22 <C:comp name="VTIMEZONE"> 23 <C:allprop/> 24 <C:allcomp/> 25 </C:comp> 26 </C:comp> 27 </C:calendar-data> 6 28 </D:prop> 7 <C:calendar-data>8 <C:comp name="VCALENDAR">9 <C:allprop/>10 <C:comp name="VEVENT">11 <C:prop name="X-ABC-GUID"/>12 <C:prop name="UID"/>13 <C:prop name="DTSTART"/>14 <C:prop name="DTEND"/>15 <C:prop name="DURATION"/>16 <C:prop name="EXDATE"/>17 <C:prop name="EXRULE"/>18 <C:prop name="RDATE"/>19 <C:prop name="RRULE"/>20 <C:prop name="LOCATION"/>21 <C:prop name="SUMMARY"/>22 </C:comp>23 <C:comp name="VTIMEZONE">24 <C:allprop/>25 <C:allcomp/>26 </C:comp>27 </C:comp>28 </C:calendar-data>29 29 <C:filter> <!-- a comment --> 30 30 <C:comp-filter name="VCALENDAR"> 31 31 <C:comp-filter name="VEVENT"> 32 <C:time-range start=" 20060601T000000Z"33 end=" 20060630T235959Z"/>32 <C:time-range start="@NOW@" 33 end="@NEXTWEEK@"/> 34 34 </C:comp-filter> 35 35 </C:comp-filter>
