Interface WebFilesService


  • public interface WebFilesService
    • Field Detail

      • 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 the WebFileBundle for bundleName 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 - If true and AutoReloadService is enabled, then skip loading of webfilebundle as it already will have been loaded by AutoReloadService.
        If true and AutoReloadService is disabled, load webfilebundle.
        If false, Webfilebundle must be loaded, regardless of the state of AutoReloadService.
        Throws:
        IOException - if an I/O error occurs while reading web files from file system
        WebFileException - 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 - If true and AutoReloadService is enabled, then skip loading of webfilebundle as it already will have been loaded by AutoReloadService.
        If true and AutoReloadService is disabled, load webfilebundle.
        If false, 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 file
        WebFileException - 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 bundle
        bundleSubPath - 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 fileOrDirectory
        WebFileException - if an error occurs while importing web files