Changeset 507

Show
Ignore:
Timestamp:
05/25/06 09:34:51
Author:
douglm
Message:

Mostly fixes to caldav for the calconnect interop.

Some restructuring to free/busy code and rearrangement of Calintf

Files:

Legend:

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

    r477 r507  
    6262import org.bedework.calfacade.BwCategory; 
    6363import org.bedework.calfacade.BwDateTime; 
     64import org.bedework.calfacade.BwDuration; 
    6465import org.bedework.calfacade.BwEvent; 
     66import org.bedework.calfacade.BwFreeBusy; 
     67import org.bedework.calfacade.BwFreeBusyComponent; 
    6568import org.bedework.calfacade.BwLocation; 
     69import org.bedework.calfacade.BwPrincipal; 
    6670import org.bedework.calfacade.BwRWStats; 
    6771import org.bedework.calfacade.BwSponsor; 
     
    7680import org.bedework.calfacade.CalFacadeDefs; 
    7781import org.bedework.calfacade.CalFacadeException; 
     82import org.bedework.calfacade.CalFacadeUtil; 
    7883import org.bedework.calfacade.CoreEventInfo; 
     84import org.bedework.calfacade.CalFacadeUtil.EventPeriod; 
     85import org.bedework.calfacade.CalFacadeUtil.GetPeriodsPars; 
    7986import org.bedework.calfacade.base.BwShareableDbentity; 
     87import org.bedework.calfacade.base.CalintfBase; 
    8088import org.bedework.calfacade.filter.BwFilter; 
    8189import org.bedework.calfacade.ifs.CalTimezones; 
    82 import org.bedework.calfacade.ifs.Calintf; 
    8390import org.bedework.calfacade.ifs.CalintfInfo; 
    8491import org.bedework.calfacade.ifs.EventsI; 
    8592import org.bedework.calfacade.ifs.Groups; 
     93import org.bedework.calfacade.svc.EventInfo; 
    8694import org.bedework.icalendar.IcalTranslator; 
    8795 
     
    8997import java.util.ArrayList; 
    9098import java.util.Collection; 
     99import java.util.Iterator; 
    91100import java.util.TreeSet; 
    92101 
    93102import net.fortuna.ical4j.model.Calendar; 
    94103import net.fortuna.ical4j.model.Component; 
     104import net.fortuna.ical4j.model.DateTime; 
     105import net.fortuna.ical4j.model.Period; 
    95106import net.fortuna.ical4j.model.component.VTimeZone; 
    96107 
     
    131142 * @author Mike Douglass   douglm@rpi.edu 
    132143 */ 
    133 public class CalintfImpl implements Calintf, PrivilegeDefs { 
    134   private boolean debug; 
    135  
     144public class CalintfImpl extends CalintfBase implements PrivilegeDefs { 
    136145  private BwSystem syspars; 
    137146 
     
    150159  private AccessUtil access; 
    151160 
    152   /** Ensure we don't open while open 
    153    */ 
    154   private boolean isOpen; 
    155  
    156   /* * This is all the personal calendars modified while the current transaction 
    157    *  has been in progress. Just before commit we update the lastmod off all 
    158    *  the users on this list. 
    159    * / 
    160   private Vector personalModified; 
    161   */ 
    162  
    163   /** User for whom we maintain this facade 
    164    */ 
    165   private BwUser user; 
    166  
    167161  private EventsI events; 
    168162 
     
    174168 
    175169  private EventProperties sponsors; 
    176  
    177   private int currentMode = CalintfUtil.guestMode; 
    178  
    179   /** Non-null if this is for synchronization. Identifies the client end. 
    180    */ 
    181   private String synchId; 
    182170 
    183171  /** Prevent updates. 
     
    213201  } 
    214202 
    215   private transient Logger log; 
    216  
    217   /** When we were created for debugging */ 
    218   private Timestamp objTimestamp; 
    219  
    220203  /* ==================================================================== 
    221204   *                   initialisation 
     
    225208   * @see org.bedework.calfacade.Calintf#init(org.bedework.calfacade.BwUser, java.lang.String, boolean, boolean, boolean, java.lang.String, boolean) 
    226209   */ 
    227   public boolean init(String authenticatedUser, 
     210  public boolean init(String url, 
     211                      String authenticatedUser, 
    228212                      String user, 
    229213                      boolean publicAdmin, 
     
    231215                      String synchId, 
    232216                      boolean debug) throws CalFacadeException { 
    233     this.debug = debug; 
     217    super.init(url, authenticatedUser, user, publicAdmin, 
     218               groups, synchId, debug); 
     219 
    234220    boolean userCreated = false; 
    235221 
     
    238224    try { 
    239225      access = new AccessUtil(debug); 
    240  
    241       objTimestamp = new Timestamp(System.currentTimeMillis()); 
    242  
    243       this.synchId = synchId; 
    244       log = Logger.getLogger(getClass()); 
    245226 
    246227      if ((synchId != null) && publicAdmin) { 
     
    327308  } 
    328309 
     310  public void logon(BwUser val) throws CalFacadeException { 
     311    checkOpen(); 
     312    Timestamp now = new Timestamp(System.currentTimeMillis()); 
     313 
     314    val.setLogon(now); 
     315    val.setLastAccess(now); 
     316    sess.update(val); 
     317  } 
     318 
    329319  public void setSuperUser(boolean val) { 
    330320    access.setSuperUser(val); 
     
    421411  } 
    422412 
    423   public boolean getDebug() throws CalFacadeException { 
    424     return debug; 
    425   } 
    426  
    427   public void setUser(String val) throws CalFacadeException { 
    428     refreshEvents(); 
    429  
    430     user = getUser(val); 
    431     if (this.user == null) { 
    432       throw new CalFacadeException("User " + val + " does not exist."); 
    433     } 
    434  
    435     logon(user); 
    436  
    437     if (debug) { 
    438       log.debug("User " + val + " set in calintf"); 
    439     } 
    440   } 
    441  
    442413  /* ==================================================================== 
    443414   *                   Misc methods 
     
    446417  public void flushAll() throws CalFacadeException { 
    447418    if (debug) { 
    448       log.debug("flushAll for " + objTimestamp); 
     419      debug("flushAll for " + objTimestamp); 
    449420    } 
    450421    if (sess == null) { 
     
    472443    if (sess == null) { 
    473444      if (debug) { 
    474         log.debug("New hibernate session for " + objTimestamp); 
    475       } 
    476       sess = new HibSession(sessFactory, log); 
     445        debug("New hibernate session for " + objTimestamp); 
     446      } 
     447      sess = new HibSession(sessFactory, getLogger()); 
    477448    } else { 
    478449      if (debug) { 
    479         log.debug("Reconnect hibernate session for " + objTimestamp); 
     450        debug("Reconnect hibernate session for " + objTimestamp); 
    480451      } 
    481452      sess.reconnect(); 
     
    492463    if (!isOpen) { 
    493464      if (debug) { 
    494         log.debug("Close for " + objTimestamp + " closed session"); 
     465        debug("Close for " + objTimestamp + " closed session"); 
    495466      } 
    496467      return; 
     
    498469 
    499470    if (debug) { 
    500       log.debug("Close for " + objTimestamp); 
     471      debug("Close for " + objTimestamp); 
    501472    } 
    502473 
     
    526497//    sess.close(); 
    527498    if (debug) { 
    528       log.debug("Begin transaction for " + objTimestamp); 
     499      debug("Begin transaction for " + objTimestamp); 
    529500    } 
    530501    sess.beginTransaction(); 
     
    535506 
    536507    if (debug) { 
    537       log.debug("End transaction for " + objTimestamp); 
     508      debug("End transaction for " + objTimestamp); 
    538509    } 
    539510 
     
    604575   *                   Users 
    605576   * ==================================================================== */ 
    606  
    607   public BwUser getUser() throws CalFacadeException { 
    608     return user; 
    609   } 
    610577 
    611578  public BwUser getUser(int id) throws CalFacadeException { 
     
    656623  } 
    657624 
    658   public void updateUser() throws CalFacadeException { 
    659     updateUser(getUser()); 
    660   } 
    661  
    662625  public void updateUser(BwUser user) throws CalFacadeException { 
    663626    checkOpen(); 
     
    682645    throw new CalFacadeException("Unimplemented"); 
    683646  }*/ 
    684  
    685   private void logon(BwUser val) throws CalFacadeException { 
    686     checkOpen(); 
    687     Timestamp now = new Timestamp(System.currentTimeMillis()); 
    688  
    689     val.setLogon(now); 
    690     val.setLastAccess(now); 
    691     sess.update(val); 
    692   } 
    693647 
    694648  /* ==================================================================== 
     
    10791033 
    10801034    return sponsors.getRefs(val); 
     1035  } 
     1036 
     1037  /* ==================================================================== 
     1038   *                   Free busy 
     1039   * ==================================================================== */ 
     1040 
     1041  public BwFreeBusy getFreeBusy(BwCalendar cal, BwPrincipal who, 
     1042                                BwDateTime start, BwDateTime end, 
     1043                                BwDuration granularity, 
     1044                                boolean returnAll, 
     1045                                boolean ignoreTransparency) 
     1046          throws CalFacadeException { 
     1047    if (!(who instanceof BwUser)) { 
     1048      throw new CalFacadeException("Unsupported: non user principal for free-busy"); 
     1049    } 
     1050 
     1051    Collection events = getFreeBusyEntities(cal, start, end, ignoreTransparency); 
     1052    BwFreeBusy fb = new BwFreeBusy(who, start, end); 
     1053 
     1054    try { 
     1055      if (granularity != null) { 
     1056        // chunked. 
     1057        GetPeriodsPars gpp = new GetPeriodsPars(); 
     1058 
     1059        gpp.events = events; 
     1060        gpp.startDt = start; 
     1061        gpp.dur = granularity; 
     1062        gpp.tzcache = getTimezones(); 
     1063 
     1064        BwFreeBusyComponent fbc = null; 
     1065 
     1066        if (!returnAll) { 
     1067          // One component 
     1068          fbc = new BwFreeBusyComponent(); 
     1069          fb.addTime(fbc); 
     1070        } 
     1071 
     1072        int limit = 10000; // XXX do this better 
     1073 
     1074        /* endDt is null first time through, then represents end of last 
     1075         * segment. 
     1076         */ 
     1077        while ((gpp.endDt == null) || (gpp.endDt.before(end))) { 
     1078          //if (debug) { 
     1079          //  trace("gpp.startDt=" + gpp.startDt + " end=" + end); 
     1080          //} 
     1081          if (limit < 0) { 
     1082            throw new CalFacadeException("org.bedework.svci.limit.exceeded"); 
     1083          } 
     1084          limit--; 
     1085 
     1086          Collection periodEvents = CalFacadeUtil.getPeriodsEvents(gpp); 
     1087 
     1088          if (returnAll) { 
     1089            fbc = new BwFreeBusyComponent(); 
     1090            fb.addTime(fbc); 
     1091 
     1092            DateTime psdt = new DateTime(gpp.startDt.getDtval()); 
     1093            DateTime pedt = new DateTime(gpp.endDt.getDtval()); 
     1094 
     1095            psdt.setUtc(true); 
     1096            pedt.setUtc(true); 
     1097            fbc.addPeriod(new Period(psdt, pedt)); 
     1098            if (periodEvents.size() == 0) { 
     1099              fbc.setType(BwFreeBusyComponent.typeFree); 
     1100            } 
     1101          } else if (periodEvents.size() != 0) { 
     1102            /* Some events fall in the period. Add an entry. 
     1103             * We eliminated cancelled events earler. Now we should set the 
     1104             * free/busy type based on the events status. 
     1105             */ 
     1106 
     1107            DateTime psdt = new DateTime(gpp.startDt.getDtval()); 
     1108            DateTime pedt = new DateTime(gpp.endDt.getDtval()); 
     1109 
     1110            psdt.setUtc(true); 
     1111            pedt.setUtc(true); 
     1112 
     1113            if (fbc == null) { 
     1114              fbc = new BwFreeBusyComponent(); 
     1115              fb.addTime(fbc); 
     1116            } 
     1117 
     1118            fbc.addPeriod(new Period(psdt, pedt)); 
     1119          } 
     1120        } 
     1121 
     1122        return fb; 
     1123      } 
     1124 
     1125      Iterator it = events.iterator(); 
     1126 
     1127      TreeSet eventPeriods = new TreeSet(); 
     1128 
     1129      while (it.hasNext()) { 
     1130        EventInfo ei = (EventInfo)it.next(); 
     1131        BwEvent ev = ei.getEvent(); 
     1132 
     1133        if (BwEvent.statusCancelled.equals(ev.getStatus())) { 
     1134          // Ignore this one. 
     1135          continue; 
     1136        } 
     1137 
     1138        // Ignore if times were specified and this event is outside the times 
     1139 
     1140        BwDateTime estart = ev.getDtstart(); 
     1141        BwDateTime eend = ev.getDtend(); 
     1142 
     1143        /* Don't report out of the requested period */ 
     1144 
     1145        String dstart; 
     1146        String dend; 
     1147 
     1148        if (estart.before(start)) { 
     1149          dstart = start.getDtval(); 
     1150        } else { 
     1151          dstart = estart.getDtval(); 
     1152        } 
     1153 
     1154        if (eend.after(end)) { 
     1155          dend = end.getDtval(); 
     1156        } else { 
     1157          dend = eend.getDtval(); 
     1158        } 
     1159 
     1160        DateTime psdt = new DateTime(dstart); 
     1161        DateTime pedt = new DateTime(dend); 
     1162 
     1163        psdt.setUtc(true); 
     1164        pedt.setUtc(true); 
     1165 
     1166        int type = BwFreeBusyComponent.typeBusy; 
     1167 
     1168        if (BwEvent.statusTentative.equals(ev.getStatus())) { 
     1169          type = BwFreeBusyComponent.typeBusyTentative; 
     1170       } 
     1171 
     1172        eventPeriods.add(new EventPeriod(psdt, pedt, type)); 
     1173      } 
     1174 
     1175      /* iterate through the sorted periods combining them where they are 
     1176       adjacent or overlap */ 
     1177 
     1178      Period p = null; 
     1179 
     1180      /* For the moment just build a single BwFreeBusyComponent 
     1181       */ 
     1182      BwFreeBusyComponent fbc = null; 
     1183      int lastType = 0; 
     1184 
     1185      it = eventPeriods.iterator(); 
     1186      while (it.hasNext()) { 
     1187        EventPeriod ep = (EventPeriod)it.next(); 
     1188 
     1189        if (debug) { 
     1190          trace(ep.toString()); 
     1191        } 
     1192 
     1193        if (p == null) { 
     1194          p = new Period(ep.getStart(), ep.getEnd()); 
     1195          lastType = ep.getType(); 
     1196        } else if ((lastType != ep.getType()) || ep.getStart().after(p.getEnd())) { 
     1197          // Non adjacent periods 
     1198          if (fbc == null) { 
     1199            fbc = new BwFreeBusyComponent(); 
     1200            fbc.setType(lastType); 
     1201            fb.addTime(fbc); 
     1202          } 
     1203          fbc.addPeriod(p); 
     1204 
     1205          if (lastType != ep.getType()) { 
     1206            fbc = null; 
     1207          } 
     1208 
     1209          p = new Period(ep.getStart(), ep.getEnd()); 
     1210          lastType = ep.getType(); 
     1211        } else if (ep.getEnd().after(p.getEnd())) { 
     1212          // Extend the current period 
     1213          p = new Period(p.getStart(), ep.getEnd()); 
     1214        } // else it falls within the existing period 
     1215      } 
     1216 
     1217      if (p != null) { 
     1218        if ((fbc == null) || (lastType != fbc.getType())) { 
     1219          fbc = new BwFreeBusyComponent(); 
     1220          fbc.setType(lastType); 
     1221          fb.addTime(fbc); 
     1222        } 
     1223        fbc.addPeriod(p); 
     1224      } 
     1225    } catch (Throwable t) { 
     1226      if (debug) { 
     1227        error(t); 
     1228      } 
     1229      throw new CalFacadeException(t); 
     1230    } 
     1231 
     1232    return fb; 
    10811233  } 
    10821234 
     
    13421494   * ==================================================================== */ 
    13431495 
    1344   private void checkOpen() throws CalFacadeException { 
    1345     if (!isOpen) { 
    1346       throw new CalFacadeException("Calintf call when closed"); 
    1347     } 
    1348   } 
    1349  
    1350   /* Get a logger for messages 
    1351    */ 
    1352   private Logger getLogger() { 
    1353     if (log == null) { 
    1354       log = Logger.getLogger(this.getClass()); 
    1355     } 
    1356  
    1357     return log; 
    1358   } 
    1359  
    1360   private void trace(String msg) { 
    1361     getLogger().debug(msg); 
     1496  private Collection getFreeBusyEntities(BwCalendar cal, 
     1497                                         BwDateTime start, BwDateTime end, 
     1498                                         boolean ignoreTransparency) 
     1499          throws CalFacadeException { 
     1500    Collection evs = getEvents(cal, null, start, end, 
     1501                               CalFacadeDefs.retrieveRecurExpanded, true, 
     1502                               true); 
     1503 
     1504    // Filter out transparent and cancelled events 
     1505    Iterator evit = evs.iterator(); 
     1506 
     1507    Collection events = new TreeSet(); 
     1508 
     1509    while (evit.hasNext()) { 
     1510      EventInfo ei = (EventInfo)evit.next(); 
     1511      BwEvent ev = ei.getEvent(); 
     1512 
     1513      if (!ignoreTransparency && 
     1514          BwEvent.transparencyTransparent.equals(ev.getTransparency())) { 
     1515        // Ignore this one. 
     1516        continue; 
     1517      } 
     1518 
     1519      if (BwEvent.statusCancelled.equals(ev.getStatus())) { 
     1520        // Ignore this one. 
     1521        continue; 
     1522      } 
     1523 
     1524      events.add(ei); 
     1525    } 
     1526 
     1527    return events; 
    13621528  } 
    13631529} 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java

    r452 r507  
    10921092        // Single leaf calendar - always include 
    10931093        sess.setEntity("calendar", calendar); 
     1094        if (debug) { 
     1095          trace("------------Using calendar " + calendar.getPath()); 
     1096        } 
    10941097      } else { 
    10951098        // Non leaf - add entities 
     
    11061109        // leaf calendar 
    11071110        getSess().setEntity("calendar" + calTerm.i, calendar); 
     1111        if (debug) { 
     1112          trace("------------Using calendar " + calendar.getPath()); 
     1113        } 
    11081114        calTerm.i++; 
    11091115      } 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwEvent.java

    r464 r507  
    185185 
    186186  private String link; 
     187 
     188  /** Rfc value for a confirmed meeting */ 
     189  public static final String statusConfirmed = "CONFIRMED"; 
     190 
     191  /** Rfc value for a cancelled meeting */ 
     192  public static final String statusCancelled = "CANCELLED"; 
     193 
     194  /** Rfc value for a tentative meeting */ 
     195  public static final String statusTentative = "TENTATIVE"; 
     196 
    187197  private String status; 
    188198  private String cost; 
     
    985995    res.setGuid(getGuid()); 
    986996    res.setTransparency(getTransparency()); 
     997    res.setStatus(getStatus()); 
    987998 
    988999    return res; 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/BwFreeBusyComponent.java

    r365 r507  
    7979  public static final int typeBusyTentative = 3; 
    8080 
    81   private int type
     81  private int type = typeBusy
    8282 
    8383  /** Collection of Period 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeException.java

    r298 r507  
    6262   * retrieve a localized message and can also be used to identify the 
    6363   * cause of the exception. 
    64    *  
     64   * 
    6565   * Every CalFacadeException should have one of these as the getMessage() 
    6666   * value. 
    6767   */ 
    68    
     68 
    6969  /* ****************** Admin groups ****************************** */ 
    70    
     70 
    7171  /** The admin group already exists */ 
    7272  public static final String duplicateAdminGroup = 
    7373      "org.bedework.exception.duplicateadmingroup"; 
    74    
     74 
    7575  /** The admin group is already on the path to the root (makes a loop) */ 
    7676  public static final String alreadyOnAdminGroupPath = 
     
    7878 
    7979  /* ****************** Calendars ****************************** */ 
    80    
     80 
    8181  /** Couldn't find calendar */ 
    8282  public static final String calendarNotFound = 
     
    100100 
    101101  /* ****************** Subscriptions ****************************** */ 
    102    
     102 
    103103  /** Somebody tried to create a duplicate subscription */ 
    104104  public static final String duplicateSubscription = 
     
    109109      "org.bedework.exception.ical.endandduration"; 
    110110 
     111  /* ****************** Users ****************************** */ 
     112 
     113  /** No such account */ 
     114  public static final String noSuchAccount = 
     115      "org.bedework.exception.nosuchaccount"; 
     116 
    111117  /* ****************** Events ****************************** */ 
    112    
     118 
    113119  /** The guid for this event already exists */ 
    114120  public static final String duplicateGuid = 
     
    116122 
    117123  /* ****************** Timezones ****************************** */ 
    118    
     124 
    119125  /** Error reading timezones */ 
    120126  public static final String timezonesReadError = 
    121127      "org.bedework.error.timezones.readerror"; 
    122    
     128 
    123129  /** Unknown timezones */ 
    124130  public static final String unknownTimezone = 
    125131      "org.bedework.error.unknown.timezone"; 
    126    
     132 
    127133  /** Bad date */ 
    128134  public static final String badDate = 
     
    134140  public static final String illegalObjectClass = 
    135141      "org.bedework.exception.illegalobjectclass"; 
    136    
     142 
    137143  private String extra; 
    138144 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeUtil.java

    r459 r507  
    5757import org.bedework.calfacade.svc.EventInfo; 
    5858 
     59import net.fortuna.ical4j.model.DateTime; 
    5960import net.fortuna.ical4j.model.Parameter; 
    6061import net.fortuna.ical4j.model.ParameterList; 
     
    671672    //} 
    672673 
     674    EntityRange er = new EntityRange(); 
    673675    Iterator it = pars.events.iterator(); 
    674676    while (it.hasNext()) { 
    675       EventInfo ei = (EventInfo)it.next(); 
    676       BwEvent ev = ei.getEvent(); 
    677  
    678       String evStart = ev.getDtstart().getDate(); 
    679       String evEnd = ev.getDtend().getDate(); 
     677      er.setEntity(it.next()); 
    680678 
    681679      /* Event is within range if: 
     
    688686      */ 
    689687 
    690       int evstSt = evStart.compareTo(start); 
    691       int evendSt = evEnd.compareTo(start); 
     688      int evstSt = er.start.compareTo(start); 
     689      int evendSt = er.end.compareTo(start); 
    692690 
    693691      //debugMsg("                   event " + evStart + " to " + evEnd); 
    694692 
    695693      if (((evstSt <= 0) && (evendSt > 0)) || 
    696           ((evstSt >= 0) && (evStart.compareTo(end) < 0)) || 
     694          ((evstSt >= 0) && (er.start.compareTo(end) < 0)) || 
    697695          //((evendSt > 0) && (evEnd.compareTo(end) <= 0))) { 
    698           ((evendSt > 0) && (evEnd.compareTo(end) < 0))) { 
     696          ((evendSt > 0) && (er.end.compareTo(end) < 0))) { 
    699697        // Passed the tests. 
    700698        /* 
     
    704702                   ": " + ev.getSummary()); 
    705703        }*/ 
    706         al.add(ei); 
     704        al.add(er.entity); 
    707705      } 
    708706    } 
     
    731729    return "0" + String.valueOf(val); 
    732730  } 
     731 
     732  private static class EntityRange { 
     733    Object entity; 
     734 
     735    String start; 
     736    String end; 
     737 
     738    void setEntity(Object o) throws CalFacadeException { 
     739      entity = o; 
     740 
     741      if (o instanceof EventInfo) { 
     742        EventInfo ei = (EventInfo)o; 
     743        BwEvent ev = ei.getEvent(); 
     744 
     745        start = ev.getDtstart().getDate(); 
     746        start = ev.getDtend().getDate(); 
     747 
     748        return; 
     749      } 
     750 
     751      if (o instanceof EventPeriod) { 
     752        EventPeriod ep = (EventPeriod)o; 
     753 
     754        start = String.valueOf(ep.getStart()); 
     755        start = String.valueOf(ep.getEnd()); 
     756 
     757        return; 
     758      } 
     759 
     760      start = null; 
     761      end = null; 
     762    } 
     763  } 
     764 
     765  /** 
     766   * 
     767   */ 
     768  public static class EventPeriod implements Comparable { 
     769    private DateTime start; 
     770    private DateTime end; 
     771    private int type;  // from BwFreeBusyComponent 
     772 
     773    /** Constructor 
     774     * 
     775     * @param start 
     776     * @param end 
     777     * @param type 
     778     */ 
     779    public EventPeriod(DateTime start, DateTime end, int type) { 
     780      this.start = start; 
     781      this.end = end; 
     782      this.type = type; 
     783    } 
     784 
     785    /** 
     786     * @return DateTime 
     787     */ 
     788    public DateTime getStart() { 
     789      return start; 
     790    } 
     791 
     792    /** 
     793     * @return DateTime 
     794     */ 
     795    public DateTime getEnd() { 
     796      return end; 
     797    } 
     798 
     799    /** 
     800     * @return int 
     801     */ 
     802    public int getType() { 
     803      return type; 
     804    } 
     805 
     806    public int compareTo(Object o) { 
     807      if (!(o instanceof EventPeriod)) { 
     808        return -1; 
     809      } 
     810 
     811      EventPeriod that = (EventPeriod)o; 
     812 
     813      /* Sort by type first */ 
     814      if (type < that.type) { 
     815        return -1; 
     816      } 
     817 
     818      if (type > that.type) { 
     819        return 1; 
     820      } 
     821 
     822      int res = start.compareTo(that.start); 
     823      if (res != 0) { 
     824        return res; 
     825      } 
     826 
     827      return end.compareTo(that.end); 
     828    } 
     829 
     830    public boolean equals(Object o) { 
     831      return compareTo(o) == 0; 
     832    } 
     833 
     834    public int hashCode() { 
     835      return 7 * (type + 1) * (start.hashCode() + 1) * (end.hashCode() + 1); 
     836    } 
     837 
     838    public String toString() { 
     839      StringBuffer sb = new StringBuffer("EventPeriod{start="); 
     840 
     841      sb.append(start); 
     842      sb.append(", end="); 
     843      sb.append(end); 
     844      sb.append(", type="); 
     845      sb.append(type); 
     846      sb.append("}"); 
     847 
     848      return sb.toString(); 
     849    } 
     850  } 
    733851} 
    734  
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java

    r477 r507  
    5555 
    5656 
    57 import org.bedework.calfacade.BwAlarm; 
    58 import org.bedework.calfacade.BwCalendar; 
    59 import org.bedework.calfacade.BwCategory; 
    60 import org.bedework.calfacade.BwDateTime; 
    61 import org.bedework.calfacade.BwEvent; 
    62 import org.bedework.calfacade.BwLocation; 
    63 import org.bedework.calfacade.BwSponsor; 
    64 import org.bedework.calfacade.BwStats; 
    65 import org.bedework.calfacade.BwSynchInfo; 
    66 import org.bedework.calfacade.BwSynchState; 
    67 import org.bedework.calfacade.BwSystem; 
     57//import org.bedework.calfacade.BwAlarm; 
     58//import org.bedework.calfacade.BwCalendar; 
     59//import org.bedework.calfacade.BwCategory; 
     60//import org.bedework.calfacade.BwDateTime; 
     61//import org.bedework.calfacade.BwDuration; 
     62//import org.bedework.calfacade.BwEvent; 
     63//import org.bedework.calfacade.BwFreeBusy; 
     64//import org.bedework.calfacade.BwFreeBusyComponent; 
     65//import org.bedework.calfacade.BwLocation; 
     66//import org.bedework.calfacade.BwPrincipal; 
     67//import org.bedework.calfacade.BwSponsor; 
     68//import org.bedework.calfacade.BwStats; 
     69//import org.bedework.calfacade.BwSynchInfo; 
     70//import org.bedework.calfacade.BwSynchState; 
     71//import org.bedework.calfacade.BwSystem; 
    6872import org.bedework.calfacade.BwUser; 
    6973import org.bedework.calfacade.CalFacadeAccessException; 
    70 import org.bedework.calfacade.CalFacadeUnimplementedException; 
     74//import org.bedework.calfacade.CalFacadeDefs; 
     75//import org.bedework.calfacade.CalFacadeUnimplementedException; 
    7176import org.bedework.calfacade.CalFacadeException; 
     77//import org.bedework.calfacade.CalFacadeUtil; 
    7278import org.bedework.calfacade.CalintfDefs; 
    73 import org.bedework.calfacade.CoreEventInfo; 
    74 import org.bedework.calfacade.filter.BwFilter; 
    75 import org.bedework.calfacade.ifs.CalTimezones; 
     79//import org.bedework.calfacade.CoreEventInfo; 
     80//import org.bedework.calfacade.CalFacadeUtil.EventPeriod; 
     81//import org.bedework.calfacade.CalFacadeUtil.GetPeriodsPars; 
     82//import org.bedework.calfacade.filter.BwFilter; 
     83//import org.bedework.calfacade.ifs.CalTimezones; 
    7684import org.bedework.calfacade.ifs.Calintf; 
    77 import org.bedework.calfacade.ifs.CalintfInfo; 
     85//import org.bedework.calfacade.ifs.CalintfInfo; 
    7886import org.bedework.calfacade.ifs.Groups; 
    79  
    80 import edu.rpi.cct.uwcal.access.Acl.CurrentAccess; 
     87//import org.bedework.calfacade.svc.EventInfo; 
     88 
     89//import edu.rpi.cct.uwcal.access.Acl.CurrentAccess; 
    8190 
    8291import java.sql.Timestamp; 
    83 import java.util.Collection; 
    84 import java.util.TreeSet; 
    85  
    86 import net.fortuna.ical4j.model.component.VTimeZone; 
     92//import java.util.Collection; 
     93//import java.util.Iterator; 
     94//import java.util.TreeSet; 
     95 
     96//import net.fortuna.ical4j.model.DateTime; 
     97//import net.fortuna.ical4j.model.Period; 
     98//import net.fortuna.ical4j.model.component.VTimeZone; 
    8799 
    88100import org.apache.log4j.Logger; 
     
    92104* @author Mike Douglass   douglm@rpi.edu 
    93105*/ 
    94 public class CalintfBase implements Calintf { 
     106public abstract class CalintfBase implements Calintf { 
     107  protected String url; 
     108 
    95109  protected boolean debug; 
    96110 
     
    110124  /** Ensure we don't open while open 
    111125   */ 
    112   private boolean isOpen; 
     126  protected boolean isOpen; 
    113127 
    114128  /** Ignore owner for superuser 
     
    125139   * @see org.bedework.calfacade.Calintf#init(org.bedework.calfacade.BwUser, java.lang.String, boolean, boolean, boolean, java.lang.String, boolean) 
    126140   */ 
    127   public boolean init(String authenticatedUser, 
     141  public boolean init(String url, 
     142                      String authenticatedUser, 
    128143                      String user, 
    129144                      boolean publicAdmin, 
     
    131146                      String synchId, 
    132147                      boolean debug) throws CalFacadeException { 
     148    this.url = url; 
    133149    this.debug = debug; 
    134150    boolean userCreated = false; 
     
    153169  } 
    154170 
     171  public boolean getDebug() throws CalFacadeException { 
     172    return debug; 
     173  } 
     174 
     175  /* 
    155176  public void setSuperUser(boolean val) { 
    156177  } 
     
    160181  } 
    161182 
    162   /** Get the current stats 
    163    * 
    164    * @return BwStats object 
    165    * @throws CalFacadeException if not admin 
    166    */ 
    167183  public BwStats getStats() throws CalFacadeException { 
    168184    return null; 
     
    190206  } 
    191207 
    192   /** Get the timezones cache object 
    193    * 
    194    * @return CalTimezones object 
    195    * @throws CalFacadeException if not admin 
    196    */ 
    197208  public CalTimezones getTimezones() throws CalFacadeException { 
    198209    return null; 
     
    206217      ); 
    207218  } 
    208  
    209   public boolean getDebug() throws CalFacadeException { 
    210     return debug; 
    211   } 
     219  */ 
    212220 
    213221  public void setUser(String val) throws CalFacadeException { 
     
    216224    user = getUser(val); 
    217225    if (this.user == null) { 
    218       throw new CalFacadeException("User " + val + " does not exist."); 
     226      throw new CalFacadeException(CalFacadeException.noSuchAccount, val); 
    219227    } 
    220228 
     
    230238   * ==================================================================== */ 
    231239 
     240  /* 
    232241  public void flushAll() throws CalFacadeException { 
    233242    if (debug) { 
     
    235244    } 
    236245  } 
     246  */ 
    237247 
    238248  /** Default implementation fails if already open and sets the open flag 
     
    269279  } 
    270280 
     281  /* 
    271282  public void beginTransaction() throws CalFacadeException { 
    272283    checkOpen(); 
     
    284295    return null; 
    285296  } 
     297  */ 
    286298 
    287299  /* ==================================================================== 
     
    293305    checkOpen(); 
    294306    sess.flush(); 
    295   }*/ 
     307  } 
    296308 
    297309  public void refreshEvents() throws CalFacadeException { 
     
    299311  } 
    300312 
    301   /* 
    302313  public void lockRead(Object val) throws CalFacadeException { 
    303314    checkOpen(); 
     
    315326   * ==================================================================== */ 
    316327 
     328  /* 
    317329  public long getPublicLastmod() throws CalFacadeException { 
    318330    checkOpen(); 
     
    323335    return ""; 
    324336  } 
     337  */ 
    325338 
    326339  /* ==================================================================== 
     
    336349  } 
    337350 
     351  /* 
    338352  public void updateUser(BwUser user) throws CalFacadeException { 
    339353    checkOpen(); 
     
    352366  } 
    353367 
    354  
    355368  public BwUser getUser(String account) throws CalFacadeException { 
    356369    checkOpen(); 
     
    367380    throw new CalFacadeUnimplementedException(); 
    368381  } 
     382  */ 
    369383 
    370384  /* ==================================================================== 
     
    372386   * ==================================================================== */ 
    373387 
     388  /* 
    374389  public void changeAccess(BwShareableDbentity ent, 
    375390                           Collection aces) throws CalFacadeException { 
     
    382397    throw new CalFacadeUnimplementedException(); 
    383398  } 
     399  */ 
    384400 
    385401  /* ==================================================================== 
     
    387403   * ==================================================================== */ 
    388404 
     405  /* 
    389406  public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException { 
    390407    throw new CalFacadeUnimplementedException(); 
     
    407424    throw new CalFacadeUnimplementedException(); 
    408425  } 
     426  */ 
    409427 
    410428  /* ==================================================================== 
     
    412430   * ==================================================================== */ 
    413431 
     432  /* 
    414433  public BwCalendar getPublicCalendars() throws CalFacadeException { 
    415434    throw new CalFacadeUnimplementedException(); 
     
    505524    throw new CalFacadeUnimplementedException(); 
    506525  } 
     526  */ 
    507527 
    508528  /* ==================================================================== 
     
    510530   * ==================================================================== */ 
    511531 
     532  /* 
    512533  public void setSearch(String val) throws CalFacadeException { 
    513534    checkOpen(); 
     
    520541  } 
    521542 
    522   /
     543  /
    523544  public BwFilter getFilter(String name) throws CalFacadeException { 
    524545    checkOpen(); 
     
    547568 
    548569    return (BwFilter)sess.getUnique(); 
    549   } */ 
     570  } 
    550571 
    551572  public void addFilter(BwFilter val) throws CalFacadeException { 
     
    558579    throw new CalFacadeUnimplementedException(); 
    559580  } 
     581  */ 
    560582 
    561583  /* ==================================================================== 
     
    563585   * ==================================================================== */ 
    564586 
     587  /* 
    565588  public Collection getCategories(BwUser owner, BwUser creator) 
    566589        throws CalFacadeException { 
     
    605628    throw new CalFacadeUnimplementedException(); 
    606629  } 
     630  */ 
    607631 
    608632  /* ==================================================================== 
     
    610634   * ==================================================================== */ 
    611635 
     636  /* 
    612637  public Collection getLocations(BwUser owner, BwUser creator) 
    613638        throws CalFacadeException { 
     
    652677    throw new CalFacadeUnimplementedException(); 
    653678  } 
     679  */ 
    654680 
    655681  /* ==================================================================== 
     
    657683   * ==================================================================== */ 
    658684 
     685  /* 
    659686  public Collection getSponsors(BwUser owner, BwUser creator) 
    660687        throws CalFacadeException { 
     
    699726    throw new CalFacadeUnimplementedException(); 
    700727  } 
     728  */ 
    701729 
    702730  /* ==================================================================== 
     
    704732   * ==================================================================== */ 
    705733 
     734  /* 
    706735  public CoreEventInfo getEvent(int id) throws CalFacadeException { 
    707736    checkOpen(); 
     
    746775    throw new CalFacadeUnimplementedException(); 
    747776  } 
     777  */ 
    748778 
    749779  /* ==================================================================== 
     
    753783   * ==================================================================== */ 
    754784 
     785  /* 
    755786  public Collection getEventsByName(BwCalendar cal, String val) 
    756787          throws CalFacadeException { 
     
    758789    throw new CalFacadeUnimplementedException(); 
    759790  } 
     791  */ 
    760792 
    761793  /* ==================================================================== 
     
    763795   * ==================================================================== */ 
    764796 
     797  /* 
    765798  public BwSynchInfo getSynchInfo() throws CalFacadeException { 
    766799    checkOpen(); 
     
    840873    throw new CalFacadeUnimplementedException(); 
    841874  } 
     875  */ 
    842876 
    843877  /* ==================================================================== 
     
    845879   * ==================================================================== */ 
    846880 
     881  /* 
    847882  public Collection getAlarms(BwEvent event, BwUser user) throws CalFacadeException { 
    848883    checkOpen(); 
     
    874909    throw new CalFacadeUnimplementedException(); 
    875910  } 
     911  */ 
    876912 
    877913  /* ==================================================================== 
     
    894930  protected Logger getLogger() { 
    895931    if (log == null) { 
    896       log = Logger.getLogger(this.getClass()); 
     932      log = Logger.getLogger(getClass()); 
    897933    } 
    898934 
     
    904940  } 
    905941 
     942  protected void error(Throwable t) { 
     943    getLogger().error(this, t); 
     944  } 
     945 
    906946  protected void trace(String msg) { 
     947    getLogger().debug(msg); 
     948  } 
     949 
     950  protected void debug(String msg) { 
    907951    getLogger().debug(msg); 
    908952  } 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java

    r415 r507  
    5555 
    5656import org.bedework.calfacade.BwAlarm; 
     57import org.bedework.calfacade.BwCalendar; 
    5758import org.bedework.calfacade.BwCategory; 
     59import org.bedework.calfacade.BwDateTime; 
     60import org.bedework.calfacade.BwDuration; 
    5861import org.bedework.calfacade.BwEvent; 
     62import org.bedework.calfacade.BwFreeBusy; 
    5963import org.bedework.calfacade.BwLocation; 
     64import org.bedework.calfacade.BwPrincipal; 
    6065import org.bedework.calfacade.BwSponsor; 
    6166import org.bedework.calfacade.BwStats; 
     
    95100  /** Must be called to initialise the new object. 
    96101   * 
     102   * @param url         String url to which we are connecting 
    97103   * @param authenticatedUser    String authenticated user of the application 
    98104   *                             or null for guest 
     
    106112   * @throws CalFacadeException 
    107113   */ 
    108   public boolean init(String authenticatedUser, 
     114  public boolean init(String url, 
     115                      String authenticatedUser, 
    109116                      String user, 
    110117                      boolean publicAdmin, 
     
    112119                      String synchId, 
    113120                      boolean debug) throws CalFacadeException; 
     121 
     122  /** Can be called after init to flag the arrival of a user. 
     123   * 
     124   * @param val       true for a super user 
     125   * @throws CalFacadeException 
     126   */ 
     127  public void logon(BwUser val) throws CalFacadeException; 
    114128 
    115129  /** Called after init to flag this user as a super user. 
     
    692706   */ 
    693707  public Collection getSponsorRefs(BwSponsor val) throws CalFacadeException; 
     708 
     709  /* ==================================================================== 
     710   *                   Free busy 
     711   * ==================================================================== */ 
     712 
     713  /** 
     714   * @param cal 
     715   * @param who 
     716   * @param start 
     717   * @param end 
     718   * @param granularity 
     719   * @param returnAll 
     720   * @param ignoreTransparency 
     721   * @return  BwFreeBusy object representing the calendar (or principals) 
     722   *          free/busy 
     723   * @throws CalFacadeException 
     724   */ 
     725  public BwFreeBusy getFreeBusy(BwCalendar cal, BwPrincipal who, 
     726                                BwDateTime start, BwDateTime end, 
     727                                BwDuration granularity, 
     728                                boolean returnAll, 
     729                                boolean ignoreTransparency) 
     730          throws CalFacadeException; 
    694731 
    695732  /* ==================================================================== 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java

    r490 r507  
    10381038    try { 
    10391039      /* Deal with webdav properties */ 
    1040       if (!ns.equals(CaldavDefs.caldavNamespace)) { 
     1040      if ((!ns.equals(CaldavDefs.caldavNamespace) && 
     1041          !ns.equals(CaldavDefs.icalNamespace))) { 
    10411042        // Not ours 
    10421043        super.generatePropValue(node, pr); 
     
    10441045      } 
    10451046 
    1046       if (tag.equals(CaldavTags.calendarDescription)) { 
     1047      // XXX Change this to have node class generate??? 
     1048      if (tag.equals(ICalTags.summary)) { 
     1049        openPropstat(); 
     1050        xml.property(tag, pr.getPval()); 
     1051        closePropstat(); 
     1052      } else if (tag.equals(ICalTags.dtstart)) { 
     1053        openPropstat(); 
     1054        xml.property(tag, pr.getPval()); 
     1055        closePropstat(); 
     1056      } else if (tag.equals(ICalTags.dtend)) { 
     1057        openPropstat(); 
     1058        xml.property(tag, pr.getPval()); 
     1059        closePropstat(); 
     1060      } else if (tag.equals(ICalTags.duration)) { 
     1061        openPropstat(); 
     1062        xml.property(tag, pr.getPval()); 
     1063        closePropstat(); 
     1064      } else if (tag.equals(ICalTags.transp)) { 
     1065        openPropstat(); 
     1066        xml.property(tag, pr.getPval()); 
     1067        closePropstat(); 
     1068      } else if (tag.equals(ICalTags.due)) { 
     1069        openPropstat(); 
     1070        xml.property(tag, pr.getPval()); 
     1071        closePropstat(); 
     1072      } else if (tag.equals(ICalTags.status)) { 
     1073        openPropstat(); 
     1074        xml.property(tag, pr.getPval()); 
     1075        closePropstat(); 
     1076      } else if (tag.equals(ICalTags.uid)) { 
     1077        openPropstat(); 
     1078        xml.property(tag, pr.getPval()); 
     1079        closePropstat(); 
     1080      } else if (tag.equals(ICalTags.sequence)) { 
     1081        openPropstat(); 
     1082        xml.property(tag, pr.getPval()); 
     1083        closePropstat(); 
     1084      } else if (tag.equals(ICalTags.hasRecurrence)) { 
     1085        openPropstat(); 
     1086        xml.property(tag, pr.getPval()); 
     1087        closePropstat(); 
     1088      } else if (tag.equals(ICalTags.hasAlarm)) { 
     1089        openPropstat(); 
     1090        xml.property(tag, pr.getPval()); 
     1091        closePropstat(); 
     1092      } else if (tag.equals(ICalTags.hasAttachment)) { 
     1093        openPropstat(); 
     1094        xml.property(tag, pr.getPval()); 
     1095        closePropstat(); 
     1096      } else if (tag.equals(CaldavTags.calendarDescription)) { 
    10471097        if ((cal != null) && (cal.getDescription() != null)) { 
    10481098          // XXX lang 
     
    13951445      } 
    13961446 
     1447      if (uri.endsWith("/")) { 
     1448        uri = uri.substring(0, uri.length() - 1); 
     1449      } 
     1450 
    13971451      String[] ss = uri.split("/"); 
    13981452      int pathLength = ss.length - 1;  // First element is empty string 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWServlet.java

    r490 r507  
    107107    // Replace methods 
    108108    methods.put("MKCALENDAR", new MkcalendarMethod()); 
     109    methods.put("OPTIONS", new CalDavOptionsMethod()); 
    109110    methods.put("REPORT", new ReportMethod()); 
    110111  } 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBwNode.java

    r2 r507  
    6363import java.io.StringReader; 
    6464import java.io.Reader; 
     65import java.util.ArrayList; 
    6566import java.util.Collection; 
    66 import java.util.Vector; 
    6767 
    6868/** Class to represent a caldav node. 
     
    133133   */ 
    134134  public Collection getProperties(String ns) throws WebdavIntfException { 
    135     return new Vector(); 
     135    return new ArrayList(); 
    136136  } 
    137137 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavCalNode.java

    r472 r507  
    156156      VFreeBusy vfreeBusy = VFreeUtil.toVFreeBusy(fb); 
    157157      if (vfreeBusy != null) { 
    158         ical = new Calendar(); 
     158        ical = IcalTranslator.newIcal(); 
    159159        ical.getComponents().add(vfreeBusy); 
    160160        vfreeBusyString = ical.toString(); 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/MkcalendarMethod.java

    r491 r507  
    5858 
    5959import edu.rpi.cct.webdav.servlet.common.PropPatchMethod; 
    60 import edu.rpi.cct.webdav.servlet.common.Property; 
    6160import edu.rpi.cct.webdav.servlet.shared.WebdavBadRequest; 
    6261import edu.rpi.cct.webdav.servlet.shared.WebdavException; 
    63 import edu.rpi.cct.webdav.servlet.shared.WebdavNsIntf; 
    6462import edu.rpi.cct.webdav.servlet.shared.WebdavNsNode; 
    6563 
     
    114112                            Document doc) throws WebdavException { 
    115113    try { 
    116       WebdavNsIntf intf = getNsIntf(); 
    117  
    118114      Element root = doc.getDocumentElement(); 
    119115 
     
    134130        Iterator pit = sr.iterator(); 
    135131        while (pit.hasNext()) { 
    136           Property prop = (Property)pit.next(); 
     132          Element prop = (Element)pit.next(); 
     133 
     134          if (nodeMatches(prop, CaldavTags.calendarDescription)) { 
     135            // Some way to set description 
     136          } 
    137137        } 
    138138      } 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/calquery/FreeBusyQuery.java

    r490 r507  
    137137        throw WebdavIntfException.unauthorized(); 
    138138      } 
    139       BwFreeBusy fb = svci.getFreeBusy(cal, user, 
     139 
     140      if (svci.isUserRoot(cal)) { 
     141        cal = null; 
     142      } 
     143 
     144      BwFreeBusy fb = svci.getFreeBusy(null, cal, user, 
    140145                                       timeRange.getStart(), timeRange.getEnd(), 
    141146                                       null, false); 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/OptionsMethod.java

    r2 r507  
    5252    to the maximum extent the law permits. 
    5353*/ 
    54  
    5554package edu.rpi.cct.webdav.servlet.common; 
    5655 
     
    9190      } 
    9291 
    93       if (getNsIntf().getAccessControl()) { 
    94         resp.addHeader("DAV", "1, 2, access-control"); 
    95       } else { 
    96         resp.addHeader("DAV", "1, 2"); 
    97       } 
     92      addDavHeader(resp); 
    9893 
    9994      // Lisa say's we need this 
     
    119114    } 
    120115  } 
     116 
     117  protected void addDavHeader(HttpServletResponse resp) throws WebdavException { 
     118    if (getNsIntf().getAccessControl()) { 
     119      resp.addHeader("DAV", "1, 2, 3, access-control"); 
     120    } else { 
     121      resp.addHeader("DAV", "1, 2, 3"); 
     122    } 
     123  } 
    121124} 
    122125 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/PropPatchMethod.java

    r490 r507  
    156156      Element prop = props[i]; 
    157157 
    158       String ns = prop.getNamespaceURI(); 
    159       String nm = prop.getLocalName(); 
    160158      String value = getElementContent(prop); 
    161159 
     
    164162      } 
    165163 
    166       plist.add(new Property(ns, nm, value)); 
     164      plist.add(prop); 
    167165 
    168166      if (debug) { 
    169         trace("reqtype: " + nm + " ns: " + ns + " value: " + value); 
     167        trace("reqtype: " + prop.getLocalName() + 
     168              " ns: " + prop.getNamespaceURI() + 
     169              " value: " + value); 
    170170      } 
    171171    } 
  • trunk/calendar3/caldavClientApi/src/org/bedework/caldav/client/CalintfCaldavImpl.java

    r466 r507  
    5959import org.bedework.calfacade.BwCategory; 
    6060import org.bedework.calfacade.BwDateTime; 
     61import org.bedework.calfacade.BwDuration; 
    6162import org.bedework.calfacade.BwEvent; 
     63import org.bedework.calfacade.BwFreeBusy; 
    6264import org.bedework.calfacade.BwLocation; 
     65import org.bedework.calfacade.BwPrincipal; 
    6366import org.bedework.calfacade.BwSponsor; 
    6467import org.bedework.calfacade.BwStats; 
     68import org.bedework.calfacade.BwSystem; 
    6569import org.bedework.calfacade.CoreEventInfo; 
    6670//import org.bedework.calfacade.BwSynchData; 
     
    110114   * @see org.bedework.calfacade.Calintf#init(org.bedework.calfacade.BwUser, java.lang.String, boolean, boolean, boolean, java.lang.String, boolean) 
    111115   */ 
    112   public boolean init(String authenticatedUser, 
     116  public boolean init(String url, 
     117                      String authenticatedUser, 
    113118                      String user, 
    114119                      boolean publicAdmin, 
     
    116121                      String synchId, 
    117122                      boolean debug) throws CalFacadeException { 
    118     boolean userAdded = super.init(authenticatedUser, user, publicAdmin, 
     123    boolean userAdded = super.init(url, authenticatedUser, user, publicAdmin, 
    119124                                   groups, synchId, debug); 
    120125 
     
    130135  } 
    131136 
    132   /** Get the current stats 
    133    * 
    134    * @return BwStats object 
    135    * @throws CalFacadeException if not admin 
    136    */ 
     137  public void logon(BwUser val) throws CalFacadeException { 
     138    checkOpen(); 
     139    throw new CalFacadeUnimplementedException(); 
     140  } 
     141 
     142  public void setSuperUser(boolean val) { 
     143  } 
     144 
     145  public boolean getSuperUser() { 
     146    return false; 
     147  } 
     148 
    137149  public BwStats getStats() throws CalFacadeException { 
    138150    return null; 
    139151  } 
    140152 
    141   /** Get the timezones cache object 
    142    * 
    143    * @return CalTimezones object 
    144    * @throws CalFacadeException if not admin 
    145    */ 
     153  public void setDbStatsEnabled(boolean enable) throws CalFacadeException { 
     154  } 
     155 
     156  public boolean getDbStatsEnabled() throws CalFacadeException { 
     157    return false; 
     158  } 
     159 
     160  public void dumpDbStats() throws CalFacadeException { 
     161  } 
     162 
     163  public Collection getDbStats() throws CalFacadeException { 
     164    return null; 
     165  } 
     166 
     167  public BwSystem getSyspars() throws CalFacadeException { 
     168    return null; 
     169  } 
     170 
     171  public void updateSyspars(BwSystem val) throws CalFacadeException { 
     172  } 
     173 
    146174  public CalTimezones getTimezones() throws CalFacadeException { 
    147175    return null; 
     
    150178  public CalintfInfo getInfo() throws CalFacadeException { 
    151179    return info; 
    152   } 
    153  
    154   public boolean getDebug() throws CalFacadeException { 
    155     return debug; 
    156180  } 
    157181 
     
    181205  } 
    182206 
    183   public synchronized void open() throws CalFacadeException { 
    184     super.open(); 
    185   } 
    186  
    187   public synchronized void close() throws CalFacadeException { 
    188     super.close(); 
    189   } 
    190  
    191207  public void beginTransaction() throws CalFacadeException { 
    192208    checkOpen(); 
     
    209225   * ==================================================================== */ 
    210226 
    211   /* 
    212   public void refresh() throws CalFacadeException { 
    213     checkOpen(); 
    214     sess.flush(); 
    215   }*/ 
    216  
    217227  public void refreshEvents() throws CalFacadeException { 
    218228    checkOpen(); 
    219229  } 
    220  
    221   /* 
    222   public void lockRead(Object val) throws CalFacadeException { 
    223     checkOpen(); 
    224     sess.lockRead(val); 
    225   } 
    226  
    227   public void lockMod(Object val) throws CalFacadeException { 
    228     checkOpen(); 
    229     sess.lockUpdate(val); 
    230   } 
    231   */ 
    232230 
    233231  /* ==================================================================== 
     
    248246   * ==================================================================== */ 
    249247 
    250   public BwUser getUser() throws CalFacadeException { 
    251     return user; 
     248  public void updateUser(BwUser user) throws CalFacadeException { 
     249    checkOpen(); 
     250    throw new CalFacadeUnimplementedException(); 
     251  } 
     252 
     253  public void addUser(BwUser user) throws CalFacadeException { 
     254    checkOpen(); 
     255 
     256    throw new CalFacadeUnimplementedException(); 
    252257  } 
    253258 
     
    257262  } 
    258263 
    259  
    260264  public BwUser getUser(String user) throws CalFacadeException { 
    261265    checkOpen(); 
     
    263267  } 
    264268 
    265   public void addUser(BwUser user) throws CalFacadeException { 
    266     checkOpen(); 
    267  
    268     throw new CalFacadeUnimplementedException(); 
    269   } 
    270  
    271   public void updateUser() throws CalFacadeException { 
    272     updateUser(getUser()); 
    273   } 
    274  
    275   public void updateUser(BwUser user) throws CalFacadeException { 
    276     checkOpen(); 
    277     throw new CalFacadeUnimplementedException(); 
    278   } 
    279  
    280   /* 
    281   public void deleteUser(BwUser user) throws CalFacadeException { 
    282     checkOpen(); 
    283     throw new CalFacadeException("Unimplemented"); 
    284   }*/ 
    285  
    286   private void logon(BwUser val) throws CalFacadeException { 
     269  public Collection getInstanceOwners() throws CalFacadeException { 
    287270    checkOpen(); 
    288271    throw new CalFacadeUnimplementedException(); 
     
    345328 
    346329  public BwCalendar getCalendars() throws CalFacadeException { 
     330    throw new CalFacadeUnimplementedException(); 
     331  } 
     332 
     333  public BwCalendar getCalendars(BwUser user, 
     334                                 int desiredAccess) throws CalFacadeException { 
    347335    throw new CalFacadeUnimplementedException(); 
    348336  } 
     
    389377  } 
    390378 
     379  public BwCalendar getSpecialCalendar(BwUser user, 
     380                                       int calType, 
     381                                       boolean create) throws CalFacadeException { 
     382    throw new CalFacadeUnimplementedException(); 
     383  } 
     384 
    391385  public void addCalendar(BwCalendar val, String parentPath) throws CalFacadeException { 
    392386    checkOpen(); 
     
    396390 
    397391  public void updateCalendar(BwCalendar val) throws CalFacadeException { 
     392    checkOpen(); 
     393    throw new CalFacadeUnimplementedException(); 
     394  } 
     395 
     396  public void changeAccess(BwCalendar cal, 
     397                           Collection aces) throws CalFacadeException { 
    398398    checkOpen(); 
    399399    throw new CalFacadeUnimplementedException(); 
     
    573573    checkOpen(); 
    574574 
     575    throw new CalFacadeUnimplementedException(); 
     576  } 
     577 
     578  /* ==================================================================== 
     579   *                   Free busy 
     580   * ==================================================================== */ 
     581 
     582  public BwFreeBusy getFreeBusy(BwCalendar cal, BwPrincipal who, 
     583                                BwDateTime start, BwDateTime end, 
     584                                BwDuration granularity, 
     585                                boolean returnAll, 
     586                                boolean ignoreTransparency) 
     587          throws CalFacadeException { 
    575588    throw new CalFacadeUnimplementedException(); 
    576589  } 
     
    615628  } 
    616629 
     630  public Collection getDeletedProxies() throws CalFacadeException { 
     631    throw new CalFacadeUnimplementedException(); 
     632  } 
     633 
     634  public Collection getDeletedProxies(BwCalendar cal) throws CalFacadeException { 
     635    throw new CalFacadeUnimplementedException(); 
     636  } 
     637 
    617638  /* ==================================================================== 
    618639   *                       Caldav support 
     
    742763    throw new CalFacadeUnimplementedException(); 
    743764  } 
     765 
     766  /* ==================================================================== 
     767   *                   Free busy 
     768   * ==================================================================== */ 
    744769} 
    745770 
  • trunk/calendar3/caldavClientApi/src/org/bedework/caldav/client/api/CaldavClientIo.java

    r490 r507  
    5757import org.bedework.calfacade.CalFacadeException; 
    5858import org.bedework.http.client.caldav.CaldavClient; 
     59import org.bedework.http.client.DepthHttpMethod; 
    5960import org.bedework.http.client.HttpManager; 
    6061 
     
    135136   * @param url 
    136137   * @param hdrs 
     138   * @param depth 
    137139   * @param contentType 
    138140   * @param contentLen 
     
    142144   */ 
    143145  public int sendRequest(String method, String url, 
    144                          Header[] hdrs, String contentType, int contentLen, 
     146                         Header[] hdrs, int depth, 
     147                         String contentType, int contentLen, 
    145148                         byte[] content) throws Throwable { 
    146     return sendRequest(method, url, null, null, hdrs, contentType, contentLen, content); 
     149    return sendRequest(method, url, null, null, hdrs, depth, 
     150                       contentType, contentLen, content); 
    147151  } 
    148152 
     
    154158   * @param pw 
    155159   * @param hdrs 
     160   * @param depth 
    156161   * @param contentType 
    157162   * @param contentLen 
     
    161166   */ 
    162167  public int sendRequest(String method, String url, String user, String pw, 
    163                          Header[] hdrs, String contentType, int contentLen, 
     168                         Header[] hdrs, int depth, 
     169                         String contentType, int contentLen, 
    164170                         byte[] content) throws Throwable { 
    165171    int sz = 0; 
     
    175181 
    176182    HttpMethod meth = client.getMethod(); 
     183 
     184    if (meth instanceof DepthHttpMethod) { 
     185      ((DepthHttpMethod)meth).setDepth(depth); 
     186    } 
    177187 
    178188    if (user != null) { 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java

    r501 r507  
    730730  } 
    731731 
     732  public boolean isUserRoot(BwCalendar cal) throws CalFacadeException { 
     733    if (cal == null) { 
     734      return false; 
     735    } 
     736 
     737    String[] ss = cal.getPath().split("/"); 
     738    int pathLength = ss.length - 1;  // First element is empty string 
     739 
     740    return (pathLength == 2) && 
     741           (ss[1].equals(getSyspars().getUserCalendarRoot())); 
     742  } 
     743 
    732744  /* ==================================================================== 
    733745   *                   Views 
     
    10221034   * ==================================================================== */ 
    10231035 
    1024   public BwFreeBusy getFreeBusy(BwCalendar cal, BwPrincipal who, 
     1036  public BwFreeBusy getFreeBusy(Collection subs, 
     1037                                BwCalendar cal, BwPrincipal who, 
    10251038                                BwDateTime start, BwDateTime end, 
    10261039                                BwDuration granularity, 
     
    10321045 
    10331046    BwUser u = (BwUser)who; 
    1034     Collection subs; 
    1035  
    1036     /* See if the calendar is a user root. */ 
    1037  
    1038     if (cal != null) { 
    1039       String[] ss = cal.getPath().split("/"); 
    1040       int pathLength = ss.length - 1;  // First element is empty string 
    1041  
    1042       if ((pathLength == 2) && 
    1043           (ss[1].equals(getSyspars().getUserCalendarRoot()))) { 
    1044         cal = null; 
    1045       } 
    1046     } 
    1047  
    1048     if (cal != null) { 
     1047 
     1048    if (subs != null) { 
     1049      // Use these 
     1050    } else if (cal != null) { 
    10491051      getCal().checkAccess(cal, PrivilegeDefs.privReadFreeBusy, false); 
    10501052 
     
    10921094        if (!sub.getIgnoreTransparency() && 
    10931095            BwEvent.transparencyTransparent.equals(ev.getTransparency())) { 
     1096          // Ignore this one. 
     1097          continue; 
     1098        } 
     1099 
     1100        if (BwEvent.statusCancelled.equals(ev.getStatus())) { 
    10941101          // Ignore this one. 
    10951102          continue; 
     
    11481155            } 
    11491156          } else if (periodEvents.size() != 0) { 
    1150             // Some events fall in the period. Add an entry. 
     1157            /* Some events fall in the period. Add an entry. 
     1158             * We eliminated cancelled events earler. Now we should set the 
     1159             * free/busy type based on the events status. 
     1160             */ 
    11511161 
    11521162            DateTime psdt = new DateTime(gpp.startDt.getDtval()); 
     
    11551165            psdt.setUtc(true); 
    11561166            pedt.setUtc(true); 
     1167 
     1168            if (fbc == null) { 
     1169              fbc = new BwFreeBusyComponent(); 
     1170              fb.addTime(fbc); 
     1171            } 
     1172 
    11571173            fbc.addPeriod(new Period(psdt, pedt)); 
    11581174          } 
     
    11691185        EventInfo ei = (EventInfo)it.next(); 
    11701186        BwEvent ev = ei.getEvent(); 
     1187 
     1188        if (BwEvent.statusCancelled.equals(ev.getStatus())) { 
     1189          // Ignore this one. 
     1190          continue; 
     1191        } 
    11711192 
    11721193        // Ignore if times were specified and this event is outside the times 
     
    11981219        pedt.setUtc(true); 
    11991220 
    1200         eventPeriods.add(new EventPeriod(psdt, pedt)); 
     1221        int type = BwFreeBusyComponent.typeBusy; 
     1222 
     1223        if (BwEvent.statusTentative.equals(ev.getStatus())) { 
     1224          type = BwFreeBusyComponent.typeBusyTentative; 
     1225       } 
     1226 
     1227        eventPeriods.add(new EventPeriod(psdt, pedt, type)); 
    12011228      } 
    12021229 
     
    12091236       */ 
    12101237      BwFreeBusyComponent fbc = null; 
     1238      int lastType = 0; 
    12111239 
    12121240      it = eventPeriods.iterator(); 
     
    12141242        EventPeriod ep = (EventPeriod)it.next(); 
    12151243 
     1244        if (debug) { 
     1245          trace(ep.toString()); 
     1246        } 
     1247 
    12161248        if (p == null) { 
    12171249          p = new Period(ep.start, ep.end); 
    1218         } else if (ep.start.after(p.getEnd())) { 
     1250          lastType = ep.type; 
     1251        } else if ((lastType != ep.type) || ep.start.after(p.getEnd())) { 
    12191252          // Non adjacent periods 
    12201253          if (fbc == null) { 
    12211254            fbc = new BwFreeBusyComponent(); 
     1255            fbc.setType(lastType); 
     1256            fb.addTime(fbc); 
    12221257          } 
    12231258          fbc.addPeriod(p); 
     1259 
     1260          if (lastType != ep.type) { 
     1261            fbc = null; 
     1262          } 
     1263 
    12241264          p = new Period(ep.start, ep.end); 
     1265          lastType = ep.type; 
    12251266        } else if (ep.end.after(p.getEnd())) { 
    12261267          // Extend the current period 
     
    12301271 
    12311272      if (p != null) { 
    1232         if (fbc == null) { 
     1273        if ((fbc == null) || (lastType != fbc.getType())) { 
    12331274          fbc = new BwFreeBusyComponent(); 
     1275          fbc.setType(lastType); 
     1276          fb.addTime(fbc); 
    12341277        } 
    12351278        fbc.addPeriod(p); 
    12361279      } 
    1237  
    1238       if (fbc != null) { 
    1239         fb.addTime(fbc); 
    1240       } 
    12411280    } catch (Throwable t) { 
     1281      if (debug) { 
     1282        error(t); 
     1283      } 
    12421284      throw new CalFacadeException(t); 
    12431285    } 
     
    12491291    DateTime start; 
    12501292    DateTime end; 
    1251  
    1252     EventPeriod(DateTime start, DateTime end) { 
     1293    int type;  // from BwFreeBusyComponent 
     1294 
     1295    EventPeriod(DateTime start, DateTime end, int type) { 
    12531296      this.start = start; 
    12541297      this.end = end; 
     1298      this.type = type; 
    12551299    } 
    12561300 
     
    12621306      EventPeriod that = (EventPeriod)o; 
    12631307 
     1308      /* Sort by type first */ 
     1309      if (type < that.type) { 
     1310        return -1; 
     1311      } 
     1312 
     1313      if (type > that.type) { 
     1314        return 1; 
     1315      } 
     1316 
    12641317      int res = start.compareTo(that.start); 
    12651318      if (res != 0) { 
     
    12681321 
    12691322      return end.compareTo(that.end); 
     1323    } 
     1324 
     1325    public boolean equals(Object o) { 
     1326      return compareTo(o) == 0; 
     1327    } 
     1328 
     1329    public int hashCode() { 
     1330      return 7 * (type + 1) * (start.hashCode() + 1) * (end.hashCode() + 1); 
     1331    } 
     1332 
     1333    public String toString() { 
     1334      StringBuffer sb = new StringBuffer("EventPeriod{start="); 
     1335 
     1336      sb.append(start); 
     1337      sb.append(", end="); 
     1338      sb.append(end); 
     1339      sb.append(", type="); 
     1340      sb.append(type); 
     1341      sb.append("}"); 
     1342 
     1343      return sb.toString(); 
    12701344    } 
    12711345  } 
     
    19211995      // Explicitly selected calendar - via a subscription. 
    19221996 
    1923       return postProcess(getCal().getEvents(sub.getCalendar(), filter, startDate
    1924                                             endDate, recurRetrieval
    1925                                             freeBusy, true), 
     1997      return postProcess(getCal(sub).getEvents(sub.getCalendar(), filter
     1998                                               startDate, endDate
     1999                                               recurRetrieval, freeBusy, true), 
    19262000                         sub); 
    19272001    } 
     
    22122286  }*/ 
    22132287 
     2288  /* This will get a calintf based on the subscription uri. 
     2289   */ 
     2290  Calintf getCal(BwSubscription sub) throws CalFacadeException { 
     2291    return getCal(); 
     2292  } 
     2293 
     2294  /* Currently this gets a local calintf only. Later we need to use a par to 
     2295   * get calintf from a table. 
     2296   */ 
    22142297  Calintf getCal() throws CalFacadeException { 
    22152298    if (cali != null) { 
     
    22272310      cali.beginTransaction(); 
    22282311 
    2229       boolean userCreated = cali.init(pars.getAuthUser(), 
     2312      boolean userCreated = cali.init(null, 
     2313                                      pars.getAuthUser(), 
    22302314                                      pars.getUser(), 
    22312315                                      pars.getPublicAdmin(), 
     
    25492633    getLogger().debug(msg); 
    25502634  } 
     2635 
     2636  private void error(Throwable t) { 
     2637    getLogger().error(this, t); 
     2638  } 
    25512639} 
    25522640 
  • trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java

    r501 r507  
    612612  public abstract int deleteCalendar(BwCalendar val) throws CalFacadeException; 
    613613 
     614  /** Return true if cal != null and it represents a (local) user root 
     615   * 
     616   * @param cal 
     617   * @return boolean 
     618   * @throws CalFacadeException 
     619   */ 
     620  public abstract boolean isUserRoot(BwCalendar cal) throws CalFacadeException; 
     621 
    614622  /* ==================================================================== 
    615623   *                   Views 
     
    812820   * events fall in the segment. 
    813821   * 
    814    * @param cal    Calendar to provide free-busy for. Null or the user root 
     822   * @param subs   If non-null use these as the subscriptions. 
     823   * @param cal    Calendar to provide free-busy for. Null for the user root 
    815824   *               for default collection (as specified by user). 
    816    * @param who 
     825   *               Used for local access to a given calendar via e.g. caldav 
     826   * @param who    If sub and cal are null get the info for this user, otherwise 
     827   *               this si used as the free/busy result owner 
    817828   * @param start 
    818829   * @param end 
     
    825836   * @throws CalFacadeException 
    826837   */ 
    827   public abstract BwFreeBusy getFreeBusy(BwCalendar cal, BwPrincipal who, 
     838  public abstract BwFreeBusy getFreeBusy(Collection subs, 
     839                                         BwCalendar cal, BwPrincipal who, 
    828840                                         BwDateTime start, BwDateTime end, 
    829841                                         BwDuration granularity, 
  • trunk/calendar3/freebusyServer/src/org/bedework/freebusyServer/FreeBusyAggregator.java

    r490 r507  
    134134//    req.addContentLine("                end=\"" + 
    135135//                               CalFacadeUtil.isoDateTimeUTC(end) + "\"/>"); 
    136     req.addContentLine("  <C:time-range start=\"20060521T131358Z\""); 
    137     req.addContentLine("                end=\"20060528T131358Z\"/>"); 
     136    req.addContentLine("  <C:time-range start=\"20060601T131358Z\""); 
     137    req.addContentLine("                end=\"20060631T131358Z\"/>"); 
    138138    req.addContentLine("</C:free-busy-query>"); 
    139139 
     
    158158                         "/ucaldav/user/johnsa")); 
    159159                         */ 
    160  
     160    /* 
    161161    addUser(new UserInfo("testuser02", "bedework", "testuser02", 
    162162                         "www.bedework.org", 80, false, 
    163163                         "/ucaldav/user/testuser02")); 
    164     addUser(new UserInfo("testuser03", "bedework", "testuser03", 
     164                         */ 
     165    addUser(new UserInfo("douglm", "bedework", "douglm", 
     166                         "localhost", 8080, false, 
     167                         "/ucaldav/user/douglm")); 
     168/* 
     169    addUser(new UserInfo("testuser02", "bedework", "testuser02", 
    165170                         "www.bedework.org", 80, false, 
    166                          "/ucaldav/user/testuser03")); 
    167  
     171                         "/ucaldav/user/testuser02")); 
     172    addUser(new UserInfo("testuser08", "bedework", "testuser08", 
     173                         "www.bedework.org", 80, false, 
     174                         "/ucaldav/user/testuser08")); 
     175*/ 
    168176    getSvci(); // 
    169177  } 
     
    185193      if (r.getAuth()) { 
    186194        resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), 
    187                                             r.getUser(), r.getPw(), r.getHeaders(), 
     195                                            r.getUser(), r.getPw(), 
     196                                            r.getHeaders(), 0, 
    188197                                            r.getContentType(), 
    189198                                            r.getContentLength(), r.getContentBytes()); 
    190199      } else { 
    191         resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), r.getHeaders(), 
     200        resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), 
     201                                            r.getHeaders(), 0, 
    192202                                            r.getContentType(), r.getContentLength(), 
    193203                                            r.getContentBytes()); 
  • trunk/calendar3/test/caldavTestData/eg/content/eg02.xml

    r2 r507  
    3030    <C:comp-filter name="VCALENDAR"> 
    3131      <C:comp-filter name="VEVENT"> 
    32         <C:time-range start="20050402T000000Z" 
    33                       end="20050602T235959Z"/> 
     32        <C:time-range start="20060601T000000Z" 
     33                      end="20060630T235959Z"/> 
    3434      </C:comp-filter> 
    3535    </C:comp-filter> 
  • trunk/calendar3/test/caldavTestData/eg/content/eg20.xml

    r423 r507  
    11<?xml version="1.0" encoding="utf-8" ?> 
    22<C:free-busy-query xmlns:C="urn:ietf:params:xml:ns:caldav"> 
    3   <C:time-range start="@NOW@" 
    4                   end="@NEXTWEEK@"/> 
     3  <C:time-range start="20060601T131358Z" 
     4                  end="20060701T131358Z"/> 
     5<!--  <C:time-range start="@NOW@" 
     6                  end="@NEXTWEEK@"/> --> 
    57</C:free-busy-query> 
    68 
  • trunk/calendar3/test/caldavTestData/eg/eg12.test

    r2 r507  
    1414<?xml version="1.0" encoding="utf-8" ?> 
    1515<C:free-busy-query xmlns:C="urn:ietf:params:xml:ns:caldav"> 
    16   <C:time-range start="20050701T000000Z" 
    17                   end="20050731T240000Z"/> 
     16  <C:time-range start="20060401T000000Z" 
     17                  end="20060731T240000Z"/> 
    1818</C:free-busy-query> 
    1919 
  • trunk/calendar3/test/caldavTestData/eg/eg16.test

    r2 r507  
    55AUTH: true 
    66 
    7 URL: newcol 
     7URL: RPI_TEST 
    88 
  • trunk/calendar3/test/caldavTestData/eg/eg17.test

    r2 r507  
    55AUTH: true 
    66 
    7 URL: newcol/newcalendar 
     7URL: RPI_TEST/RPI_TEST/ 
    88 
  • trunk/calendar3/test/src/org/bedework/tests/caldav/Req.java

    r420 r507  
    7474  String description; 
    7575  Header[] hdrs; 
     76  int depth; 
    7677  String contentType; 
    7778  String[] content; 
     
    8990  static final String exprespHdr = "EXPECT-RESPONSE: "; 
    9091  static final String methHdr = "METHOD: "; 
     92  static final String depthHdr = "DEPTH: "; 
    9193  static final String authHdr = "AUTH: "; 
    9294  static final String urlHdr = "URL: "; 
     
    141143           */ 
    142144          method = ln.substring(methHdr.length()); 
     145        } else if (ln.startsWith(depthHdr)) { 
     146          /* 
     147                DEPTH 
     148           */ 
     149          depth = Integer.valueOf(ln.substring(depthHdr.length())).intValue(); 
    143150        } else if (ln.startsWith(authHdr)) { 
    144151          /* 
     
    262269 
    263270  /** 
     271   * @return int 
     272   */ 
     273  public int getDepth() { 
     274    return depth; 
     275  } 
     276 
     277  /** 
    264278   * @return String 
    265279   */ 
  • trunk/calendar3/test/src/org/bedework/tests/caldav/TestCalDav.java

    r464 r507  
    365365      if (r.getAuth()) { 
    366366        respCode = cio.sendRequest(r.getMethod(), r.getPrefixedUrl(), 
    367                                    user, pw, r.getHdrs(), r.getContentType(), 
     367                                   user, pw, r.getHdrs(), r.getDepth(), 
     368                                   r.getContentType(), 
    368369                                   r.getContentLength(), r.getContentBytes()); 
    369370      } else { 
    370         respCode = cio.sendRequest(r.getMethod(), r.getPrefixedUrl(), r.getHdrs(), 
     371        respCode = cio.sendRequest(r.getMethod(), r.getPrefixedUrl(), 
     372                                   r.getHdrs(), r.getDepth(), 
    371373                                   r.getContentType(), r.getContentLength(), 
    372374                                   r.getContentBytes()); 
  • trunk/calendar3/webclient/src/org/bedework/webclient/BwFreeBusyAction.java

    r480 r507  
    7878 * <p>Request parameters - all optional:<ul> 
    7979 *      <li>  userid:   whose free busy we want - default to current user</li>. 
    80  *      <li>  calendar: name of the calendar - default to subscriptions 
     80 *      <li>  subname:  name of the subscription - default to subscriptions 
    8181 *                      specified by user</li>. 
    8282 *      <li>  start:    start of period - default to beginning of this week</li>. 
     
    203203 
    204204      try { 
    205         BwFreeBusy fb = svci.getFreeBusy(null, user, 
     205        BwFreeBusy fb = svci.getFreeBusy(null, null, user, 
    206206                                         CalFacadeUtil.getDateTime(sdt, false, false, tzs), 
    207207                                         CalFacadeUtil.getDateTime(edt, false, false, tzs),