com.opensymphony.xwork2.util.fs

## Class DefaultFileManager

- java.lang.Object
- - com.opensymphony.xwork2.util.fs.DefaultFileManager

- All Implemented Interfaces:
    FileManager
  Direct Known Subclasses:
    JBossFileManager

      public class DefaultFileManager
      extends Object
      implements FileManager

  Default implementation of `FileManager`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static Map<String,Revision>` | `files`
    `protected boolean` | `reloadingConfigs`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultFileManager()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `fileNeedsReloading(String fileName)` Checks if given file changed and must be reloaded
    `boolean` | `fileNeedsReloading(URL fileUrl)` Checks if file represented by provided URL changed and must be reloaded
    `Collection<? extends URL>` | `getAllPhysicalUrls(URL url)`
    `boolean` | `internal()` User's implementation should return false as then it will be taken in first place
    `protected boolean` | `isJarURL(URL fileUrl)` Check if given URL is matching Jar pattern for different servers
    `InputStream` | `loadFile(URL fileUrl)` Loads opens the named file and returns the InputStream
    `void` | `monitorFile(URL fileUrl)` Adds file to list of monitored files
    `URL` | `normalizeToFileProtocol(URL url)` Convert URLs to URLs with "file" protocol
    `void` | `setReloadingConfigs(boolean reloadingConfigs)` Enables configs reloading when config file changed
    `boolean` | `support()` Indicate if given implementation supports current OS File System

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### files

          protected static final Map<String,Revision> files

    - #### reloadingConfigs

          protected boolean reloadingConfigs

  - ### Constructor Detail

    - #### DefaultFileManager

          public DefaultFileManager()

  - ### Method Detail

    - #### setReloadingConfigs

          public void setReloadingConfigs(boolean reloadingConfigs)

      Description copied from interface: `FileManager`
      Enables configs reloading when config file changed
      Specified by:
        `setReloadingConfigs` in interface `FileManager`
      Parameters:
        `reloadingConfigs` - `StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD`

    - #### fileNeedsReloading

          public boolean fileNeedsReloading(URL fileUrl)

      Description copied from interface: `FileManager`
      Checks if file represented by provided URL changed and must be reloaded
      Specified by:
        `fileNeedsReloading` in interface `FileManager`
      Parameters:
        `fileUrl` - url to a file
      Returns:
        true if file exists and should be reloaded, if url is null return false

    - #### fileNeedsReloading

          public boolean fileNeedsReloading(String fileName)

      Description copied from interface: `FileManager`
      Checks if given file changed and must be reloaded
      Specified by:
        `fileNeedsReloading` in interface `FileManager`
      Parameters:
        `fileName` - to check
      Returns:
        true if file changed

    - #### loadFile

          public InputStream loadFile(URL fileUrl)

      Description copied from interface: `FileManager`
      Loads opens the named file and returns the InputStream
      Specified by:
        `loadFile` in interface `FileManager`
      Parameters:
        `fileUrl` - - the URL of the file to open
      Returns:
        an InputStream of the file contents or null

    - #### monitorFile

          public void monitorFile(URL fileUrl)

      Description copied from interface: `FileManager`
      Adds file to list of monitored files
      Specified by:
        `monitorFile` in interface `FileManager`
      Parameters:
        `fileUrl` - `URL` to file to be monitored

    - #### isJarURL

          protected boolean isJarURL(URL fileUrl)

      Check if given URL is matching Jar pattern for different servers
      Parameters:
        `fileUrl` - jar file URL
      Returns:
        if given URL is matching Jar pattern for different servers

    - #### normalizeToFileProtocol

          public URL normalizeToFileProtocol(URL url)

      Description copied from interface: `FileManager`
      Convert URLs to URLs with "file" protocol
      Specified by:
        `normalizeToFileProtocol` in interface `FileManager`
      Parameters:
        `url` - URL to convert to a jar url
      Returns:
        a URL to a file, or null if the URL external form cannot be parsed

    - #### support

          public boolean support()

      Description copied from interface: `FileManager`
      Indicate if given implementation supports current OS File System
      Specified by:
        `support` in interface `FileManager`
      Returns:
        true if supports current OS File System

    - #### internal

          public boolean internal()

      Description copied from interface: `FileManager`
      User's implementation should return false as then it will be taken in first place
      Specified by:
        `internal` in interface `FileManager`
      Returns:
        true if it's a framework provided implementation

    - #### getAllPhysicalUrls

          public Collection<? extends URL> getAllPhysicalUrls(URL url)
                                                       throws IOException

      Specified by:
        `getAllPhysicalUrls` in interface `FileManager`
      Throws:
        `IOException`

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.