01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: SimpleEntryProvider.java 3714 2007-04-08 02:57:38Z gbevin $
07: */
08: package com.uwyn.rife.feed;
09:
10: import com.uwyn.rife.config.RifeConfig;
11: import com.uwyn.rife.engine.ElementSupport;
12: import java.util.Calendar;
13:
14: public class SimpleEntryProvider implements EntryProvider {
15: private Calendar mCalendar = null;
16:
17: public SimpleEntryProvider() {
18: mCalendar = Calendar.getInstance();
19: mCalendar.setTimeZone(RifeConfig.Tools.getDefaultTimeZone());
20: mCalendar.set(2005, Calendar.JANUARY, 1, 0, 0, 0);
21: mCalendar.set(Calendar.AM_PM, Calendar.AM);
22: }
23:
24: public Feed getFeedDescriptor(ElementSupport element) {
25: Feed feed = new Feed();
26: feed.title("feed_title").author("feed_author").copyright(
27: "feed_copyright").description("feed_description")
28: .language("feed_language").link("feed_link")
29: .publishedDate(mCalendar.getTime());
30:
31: return feed;
32: }
33:
34: public void provideEntries(ElementSupport element,
35: EntryProcessor processor) {
36: for (int i = 0; i < 2; i++) {
37: mCalendar.set(Calendar.HOUR, i + 1);
38: Entry entry = new Entry();
39: entry.author("entry_author" + (i + 1)).content(
40: "entry_content" + (i + 1)).link(
41: "entry_link" + (i + 1)).publishedDate(
42: mCalendar.getTime()).title("entry_title" + (i + 1));
43:
44: processor.setEntry(entry);
45: }
46: }
47: }
|