Class BwSysIntfImpl

  • All Implemented Interfaces:
    SysIntf, org.bedework.util.logging.Logged, org.bedework.webdav.servlet.shared.WdSysIntf

    public class BwSysIntfImpl
    extends Object
    implements org.bedework.util.logging.Logged, SysIntf
    Bedework implementation of carddav SysIntf.
    Author:
    Mike Douglass douglm at rpi.edu
    • Constructor Detail

      • BwSysIntfImpl

        public BwSysIntfImpl()
    • Method Detail

      • init

        public void init​(javax.servlet.http.HttpServletRequest req,
                         String account,
                         CardDAVConfig conf,
                         CardDAVContextConfig ctxConf)
                  throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Called before any other method is called to allow initialisation to take place at the first or subsequent requests
        Specified by:
        init in interface SysIntf
        conf - global service configuration
        ctxConf - per application type configuration
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getDefaultContentType

        public String getDefaultContentType()
        Specified by:
        getDefaultContentType in interface org.bedework.webdav.servlet.shared.WdSysIntf
      • getNotificationURL

        public String getNotificationURL()
                                  throws org.bedework.webdav.servlet.shared.WebdavException
        Specified by:
        getNotificationURL in interface org.bedework.webdav.servlet.shared.WdSysIntf
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getPrincipal

        public org.bedework.access.AccessPrincipal getPrincipal()
                                                         throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Return the current principal
        Specified by:
        getPrincipal in interface SysIntf
        Returns:
        String
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getUrlHandler

        public org.bedework.webdav.servlet.shared.UrlHandler getUrlHandler()
        Specified by:
        getUrlHandler in interface org.bedework.webdav.servlet.shared.WdSysIntf
      • allowsSyncReport

        public boolean allowsSyncReport​(org.bedework.webdav.servlet.shared.WdCollection col)
                                 throws org.bedework.webdav.servlet.shared.WebdavException
        Specified by:
        allowsSyncReport in interface org.bedework.webdav.servlet.shared.WdSysIntf
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • isPrincipal

        public boolean isPrincipal​(String val)
                            throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Does the value appear to represent a valid principal?
        Specified by:
        isPrincipal in interface SysIntf
        Returns:
        true if it's a (possible) principal
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getPrincipal

        public org.bedework.access.AccessPrincipal getPrincipal​(String href)
                                                         throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Return principal information for the given href. Also tests for a valid principal.
        Specified by:
        getPrincipal in interface SysIntf
        Returns:
        AccessPrincipal
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • makeHref

        public String makeHref​(org.bedework.access.AccessPrincipal p)
                        throws org.bedework.webdav.servlet.shared.WebdavException
        Specified by:
        makeHref in interface SysIntf
        Returns:
        String href
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getGroups

        public Collection<String> getGroups​(String rootUrl,
                                            String principalUrl)
                                     throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        The urls should be principal urls. principalUrl can null for the current user. The result is a collection of principal urls of which the given url is a member, based upon rootUrl. For example, if rootUrl points to the base of the user principal hierarchy, then the rsult should be at least the current user's principal url, remembering that user principals are themselves groups and the user is considered a member of their own group.
        Specified by:
        getGroups in interface SysIntf
        Parameters:
        rootUrl - - url to base search on.
        principalUrl - - url of principal or null for current user
        Returns:
        Collection of urls - always non-null
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getDirectoryBrowsingDisallowed

        public boolean getDirectoryBrowsingDisallowed()
                                               throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Do we allow browsing of directories?
        Specified by:
        getDirectoryBrowsingDisallowed in interface SysIntf
        Returns:
        boolean true if browsing disallowed
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException - for errors
      • getPrincipalInfo

        public SysIntf.PrincipalInfo getPrincipalInfo​(org.bedework.access.AccessPrincipal pcpl,
                                                      boolean getDirInfo)
                                               throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Given a valid principal return the associated information needed for carddav interactions.
        Specified by:
        getPrincipalInfo in interface SysIntf
        Parameters:
        pcpl - the principal
        getDirInfo - get directory info if true and available.
        Returns:
        PrincipalInfo or null
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException - for errors
      • getPrincipalCollectionSet

        public Collection<String> getPrincipalCollectionSet​(String resourceUri)
                                                     throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Given a uri returns a Collection of uris that allow search operations on principals for that resource.
        Specified by:
        getPrincipalCollectionSet in interface SysIntf
        Returns:
        Collection of String
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getPrincipals

        public Collection<SysIntf.PrincipalInfo> getPrincipals​(String resourceUri,
                                                               org.bedework.webdav.servlet.shared.PrincipalPropertySearch pps)
                                                        throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Given a PrincipalPropertySearch returns a Collection of matching principals.
        Specified by:
        getPrincipals in interface SysIntf
        pps - Collection of PrincipalPropertySearch
        Returns:
        Collection of CalUserInfo
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • addCard

        public void addCard​(String path,
                            Card card)
                     throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Add a card.
        Specified by:
        addCard in interface SysIntf
        Parameters:
        path - to collection
        card - Object to be added
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • updateCard

        public void updateCard​(String path,
                               Card card)
                        throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Update a card.
        Specified by:
        updateCard in interface SysIntf
        Parameters:
        path - to collection
        card - Object to be updated
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getCards

        public GetResult getCards​(CarddavCollection col,
                                  Filter filter,
                                  GetLimits limits)
                           throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Return the cards for the current user in the given collection using the supplied filter.
        Specified by:
        getCards in interface SysIntf
        Parameters:
        col - collection
        filter - - if non-null defines a search filter
        limits - - applied to this query
        Returns:
        Collection populated card objects
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getCard

        public Card getCard​(String path,
                            String name)
                     throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Get card given the collection and String name.
        Specified by:
        getCard in interface SysIntf
        Parameters:
        path - to collection
        name - String possible name
        Returns:
        Vcard or null
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • deleteCard

        public void deleteCard​(CarddavCardNode card)
                        throws org.bedework.webdav.servlet.shared.WebdavException
        Specified by:
        deleteCard in interface SysIntf
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • updateAccess

        public void updateAccess​(CarddavCardNode card,
                                 org.bedework.access.Acl acl)
                          throws org.bedework.webdav.servlet.shared.WebdavException
        Specified by:
        updateAccess in interface SysIntf
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • checkAccess

        public org.bedework.access.CurrentAccess checkAccess​(CarddavCollection ent,
                                                             int desiredAccess,
                                                             boolean returnResult)
                                                      throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Check the access for the given entity. Returns the current access or null or optionally throws a no access exception.
        Specified by:
        checkAccess in interface SysIntf
        Returns:
        CurrentAccess
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException - if returnResult false and no access
      • updateAccess

        public void updateAccess​(CarddavColNode col,
                                 org.bedework.access.Acl acl)
                          throws org.bedework.webdav.servlet.shared.WebdavException
        Specified by:
        updateAccess in interface SysIntf
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • makeCollection

        public int makeCollection​(CarddavCollection col,
                                  String parentPath)
                           throws org.bedework.webdav.servlet.shared.WebdavException
        Specified by:
        makeCollection in interface SysIntf
        Parameters:
        col - Initialised collection object
        Returns:
        int status
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • deleteCollection

        public void deleteCollection​(org.bedework.webdav.servlet.shared.WdCollection col)
                              throws org.bedework.webdav.servlet.shared.WebdavException
        Specified by:
        deleteCollection in interface SysIntf
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • copyMove

        public void copyMove​(org.bedework.webdav.servlet.shared.WdCollection from,
                             org.bedework.webdav.servlet.shared.WdCollection to,
                             boolean copy,
                             boolean overwrite)
                      throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Copy or move the collection to another location. Status is set on return
        Specified by:
        copyMove in interface SysIntf
        Parameters:
        from - Source collection
        to - Destination collection
        copy - true for copying
        overwrite - destination exists
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • copyMove

        public boolean copyMove​(Card from,
                                org.bedework.webdav.servlet.shared.WdCollection to,
                                String name,
                                boolean copy,
                                boolean overwrite)
                         throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Copy or move the given entity to the destination collection with the given name. Status is set on return
        Specified by:
        copyMove in interface SysIntf
        Parameters:
        from - Source entity
        to - Destination collection
        name - String name of new entity
        copy - true for copying
        overwrite - destination exists
        Returns:
        true if destination created (i.e. not updated)
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getCollection

        public CarddavCollection getCollection​(String path)
                                        throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Get a collection given the path
        Specified by:
        getCollection in interface SysIntf
        Parameters:
        path - String path of collection
        Returns:
        WdCollection null for unknown collection
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • updateCollection

        public void updateCollection​(org.bedework.webdav.servlet.shared.WdCollection val)
                              throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Update a collection.
        Specified by:
        updateCollection in interface SysIntf
        Parameters:
        val - updated WdCollection object
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getCollections

        public GetResult getCollections​(CarddavCollection val,
                                        GetLimits limits)
                                 throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Returns children of the given collection to which the current user has some access.
        Specified by:
        getCollections in interface SysIntf
        Parameters:
        val - parent collection
        Returns:
        GetResult with collection of WdCollection
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • putFile

        public void putFile​(org.bedework.webdav.servlet.shared.WdCollection coll,
                            CarddavResource val)
                     throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        PUT a file.
        Specified by:
        putFile in interface SysIntf
        Parameters:
        coll - WdCollection defining recipient collection
        val - BwResource
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getFile

        public CarddavResource getFile​(org.bedework.webdav.servlet.shared.WdCollection coll,
                                       String name)
                                throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        GET a file.
        Specified by:
        getFile in interface SysIntf
        Parameters:
        coll - WdCollection containing file
        Returns:
        BwResource
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getFileContent

        public void getFileContent​(CarddavResource val)
                            throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Get resource content given the resource. It will be set in the resource object
        Specified by:
        getFileContent in interface SysIntf
        Parameters:
        val - BwResource
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getFiles

        public Collection<CarddavResource> getFiles​(org.bedework.webdav.servlet.shared.WdCollection coll)
                                             throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Get the files in a collection.
        Specified by:
        getFiles in interface SysIntf
        Parameters:
        coll - WdCollection containing file
        Returns:
        Collection of BwResource
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • updateFile

        public void updateFile​(CarddavResource val,
                               boolean updateContent)
                        throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Update a file.
        Specified by:
        updateFile in interface SysIntf
        Parameters:
        val - BwResource
        updateContent - if true we also update the content
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • deleteFile

        public void deleteFile​(CarddavResource val)
                        throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Delete a file.
        Specified by:
        deleteFile in interface SysIntf
        Parameters:
        val - BwResource
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • copyMoveFile

        public boolean copyMoveFile​(CarddavResource from,
                                    org.bedework.webdav.servlet.shared.WdCollection to,
                                    String name,
                                    boolean copy,
                                    boolean overwrite)
                             throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Copy or move the given file to the destination collection with the given name. Status is set on return
        Specified by:
        copyMoveFile in interface SysIntf
        Parameters:
        from - Source resource
        to - Destination collection
        name - String name of new entity
        copy - true for copying
        overwrite - destination exists
        Returns:
        true if destination created (i.e. not updated)
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getMaxUserEntitySize

        public int getMaxUserEntitySize()
                                 throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        Max size for an entity
        Specified by:
        getMaxUserEntitySize in interface SysIntf
        Returns:
        int
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • close

        public void close()
                   throws org.bedework.webdav.servlet.shared.WebdavException
        Description copied from interface: SysIntf
        End any transactions.
        Specified by:
        close in interface SysIntf
        Throws:
        org.bedework.webdav.servlet.shared.WebdavException
      • getLogger

        public org.bedework.util.logging.BwLogger getLogger()
        Specified by:
        getLogger in interface org.bedework.util.logging.Logged