Changeset 418
- Timestamp:
- 04/27/06 23:57:39
- Files:
-
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java (modified) (1 diff)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwSystem.java (modified) (3 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java (modified) (9 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavURI.java (modified) (1 diff)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/ReportMethod.java (modified) (1 diff)
- trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/MethodBase.java (modified) (2 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/PropFindMethod.java (modified) (9 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsIntf.java (modified) (4 diffs)
- trunk/calendar3/common/src/edu/rpi/sss/util/xml/XmlEmit.java (modified) (2 diffs)
- trunk/calendar3/davdefs/src/org/bedework/davdefs/CaldavTags.java (modified) (3 diffs)
- trunk/calendar3/icalendar/src/org/bedework/icalendar/IcalTranslator.java (modified) (13 diffs)
- trunk/calendar3/test/caldavTestData/eg/eg15.test (modified) (1 diff)
- trunk/calendar3/test/src/org/bedework/tests/caldav/TestCalDav.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java
r415 r418 299 299 if (cal != null) { 300 300 // Need to clone for this 301 // cal.setCurrentAccess(access.checkAccess(cal, privRead, false));302 access.checkAccess(cal, desiredAccess, false);301 //access.checkAccess(cal, desiredAccess, false); 302 cal = cloneAndCheckOne(cal, desiredAccess, false); 303 303 } 304 304 trunk/calendar3/calFacade/src/org/bedework/calfacade/BwSystem.java
r64 r418 61 61 /** System settings for an instance of bedework as represented by a single 62 62 * database. These settings may be changed by the super user but most should 63 * not be changed after system initialisation. .63 * not be changed after system initialisation. 64 64 * 65 65 * @author Mike Douglass douglm@rpi.edu … … 96 96 private long defaultUserQuota = 1000000 * 10; // 10 Meg OK? 97 97 98 private int maxInstances; 99 98 100 private String userauthClass; 99 101 private String mailerClass; … … 387 389 public long getDefaultUserQuota() { 388 390 return defaultUserQuota; 391 } 392 393 /** Set the max instances per recurring event. 394 * 395 * @param val int max 396 */ 397 public void setMaxInstances(int val) { 398 maxInstances = val; 399 } 400 401 /** 402 * 403 * @return int 404 */ 405 public int getMaxInstances() { 406 return maxInstances; 389 407 } 390 408 trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java
r331 r418 85 85 import edu.rpi.cct.webdav.servlet.shared.WebdavNsNode; 86 86 import edu.rpi.cct.webdav.servlet.shared.WebdavProperty; 87 import edu.rpi.sss.util.xml.QName; 88 89 import net.fortuna.ical4j.model.TimeZone; 87 90 88 91 import java.io.IOException; … … 100 103 import javax.servlet.ServletContext; 101 104 import javax.servlet.http.HttpServletRequest; 105 import javax.servlet.http.HttpServletResponse; 102 106 import javax.servlet.http.HttpSession; 103 107 … … 124 128 */ 125 129 private String namespacePrefix; 126 130 127 131 private EmitAccess emitAccess; 128 132 … … 172 176 boolean debug) throws WebdavIntfException { 173 177 super.init(servlet, req, props, debug); 174 178 175 179 try { 176 180 HttpSession session = req.getSession(); 177 181 ServletContext sc = session.getServletContext(); 178 182 179 183 String appName = sc.getInitParameter("bwappname"); 180 184 181 185 if ((appName == null) || (appName.length() == 0)) { 182 186 appName = "unknown-app-name"; 183 187 } 184 188 185 189 envPrefix = "org.bedework.app." + appName + "."; 186 190 187 191 namespacePrefix = WebdavUtils.getUrlPrefix(req); 188 192 namespace = namespacePrefix + "/schema"; … … 190 194 publicCalendarRoot = getSvci().getSyspars().getPublicCalendarRoot(); 191 195 userCalendarRoot = getSvci().getSyspars().getUserCalendarRoot(); 192 196 193 197 emitAccess = new EmitAccess(namespacePrefix, xml); 194 198 } catch (Throwable t) { … … 790 794 } 791 795 792 info.aces.add(new Ace(info.who, info.notWho, info.whoType, 796 info.aces.add(new Ace(info.who, info.notWho, info.whoType, 793 797 Privileges.makePriv(priv))); 794 798 } … … 837 841 } 838 842 } 839 843 840 844 public void emitSupportedPrivSet(WebdavNsNode node) throws WebdavIntfException { 841 845 try { … … 1012 1016 * ==================================================================== */ 1013 1017 1018 /** Generate a response for a single webdav property. This should be overrriden 1019 * to handle other namespaces. 1020 * 1021 * @param node 1022 * @param pr 1023 * @throws WebdavIntfException 1024 */ 1025 public void generatePropValue(WebdavNsNode node, 1026 WebdavProperty pr) throws WebdavIntfException { 1027 QName tag = pr.getTag(); 1028 String ns = tag.getNamespaceURI(); 1029 boolean isCalendar = node instanceof CaldavCalNode; 1030 CaldavCalNode calNode = null; 1031 BwCalendar cal = null; 1032 1033 if (isCalendar) { 1034 calNode = (CaldavCalNode)node; 1035 cal = calNode.getCDURI().getCal(); 1036 } 1037 1038 try { 1039 /* Deal with webdav properties */ 1040 if (!ns.equals(CaldavDefs.caldavNamespace)) { 1041 // Not ours 1042 super.generatePropValue(node, pr); 1043 return; 1044 } 1045 1046 if (tag.equals(CaldavTags.calendarDescription)) { 1047 if ((cal != null) && (cal.getDescription() != null)) { 1048 // XXX lang 1049 openPropstat(); 1050 xml.property(tag, cal.getDescription()); 1051 closePropstat(); 1052 } 1053 } else if (tag.equals(CaldavTags.calendarTimezone)) { 1054 TimeZone tz = getSvci().getTimezones().getDefaultTimeZone(); 1055 openPropstat(); 1056 xml.property(tag, trans.toStringTzCalendar(tz.getID())); 1057 closePropstat(); 1058 } else if (tag.equals(CaldavTags.supportedCalendarComponentSet)) { 1059 /* e.g. 1060 * <C:supported-calendar-component-set 1061 * xmlns:C="urn:ietf:params:xml:ns:caldav"> 1062 * <C:comp name="VEVENT"/> 1063 * <C:comp name="VTODO"/> 1064 * </C:supported-calendar-component-set> 1065 */ 1066 openPropstat(); 1067 xml.openTag(tag); 1068 xml.startTag(CaldavTags.comp); 1069 xml.atribute("name", "VEVENT"); 1070 xml.closeTag(tag); 1071 closePropstat(); 1072 } else if (tag.equals(CaldavTags.supportedCalendarData)) { 1073 /* e.g. 1074 * <C:supported-calendar-data 1075 * xmlns:C="urn:ietf:params:xml:ns:caldav"> 1076 * <C:calendar-data content-type="text/calendar" version="2.0"/> 1077 * </C:supported-calendar-data> 1078 */ 1079 openPropstat(); 1080 xml.openTag(tag); 1081 xml.startTag(CaldavTags.calendarData); 1082 xml.atribute("content-type", "text/calendar"); 1083 xml.atribute("version", "2.0"); 1084 xml.closeTag(tag); 1085 closePropstat(); 1086 } else if (tag.equals(CaldavTags.maxAttendeesPerInstance)) { 1087 } else if (tag.equals(CaldavTags.maxDateTime)) { 1088 } else if (tag.equals(CaldavTags.maxInstances)) { 1089 } else if (tag.equals(CaldavTags.maxResourceSize)) { 1090 /* e.g. 1091 * <C:max-resource-size 1092 * xmlns:C="urn:ietf:params:xml:ns:caldav">102400</C:max-resource-size> 1093 */ 1094 openPropstat(); 1095 xml.property(tag, String.valueOf(getSvci().getSyspars().getMaxUserEntitySize())); 1096 closePropstat(); 1097 } else if (tag.equals(CaldavTags.minDateTime)) { 1098 } else { 1099 // Not known 1100 openPropstat(); 1101 xml.emptyTag(tag); 1102 closePropstat(HttpServletResponse.SC_NOT_FOUND); 1103 } 1104 } catch (WebdavIntfException wie) { 1105 throw wie; 1106 } catch (Throwable t) { 1107 throw new WebdavIntfException(t); 1108 } 1109 } 1110 1014 1111 public void generatePropResourcetype(WebdavNsNode node) 1015 1112 throws WebdavIntfException { … … 1192 1289 * user, if non-null, is the user calendar we want to access. 1193 1290 */ 1194 CalSvcIPars pars = new CalSvcIPars(account, 1291 CalSvcIPars pars = new CalSvcIPars(account, 1195 1292 account, 1196 1293 envPrefix, trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavURI.java
r2 r418 76 76 77 77 String entityName; 78 79 CaldavURI(boolean ispublic, BwCalendar cal) {80 init(ispublic, cal, null);81 }82 78 83 79 CaldavURI(boolean ispublic, BwCalendar cal, String entityName) { trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/ReportMethod.java
r310 r418 455 455 456 456 if (status != HttpServletResponse.SC_OK) { 457 pm.doNodeProperties(node, null, status); 457 openTag(WebdavTags.propstat); 458 459 property(WebdavTags.status, "HTTP/1.1 " + status + " " + 460 WebdavStatusCode.getMessage(status)); 461 462 closeTag(WebdavTags.propstat); 458 463 } else if (reportType == reportTypeExpandProperty) { 459 464 } else { 460 pm.doNodeProperties(node, preq , status);465 pm.doNodeProperties(node, preq); 461 466 462 467 /* Output the (transformed) node. trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/MethodBase.java
r278 r418 110 110 public abstract void init(); 111 111 112 private SimpleDateFormat httpDateFormatter = 112 private SimpleDateFormat httpDateFormatter = 113 113 new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss "); 114 114 … … 482 482 protected String getEntityTag(WebdavNsNode node, boolean strong) 483 483 throws WebdavException { 484 String val = getNsIntf().getEtagValue(node, strong); 485 486 if (strong) { 487 return "\"" + val + "\""; 488 } 489 490 return "W/\"" + val + "\""; 484 return getNsIntf().getEntityTag(node, strong); 491 485 } 492 486 trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/PropFindMethod.java
r310 r418 58 58 59 59 import edu.rpi.cct.webdav.servlet.shared.WebdavException; 60 import edu.rpi.cct.webdav.servlet.shared.WebdavNsIntf; 60 61 import edu.rpi.cct.webdav.servlet.shared.WebdavNsNode; 61 62 import edu.rpi.cct.webdav.servlet.shared.WebdavProperty; … … 68 69 69 70 import java.net.URI; 71 import java.util.ArrayList; 72 import java.util.Collection; 70 73 import java.util.Enumeration; 71 74 import java.util.Iterator; 72 import java.util.Vector;73 75 import javax.servlet.http.HttpServletRequest; 74 76 import javax.servlet.http.HttpServletResponse; … … 95 97 /** For the prop element we build a Collection of WebdavProperty 96 98 */ 97 Vectorprops;99 Collection props; 98 100 } 99 101 … … 205 207 public PropRequest parseProps(Node nd) throws WebdavException { 206 208 PropRequest pr = new PropRequest(PropRequest.reqProp); 207 pr.props = new Vector();209 pr.props = new ArrayList(); 208 210 209 211 Element[] children = getChildren(nd); … … 222 224 addNs(prop.getTag().getNamespaceURI()); 223 225 224 pr.props.add Element(prop);226 pr.props.add(prop); 225 227 } 226 228 … … 258 260 } 259 261 260 /** 262 /** Generate response for a PROPFIND for the current node, then for the children. 263 * 261 264 * @param node 262 265 * @param pr 263 * @param status264 266 * @throws WebdavException 265 267 */ 266 268 public void doNodeProperties(WebdavNsNode node, 267 PropRequest pr, 268 int status) throws WebdavException { 269 PropRequest pr) throws WebdavException { 269 270 addHref(node); 270 271 271 openTag(WebdavTags.propstat); 272 273 if (pr != null) { 274 openTag(WebdavTags.prop); 275 276 if (status == HttpServletResponse.SC_OK) { 277 if (node.getExists()) { 278 if (pr.reqType == PropRequest.reqProp) { 279 status = doPropFind(node, pr); 280 } else if (pr.reqType == PropRequest.reqPropName) { 281 status = doPropNames(node); 282 } else if (pr.reqType == PropRequest.reqPropAll) { 283 status = doPropAll(node); 284 } 285 } else { 286 status = HttpServletResponse.SC_NOT_FOUND; 287 } 288 } 289 290 closeTag(WebdavTags.prop); 291 } 292 293 if ((status != HttpServletResponse.SC_OK) || 294 getNsIntf().getReturnMultistatusOk()) { 295 property(WebdavTags.status, "HTTP/1.1 " + status + " " + 296 WebdavStatusCode.getMessage(status)); 297 } 298 299 closeTag(WebdavTags.propstat); 272 if ((pr != null) && (node.getExists())) { 273 if (pr.reqType == PropRequest.reqProp) { 274 doPropFind(node, pr); 275 } else if (pr.reqType == PropRequest.reqPropName) { 276 doPropNames(node); 277 } else if (pr.reqType == PropRequest.reqPropAll) { 278 doPropAll(node); 279 } 280 } 300 281 } 301 282 … … 305 286 openTag(WebdavTags.response); 306 287 307 doNodeProperties(node, parsedReq , HttpServletResponse.SC_OK);288 doNodeProperties(node, parsedReq); 308 289 309 290 closeTag(WebdavTags.response); … … 328 309 /* Build the response for a single node for a propfind request 329 310 */ 330 private int doPropFind(WebdavNsNode node, PropRequest preq) throws WebdavException { 331 Enumeration en = preq.props.elements(); 332 333 while (en.hasMoreElements()) { 334 WebdavProperty pr = (WebdavProperty)en.nextElement(); 335 QName tag = pr.getTag(); 336 String ns = tag.getNamespaceURI(); 337 338 /* Deal with webdav properties */ 339 if (ns.equals(WebdavTags.namespace)) { 340 if (tag.equals(WebdavTags.creationdate)) { 341 // dav 13.1 342 if (node.getCreDate() != null) { 343 property(WebdavTags.creationdate, node.getCreDate()); 344 } 345 } else if (tag.equals(WebdavTags.displayname)) { 346 // dav 13.2 347 property(WebdavTags.displayname, node.getName()); 348 } else if (tag.equals(WebdavTags.getcontentlanguage)) { 349 // dav 13.3 350 } else if (tag.equals(WebdavTags.getcontentlength)) { 351 // dav 13.4 352 } else if (tag.equals(WebdavTags.getcontenttype)) { 353 // dav 13.5 354 getNsIntf().generatePropContenttype(node); 355 } else if (tag.equals(WebdavTags.getetag)) { 356 // dav 13.6 357 property(WebdavTags.getetag, getEntityTag(node, true)); 358 } else if (tag.equals(WebdavTags.getlastmodified)) { 359 // dav 13.7 360 if (node.getLastmodDate() != null) { 361 property(WebdavTags.getlastmodified, node.getLastmodDate()); 362 } 363 } else if (tag.equals(WebdavTags.lockdiscovery)) { 364 // dav 13.8 365 } else if (tag.equals(WebdavTags.resourcetype)) { 366 // dav 13.9 367 getNsIntf().generatePropResourcetype(node); 368 } else if (tag.equals(WebdavTags.source)) { 369 // dav 13.10 370 } else if (tag.equals(WebdavTags.supportedlock)) { 371 // dav 13.11 372 } else if (tag.equals(WebdavTags.owner)) { 373 // access 5.1 374 openTag(WebdavTags.owner); 375 property(WebdavTags.href, getNsIntf().makeUserHref(node.getOwner())); 376 closeTag(WebdavTags.owner); 377 } else if (tag.equals(WebdavTags.supportedPrivilegeSet)) { 378 // access 5.2 379 getNsIntf().emitSupportedPrivSet(node); 380 } else if (tag.equals(WebdavTags.currentUserPrivilegeSet)) { 381 // access 5.3 382 } else if (tag.equals(WebdavTags.acl)) { 383 // access 5.4 384 getNsIntf().emitAcl(node); 385 } else if (tag.equals(WebdavTags.aclRestrictions)) { 386 // access 5.5 387 } else if (tag.equals(WebdavTags.inheritedAclSet)) { 388 // access 5.6 389 } else if (tag.equals(WebdavTags.principalCollectionSet)) { 390 // access 5.7 391 } 392 } else { 393 } 394 } 395 396 return HttpServletResponse.SC_OK; 311 /** 312 * @param node 313 * @param preq 314 * @throws WebdavException 315 */ 316 private void doPropFind(WebdavNsNode node, PropRequest preq) throws WebdavException { 317 Iterator it = preq.props.iterator(); 318 WebdavNsIntf intf = getNsIntf(); 319 320 while (it.hasNext()) { 321 WebdavProperty pr = (WebdavProperty)it.next(); 322 intf.generatePropValue(node, pr); 323 } 397 324 } 398 325 … … 442 369 private void doNodeNsProperties(WebdavNsNode node) throws WebdavException { 443 370 Enumeration en = getNsIntf().getProperties(node); 371 WebdavNsIntf intf = getNsIntf(); 444 372 445 373 while (en.hasMoreElements()) { 446 374 WebdavProperty prop = (WebdavProperty)en.nextElement(); 447 375 448 property(prop.getTag(), prop.getPval());376 intf.generatePropValue(node, prop); 449 377 } 450 378 } trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsIntf.java
r310 r418 57 57 import org.bedework.davdefs.WebdavTags; 58 58 59 import edu.rpi.sss.util.xml.QName; 59 60 import edu.rpi.sss.util.xml.XmlEmit; 60 61 import edu.rpi.sss.util.xml.XmlUtil; … … 70 71 import java.util.Properties; 71 72 import javax.servlet.http.HttpServletRequest; 73 import javax.servlet.http.HttpServletResponse; 72 74 73 75 import org.apache.log4j.Logger; … … 549 551 * ==================================================================== */ 550 552 553 /** Open a propstat response. 554 * 555 * @throws WebdavIntfException 556 */ 557 public void openPropstat() throws WebdavIntfException { 558 try { 559 xml.openTag(WebdavTags.propstat); 560 xml.openTag(WebdavTags.prop); 561 } catch (Throwable t) { 562 throw new WebdavIntfException(t); 563 } 564 } 565 566 /** Close a propstat response with given result. 567 * 568 * @param status 569 * @throws WebdavIntfException 570 */ 571 public void closePropstat(int status) throws WebdavIntfException { 572 try { 573 xml.closeTag(WebdavTags.prop); 574 575 if ((status != HttpServletResponse.SC_OK) || 576 getReturnMultistatusOk()) { 577 xml.property(WebdavTags.status, "HTTP/1.1 " + status + " " + 578 WebdavStatusCode.getMessage(status)); 579 } 580 581 xml.closeTag(WebdavTags.propstat); 582 } catch (Throwable t) { 583 throw new WebdavIntfException(t); 584 } 585 } 586 587 /** Close a propstat response with an ok result. 588 * 589 * @throws WebdavIntfException 590 */ 591 public void closePropstat() throws WebdavIntfException { 592 closePropstat(HttpServletResponse.SC_OK); 593 } 594 595 /** Generate a response for a single webdav property. This should be overrriden 596 * to handle other namespaces. 597 * 598 * @param node 599 * @param pr 600 * @throws WebdavIntfException 601 */ 602 public void generatePropValue(WebdavNsNode node, 603 WebdavProperty pr) throws WebdavIntfException { 604 QName tag = pr.getTag(); 605 String ns = tag.getNamespaceURI(); 606 607 try { 608 /* Deal with webdav properties */ 609 if (!ns.equals(WebdavTags.namespace)) { 610 // Not ours 611 openPropstat(); 612 xml.emptyTag(tag); 613 closePropstat(HttpServletResponse.SC_NOT_FOUND); 614 } 615 616 if (tag.equals(WebdavTags.creationdate)) { 617 // dav 13.1 618 if (node.getCreDate() != null) { 619 openPropstat(); 620 xml.property(tag, node.getCreDate()); 621 closePropstat(); 622 } 623 } else if (tag.equals(WebdavTags.displayname)) { 624 // dav 13.2 625 openPropstat(); 626 xml.property(tag, node.getName()); 627 closePropstat(); 628 } else if (tag.equals(WebdavTags.getcontentlanguage)) { 629 // dav 13.3 630 } else if (tag.equals(WebdavTags.getcontentlength)) { 631 // dav 13.4 632 } else if (tag.equals(WebdavTags.getcontenttype)) { 633 // dav 13.5 634 openPropstat(); 635 generatePropContenttype(node); 636 closePropstat(); 637 } else if (tag.equals(WebdavTags.getetag)) { 638 // dav 13.6 639 openPropstat(); 640 xml.property(tag, getEntityTag(node, true)); 641 closePropstat(); 642 } else if (tag.equals(WebdavTags.getlastmodified)) { 643 // dav 13.7 644 if (node.getLastmodDate() != null) { 645 openPropstat(); 646 xml.property(tag, node.getLastmodDate()); 647 closePropstat(); 648 } 649 } else if (tag.equals(WebdavTags.lockdiscovery)) { 650 // dav 13.8 651 } else if (tag.equals(WebdavTags.resourcetype)) { 652 // dav 13.9 653 openPropstat(); 654 generatePropResourcetype(node); 655 closePropstat(); 656 } else if (tag.equals(WebdavTags.source)) { 657 // dav 13.10 658 } else if (tag.equals(WebdavTags.supportedlock)) { 659 // dav 13.11 660 } else if (tag.equals(WebdavTags.owner)) { 661 // access 5.1 662 openPropstat(); 663 xml.openTag(tag); 664 xml.property(WebdavTags.href, makeUserHref(node.getOwner())); 665 xml.closeTag(tag); 666 closePropstat(); 667 } else if (tag.equals(WebdavTags.supportedPrivilegeSet)) { 668 // access 5.2 669 openPropstat(); 670 emitSupportedPrivSet(node); 671 closePropstat(); 672 } else if (tag.equals(WebdavTags.currentUserPrivilegeSet)) { 673 // access 5.3 674 } else if (tag.equals(WebdavTags.acl)) { 675 // access 5.4 676 openPropstat(); 677 emitAcl(node); 678 closePropstat(); 679 } else if (tag.equals(WebdavTags.aclRestrictions)) { 680 // access 5.5 681 } else if (tag.equals(WebdavTags.inheritedAclSet)) { 682 // access 5.6 683 } else if (tag.equals(WebdavTags.principalCollectionSet)) { 684 // access 5.7 685 } else { 686 // Not known 687 openPropstat(); 688 xml.emptyTag(tag); 689 closePropstat(HttpServletResponse.SC_NOT_FOUND); 690 } 691 } catch (WebdavIntfException wie) { 692 throw wie; 693 } catch (Throwable t) { 694 throw new WebdavIntfException(t); 695 } 696 } 697 551 698 /** Generate content type. 552 699 * … … 583 730 } 584 731 732 /** Entity tags are defined in RFC2068 - they are supposed to provide some 733 * sort of indication the data has changed - e.g. a checksum. 734 * <p>There are weak and strong tags 735 * 736 * @param node 737 * @param strong 738 * @return String tag 739 * @throws WebdavException 740 */ 741 public String getEntityTag(WebdavNsNode node, boolean strong) 742 throws WebdavException { 743 String val = getEtagValue(node, strong); 744 745 if (strong) { 746 return "\"" + val + "\""; 747 } 748 749 return "W/\"" + val + "\""; 750 } 751 585 752 /* ==================================================================== 586 753 * XmlUtil wrappers trunk/calendar3/common/src/edu/rpi/sss/util/xml/XmlEmit.java
r415 r418 208 208 } 209 209 210 /** Start tag ready for attributes 211 * 212 * @param tag 213 * @throws IOException 214 */ 215 public void startTag(QName tag) throws IOException { 216 blanks(); 217 startTagSameLine(tag); 218 } 219 220 /** Add an attribute 221 * 222 * @param attrName 223 * @param attrVal 224 * @throws IOException 225 */ 226 public void atribute(String attrName, String attrVal) throws IOException { 227 wtr.write(" "); 228 wtr.write(attrName); 229 wtr.write("="); 230 quote(attrVal); 231 } 232 233 /** End an empty tag 234 * 235 * @throws IOException 236 */ 237 public void endEmptyTag() throws IOException { 238 wtr.write(" /"); 239 rb(); 240 } 241 210 242 /** 211 243 * @param tag … … 217 249 wtr.write("/"); 218 250 rb(); 251 } 252 253 /** 254 * @param tag 255 * @throws IOException 256 */ 257 public void startTagSameLine(QName tag) throws IOException { 258 lb(); 259 tagname(tag); 260 } 261 262 private void quote(String val) throws IOException { 263 if (val.indexOf("\"") < 0) { 264 wtr.write("\""); 265 wtr.write(val); 266 wtr.write("\""); 267 } else { 268 wtr.write("'"); 269 wtr.write(val); 270 wtr.write("'"); 271 } 219 272 } 220 273 trunk/calendar3/davdefs/src/org/bedework/davdefs/CaldavTags.java
r417 r418 83 83 84 84 /** */ 85 public static final QName calendarTimezone = new QName(caldavNamespace, 86 "calendar-timezone"); 87 88 /** */ 85 89 public static final QName calendarMultiget = new QName(caldavNamespace, 86 90 "calendar-multiget"); … … 127 131 128 132 /** */ 133 public static final QName maxAttendeesPerInstance = new QName(caldavNamespace, 134 "max-attendees-per-instance"); 135 136 /** */ 137 public static final QName maxDateTime = new QName(caldavNamespace, 138 "max-date-time"); 139 140 /** */ 141 public static final QName maxInstances = new QName(caldavNamespace, 142 "max-instances"); 143 144 /** */ 145 public static final QName maxResourceSize = new QName(caldavNamespace, 146 "max-resource-size"); 147 148 /** */ 149 public static final QName minDateTime = new QName(caldavNamespace, 150 "min-date-time"); 151 152 /** */ 129 153 public static final QName paramFilter = new QName(caldavNamespace, 130 154 "param-filter"); … … 147 171 148 172 /** */ 173 public static final QName supportedCalendarComponentSet = new QName(caldavNamespace, 174 "supported-calendar-component-set"); 175 176 /** */ 177 public static final QName supportedCalendarData = new QName(caldavNamespace, 178 "supported-calendar-data"); 179 180 /** */ 149 181 public static final QName textMatch = new QName(caldavNamespace, 150 182 "text-match"); trunk/calendar3/icalendar/src/org/bedework/icalendar/IcalTranslator.java
r298 r418 154 154 * @throws CalFacadeException 155 155 */ 156 public Calendar newIcal() throws CalFacadeException {156 public static Calendar newIcal() throws CalFacadeException { 157 157 Calendar cal = new Calendar(); 158 158 … … 173 173 return null; 174 174 } 175 175 176 176 HashMap added = new HashMap(); 177 177 … … 203 203 return null; 204 204 } 205 205 206 206 HashMap added = new HashMap(); 207 207 … … 228 228 } 229 229 230 /** Make a VEvent object from a n EventVO.230 /** Make a VEvent object from a BwEvent. 231 231 * 232 232 * @param val … … 238 238 } 239 239 240 /** Convert the EventVOobject to a String representation240 /** Convert the BwEvent object to a String representation 241 241 * 242 242 * @param val … … 277 277 278 278 UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); 279 279 280 280 //return fromIcal(cal, bldr.build(new UnfoldingReader(new StringReader(val)))); 281 281 return fromIcal(cal, bldr.build(ufrdr)); … … 366 366 367 367 UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); 368 368 369 369 return bldr.build(ufrdr); 370 370 } catch (CalFacadeException cfe) { … … 375 375 } 376 376 377 /** Create a Calendar object from the named timezone 378 * 379 * @param tzid String timezone id 380 * @return Calendar 381 * @throws CalFacadeException 382 */ 383 public Calendar getTzCalendar(String tzid) throws CalFacadeException { 384 try { 385 Calendar cal = newIcal(); 386 387 addIcalTimezone(cal, tzid, null, null); 388 389 return cal; 390 } catch (CalFacadeException cfe) { 391 throw cfe; 392 } catch (Throwable t) { 393 throw new CalFacadeException(t); 394 } 395 } 396 397 /** Create a Calendar object from the named timezone and convert to 398 * a String representation 399 * 400 * @param tzid String timezone id 401 * @return String 402 * @throws CalFacadeException 403 */ 404 public String toStringTzCalendar(String tzid) throws CalFacadeException { 405 Calendar ical = getTzCalendar(tzid); 406 407 CalendarOutputter calOut = new CalendarOutputter(true); 408 409 StringWriter sw = new StringWriter(); 410 411 try { 412 calOut.output(ical, sw); 413 414 return sw.toString(); 415 } catch (Throwable t) { 416 throw new CalFacadeException(t); 417 } 418 } 419 377 420 /** Convert the given string representation of an Icalendar object to a 378 421 * collection of VEvent … … 391 434 392 435 UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); 393 436 394 437 Calendar cal = bldr.build(ufrdr); 395 438 Vector evs = new Vector(); … … 510 553 * and add it to the calendar. 511 554 */ 512 private void addIcalTimezones(Calendar cal, BwEvent ev, 555 private void addIcalTimezones(Calendar cal, BwEvent ev, 513 556 HashMap added) throws CalFacadeException { 514 557 BwUser owner = ev.getOwner(); … … 520 563 } 521 564 } 522 523 private void addIcalTimezone(Calendar cal, String tzid, 524 BwUser owner, 565 566 private void addIcalTimezone(Calendar cal, String tzid, 567 BwUser owner, 525 568 HashMap added) throws CalFacadeException { 526 569 VTimeZone vtz; 527 528 if ((tzid == null) || added.containsKey(tzid)) { 570 571 if ((tzid == null) || 572 ((added != null) && added.containsKey(tzid))) { 529 573 return; 530 574 } … … 533 577 debugMsg("Look for timezone with id " + tzid); 534 578 } 535 579 536 580 vtz = cb.findTimeZone(tzid, owner); 537 581 if (vtz != null) { … … 543 587 debugMsg("Didn't find timezone with id " + tzid); 544 588 } 545 546 added.put(tzid, null); 547 } 548 589 590 if (added != null) { 591 added.put(tzid, null); 592 } 593 } 594 549 595 private static void setSystemProperties() throws CalFacadeException { 550 596 try { trunk/calendar3/test/caldavTestData/eg/eg15.test
r2 r418 11 11 CONTENTTYPE: text/xml 12 12 13 CONTENT: 14 <?xml version="1.0" encoding="utf-8" ?> 15 <D:propfind xmlns:D="DAV:"> 16 <D:prop> 17 <D:getetag/> 18 <D:owner/> 19 <D:acl/> 20 </D:prop> 21 </D:propfind> 13 CONTENTFILE: content/eg15.xml 22 14 trunk/calendar3/test/src/org/bedework/tests/caldav/TestCalDav.java
r310 r418 80 80 //import java.net.Authenticator; 81 81 //import java.net.PasswordAuthentication; 82 import java.util.ArrayList; 82 83 import java.util.Iterator; 83 84 import java.util.TreeSet; … … 162 163 } 163 164 164 private static Vector results = new Vector();165 private static ArrayList results = new ArrayList(); 165 166 166 167 /** Main method … … 187 188 // Either use the test list or the sorted directory contents. 188 189 189 Vector tests = new Vector();190 ArrayList tests = new ArrayList(); 190 191 191 192 if (testListName != null) {
