Class DirectoryBundleSource

  • All Implemented Interfaces:

    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.
        masterBundleDirectoryPathname - The path of a directory which can contain subdirectories for each bundle.
        jsonTool - The json utility to use, wrapped in a JsonTool class.
        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
        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
        bundleId - The Id of the bundle to which the requested file belongs.
        relativeFilePath - the relative path of the file, as listed in the metadata.
        true if the bundle exists and file is listed in the metadata. false otherwise.