Class DirectoryBuilder


  • public class DirectoryBuilder
    extends Object
    A Builder of DirectoryPartitions and DirectoryCollections. Each DirectoryBuilder is associated with one directory, and one ncx index. This may contain collections of files (MFiles in a DirectoryCollection), or subdirectories (MCollections in a DirectoryPartition).
    Since:
    11/10/13
    • Constructor Detail

      • DirectoryBuilder

        public DirectoryBuilder​(String topCollectionName,
                                Path dir,
                                BasicFileAttributes attr,
                                String suffix)
                         throws IOException
        Create a DirectoryBuilder for the named directory
        Parameters:
        topCollectionName - from config, name of the collection
        dir - covers this directory
        attr - file attributes, may be null
        Throws:
        IOException
    • Method Detail

      • findIndex

        public boolean findIndex()
                          throws IOException
        Find the index file, using its canonical name
        Returns:
        true if found
        Throws:
        IOException
      • constructChildren

        public List<DirectoryBuilder> constructChildren​(IndexReader indexReader,
                                                        CollectionUpdateType forceCollection)
                                                 throws IOException
        Find all children directories. Does not recurse. We separate this from the constructor so it can be done on demand Public for debugging. Look for children by:
        1. If index exists , use the children inside there./li>
        2. (or) scan the directory for children partitions
        Parameters:
        indexReader - this reads the index, and calls AddChild.addchild() for each child
        Returns:
        children, may be empty but not null
        Throws:
        IOException
      • getDir

        public Path getDir()
        The directory that the partition covers
        Returns:
        directory
      • getIndex

        public Path getIndex()
        The ncx2 file
        Returns:
        ncx2 file path
      • getChildren

        public List<DirectoryBuilder> getChildren()
        May be null if constructChildren() was not called
        Returns:
        children directories
      • getPartitionName

        public String getPartitionName()