Class EnvironmentProcessor


  • public class EnvironmentProcessor
    extends Object
    This class does the work of taking a raw configuration file, possibly with environment elements, snooping the lines for the environment tags, and resolving them It will create the environment for a single document.

    Usage

    1. Instantiate this class
    2. Invoke resolveEnvironment(InputStream) on your configuration file
    3. retrieve the processed file using getRootDocument()
    4. If you need the environment, it is in getEnv()
    • Constructor Detail

      • EnvironmentProcessor

        public EnvironmentProcessor()
    • Method Detail

      • isStartEnv

        protected boolean isStartEnv​(String l)
        Does the trimmed line start and environment entry?
        Parameters:
        l -
        Returns:
      • isEndEnv

        protected boolean isEndEnv​(String l)
        Does the trimmed line end with an environment end tag?
        Parameters:
        l -
        Returns:
      • getRootDocument

        public Document getRootDocument()
        The final document when all is said and done.
        Returns:
      • setRootDocument

        public void setRootDocument​(Document rootDocument)
      • resolveEnvironment

        public void resolveEnvironment​(InputStream inputStream)
                                throws Throwable
        This starts the environment resolution on a file. It will read through the lines for environment tags, collect them then process them. You do not call this on a file with only environment elements in it.
        Parameters:
        inputStream -
        Throws:
        Throwable
      • processEnvDocument

        protected void processEnvDocument​(InputStream inputStream,
                                          EnvStack envStack)
                                   throws Throwable
        Process a single env document from any source. At the end of this, every envionment element will have been processed and added to the current environment getEnv().
        Parameters:
        inputStream -
        Throws:
        Throwable