Changeset 833

Show
Ignore:
Timestamp:
07/23/06 22:54:06
Author:
douglm
Message:

Move code out of appcommon into access project.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/appcommon/src/org/bedework/appcommon/AccessXmlUtil.java

    r797 r833  
    5454package org.bedework.appcommon; 
    5555 
    56 import org.bedework.calfacade.CalFacadeException; 
    5756import org.bedework.davdefs.CaldavTags; 
    5857import org.bedework.davdefs.WebdavTags; 
    5958 
    60 import edu.rpi.cmt.access.Ace
     59import edu.rpi.cmt.access.AccessException
    6160import edu.rpi.cmt.access.Acl; 
    62 import edu.rpi.cmt.access.Privilege; 
    63 import edu.rpi.cmt.access.PrivilegeDefs; 
    6461import edu.rpi.cmt.access.PrivilegeSet; 
    65 import edu.rpi.cmt.access.Privileges; 
    6662import edu.rpi.sss.util.xml.QName; 
    6763import edu.rpi.sss.util.xml.XmlEmit; 
    6864 
    69 import java.io.Serializable; 
    7065import java.io.StringWriter; 
    71 import java.util.Collection; 
    72 import java.util.Iterator; 
    7366 
    7467/** Class to generate xml from an access specification. The resulting xml follows 
     
    7770 *  @author Mike Douglass   douglm @ rpi.edu 
    7871 */ 
    79 public class AccessXmlUtil implements Serializable
     72public class AccessXmlUtil extends edu.rpi.cmt.access.AccessXmlUtil
    8073  /** xml rpivilege tags */ 
    81   public static final QName[] privTags = { 
     74  private static final QName[] privTags = { 
    8275    WebdavTags.all,              // privAll = 0; 
    8376    WebdavTags.read,             // privRead = 1; 
     
    9588  }; 
    9689 
    97   private XmlEmit xml; 
    98  
    9990  /** Acls use tags in the webdav and caldav namespace. 
    10091   * 
     
    10293   */ 
    10394  public AccessXmlUtil(XmlEmit xml) { 
    104     this.xml = xml
     95    super(privTags, new WebdavTags(), xml)
    10596  } 
    10697 
     
    109100   * @param acl 
    110101   * @return String xml representation 
    111    * @throws CalFacadeException 
     102   * @throws AccessException 
    112103   */ 
    113   public static String getXmlAclString(Acl acl) throws CalFacadeException { 
    114     try { 
    115       XmlEmit xml = new XmlEmit(true);  // no headers 
    116       StringWriter su = new StringWriter(); 
    117       xml.startEmit(su); 
    118       AccessXmlUtil au = new AccessXmlUtil(xml); 
    119  
    120       au.emitAcl(acl); 
    121  
    122       su.close(); 
    123  
    124       return su.toString(); 
    125     } catch (CalFacadeException cfe) { 
    126       throw cfe; 
    127     } catch (Throwable t) { 
    128       throw new CalFacadeException(t); 
    129     } 
    130   } 
    131  
    132   /** (Re)set the xml writer 
    133    * 
    134    * @param val      xml Writer 
    135    */ 
    136   public void setXml(XmlEmit val) { 
    137     xml = val; 
    138   } 
    139  
    140   /** Override this to construct urls from the parameter 
    141    * 
    142    * @param who String 
    143    * @return String href 
    144    */ 
    145   public String makeUserHref(String who) { 
    146     return who; 
    147   } 
    148  
    149   /** Override this to construct urls from the parameter 
    150    * 
    151    * @param who String 
    152    * @return String href 
    153    */ 
    154   public String makeGroupHref(String who) { 
    155     return who; 
    156   } 
    157  
    158   /** Emit an acl as an xml string the current xml writer 
    159    * 
    160    * @param acl 
    161    * @throws CalFacadeException 
    162    */ 
    163   public void emitAcl(Acl acl) throws CalFacadeException { 
    164     try { 
    165       Collection aces = acl.getAces(); 
    166       emitAces(aces); 
    167     } catch (CalFacadeException cfe) { 
    168       throw cfe; 
    169     } catch (Throwable t) { 
    170       throw new CalFacadeException(t); 
    171     } 
    172   } 
    173  
    174   /** Emit the Collection of aces as an xml sing the current xml writer 
    175    * 
    176    * @param aces 
    177    * @throws CalFacadeException 
    178    */ 
    179   public void emitAces(Collection aces) throws CalFacadeException { 
    180     try { 
    181       xml.openTag(WebdavTags.acl); 
    182  
    183       if (aces != null) { 
    184         Iterator it = aces.iterator(); 
    185         while (it.hasNext()) { 
    186           Ace ace = (Ace)it.next(); 
    187  
    188           boolean aceOpen = emitAce(ace, true, false); 
    189           if (emitAce(ace, false, aceOpen)) { 
    190             aceOpen = true; 
    191           } 
    192  
    193           if (aceOpen) { 
    194             xml.closeTag(WebdavTags.ace); 
    195           } 
    196         } 
    197       } 
    198  
    199       xml.closeTag(WebdavTags.acl); 
    200     } catch (CalFacadeException cfe) { 
    201       throw cfe; 
    202     } catch (Throwable t) { 
    203       throw new CalFacadeException(t); 
    204     } 
    205   } 
    206  
    207   /** Produce an xml representation of supported privileges. This is the same 
    208    * at all points in the system and is identical to the webdav/caldav 
    209    * requirements. 
    210    * 
    211    * @throws CalFacadeException 
    212    */ 
    213   public void emitSupportedPrivSet() throws CalFacadeException { 
    214     try { 
    215       xml.openTag(WebdavTags.supportedPrivilegeSet); 
    216  
    217       emitSupportedPriv(Privileges.getPrivAll()); 
    218  
    219       xml.closeTag(WebdavTags.supportedPrivilegeSet); 
    220     } catch (Throwable t) { 
    221       throw new CalFacadeException(t); 
    222     } 
     104  public static String getXmlAclString(Acl acl) throws AccessException { 
     105    return edu.rpi.cmt.access.AccessXmlUtil.getXmlAclString(acl, privTags, 
     106                                                            new WebdavTags()); 
    223107  } 
    224108 
     
    228112   * @param xml 
    229113   * @param privileges    char[] of allowed/disallowed 
    230    * @throws CalFacadeException 
     114   * @throws AccessException 
    231115   */ 
    232116  public static void emitCurrentPrivSet(XmlEmit xml, 
    233                                         char[] privileges) throws CalFacadeException { 
    234     try { 
    235       xml.openTag(WebdavTags.currentUserPrivilegeSet); 
    236  
    237       for (int pi = 0; pi < privileges.length; pi++) { 
    238         if ((privileges[pi] == PrivilegeDefs.allowed) || 
    239             (privileges[pi] == PrivilegeDefs.allowedInherited)) { 
    240           // XXX further work - don't emit abstract privs or contained privs. 
    241           QName pr = privTags[pi]; 
    242  
    243           if (pr != null) { 
    244             xml.propertyTagVal(WebdavTags.privilege, pr); 
    245           } 
    246         } 
    247       } 
    248  
    249       xml.closeTag(WebdavTags.currentUserPrivilegeSet); 
    250     } catch (Throwable t) { 
    251       throw new CalFacadeException(t); 
    252     } 
     117                                        char[] privileges) throws AccessException { 
     118    edu.rpi.cmt.access.AccessXmlUtil.emitCurrentPrivSet(xml, privTags, 
     119                                                        new WebdavTags(), 
     120                                                        privileges); 
    253121  } 
    254122 
     
    259127   * @param ps    PrivilegeSet allowed/disallowed 
    260128   * @return String xml 
    261    * @throws CalFacadeException 
     129   * @throws AccessException 
    262130   */ 
    263131  public static String getCurrentPrivSetString(PrivilegeSet ps) 
    264           throws CalFacadeException { 
     132          throws AccessException { 
    265133    try { 
    266134      char[] privileges = ps.getPrivileges(); 
     
    269137      StringWriter su = new StringWriter(); 
    270138      xml.startEmit(su); 
    271       AccessXmlUtil.emitCurrentPrivSet(xml, privileges); 
     139      edu.rpi.cmt.access.AccessXmlUtil.emitCurrentPrivSet(xml, privTags, 
     140                                                          new WebdavTags(), 
     141                                                          privileges); 
    272142 
    273143      su.close(); 
    274144 
    275145      return su.toString(); 
    276     } catch (CalFacadeException cfe) { 
    277       throw cfe; 
     146    } catch (AccessException ae) { 
     147      throw ae; 
    278148    } catch (Throwable t) { 
    279       throw new CalFacadeException(t); 
    280     } 
    281   } 
    282  
    283   /* ==================================================================== 
    284    *                   Private methods 
    285    * ==================================================================== */ 
    286  
    287   private void emitSupportedPriv(Privilege priv) throws Throwable { 
    288     xml.openTag(WebdavTags.supportedPrivilege); 
    289  
    290     xml.openTagNoNewline(WebdavTags.privilege); 
    291     xml.emptyTagSameLine(privTags[priv.getIndex()]); 
    292     xml.closeTagNoblanks(WebdavTags.privilege); 
    293  
    294     if (priv.getAbstractPriv()) { 
    295       xml.emptyTag(WebdavTags._abstract); 
    296     } 
    297  
    298     xml.property(WebdavTags.description, priv.getDescription()); 
    299  
    300     Iterator it = priv.iterateContainedPrivileges(); 
    301     while (it.hasNext()) { 
    302       emitSupportedPriv((Privilege)it.next()); 
    303     } 
    304  
    305     xml.closeTag(WebdavTags.supportedPrivilege); 
    306   } 
    307  
    308   private boolean emitAce(Ace ace, boolean denials, boolean aceOpen) throws Throwable { 
    309     Collection privs = ace.getPrivs(); 
    310     boolean tagOpen = false; 
    311  
    312     QName tag; 
    313     if (denials) { 
    314       tag = WebdavTags.deny; 
    315     } else { 
    316       tag = WebdavTags.grant; 
    317     } 
    318  
    319     Iterator it = privs.iterator(); 
    320     while (it.hasNext()) { 
    321       Privilege p = (Privilege)it.next(); 
    322  
    323       if (denials == p.getDenial()) { 
    324         if (!aceOpen) { 
    325           xml.openTag(WebdavTags.ace); 
    326  
    327           emitAceWho(ace); 
    328           aceOpen = true; 
    329         } 
    330  
    331         if (!tagOpen) { 
    332           xml.openTag(tag); 
    333           tagOpen = true; 
    334         } 
    335         xml.emptyTag(privTags[p.getIndex()]); 
    336       } 
    337     } 
    338  
    339     if (tagOpen) { 
    340       // XXX Wrong - need to encode an href in the acl 
    341       /* 
    342       if (ace.getInherited()) { 
    343         xml.emptyTag(WebdavTags.inherited); 
    344       } 
    345       */ 
    346       xml.closeTag(tag); 
    347     } 
    348  
    349     return aceOpen; 
    350   } 
    351  
    352   private void emitAceWho(Ace ace) throws Throwable { 
    353     boolean invert = ace.getNotWho(); 
    354  
    355     if (ace.getWhoType() == Ace.whoTypeOther) { 
    356       invert = !invert; 
    357     } 
    358  
    359     if (invert) { 
    360       xml.openTag(WebdavTags.invert); 
    361     } 
    362  
    363     xml.openTag(WebdavTags.principal); 
    364  
    365     int whoType = ace.getWhoType(); 
    366  
    367     /* 
    368            <!ELEMENT principal (href) 
    369                   | all | authenticated | unauthenticated 
    370                   | property | self)> 
    371     */ 
    372  
    373     if (whoType == Ace.whoTypeUser) { 
    374       xml.property(WebdavTags.href, makeUserHref(ace.getWho())); 
    375     } else if (whoType == Ace.whoTypeGroup) { 
    376       xml.property(WebdavTags.href, makeGroupHref(ace.getWho())); 
    377     } else if ((whoType == Ace.whoTypeOwner) || 
    378                (whoType == Ace.whoTypeOther)) { 
    379       // Other is !owner 
    380       xml.openTag(WebdavTags.property); 
    381       xml.emptyTag(WebdavTags.owner); 
    382       xml.closeTag(WebdavTags.property); 
    383     } else if (whoType == Ace.whoTypeUnauthenticated) { 
    384       xml.emptyTag(WebdavTags.unauthenticated); 
    385     } else if (whoType == Ace.whoTypeAuthenticated) { 
    386       xml.emptyTag(WebdavTags.authenticated); 
    387     } else if (whoType == Ace.whoTypeAll) { 
    388       xml.emptyTag(WebdavTags.all); 
    389     } else  { 
    390       throw new CalFacadeException("access.unknown.who"); 
    391     } 
    392  
    393     xml.closeTag(WebdavTags.principal); 
    394  
    395     if (invert) { 
    396       xml.closeTag(WebdavTags.invert); 
     149      throw new AccessException(t); 
    397150    } 
    398151  } 
  • trunk/calendar3/bldfiles/quickstart-build.xml

    r829 r833  
    150150    <ant antfile="${org.bedework.project.rpiutil}/build.xml" inheritrefs="true" 
    151151           target="build-all" /> 
     152 
    152153    <copy todir="${org.bedework.project.calendar}/lib" overwrite="yes"> 
    153154      <fileset dir="${org.bedework.project.rpiutil}/dist"> 
     
    155156      </fileset> 
    156157    </copy> 
     158 
     159    <copy todir="${org.bedework.project.access}/lib" overwrite="yes"> 
     160      <fileset dir="${org.bedework.project.rpiutil}/dist"> 
     161        <include name="*.jar" /> 
     162      </fileset> 
     163    </copy> 
    157164  </target> 
    158165 
     
    161168    <ant antfile="${org.bedework.project.rpiutil}/build.xml" inheritrefs="true" 
    162169           target="clean-build-all" /> 
     170 
    163171    <copy todir="${org.bedework.project.calendar}/lib" overwrite="yes"> 
     172      <fileset dir="${org.bedework.project.rpiutil}/dist"> 
     173        <include name="*.jar" /> 
     174      </fileset> 
     175    </copy> 
     176 
     177    <copy todir="${org.bedework.project.access}/lib" overwrite="yes"> 
    164178      <fileset dir="${org.bedework.project.rpiutil}/dist"> 
    165179        <include name="*.jar" /> 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java

    r797 r833  
    768768    int priv; 
    769769 
     770    QName[] privTags = emitAccess.getPrivTags(); 
     771 
    770772    findPriv: { 
    771773      // ENUM 
    772       for (priv = 0; priv < AccessXmlUtil.privTags.length; priv++) { 
    773         if (MethodBase.nodeMatches(el, AccessXmlUtil.privTags[priv])) { 
     774      for (priv = 0; priv < privTags.length; priv++) { 
     775        if (MethodBase.nodeMatches(el, privTags[priv])) { 
    774776          break findPriv; 
    775777        } 
     
    826828    } 
    827829  } 
    828  
    829   /* 
    830   public void emitAcl(WebdavNsNode node) throws WebdavIntfException { 
    831     CaldavBwNode uwnode = getBwnode(node); 
    832     CaldavURI cdUri = uwnode.getCDURI(); 
    833     Collection aces = null; 
    834  
    835     try { 
    836       if (cdUri.isCalendar()) { 
    837         aces = getSvci().getAces(cdUri.getCal()); 
    838       } else { 
    839         aces = getSvci().getAces(((CaldavComponentNode)node).getEvent()); 
    840       } 
    841  
    842       xml.openTag(WebdavTags.acl); 
    843  
    844       if (aces != null) { 
    845         Iterator it = aces.iterator(); 
    846         while (it.hasNext()) { 
    847           Ace ace = (Ace)it.next(); 
    848  
    849           emitAce(ace, true); 
    850           emitAce(ace, false); 
    851         } 
    852       } 
    853       xml.closeTag(WebdavTags.acl); 
    854     } catch (WebdavIntfException wi) { 
    855       throw wi; 
    856     } catch (Throwable t) { 
    857       throw new WebdavIntfException(t); 
    858     } 
    859   } 
    860  
    861   private void emitAce(Ace ace, boolean denials) throws Throwable { 
    862     Collection privs = ace.getPrivs(); 
    863     boolean emittedWho = false; 
    864  
    865     QName tag; 
    866     if (denials) { 
    867       tag = WebdavTags.deny; 
    868     } else { 
    869       tag = WebdavTags.grant; 
    870     } 
    871  
    872     Iterator it = privs.iterator(); 
    873     while (it.hasNext()) { 
    874       Privilege p = (Privilege)it.next(); 
    875  
    876       if (denials == p.getDenial()) { 
    877         if (!emittedWho) { 
    878           emitAceWho(ace); 
    879           emittedWho = true; 
    880         } 
    881  
    882         xml.openTag(tag); 
    883         xml.emptyTag(privTags[p.getIndex()]); 
    884         xml.closeTag(tag); 
    885       } 
    886     } 
    887  
    888     if (emittedWho) { 
    889       xml.closeTag(WebdavTags.ace); 
    890     } 
    891   } 
    892  
    893   private void emitAceWho(Ace ace) throws Throwable { 
    894     xml.openTag(WebdavTags.ace); 
    895  
    896     boolean invert = ace.getNotWho(); 
    897  
    898     if (ace.getWhoType() == Ace.whoTypeOther) { 
    899       invert = !invert; 
    900     } 
    901  
    902     if (invert) { 
    903       xml.openTag(WebdavTags.invert); 
    904     } 
    905  
    906     xml.openTag(WebdavTags.principal); 
    907  
    908     int whoType = ace.getWhoType(); 
    909  
    910     /* 
    911            <!ELEMENT principal (href) 
    912                   | all | authenticated | unauthenticated 
    913                   | property | self)> 
    914     * / 
    915  
    916     if (whoType == Ace.whoTypeUser) { 
    917       xml.property(WebdavTags.href, makeUserHref(ace.getWho())); 
    918     } else if (whoType == Ace.whoTypeGroup) { 
    919       xml.property(WebdavTags.href, makeGroupHref(ace.getWho())); 
    920     } else if ((whoType == Ace.whoTypeOwner) || 
    921                (whoType == Ace.whoTypeOther)) { 
    922       // Other is !owner 
    923       xml.openTag(WebdavTags.property); 
    924       xml.emptyTag(WebdavTags.owner); 
    925       xml.closeTag(WebdavTags.property); 
    926     } else if (whoType == Ace.whoTypeUnauthenticated) { 
    927       xml.emptyTag(WebdavTags.unauthenticated); 
    928     } else if (whoType == Ace.whoTypeAuthenticated) { 
    929       xml.emptyTag(WebdavTags.authenticated); 
    930     } else if (whoType == Ace.whoTypeAll) { 
    931       xml.emptyTag(WebdavTags.all); 
    932     } else  { 
    933       throw WebdavIntfException.serverError(); 
    934     } 
    935  
    936     xml.closeTag(WebdavTags.principal); 
    937  
    938     if (invert) { 
    939       xml.closeTag(WebdavTags.invert); 
    940     } 
    941   } 
    942   */ 
    943830 
    944831  /** This class is the result of interpreting a principal url 
     
    987874      throw WebdavIntfException.badRequest(); 
    988875    } 
     876  } 
     877 
     878  /** Override to include free and busy access. 
     879   * 
     880   * @return QName[] 
     881   */ 
     882  public QName[] getPrivTags() { 
     883    return emitAccess.getPrivTags(); 
    989884  } 
    990885 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/EmitAccess.java

    r509 r833  
    5454package edu.rpi.cct.uwcal.caldav; 
    5555 
    56 import org.bedework.appcommon.AccessXmlUtil; 
     56import org.bedework.davdefs.CaldavTags; 
     57import org.bedework.davdefs.WebdavTags; 
    5758 
     59import edu.rpi.cmt.access.AccessXmlUtil; 
     60import edu.rpi.sss.util.xml.QName; 
    5861import edu.rpi.sss.util.xml.XmlEmit; 
    5962 
     
    6568  private String namespacePrefix; 
    6669 
     70  /** xml rpivilege tags */ 
     71  private static final QName[] privTags = { 
     72    WebdavTags.all,              // privAll = 0; 
     73    WebdavTags.read,             // privRead = 1; 
     74    WebdavTags.readAcl,          // privReadAcl = 2; 
     75    WebdavTags.readCurrentUserPrivilegeSet,  // privReadCurrentUserPrivilegeSet = 3; 
     76    CaldavTags.readFreeBusy,     // privReadFreeBusy = 4; 
     77    WebdavTags.write,            // privWrite = 5; 
     78    WebdavTags.writeAcl,         // privWriteAcl = 6; 
     79    WebdavTags.writeProperties,  // privWriteProperties = 7; 
     80    WebdavTags.writeContent,     // privWriteContent = 8; 
     81    WebdavTags.bind,             // privBind = 9; 
     82    WebdavTags.unbind,           // privUnbind = 10; 
     83    WebdavTags.unlock,           // privUnlock = 11; 
     84    null                         // privNone = 12; 
     85  }; 
     86 
    6787  /** Acls use tags in the webdav and caldav namespace. For use over caldav 
    6888   * we shoud supply the uris. Otherwise a null namespace will be used. 
     
    7292   */ 
    7393  public EmitAccess(String namespacePrefix, XmlEmit xml) { 
    74     super(xml); 
     94    super(privTags, new WebdavTags(), xml); 
    7595 
    7696    this.namespacePrefix = namespacePrefix; 
     
    94114    return namespacePrefix + "/principals/groups/" + who; 
    95115  } 
     116 
     117  /** 
     118   * @return QName[] 
     119   */ 
     120  public QName[] getPrivTags() { 
     121    return privTags; 
     122  } 
    96123} 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/common/MethodBase.java

    r490 r833  
    531531  protected void startEmit(HttpServletResponse resp) throws WebdavException { 
    532532    try { 
    533       xml.startEmit(resp); 
     533      xml.startEmit(resp.getWriter()); 
    534534    } catch (Throwable t) { 
    535535      throw new WebdavException(t); 
  • trunk/calendar3/caldav/src/edu/rpi/cct/webdav/servlet/shared/WebdavNsIntf.java

    r797 r833  
    681681 
    682682          openPropstat(); 
    683           AccessXmlUtil.emitCurrentPrivSet(xml, privileges); 
     683          AccessXmlUtil.emitCurrentPrivSet(xml, getPrivTags(), 
     684                                           new WebdavTags(), privileges); 
    684685          closePropstat(); 
    685686        } 
     
    762763  } 
    763764 
     765  /** xml rpivilege tags */ 
     766  private static final QName[] privTags = { 
     767    WebdavTags.all,              // privAll = 0; 
     768    WebdavTags.read,             // privRead = 1; 
     769    WebdavTags.readAcl,          // privReadAcl = 2; 
     770    WebdavTags.readCurrentUserPrivilegeSet,  // privReadCurrentUserPrivilegeSet = 3; 
     771    null,                        // privReadFreeBusy = 4; 
     772    WebdavTags.write,            // privWrite = 5; 
     773    WebdavTags.writeAcl,         // privWriteAcl = 6; 
     774    WebdavTags.writeProperties,  // privWriteProperties = 7; 
     775    WebdavTags.writeContent,     // privWriteContent = 8; 
     776    WebdavTags.bind,             // privBind = 9; 
     777    WebdavTags.unbind,           // privUnbind = 10; 
     778    WebdavTags.unlock,           // privUnlock = 11; 
     779    null                         // privNone = 12; 
     780  }; 
     781 
     782  /** 
     783   * @return QName[] 
     784   */ 
     785  public QName[] getPrivTags() { 
     786    return privTags; 
     787  } 
     788 
    764789  /* ==================================================================== 
    765790   *                   XmlUtil wrappers 
  • trunk/calendar3/davdefs/src/org/bedework/davdefs/WebdavTags.java

    r490 r833  
    1 /* 
    2  Copyright (c) 2000-2005 University of Washington.  All rights reserved. 
    3  
    4  Redistribution and use of this distribution in source and binary forms, 
    5  with or without modification, are permitted provided that: 
    6  
    7    The above copyright notice and this permission notice appear in 
    8    all copies and supporting documentation; 
    9  
    10    The name, identifiers, and trademarks of the University of Washington 
    11    are not used in advertising or publicity without the express prior 
    12    written permission of the University of Washington; 
    13  
    14    Recipients acknowledge that this distribution is made available as a 
    15    research courtesy, "as is", potentially with defects, without 
    16    any obligation on the part of the University of Washington to 
    17    provide support, services, or repair; 
    18  
    19    THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR 
    20    IMPLIED, WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION 
    21    ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
    22    PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF 
    23    WASHINGTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 
    24    DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 
    25    PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING 
    26    NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH 
    27    THE USE OR PERFORMANCE OF THIS SOFTWARE. 
    28  */ 
    291/* ********************************************************************** 
    302    Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved. 
     
    5426package org.bedework.davdefs; 
    5527 
     28import edu.rpi.cmt.access.AccessXmlUtil.AccessTags; 
     29 
    5630import edu.rpi.sss.util.xml.QName; 
     31 
     32import java.util.HashMap; 
    5733 
    5834/** Define Webdav tags for XMlEmit 
     
    6036 * @author Mike Douglass douglm@rpi.edu 
    6137 */ 
    62 public class WebdavTags
     38public class WebdavTags implements AccessTags
    6339  /** Namespace for these tags 
    6440   */ 
     
    6642 
    6743  /** */ 
    68   public static final QName _abstract = new QName(namespace, 
    69                                                   "abstract"); 
    70  
    71   /** */ 
    72   public static final QName ace = new QName(namespace, 
    73                                               "ace"); 
    74  
    75   /** */ 
    76   public static final QName acl = new QName(namespace, 
    77                                             "acl"); 
    78  
    79   /** */ 
    80   public static final QName aclPrincipalPropSet = new QName(namespace, 
    81                                             "acl-principal-prop-set"); 
    82  
    83   /** */ 
    84   public static final QName aclRestrictions = new QName(namespace, 
    85                                                         "acl-restrictions"); 
    86  
    87   /** */ 
    88   public static final QName all = new QName(namespace, 
    89                                             "all"); 
    90  
    91   /** */ 
    92   public static final QName allowedPrincipal = new QName(namespace, 
    93                                                          "allowed-principal"); 
    94  
    95   /** */ 
    96   public static final QName allprop = new QName(namespace, 
    97                                                 "allprop"); 
    98  
    99   /** */ 
    100   public static final QName alternateURISet = new QName(namespace, 
    101                                                         "alternate-URI-set"); 
    102  
    103   /** */ 
    104   public static final QName authenticated = new QName(namespace, 
    105                                                       "authenticated"); 
    106  
    107   /** */ 
    108   public static final QName bind = new QName(namespace, 
    109                                              "bind"); 
    110  
    111   /** */ 
    112   public static final QName collection = new QName(namespace, 
    113                                                    "collection"); 
    114  
    115   /** */ 
    116   public static final QName creationdate = new QName(namespace, 
    117                                                      "creationdate"); 
    118  
    119   /** */ 
    120   public static final QName currentUserPrivilegeSet = new QName(namespace, 
    121                                                  "current-user-privilege-set"); 
    122  
    123   /** */ 
    124   public static final QName denyBeforeGrant = new QName(namespace, 
    125                                                         "deny-before-grant"); 
    126  
    127   /** */ 
    128   public static final QName deny = new QName(namespace, 
    129                                              "deny"); 
    130  
    131   /** */ 
    132   public static final QName description = new QName(namespace, 
    133                                                     "description"); 
    134  
    135   /** */ 
    136   public static final QName displayname = new QName(namespace, 
    137                                                     "displayname"); 
    138  
    139   /** */ 
    140   public static final QName expandProperty = new QName(namespace, 
    141                                                        "expand-property"); 
    142  
    143   /** */ 
    144   public static final QName getcontentlanguage = new QName(namespace, 
    145                                                            "getcontentlanguage"); 
    146  
    147   /** */ 
    148   public static final QName getcontentlength = new QName(namespace, 
    149                                                        "getcontentlength"); 
    150  
    151   /** */ 
    152   public static final QName getcontenttype = new QName(namespace, 
    153                                                        "getcontenttype"); 
    154  
    155   /** */ 
    156   public static final QName getetag = new QName(namespace, 
    157                                                      "getetag"); 
    158  
    159   /** */ 
    160   public static final QName getlastmodified = new QName(namespace, 
    161                                                        "getlastmodified"); 
    162  
    163   /** */ 
    164   public static final QName grant = new QName(namespace, 
    165                                              "grant"); 
    166  
    167   /** */ 
    168   public static final QName grantOnly = new QName(namespace, 
    169                                              "grant-only"); 
    170  
    171   /** */ 
    172   public static final QName group = new QName(namespace, 
    173                                              "group"); 
    174  
    175   /** */ 
    176   public static final QName groupMemberSet = new QName(namespace, 
    177                                                        "group-member-set"); 
    178  
    179   /** */ 
    180   public static final QName groupMembership = new QName(namespace, 
    181                                                         "group-membership"); 
    182  
    183   /** */ 
    184   public static final QName href = new QName(namespace, 
    185                                              "href"); 
    186  
    187   /** */ 
    188   public static final QName inherited = new QName(namespace, 
    189                                                   "inherited"); 
    190  
    191   /** */ 
    192   public static final QName inheritedAclSet = new QName(namespace, 
    193                                                         "inherited-acl-set"); 
    194  
    195   /** */ 
    196   public static final QName invert = new QName(namespace, 
    197                                                "invert"); 
    198  
    199   /** */ 
    200   public static final QName limitedNumberOfAces = new QName(namespace, 
    201                                                       "limited-number-of-aces"); 
    202  
    203   /** */ 
    204   public static final QName lockdiscovery = new QName(namespace, 
    205                                                       "lockdiscovery"); 
    206  
    207   /** */ 
    208   public static final QName lockentry = new QName(namespace, 
    209                                                   "lockentry"); 
    210  
    211   /** */ 
    212   public static final QName lockscope = new QName(namespace, 
    213                                                   "lockscope"); 
    214  
    215   /** */ 
    216   public static final QName locktype = new QName(namespace, 
    217                                                  "locktype"); 
    218  
    219   /** */ 
    220   public static final QName match = new QName(namespace, 
    221                                               "match"); 
    222  
    223   /** */ 
    224   public static final QName missingRequiredPrincipal = new QName(namespace, 
    225                                                  "missing-required-principal"); 
    226  
    227   /** */ 
    228   public static final QName multistatus = new QName(namespace, 
    229                                                     "multistatus"); 
    230  
    231   /** */ 
    232   public static final QName needPrivileges = new QName(namespace, 
    233                                                    "need-privileges"); 
    234  
    235   /** */ 
    236   public static final QName noAbstract = new QName(namespace, 
    237                                                    "no-abstract"); 
    238  
    239   /** */ 
    240   public static final QName noAceConflict = new QName(namespace, 
    241                                                       "no-ace-conflict"); 
    242  
    243   /** */ 
    244   public static final QName noInheritedAceConflict = new QName(namespace, 
    245                                                       "no-inherited-ace-conflict"); 
    246  
    247   /** */ 
    248   public static final QName noInvert = new QName(namespace, 
    249                                                  "no-invert"); 
    250  
    251   /** */ 
    252   public static final QName noProtectedAceConflict = new QName(namespace, 
    253                                                       "no-protected-ace-conflict"); 
    254  
    255   /** */ 
    256   public static final QName notSupportedPrivilege = new QName(namespace, 
    257                                               "not-supported-privilege"); 
    258  
    259   /** */ 
    260   public static final QName owner = new QName(namespace, 
    261                                               "owner"); 
    262  
    263   /** */ 
    264   public static final QName principal = new QName(namespace, 
    265                                                  "principal"); 
    266  
    267   /** */ 
    268   public static final QName principalCollectionSet = new QName(namespace, 
    269                                                  "principal-collection-set"); 
    270  
    271   /** */ 
    272   public static final QName principalMatch = new QName(namespace, 
    273                                                  "principal-match"); 
    274  
    275   /** */ 
    276   public static final QName principalProperty = new QName(namespace, 
    277                                                  "principal-property"); 
    278  
    279   /** */ 
    280   public static final QName principalPropertySearch = new QName(namespace, 
    281                                                  "principal-property-search"); 
    282  
    283   /** */ 
    284   public static final QName principalSearchProperty = new QName(namespace, 
    285                                                  "principal-search-property"); 
    286  
    287   /** */ 
    288   public static final QName principalSearchPropertySet = new QName(namespace, 
    289                                                  "principal-search-property-set"); 
    290  
    291   /** */ 
    292   public static final QName principalURL = new QName(namespace, 
    293                                                  "principal-URL"); 
    294  
    295   /** */ 
    296   public static final QName privilege = new QName(namespace, 
    297                                                   "privilege"); 
    298  
    299   /** */ 
    300   public static final QName prop = new QName(namespace, "prop"); 
    301  
    302   /** */ 
    303   public static final QName property = new QName(namespace, "property"); 
    304  
    305   /** */ 
    306   public static final QName propertySearch = new QName(namespace, 
    307                                              "property-search"); 
    308  
    309   /** */ 
    310   public static final QName propname = new QName(namespace, "propname"); 
    311  
    312   /** */ 
    313   public static final QName propstat = new QName(namespace, "propstat"); 
    314  
    315   /** */ 
    316   public static final QName _protected = new QName(namespace, 
    317                                                    "protected"); 
    318  
    319   /** */ 
    320   public static final QName read = new QName(namespace, "read"); 
    321  
    322   /** */ 
    323   public static final QName readAcl = new QName(namespace, "read-acl"); 
    324  
    325   /** */ 
    326   public static final QName readCurrentUserPrivilegeSet = new QName(namespace, 
     44  public static final QName _abstract = makeQName("abstract"); 
     45 
     46  /** */ 
     47  public static final QName ace = makeQName("ace"); 
     48 
     49  /** */ 
     50  public static final QName acl = makeQName("acl"); 
     51 
     52  /** */ 
     53  public static final QName aclPrincipalPropSet = makeQName("acl-principal-prop-set"); 
     54 
     55  /** */ 
     56  public static final QName aclRestrictions = makeQName("acl-restrictions"); 
     57 
     58  /** */ 
     59  public static final QName all = makeQName("all"); 
     60 
     61  /** */ 
     62  public static final QName allowedPrincipal = makeQName("allowed-principal"); 
     63 
     64  /** */ 
     65  public static final QName allprop = makeQName("allprop"); 
     66 
     67  /** */ 
     68  public static final QName alternateURISet = makeQName("alternate-URI-set"); 
     69 
     70  /** */ 
     71  public static final QName authenticated = makeQName("authenticated"); 
     72 
     73  /** */ 
     74  public static final QName bind = makeQName("bind"); 
     75 
     76  /** */ 
     77  public static final QName collection = makeQName("collection"); 
     78 
     79  /** */ 
     80  public static final QName creationdate = makeQName("creationdate"); 
     81 
     82  /** */ 
     83  public static final QName currentUserPrivilegeSet = makeQName("current-user-privilege-set"); 
     84 
     85  /** */ 
     86  public static final QName denyBeforeGrant = makeQName("deny-before-grant"); 
     87 
     88  /** */ 
     89  public static final QName deny = makeQName("deny"); 
     90 
     91  /** */ 
     92  public static final QName description = makeQName("description"); 
     93 
     94  /** */ 
     95  public static final QName displayname = makeQName("displayname"); 
     96 
     97  /** */ 
     98  public static final QName expandProperty = makeQName("expand-property"); 
     99 
     100  /** */ 
     101  public static final QName getcontentlanguage = makeQName("getcontentlanguage"); 
     102 
     103  /** */ 
     104  public static final QName getcontentlength = makeQName("getcontentlength"); 
     105 
     106  /** */ 
     107  public static final QName getcontenttype = makeQName("getcontenttype"); 
     108 
     109  /** */ 
     110  public static final QName getetag = makeQName("getetag"); 
     111 
     112  /** */ 
     113  public static final QName getlastmodified = makeQName("getlastmodified"); 
     114 
     115  /** */ 
     116  public static final QName grant = makeQName("grant"); 
     117 
     118  /** */ 
     119  public static final QName grantOnly = makeQName("grant-only"); 
     120 
     121  /** */ 
     122  public static final QName group = makeQName("group"); 
     123 
     124  /** */ 
     125  public static final QName groupMemberSet = makeQName("group-member-set"); 
     126 
     127  /** */ 
     128  public static final QName groupMembership = makeQName("group-membership"); 
     129 
     130  /** */ 
     131  public static final QName href = makeQName("href"); 
     132 
     133  /** */ 
     134  public static final QName inherited = makeQName("inherited"); 
     135 
     136  /** */ 
     137  public static final QName inheritedAclSet = makeQName("inherited-acl-set"); 
     138 
     139  /** */ 
     140  public static final QName invert = makeQName("invert"); 
     141 
     142  /** */ 
     143  public static final QName limitedNumberOfAces = makeQName("limited-number-of-aces"); 
     144 
     145  /** */ 
     146  public static final QName lockdiscovery = makeQName("lockdiscovery"); 
     147 
     148  /** */ 
     149  public static final QName lockentry = makeQName("lockentry"); 
     150 
     151  /** */ 
     152  public static final QName lockscope = makeQName("lockscope"); 
     153 
     154  /** */ 
     155  public static final QName locktype = makeQName("locktype"); 
     156 
     157  /** */ 
     158  public static final QName match = makeQName("match"); 
     159 
     160  /** */ 
     161  public static final QName missingRequiredPrincipal = makeQName("missing-required-principal"); 
     162 
     163  /** */ 
     164  public static final QName multistatus = makeQName("multistatus"); 
     165 
     166  /** */ 
     167  public static final QName needPrivileges = makeQName("need-privileges"); 
     168 
     169  /** */ 
     170  public static final QName noAbstract = makeQName("no-abstract"); 
     171 
     172  /** */ 
     173  public static final QName noAceConflict = makeQName("no-ace-conflict"); 
     174 
     175  /** */ 
     176  public static final QName noInheritedAceConflict = makeQName("no-inherited-ace-conflict"); 
     177 
     178  /** */ 
     179  public static final QName noInvert = makeQName("no-invert"); 
     180 
     181  /** */ 
     182  public static final QName noProtectedAceConflict = makeQName("no-protected-ace-conflict"); 
     183 
     184  /** */ 
     185  public static final QName notSupportedPrivilege = makeQName("not-supported-privilege"); 
     186 
     187  /** */ 
     188  public static final QName owner = makeQName("owner"); 
     189 
     190  /** */ 
     191  public static final QName principal = makeQName("principal"); 
     192 
     193  /** */ 
     194  public static final QName principalCollectionSet = makeQName("principal-collection-set"); 
     195 
     196  /** */ 
     197  public static final QName principalMatch = makeQName("principal-match"); 
     198 
     199  /** */ 
     200  public static final QName principalProperty = makeQName("principal-property"); 
     201 
     202  /** */ 
     203  public static final QName principalPropertySearch = makeQName("principal-property-search"); 
     204 
     205  /** */ 
     206  public static final QName principalSearchProperty = makeQName("principal-search-property"); 
     207 
     208  /** */ 
     209  public static final QName principalSearchPropertySet = makeQName("principal-search-property-set"); 
     210 
     211  /** */ 
     212  public static final QName principalURL = makeQName("principal-URL"); 
     213 
     214  /** */ 
     215  public static final QName privilege = makeQName("privilege"); 
     216 
     217  /** */ 
     218  public static final QName prop = makeQName("prop"); 
     219 
     220  /** */ 
     221  public static final QName property = makeQName("property"); 
     222 
     223  /** */ 
     224  public static final QName propertySearch = makeQName("property-search"); 
     225 
     226  /** */ 
     227  public static final QName propname = makeQName("propname"); 
     228 
     229  /** */ 
     230  public static final QName propstat = makeQName("propstat"); 
     231 
     232  /** */ 
     233  public static final QName _protected = makeQName("protected"); 
     234 
     235  /** */ 
     236  public static final QName read = makeQName("read"); 
     237 
     238  /** */ 
     239  public static final QName readAcl = makeQName("read-acl"); 
     240 
     241  /** */ 
     242  public static final QName readCurrentUserPrivilegeSet = makeQName( 
    327243                                                "read-current-user-privilege-set"); 
    328244 
    329245  /** */ 
    330   public static final QName recognizedPrincipal = new QName(namespace, 
    331                                                      "recognized-principal"); 
    332  
    333   /** */ 
    334   public static final QName remove = new QName(namespace, "remove"); 
    335  
    336   /** */ 
    337   public static final QName requiredPrincipal = new QName(namespace, 
    338                                                      "required-principal"); 
    339  
    340   /** */ 
    341   public static final QName resource = new QName(namespace, 
    342                                                  "resource"); 
    343  
    344   /** */ 
    345   public static final QName resourcetype = new QName(namespace, 
    346                                                      "resourcetype"); 
    347  
    348   /** */ 
    349   public static final QName response = new QName(namespace, "response"); 
    350  
    351   /** */ 
    352   public static final QName responseDescription = new QName(namespace, 
    353                                                       "responsedescription"); 
    354  
    355   /** */ 
    356   public static final QName self = new QName(namespace, "self"); 
    357  
    358   /** */ 
    359   public static final QName set = new QName(namespace, "set"); 
    360  
    361   /** */ 
    362   public static final QName source = new QName(namespace, "source"); 
    363  
    364   /** */ 
    365   public static final QName status = new QName(namespace, "status"); 
    366  
    367   /** */ 
    368   public static final QName supportedPrivilege = new QName(namespace, 
    369                                                         "supported-privilege"); 
    370  
    371   /** */ 
    372   public static final QName supportedPrivilegeSet = new QName(namespace, 
    373                                                         "supported-privilege-set"); 
    374  
    375   /** */ 
    376   public static final QName supportedlock = new QName(namespace, 
    377                                                   "supportedlock"); 
    378  
    379   /** */ 
    380   public static final QName unauthenticated = new QName(namespace, 
    381                                                         "unauthenticated"); 
    382  
    383   /** */ 
    384   public static final QName unbind = new QName(namespace, 
    385                                                "unbind"); 
    386  
    387   /** */ 
    388   public static final QName unlock = new QName(namespace, 
    389                                                "unlock"); 
    390  
    391   /** */ 
    392   public static final QName write = new QName(namespace, 
    393                                               "write"); 
    394  
    395   /** */ 
    396   public static final QName writeAcl = new QName(namespace, 
    397                                                  "write-acl"); 
    398  
    399   /** */ 
    400   public static final QName writeContent = new QName(namespace, 
    401                                                  "write-content"); 
    402  
    403   /** */ 
    404   public static final QName writeProperties = new QName(namespace, 
    405                                                  "write-properties"); 
     246  public static final QName recognizedPrincipal = makeQName("recognized-principal"); 
     247 
     248  /** */ 
     249  public static final QName remove = makeQName("remove"); 
     250 
     251  /** */ 
     252  public static final QName requiredPrincipal = makeQName("required-principal"); 
     253 
     254  /** */ 
     255  public static final QName resource = makeQName("resource"); 
     256 
     257  /** */ 
     258  public static final QName resourcetype = makeQName("resourcetype"); 
     259 
     260  /** */ 
     261  public static final QName response = makeQName("response"); 
     262 
     263  /** */ 
     264  public static final QName responseDescription = makeQName("responsedescription"); 
     265 
     266  /** */ 
     267  public static final QName self = makeQName("self"); 
     268 
     269  /** */ 
     270  public static final QName set = makeQName("set"); 
     271 
     272  /** */ 
     273  public static final QName source = makeQName("source"); 
     274 
     275  /** */ 
     276  public static final QName status = makeQName("status"); 
     277 
     278  /** */ 
     279  public static final QName supportedPrivilege = makeQName("supported-privilege"); 
     280 
     281  /** */ 
     282  public static final QName supportedPrivilegeSet = makeQName("supported-privilege-set"); 
     283 
     284  /** */ 
     285  public static final QName supportedlock = makeQName("supportedlock"); 
     286 
     287  /** */ 
     288  public static final QName unauthenticated = makeQName("unauthenticated"); 
     289 
     290  /** */ 
     291  public static final QName unbind = makeQName("unbind"); 
     292 
     293  /** */ 
     294  public static final QName unlock = makeQName("unlock"); 
     295 
     296  /** */ 
     297  public static final QName write = makeQName("write"); 
     298 
     299  /** */ 
     300  public static final QName writeAcl = makeQName("write-acl"); 
     301 
     302  /** */ 
     303  public static final QName writeContent = makeQName("write-content"); 
     304 
     305  /** */ 
     306  public static final QName writeProperties = makeQName("write-properties"); 
     307 
     308  /** Tables of QNames indexed by name 
     309   */ 
     310  public final static HashMap qnames = new HashMap(); 
     311 
     312  private static QName makeQName(String name) { 
     313    QName q = new QName(namespace, name); 
     314    qnames.put(name, q); 
     315 
     316    return q; 
     317  } 
     318 
     319  public QName getTag(String name) { 
     320    return (QName)qnames.get(name); 
     321  } 
    406322} 
    407323 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/taglib/EmitAclTag.java

    r797 r833  
    5454package org.bedework.webcommon.taglib; 
    5555 
    56  
    5756import org.bedework.appcommon.AccessXmlUtil; 
    5857 
     
    7877  public EmitAclTag() { 
    7978  } 
    80    
     79 
    8180  /** Called at end of Tag 
    8281   * 
     
    10099    return EVAL_PAGE; 
    101100  } 
    102    
     101 
    103102  private String getXmlAcl(CurrentAccess ca) throws Throwable { 
    104103    if (ca == null) { 
    105104      return null; 
    106105    } 
    107      
     106 
    108107    return AccessXmlUtil.getXmlAclString(ca.acl); 
    109108  }