Interface Store

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void createDocument​(java.lang.String documentPath, java.lang.String content)
      Creates a document.
      void createDocuments​(java.util.List<org.springframework.extensions.surf.util.Pair<java.lang.String,​org.dom4j.Document>> paths)
      Creates multiple XML documents at the specified paths.
      boolean exists()
      Determines whether the store actually exists
      java.lang.String[] getAllDocumentPaths()
      Gets the paths of all documents in this store
      java.lang.String getBasePath()
      Gets the base path of the store
      java.lang.String[] getDescriptionDocumentPaths()
      Gets the paths of all Web Script description documents in this store
      java.io.InputStream getDocument​(java.lang.String documentPath)
      Gets a document.
      java.lang.String[] getDocumentPaths​(java.lang.String path, boolean includeSubPaths, java.lang.String documentPattern)
      Gets the paths of given document pattern within given path/sub-paths in this store
      java.lang.String[] getDocumentPaths​(java.lang.String path, java.lang.String filePathPattern)
      Gets the paths matching a given file path pattern in this store.
      java.lang.String[] getScriptDocumentPaths​(WebScript script)
      Gets the paths of all implementation files for a given Web Script
      ScriptLoader getScriptLoader()
      Gets the script loader for this store
      freemarker.cache.TemplateLoader getTemplateLoader()
      Gets the template loader for this store
      boolean hasDocument​(java.lang.String documentPath)
      Determines if the document exists.
      void init()
      Initialise Store (called once)
      boolean isReadOnly()
      Indicates whether or not this store can be written to.
      boolean isSecure()
      Returns true if this store is considered secure - i.e.
      long lastModified​(java.lang.String documentPath)
      Gets the last modified timestamp for the document.
      boolean removeDocument​(java.lang.String documentPath)
      Removes an existing document.
      void updateDocument​(java.lang.String documentPath, java.lang.String content)
      Updates an existing document.
    • Method Detail

      • init

        void init()
        Initialise Store (called once)
      • exists

        boolean exists()
        Determines whether the store actually exists
        Returns:
        true => it does exist
      • getBasePath

        java.lang.String getBasePath()
        Gets the base path of the store
        Returns:
        base path
      • isSecure

        boolean isSecure()
        Returns true if this store is considered secure - i.e. on the app-server classpath. Scripts in secure stores can be run under the identity of a declared user (via the runas attribute) rather than the authenticated user.
        Returns:
        true if this store is considered secure
      • getDocumentPaths

        java.lang.String[] getDocumentPaths​(java.lang.String path,
                                            boolean includeSubPaths,
                                            java.lang.String documentPattern)
                                     throws java.io.IOException
        Gets the paths of given document pattern within given path/sub-paths in this store
        Parameters:
        path - start path
        includeSubPaths - if true, include sub-paths
        documentPattern - document name, allows wildcards, eg. *.ftl or my*.ftl
        Returns:
        array of document paths
        Throws:
        java.io.IOException
      • getDocumentPaths

        java.lang.String[] getDocumentPaths​(java.lang.String path,
                                            java.lang.String filePathPattern)
                                     throws java.io.IOException
        Gets the paths matching a given file path pattern in this store.
        Parameters:
        path - start path
        filePathPattern - file path pattern string, allows wildcards, eg. *.ftl or my*.ftl or *\/a\/*.xml
        Returns:
        array of document paths
        Throws:
        java.io.IOException
      • getDescriptionDocumentPaths

        java.lang.String[] getDescriptionDocumentPaths()
                                                throws java.io.IOException
        Gets the paths of all Web Script description documents in this store
        Returns:
        array of description document paths
        Throws:
        java.io.IOException
      • getScriptDocumentPaths

        java.lang.String[] getScriptDocumentPaths​(WebScript script)
                                           throws java.io.IOException
        Gets the paths of all implementation files for a given Web Script
        Parameters:
        script - web script
        Returns:
        array of implementation document paths
        Throws:
        java.io.IOException
      • getAllDocumentPaths

        java.lang.String[] getAllDocumentPaths()
        Gets the paths of all documents in this store
        Returns:
        array of all document paths
      • lastModified

        long lastModified​(java.lang.String documentPath)
                   throws java.io.IOException
        Gets the last modified timestamp for the document.
        Parameters:
        documentPath - document path to an existing document
        Returns:
        last modified timestamp
        Throws:
        java.io.IOException - if the document does not exist in the store
      • hasDocument

        boolean hasDocument​(java.lang.String documentPath)
                     throws java.io.IOException
        Determines if the document exists.
        Parameters:
        documentPath - document path
        Returns:
        true => exists, false => does not exist
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • getDocument

        java.io.InputStream getDocument​(java.lang.String documentPath)
                                 throws java.io.IOException
        Gets a document. Note a raw InputStream to the content is returned and must be closed by the accessing method.
        Parameters:
        documentPath - document path
        Returns:
        input stream onto document
        Throws:
        java.io.IOException - if the document does not exist in the store
      • createDocument

        void createDocument​(java.lang.String documentPath,
                            java.lang.String content)
                     throws java.io.IOException
        Creates a document.
        Parameters:
        documentPath - document path
        content - content of the document to write
        Throws:
        java.io.IOException - if the document already exists or the create fails
      • createDocuments

        void createDocuments​(java.util.List<org.springframework.extensions.surf.util.Pair<java.lang.String,​org.dom4j.Document>> paths)
                      throws java.io.IOException
        Creates multiple XML documents at the specified paths.
        Parameters:
        paths - list of path, document pairs
        Throws:
        java.io.IOException - if a document already exists or a create fails
      • updateDocument

        void updateDocument​(java.lang.String documentPath,
                            java.lang.String content)
                     throws java.io.IOException
        Updates an existing document.
        Parameters:
        documentPath - document path
        content - content to update the document with
        Throws:
        java.io.IOException - if the document does not exist or the update fails
      • removeDocument

        boolean removeDocument​(java.lang.String documentPath)
                        throws java.io.IOException
        Removes an existing document.
        Parameters:
        documentPath - document path
        Returns:
        whether the operation succeeded
        Throws:
        java.io.IOException - if the document does not exist or the remove fails
      • getTemplateLoader

        freemarker.cache.TemplateLoader getTemplateLoader()
        Gets the template loader for this store
        Returns:
        template loader
      • getScriptLoader

        ScriptLoader getScriptLoader()
        Gets the script loader for this store
        Returns:
        script loader
      • isReadOnly

        boolean isReadOnly()
        Indicates whether or not this store can be written to.
        Returns:
        true If the store cannot be written to and false otherwise.