Interface WebFilesService
public interface WebFilesService
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
Reload bundle even if runtime digest is inconsistent with the one from baseline (runtime was modified)static final String
Reload bundle from JAR if bundle's runtime digest is consistent with the one from baselinestatic final String
Dont reload bundle even if it is modified at classpath level -
Method Summary
Modifier and TypeMethodDescriptionboolean
fileMatches
(File file) getJcrWebFileBundle
(Session session, String bundleName) Creates a web files implementation based on JCR.void
importJcrWebFileBundle
(Session session, File directory, boolean skipIfAlreadyAutoLoaded) Imports a web file bundle from a directory.void
importJcrWebFileBundle
(Session session, ZipFile zip, boolean skipIfAlreadyAutoLoaded) Imports a web file bundle from the given zip file.void
importJcrWebFiles
(Session session, String bundleName, String bundleSubPath, File fileOrDirectory) Imports a sub-tree of a web file bundle from a directory.
-
Field Details
-
JCR_ROOT_PATH
- See Also:
-
RELOAD_NEVER
Dont reload bundle even if it is modified at classpath level- See Also:
-
RELOAD_IF_RUNTIME_UNCHANGED
Reload bundle from JAR if bundle's runtime digest is consistent with the one from baseline- See Also:
-
RELOAD_DISCARD_RUNTIME_CHANGES
Reload bundle even if runtime digest is inconsistent with the one from baseline (runtime was modified)- See Also:
-
-
Method Details
-
fileMatches
- Parameters:
file
-File
- Returns:
- Check if given file is part of webfile bundle
-
getReloadMode
String getReloadMode()- Returns:
- Reload mode for bundles
-
getJcrWebFileBundle
Creates a web files implementation based on JCR.- Parameters:
session
- the JCR session used to access web files.bundleName
- the name of the web files bundle.- Returns:
- a JCR-based web files implementation for
bundleName
. - Throws:
WebFileException
- if theWebFileBundle
forbundleName
cannot be found
-
importJcrWebFileBundle
void importJcrWebFileBundle(Session session, File directory, boolean skipIfAlreadyAutoLoaded) throws IOException, WebFileException Imports a web file bundle from a directory. The name of the directory is used as the name of the bundle. Existing web files in JCR are replaced by the new ones. Missing web files are deleted from JCR. The caller of this method is responsible for saving the changes made in the session.- Parameters:
session
- the JCR session used to access web files.directory
- the directory containing the web files to import.skipIfAlreadyAutoLoaded
- Iftrue
and AutoReloadService is enabled, then skip loading of webfilebundle as it already will have been loaded by AutoReloadService.
Iftrue
and AutoReloadService is disabled, load webfilebundle.
Iffalse
, Webfilebundle must be loaded, regardless of the state of AutoReloadService.- Throws:
IOException
- if an I/O error occurs while reading web files from file systemWebFileException
- if another error occurs while importing web files
-
importJcrWebFileBundle
void importJcrWebFileBundle(Session session, ZipFile zip, boolean skipIfAlreadyAutoLoaded) throws IOException, WebFileException Imports a web file bundle from the given zip file. The zip file should contain a single root directory entry that contains all web files. The name of the root directory entry is used as the name of the bundle. Existing web files in JCR are replaced by the new ones. Missing web files are deleted from JCR. The caller of this method is responsible for saving the changes made in the session.- Parameters:
session
- the JCR session used to access web files.zip
- the ZIP file containing the web files to import.skipIfAlreadyAutoLoaded
- Iftrue
and AutoReloadService is enabled, then skip loading of webfilebundle as it already will have been loaded by AutoReloadService.
Iftrue
and AutoReloadService is disabled, load webfilebundle.
Iffalse
, Webfilebundle must be loaded, regardless of the state of AutoReloadService.- Throws:
IOException
- if an I/O error occurs while reading web files from the ZIP fileWebFileException
- if another error occurs while importing web files
-
importJcrWebFiles
void importJcrWebFiles(Session session, String bundleName, String bundleSubPath, File fileOrDirectory) throws IOException, WebFileException Imports a sub-tree of a web file bundle from a directory. The sub-tree can consist of a directory or a single file. The caller of this method is responsible for saving the changes made in the session.- Parameters:
session
- the JCR session used to access web files.bundleName
- the name of the web file bundlebundleSubPath
- the relative sub-path in the web file bundle to import the resources into.fileOrDirectory
- the file or directory to import web files from.- Throws:
IOException
- if an I/O error occurs while reading web files from the fileOrDirectoryWebFileException
- if an error occurs while importing web files
-