// Path: spring-soy-view/src/main/java/pl/matisoft/soy/compile/EmptyTofuCompiler.java
// public class EmptyTofuCompiler implements TofuCompiler {
// 
//     @Override
//     public SoyTofu compile(final Collection<URL> urls) {
//         return null;
//     }
// 
//     @Override
//     public Optional<String> compileToJsSrc(final URL template, @Nullable SoyMsgBundle soyMsgBundle) {
//         return Optional.absent();
//     }
// 
//     @Override
//     public Collection<String> compileToJsSrc(Collection<URL> templates, @Nullable SoyMsgBundle soyMsgBundle) {
//         return Lists.newArrayList();
//     }
// 
// }
// 
// Path: spring-soy-view/src/main/java/pl/matisoft/soy/compile/TofuCompiler.java
// public interface TofuCompiler {
// 
//     /**
//      * Obtains a binary compiled version based on a set of input urls
//      * @param files - urls
//      * @return soy tofu
//      * @throws java.io.IOException - i/o error
//      */
//     SoyTofu compile(Collection<URL> files) throws IOException;
// 
//     /**
//      * Obtains a compiled template to JavaScript as a String based on a template url
//      * @param template - template
//      * @param soyMsgBundle - bundle
//      * @return js
//      */
//     Optional<String> compileToJsSrc(URL template, @Nullable SoyMsgBundle soyMsgBundle);
// 
//     /**
//      * Obtains a compiled template to JavaScript as a String based on a collection of template urls
//      * @param templates - templates
//      * @param soyMsgBundle - bundle
//      * @return js
//      */
//     Collection<String> compileToJsSrc(Collection<URL> templates, @Nullable SoyMsgBundle soyMsgBundle);
// 
// }
// 
// Path: spring-soy-view/src/main/java/pl/matisoft/soy/config/SoyViewConfigDefaults.java
// public class SoyViewConfigDefaults {
// 
//     /**
//      * Default directory for templates
//      */
//     public final static String DEFAULT_TEMPLATE_FILES_PATH = "/WEB-INF/templates";
// 
//     /**
//      * Default encoding
//      */
//     public final static String DEFAULT_ENCODING = "utf-8";
// 
//     public final static boolean DEFAULT_HOT_RELOAD_MODE = false;
// 
//     /**
//      * Default soy files extension
//      */
//     public final static String DEFAULT_FILES_EXTENSION = "soy";
// 
//     /**
//      * Whether templates should be precompiled on the startup of application
//      */
//     public final static boolean DEFAULT_PRECOMPILE_TEMPLATES = false;
// 
//     /**
//      * Special soy prefix to indicate that this template if meant to be rendered by soy template renderer
//      */
//     public final static String DEFAULT_SOY_PREFIX = "soy:";
// 
//     public static final String DEF_MESSAGES_PATH = "messages";
// 
// }
// 
// Path: spring-soy-view/src/main/java/pl/matisoft/soy/template/EmptyTemplateFilesResolver.java
// public class EmptyTemplateFilesResolver implements TemplateFilesResolver {
// 
//     @Override
//     public Collection<URL> resolve() throws IOException {
//         return Collections.emptyList();
//     }
// 
//     @Override
//     public Optional<URL> resolve(final String templateName) throws IOException {
//         return Optional.absent();
//     }
// 
// }
// 
// Path: spring-soy-view/src/main/java/pl/matisoft/soy/template/TemplateFilesResolver.java
// public interface TemplateFilesResolver {
// 
//     /**
//      * Iterate over all files and provide urls of files pointing to soy template files
//      * @return urls
//      * @throws java.io.IOException - i/o error
//      */
//     Collection<URL> resolve() throws IOException;
// 
//     /**
//      * Iterate over all files and provide a matching url for a template passed in as a parameter
//      * @param templateName - name of template
//      * @return urls
//      * @throws java.io.IOException - i/o error
//      */
//     Optional<URL> resolve(String templateName) throws IOException;
// 
// }


import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.template.soy.tofu.SoyTofu;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import pl.matisoft.soy.compile.EmptyTofuCompiler;
import pl.matisoft.soy.compile.TofuCompiler;
import pl.matisoft.soy.config.SoyViewConfigDefaults;
import pl.matisoft.soy.template.EmptyTemplateFilesResolver;
import pl.matisoft.soy.template.TemplateFilesResolver;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
            this.compiledTemplates = Optional.fromNullable(compileTemplates());
        }
    }

    private SoyTofu compileTemplates() throws IOException {
        Preconditions.checkNotNull(templatesFileResolver, "templatesRenderer cannot be null!");
        Preconditions.checkNotNull(tofuCompiler, "tofuCompiler cannot be null!");

        final Collection<URL> templateFiles = templatesFileResolver.resolve();
        if (templateFiles != null && templateFiles.size() > 0) {
            logger.debug("Compiling templates, no:{}", templateFiles.size());

            return tofuCompiler.compile(templateFiles);
        }

        throw new IOException("0 template files have been found, check your templateFilesResolver!");
    }

    public void setHotReloadMode(final boolean hotReloadMode) {
        this.hotReloadMode = hotReloadMode;
    }

    public boolean isHotReloadMode() {
        return hotReloadMode;
    }

    public boolean isHotReloadModeOff() {
        return !hotReloadMode;
    }

// Path: spring-soy-view/src/main/java/pl/matisoft/soy/compile/EmptyTofuCompiler.java
// public class EmptyTofuCompiler implements TofuCompiler {
// 
//     @Override
//     public SoyTofu compile(final Collection<URL> urls) {
//         return null;
//     }
// 
//     @Override
//     public Optional<String> compileToJsSrc(final URL template, @Nullable SoyMsgBundle soyMsgBundle) {
//         return Optional.absent();
//     }
// 
//     @Override
//     public Collection<String> compileToJsSrc(Collection<URL> templates, @Nullable SoyMsgBundle soyMsgBundle) {
//         return Lists.newArrayList();
//     }
// 
// }
// 
// Path: spring-soy-view/src/main/java/pl/matisoft/soy/compile/TofuCompiler.java
// public interface TofuCompiler {
// 
//     /**
//      * Obtains a binary compiled version based on a set of input urls
//      * @param files - urls
//      * @return soy tofu
//      * @throws java.io.IOException - i/o error
//      */
//     SoyTofu compile(Collection<URL> files) throws IOException;
// 
//     /**
//      * Obtains a compiled template to JavaScript as a String based on a template url
//      * @param template - template
//      * @param soyMsgBundle - bundle
//      * @return js
//      */
//     Optional<String> compileToJsSrc(URL template, @Nullable SoyMsgBundle soyMsgBundle);
// 
//     /**
//      * Obtains a compiled template to JavaScript as a String based on a collection of template urls
//      * @param templates - templates
//      * @param soyMsgBundle - bundle
//      * @return js
//      */
//     Collection<String> compileToJsSrc(Collection<URL> templates, @Nullable SoyMsgBundle soyMsgBundle);
// 
// }
// 
// Path: spring-soy-view/src/main/java/pl/matisoft/soy/config/SoyViewConfigDefaults.java
// public class SoyViewConfigDefaults {
// 
//     /**
//      * Default directory for templates
//      */
//     public final static String DEFAULT_TEMPLATE_FILES_PATH = "/WEB-INF/templates";
// 
//     /**
//      * Default encoding
//      */
//     public final static String DEFAULT_ENCODING = "utf-8";
// 
//     public final static boolean DEFAULT_HOT_RELOAD_MODE = false;
// 
//     /**
//      * Default soy files extension
//      */
//     public final static String DEFAULT_FILES_EXTENSION = "soy";
// 
//     /**
//      * Whether templates should be precompiled on the startup of application
//      */
//     public final static boolean DEFAULT_PRECOMPILE_TEMPLATES = false;
// 
//     /**
//      * Special soy prefix to indicate that this template if meant to be rendered by soy template renderer
//      */
//     public final static String DEFAULT_SOY_PREFIX = "soy:";
// 
//     public static final String DEF_MESSAGES_PATH = "messages";
// 
// }
// 
// Path: spring-soy-view/src/main/java/pl/matisoft/soy/template/EmptyTemplateFilesResolver.java
// public class EmptyTemplateFilesResolver implements TemplateFilesResolver {
// 
//     @Override
//     public Collection<URL> resolve() throws IOException {
//         return Collections.emptyList();
//     }
// 
//     @Override
//     public Optional<URL> resolve(final String templateName) throws IOException {
//         return Optional.absent();
//     }
// 
// }
// 
// Path: spring-soy-view/src/main/java/pl/matisoft/soy/template/TemplateFilesResolver.java
// public interface TemplateFilesResolver {
// 
//     /**
//      * Iterate over all files and provide urls of files pointing to soy template files
//      * @return urls
//      * @throws java.io.IOException - i/o error
//      */
//     Collection<URL> resolve() throws IOException;
// 
//     /**
//      * Iterate over all files and provide a matching url for a template passed in as a parameter
//      * @param templateName - name of template
//      * @return urls
//      * @throws java.io.IOException - i/o error
//      */
//     Optional<URL> resolve(String templateName) throws IOException;
// 
// }


// Path: spring-soy-view/src/main/java/pl/matisoft/soy/holder/DefaultCompiledTemplatesHolder.java
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.template.soy.tofu.SoyTofu;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import pl.matisoft.soy.compile.EmptyTofuCompiler;
import pl.matisoft.soy.compile.TofuCompiler;
import pl.matisoft.soy.config.SoyViewConfigDefaults;
import pl.matisoft.soy.template.EmptyTemplateFilesResolver;
import pl.matisoft.soy.template.TemplateFilesResolver;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;

            this.compiledTemplates = Optional.fromNullable(compileTemplates());
        }
    }

    private SoyTofu compileTemplates() throws IOException {
        Preconditions.checkNotNull(templatesFileResolver, "templatesRenderer cannot be null!");
        Preconditions.checkNotNull(tofuCompiler, "tofuCompiler cannot be null!");

        final Collection<URL> templateFiles = templatesFileResolver.resolve();
        if (templateFiles != null && templateFiles.size() > 0) {
            logger.debug("Compiling templates, no:{}", templateFiles.size());

            return tofuCompiler.compile(templateFiles);
        }

        throw new IOException("0 template files have been found, check your templateFilesResolver!");
    }

    public void setHotReloadMode(final boolean hotReloadMode) {
        this.hotReloadMode = hotReloadMode;
    }

    public boolean isHotReloadMode() {
        return hotReloadMode;
    }

    public boolean isHotReloadModeOff() {
        return !hotReloadMode;
    }

    public void setTofuCompiler(TofuCompiler tofuCompiler) {