Package com.astamuse.asta4d.template.TemplateResolver

Examples of com.astamuse.asta4d.template.TemplateResolver.TemplateInfo


            Template t = cachedTemplateMap.get(cacheKey);
            if (t != null) {
                return t;
            }
            logger.info("Initializing template " + path);
            TemplateInfo info = searchResource("/", LocalizeUtil.getCandidatePaths(path, locale));
            InputStream input = info.getInput();
            if (input == null) {
                // TODO mayby we should return a null? So that caller can
                // identify the situation of template load error or template not
                // found.
                throw new TemplateException(String.format("Template %s not found.", path));
            }
            t = new Template(info.getPath(), input);
            cachedTemplateMap.put(cacheKey, t);
            return t;
        } catch (Exception e) {
            throw new TemplateException(path + " resolve error", e);
        }
View Full Code Here


    protected TemplateInfo createTemplateInfo(String path, InputStream input) {
        if (input == null) {
            return null;
        }
        return new TemplateInfo(path, input);
    }
View Full Code Here

            Template t = cachedTemplateMap.get(cacheKey);
            if (t != null) {
                return t;
            }
            logger.info("Initializing template " + path);
            TemplateInfo info = searchResource("/", LocalizeUtil.getCandidatePaths(path, locale));
            InputStream input = info.getInput();
            if (input == null) {
                // TODO mayby we should return a null? So that caller can
                // identify the situation of template load error or template not
                // found.
                throw new TemplateException(String.format("Template %s not found.", path));
            }
            t = new Template(info.getPath(), input);
            cachedTemplateMap.put(cacheKey, t);
            return t;
        } catch (Exception e) {
            throw new TemplateException(path + " resolve error", e);
        }
View Full Code Here

    protected TemplateInfo createTemplateInfo(String path, InputStream input) {
        if (input == null) {
            return null;
        }
        return new TemplateInfo(path, input);
    }
View Full Code Here

                } else {
                    return t;
                }
            }
            logger.info("Initializing template " + path);
            TemplateInfo info = searchResource("/", LocalizeUtil.getCandidatePaths(path, locale));
            if (info == null) {
                cachedTemplateMap.put(cacheKey, getNotFoundHolder());
                return null;
            }
            InputStream input = info.getInput();
            if (input == null) {
                cachedTemplateMap.put(cacheKey, getNotFoundHolder());
                return null;
            }
            t = new Template(info.getPath(), input);
            cachedTemplateMap.put(cacheKey, t);
            return t;
        } catch (Exception e) {
            throw new TemplateException(path + " resolve error", e);
        }
View Full Code Here

    protected TemplateInfo createTemplateInfo(String path, InputStream input) {
        if (input == null) {
            return null;
        }
        return new TemplateInfo(path, input);
    }
View Full Code Here

                } else {
                    return t;
                }
            }
            logger.info("Initializing template " + path);
            TemplateInfo info = searchResource("/", LocalizeUtil.getCandidatePaths(path, locale));
            if (info == null) {
                cachedTemplateMap.put(cacheKey, getNotFoundHolder());
                return null;
            }
            InputStream input = info.getInput();
            if (input == null) {
                cachedTemplateMap.put(cacheKey, getNotFoundHolder());
                return null;
            }
            try {
                t = new Template(info.getPath(), input);
            } finally {
                // we have to close the input stream to avoid file lock
                try {
                    input.close();
                } catch (Exception ex) {
                    logger.error("Error occured when close input stream of " + info.getPath(), ex);
                }
            }
            cachedTemplateMap.put(cacheKey, t);
            return t;
        } catch (Exception e) {
View Full Code Here

    protected TemplateInfo createTemplateInfo(String path, InputStream input) {
        if (input == null) {
            return null;
        }
        return new TemplateInfo(path, input);
    }
View Full Code Here

TOP

Related Classes of com.astamuse.asta4d.template.TemplateResolver.TemplateInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.