• R/O
  • SSH
  • HTTPS

manjyurss: 提交


Commit MetaInfo

修訂7 (tree)
時間2012-11-13 22:11:12
作者iga

Log Message

move package.

Change Summary

差異

--- manjyu-rss/trunk/src/manjyu/rss/ManjyuRssSerializer.java (revision 6)
+++ manjyu-rss/trunk/src/manjyu/rss/ManjyuRssSerializer.java (nonexistent)
@@ -1,273 +0,0 @@
1-/*******************************************************************************
2- * Manjyu RSS Library
3- * Copyright (C) 2012 Toshiki IGA
4- *
5- * This library is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * any later version.
9- *
10- * This program is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * GNU Lesser General Public License for more details.
14- *
15- * You should have received a copy of the GNU Lesser General Public License
16- * along with this library. If not, see <http://www.gnu.org/licenses/>.
17- *******************************************************************************/
18-/*******************************************************************************
19- * Copyright (c) 2012 Toshiki IGA and others.
20- * All rights reserved. This program and the accompanying materials
21- * are made available under the terms of the Eclipse Public License v1.0
22- * which accompanies this distribution, and is available at
23- * http://www.eclipse.org/legal/epl-v10.html
24- *
25- * Contributors:
26- * Toshiki IGA - initial API and implementation
27- *******************************************************************************/
28-/*******************************************************************************
29- * Copyright 2012 Toshiki IGA and others.
30- *
31- * Licensed under the Apache License, Version 2.0 (the "License");
32- * you may not use this file except in compliance with the License.
33- * You may obtain a copy of the License at
34- *
35- * http://www.apache.org/licenses/LICENSE-2.0
36- *
37- * Unless required by applicable law or agreed to in writing, software
38- * distributed under the License is distributed on an "AS IS" BASIS,
39- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40- * See the License for the specific language governing permissions and
41- * limitations under the License.
42- *******************************************************************************/
43-package manjyu.rss;
44-
45-import java.io.IOException;
46-import java.io.OutputStream;
47-import java.util.Date;
48-
49-import javax.xml.transform.TransformerConfigurationException;
50-import javax.xml.transform.TransformerFactory;
51-import javax.xml.transform.sax.SAXTransformerFactory;
52-import javax.xml.transform.sax.TransformerHandler;
53-import javax.xml.transform.stream.StreamResult;
54-
55-import manjyu.rss.util.ManjyuRssSerializerUtil;
56-import manjyu.rss.vo.ManjyuRss;
57-import manjyu.rss.vo.ManjyuRssAttribute;
58-import manjyu.rss.vo.ManjyuRssAttributes;
59-import manjyu.rss.vo.ManjyuRssCategory;
60-import manjyu.rss.vo.ManjyuRssChannel;
61-import manjyu.rss.vo.ManjyuRssItem;
62-
63-import org.xml.sax.SAXException;
64-
65-/**
66- * Serializer of Manjyu RSS Library
67- *
68- * @author Toshiki Iga
69- */
70-public class ManjyuRssSerializer {
71- public static final void main(final String[] args) throws IOException {
72- final ManjyuRss rss = new ManjyuRss();
73- rss.getChannel().setTitle("Ugeuge");
74- rss.getChannel().setLink(
75- "http://www.igapyon.com/manjyu/keyword/directory.jsf?path=Culture%09Music%09Instrument");
76- rss.getChannel().setDescription("Description of ugeuge.");
77- rss.getChannel().setPubDate(new Date());
78-
79- {
80- final ManjyuRssItem item = new ManjyuRssItem();
81- rss.getChannel().getItemList().add(item);
82- item.setTitle("Item title");
83- item.setLink("http://www.igapyon.com/manjyu/keyword/directory.jsf?path=Culture%09Music%09Instrument");
84- item.setDescription("Desc of item.");
85- item.setPubDate(new Date());
86-
87- {
88- final ManjyuRssCategory category = new ManjyuRssCategory();
89- item.getCategoryList().add(category);
90- category.setDomain("http://www.igapyon.com/manjyu/keyword/directory.jsf?path=Culture%09Music%09Instrument");
91- category.setCharacters("Instrument");
92- }
93- }
94-
95- new ManjyuRssSerializer().serialize(rss, System.out);
96- }
97-
98- public void serialize(final ManjyuRss rss, final OutputStream outStream) throws IOException {
99- TransformerHandler sax = null;
100-
101- final TransformerFactory tf = TransformerFactory.newInstance();
102- final SAXTransformerFactory saxTf = (SAXTransformerFactory) tf;
103- try {
104- sax = saxTf.newTransformerHandler();
105- sax.getTransformer().setOutputProperty("version", "1.0");
106- sax.getTransformer().setOutputProperty("encoding", "UTF-8");
107- } catch (TransformerConfigurationException e) {
108- throw new IllegalArgumentException("Fail to generate TransformerHandler: " + e.toString(), e);
109- }
110-
111- sax.setResult(new StreamResult(outStream));
112-
113- try {
114- ManjyuRssSerializerUtil.newLine(sax);
115-
116- sax.startDocument();
117-
118- final ManjyuRssAttributes attrs = new ManjyuRssAttributes();
119- {
120- final ManjyuRssAttribute attr = new ManjyuRssAttribute();
121- attrs.getAttrList().add(attr);
122- attr.setLocalName("version");
123- attr.setValue(rss.getVersion());
124- }
125- sax.startElement(null, "rss", "rss", attrs);
126- ManjyuRssSerializerUtil.newLine(sax);
127-
128- serializeChannel(rss.getChannel(), sax);
129-
130- sax.endElement(null, "rss", "rss");
131- ManjyuRssSerializerUtil.newLine(sax);
132-
133- sax.endDocument();
134- } catch (SAXException ex) {
135- throw new IOException(ex.toString(), ex);
136- }
137-
138- outStream.flush();
139- }
140-
141- void serializeChannel(final ManjyuRssChannel channel, final TransformerHandler sax) throws SAXException {
142- ManjyuRssSerializerUtil.indent(1, sax);
143- sax.startElement(null, "channel", "channel", null);
144-
145- ManjyuRssSerializerUtil.newLine(sax);
146-
147- if (channel.getTitle() != null) {
148- ManjyuRssSerializerUtil.indent(2, sax);
149- sax.startElement(null, "title", "title", null);
150- ManjyuRssSerializerUtil.writeCharacters(channel.getTitle(), sax);
151- sax.endElement(null, "title", "title");
152- ManjyuRssSerializerUtil.newLine(sax);
153- }
154-
155- if (channel.getLink() != null) {
156- ManjyuRssSerializerUtil.indent(2, sax);
157- sax.startElement(null, "link", "link", null);
158- ManjyuRssSerializerUtil.writeCharacters(channel.getLink(), sax);
159- sax.endElement(null, "link", "link");
160- ManjyuRssSerializerUtil.newLine(sax);
161- }
162-
163- if (channel.getDescription() != null) {
164- ManjyuRssSerializerUtil.indent(2, sax);
165- sax.startElement(null, "description", "description", null);
166- ManjyuRssSerializerUtil.writeCharacters(channel.getDescription(), sax);
167- sax.endElement(null, "description", "description");
168- ManjyuRssSerializerUtil.newLine(sax);
169- }
170-
171- if (channel.getLanguage() != null) {
172- ManjyuRssSerializerUtil.indent(2, sax);
173- sax.startElement(null, "language", "language", null);
174- ManjyuRssSerializerUtil.writeCharacters(channel.getLanguage(), sax);
175- sax.endElement(null, "language", "language");
176- ManjyuRssSerializerUtil.newLine(sax);
177- }
178-
179- if (channel.getPubDate() != null) {
180- ManjyuRssSerializerUtil.indent(2, sax);
181- sax.startElement(null, "pubDate", "pubDate", null);
182- ManjyuRssSerializerUtil.writeCharacters(ManjyuRssSerializerUtil.date2Rfc822String(channel.getPubDate()),
183- sax);
184- sax.endElement(null, "pubDate", "pubDate");
185- ManjyuRssSerializerUtil.newLine(sax);
186- }
187-
188- if (channel.getGenerator() != null) {
189- ManjyuRssSerializerUtil.indent(2, sax);
190- sax.startElement(null, "generator", "generator", null);
191- ManjyuRssSerializerUtil.writeCharacters(channel.getGenerator(), sax);
192- sax.endElement(null, "generator", "generator");
193- ManjyuRssSerializerUtil.newLine(sax);
194- }
195-
196- for (ManjyuRssItem item : channel.getItemList()) {
197- serializeItem(item, sax);
198- }
199-
200- ManjyuRssSerializerUtil.indent(1, sax);
201- sax.endElement(null, "channel", "channel");
202- ManjyuRssSerializerUtil.newLine(sax);
203- }
204-
205- void serializeItem(final ManjyuRssItem item, final TransformerHandler sax) throws SAXException {
206- ManjyuRssSerializerUtil.indent(2, sax);
207- sax.startElement(null, "item", "item", null);
208-
209- ManjyuRssSerializerUtil.newLine(sax);
210-
211- if (item.getTitle() != null) {
212- ManjyuRssSerializerUtil.indent(3, sax);
213- sax.startElement(null, "title", "title", null);
214- ManjyuRssSerializerUtil.writeCharacters(item.getTitle(), sax);
215- sax.endElement(null, "title", "title");
216- ManjyuRssSerializerUtil.newLine(sax);
217- }
218-
219- if (item.getLink() != null) {
220- ManjyuRssSerializerUtil.indent(3, sax);
221- sax.startElement(null, "link", "link", null);
222- ManjyuRssSerializerUtil.writeCharacters(item.getLink(), sax);
223- sax.endElement(null, "link", "link");
224- ManjyuRssSerializerUtil.newLine(sax);
225- }
226-
227- if (item.getDescription() != null) {
228- ManjyuRssSerializerUtil.indent(3, sax);
229- sax.startElement(null, "description", "description", null);
230- ManjyuRssSerializerUtil.writeCharacters(item.getDescription(), sax);
231- sax.endElement(null, "description", "description");
232- ManjyuRssSerializerUtil.newLine(sax);
233- }
234-
235- if (item.getAuthor() != null) {
236- ManjyuRssSerializerUtil.indent(3, sax);
237- sax.startElement(null, "author", "author", null);
238- ManjyuRssSerializerUtil.writeCharacters(item.getAuthor(), sax);
239- sax.endElement(null, "author", "author");
240- ManjyuRssSerializerUtil.newLine(sax);
241- }
242-
243- // list of category
244- for (ManjyuRssCategory category : item.getCategoryList()) {
245- final ManjyuRssAttributes attrs = new ManjyuRssAttributes();
246- {
247- final ManjyuRssAttribute attr = new ManjyuRssAttribute();
248- attrs.getAttrList().add(attr);
249- attr.setLocalName("domain");
250- attr.setValue(category.getDomain());
251- }
252-
253- ManjyuRssSerializerUtil.indent(3, sax);
254-
255- sax.startElement(null, "category", "category", attrs);
256- ManjyuRssSerializerUtil.writeCharacters(category.getCharacters(), sax);
257- sax.endElement(null, "category", "category");
258- ManjyuRssSerializerUtil.newLine(sax);
259- }
260-
261- if (item.getPubDate() != null) {
262- ManjyuRssSerializerUtil.indent(3, sax);
263- sax.startElement(null, "pubDate", "pubDate", null);
264- ManjyuRssSerializerUtil.writeCharacters(ManjyuRssSerializerUtil.date2Rfc822String(item.getPubDate()), sax);
265- sax.endElement(null, "pubDate", "pubDate");
266- ManjyuRssSerializerUtil.newLine(sax);
267- }
268-
269- ManjyuRssSerializerUtil.indent(2, sax);
270- sax.endElement(null, "item", "item");
271- ManjyuRssSerializerUtil.newLine(sax);
272- }
273-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/manjyu/rss/AbstractManjyuRssConstants.java (revision 6)
+++ manjyu-rss/trunk/src/manjyu/rss/AbstractManjyuRssConstants.java (nonexistent)
@@ -1,54 +0,0 @@
1-/*******************************************************************************
2- * Manjyu RSS Library
3- * Copyright (C) 2012 Toshiki IGA
4- *
5- * This library is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * any later version.
9- *
10- * This program is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * GNU Lesser General Public License for more details.
14- *
15- * You should have received a copy of the GNU Lesser General Public License
16- * along with this library. If not, see <http://www.gnu.org/licenses/>.
17- *******************************************************************************/
18-/*******************************************************************************
19- * Copyright (c) 2012 Toshiki IGA and others.
20- * All rights reserved. This program and the accompanying materials
21- * are made available under the terms of the Eclipse Public License v1.0
22- * which accompanies this distribution, and is available at
23- * http://www.eclipse.org/legal/epl-v10.html
24- *
25- * Contributors:
26- * Toshiki IGA - initial API and implementation
27- *******************************************************************************/
28-/*******************************************************************************
29- * Copyright 2012 Toshiki IGA and others.
30- *
31- * Licensed under the Apache License, Version 2.0 (the "License");
32- * you may not use this file except in compliance with the License.
33- * You may obtain a copy of the License at
34- *
35- * http://www.apache.org/licenses/LICENSE-2.0
36- *
37- * Unless required by applicable law or agreed to in writing, software
38- * distributed under the License is distributed on an "AS IS" BASIS,
39- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40- * See the License for the specific language governing permissions and
41- * limitations under the License.
42- *******************************************************************************/
43-package manjyu.rss;
44-
45-import blanco.constants.BlancoConstantsVersion;
46-
47-/**
48- * Constants of Manjyu RSS Library
49- *
50- * @author Toshiki Iga
51- */
52-@BlancoConstantsVersion(prefix = "0.0.1-")
53-public abstract class AbstractManjyuRssConstants {
54-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRss.java (revision 6)
+++ manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRss.java (nonexistent)
@@ -1,60 +0,0 @@
1-/*******************************************************************************
2- * Manjyu RSS Library
3- * Copyright (C) 2012 Toshiki IGA
4- *
5- * This library is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * any later version.
9- *
10- * This program is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * GNU Lesser General Public License for more details.
14- *
15- * You should have received a copy of the GNU Lesser General Public License
16- * along with this library. If not, see <http://www.gnu.org/licenses/>.
17- *******************************************************************************/
18-/*******************************************************************************
19- * Copyright (c) 2012 Toshiki IGA and others.
20- * All rights reserved. This program and the accompanying materials
21- * are made available under the terms of the Eclipse Public License v1.0
22- * which accompanies this distribution, and is available at
23- * http://www.eclipse.org/legal/epl-v10.html
24- *
25- * Contributors:
26- * Toshiki IGA - initial API and implementation
27- *******************************************************************************/
28-/*******************************************************************************
29- * Copyright 2012 Toshiki IGA and others.
30- *
31- * Licensed under the Apache License, Version 2.0 (the "License");
32- * you may not use this file except in compliance with the License.
33- * You may obtain a copy of the License at
34- *
35- * http://www.apache.org/licenses/LICENSE-2.0
36- *
37- * Unless required by applicable law or agreed to in writing, software
38- * distributed under the License is distributed on an "AS IS" BASIS,
39- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40- * See the License for the specific language governing permissions and
41- * limitations under the License.
42- *******************************************************************************/
43-package manjyu.rss.vo;
44-
45-import blanco.gettersetter.BlancoGetterSetter;
46-
47-/**
48- * RSS 2.0
49- *
50- * @author Toshiki Iga
51- */
52-public abstract class AbstractManjyuRss {
53- @BlancoGetterSetter
54- protected String version = "2.0";
55-
56- // xml version here or not???
57-
58- @BlancoGetterSetter(setter = false)
59- protected ManjyuRssChannel channel = new ManjyuRssChannel();
60-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssAttributes.java (revision 6)
+++ manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssAttributes.java (nonexistent)
@@ -1,229 +0,0 @@
1-/*******************************************************************************
2- * Manjyu RSS Library
3- * Copyright (C) 2012 Toshiki IGA
4- *
5- * This library is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * any later version.
9- *
10- * This program is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * GNU Lesser General Public License for more details.
14- *
15- * You should have received a copy of the GNU Lesser General Public License
16- * along with this library. If not, see <http://www.gnu.org/licenses/>.
17- *******************************************************************************/
18-/*******************************************************************************
19- * Copyright (c) 2012 Toshiki IGA and others.
20- * All rights reserved. This program and the accompanying materials
21- * are made available under the terms of the Eclipse Public License v1.0
22- * which accompanies this distribution, and is available at
23- * http://www.eclipse.org/legal/epl-v10.html
24- *
25- * Contributors:
26- * Toshiki IGA - initial API and implementation
27- *******************************************************************************/
28-/*******************************************************************************
29- * Copyright 2012 Toshiki IGA and others.
30- *
31- * Licensed under the Apache License, Version 2.0 (the "License");
32- * you may not use this file except in compliance with the License.
33- * You may obtain a copy of the License at
34- *
35- * http://www.apache.org/licenses/LICENSE-2.0
36- *
37- * Unless required by applicable law or agreed to in writing, software
38- * distributed under the License is distributed on an "AS IS" BASIS,
39- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40- * See the License for the specific language governing permissions and
41- * limitations under the License.
42- *******************************************************************************/
43-package manjyu.rss.vo;
44-
45-import java.util.ArrayList;
46-import java.util.List;
47-
48-import org.xml.sax.Attributes;
49-
50-import blanco.gettersetter.BlancoGetterSetter;
51-
52-public class AbstractManjyuRssAttributes implements Attributes {
53- @BlancoGetterSetter(setter = false)
54- protected List<ManjyuRssAttribute> attrList = new ArrayList<ManjyuRssAttribute>();
55-
56- @Override
57- public int getLength() {
58- return attrList.size();
59- }
60-
61- @Override
62- public String getURI(int index) {
63- final ManjyuRssAttribute attribute = getAttr(index);
64- if (attribute == null) {
65- return null;
66- }
67-
68- return attribute.getUri();
69- }
70-
71- @Override
72- public String getLocalName(int index) {
73- final ManjyuRssAttribute attribute = getAttr(index);
74- if (attribute == null) {
75- return null;
76- }
77-
78- return attribute.getLocalName();
79- }
80-
81- @Override
82- public String getQName(int index) {
83- final ManjyuRssAttribute attribute = getAttr(index);
84- if (attribute == null) {
85- return null;
86- }
87-
88- final String qName = null2Blank(attribute.getQName());
89- if (qName.length() == 0) {
90- return getLocalName(index);
91- }
92-
93- return attribute.getQName();
94- }
95-
96- @Override
97- public String getType(int index) {
98- final ManjyuRssAttribute attribute = getAttr(index);
99- if (attribute == null) {
100- return null;
101- }
102-
103- return attribute.getType();
104- }
105-
106- @Override
107- public String getValue(int index) {
108- final ManjyuRssAttribute attribute = getAttr(index);
109- if (attribute == null) {
110- return null;
111- }
112-
113- return attribute.getValue();
114- }
115-
116- @Override
117- public int getIndex(final String uri, final String localName) {
118- final int attrSize = attrList.size();
119- for (int index = 0; index < attrSize; index++) {
120- final ManjyuRssAttribute attrLook = attrList.get(index);
121- if (null2Blank(attrLook.getUri()).equals(uri) && null2Blank(attrLook.getLocalName()).equals(localName)) {
122- return index;
123- }
124- }
125-
126- // Not found
127- return -1;
128- }
129-
130- @Override
131- public int getIndex(final String qName) {
132- final int attrSize = attrList.size();
133- for (int index = 0; index < attrSize; index++) {
134- final ManjyuRssAttribute attrLook = attrList.get(index);
135- if (null2Blank(attrLook.getQName()).equals(qName)) {
136- return index;
137- }
138- }
139-
140- // Not found
141- return -1;
142- }
143-
144- @Override
145- public String getType(final String uri, final String localName) {
146- final ManjyuRssAttribute attrFound = findByUriLocalName(uri, localName);
147- if (attrFound == null) {
148- // Not found
149- return null;
150- }
151-
152- return attrFound.getType();
153- }
154-
155- @Override
156- public String getType(final String qName) {
157- final ManjyuRssAttribute attrFound = findByQName(qName);
158- if (attrFound == null) {
159- // Not found
160- return null;
161- }
162-
163- return attrFound.getType();
164- }
165-
166- @Override
167- public String getValue(final String uri, final String localName) {
168- final ManjyuRssAttribute attrFound = findByUriLocalName(uri, localName);
169- if (attrFound == null) {
170- // Not found
171- return null;
172- }
173-
174- return attrFound.getValue();
175- }
176-
177- @Override
178- public String getValue(final String qName) {
179- final ManjyuRssAttribute attrFound = findByQName(qName);
180- if (attrFound == null) {
181- // Not found
182- return null;
183- }
184-
185- return attrFound.getValue();
186- }
187-
188- private ManjyuRssAttribute getAttr(int index) {
189- if (index >= attrList.size()) {
190- return null;
191- }
192-
193- return attrList.get(index);
194- }
195-
196- private ManjyuRssAttribute findByUriLocalName(final String uri, final String localName) {
197- final int attrSize = attrList.size();
198- for (int index = 0; index < attrSize; index++) {
199- final ManjyuRssAttribute attrLook = attrList.get(index);
200- if (null2Blank(attrLook.getUri()).equals(uri) && null2Blank(attrLook.getLocalName()).equals(localName)) {
201- return attrLook;
202- }
203- }
204-
205- // Not found
206- return null;
207- }
208-
209- private ManjyuRssAttribute findByQName(final String qName) {
210- final int attrSize = attrList.size();
211- for (int index = 0; index < attrSize; index++) {
212- final ManjyuRssAttribute attrLook = attrList.get(index);
213- if (null2Blank(attrLook.getUri()).equals(qName)) {
214- return attrLook;
215- }
216- }
217-
218- // Not found
219- return null;
220- }
221-
222- private static final String null2Blank(final String value) {
223- if (value == null) {
224- return "";
225- }
226-
227- return value;
228- }
229-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssAttribute.java (revision 6)
+++ manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssAttribute.java (nonexistent)
@@ -1,62 +0,0 @@
1-/*******************************************************************************
2- * Manjyu RSS Library
3- * Copyright (C) 2012 Toshiki IGA
4- *
5- * This library is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * any later version.
9- *
10- * This program is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * GNU Lesser General Public License for more details.
14- *
15- * You should have received a copy of the GNU Lesser General Public License
16- * along with this library. If not, see <http://www.gnu.org/licenses/>.
17- *******************************************************************************/
18-/*******************************************************************************
19- * Copyright (c) 2012 Toshiki IGA and others.
20- * All rights reserved. This program and the accompanying materials
21- * are made available under the terms of the Eclipse Public License v1.0
22- * which accompanies this distribution, and is available at
23- * http://www.eclipse.org/legal/epl-v10.html
24- *
25- * Contributors:
26- * Toshiki IGA - initial API and implementation
27- *******************************************************************************/
28-/*******************************************************************************
29- * Copyright 2012 Toshiki IGA and others.
30- *
31- * Licensed under the Apache License, Version 2.0 (the "License");
32- * you may not use this file except in compliance with the License.
33- * You may obtain a copy of the License at
34- *
35- * http://www.apache.org/licenses/LICENSE-2.0
36- *
37- * Unless required by applicable law or agreed to in writing, software
38- * distributed under the License is distributed on an "AS IS" BASIS,
39- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40- * See the License for the specific language governing permissions and
41- * limitations under the License.
42- *******************************************************************************/
43-package manjyu.rss.vo;
44-
45-import blanco.gettersetter.BlancoGetterSetter;
46-
47-public abstract class AbstractManjyuRssAttribute {
48- @BlancoGetterSetter
49- protected String uri;
50-
51- @BlancoGetterSetter
52- protected String localName;
53-
54- @BlancoGetterSetter
55- protected String QName;
56-
57- @BlancoGetterSetter
58- protected String type;
59-
60- @BlancoGetterSetter
61- protected String value;
62-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssCategory.java (revision 6)
+++ manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssCategory.java (nonexistent)
@@ -1,63 +0,0 @@
1-/*******************************************************************************
2- * Manjyu RSS Library
3- * Copyright (C) 2012 Toshiki IGA
4- *
5- * This library is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * any later version.
9- *
10- * This program is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * GNU Lesser General Public License for more details.
14- *
15- * You should have received a copy of the GNU Lesser General Public License
16- * along with this library. If not, see <http://www.gnu.org/licenses/>.
17- *******************************************************************************/
18-/*******************************************************************************
19- * Copyright (c) 2012 Toshiki IGA and others.
20- * All rights reserved. This program and the accompanying materials
21- * are made available under the terms of the Eclipse Public License v1.0
22- * which accompanies this distribution, and is available at
23- * http://www.eclipse.org/legal/epl-v10.html
24- *
25- * Contributors:
26- * Toshiki IGA - initial API and implementation
27- *******************************************************************************/
28-/*******************************************************************************
29- * Copyright 2012 Toshiki IGA and others.
30- *
31- * Licensed under the Apache License, Version 2.0 (the "License");
32- * you may not use this file except in compliance with the License.
33- * You may obtain a copy of the License at
34- *
35- * http://www.apache.org/licenses/LICENSE-2.0
36- *
37- * Unless required by applicable law or agreed to in writing, software
38- * distributed under the License is distributed on an "AS IS" BASIS,
39- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40- * See the License for the specific language governing permissions and
41- * limitations under the License.
42- *******************************************************************************/
43-package manjyu.rss.vo;
44-
45-import blanco.gettersetter.BlancoGetterSetter;
46-
47-/**
48- * RSS 2.0
49- *
50- * Child of <item>
51- *
52- * <category domain="https://www.igapyon.com/manjyu/keyword/directory.jsf?path=Culture">Culture</category>
53- * or will be <category domain="https://manjyu.org/manjyu/keyword/directory.jsf?path=Culture">Culture</category>
54- *
55- * @author Toshiki Iga
56- */
57-public abstract class AbstractManjyuRssCategory {
58- @BlancoGetterSetter
59- protected String domain;
60-
61- @BlancoGetterSetter
62- protected String characters;
63-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssChannel.java (revision 6)
+++ manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssChannel.java (nonexistent)
@@ -1,83 +0,0 @@
1-/*******************************************************************************
2- * Manjyu RSS Library
3- * Copyright (C) 2012 Toshiki IGA
4- *
5- * This library is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * any later version.
9- *
10- * This program is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * GNU Lesser General Public License for more details.
14- *
15- * You should have received a copy of the GNU Lesser General Public License
16- * along with this library. If not, see <http://www.gnu.org/licenses/>.
17- *******************************************************************************/
18-/*******************************************************************************
19- * Copyright (c) 2012 Toshiki IGA and others.
20- * All rights reserved. This program and the accompanying materials
21- * are made available under the terms of the Eclipse Public License v1.0
22- * which accompanies this distribution, and is available at
23- * http://www.eclipse.org/legal/epl-v10.html
24- *
25- * Contributors:
26- * Toshiki IGA - initial API and implementation
27- *******************************************************************************/
28-/*******************************************************************************
29- * Copyright 2012 Toshiki IGA and others.
30- *
31- * Licensed under the Apache License, Version 2.0 (the "License");
32- * you may not use this file except in compliance with the License.
33- * You may obtain a copy of the License at
34- *
35- * http://www.apache.org/licenses/LICENSE-2.0
36- *
37- * Unless required by applicable law or agreed to in writing, software
38- * distributed under the License is distributed on an "AS IS" BASIS,
39- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40- * See the License for the specific language governing permissions and
41- * limitations under the License.
42- *******************************************************************************/
43-package manjyu.rss.vo;
44-
45-import java.util.ArrayList;
46-import java.util.Date;
47-import java.util.List;
48-
49-import manjyu.rss.ManjyuRssConstants;
50-import blanco.gettersetter.BlancoGetterSetter;
51-
52-/**
53- * RSS 2.0
54- *
55- * @author Toshiki Iga
56- */
57-public abstract class AbstractManjyuRssChannel {
58- @BlancoGetterSetter
59- // @BlancoValidateRequired
60- protected String title;
61-
62- @BlancoGetterSetter
63- // @BlancoValidateRequired
64- protected String link;
65-
66- @BlancoGetterSetter
67- // @BlancoValidateRequired
68- protected String description;
69-
70- @BlancoGetterSetter
71- protected String language;
72-
73- @BlancoGetterSetter
74- protected Date pubDate;
75-
76- // TODO list of category? or not...
77-
78- @BlancoGetterSetter
79- protected String generator = "Manjyu RSS Library (" + ManjyuRssConstants.VERSION + ")";
80-
81- @BlancoGetterSetter(setter = false)
82- protected List<ManjyuRssItem> itemList = new ArrayList<ManjyuRssItem>();
83-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssItem.java (revision 6)
+++ manjyu-rss/trunk/src/manjyu/rss/vo/AbstractManjyuRssItem.java (nonexistent)
@@ -1,81 +0,0 @@
1-/*******************************************************************************
2- * Manjyu RSS Library
3- * Copyright (C) 2012 Toshiki IGA
4- *
5- * This library is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * any later version.
9- *
10- * This program is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * GNU Lesser General Public License for more details.
14- *
15- * You should have received a copy of the GNU Lesser General Public License
16- * along with this library. If not, see <http://www.gnu.org/licenses/>.
17- *******************************************************************************/
18-/*******************************************************************************
19- * Copyright (c) 2012 Toshiki IGA and others.
20- * All rights reserved. This program and the accompanying materials
21- * are made available under the terms of the Eclipse Public License v1.0
22- * which accompanies this distribution, and is available at
23- * http://www.eclipse.org/legal/epl-v10.html
24- *
25- * Contributors:
26- * Toshiki IGA - initial API and implementation
27- *******************************************************************************/
28-/*******************************************************************************
29- * Copyright 2012 Toshiki IGA and others.
30- *
31- * Licensed under the Apache License, Version 2.0 (the "License");
32- * you may not use this file except in compliance with the License.
33- * You may obtain a copy of the License at
34- *
35- * http://www.apache.org/licenses/LICENSE-2.0
36- *
37- * Unless required by applicable law or agreed to in writing, software
38- * distributed under the License is distributed on an "AS IS" BASIS,
39- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40- * See the License for the specific language governing permissions and
41- * limitations under the License.
42- *******************************************************************************/
43-package manjyu.rss.vo;
44-
45-import java.util.ArrayList;
46-import java.util.Date;
47-import java.util.List;
48-
49-import blanco.gettersetter.BlancoGetterSetter;
50-
51-/**
52- * RSS 2.0
53- *
54- * @author Toshiki Iga
55- */
56-public abstract class AbstractManjyuRssItem {
57- @BlancoGetterSetter
58- protected String title;
59-
60- @BlancoGetterSetter
61- protected String link;
62-
63- @BlancoGetterSetter
64- protected String description;
65-
66- @BlancoGetterSetter
67- protected String author;
68-
69- /**
70- * list of category
71- */
72- @BlancoGetterSetter(setter = false)
73- protected List<ManjyuRssCategory> categoryList = new ArrayList<ManjyuRssCategory>();
74-
75- // comments page
76-
77- // guid
78-
79- @BlancoGetterSetter
80- protected Date pubDate;
81-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/manjyu/rss/util/ManjyuRssSerializerUtil.java (revision 6)
+++ manjyu-rss/trunk/src/manjyu/rss/util/ManjyuRssSerializerUtil.java (nonexistent)
@@ -1,78 +0,0 @@
1-/*******************************************************************************
2- * Manjyu RSS Library
3- * Copyright (C) 2012 Toshiki IGA
4- *
5- * This library is free software: you can redistribute it and/or modify
6- * it under the terms of the GNU Lesser General Public License as published by
7- * the Free Software Foundation, either version 3 of the License, or
8- * any later version.
9- *
10- * This program is distributed in the hope that it will be useful,
11- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13- * GNU Lesser General Public License for more details.
14- *
15- * You should have received a copy of the GNU Lesser General Public License
16- * along with this library. If not, see <http://www.gnu.org/licenses/>.
17- *******************************************************************************/
18-/*******************************************************************************
19- * Copyright (c) 2012 Toshiki IGA and others.
20- * All rights reserved. This program and the accompanying materials
21- * are made available under the terms of the Eclipse Public License v1.0
22- * which accompanies this distribution, and is available at
23- * http://www.eclipse.org/legal/epl-v10.html
24- *
25- * Contributors:
26- * Toshiki IGA - initial API and implementation
27- *******************************************************************************/
28-/*******************************************************************************
29- * Copyright 2012 Toshiki IGA and others.
30- *
31- * Licensed under the Apache License, Version 2.0 (the "License");
32- * you may not use this file except in compliance with the License.
33- * You may obtain a copy of the License at
34- *
35- * http://www.apache.org/licenses/LICENSE-2.0
36- *
37- * Unless required by applicable law or agreed to in writing, software
38- * distributed under the License is distributed on an "AS IS" BASIS,
39- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40- * See the License for the specific language governing permissions and
41- * limitations under the License.
42- *******************************************************************************/
43-package manjyu.rss.util;
44-
45-import java.text.SimpleDateFormat;
46-import java.util.Date;
47-import java.util.Locale;
48-
49-import javax.xml.transform.sax.TransformerHandler;
50-
51-import org.xml.sax.SAXException;
52-
53-/**
54- * Serializer Utils of Manjyu RSS Library
55- *
56- * @author Toshiki Iga
57- */
58-public class ManjyuRssSerializerUtil {
59- public static void newLine(final TransformerHandler sax) throws SAXException {
60- sax.characters("\n".toCharArray(), 0, 1);
61- }
62-
63- public static void indent(final int level, final TransformerHandler sax) throws SAXException {
64- for (int index = 0; index < level * 2; index++) {
65- sax.characters(" ".toCharArray(), 0, 1);
66- }
67- }
68-
69- public static void writeCharacters(final String text, final TransformerHandler sax) throws SAXException {
70- final char[] value = text.toCharArray();
71- sax.characters(value, 0, value.length);
72- }
73-
74- public static String date2Rfc822String(final Date date) {
75- final SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
76- return sdf.format(date);
77- }
78-}
Deleted: svn:mime-type
## -1 +0,0 ##
-text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRss.java (nonexistent)
+++ manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRss.java (revision 7)
@@ -0,0 +1,60 @@
1+/*******************************************************************************
2+ * Manjyu RSS Library
3+ * Copyright (C) 2012 Toshiki IGA
4+ *
5+ * This library is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU Lesser General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU Lesser General Public License
16+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
17+ *******************************************************************************/
18+/*******************************************************************************
19+ * Copyright (c) 2012 Toshiki IGA and others.
20+ * All rights reserved. This program and the accompanying materials
21+ * are made available under the terms of the Eclipse Public License v1.0
22+ * which accompanies this distribution, and is available at
23+ * http://www.eclipse.org/legal/epl-v10.html
24+ *
25+ * Contributors:
26+ * Toshiki IGA - initial API and implementation
27+ *******************************************************************************/
28+/*******************************************************************************
29+ * Copyright 2012 Toshiki IGA and others.
30+ *
31+ * Licensed under the Apache License, Version 2.0 (the "License");
32+ * you may not use this file except in compliance with the License.
33+ * You may obtain a copy of the License at
34+ *
35+ * http://www.apache.org/licenses/LICENSE-2.0
36+ *
37+ * Unless required by applicable law or agreed to in writing, software
38+ * distributed under the License is distributed on an "AS IS" BASIS,
39+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+ * See the License for the specific language governing permissions and
41+ * limitations under the License.
42+ *******************************************************************************/
43+package org.manjyu.rss.vo;
44+
45+import blanco.gettersetter.BlancoGetterSetter;
46+
47+/**
48+ * RSS 2.0
49+ *
50+ * @author Toshiki Iga
51+ */
52+public abstract class AbstractManjyuRss {
53+ @BlancoGetterSetter
54+ protected String version = "2.0";
55+
56+ // xml version here or not???
57+
58+ @BlancoGetterSetter(setter = false)
59+ protected ManjyuRssChannel channel = new ManjyuRssChannel();
60+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssAttribute.java (nonexistent)
+++ manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssAttribute.java (revision 7)
@@ -0,0 +1,62 @@
1+/*******************************************************************************
2+ * Manjyu RSS Library
3+ * Copyright (C) 2012 Toshiki IGA
4+ *
5+ * This library is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU Lesser General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU Lesser General Public License
16+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
17+ *******************************************************************************/
18+/*******************************************************************************
19+ * Copyright (c) 2012 Toshiki IGA and others.
20+ * All rights reserved. This program and the accompanying materials
21+ * are made available under the terms of the Eclipse Public License v1.0
22+ * which accompanies this distribution, and is available at
23+ * http://www.eclipse.org/legal/epl-v10.html
24+ *
25+ * Contributors:
26+ * Toshiki IGA - initial API and implementation
27+ *******************************************************************************/
28+/*******************************************************************************
29+ * Copyright 2012 Toshiki IGA and others.
30+ *
31+ * Licensed under the Apache License, Version 2.0 (the "License");
32+ * you may not use this file except in compliance with the License.
33+ * You may obtain a copy of the License at
34+ *
35+ * http://www.apache.org/licenses/LICENSE-2.0
36+ *
37+ * Unless required by applicable law or agreed to in writing, software
38+ * distributed under the License is distributed on an "AS IS" BASIS,
39+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+ * See the License for the specific language governing permissions and
41+ * limitations under the License.
42+ *******************************************************************************/
43+package org.manjyu.rss.vo;
44+
45+import blanco.gettersetter.BlancoGetterSetter;
46+
47+public abstract class AbstractManjyuRssAttribute {
48+ @BlancoGetterSetter
49+ protected String uri;
50+
51+ @BlancoGetterSetter
52+ protected String localName;
53+
54+ @BlancoGetterSetter
55+ protected String QName;
56+
57+ @BlancoGetterSetter
58+ protected String type;
59+
60+ @BlancoGetterSetter
61+ protected String value;
62+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssAttributes.java (nonexistent)
+++ manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssAttributes.java (revision 7)
@@ -0,0 +1,229 @@
1+/*******************************************************************************
2+ * Manjyu RSS Library
3+ * Copyright (C) 2012 Toshiki IGA
4+ *
5+ * This library is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU Lesser General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU Lesser General Public License
16+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
17+ *******************************************************************************/
18+/*******************************************************************************
19+ * Copyright (c) 2012 Toshiki IGA and others.
20+ * All rights reserved. This program and the accompanying materials
21+ * are made available under the terms of the Eclipse Public License v1.0
22+ * which accompanies this distribution, and is available at
23+ * http://www.eclipse.org/legal/epl-v10.html
24+ *
25+ * Contributors:
26+ * Toshiki IGA - initial API and implementation
27+ *******************************************************************************/
28+/*******************************************************************************
29+ * Copyright 2012 Toshiki IGA and others.
30+ *
31+ * Licensed under the Apache License, Version 2.0 (the "License");
32+ * you may not use this file except in compliance with the License.
33+ * You may obtain a copy of the License at
34+ *
35+ * http://www.apache.org/licenses/LICENSE-2.0
36+ *
37+ * Unless required by applicable law or agreed to in writing, software
38+ * distributed under the License is distributed on an "AS IS" BASIS,
39+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+ * See the License for the specific language governing permissions and
41+ * limitations under the License.
42+ *******************************************************************************/
43+package org.manjyu.rss.vo;
44+
45+import java.util.ArrayList;
46+import java.util.List;
47+
48+import org.xml.sax.Attributes;
49+
50+import blanco.gettersetter.BlancoGetterSetter;
51+
52+public class AbstractManjyuRssAttributes implements Attributes {
53+ @BlancoGetterSetter(setter = false)
54+ protected List<ManjyuRssAttribute> attrList = new ArrayList<ManjyuRssAttribute>();
55+
56+ @Override
57+ public int getLength() {
58+ return attrList.size();
59+ }
60+
61+ @Override
62+ public String getURI(int index) {
63+ final ManjyuRssAttribute attribute = getAttr(index);
64+ if (attribute == null) {
65+ return null;
66+ }
67+
68+ return attribute.getUri();
69+ }
70+
71+ @Override
72+ public String getLocalName(int index) {
73+ final ManjyuRssAttribute attribute = getAttr(index);
74+ if (attribute == null) {
75+ return null;
76+ }
77+
78+ return attribute.getLocalName();
79+ }
80+
81+ @Override
82+ public String getQName(int index) {
83+ final ManjyuRssAttribute attribute = getAttr(index);
84+ if (attribute == null) {
85+ return null;
86+ }
87+
88+ final String qName = null2Blank(attribute.getQName());
89+ if (qName.length() == 0) {
90+ return getLocalName(index);
91+ }
92+
93+ return attribute.getQName();
94+ }
95+
96+ @Override
97+ public String getType(int index) {
98+ final ManjyuRssAttribute attribute = getAttr(index);
99+ if (attribute == null) {
100+ return null;
101+ }
102+
103+ return attribute.getType();
104+ }
105+
106+ @Override
107+ public String getValue(int index) {
108+ final ManjyuRssAttribute attribute = getAttr(index);
109+ if (attribute == null) {
110+ return null;
111+ }
112+
113+ return attribute.getValue();
114+ }
115+
116+ @Override
117+ public int getIndex(final String uri, final String localName) {
118+ final int attrSize = attrList.size();
119+ for (int index = 0; index < attrSize; index++) {
120+ final ManjyuRssAttribute attrLook = attrList.get(index);
121+ if (null2Blank(attrLook.getUri()).equals(uri) && null2Blank(attrLook.getLocalName()).equals(localName)) {
122+ return index;
123+ }
124+ }
125+
126+ // Not found
127+ return -1;
128+ }
129+
130+ @Override
131+ public int getIndex(final String qName) {
132+ final int attrSize = attrList.size();
133+ for (int index = 0; index < attrSize; index++) {
134+ final ManjyuRssAttribute attrLook = attrList.get(index);
135+ if (null2Blank(attrLook.getQName()).equals(qName)) {
136+ return index;
137+ }
138+ }
139+
140+ // Not found
141+ return -1;
142+ }
143+
144+ @Override
145+ public String getType(final String uri, final String localName) {
146+ final ManjyuRssAttribute attrFound = findByUriLocalName(uri, localName);
147+ if (attrFound == null) {
148+ // Not found
149+ return null;
150+ }
151+
152+ return attrFound.getType();
153+ }
154+
155+ @Override
156+ public String getType(final String qName) {
157+ final ManjyuRssAttribute attrFound = findByQName(qName);
158+ if (attrFound == null) {
159+ // Not found
160+ return null;
161+ }
162+
163+ return attrFound.getType();
164+ }
165+
166+ @Override
167+ public String getValue(final String uri, final String localName) {
168+ final ManjyuRssAttribute attrFound = findByUriLocalName(uri, localName);
169+ if (attrFound == null) {
170+ // Not found
171+ return null;
172+ }
173+
174+ return attrFound.getValue();
175+ }
176+
177+ @Override
178+ public String getValue(final String qName) {
179+ final ManjyuRssAttribute attrFound = findByQName(qName);
180+ if (attrFound == null) {
181+ // Not found
182+ return null;
183+ }
184+
185+ return attrFound.getValue();
186+ }
187+
188+ private ManjyuRssAttribute getAttr(int index) {
189+ if (index >= attrList.size()) {
190+ return null;
191+ }
192+
193+ return attrList.get(index);
194+ }
195+
196+ private ManjyuRssAttribute findByUriLocalName(final String uri, final String localName) {
197+ final int attrSize = attrList.size();
198+ for (int index = 0; index < attrSize; index++) {
199+ final ManjyuRssAttribute attrLook = attrList.get(index);
200+ if (null2Blank(attrLook.getUri()).equals(uri) && null2Blank(attrLook.getLocalName()).equals(localName)) {
201+ return attrLook;
202+ }
203+ }
204+
205+ // Not found
206+ return null;
207+ }
208+
209+ private ManjyuRssAttribute findByQName(final String qName) {
210+ final int attrSize = attrList.size();
211+ for (int index = 0; index < attrSize; index++) {
212+ final ManjyuRssAttribute attrLook = attrList.get(index);
213+ if (null2Blank(attrLook.getUri()).equals(qName)) {
214+ return attrLook;
215+ }
216+ }
217+
218+ // Not found
219+ return null;
220+ }
221+
222+ private static final String null2Blank(final String value) {
223+ if (value == null) {
224+ return "";
225+ }
226+
227+ return value;
228+ }
229+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssChannel.java (nonexistent)
+++ manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssChannel.java (revision 7)
@@ -0,0 +1,85 @@
1+/*******************************************************************************
2+ * Manjyu RSS Library
3+ * Copyright (C) 2012 Toshiki IGA
4+ *
5+ * This library is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU Lesser General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU Lesser General Public License
16+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
17+ *******************************************************************************/
18+/*******************************************************************************
19+ * Copyright (c) 2012 Toshiki IGA and others.
20+ * All rights reserved. This program and the accompanying materials
21+ * are made available under the terms of the Eclipse Public License v1.0
22+ * which accompanies this distribution, and is available at
23+ * http://www.eclipse.org/legal/epl-v10.html
24+ *
25+ * Contributors:
26+ * Toshiki IGA - initial API and implementation
27+ *******************************************************************************/
28+/*******************************************************************************
29+ * Copyright 2012 Toshiki IGA and others.
30+ *
31+ * Licensed under the Apache License, Version 2.0 (the "License");
32+ * you may not use this file except in compliance with the License.
33+ * You may obtain a copy of the License at
34+ *
35+ * http://www.apache.org/licenses/LICENSE-2.0
36+ *
37+ * Unless required by applicable law or agreed to in writing, software
38+ * distributed under the License is distributed on an "AS IS" BASIS,
39+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+ * See the License for the specific language governing permissions and
41+ * limitations under the License.
42+ *******************************************************************************/
43+package org.manjyu.rss.vo;
44+
45+import java.util.ArrayList;
46+import java.util.Date;
47+import java.util.List;
48+
49+import org.manjyu.rss.ManjyuRssConstants;
50+
51+import blanco.gettersetter.BlancoGetterSetter;
52+
53+/**
54+ * RSS 2.0
55+ *
56+ * @author Toshiki Iga
57+ */
58+public abstract class AbstractManjyuRssChannel {
59+ @BlancoGetterSetter
60+ // @BlancoValidateRequired
61+ protected String title;
62+
63+ @BlancoGetterSetter
64+ // @BlancoValidateRequired
65+ protected String link;
66+
67+ @BlancoGetterSetter
68+ // @BlancoValidateRequired
69+ protected String description;
70+
71+ @BlancoGetterSetter
72+ protected String language;
73+
74+ @BlancoGetterSetter
75+ protected Date pubDate;
76+
77+ // TODO list of category? or not...
78+
79+ @BlancoGetterSetter
80+ protected String generator = "Manjyu RSS Library ("
81+ + ManjyuRssConstants.VERSION + ")";
82+
83+ @BlancoGetterSetter(setter = false)
84+ protected List<ManjyuRssItem> itemList = new ArrayList<ManjyuRssItem>();
85+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssCategory.java (nonexistent)
+++ manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssCategory.java (revision 7)
@@ -0,0 +1,63 @@
1+/*******************************************************************************
2+ * Manjyu RSS Library
3+ * Copyright (C) 2012 Toshiki IGA
4+ *
5+ * This library is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU Lesser General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU Lesser General Public License
16+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
17+ *******************************************************************************/
18+/*******************************************************************************
19+ * Copyright (c) 2012 Toshiki IGA and others.
20+ * All rights reserved. This program and the accompanying materials
21+ * are made available under the terms of the Eclipse Public License v1.0
22+ * which accompanies this distribution, and is available at
23+ * http://www.eclipse.org/legal/epl-v10.html
24+ *
25+ * Contributors:
26+ * Toshiki IGA - initial API and implementation
27+ *******************************************************************************/
28+/*******************************************************************************
29+ * Copyright 2012 Toshiki IGA and others.
30+ *
31+ * Licensed under the Apache License, Version 2.0 (the "License");
32+ * you may not use this file except in compliance with the License.
33+ * You may obtain a copy of the License at
34+ *
35+ * http://www.apache.org/licenses/LICENSE-2.0
36+ *
37+ * Unless required by applicable law or agreed to in writing, software
38+ * distributed under the License is distributed on an "AS IS" BASIS,
39+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+ * See the License for the specific language governing permissions and
41+ * limitations under the License.
42+ *******************************************************************************/
43+package org.manjyu.rss.vo;
44+
45+import blanco.gettersetter.BlancoGetterSetter;
46+
47+/**
48+ * RSS 2.0
49+ *
50+ * Child of <item>
51+ *
52+ * <category domain="https://www.igapyon.com/manjyu/keyword/directory.jsf?path=Culture">Culture</category>
53+ * or will be <category domain="https://manjyu.org/manjyu/keyword/directory.jsf?path=Culture">Culture</category>
54+ *
55+ * @author Toshiki Iga
56+ */
57+public abstract class AbstractManjyuRssCategory {
58+ @BlancoGetterSetter
59+ protected String domain;
60+
61+ @BlancoGetterSetter
62+ protected String characters;
63+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssItem.java (nonexistent)
+++ manjyu-rss/trunk/src/org/manjyu/rss/vo/AbstractManjyuRssItem.java (revision 7)
@@ -0,0 +1,81 @@
1+/*******************************************************************************
2+ * Manjyu RSS Library
3+ * Copyright (C) 2012 Toshiki IGA
4+ *
5+ * This library is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU Lesser General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU Lesser General Public License
16+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
17+ *******************************************************************************/
18+/*******************************************************************************
19+ * Copyright (c) 2012 Toshiki IGA and others.
20+ * All rights reserved. This program and the accompanying materials
21+ * are made available under the terms of the Eclipse Public License v1.0
22+ * which accompanies this distribution, and is available at
23+ * http://www.eclipse.org/legal/epl-v10.html
24+ *
25+ * Contributors:
26+ * Toshiki IGA - initial API and implementation
27+ *******************************************************************************/
28+/*******************************************************************************
29+ * Copyright 2012 Toshiki IGA and others.
30+ *
31+ * Licensed under the Apache License, Version 2.0 (the "License");
32+ * you may not use this file except in compliance with the License.
33+ * You may obtain a copy of the License at
34+ *
35+ * http://www.apache.org/licenses/LICENSE-2.0
36+ *
37+ * Unless required by applicable law or agreed to in writing, software
38+ * distributed under the License is distributed on an "AS IS" BASIS,
39+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+ * See the License for the specific language governing permissions and
41+ * limitations under the License.
42+ *******************************************************************************/
43+package org.manjyu.rss.vo;
44+
45+import java.util.ArrayList;
46+import java.util.Date;
47+import java.util.List;
48+
49+import blanco.gettersetter.BlancoGetterSetter;
50+
51+/**
52+ * RSS 2.0
53+ *
54+ * @author Toshiki Iga
55+ */
56+public abstract class AbstractManjyuRssItem {
57+ @BlancoGetterSetter
58+ protected String title;
59+
60+ @BlancoGetterSetter
61+ protected String link;
62+
63+ @BlancoGetterSetter
64+ protected String description;
65+
66+ @BlancoGetterSetter
67+ protected String author;
68+
69+ /**
70+ * list of category
71+ */
72+ @BlancoGetterSetter(setter = false)
73+ protected List<ManjyuRssCategory> categoryList = new ArrayList<ManjyuRssCategory>();
74+
75+ // comments page
76+
77+ // guid
78+
79+ @BlancoGetterSetter
80+ protected Date pubDate;
81+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/org/manjyu/rss/ManjyuRssSerializer.java (nonexistent)
+++ manjyu-rss/trunk/src/org/manjyu/rss/ManjyuRssSerializer.java (revision 7)
@@ -0,0 +1,281 @@
1+/*******************************************************************************
2+ * Manjyu RSS Library
3+ * Copyright (C) 2012 Toshiki IGA
4+ *
5+ * This library is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU Lesser General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU Lesser General Public License
16+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
17+ *******************************************************************************/
18+/*******************************************************************************
19+ * Copyright (c) 2012 Toshiki IGA and others.
20+ * All rights reserved. This program and the accompanying materials
21+ * are made available under the terms of the Eclipse Public License v1.0
22+ * which accompanies this distribution, and is available at
23+ * http://www.eclipse.org/legal/epl-v10.html
24+ *
25+ * Contributors:
26+ * Toshiki IGA - initial API and implementation
27+ *******************************************************************************/
28+/*******************************************************************************
29+ * Copyright 2012 Toshiki IGA and others.
30+ *
31+ * Licensed under the Apache License, Version 2.0 (the "License");
32+ * you may not use this file except in compliance with the License.
33+ * You may obtain a copy of the License at
34+ *
35+ * http://www.apache.org/licenses/LICENSE-2.0
36+ *
37+ * Unless required by applicable law or agreed to in writing, software
38+ * distributed under the License is distributed on an "AS IS" BASIS,
39+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+ * See the License for the specific language governing permissions and
41+ * limitations under the License.
42+ *******************************************************************************/
43+package org.manjyu.rss;
44+
45+import java.io.IOException;
46+import java.io.OutputStream;
47+import java.util.Date;
48+
49+import javax.xml.transform.TransformerConfigurationException;
50+import javax.xml.transform.TransformerFactory;
51+import javax.xml.transform.sax.SAXTransformerFactory;
52+import javax.xml.transform.sax.TransformerHandler;
53+import javax.xml.transform.stream.StreamResult;
54+
55+import org.manjyu.rss.util.ManjyuRssSerializerUtil;
56+import org.manjyu.rss.vo.ManjyuRss;
57+import org.manjyu.rss.vo.ManjyuRssAttribute;
58+import org.manjyu.rss.vo.ManjyuRssAttributes;
59+import org.manjyu.rss.vo.ManjyuRssCategory;
60+import org.manjyu.rss.vo.ManjyuRssChannel;
61+import org.manjyu.rss.vo.ManjyuRssItem;
62+import org.xml.sax.SAXException;
63+
64+/**
65+ * Serializer of Manjyu RSS Library
66+ *
67+ * @author Toshiki Iga
68+ */
69+public class ManjyuRssSerializer {
70+ public static final void main(final String[] args) throws IOException {
71+ final ManjyuRss rss = new ManjyuRss();
72+ rss.getChannel().setTitle("Ugeuge");
73+ rss.getChannel()
74+ .setLink(
75+ "http://www.igapyon.com/manjyu/keyword/directory.jsf?path=Culture%09Music%09Instrument");
76+ rss.getChannel().setDescription("Description of ugeuge.");
77+ rss.getChannel().setPubDate(new Date());
78+
79+ {
80+ final ManjyuRssItem item = new ManjyuRssItem();
81+ rss.getChannel().getItemList().add(item);
82+ item.setTitle("Item title");
83+ item.setLink("http://www.igapyon.com/manjyu/keyword/directory.jsf?path=Culture%09Music%09Instrument");
84+ item.setDescription("Desc of item.");
85+ item.setPubDate(new Date());
86+
87+ {
88+ final ManjyuRssCategory category = new ManjyuRssCategory();
89+ item.getCategoryList().add(category);
90+ category.setDomain("http://www.igapyon.com/manjyu/keyword/directory.jsf?path=Culture%09Music%09Instrument");
91+ category.setCharacters("Instrument");
92+ }
93+ }
94+
95+ new ManjyuRssSerializer().serialize(rss, System.out);
96+ }
97+
98+ public void serialize(final ManjyuRss rss, final OutputStream outStream)
99+ throws IOException {
100+ TransformerHandler sax = null;
101+
102+ final TransformerFactory tf = TransformerFactory.newInstance();
103+ final SAXTransformerFactory saxTf = (SAXTransformerFactory) tf;
104+ try {
105+ sax = saxTf.newTransformerHandler();
106+ sax.getTransformer().setOutputProperty("version", "1.0");
107+ sax.getTransformer().setOutputProperty("encoding", "UTF-8");
108+ } catch (TransformerConfigurationException e) {
109+ throw new IllegalArgumentException(
110+ "Fail to generate TransformerHandler: " + e.toString(), e);
111+ }
112+
113+ sax.setResult(new StreamResult(outStream));
114+
115+ try {
116+ ManjyuRssSerializerUtil.newLine(sax);
117+
118+ sax.startDocument();
119+
120+ final ManjyuRssAttributes attrs = new ManjyuRssAttributes();
121+ {
122+ final ManjyuRssAttribute attr = new ManjyuRssAttribute();
123+ attrs.getAttrList().add(attr);
124+ attr.setLocalName("version");
125+ attr.setValue(rss.getVersion());
126+ }
127+ sax.startElement(null, "rss", "rss", attrs);
128+ ManjyuRssSerializerUtil.newLine(sax);
129+
130+ serializeChannel(rss.getChannel(), sax);
131+
132+ sax.endElement(null, "rss", "rss");
133+ ManjyuRssSerializerUtil.newLine(sax);
134+
135+ sax.endDocument();
136+ } catch (SAXException ex) {
137+ throw new IOException(ex.toString(), ex);
138+ }
139+
140+ outStream.flush();
141+ }
142+
143+ void serializeChannel(final ManjyuRssChannel channel,
144+ final TransformerHandler sax) throws SAXException {
145+ ManjyuRssSerializerUtil.indent(1, sax);
146+ sax.startElement(null, "channel", "channel", null);
147+
148+ ManjyuRssSerializerUtil.newLine(sax);
149+
150+ if (channel.getTitle() != null) {
151+ ManjyuRssSerializerUtil.indent(2, sax);
152+ sax.startElement(null, "title", "title", null);
153+ ManjyuRssSerializerUtil.writeCharacters(channel.getTitle(), sax);
154+ sax.endElement(null, "title", "title");
155+ ManjyuRssSerializerUtil.newLine(sax);
156+ }
157+
158+ if (channel.getLink() != null) {
159+ ManjyuRssSerializerUtil.indent(2, sax);
160+ sax.startElement(null, "link", "link", null);
161+ ManjyuRssSerializerUtil.writeCharacters(channel.getLink(), sax);
162+ sax.endElement(null, "link", "link");
163+ ManjyuRssSerializerUtil.newLine(sax);
164+ }
165+
166+ if (channel.getDescription() != null) {
167+ ManjyuRssSerializerUtil.indent(2, sax);
168+ sax.startElement(null, "description", "description", null);
169+ ManjyuRssSerializerUtil.writeCharacters(channel.getDescription(),
170+ sax);
171+ sax.endElement(null, "description", "description");
172+ ManjyuRssSerializerUtil.newLine(sax);
173+ }
174+
175+ if (channel.getLanguage() != null) {
176+ ManjyuRssSerializerUtil.indent(2, sax);
177+ sax.startElement(null, "language", "language", null);
178+ ManjyuRssSerializerUtil.writeCharacters(channel.getLanguage(), sax);
179+ sax.endElement(null, "language", "language");
180+ ManjyuRssSerializerUtil.newLine(sax);
181+ }
182+
183+ if (channel.getPubDate() != null) {
184+ ManjyuRssSerializerUtil.indent(2, sax);
185+ sax.startElement(null, "pubDate", "pubDate", null);
186+ ManjyuRssSerializerUtil.writeCharacters(ManjyuRssSerializerUtil
187+ .date2Rfc822String(channel.getPubDate()), sax);
188+ sax.endElement(null, "pubDate", "pubDate");
189+ ManjyuRssSerializerUtil.newLine(sax);
190+ }
191+
192+ if (channel.getGenerator() != null) {
193+ ManjyuRssSerializerUtil.indent(2, sax);
194+ sax.startElement(null, "generator", "generator", null);
195+ ManjyuRssSerializerUtil
196+ .writeCharacters(channel.getGenerator(), sax);
197+ sax.endElement(null, "generator", "generator");
198+ ManjyuRssSerializerUtil.newLine(sax);
199+ }
200+
201+ for (ManjyuRssItem item : channel.getItemList()) {
202+ serializeItem(item, sax);
203+ }
204+
205+ ManjyuRssSerializerUtil.indent(1, sax);
206+ sax.endElement(null, "channel", "channel");
207+ ManjyuRssSerializerUtil.newLine(sax);
208+ }
209+
210+ void serializeItem(final ManjyuRssItem item, final TransformerHandler sax)
211+ throws SAXException {
212+ ManjyuRssSerializerUtil.indent(2, sax);
213+ sax.startElement(null, "item", "item", null);
214+
215+ ManjyuRssSerializerUtil.newLine(sax);
216+
217+ if (item.getTitle() != null) {
218+ ManjyuRssSerializerUtil.indent(3, sax);
219+ sax.startElement(null, "title", "title", null);
220+ ManjyuRssSerializerUtil.writeCharacters(item.getTitle(), sax);
221+ sax.endElement(null, "title", "title");
222+ ManjyuRssSerializerUtil.newLine(sax);
223+ }
224+
225+ if (item.getLink() != null) {
226+ ManjyuRssSerializerUtil.indent(3, sax);
227+ sax.startElement(null, "link", "link", null);
228+ ManjyuRssSerializerUtil.writeCharacters(item.getLink(), sax);
229+ sax.endElement(null, "link", "link");
230+ ManjyuRssSerializerUtil.newLine(sax);
231+ }
232+
233+ if (item.getDescription() != null) {
234+ ManjyuRssSerializerUtil.indent(3, sax);
235+ sax.startElement(null, "description", "description", null);
236+ ManjyuRssSerializerUtil.writeCharacters(item.getDescription(), sax);
237+ sax.endElement(null, "description", "description");
238+ ManjyuRssSerializerUtil.newLine(sax);
239+ }
240+
241+ if (item.getAuthor() != null) {
242+ ManjyuRssSerializerUtil.indent(3, sax);
243+ sax.startElement(null, "author", "author", null);
244+ ManjyuRssSerializerUtil.writeCharacters(item.getAuthor(), sax);
245+ sax.endElement(null, "author", "author");
246+ ManjyuRssSerializerUtil.newLine(sax);
247+ }
248+
249+ // list of category
250+ for (ManjyuRssCategory category : item.getCategoryList()) {
251+ final ManjyuRssAttributes attrs = new ManjyuRssAttributes();
252+ {
253+ final ManjyuRssAttribute attr = new ManjyuRssAttribute();
254+ attrs.getAttrList().add(attr);
255+ attr.setLocalName("domain");
256+ attr.setValue(category.getDomain());
257+ }
258+
259+ ManjyuRssSerializerUtil.indent(3, sax);
260+
261+ sax.startElement(null, "category", "category", attrs);
262+ ManjyuRssSerializerUtil.writeCharacters(category.getCharacters(),
263+ sax);
264+ sax.endElement(null, "category", "category");
265+ ManjyuRssSerializerUtil.newLine(sax);
266+ }
267+
268+ if (item.getPubDate() != null) {
269+ ManjyuRssSerializerUtil.indent(3, sax);
270+ sax.startElement(null, "pubDate", "pubDate", null);
271+ ManjyuRssSerializerUtil.writeCharacters(ManjyuRssSerializerUtil
272+ .date2Rfc822String(item.getPubDate()), sax);
273+ sax.endElement(null, "pubDate", "pubDate");
274+ ManjyuRssSerializerUtil.newLine(sax);
275+ }
276+
277+ ManjyuRssSerializerUtil.indent(2, sax);
278+ sax.endElement(null, "item", "item");
279+ ManjyuRssSerializerUtil.newLine(sax);
280+ }
281+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/org/manjyu/rss/AbstractManjyuRssConstants.java (nonexistent)
+++ manjyu-rss/trunk/src/org/manjyu/rss/AbstractManjyuRssConstants.java (revision 7)
@@ -0,0 +1,54 @@
1+/*******************************************************************************
2+ * Manjyu RSS Library
3+ * Copyright (C) 2012 Toshiki IGA
4+ *
5+ * This library is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU Lesser General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU Lesser General Public License
16+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
17+ *******************************************************************************/
18+/*******************************************************************************
19+ * Copyright (c) 2012 Toshiki IGA and others.
20+ * All rights reserved. This program and the accompanying materials
21+ * are made available under the terms of the Eclipse Public License v1.0
22+ * which accompanies this distribution, and is available at
23+ * http://www.eclipse.org/legal/epl-v10.html
24+ *
25+ * Contributors:
26+ * Toshiki IGA - initial API and implementation
27+ *******************************************************************************/
28+/*******************************************************************************
29+ * Copyright 2012 Toshiki IGA and others.
30+ *
31+ * Licensed under the Apache License, Version 2.0 (the "License");
32+ * you may not use this file except in compliance with the License.
33+ * You may obtain a copy of the License at
34+ *
35+ * http://www.apache.org/licenses/LICENSE-2.0
36+ *
37+ * Unless required by applicable law or agreed to in writing, software
38+ * distributed under the License is distributed on an "AS IS" BASIS,
39+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+ * See the License for the specific language governing permissions and
41+ * limitations under the License.
42+ *******************************************************************************/
43+package org.manjyu.rss;
44+
45+import blanco.constants.BlancoConstantsVersion;
46+
47+/**
48+ * Constants of Manjyu RSS Library
49+ *
50+ * @author Toshiki Iga
51+ */
52+@BlancoConstantsVersion(prefix = "0.0.1-")
53+public abstract class AbstractManjyuRssConstants {
54+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
--- manjyu-rss/trunk/src/org/manjyu/rss/util/ManjyuRssSerializerUtil.java (nonexistent)
+++ manjyu-rss/trunk/src/org/manjyu/rss/util/ManjyuRssSerializerUtil.java (revision 7)
@@ -0,0 +1,78 @@
1+/*******************************************************************************
2+ * Manjyu RSS Library
3+ * Copyright (C) 2012 Toshiki IGA
4+ *
5+ * This library is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU Lesser General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU Lesser General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU Lesser General Public License
16+ * along with this library. If not, see <http://www.gnu.org/licenses/>.
17+ *******************************************************************************/
18+/*******************************************************************************
19+ * Copyright (c) 2012 Toshiki IGA and others.
20+ * All rights reserved. This program and the accompanying materials
21+ * are made available under the terms of the Eclipse Public License v1.0
22+ * which accompanies this distribution, and is available at
23+ * http://www.eclipse.org/legal/epl-v10.html
24+ *
25+ * Contributors:
26+ * Toshiki IGA - initial API and implementation
27+ *******************************************************************************/
28+/*******************************************************************************
29+ * Copyright 2012 Toshiki IGA and others.
30+ *
31+ * Licensed under the Apache License, Version 2.0 (the "License");
32+ * you may not use this file except in compliance with the License.
33+ * You may obtain a copy of the License at
34+ *
35+ * http://www.apache.org/licenses/LICENSE-2.0
36+ *
37+ * Unless required by applicable law or agreed to in writing, software
38+ * distributed under the License is distributed on an "AS IS" BASIS,
39+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+ * See the License for the specific language governing permissions and
41+ * limitations under the License.
42+ *******************************************************************************/
43+package org.manjyu.rss.util;
44+
45+import java.text.SimpleDateFormat;
46+import java.util.Date;
47+import java.util.Locale;
48+
49+import javax.xml.transform.sax.TransformerHandler;
50+
51+import org.xml.sax.SAXException;
52+
53+/**
54+ * Serializer Utils of Manjyu RSS Library
55+ *
56+ * @author Toshiki Iga
57+ */
58+public class ManjyuRssSerializerUtil {
59+ public static void newLine(final TransformerHandler sax) throws SAXException {
60+ sax.characters("\n".toCharArray(), 0, 1);
61+ }
62+
63+ public static void indent(final int level, final TransformerHandler sax) throws SAXException {
64+ for (int index = 0; index < level * 2; index++) {
65+ sax.characters(" ".toCharArray(), 0, 1);
66+ }
67+ }
68+
69+ public static void writeCharacters(final String text, final TransformerHandler sax) throws SAXException {
70+ final char[] value = text.toCharArray();
71+ sax.characters(value, 0, value.length);
72+ }
73+
74+ public static String date2Rfc822String(final Date date) {
75+ final SimpleDateFormat sdf = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
76+ return sdf.format(date);
77+ }
78+}
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Show on old repository browser