Changeset 756

Show
Ignore:
Timestamp:
07/12/06 16:13:24
Author:
douglm
Message:

Use db to store users

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freebusy/trunk/fbclient/src/org/bedework/fbclient/CalDavClient.java

    r747 r756  
    9898        resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), 
    9999                                            r.getUser(), r.getPw(), 
    100                                             r.getHeaders(), 0
     100                                            r.getHeaders(), r.getDepth()
    101101                                            r.getContentType(), 
    102102                                            r.getContentLength(), r.getContentBytes()); 
    103103      } else { 
    104104        resp.responseCode = cio.sendRequest(r.getMethod(), r.getUrl(), 
    105                                             r.getHeaders(), 0
     105                                            r.getHeaders(), r.getDepth()
    106106                                            r.getContentType(), r.getContentLength(), 
    107107                                            r.getContentBytes()); 
  • freebusy/trunk/fbclient/src/org/bedework/fbclient/FBUserInfo.java

    r730 r756  
    4040 */ 
    4141public class FBUserInfo implements Comparable, Serializable { 
     42  /* Whose free busy? */ 
     43  private String account; 
     44 
    4245  /* user id for server authentication. May be null if anon ok */ 
    4346  private String authUser; 
    4447  private String authPw; 
    4548 
    46   /* Whose free busy? */ 
    47   private String account; 
    48  
    4949  private String host; 
    5050  private int port; 
     
    5353 
    5454  private String url; 
     55 
     56  private String depth;  // "0", "1", "infinity" 
    5557 
    5658  /** Constructor 
     
    6365   * @param secure 
    6466   * @param url 
     67   * @param depth 
     68   * @throws Throwable 
    6569   */ 
    6670  public FBUserInfo(String account, 
     
    7074                    int port, 
    7175                    boolean secure, 
    72                     String url) { 
     76                    String url, 
     77                    String depth) throws Throwable { 
    7378    this.account = account; 
    7479    this.authUser = authUser; 
     
    7883    this.secure = secure; 
    7984    this.url = url; 
     85    setDepth(depth); 
    8086  } 
    8187 
     
    186192  } 
    187193 
     194  /** 
     195   * @param val 
     196   * @throws Throwable 
     197   */ 
     198  public void setDepth(String val) throws Throwable { 
     199    if ("0".equals(val) || 
     200        "1".equals(val) || 
     201        "infinity".equals(val)) { 
     202      depth = val; 
     203    } else { 
     204      throw new Exception("Illegal value for depth"); 
     205    } 
     206  } 
     207 
     208  /** 
     209   * @return String 
     210   */ 
     211  public String getDepth() { 
     212    return depth; 
     213  } 
     214 
    188215  /* ==================================================================== 
    189216   *                   Object methods 
     
    219246 
    220247  public Object clone() { 
    221     FBUserInfo nfbui = new FBUserInfo(getAccount(), 
    222                                       getAuthUser(), 
    223                                       getAuthPw(), 
    224                                       getHost(), 
    225                                       getPort(), 
    226                                       getSecure(), 
    227                                       getUrl()); 
    228  
    229     return nfbui; 
     248    try { 
     249      FBUserInfo nfbui = new FBUserInfo(getAccount(), 
     250                                        getAuthUser(), 
     251                                        getAuthPw(), 
     252                                        getHost(), 
     253                                        getPort(), 
     254                                        getSecure(), 
     255                                        getUrl(), 
     256                                        getDepth()); 
     257 
     258      return nfbui; 
     259    } catch (Throwable t) { 
     260      throw new RuntimeException(t); 
     261    } 
    230262  } 
    231263 
     
    247279    sb.append(", url="); 
    248280    sb.append(getUrl()); 
     281    sb.append(", depth="); 
     282    sb.append(getDepth()); 
    249283 
    250284    sb.append("]"); 
  • freebusy/trunk/webclient/src/org/bedework/fbaggregator/AddUser.java

    r753 r756  
    2424    } 
    2525 
    26     int port = getIntReqPar(request, "port", 80); 
    27  
    28     boolean secure = false; 
    29     Boolean secureB = getBooleanReqPar(request, "secure"); 
    30     if (secureB != null) { 
    31       secure = secureB.booleanValue(); 
     26    String depth = getReqPar(request, "depth"); 
     27    if (depth == null) { 
     28      depth = "0"; 
    3229    } 
    3330 
     
    3633                                   getReqPar(request, "authPw"), 
    3734                                   getReqPar(request, "host"), 
    38                                    port, 
    39                                    secure, 
    40                                    getReqPar(request, "url")); 
     35                                   getIntReqPar(request, "port", 80), 
     36                                   getBooleanReqPar(request, "secure", false), 
     37                                   getReqPar(request, "url"), 
     38                                   depth); 
    4139 
    4240    sess.getAllUsers().addInfo(ui); 
  • freebusy/trunk/webclient/src/org/bedework/fbaggregator/EditUser.java

    r732 r756  
    8080    ui.setSecure(getBooleanReqPar(request, "secure", ui.getSecure())); 
    8181 
     82    sess.getAllUsers().updateInfo(ai); 
     83 
    8284    return forwardSuccess; 
    8385  } 
  • freebusy/trunk/webclient/src/org/bedework/fbaggregator/FBAggAction.java

    r754 r756  
    2727 
    2828import org.bedework.calenv.CalOptions; 
    29 import org.bedework.fbclient.FBUserInfo; 
    3029 
    3130import edu.rpi.sss.util.jsp.UtilAbstractAction; 
     
    246245  private void initAttendees(FbAggSession s, 
    247246                             FbAggForm form) throws Throwable { 
    248     FBAttendeeSet all = new FBAttendeeSet(); 
    249  
    250     /* Fake up list of users */ 
    251  
    252     all.setName("all"); 
     247    FBAttendeeSet all = new AllUsers(); 
     248 
    253249 
    254250    /* 
     
    265261                         "/ucaldav/user/testuser02")); 
    266262                         */ 
     263    /* 
    267264    all.addInfo(new FBUserInfo("douglm@rpi.edu", 
    268265                               "douglm", "bedework", 
     
    293290                               "www.bedework.org", 80, false, 
    294291                               "/ucaldav/user/boeing01")); 
     292                               */ 
    295293    /* 
    296294    addInfo(new FBUserInfo("testuser02", "testuser02", "bedework", 
  • freebusy/trunk/webclient/src/org/bedework/fbaggregator/FBAttendeeSet.java

    r735 r756  
    160160 
    161161  /** 
     162   * @param val  FBAttendeeInfo 
     163   * @throws Throwable 
     164   */ 
     165  public void updateInfo(FBAttendeeInfo val) throws Throwable { 
     166    if (val == null) { 
     167      return; 
     168    } 
     169 
     170    removeInfo(val.getAttendee().getAccount()); 
     171    addInfo(val); 
     172  } 
     173 
     174  /** 
    162175   * @param account    - String account to remove 
    163176   * @throws Throwable 
     
    165178  public void removeInfo(String account) throws Throwable { 
    166179    attendeeSet.remove(new FBAttendeeInfo(new FBUserInfo(account))); 
     180  } 
     181 
     182  /* ==================================================================== 
     183   *                   Protected methods 
     184   * ==================================================================== */ 
     185 
     186  /** Called by superclasses to add an entry to the internal set 
     187   * 
     188   * @param val  FBUserInfo 
     189   * @throws Throwable 
     190   */ 
     191  protected void addUser(FBUserInfo val) throws Throwable { 
     192    if (val == null) { 
     193      return; 
     194    } 
     195 
     196    attendeeSet.add(new FBAttendeeInfo(val)); 
    167197  } 
    168198 
  • freebusy/trunk/webclient/src/org/bedework/fbaggregator/FreeBusyAggregator.java

    r752 r756  
    411411    req.setContentType("text/xml"); 
    412412    req.setMethod("REPORT"); 
    413     req.addHeader("Depth", "0"); 
     413    req.setDepth(ui.getDepth()); 
    414414 
    415415    req.addContentLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");