[Bedework-commit] calendarapi r284 - in trunk: calCore/src/org/bedework/calcore calCore/src/org/bedework/calcore/hibernate calFacade/src/org/bedework/calfacade calFacade/src/org/bedework/calfacade/ifs

svnadmin at bedework.org svnadmin at bedework.org
Tue May 15 10:57:54 EDT 2007


Author: douglm
Date: 2007-05-15 10:57:53 -0400 (Tue, 15 May 2007)
New Revision: 284

Added:
   trunk/calFacade/src/org/bedework/calfacade/DirectoryInfo.java
Modified:
   trunk/calCore/src/org/bedework/calcore/AbstractDirImpl.java
   trunk/calCore/src/org/bedework/calcore/DirConfigProperties.java
   trunk/calCore/src/org/bedework/calcore/hibernate/AdminGroupsDbImpl.java
   trunk/calCore/src/org/bedework/calcore/hibernate/GroupsDbImpl.java
   trunk/calFacade/src/org/bedework/calfacade/ifs/Directories.java
Log:
Fix some errors in the user clients caused by removal of principal info from system parameters.

Remove principal info from admin form.

More CalDAV property related fixes.

Modified: trunk/calCore/src/org/bedework/calcore/AbstractDirImpl.java
===================================================================
--- trunk/calCore/src/org/bedework/calcore/AbstractDirImpl.java	2007-05-14 19:47:46 UTC (rev 283)
+++ trunk/calCore/src/org/bedework/calcore/AbstractDirImpl.java	2007-05-15 14:57:53 UTC (rev 284)
@@ -25,6 +25,7 @@
 */
 package org.bedework.calcore;
 
+import org.bedework.calfacade.DirectoryInfo;
 import org.bedework.calfacade.env.CalOptionsFactory;
 import org.bedework.calfacade.exc.CalFacadeException;
 import org.bedework.calfacade.ifs.Directories;
@@ -75,6 +76,24 @@
   }
 
   /* (non-Javadoc)
+   * @see org.bedework.calfacade.ifs.Directories#getDirectoryInfo()
+   */
+  public DirectoryInfo getDirectoryInfo() throws CalFacadeException {
+    DirectoryInfo info = new DirectoryInfo();
+    DirConfigProperties props = getProps();
+
+    info.setPrincipalRoot(props.getPrincipalRoot());
+    info.setUserPrincipalRoot(props.getUserPrincipalRoot());
+    info.setGroupPrincipalRoot(props.getGroupPrincipalRoot());
+    info.setTicketPrincipalRoot(props.getTicketPrincipalRoot());
+    info.setResourcePrincipalRoot(props.getResourcePrincipalRoot());
+    info.setVenuePrincipalRoot(props.getVenuePrincipalRoot());
+    info.setHostPrincipalRoot(props.getHostPrincipalRoot());
+
+    return info;
+  }
+
+  /* (non-Javadoc)
    * @see org.bedework.calfacade.ifs.Directories#validUser(java.lang.String)
    */
   public boolean validUser(String account) throws CalFacadeException {
@@ -230,15 +249,20 @@
         throw new CalFacadeException("org.bedework.error.nullcaladdr");
       }
 
-      String userRoot = getProps().getUserPrincipalRoot() + "/";
+      if (caladdr.startsWith(getProps().getPrincipalRoot() + "/")) {
+        PrincipalInfo pi = getPrincipalInfo(caladdr);
 
-      if (caladdr.startsWith(userRoot)) {
-        String u = caladdr.substring(userRoot.length());
-        if (u.endsWith("/")) {
-          return u.substring(0, u.length() - 1);
-        }
+        /*String userRoot = getProps().getUserPrincipalRoot() + "/";
 
-        return u;
+        if (caladdr.startsWith(userRoot)) {
+          String u = caladdr.substring(userRoot.length());
+          if (u.endsWith("/")) {
+            return u.substring(0, u.length() - 1);
+          }
+
+          return u;
+        } */
+        return pi.who;
       }
 
       String sysid = cb.getSysid();

Modified: trunk/calCore/src/org/bedework/calcore/DirConfigProperties.java
===================================================================
--- trunk/calCore/src/org/bedework/calcore/DirConfigProperties.java	2007-05-14 19:47:46 UTC (rev 283)
+++ trunk/calCore/src/org/bedework/calcore/DirConfigProperties.java	2007-05-15 14:57:53 UTC (rev 284)
@@ -161,7 +161,7 @@
     debug = val;
   }
 
-  /** If we need an id to authenticate this is it.
+  /** Is debugging on?
    *
    * @return String val
    */

Modified: trunk/calCore/src/org/bedework/calcore/hibernate/AdminGroupsDbImpl.java
===================================================================
--- trunk/calCore/src/org/bedework/calcore/hibernate/AdminGroupsDbImpl.java	2007-05-14 19:47:46 UTC (rev 283)
+++ trunk/calCore/src/org/bedework/calcore/hibernate/AdminGroupsDbImpl.java	2007-05-15 14:57:53 UTC (rev 284)
@@ -53,6 +53,7 @@
 */
 package org.bedework.calcore.hibernate;
 
+import org.bedework.calcore.AbstractDirImpl;
 import org.bedework.calcorei.HibSession;
 import org.bedework.calfacade.BwGroup;
 import org.bedework.calfacade.BwPrincipal;
@@ -64,27 +65,25 @@
 import org.bedework.calfacade.svc.BwAdminGroup;
 import org.bedework.calfacade.svc.BwAdminGroupEntry;
 
-import edu.rpi.cmt.access.PrincipalInfo;
-
 import java.util.Collection;
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.apache.log4j.Logger;
-
 /** An implementation of AdminGroups which stores the groups in the calendar
  * database.
  *
  * @author Mike Douglass douglm at rpi.edu
  * @version 1.0
  */
-public class AdminGroupsDbImpl implements AdminGroups {
-  private CallBack cb;
+public class AdminGroupsDbImpl extends AbstractDirImpl implements AdminGroups {
+  /* ====================================================================
+   *  Abstract methods.
+   * ==================================================================== */
 
-  private transient Logger log;
-
-  public void init(CallBack cb) {
-    this.cb = cb;
+  protected String getConfigName() {
+    /* Use the same config as the default groups - we're only after principal info
+     */
+    return "module.dir-config";
   }
 
   /* ===================================================================
@@ -420,63 +419,6 @@
     throw new CalFacadeUnimplementedException();
   }
 
-  /* (non-Javadoc)
-   * @see org.bedework.calfacade.ifs.Directories#isPrincipal(java.lang.String)
-   */
-  public boolean isPrincipal(String val) throws CalFacadeException {
-    // Not needed for admin
-    throw new CalFacadeUnimplementedException();
-  }
-
-  /* (non-Javadoc)
-   * @see org.bedework.calfacade.ifs.Directories#getPrincipalInfo(java.lang.String)
-   */
-  public PrincipalInfo getPrincipalInfo(String href) throws CalFacadeException {
-    // Not needed for admin
-    throw new CalFacadeUnimplementedException();
-  }
-
-  /* (non-Javadoc)
-   * @see org.bedework.calfacade.ifs.Directories#makePrincipalUri(java.lang.String, boolean)
-   */
-  public String makePrincipalUri(String id,
-                                 int whoType) throws CalFacadeException {
-    // Not needed for admin
-    throw new CalFacadeUnimplementedException();
-  }
-
-  /* (non-Javadoc)
-   * @see org.bedework.calfacade.ifs.Directories#getPrincipalRoot()
-   */
-  public String getPrincipalRoot() throws CalFacadeException {
-    // Not needed for admin
-    throw new CalFacadeUnimplementedException();
-  }
-
-  /* (non-Javadoc)
-   * @see org.bedework.calfacade.ifs.Directories#userToCaladdr(java.lang.String)
-   */
-  public String userToCaladdr(String val) throws CalFacadeException {
-    // Not needed for admin
-    throw new CalFacadeUnimplementedException();
-  }
-
-  /* (non-Javadoc)
-   * @see org.bedework.calsvci.CalSvcI#caladdrToUser(java.lang.String)
-   */
-  public String caladdrToUser(String caladdr) throws CalFacadeException {
-    // Not needed for admin
-    throw new CalFacadeUnimplementedException();
-  }
-
-  /* (non-Javadoc)
-   * @see org.bedework.calsvci.CalSvcI#fixCalAddr(java.lang.String)
-   */
-  public String fixCalAddr(String val) throws CalFacadeException {
-    // Not needed for admin
-    throw new CalFacadeUnimplementedException();
-  }
-
   private boolean checkPathForSelf(BwGroup group,
                                    BwPrincipal val) throws CalFacadeException {
     if (group.equals(val)) {
@@ -498,22 +440,4 @@
   private HibSession getSess() throws CalFacadeException {
     return (HibSession)cb.getDbSession();
   }
-
-  /* Get a logger for messages
-   */
-  protected Logger getLogger() {
-    if (log == null) {
-      log = Logger.getLogger(this.getClass());
-    }
-
-    return log;
-  }
-
-  protected void error(Throwable t) {
-    getLogger().error(this, t);
-  }
-
-  protected void trace(String msg) {
-    getLogger().debug(msg);
-  }
 }

Modified: trunk/calCore/src/org/bedework/calcore/hibernate/GroupsDbImpl.java
===================================================================
--- trunk/calCore/src/org/bedework/calcore/hibernate/GroupsDbImpl.java	2007-05-14 19:47:46 UTC (rev 283)
+++ trunk/calCore/src/org/bedework/calcore/hibernate/GroupsDbImpl.java	2007-05-15 14:57:53 UTC (rev 284)
@@ -313,7 +313,7 @@
   }
 
   /* ====================================================================
-   *  Protected methods.
+   *  Abstract methods.
    * ==================================================================== */
 
   protected String getConfigName() {

Added: trunk/calFacade/src/org/bedework/calfacade/DirectoryInfo.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/DirectoryInfo.java	                        (rev 0)
+++ trunk/calFacade/src/org/bedework/calfacade/DirectoryInfo.java	2007-05-15 14:57:53 UTC (rev 284)
@@ -0,0 +1,154 @@
+/* **********************************************************************
+    Copyright 2007 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+    Redistribution and use of this distribution in source and binary forms,
+    with or without modification, are permitted provided that:
+       The above copyright notice and this permission notice appear in all
+        copies and supporting documentation;
+
+        The name, identifiers, and trademarks of Rensselaer Polytechnic
+        Institute are not used in advertising or publicity without the
+        express prior written permission of Rensselaer Polytechnic Institute;
+
+    DISCLAIMER: The software is distributed" AS IS" without any express or
+    implied warranty, including but not limited to, any implied warranties
+    of merchantability or fitness for a particular purpose or any warrant)'
+    of non-infringement of any current or pending patent rights. The authors
+    of the software make no representations about the suitability of this
+    software for any particular purpose. The entire risk as to the quality
+    and performance of the software is with the user. Should the software
+    prove defective, the user assumes the cost of all necessary servicing,
+    repair or correction. In particular, neither Rensselaer Polytechnic
+    Institute, nor the authors of the software are liable for any indirect,
+    special, consequential, or incidental damages related to the software,
+    to the maximum extent the law permits.
+*/
+package org.bedework.calfacade;
+
+/** This class defines the various directory properties we need to make visible
+ * to applications.
+ *
+ * @author Mike Douglass
+ */
+public class DirectoryInfo {
+  /* Principals */
+  private String principalRoot;
+  private String userPrincipalRoot;
+  private String groupPrincipalRoot;
+  private String resourcePrincipalRoot;
+  private String venuePrincipalRoot;
+  private String ticketPrincipalRoot;
+  private String hostPrincipalRoot;
+
+  /** Set the principal root e.g. "/principals"
+   *
+   * @param val    String
+   */
+  public void setPrincipalRoot(String val) {
+    principalRoot = val;
+  }
+
+  /** get the principal root e.g. "/principals"
+   *
+   * @return String
+   */
+  public String getPrincipalRoot() {
+    return principalRoot;
+  }
+
+  /** Set the user principal root e.g. "/principals/users"
+   *
+   * @param val    String
+   */
+  public void setUserPrincipalRoot(String val) {
+    userPrincipalRoot = val;
+  }
+
+  /** get the principal root e.g. "/principals/users"
+   *
+   * @return String
+   */
+  public String getUserPrincipalRoot() {
+    return userPrincipalRoot;
+  }
+
+  /** Set the group principal root e.g. "/principals/groups"
+   *
+   * @param val    String
+   */
+  public void setGroupPrincipalRoot(String val) {
+    groupPrincipalRoot = val;
+  }
+
+  /** get the group principal root e.g. "/principals/groups"
+   *
+   * @return String
+   */
+  public String getGroupPrincipalRoot() {
+    return groupPrincipalRoot;
+  }
+
+  /** Set the resource principal root e.g. "/principals/resources"
+   *
+   * @param val    String
+   */
+  public void setResourcePrincipalRoot(String val) {
+    resourcePrincipalRoot = val;
+  }
+
+  /** get the resource principal root e.g. "/principals/resources"
+   *
+   * @return String
+   */
+  public String getResourcePrincipalRoot() {
+    return resourcePrincipalRoot;
+  }
+
+  /** Set the venue principal root e.g. "/principals/locations"
+   *
+   * @param val    String
+   */
+  public void setVenuePrincipalRoot(String val) {
+    venuePrincipalRoot = val;
+  }
+
+  /** get the venue principal root e.g. "/principals/locations"
+   *
+   * @return String
+   */
+  public String getVenuePrincipalRoot() {
+    return venuePrincipalRoot;
+  }
+
+  /** Set the ticket principal root e.g. "/principals/tickets"
+   *
+   * @param val    String
+   */
+  public void setTicketPrincipalRoot(String val) {
+    ticketPrincipalRoot = val;
+  }
+
+  /** get the ticket principal root e.g. "/principals/tickets"
+   *
+   * @return String
+   */
+  public String getTicketPrincipalRoot() {
+    return ticketPrincipalRoot;
+  }
+
+  /** Set the host principal root e.g. "/principals/hosts"
+   *
+   * @param val    String
+   */
+  public void setHostPrincipalRoot(String val) {
+    hostPrincipalRoot = val;
+  }
+
+  /** get the host principal root e.g. "/principals/hosts"
+   *
+   * @return String
+   */
+  public String getHostPrincipalRoot() {
+    return hostPrincipalRoot;
+  }
+}


Property changes on: trunk/calFacade/src/org/bedework/calfacade/DirectoryInfo.java
___________________________________________________________________
Name: svn:eol-style
   + LF

Modified: trunk/calFacade/src/org/bedework/calfacade/ifs/Directories.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/ifs/Directories.java	2007-05-14 19:47:46 UTC (rev 283)
+++ trunk/calFacade/src/org/bedework/calfacade/ifs/Directories.java	2007-05-15 14:57:53 UTC (rev 284)
@@ -57,6 +57,7 @@
 import org.bedework.calfacade.BwPrincipal;
 import org.bedework.calfacade.BwUser;
 import org.bedework.calfacade.BwUserInfo;
+import org.bedework.calfacade.DirectoryInfo;
 import org.bedework.calfacade.exc.CalFacadeException;
 
 import edu.rpi.cmt.access.PrincipalInfo;
@@ -122,6 +123,13 @@
    */
   public void init(CallBack cb) throws CalFacadeException;
 
+  /** Get application visible directory information.
+   *
+   * @return DirectoryInfo
+   * @throws CalFacadeException
+   */
+  public DirectoryInfo getDirectoryInfo() throws CalFacadeException;
+
   /** Test for a valid user account in the directory. This may have a number of
    * uses. For example, when organizing meetings we may want to send an
    * invitation to a user who has not yet logged on. This allows us to



More information about the Bedework-commit mailing list