+
+ templateContextFactory = new TemplateContextFactory();
+ templateContextFactory.addAccessor(Object.class, new ReflectionAccessor());
+ templateContextFactory.addAccessor(Collection.class, new CollectionAccessor());
+ templateContextFactory.addAccessor(Sone.class, new SoneAccessor(getCore()));
+ templateContextFactory.addAccessor(Post.class, new PostAccessor(getCore()));
+ templateContextFactory.addAccessor(Reply.class, new ReplyAccessor(getCore()));
+ templateContextFactory.addAccessor(Identity.class, new IdentityAccessor(getCore()));
+ templateContextFactory.addAccessor(Trust.class, new TrustAccessor());
+ templateContextFactory.addAccessor(HTTPRequest.class, new HttpRequestAccessor());
+ templateContextFactory.addFilter("date", new DateFilter());
+ templateContextFactory.addFilter("html", new HtmlFilter());
+ templateContextFactory.addFilter("replace", new ReplaceFilter());
+ templateContextFactory.addFilter("store", new StoreFilter());
+ templateContextFactory.addFilter("l10n", new L10nFilter(getL10n()));
+ templateContextFactory.addFilter("substring", new SubstringFilter());
+ templateContextFactory.addFilter("xml", new XmlFilter());
+ templateContextFactory.addFilter("change", new RequestChangeFilter());
+ templateContextFactory.addFilter("match", new MatchFilter());
+ templateContextFactory.addFilter("css", new CssClassNameFilter());
+ templateContextFactory.addFilter("js", new JavascriptFilter());
+ templateContextFactory.addFilter("parse", new ParserFilter(getCore(), templateContextFactory));
+ templateContextFactory.addFilter("unknown", new UnknownDateFilter(getL10n(), "View.Sone.Text.UnknownDate"));
+ templateContextFactory.addFilter("format", new FormatFilter());
+ templateContextFactory.addFilter("sort", new CollectionSortFilter());
+ templateContextFactory.addFilter("replyGroup", new ReplyGroupFilter());
+ templateContextFactory.addFilter("in", new ContainsFilter());
+ templateContextFactory.addProvider(Provider.TEMPLATE_CONTEXT_PROVIDER);
+ templateContextFactory.addProvider(new ClassPathTemplateProvider());
+ templateContextFactory.addTemplateObject("formPassword", formPassword);
+
+ /* create notifications. */
+ Template newSoneNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newSoneNotification.html"));
+ newSoneNotification = new ListNotification<Sone>("new-sone-notification", "sones", newSoneNotificationTemplate, false);
+
+ Template newPostNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newPostNotification.html"));
+ newPostNotification = new ListNotification<Post>("new-post-notification", "posts", newPostNotificationTemplate, false);
+
+ Template newReplyNotificationTemplate = TemplateParser.parse(createReader("/templates/notify/newReplyNotification.html"));
+ newReplyNotification = new ListNotification<Reply>("new-replies-notification", "replies", newReplyNotificationTemplate, false);
+
+ Template rescuingSonesTemplate = TemplateParser.parse(createReader("/templates/notify/rescuingSonesNotification.html"));
+ rescuingSonesNotification = new ListNotification<Sone>("sones-being-rescued-notification", "sones", rescuingSonesTemplate);
+
+ Template sonesRescuedTemplate = TemplateParser.parse(createReader("/templates/notify/sonesRescuedNotification.html"));
+ sonesRescuedNotification = new ListNotification<Sone>("sones-rescued-notification", "sones", sonesRescuedTemplate);
+
+ Template lockedSonesTemplate = TemplateParser.parse(createReader("/templates/notify/lockedSonesNotification.html"));
+ lockedSonesNotification = new ListNotification<Sone>("sones-locked-notification", "sones", lockedSonesTemplate);
+
+ Template newVersionTemplate = TemplateParser.parse(createReader("/templates/notify/newVersionNotification.html"));
+ newVersionNotification = new TemplateNotification("new-version-notification", newVersionTemplate);