Interface SSIExternalResolver

  • All Known Implementing Classes:
    SSIServletExternalResolver

    public interface SSIExternalResolver
    Interface used by SSIMediator to talk to the 'outside world' ( usually a servlet ).
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addVariableNames​(java.util.Collection<java.lang.String> variableNames)
      Adds any external variables to the variableNames collection.
      java.util.Date getCurrentDate()
      Returns the current date.
      long getFileLastModified​(java.lang.String path, boolean virtual)
      Returns the last modified timestamp of the specified file.
      long getFileSize​(java.lang.String path, boolean virtual)
      Returns the size of the specified file in bytes.
      java.lang.String getFileText​(java.lang.String path, boolean virtual)
      Returns the text content of the specified file.
      java.lang.String getVariableValue​(java.lang.String name)
      Returns the value of the named variable, or null if not found.
      void log​(java.lang.String message, java.lang.Throwable throwable)
      Logs a message, optionally with an associated throwable.
      void setVariableValue​(java.lang.String name, java.lang.String value)
      Set the named variable to the specified value.
    • Method Detail

      • addVariableNames

        void addVariableNames​(java.util.Collection<java.lang.String> variableNames)
        Adds any external variables to the variableNames collection.
        Parameters:
        variableNames - the collection to add to
      • getVariableValue

        java.lang.String getVariableValue​(java.lang.String name)
        Returns the value of the named variable, or null if not found.
        Parameters:
        name - of the variable
        Returns:
        the variable value
      • setVariableValue

        void setVariableValue​(java.lang.String name,
                              java.lang.String value)
        Set the named variable to the specified value. If value is null, then the variable will be removed ( ie. a call to getVariableValue will return null )
        Parameters:
        name - of the variable
        value - of the variable
      • getCurrentDate

        java.util.Date getCurrentDate()
        Returns the current date. This is useful for putting the SSI stuff in a regression test. Since you can make the current date a constant, it makes testing easier since the output won't change.
        Returns:
        the data
      • getFileSize

        long getFileSize​(java.lang.String path,
                         boolean virtual)
                  throws java.io.IOException
        Returns the size of the specified file in bytes.
        Parameters:
        path - the file path
        virtual - true for virtual (webapp-relative) path, false for physical path
        Returns:
        the file size in bytes
        Throws:
        java.io.IOException - if the file cannot be accessed
      • getFileLastModified

        long getFileLastModified​(java.lang.String path,
                                 boolean virtual)
                          throws java.io.IOException
        Returns the last modified timestamp of the specified file.
        Parameters:
        path - the file path
        virtual - true for virtual (webapp-relative) path, false for physical path
        Returns:
        the last modified time in milliseconds
        Throws:
        java.io.IOException - if the file cannot be accessed
      • getFileText

        java.lang.String getFileText​(java.lang.String path,
                                     boolean virtual)
                              throws java.io.IOException
        Returns the text content of the specified file.
        Parameters:
        path - the file path
        virtual - true for virtual (webapp-relative) path, false for physical path
        Returns:
        the file content as a string
        Throws:
        java.io.IOException - if the file cannot be read
      • log

        void log​(java.lang.String message,
                 java.lang.Throwable throwable)
        Logs a message, optionally with an associated throwable.
        Parameters:
        message - the log message
        throwable - the associated throwable, or null