Changeset 418

Show
Ignore:
Timestamp:
04/27/06 23:57:39
Author:
douglm
Message:

Add caldav properties and process them

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java

    r415 r418  
    299299    if (cal != null) { 
    300300      // 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); 
    303303    } 
    304304 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwSystem.java

    r64 r418  
    6161/** System settings for an instance of bedework as represented by a single 
    6262 * 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. 
    6464 * 
    6565 * @author Mike Douglass       douglm@rpi.edu 
     
    9696  private long defaultUserQuota = 1000000 * 10; // 10 Meg OK? 
    9797 
     98  private int maxInstances; 
     99 
    98100  private String userauthClass; 
    99101  private String mailerClass; 
     
    387389  public long getDefaultUserQuota() { 
    388390    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; 
    389407  } 
    390408 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java

    r331 r418  
    8585import edu.rpi.cct.webdav.servlet.shared.WebdavNsNode; 
    8686import edu.rpi.cct.webdav.servlet.shared.WebdavProperty; 
     87import edu.rpi.sss.util.xml.QName; 
     88 
     89import net.fortuna.ical4j.model.TimeZone; 
    8790 
    8891import java.io.IOException; 
     
    100103import javax.servlet.ServletContext; 
    101104import javax.servlet.http.HttpServletRequest; 
     105import javax.servlet.http.HttpServletResponse; 
    102106import javax.servlet.http.HttpSession; 
    103107 
     
    124128   */ 
    125129  private String namespacePrefix; 
    126    
     130 
    127131  private EmitAccess emitAccess; 
    128132 
     
    172176                   boolean debug) throws WebdavIntfException { 
    173177    super.init(servlet, req, props, debug); 
    174      
     178 
    175179    try { 
    176180      HttpSession session = req.getSession(); 
    177181      ServletContext sc = session.getServletContext(); 
    178        
     182 
    179183      String appName = sc.getInitParameter("bwappname"); 
    180        
     184 
    181185      if ((appName == null) || (appName.length() == 0)) { 
    182186        appName = "unknown-app-name"; 
    183187      } 
    184        
     188 
    185189      envPrefix = "org.bedework.app." + appName + "."; 
    186        
     190 
    187191      namespacePrefix = WebdavUtils.getUrlPrefix(req); 
    188192      namespace = namespacePrefix + "/schema"; 
     
    190194      publicCalendarRoot = getSvci().getSyspars().getPublicCalendarRoot(); 
    191195      userCalendarRoot = getSvci().getSyspars().getUserCalendarRoot(); 
    192        
     196 
    193197      emitAccess = new EmitAccess(namespacePrefix, xml); 
    194198    } catch (Throwable t) { 
     
    790794    } 
    791795 
    792     info.aces.add(new Ace(info.who, info.notWho, info.whoType,  
     796    info.aces.add(new Ace(info.who, info.notWho, info.whoType, 
    793797                          Privileges.makePriv(priv))); 
    794798  } 
     
    837841    } 
    838842  } 
    839    
     843 
    840844  public void emitSupportedPrivSet(WebdavNsNode node) throws WebdavIntfException { 
    841845    try { 
     
    10121016   * ==================================================================== */ 
    10131017 
     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 
    10141111  public void generatePropResourcetype(WebdavNsNode node) 
    10151112          throws WebdavIntfException { 
     
    11921289       * user, if non-null, is the user calendar we want to access. 
    11931290       */ 
    1194       CalSvcIPars pars = new CalSvcIPars(account,  
     1291      CalSvcIPars pars = new CalSvcIPars(account, 
    11951292                                         account, 
    11961293                                         envPrefix, 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavURI.java

    r2 r418  
    7676 
    7777  String entityName; 
    78  
    79   CaldavURI(boolean ispublic, BwCalendar cal) { 
    80     init(ispublic, cal, null); 
    81   } 
    8278 
    8379  CaldavURI(boolean ispublic, BwCalendar cal, String entityName) { 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/ReportMethod.java

    r310 r418  
    455455 
    456456    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); 
    458463    } else if (reportType == reportTypeExpandProperty) { 
    459464    } else { 
    460       pm.doNodeProperties(node, preq, status); 
     465      pm.doNodeProperties(node, preq); 
    461466 
    462467      /* Output the (transformed) node. 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/MethodBase.java

    r278 r418  
    110110  public abstract void init(); 
    111111 
    112   private SimpleDateFormat httpDateFormatter =  
     112  private SimpleDateFormat httpDateFormatter = 
    113113      new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss "); 
    114114 
     
    482482  protected String getEntityTag(WebdavNsNode node, boolean strong) 
    483483      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); 
    491485  } 
    492486 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/PropFindMethod.java

    r310 r418  
    5858 
    5959import edu.rpi.cct.webdav.servlet.shared.WebdavException; 
     60import edu.rpi.cct.webdav.servlet.shared.WebdavNsIntf; 
    6061import edu.rpi.cct.webdav.servlet.shared.WebdavNsNode; 
    6162import edu.rpi.cct.webdav.servlet.shared.WebdavProperty; 
     
    6869 
    6970import java.net.URI; 
     71import java.util.ArrayList; 
     72import java.util.Collection; 
    7073import java.util.Enumeration; 
    7174import java.util.Iterator; 
    72 import java.util.Vector; 
    7375import javax.servlet.http.HttpServletRequest; 
    7476import javax.servlet.http.HttpServletResponse; 
     
    9597    /** For the prop element we build a Collection of WebdavProperty 
    9698     */ 
    97     Vector props; 
     99    Collection props; 
    98100  } 
    99101 
     
    205207  public PropRequest parseProps(Node nd) throws WebdavException { 
    206208    PropRequest pr = new PropRequest(PropRequest.reqProp); 
    207     pr.props = new Vector(); 
     209    pr.props = new ArrayList(); 
    208210 
    209211    Element[] children = getChildren(nd); 
     
    222224      addNs(prop.getTag().getNamespaceURI()); 
    223225 
    224       pr.props.addElement(prop); 
     226      pr.props.add(prop); 
    225227    } 
    226228 
     
    258260  } 
    259261 
    260   /** 
     262  /** Generate response for a PROPFIND for the current node, then for the children. 
     263   * 
    261264   * @param node 
    262265   * @param pr 
    263    * @param status 
    264266   * @throws WebdavException 
    265267   */ 
    266268  public void doNodeProperties(WebdavNsNode node, 
    267                                 PropRequest pr, 
    268                                 int status) throws WebdavException { 
     269                                PropRequest pr) throws WebdavException { 
    269270    addHref(node); 
    270271 
    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    } 
    300281  } 
    301282 
     
    305286    openTag(WebdavTags.response); 
    306287 
    307     doNodeProperties(node, parsedReq, HttpServletResponse.SC_OK); 
     288    doNodeProperties(node, parsedReq); 
    308289 
    309290    closeTag(WebdavTags.response); 
     
    328309  /* Build the response for a single node for a propfind request 
    329310   */ 
    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    } 
    397324  } 
    398325 
     
    442369  private void doNodeNsProperties(WebdavNsNode node) throws WebdavException { 
    443370    Enumeration en = getNsIntf().getProperties(node); 
     371    WebdavNsIntf intf = getNsIntf(); 
    444372 
    445373    while (en.hasMoreElements()) { 
    446374      WebdavProperty prop = (WebdavProperty)en.nextElement(); 
    447375 
    448       property(prop.getTag(), prop.getPval()); 
     376      intf.generatePropValue(node, prop); 
    449377    } 
    450378  } 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsIntf.java

    r310 r418  
    5757import org.bedework.davdefs.WebdavTags; 
    5858 
     59import edu.rpi.sss.util.xml.QName; 
    5960import edu.rpi.sss.util.xml.XmlEmit; 
    6061import edu.rpi.sss.util.xml.XmlUtil; 
     
    7071import java.util.Properties; 
    7172import javax.servlet.http.HttpServletRequest; 
     73import javax.servlet.http.HttpServletResponse; 
    7274 
    7375import org.apache.log4j.Logger; 
     
    549551   * ==================================================================== */ 
    550552 
     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 
    551698  /** Generate content type. 
    552699   * 
     
    583730  } 
    584731 
     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 
    585752  /* ==================================================================== 
    586753   *                   XmlUtil wrappers 
  • trunk/calendar3/common/src/edu/rpi/sss/util/xml/XmlEmit.java

    r415 r418  
    208208  } 
    209209 
     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 
    210242  /** 
    211243   * @param tag 
     
    217249    wtr.write("/"); 
    218250    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    } 
    219272  } 
    220273 
  • trunk/calendar3/davdefs/src/org/bedework/davdefs/CaldavTags.java

    r417 r418  
    8383 
    8484  /**   */ 
     85  public static final QName calendarTimezone = new QName(caldavNamespace, 
     86                                                         "calendar-timezone"); 
     87 
     88  /**   */ 
    8589  public static final QName calendarMultiget = new QName(caldavNamespace, 
    8690                                                         "calendar-multiget"); 
     
    127131 
    128132  /**   */ 
     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  /**   */ 
    129153  public static final QName paramFilter = new QName(caldavNamespace, 
    130154                                                    "param-filter"); 
     
    147171 
    148172  /**   */ 
     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  /**   */ 
    149181  public static final QName textMatch = new QName(caldavNamespace, 
    150182                                                  "text-match"); 
  • trunk/calendar3/icalendar/src/org/bedework/icalendar/IcalTranslator.java

    r298 r418  
    154154   * @throws CalFacadeException 
    155155   */ 
    156   public Calendar newIcal() throws CalFacadeException { 
     156  public static Calendar newIcal() throws CalFacadeException { 
    157157    Calendar cal = new Calendar(); 
    158158 
     
    173173      return null; 
    174174    } 
    175      
     175 
    176176    HashMap added = new HashMap(); 
    177177 
     
    203203      return null; 
    204204    } 
    205      
     205 
    206206    HashMap added = new HashMap(); 
    207207 
     
    228228  } 
    229229 
    230   /** Make a VEvent object from an EventVO
     230  /** Make a VEvent object from a BwEvent
    231231   * 
    232232   * @param val 
     
    238238  } 
    239239 
    240   /** Convert the EventVO object to a String representation 
     240  /** Convert the BwEvent object to a String representation 
    241241   * 
    242242   * @param val 
     
    277277 
    278278      UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); 
    279        
     279 
    280280      //return fromIcal(cal, bldr.build(new UnfoldingReader(new StringReader(val)))); 
    281281      return fromIcal(cal, bldr.build(ufrdr)); 
     
    366366 
    367367      UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); 
    368        
     368 
    369369      return bldr.build(ufrdr); 
    370370    } catch (CalFacadeException cfe) { 
     
    375375  } 
    376376 
     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 
    377420  /** Convert the given string representation of an Icalendar object to a 
    378421   * collection of VEvent 
     
    391434 
    392435      UnfoldingReader ufrdr = new UnfoldingReader(new StringReader(val), true); 
    393        
     436 
    394437      Calendar cal = bldr.build(ufrdr); 
    395438      Vector evs = new Vector(); 
     
    510553   * and add it to the calendar. 
    511554   */ 
    512   private void addIcalTimezones(Calendar cal, BwEvent ev,  
     555  private void addIcalTimezones(Calendar cal, BwEvent ev, 
    513556                                HashMap added) throws CalFacadeException { 
    514557    BwUser owner = ev.getOwner(); 
     
    520563    } 
    521564  } 
    522    
    523   private void addIcalTimezone(Calendar cal, String tzid,  
    524                                BwUser owner,  
     565 
     566  private void addIcalTimezone(Calendar cal, String tzid, 
     567                               BwUser owner, 
    525568                               HashMap added) throws CalFacadeException { 
    526569    VTimeZone vtz; 
    527      
    528     if ((tzid == null) || added.containsKey(tzid)) { 
     570 
     571    if ((tzid == null) || 
     572        ((added != null) && added.containsKey(tzid))) { 
    529573      return; 
    530574    } 
     
    533577      debugMsg("Look for timezone with id " + tzid); 
    534578    } 
    535      
     579 
    536580    vtz = cb.findTimeZone(tzid, owner); 
    537581    if (vtz != null) { 
     
    543587      debugMsg("Didn't find timezone with id " + tzid); 
    544588    } 
    545      
    546     added.put(tzid, null); 
    547   } 
    548    
     589 
     590    if (added != null) { 
     591      added.put(tzid, null); 
     592    } 
     593  } 
     594 
    549595  private static void setSystemProperties() throws CalFacadeException { 
    550596    try { 
  • trunk/calendar3/test/caldavTestData/eg/eg15.test

    r2 r418  
    1111CONTENTTYPE: text/xml 
    1212 
    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> 
     13CONTENTFILE: content/eg15.xml 
    2214 
  • trunk/calendar3/test/src/org/bedework/tests/caldav/TestCalDav.java

    r310 r418  
    8080//import java.net.Authenticator; 
    8181//import java.net.PasswordAuthentication; 
     82import java.util.ArrayList; 
    8283import java.util.Iterator; 
    8384import java.util.TreeSet; 
     
    162163  } 
    163164 
    164   private static Vector results = new Vector(); 
     165  private static ArrayList results = new ArrayList(); 
    165166 
    166167  /** Main method 
     
    187188        // Either use the test list or the sorted directory contents. 
    188189 
    189         Vector tests = new Vector(); 
     190        ArrayList tests = new ArrayList(); 
    190191 
    191192        if (testListName != null) {