Class DirectoryBundleSource

  • All Implemented Interfaces:
    BundleSource

    public class DirectoryBundleSource
    extends AbstractBundleSource
    implements BundleSource
    Represents a bundle source where each bundle is saved as a set of files within a directory. The constructor takes a directory which contains multiple subdirectories, one for each bundle.
    • Constructor Detail

      • DirectoryBundleSource

        public DirectoryBundleSource​(String masterBundleDirectoryPathname,
                                     JsonTool jsonTool)
                              throws Exception
        Construct this DirectoryBundleSource, verifying that the passed directory is actually a directory.
        Parameters:
        masterBundleDirectoryPathname - The path of a directory which can contain subdirectories for each bundle.
        jsonTool - The json utility to use, wrapped in a JsonTool class.
        Throws:
        Exception - If bundleDirectoryPathname is not a directory.
    • Method Detail

      • getMasterBundleDirectory

        public File getMasterBundleDirectory()
      • setMasterBundleDirectoryPathname

        public void setMasterBundleDirectoryPathname​(String pathname)
      • setJsonTool

        public void setJsonTool​(JsonTool tool)
      • getBundles

        public List<Bundle> getBundles()
        Description copied from interface: BundleSource
        Get all the bundles that seem initially correct.
        Specified by:
        getBundles in interface BundleSource
        Returns:
        A list of the available bundle objects.
      • checkIsValidBundleFile

        public boolean checkIsValidBundleFile​(String bundleId,
                                              String relativeFilePath)
        Description copied from interface: BundleSource
        Checks that the bundleId exists, and that the file is listed in the metadata.
        Specified by:
        checkIsValidBundleFile in interface BundleSource
        Parameters:
        bundleId - The Id of the bundle to which the requested file belongs.
        relativeFilePath - the relative path of the file, as listed in the metadata.
        Returns:
        true if the bundle exists and file is listed in the metadata. false otherwise.