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: NamespacesEntryProvider.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: import java.util.LinkedHashMap;
14:
15: public class NamespacesEntryProvider implements EntryProvider {
16: private Calendar mCalendar = null;
17:
18: public NamespacesEntryProvider() {
19: mCalendar = Calendar.getInstance();
20: mCalendar.setTimeZone(RifeConfig.Tools.getDefaultTimeZone());
21: mCalendar.set(2005, Calendar.JANUARY, 1, 0, 0, 0);
22: mCalendar.set(Calendar.AM_PM, Calendar.AM);
23: }
24:
25: public Feed getFeedDescriptor(ElementSupport element) {
26: Feed feed = new Feed();
27: feed.title("feed_title_namespace").author(
28: "feed_author_namespace").copyright(
29: "feed_copyright_namespace").description(
30: "feed_description_namespace").language(
31: "feed_language_namespace").link("feed_link_namespace")
32: .publishedDate(mCalendar.getTime()).namespaces(
33: new LinkedHashMap<String, String>() {
34: {
35: put("doap",
36: "http://usefulinc.com/ns/doap#");
37: put("foaf",
38: "http://xmlns.com/foaf/0.1/");
39: }
40: });
41:
42: return feed;
43: }
44:
45: public void provideEntries(ElementSupport element,
46: EntryProcessor processor) {
47: for (int i = 0; i < 2; i++) {
48: mCalendar.set(Calendar.HOUR, i + 1);
49: Entry entry = new Entry();
50: entry.author("entry_author_namespace" + (i + 1)).content(
51: "<doap:Project>entry_content_namespace" + (i + 1)
52: + "</doap:Project>").link(
53: "entry_link_namespace" + (i + 1)).publishedDate(
54: mCalendar.getTime()).title(
55: "entry_title_namespace" + (i + 1)).type(
56: "application/rdf+xml").escaped(false);
57:
58: processor.setEntry(entry);
59: }
60: }
61: }
|