Interface ModuleFileProvider
- All Known Implementing Classes:
DefaultModuleFileProvider
public interface ModuleFileProvider
Interface for providing file access operations specific to module parsing.
This interface encapsulates file access operations that are specific to parsing eLearning modules, such as getting manifest files, checking for xAPI files, etc. It separates file access concerns from parsing logic, making the parsers more focused on their primary responsibility.
Implementations of this interface should handle the details of accessing files from different storage mechanisms (e.g., ZIP files, local file system, S3, etc.) and provide a consistent interface for parsers to use.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanfileExists(String path) Checks if a file exists at the specified path.getFileContents(String path) Gets the contents of a file as an InputStream.Gets the root path of the module.booleanChecks if the module contains xAPI-related files.Lists all files in the specified directory.
-
Method Details
-
getFileContents
Gets the contents of a file as an InputStream.- Parameters:
path- The path to the file.- Returns:
- An InputStream containing the file contents.
- Throws:
IOException- If an error occurs while reading the file.IllegalArgumentException- if path is null
-
fileExists
Checks if a file exists at the specified path.- Parameters:
path- The path to check.- Returns:
- true if the file exists, false otherwise.
- Throws:
IllegalArgumentException- if path is null
-
getRootPath
String getRootPath()Gets the root path of the module.- Returns:
- The root path of the module.
-
hasXapiSupport
boolean hasXapiSupport()Checks if the module contains xAPI-related files.- Returns:
- true if xAPI is enabled, false otherwise.
-
listFiles
Lists all files in the specified directory.- Parameters:
directory- The directory to list files from.- Returns:
- A list of file names in the directory.
- Throws:
IOException- If an error occurs while listing the files.IllegalArgumentException- if directory is null
-