Class FileRepository

    • Field Detail

      • directory

        protected final java.io.File directory
      • lastModified

        protected long lastModified
      • lastChecksum

        protected long lastChecksum
      • lastChecksumTime

        protected long lastChecksumTime
    • Constructor Detail

      • FileRepository

        public FileRepository​(java.lang.String path)
                       throws java.io.IOException
        Constructs a FileRepository using the given argument
        Parameters:
        path - absolute path to the directory
        Throws:
        java.io.IOException - if canonical path couldn't be resolved
      • FileRepository

        public FileRepository​(java.io.File dir)
                       throws java.io.IOException
        Constructs a FileRepository using the given directory as top-level repository
        Parameters:
        dir - directory
        Throws:
        java.io.IOException - if canonical path couldn't be resolved
      • FileRepository

        protected FileRepository​(java.io.File dir,
                                 FileRepository parent)
                          throws java.io.IOException
        Constructs a FileRepository using the given directory and top-level repository
        Parameters:
        dir - directory
        parent - top-level repository
        Throws:
        java.io.IOException - if canonical path couldn't be resolved
    • Method Detail

      • exists

        public boolean exists()
        Check whether the repository exists.
        Returns:
        true if the repository exists.
      • createChildRepository

        public AbstractRepository createChildRepository​(java.lang.String name)
                                                 throws java.io.IOException
        Create a child repository with the given name
        Specified by:
        createChildRepository in class AbstractRepository
        Parameters:
        name - the name of the repository
        Returns:
        the child repository
        Throws:
        java.io.IOException - an I/O error occurred
      • lastModified

        public long lastModified()
        Returns the date the repository was last modified.
        Returns:
        last modified date
      • getChecksum

        public long getChecksum()
                         throws java.io.IOException
        Checksum of the repository and all its contained resources. Implementations should make sure to return a different checksum if any contained resource has changed.
        Returns:
        checksum
        Throws:
        java.io.IOException
      • lookupResource

        protected Resource lookupResource​(java.lang.String name)
                                   throws java.io.IOException
        Called to create a child resource for this repository
        Specified by:
        lookupResource in class AbstractRepository
        Parameters:
        name - the name of the child resource
        Returns:
        the child resource, or null if no resource with the given name exists
        Throws:
        java.io.IOException - an I/O error occurred
      • getResources

        protected void getResources​(java.util.List<Resource> list,
                                    boolean recursive)
                             throws java.io.IOException
        Description copied from class: AbstractRepository
        Add the repository's resources into the list, optionally descending into nested repositories.
        Specified by:
        getResources in class AbstractRepository
        Parameters:
        list - the list to add the resources to
        recursive - whether to descend into nested repositories
        Throws:
        java.io.IOException - an I/O related error occurred
      • getRepositories

        public Repository[] getRepositories()
                                     throws java.io.IOException
        Description copied from interface: Repository
        Returns this repository's direct child repositories
        Returns:
        direct repositories
        Throws:
        java.io.IOException - an I/O error occurred
      • getUrl

        public java.net.URL getUrl()
                            throws java.net.MalformedURLException
        Description copied from interface: Trackable
        Returns an url to the resource if the repository of this resource is able to provide urls.
        Returns:
        url to the resource
        Throws:
        java.net.MalformedURLException
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object