Class ConfigurationSource


  • public class ConfigurationSource
    extends Object
    Represents the source for the logging configuration.
    • Constructor Detail

      • ConfigurationSource

        public ConfigurationSource​(InputStream stream,
                                   File file)
        Constructs a new ConfigurationSource with the specified input stream that originated from the specified file.
        Parameters:
        stream - the input stream
        file - the file where the input stream originated
      • ConfigurationSource

        public ConfigurationSource​(InputStream stream,
                                   URL url)
        Constructs a new ConfigurationSource with the specified input stream that originated from the specified url.
        Parameters:
        stream - the input stream
        url - the URL where the input stream originated
      • ConfigurationSource

        public ConfigurationSource​(InputStream stream,
                                   URL url,
                                   long lastModified)
        Constructs a new ConfigurationSource with the specified input stream that originated from the specified url.
        Parameters:
        stream - the input stream
        url - the URL where the input stream originated
        lastModified - when the source was last modified.
      • ConfigurationSource

        public ConfigurationSource​(InputStream stream)
                            throws IOException
        Constructs a new ConfigurationSource with the specified input stream. Since the stream is the only source of data, this constructor makes a copy of the stream contents.
        Parameters:
        stream - the input stream
        Throws:
        IOException - if an exception occurred reading from the specified stream
      • ConfigurationSource

        public ConfigurationSource​(Source source,
                                   byte[] data,
                                   long lastModified)
                            throws IOException
        Throws:
        IOException
    • Method Detail

      • getFile

        public File getFile()
        Returns the file configuration source, or null if this configuration source is based on an URL or has neither a file nor an URL.
        Returns:
        the configuration source file, or null
      • getURL

        public URL getURL()
        Returns the configuration source URL, or null if this configuration source is based on a file or has neither a file nor an URL.
        Returns:
        the configuration source URL, or null
      • setSource

        public void setSource​(Source source)
      • setData

        public void setData​(byte[] data)
      • setModifiedMillis

        public void setModifiedMillis​(long modifiedMillis)
      • getURI

        public URI getURI()
        Returns a URI representing the configuration resource or null if it cannot be determined.
        Returns:
        The URI.
      • getLastModified

        public long getLastModified()
        Returns the time the resource was last modified or 0 if it is not available.
        Returns:
        the last modified time of the resource.
      • getLocation

        public String getLocation()
        Returns a string describing the configuration source file or URL, or null if this configuration source has neither a file nor an URL.
        Returns:
        a string describing the configuration source file or URL, or null
      • getInputStream

        public InputStream getInputStream()
        Returns the input stream that this configuration source was constructed with.
        Returns:
        the input stream that this configuration source was constructed with.
      • resetInputStream

        public ConfigurationSource resetInputStream()
                                             throws IOException
        Returns a new ConfigurationSource whose input stream is reset to the beginning.
        Returns:
        a new ConfigurationSource
        Throws:
        IOException - if a problem occurred while opening the new input stream
      • fromUri

        public static ConfigurationSource fromUri​(URI configLocation)
        Loads the configuration from a URI.
        Parameters:
        configLocation - A URI representing the location of the configuration.
        Returns:
        The ConfigurationSource for the configuration.
      • fromResource

        public static ConfigurationSource fromResource​(String resource,
                                                       ClassLoader loader)
        Retrieves the configuration via the ClassLoader.
        Parameters:
        resource - The resource to load.
        loader - The default ClassLoader to use.
        Returns:
        The ConfigurationSource for the configuration.