Interface WebFilesService
-
public interface WebFilesService
-
-
Field Summary
Fields Modifier and Type Field Description static String
JCR_ROOT_PATH
static String
RELOAD_DISCARD_RUNTIME_CHANGES
Reload bundle even if runtime digest is inconsistent with the one from baseline (runtime was modified)static String
RELOAD_IF_RUNTIME_UNCHANGED
Reload bundle from JAR if bundle's runtime digest is consistent with the one from baselinestatic String
RELOAD_NEVER
Dont reload bundle even if it is modified at classpath level
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
fileMatches(File file)
WebFileBundle
getJcrWebFileBundle(javax.jcr.Session session, String bundleName)
Creates a web files implementation based on JCR.String
getReloadMode()
void
importJcrWebFileBundle(javax.jcr.Session session, File directory, boolean skipIfAlreadyAutoLoaded)
Imports a web file bundle from a directory.void
importJcrWebFileBundle(javax.jcr.Session session, ZipFile zip, boolean skipIfAlreadyAutoLoaded)
Imports a web file bundle from the given zip file.void
importJcrWebFiles(javax.jcr.Session session, String bundleName, String bundleSubPath, File fileOrDirectory)
Imports a sub-tree of a web file bundle from a directory.
-
-
-
Field Detail
-
JCR_ROOT_PATH
static final String JCR_ROOT_PATH
- See Also:
- Constant Field Values
-
RELOAD_NEVER
static final String RELOAD_NEVER
Dont reload bundle even if it is modified at classpath level- See Also:
- Constant Field Values
-
RELOAD_IF_RUNTIME_UNCHANGED
static final String RELOAD_IF_RUNTIME_UNCHANGED
Reload bundle from JAR if bundle's runtime digest is consistent with the one from baseline- See Also:
- Constant Field Values
-
RELOAD_DISCARD_RUNTIME_CHANGES
static final String RELOAD_DISCARD_RUNTIME_CHANGES
Reload bundle even if runtime digest is inconsistent with the one from baseline (runtime was modified)- See Also:
- Constant Field Values
-
-
Method Detail
-
fileMatches
boolean fileMatches(File file)
- Parameters:
file
-File
- Returns:
- Check if given file is part of webfile bundle
-
getReloadMode
String getReloadMode()
- Returns:
- Reload mode for bundles
-
getJcrWebFileBundle
WebFileBundle getJcrWebFileBundle(javax.jcr.Session session, String bundleName) throws WebFileException
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(javax.jcr.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(javax.jcr.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(javax.jcr.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
-
-