Changeset 490

Show
Ignore:
Timestamp:
05/18/06 09:59:01
Author:
douglm
Message:

Fix up mkcol webdav method
Changes to propset and mkcalendar
Add new webdav Property class
Delete old caldav mkcol class

Mark Acl.CurrentAccess? serializable

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Acl.java

    r484 r490  
    5454package edu.rpi.cct.uwcal.access; 
    5555 
     56import java.io.Serializable; 
    5657import java.util.Collection; 
    5758import java.util.Iterator; 
     
    121122  /** Result of evaluating access to an object for a principal 
    122123   */ 
    123   public static class CurrentAccess
     124  public static class CurrentAccess implements Serializable
    124125    /** The Acl used to evaluate the access. We should not necessarily 
    125126     * make this available to the client. 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java

    r472 r490  
    12301230      getSvci(); 
    12311231 
    1232       BwFreeBusy fb = freeBusy.getFreeBusy(svci, user); 
     1232      BwFreeBusy fb = freeBusy.getFreeBusy(svci, cnode.getCDURI().getCal(), 
     1233                                           user); 
    12331234 
    12341235      cnode.setFreeBusy(fb); 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWServlet.java

    r310 r490  
    106106 
    107107    // Replace methods 
    108     methods.put("MKCALENDAR", new CDMkcolMethod()); 
     108    methods.put("MKCALENDAR", new MkcalendarMethod()); 
    109109    methods.put("REPORT", new ReportMethod()); 
    110110  } 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/ReportMethod.java

    r472 r490  
    332332      } 
    333333 
    334       return HttpServletResponse.SC_INTERNAL_SERVER_ERROR
     334      throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)
    335335    } 
    336336  } 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/calquery/FreeBusyQuery.java

    r484 r490  
    5555package edu.rpi.cct.uwcal.caldav.calquery; 
    5656 
     57import org.bedework.calfacade.BwCalendar; 
    5758import org.bedework.calfacade.BwFreeBusy; 
    5859import org.bedework.calfacade.BwUser; 
     
    124125  /** 
    125126   * @param svci 
     127   * @param cal 
    126128   * @param account 
    127129   * @return BwFreeBusy 
    128130   * @throws WebdavException 
    129131   */ 
    130   public BwFreeBusy getFreeBusy(CalSvcI svci, String account) throws WebdavException { 
     132  public BwFreeBusy getFreeBusy(CalSvcI svci, BwCalendar cal, 
     133                                String account) throws WebdavException { 
    131134    try { 
    132135      BwUser user = svci.findUser(account); 
     
    134137        throw WebdavIntfException.unauthorized(); 
    135138      } 
    136       BwFreeBusy fb = svci.getFreeBusy(null, user, 
     139      BwFreeBusy fb = svci.getFreeBusy(cal, user, 
    137140                                       timeRange.getStart(), timeRange.getEnd(), 
    138141                                       null, false); 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/MethodBase.java

    r418 r490  
    513513  } 
    514514 
     515  protected String getElementContent(Element el) throws WebdavException { 
     516    try { 
     517      return XmlUtil.getElementContent(el); 
     518    } catch (Throwable t) { 
     519      if (debug) { 
     520        getLogger().error(this, t); 
     521      } 
     522 
     523      throw new WebdavException(t); 
     524    } 
     525  } 
     526 
    515527  /* ==================================================================== 
    516528   *                   XmlEmit wrappers 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/MkcolMethod.java

    r2 r490  
    7979    } 
    8080 
    81     /* Parse any content */ 
     81    /* Parse any content 
    8282    Document doc = parseContent(req, resp); 
    83  
     83    */ 
    8484    /* Create the node */ 
    8585    String resourceUri = getResourceUri(req); 
     
    8989    getNsIntf().makeCollection(req, node); 
    9090 
     91    /* 
    9192    if (doc != null) { 
    9293      int st = processDoc(req, doc); 
     
    9798      } 
    9899    } 
     100    */ 
    99101 
    100102    resp.setStatus(HttpServletResponse.SC_CREATED); 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/PropPatchMethod.java

    r2 r490  
    5555package edu.rpi.cct.webdav.servlet.common; 
    5656 
     57import org.bedework.davdefs.WebdavTags; 
     58 
     59import edu.rpi.cct.webdav.servlet.shared.WebdavBadRequest; 
    5760import edu.rpi.cct.webdav.servlet.shared.WebdavException; 
     61 
     62import java.util.ArrayList; 
     63import java.util.Collection; 
    5864 
    5965import javax.servlet.http.HttpServletRequest; 
    6066import javax.servlet.http.HttpServletResponse; 
     67 
     68import org.w3c.dom.Element; 
    6169 
    6270/** Class called to handle PROPPATCH 
     
    7482 
    7583  } 
     84 
     85  /** List of properties to set 
     86   * 
     87   */ 
     88  public static class PropertySetList extends ArrayList { 
     89  } 
     90 
     91  /** List of properties to remove 
     92  * 
     93  */ 
     94  public static class PropertyRemoveList extends ArrayList { 
     95  } 
     96 
     97  /** The given node should contain zero or more set or remove child elements. 
     98   * 
     99   * <p>Each set element should contain zero or more property tags with values. 
     100   * 
     101   * <p>Each remove element should contain zero or more empty property tags. 
     102   * 
     103   * <p>The returned Collection contains zero or more PropertySetList or 
     104   * PropertyRemoveList entries. 
     105   * 
     106   * @param node 
     107   * @return Collection 
     108   * @throws WebdavException 
     109   */ 
     110  protected Collection processUpdate(Element node) throws WebdavException { 
     111    ArrayList res = new ArrayList(); 
     112 
     113    try { 
     114      Element[] children = getChildren(node); 
     115 
     116      for (int i = 0; i < children.length; i++) { 
     117        Element curnode = children[i]; 
     118        Collection plist; 
     119 
     120        if (nodeMatches(curnode, WebdavTags.set)) { 
     121          plist = new PropertySetList(); 
     122 
     123          processPlist(plist, curnode, false); 
     124        } else if (nodeMatches(curnode, WebdavTags.remove)) { 
     125          plist = new PropertySetList(); 
     126 
     127          processPlist(plist, curnode, true); 
     128        } else { 
     129          throw new WebdavBadRequest(); 
     130        } 
     131 
     132        res.add(plist); 
     133      } 
     134    } catch (WebdavException wde) { 
     135      throw wde; 
     136    } catch (Throwable t) { 
     137      System.err.println(t.getMessage()); 
     138      if (debug) { 
     139        t.printStackTrace(); 
     140      } 
     141 
     142      throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); 
     143    } 
     144 
     145    return res; 
     146  } 
     147 
     148  /* Process the node which should contain either empty elements for remove or 
     149   * elements with or without values for remove==false 
     150   */ 
     151  private void processPlist(Collection plist, Element node, 
     152                            boolean remove) throws WebdavException { 
     153    Element[] props = getChildren(node); 
     154 
     155    for (int i = 0; i < props.length; i++) { 
     156      Element prop = props[i]; 
     157 
     158      String ns = prop.getNamespaceURI(); 
     159      String nm = prop.getLocalName(); 
     160      String value = getElementContent(prop); 
     161 
     162      if (remove && (value != null)) { 
     163        throw new WebdavBadRequest(); 
     164      } 
     165 
     166      plist.add(new Property(ns, nm, value)); 
     167 
     168      if (debug) { 
     169        trace("reqtype: " + nm + " ns: " + ns + " value: " + value); 
     170      } 
     171    } 
     172  } 
    76173} 
    77174 
  • trunk/calendar3/caldavClientApi/src/org/bedework/caldav/client/api/CaldavClientIo.java

    r483 r490  
    6464import org.apache.commons.httpclient.HostConfiguration; 
    6565import org.apache.commons.httpclient.HttpMethod; 
    66 import org.apache.commons.httpclient.URI; 
    6766import org.apache.commons.httpclient.protocol.Protocol; 
    6867import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java

    r487 r490  
    10331033    Collection subs; 
    10341034 
     1035    /* See if the calendar is a user root. */ 
     1036 
     1037    if (cal != null) { 
     1038      String[] ss = cal.getPath().split("/"); 
     1039      int pathLength = ss.length - 1;  // First element is empty string 
     1040 
     1041      if ((pathLength == 2) && 
     1042          (ss[1].equals(getSyspars().getUserCalendarRoot()))) { 
     1043        cal = null; 
     1044      } 
     1045    } 
     1046 
    10351047    if (cal != null) { 
    10361048      getCal().checkAccess(cal, PrivilegeDefs.privReadFreeBusy, false); 
  • trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java

    r439 r490  
    811811   * events fall in the segment. 
    812812   * 
    813    * @param cal    Calendar to provide free-busy for. Null for defaul
    814    *               collection (as specified by user). 
     813   * @param cal    Calendar to provide free-busy for. Null or the user roo
     814   *               for default collection (as specified by user). 
    815815   * @param who 
    816816   * @param start 
  • trunk/calendar3/davdefs/src/org/bedework/davdefs/WebdavTags.java

    r310 r490  
    298298 
    299299  /** */ 
    300   public static final QName prop = new QName(namespace, 
    301                                              "prop"); 
    302  
    303   /** */ 
    304   public static final QName property = new QName(namespace, 
    305                                              "property"); 
     300  public static final QName prop = new QName(namespace, "prop"); 
     301 
     302  /** */ 
     303  public static final QName property = new QName(namespace, "property"); 
    306304 
    307305  /** */ 
     
    310308 
    311309  /** */ 
    312   public static final QName propname = new QName(namespace, 
    313                                                  "propname"); 
    314  
    315   /** */ 
    316   public static final QName propstat = new QName(namespace, 
    317                                                  "propstat"); 
     310  public static final QName propname = new QName(namespace, "propname"); 
     311 
     312  /** */ 
     313  public static final QName propstat = new QName(namespace, "propstat"); 
    318314 
    319315  /** */ 
     
    322318 
    323319  /** */ 
    324   public static final QName read = new QName(namespace, 
    325                                              "read"); 
    326  
    327   /** */ 
    328   public static final QName readAcl = new QName(namespace, 
    329                                                 "read-acl"); 
     320  public static final QName read = new QName(namespace, "read"); 
     321 
     322  /** */ 
     323  public static final QName readAcl = new QName(namespace, "read-acl"); 
    330324 
    331325  /** */ 
     
    338332 
    339333  /** */ 
     334  public static final QName remove = new QName(namespace, "remove"); 
     335 
     336  /** */ 
    340337  public static final QName requiredPrincipal = new QName(namespace, 
    341338                                                     "required-principal"); 
     
    350347 
    351348  /** */ 
    352   public static final QName response = new QName(namespace, 
    353                                                  "response"); 
     349  public static final QName response = new QName(namespace, "response"); 
    354350 
    355351  /** */ 
     
    358354 
    359355  /** */ 
    360   public static final QName self = new QName(namespace, 
    361                                              "self"); 
    362  
    363   /** */ 
    364   public static final QName source = new QName(namespace, 
    365                                                "source"); 
    366  
    367   /** */ 
    368   public static final QName status = new QName(namespace, 
    369                                                     "status"); 
     356  public static final QName self = new QName(namespace, "self"); 
     357 
     358  /** */ 
     359  public static final QName set = new QName(namespace, "set"); 
     360 
     361  /** */ 
     362  public static final QName source = new QName(namespace, "source"); 
     363 
     364  /** */ 
     365  public static final QName status = new QName(namespace, "status"); 
    370366 
    371367  /** */ 
  • trunk/calendar3/freebusyServer/src/org/bedework/freebusyServer/FreeBusyAggregator.java

    r488 r490  
    3131import org.bedework.calfacade.BwUser; 
    3232import org.bedework.calfacade.CalFacadeException; 
    33 import org.bedework.calfacade.CalFacadeUtil; 
    3433import org.bedework.calsvc.CalSvc; 
    3534import org.bedework.calsvci.CalSvcI; 
  • trunk/calendar3/http/src/org/bedework/http/client/caldav/CaldavClient.java

    r310 r490  
    7878 
    7979  public void setMethodName(String name, String uri) throws CalFacadeException { 
    80     if ("REPORT".equals(name)) { 
    81       setMethod(new ReportMethod(uri)); 
     80    if ("MKCOL".equals(name)) { 
     81      setMethod(new MkColMethod(uri)); 
    8282    } else if ("PROPFIND".equals(name)) { 
    8383      setMethod(new PropFindMethod(uri)); 
     84    } else if ("REPORT".equals(name)) { 
     85      setMethod(new ReportMethod(uri)); 
    8486    } else { 
    8587      super.setMethodName(name, uri); 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java

    r487 r490  
    452452   * @throws Throwable 
    453453   */ 
    454   /** 
    455    * @param request 
    456    * @param form 
    457    * @return 
    458    * @throws Throwable 
    459    */ 
    460454  protected BwUser findUser(HttpServletRequest request, 
    461455                             BwActionFormBase form) throws Throwable { 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/subs/EndSubscribeAction.java

    r487 r490  
    5454package org.bedework.webcommon.subs; 
    5555 
    56 import org.bedework.calfacade.CalFacadeException; 
    5756import org.bedework.calfacade.svc.BwPreferences; 
    5857import org.bedework.calfacade.svc.BwSubscription;