edu.ucsb.nceas.metacat.accesscontrol

## Class AccessControlList

- java.lang.Object
- - org.xml.sax.helpers.DefaultHandler
  - - edu.ucsb.nceas.metacat.accesscontrol.AccessControlList

- All Implemented Interfaces:
    edu.ucsb.nceas.utilities.access.AccessControlInterface, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler

      public class AccessControlList
      extends org.xml.sax.helpers.DefaultHandler
      implements edu.ucsb.nceas.utilities.access.AccessControlInterface, org.xml.sax.ext.LexicalHandler

  A Class that loads eml-access.xml file containing ACL for a metadata document into relational DB. It extends DefaultHandler class to handle SAX parsing events when processing the XML stream.

- - ### Field Summary

    - ### Fields inherited from interface edu.ucsb.nceas.utilities.access.AccessControlInterface

      `ACCESS, ACLID, ALL, ALLOW, ALLOWFIRST, ALLSTRING, CHMOD, CHMODSTRING, DENY, DENYFIRST, ORDER, PERMISSION, PRINCIPAL, PUBLIC, READ, READSTRING, WRITE, WRITESTRING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AccessControlList(DBConnection conn)` Construct an instance of the AccessControlList class.
    `AccessControlList(DBConnection conn, java.lang.String aclid, int rev, java.lang.String user, java.lang.String[] groups, int serverCode)` Construct an instance of the AccessControlList class.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `characters(char[] ch, int start, int length)` Callback method used by the SAX Parser when the text sequences of an xml stream are detected.
    `void` | `comment(char[] ch, int start, int length)` SAX Handler that receives notification of comments in the DTD
    `void` | `endCDATA()` SAX Handler that receives notification of the end of CDATA sections
    `void` | `endDTD()` SAX Handler that receives notification of end of DTD
    `void` | `endElement(java.lang.String uri, java.lang.String localName, java.lang.String qName)` Callback method used by the SAX Parser when the end tag of an element is detected.
    `void` | `endEntity(java.lang.String name)` SAX Handler that receives notification of the end of entities.
    `java.lang.String` | `getDocname()` Get the document name.
    `static int` | `intValue(java.lang.String permission)`
    `static void` | `main(java.lang.String[] args)`
    `boolean` | `processingDTD()` Get the document processing state.
    `void` | `startCDATA()` SAX Handler that receives notification of the start of CDATA sections
    `void` | `startDocument()` Callback method used by the SAX Parser when beginning of the document
    `void` | `startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)` SAX Handler that receives notification of DOCTYPE.
    `void` | `startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)` Callback method used by the SAX Parser when the start tag of an element is detected.
    `void` | `startEntity(java.lang.String name)` SAX Handler that receives notification of the start of entities.
    `static java.lang.String` | `txtValue(int permission)`

    - ### Methods inherited from class org.xml.sax.helpers.DefaultHandler

      `endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AccessControlList

          public AccessControlList(DBConnection conn)
                            throws java.sql.SQLException

      Construct an instance of the AccessControlList class. It is used by the permission check up from DBQuery or DocumentImpl and from "getaccesscontrol" action
      Parameters:
        `conn` - the JDBC connection where acl info is get
      Throws:
        `java.sql.SQLException`

    - #### AccessControlList

          public AccessControlList(DBConnection conn,
                                   java.lang.String aclid,
                                   int rev,
                                   java.lang.String user,
                                   java.lang.String[] groups,
                                   int serverCode)
                            throws org.xml.sax.SAXException,
                                   java.io.IOException,
                                   McdbException,
                                   edu.ucsb.nceas.utilities.PropertyNotFoundException

      Construct an instance of the AccessControlList class. It parse acl file and loads acl data into db connection.
      Parameters:
        `conn` - the JDBC connection where acl data are loaded
        `aclid` - the Accession# of the document with the acl data
        `acl` - the acl file containing acl data
        `user` - the user connected to MetaCat servlet and owns the document
        `groups` - the groups to which user belongs
        `serverCode` - the serverid from xml_replication on which this document resides.
      Throws:
        `org.xml.sax.SAXException`
        `java.io.IOException`
        `McdbException`
        `edu.ucsb.nceas.utilities.PropertyNotFoundException`

  - ### Method Detail

    - #### startDocument

          public void startDocument()
                             throws org.xml.sax.SAXException

      Callback method used by the SAX Parser when beginning of the document
      Specified by:
        `startDocument` in interface `org.xml.sax.ContentHandler`
      Overrides:
        `startDocument` in class `org.xml.sax.helpers.DefaultHandler`
      Throws:
        `org.xml.sax.SAXException`

    - #### startElement

          public void startElement(java.lang.String uri,
                                   java.lang.String localName,
                                   java.lang.String qName,
                                   org.xml.sax.Attributes atts)
                            throws org.xml.sax.SAXException

      Callback method used by the SAX Parser when the start tag of an element is detected. Used in this context to parse and store the acl information in class variables.
      Specified by:
        `startElement` in interface `org.xml.sax.ContentHandler`
      Overrides:
        `startElement` in class `org.xml.sax.helpers.DefaultHandler`
      Throws:
        `org.xml.sax.SAXException`

    - #### characters

          public void characters(char[] ch,
                                 int start,
                                 int length)
                          throws org.xml.sax.SAXException

      Callback method used by the SAX Parser when the text sequences of an xml stream are detected. Used in this context to parse and store the acl information in class variables.
      Specified by:
        `characters` in interface `org.xml.sax.ContentHandler`
      Overrides:
        `characters` in class `org.xml.sax.helpers.DefaultHandler`
      Throws:
        `org.xml.sax.SAXException`

    - #### endElement

          public void endElement(java.lang.String uri,
                                 java.lang.String localName,
                                 java.lang.String qName)
                          throws org.xml.sax.SAXException

      Callback method used by the SAX Parser when the end tag of an element is detected. Used in this context to parse and store the acl information in class variables.
      Specified by:
        `endElement` in interface `org.xml.sax.ContentHandler`
      Overrides:
        `endElement` in class `org.xml.sax.helpers.DefaultHandler`
      Throws:
        `org.xml.sax.SAXException`

    - #### startDTD

          public void startDTD(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId)
                        throws org.xml.sax.SAXException

      SAX Handler that receives notification of DOCTYPE. Sets the DTD.
      Specified by:
        `startDTD` in interface `org.xml.sax.ext.LexicalHandler`
      Parameters:
        `name` - name of the DTD
        `publicId` - Public Identifier of the DTD
        `systemId` - System Identifier of the DTD
      Throws:
        `org.xml.sax.SAXException`

    - #### endDTD

          public void endDTD()
                      throws org.xml.sax.SAXException

      SAX Handler that receives notification of end of DTD
      Specified by:
        `endDTD` in interface `org.xml.sax.ext.LexicalHandler`
      Throws:
        `org.xml.sax.SAXException`

    - #### startEntity

          public void startEntity(java.lang.String name)
                           throws org.xml.sax.SAXException

      SAX Handler that receives notification of the start of entities.
      Specified by:
        `startEntity` in interface `org.xml.sax.ext.LexicalHandler`
      Parameters:
        `name` - name of the entity
      Throws:
        `org.xml.sax.SAXException`

    - #### endEntity

          public void endEntity(java.lang.String name)
                         throws org.xml.sax.SAXException

      SAX Handler that receives notification of the end of entities.
      Specified by:
        `endEntity` in interface `org.xml.sax.ext.LexicalHandler`
      Parameters:
        `name` - name of the entity
      Throws:
        `org.xml.sax.SAXException`

    - #### getDocname

          public java.lang.String getDocname()

      Get the document name.

    - #### processingDTD

          public boolean processingDTD()

      Get the document processing state.

    - #### intValue

          public static int intValue(java.lang.String permission)

    - #### txtValue

          public static java.lang.String txtValue(int permission)

    - #### comment

          public void comment(char[] ch,
                              int start,
                              int length)
                       throws org.xml.sax.SAXException

      SAX Handler that receives notification of comments in the DTD
      Specified by:
        `comment` in interface `org.xml.sax.ext.LexicalHandler`
      Throws:
        `org.xml.sax.SAXException`

    - #### startCDATA

          public void startCDATA()
                          throws org.xml.sax.SAXException

      SAX Handler that receives notification of the start of CDATA sections
      Specified by:
        `startCDATA` in interface `org.xml.sax.ext.LexicalHandler`
      Throws:
        `org.xml.sax.SAXException`

    - #### endCDATA

          public void endCDATA()
                        throws org.xml.sax.SAXException

      SAX Handler that receives notification of the end of CDATA sections
      Specified by:
        `endCDATA` in interface `org.xml.sax.ext.LexicalHandler`
      Throws:
        `org.xml.sax.SAXException`

    - #### main

          public static void main(java.lang.String[] args)

Copyright © 2020 Regents of the University of California. All Rights Reserved.