Initial refactoring.

This commit is contained in:
kebernet 2011-03-14 12:41:04 +00:00
parent b6ec96c47b
commit 03bddc0f33
222 changed files with 40602 additions and 129 deletions

View file

@ -5,10 +5,13 @@
<groupId>org.rometools</groupId> <groupId>org.rometools</groupId>
<artifactId>rome-modules</artifactId> <artifactId>rome-modules</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.0</version> <version>1.5-SNAPSHOT</version>
<name>rome-modules</name> <name>rome-modules</name>
<description>Plugin collection for the ROME RSS and Atom Utilities</description> <description>Plugin collection for the ROME RSS and Atom Utilities</description>
<url>http://www.rometools.org</url> <url>http://www.rometools.org</url>
<issueManagement>
<url>https://rometools.jira.com/secure/IssueNavigator.jspa</url>
</issueManagement>
<developers> <developers>
<developer> <developer>
<id>kebernet</id> <id>kebernet</id>

View file

@ -0,0 +1,396 @@
/*
* Article.java
*
* Created on November 16, 2005, 1:01 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import java.util.Date;
/**
* This is an interface for the GoogleBase plug in that exposes methods used for
* Article or News entry types.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public interface Article extends GlobalInterface {
/**
* Array of Author Names. Limit 10.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="author"></a>author</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Author of the item.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:author&gt;John Steinbeck&lt;/g:author&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param authors Array of Author Names. Limit 10.
*/
public void setAuthors(String[] authors);
/**
* Array of Author Names. Limit 10.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="author"></a>author</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Author of the item.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:author&gt;John Steinbeck&lt;/g:author&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return Array of author names.
*/
public String[] getAuthors();
/**
* Source for this article.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="news_source"></a>news_source</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* The source of news content.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:news_source&gt;Journal&lt;/g:news_source&gt;</font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* News and Articles</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param newsSource Source for this article
*/
public void setNewsSource(String newsSource);
/**
* Source for this article.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="news_source"></a>news_source</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* The source of news content.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:news_source&gt;Journal&lt;/g:news_source&gt;</font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* News and Articles</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return source for this article.
*/
public String getNewsSource();
/**
* Number of pages in the article.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="pages"></a>pages</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
*
* The number of pages in the publication.</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:pages&gt;18&lt;/g:pages&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* integer</font></td>
* </tr>
* </tbody></table>
* @param pages Number of pages in the article
*/
public void setPages(Integer pages);
/**
* Number of pages in the article.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="pages"></a>pages</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
*
* The number of pages in the publication.</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:pages&gt;18&lt;/g:pages&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* integer</font></td>
* </tr>
* </tbody></table>
* @return Number of pages in the article
*/
public Integer getPages();
/**
* Date article was published.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publish_date"></a>publish_date</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* Date the item was published in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DD</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:publish_date&gt;2005-12-20&lt;/g:publish_date&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reference Items</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* date</font></td>
* </tr>
* </tbody></table>
* @param publishDate Date article was published
*/
public void setPublishDate(Date publishDate);
/**
* Date article was published.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publish_date"></a>publish_date</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* Date the item was published in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DD</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:publish_date&gt;2005-12-20&lt;/g:publish_date&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reference Items</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* date</font></td>
* </tr>
* </tbody></table>
* @return Date article was published
*/
public Date getPublishDate();
}

View file

@ -0,0 +1,567 @@
/*
* CourseInformation.java
*
* Created on November 16, 2005, 11:12 AM
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import org.rometools.feed.module.base.types.DateTimeRange;
/**
* This is an interface for the GoogleBase plug in that exposes methods used for
* Class or Course information entry types.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public interface Course extends GlobalInterface {
/**
* The timeframe a course is running.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="course_date_range"></a>course_date_range</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">Date and time range a class is in session, in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>. Two sub-attributes
* are included in course_date_range attribute.<ul type="disc">
*
* <li>start = Start date and time of a trip in
* format YYYY-MM-DDThh:mm:ss</li>
* <li>end = End date and time of a trip in
* format YYYY-MM-DDThh:mm:ss</li></ul></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:course_date_range&gt; <br>
*
* &lt;g:start&gt;2005-12-20T09:30:01&lt;/g:start&gt;
* <br>
* &lt;g:end&gt;2005-12-29T10:30:59&lt;/g:end&gt;<br>
* &lt;/g:course_date_range&gt;</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Course schedules</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
*
* <td><font size="-1">
* dateTimeRange</font></td>
* </tr>
* </tbody></table>
* @param courseDateRange The timeframe a course is running
*/
public void setCourseDateRange(DateTimeRange courseDateRange);
/**
* The timeframe a course is running.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="course_date_range"></a>course_date_range</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">Date and time range a class is in session, in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a>. Two sub-attributes
* are included in course_date_range attribute.<ul type="disc">
*
* <li>start = Start date and time of a trip in
* format YYYY-MM-DDThh:mm:ss</li>
* <li>end = End date and time of a trip in
* format YYYY-MM-DDThh:mm:ss</li></ul></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:course_date_range&gt; <br>
*
* &lt;g:start&gt;2005-12-20T09:30:01&lt;/g:start&gt;
* <br>
* &lt;g:end&gt;2005-12-29T10:30:59&lt;/g:end&gt;<br>
* &lt;/g:course_date_range&gt;</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Course schedules</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
*
* <td><font size="-1">
* dateTimeRange</font></td>
* </tr>
* </tbody></table>
* @return The timeframe a course is running
*/
public DateTimeRange getCourseDateRange();
/**
* ID code associated with a course.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="course_number"></a>course_number</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td> <font size="-1">ID code associated with a course</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">&lt;g:course_number&gt;HIST-90A&lt;/g:course_number&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td> <font size="-1">Course schedules</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
*
* <td> <font size="-1">string</font></td>
*
* </tr>
* </tbody></table>
* @param courseNumber ID code associated with a course
*/
public void setCourseNumber(String courseNumber);
/**
* ID code associated with a course.
*
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="course_number"></a>course_number</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td> <font size="-1">ID code associated with a course</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">&lt;g:course_number&gt;HIST-90A&lt;/g:course_number&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td> <font size="-1">Course schedules</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
*
* <td> <font size="-1">string</font></td>
*
* </tr>
* </tbody></table>
* @return ID code associated with a course
*/
public String getCourseNumber();
/**
* Time a class is in session.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="course_times"></a>course_times</b></font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td> <font size="-1">Time a class is in session.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1">&lt;g:course_times&gt;MWF 08:30 - 09:45&lt;/g:course_times&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td> <font size="-1">Course schedules</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
*
* <td> <font size="-1">string</font></td>
* </tr>
* </tbody></table>
* @param courseTimes Time a class is in session
*/
public void setCourseTimes(String courseTimes);
/**
* Time a class is in session.
*
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="course_times"></a>course_times</b></font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td> <font size="-1">Time a class is in session.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1">&lt;g:course_times&gt;MWF 08:30 - 09:45&lt;/g:course_times&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td> <font size="-1">Course schedules</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
*
* <td> <font size="-1">string</font></td>
* </tr>
* </tbody></table>
* @return Time a class is in session
*/
public String getCourseTimes();
/**
* Salary for this position.
*
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="salary"></a>salary</b></font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* Salary for this position. Non-numeric values such as "$" symbols are not acceptable. </font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1">
* &lt;g:salary&gt;55000&lt;/g:salary&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
*
* <td><font size="-1">
*
* float</font></td>
* </tr>
* </tbody></table>
* @param salary Salary for this position
*/
public void setSalary(Float salary);
/**
* Salary for this position.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="salary"></a>salary</b></font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* Salary for this position. Non-numeric values such as "$" symbols are not acceptable. </font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1">
* &lt;g:salary&gt;55000&lt;/g:salary&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
*
* <td><font size="-1">
*
* float</font></td>
* </tr>
* </tbody></table>
* @return Salary for this position
*/
public Float getSalary();
/**
* Topics of study for a course.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="subject"></a>subject</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* Topic of study for a course.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:subject&gt;Trigonometry&lt;/g:subject&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* Course schedules</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @param subject Topics of study for a course
*/
public void setSubjects(String[] subject);
/**
* Topics of study for a course.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="subject"></a>subject</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* Topic of study for a course.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:subject&gt;Trigonometry&lt;/g:subject&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* Course schedules</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @return Topics of study for a course
*/
public String[] getSubjects();
/**
* Name of the school at which a class is offered.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="university"></a>university</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* Name of the school a class is offered at. </font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:university&gt;Stanford&lt;/g:university&gt;</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Course schedules</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
*
* <td><font size="-1">
*
* string</font></td>
* </tr>
* </tbody></table>
* @param university Name of the school at which a class is offered.
*/
public void setUniversity(String university);
/**
* Name of the school at which a class is offered.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="university"></a>university</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* Name of the school a class is offered at. </font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:university&gt;Stanford&lt;/g:university&gt;</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Course schedules</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
*
* <td><font size="-1">
*
* string</font></td>
* </tr>
* </tbody></table>
* @return Name of the school at which a class is offered.
*/
public String getUniversity();
}

View file

@ -0,0 +1,125 @@
/*
* CustomTag.java
*
* Created on February 6, 2006, 12:17 AM
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.rometools.feed.module.base;
/**
* This class represents a custom tag name and value.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public interface CustomTag {
/**
* Returns the tag name used.
* @return Returns the tag name used.
*/
public String getName();
/**
* The value of the custom tag.
* <br>
* <br>
* <table border="1" cellpadding="6" cellspacing="0">
* <tbody><tr valign="top">
* <td><strong><font size="-1">Type (JavaType)</font></strong></td>
*
* <td><strong><font size="-1">Description</font></strong></td>
* <td><strong><font size="-1">Examples</font></strong></td>
* </tr>
* <tr valign="top">
* <td><font size="-1">string (String)</font></td>
* <td><font size="-1">Any string</font></td>
* <td><font size="-1">Blue</font></td>
*
* </tr>
* <tr valign="top">
* <td><font size="-1">int (Integer)</font></td>
* <td><font size="-1">Whole number values</font></td>
* <td><font size="-1">1000</font></td>
* </tr>
* <tr valign="top">
*
* <td><font size="-1">float (Float)</font></td>
* <td><font size="-1">Numbers with decimal digits</font></td>
* <td><font size="-1">3.5</font></td>
* </tr>
* <tr valign="top">
* <td><font size="-1">intUnit (IntUnit)</font></td>
*
* <td><font size="-1">Whole number value and a string</font></td>
*
* <td><font size="-1">10 km</font></td>
* </tr>
* <tr valign="top">
* <td><font size="-1">floatUnit (FloatUnit)</font></td>
* <td><font size="-1">Numbers with decimal digits and a string</font></td>
*
* <td><font size="-1">1.5 km</font></td>
* </tr>
*
* <tr valign="top">
* <td><font size="-1">date (ShortDate)</font></td>
* <td><font size="-1">Date of an event, in format YYYY-MM-DD</font></td>
* <td><font size="-1">2005-12-12</font></td>
* </tr>
*
* <tr valign="top">
* <td><font size="-1">dateTime (java.util.Date)</font></td>
*
* <td><font size="-1">Date and time for an event, in format YYYY-MM-DDThh:mm:ss</font></td>
* <td><font size="-1">2005-12-12T12:00:00 </font></td>
* </tr>
* <tr valign="top">
* <td><font size="-1">dateTimeRange (DateTimeRange)</font></td>
*
* <td><font size="-1">Start and end dates for an event. An attribute of this type will contain two sub-attributes, &lt;start&gt; and &lt;end&gt; in format YYYY-MM-DD</font></td>
*
* <td><font size="-1">&lt;start&gt;1975-09-25&lt;/start&gt;<br>&lt;end&gt;1975-09-25&lt;/end&gt;
*
* </font></td>
* </tr>
* <tr valign="top">
* <td><font size="-1">url (java.net.URL)</font></td>
* <td><font size="-1">HTTP URL </font></td>
*
* <td><font size="-1">http://www.google.com</font></td>
* </tr>
*
* <tr valign="top">
* <td><font size="-1">boolean (Boolean)</font></td>
* <td><font size="-1">Value may be either true or false.</font></td>
* <td><font size="-1">true</font></td>
* </tr>
*
* <tr valign="top">
* <td><font size="-1">location (CustomTagImpl.Location)</font></td>
*
* <td><font size="-1">Location</font></td>
* <td><font size="-1">921 W. Dana Street, Mtn View, CA-94103 </font></td>
* </tr>
*
* </tbody></table>
* @return The value of the tag. The objects class is determined by the "type" attribute on the tag.
*/
public Object getValue();
}

View file

@ -0,0 +1,215 @@
/*
* CustomTagImpl.java
*
* Created on February 6, 2006, 12:06 AM
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.rometools.feed.module.base;
import org.rometools.feed.module.base.types.DateTimeRange;
import org.rometools.feed.module.base.types.FloatUnit;
import org.rometools.feed.module.base.types.IntUnit;
import org.rometools.feed.module.base.types.ShortDate;
import java.net.URL;
import java.util.Date;
/**
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class CustomTagImpl implements CustomTag {
private Object value;
private String name;
/** Creates a new instance of CustomTagImpl */
public CustomTagImpl(String name,String value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,Integer value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,Float value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,IntUnit value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,FloatUnit value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,ShortDate value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,Date value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,DateTimeRange value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,URL value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,Boolean value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public CustomTagImpl(String name,Location value) {
if( name == null || value == null ){ throw new NullPointerException("Name and Value cannont be null."); }
this.name = name;
this.value = value;
}
public String getName() {
return this.name;
}
public Object getValue() {
return this.value;
}
public boolean equals( Object o ){
if( o instanceof CustomTag ){
CustomTag tag = (CustomTag) o;
if( this.name.equals( tag.getName() ) && this.value.equals( tag.getValue() ))
return true;
}
return false;
}
/**
* Creates and returns a copy of this object. The precise meaning
* of "copy" may depend on the class of the object. The general
* intent is that, for any object <tt>x</tt>, the expression:
* <blockquote>
* <pre>
* x.clone() != x</pre></blockquote>
* will be true, and that the expression:
* <blockquote>
* <pre>
* x.clone().getClass() == x.getClass()</pre></blockquote>
* will be <tt>true</tt>, but these are not absolute requirements.
* While it is typically the case that:
* <blockquote>
* <pre>
* x.clone().equals(x)</pre></blockquote>
* will be <tt>true</tt>, this is not an absolute requirement.
* <p>
* By convention, the returned object should be obtained by calling
* <tt>super.clone</tt>. If a class and all of its superclasses (except
* <tt>Object</tt>) obey this convention, it will be the case that
* <tt>x.clone().getClass() == x.getClass()</tt>.
* <p>
* By convention, the object returned by this method should be independent
* of this object (which is being cloned). To achieve this independence,
* it may be necessary to modify one or more fields of the object returned
* by <tt>super.clone</tt> before returning it. Typically, this means
* copying any mutable objects that comprise the internal "deep structure"
* of the object being cloned and replacing the references to these
* objects with references to the copies. If a class contains only
* primitive fields or references to immutable objects, then it is usually
* the case that no fields in the object returned by <tt>super.clone</tt>
* need to be modified.
* <p>
* The method <tt>clone</tt> for class <tt>Object</tt> performs a
* specific cloning operation. First, if the class of this object does
* not implement the interface <tt>Cloneable</tt>, then a
* <tt>CloneNotSupportedException</tt> is thrown. Note that all arrays
* are considered to implement the interface <tt>Cloneable</tt>.
* Otherwise, this method creates a new instance of the class of this
* object and initializes all its fields with exactly the contents of
* the corresponding fields of this object, as if by assignment; the
* contents of the fields are not themselves cloned. Thus, this method
* performs a "shallow copy" of this object, not a "deep copy" operation.
* <p>
* The class <tt>Object</tt> does not itself implement the interface
* <tt>Cloneable</tt>, so calling the <tt>clone</tt> method on an object
* whose class is <tt>Object</tt> will result in throwing an
* exception at run time.
*
* @return a clone of this instance.
* @exception CloneNotSupportedException if the object's class does not
* support the <code>Cloneable</code> interface. Subclasses
* that override the <code>clone</code> method can also
* throw this exception to indicate that an instance cannot
* be cloned.
* @see java.lang.Cloneable
*/
public Object clone() throws CloneNotSupportedException {
CustomTagImpl cti = new CustomTagImpl( this.name, "" );
cti.value = this.value;
return cti;
}
public String toString() {
return "[custom name=\""+this.name+"\" value=\""+this.value.toString()+"\"]";
}
public static class Location {
private String value;
public Location(String value) {
this.value = value;
}
public String getValue() {
return value;
}
public Object clone() {
return new Location(this.value);
}
public String toString() {
return value;
}
public boolean equals( Object o ){
if( o instanceof Location && ((Location) o).value.equals(this.value) ) return true;
else return false;
}
}
}

View file

@ -0,0 +1,38 @@
/*
* CustomTags.java
*
* Created on February 6, 2006, 12:26 AM
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.rometools.feed.module.base;
import com.sun.syndication.feed.module.Module;
import java.util.List;
/**
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public interface CustomTags extends Module {
public static final String URI = "http://base.google.com/cns/1.0";
public List getValues();
public void setValues(List values);
}

View file

@ -0,0 +1,66 @@
/*
* CustomTagsImpl.java
*
* Created on February 6, 2006, 12:26 AM
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.rometools.feed.module.base;
import java.util.ArrayList;
import java.util.List;
/**
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class CustomTagsImpl implements CustomTags {
private List values;
/** Creates a new instance of CustomTagsImpl */
public CustomTagsImpl() {
}
public List getValues(){
values = (values == null )? new ArrayList() : values;
return values;
}
public void setValues(List values){
this.values = values;
}
public void copyFrom(Object object) {
CustomTags ct = (CustomTags) object;
this.values = new ArrayList( ct.getValues() );
}
public Object clone() {
CustomTagsImpl cti = new CustomTagsImpl();
cti.values = new ArrayList( this.values );
return cti;
}
public Class getInterface(){
return CustomTags.class;
}
public String getUri() {
return CustomTags.URI;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,532 @@
/*
* GlobalInterface.java
*
* Created on November 16, 2005, 5:27 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import java.io.Serializable;
import java.net.URL;
import java.util.Date;
/**
* This is an interface representing the universals.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public interface GlobalInterface extends Serializable {
/**Expiration Date for this item.
* <br>
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="expiration_date"></a>expiration_date</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Date that the item expires in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DD</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
* <td><font size="-1">
* &lt;g:expiration_date&gt;2005-20-12&lt;/g:expiration_date&gt;
*
* </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Reference Items, Events, Housing,
* Jobs, People profiles, Products, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> date</font></td>
* </tr>
* </tbody></table>
* @param expirationDate the date this entry will expire
*/
public void setExpirationDate(Date expirationDate);
/** Expiration Date for this item.
* <br>
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="expiration_date"></a>expiration_date</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Date that the item expires in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DD</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
* <td><font size="-1">
* &lt;g:expiration_date&gt;2005-20-12&lt;/g:expiration_date&gt;
*
* </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Reference Items, Events, Housing,
* Jobs, People profiles, Products, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> date</font></td>
* </tr>
* </tbody></table>
* @return the date this entry will expire
*/
public Date getExpirationDate();
/**
* Date and time that the item expires.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="expiration_date_time"></a>expiration_date_time</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> Date and time that the item expires in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DDThh:mm:ss</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;g:expiration_date_time&gt;12-20-05T11:59:59&lt;/g:expiration_date_time&gt;
* </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
*
* <td><font size="-1"> Reference Items, Events, Housing,
* Jobs, People profiles, Products, Services, Travel, Vehicles, Wanted Ads.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> dateTime</font></td>
* </tr>
*
* </tbody></table>
* @param expirationDateTime Date and time that the item expires.
*/
public void setExpirationDateTime(Date expirationDateTime);
/**
* Date and time that the item expires.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="expiration_date_time"></a>expiration_date_time</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> Date and time that the item expires in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DDThh:mm:ss</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;g:expiration_date_time&gt;12-20-05T11:59:59&lt;/g:expiration_date_time&gt;
* </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
*
* <td><font size="-1"> Reference Items, Events, Housing,
* Jobs, People profiles, Products, Services, Travel, Vehicles, Wanted Ads.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> dateTime</font></td>
* </tr>
*
* </tbody></table>
* @return Date and time that the item expires.
*/
public Date getExpirationDateTime();
/** Unique id for this item.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="id"></a>id</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Unique alphanumeric identifier for each item
* - e.g., your internal ID code.<br>
* IMPORTANT: Once you submit an item with a unique id, this identifier
* must not change when you send in a new bulk upload. Each item must
* retain the same id in subsequent bulk uploads.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">
*
* &lt;g:id&gt;01flx&lt;/g:id&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Reference Items, Events, Housing,
* Jobs, News and Articles, People profiles, Products, Reviews, Services,
* Travel, Vehicles, Wanted Ads.</font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @param id unique identifier for this entry
*/
public void setId(String id);
/** Unique id for this item.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="id"></a>id</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Unique alphanumeric identifier for each item
* - e.g., your internal ID code.<br>
* IMPORTANT: Once you submit an item with a unique id, this identifier
* must not change when you send in a new bulk upload. Each item must
* retain the same id in subsequent bulk uploads.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">
*
* &lt;g:id&gt;01flx&lt;/g:id&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Reference Items, Events, Housing,
* Jobs, News and Articles, People profiles, Products, Reviews, Services,
* Travel, Vehicles, Wanted Ads.</font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @return unique identifier for this entry
*/
public String getId();
/**Images for this item.
* <br>
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="image_link"></a>image_link</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> URL of an associated image if available online.
* Use your full-sized images; do not use thumbnail images. Up to ten
* image_links, all placed in between their own &lt;image_link&gt;
* and &lt;/image_link&gt; attributes, can be included with each item.
* If you do not have an image available, do not include this attribute.
* Please do not include an image that says "Image not available."
* Relative URLs and logo images are not acceptable.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td><font size="-1"> <em>Acceptable:</em><br>
* &lt;image_link&gt;http://example.com/images/1006.jpg&lt;/image_link&gt;<br>
*
* &lt;image_link&gt;http://example.com/i/6.jpg,http://example.com/i/9.jpg&lt;/image_link&gt;<br>
*
* <em>Not acceptable:</em><br>
* &lt;image_link&gt;/images/1006.jpg&lt;/image_link&gt;<br>
* &lt;image_link&gt;example.com/images/1006.jpg&lt;/image_link&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
*
* <td><font size="-1"> Reference Items, Events, Housing,
* Jobs, News and Articles, People profiles, Products, Reviews, Services,
* Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> url</font></td>
* </tr>
*
* </tbody></table>
* @param imageLinks URLs to images. Limit 10.
*/
public void setImageLinks(URL[] imageLinks);
/**Images for this item.
* <br>
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="image_link"></a>image_link</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> URL of an associated image if available online.
* Use your full-sized images; do not use thumbnail images. Up to ten
* image_links, all placed in between their own &lt;image_link&gt;
* and &lt;/image_link&gt; attributes, can be included with each item.
* If you do not have an image available, do not include this attribute.
* Please do not include an image that says "Image not available."
* Relative URLs and logo images are not acceptable.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td><font size="-1"> <em>Acceptable:</em><br>
* &lt;image_link&gt;http://example.com/images/1006.jpg&lt;/image_link&gt;<br>
*
* &lt;image_link&gt;http://example.com/i/6.jpg,http://example.com/i/9.jpg&lt;/image_link&gt;<br>
*
* <em>Not acceptable:</em><br>
* &lt;image_link&gt;/images/1006.jpg&lt;/image_link&gt;<br>
* &lt;image_link&gt;example.com/images/1006.jpg&lt;/image_link&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
*
* <td><font size="-1"> Reference Items, Events, Housing,
* Jobs, News and Articles, People profiles, Products, Reviews, Services,
* Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> url</font></td>
* </tr>
*
* </tbody></table>
* @return URLs to images
*/
public URL[] getImageLinks();
/**Labels for this item.
* <br>
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top">
* <font size="-1"><b><a name="label"></a>label</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120">
*
* <font size="-1"><b>Details</b></font></td>
* <td>
* <font size="-1">A
* list of classifications the item may fall under. Up to ten user-selected
* label, each placed in between their own &lt;label&gt;
*
* and &lt;/label&gt; tags, can be included with each item. These attributes will be used to match your items to search queries. Each attribute value will be checked for policy compliance.</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120">
* <font size="-1"><b>Example</b></font></td>
* <td>
*
* <font size="-1"><em>Acceptable:<br>
* For an automobile in a Vehicles information type:</em><br>
* </font>
*
* <font size="-1">&lt;g:label&gt;Leather&lt;/g:label&gt;<br>
* </font>
* <font size="-1">&lt;g:label&gt;Power locks&lt;/g:label&gt;<br>
*
* </font>
* <font size="-1">&lt;g:label&gt;sunroof&lt;/g:label&gt;<br>
*
* </font>
* <font size="-1">&lt;g:label&gt;ABS&lt;/g:label&gt;<br><br>
* </font>
* <font size="-1"><em>For a concert in an Events information type:</em></font><br>
*
* <font size="-1">&lt;g:label&gt;VIP&lt;/g:label&gt;<br>
*
* </font>
* <font size="-1">&lt;g:label&gt;front row&lt;/g:label&gt;<br>
* </font>
* <font size="-1">&lt;g:label&gt;backstage&lt;/g:label&gt;<br>
*
* </font>
*
* <font size="-1">&lt;g:label&gt;KROCK 101.5&lt;/g:label&gt;<br>
* </font>
* <font size="-1">&lt;g:label&gt;parking passes&lt;/g:label&gt;<br><br>
* </font>
* <font size="-1"><em>Not acceptable:</em><br>
*
* </font>
* <font size="-1">&lt;g:label&gt; leater, power locks, sunroof, ABS &lt;/g:label&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120">
* <font size="-1"><b>Attribute of</b></font></td>
*
* <td>
* <font size="-1">Reference Items, Events, Housing, Jobs, News and Articles,
* People profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
* <tr valign="top">
* <td width="120">
* <font size="-1"><b>Content type</b></font></td>
* <td>
*
* <font size="-1">string</font></td>
*
* </tr>
* </tbody></table>
* @param labels labels for this entry. Limit 10.
*/
public void setLabels(String[] labels);
/**Labels for this item.
* <br>
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top">
* <font size="-1"><b><a name="label"></a>label</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120">
*
* <font size="-1"><b>Details</b></font></td>
* <td>
* <font size="-1">A
* list of classifications the item may fall under. Up to ten user-selected
* label, each placed in between their own &lt;label&gt;
*
* and &lt;/label&gt; tags, can be included with each item. These attributes will be used to match your items to search queries. Each attribute value will be checked for policy compliance.</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120">
* <font size="-1"><b>Example</b></font></td>
* <td>
*
* <font size="-1"><em>Acceptable:<br>
* For an automobile in a Vehicles information type:</em><br>
* </font>
*
* <font size="-1">&lt;g:label&gt;Leather&lt;/g:label&gt;<br>
* </font>
* <font size="-1">&lt;g:label&gt;Power locks&lt;/g:label&gt;<br>
*
* </font>
* <font size="-1">&lt;g:label&gt;sunroof&lt;/g:label&gt;<br>
*
* </font>
* <font size="-1">&lt;g:label&gt;ABS&lt;/g:label&gt;<br><br>
* </font>
* <font size="-1"><em>For a concert in an Events information type:</em></font><br>
*
* <font size="-1">&lt;g:label&gt;VIP&lt;/g:label&gt;<br>
*
* </font>
* <font size="-1">&lt;g:label&gt;front row&lt;/g:label&gt;<br>
* </font>
* <font size="-1">&lt;g:label&gt;backstage&lt;/g:label&gt;<br>
*
* </font>
*
* <font size="-1">&lt;g:label&gt;KROCK 101.5&lt;/g:label&gt;<br>
* </font>
* <font size="-1">&lt;g:label&gt;parking passes&lt;/g:label&gt;<br><br>
* </font>
* <font size="-1"><em>Not acceptable:</em><br>
*
* </font>
* <font size="-1">&lt;g:label&gt; leater, power locks, sunroof, ABS &lt;/g:label&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120">
* <font size="-1"><b>Attribute of</b></font></td>
*
* <td>
* <font size="-1">Reference Items, Events, Housing, Jobs, News and Articles,
* People profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
* <tr valign="top">
* <td width="120">
* <font size="-1"><b>Content type</b></font></td>
* <td>
*
* <font size="-1">string</font></td>
*
* </tr>
* </tbody></table>
* @return labels for this entry
*/
public String[] getLabels();
}

View file

@ -0,0 +1,62 @@
/*
* GoogleBase.java
*
* Created on November 16, 2005, 4:37 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import com.sun.syndication.feed.module.Module;
/**
* This is the root interface for the Google Base module.
*
* <p>
* It supports all the individual data "types". If you want to work with, for
* instance, just the Article or Job datatype, you can cast it to the
* respective interface and see only methods related to a particular entry
* type.
* </p>
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet"
* Cooper</a>
* @version $Revision: 1.1 $
*/
public interface GoogleBase extends Module,Article,Course,Event,Job,Person,Product,Review,ScholarlyArticle,Service,Travel,Unknown,Vehicle,Wanted,Housing {
/** This is the URI for the Google Base Schema. */
public static final String URI = "http://base.google.com/ns/1.0";
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,860 @@
/*
* Job.java
*
* Created on November 16, 2005, 12:39 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import org.rometools.feed.module.base.types.CurrencyEnumeration;
import org.rometools.feed.module.base.types.PriceTypeEnumeration;
/** This is an interface for the GoogleBase plug in that exposes methods used for
* Job listing entry types.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public interface Job extends GlobalInterface {
/**
* Level of education required for an employment position.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="education"></a>education</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Level of education required for an employment
* position.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">&lt;g:education&gt;PhD&lt;/g:education&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @param education Level of education required for an employment position.
*/
public void setEducation(String education);
/**
* Level of education required for an employment position.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="education"></a>education</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Level of education required for an employment
* position.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">&lt;g:education&gt;PhD&lt;/g:education&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @return Level of education required for an employment position.
*/
public String getEducation();
/**
* Company providing employment.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="employer"></a>employer</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> Company providing employment.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1">&lt;g:employer&gt;Google, Inc&lt;/g:employer&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @param employer Company providing employment.
*/
public void setEmployer(String employer);
/**
* Company providing employment.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="employer"></a>employer</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> Company providing employment.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1">&lt;g:employer&gt;Google, Inc&lt;/g:employer&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @return Company providing employment.
*/
public String getEmployer();
/**
* Legal residency requirements for an employment position.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="immigration_status"></a>immigration_status</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Legal residency requirements for an employment
* position.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1">&lt;g:immigration_status&gt;Permanent resident&lt;/g:immigration_status&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @param immigrationStatus Legal residency requirements for an employment position.
*/
public void setImmigrationStatus(String immigrationStatus);
/**
* Legal residency requirements for an employment position.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="immigration_status"></a>immigration_status</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Legal residency requirements for an employment
* position.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1">&lt;g:immigration_status&gt;Permanent resident&lt;/g:immigration_status&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @return Legal residency requirements for an employment position.
*/
public String getImmigrationStatus();
/**
* The functions of an employment position.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="job_function"></a>job_function</b></font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* The function of an employment position.</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:job_function&gt;Product
* Manager&lt;/g:job_function&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
*
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param function The functions of an employment position.
*/
public void setJobFunctions(String[] function);
/**
* The functions of an employment position.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="job_function"></a>job_function</b></font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* The function of an employment position.</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:job_function&gt;Product
* Manager&lt;/g:job_function&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
*
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return The functions of an employment position.
*/
public String[] getJobFunctions();
/**
* The industry of an employment position.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
*
* <b><a name="job_industry"></a>job_industry</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* The industry of an employment position.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:job_industry&gt;Government&lt;/g:job_industry&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param jobIndustries The industry of an employment position.
*/
public void setJobIndustries(String[] jobIndustries);
/**
* The industry of an employment position.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
*
* <b><a name="job_industry"></a>job_industry</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* The industry of an employment position.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:job_industry&gt;Government&lt;/g:job_industry&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return The industry of an employment position.
*/
public String[] getJobIndustries();
/**
* Type of employment position. Example: Full-time, part-time, contractor, etc.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="job_type"></a>job_type</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Type of employment position. Example: Full-time, part-time, contractor, etc.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:job_type&gt;contractor&lt;/g:job_type&gt;</font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Jobs</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param jobTypes Type of employment position. Example: Full-time, part-time, contractor, etc.
*/
public void setJobTypes(String[] jobTypes);
/**
* Type of employment position. Example: Full-time, part-time, contractor, etc.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="job_type"></a>job_type</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Type of employment position. Example: Full-time, part-time, contractor, etc.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:job_type&gt;contractor&lt;/g:job_type&gt;</font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Jobs</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return Type of employment position. Example: Full-time, part-time, contractor, etc.
*/
public String[] getJobTypes();
/**
* Location of the position.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="location"></a>location</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1"> Location of a property. Should
* include street, city, state, postal code, and country, in that order. </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* <em>Acceptable:</em><br>
* &lt;g:location&gt;<st1:place>123 Main St, <st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
*
* <em>Not acceptable:</em><br>
* &lt;g:location&gt;<st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
* &lt;g:location&gt;
* <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, Events, Housing, Jobs, News and Articles,
* People profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* locationType</font></td>
* </tr>
* </tbody></table>
* @param location Location of the position.
*/
public void setLocation(String location);
/**
* Location of the position.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="location"></a>location</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1"> Location of a property. Should
* include street, city, state, postal code, and country, in that order. </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* <em>Acceptable:</em><br>
* &lt;g:location&gt;<st1:place>123 Main St, <st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
*
* <em>Not acceptable:</em><br>
* &lt;g:location&gt;<st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
* &lt;g:location&gt;
* <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, Events, Housing, Jobs, News and Articles,
* People profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* locationType</font></td>
* </tr>
* </tbody></table>
* @return Location of the position.
*/
public String getLocation();
/**
* Salary for this position. Non-numeric values such as "$" symbols are not acceptable.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="salary"></a>salary</b></font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* Salary for this position. Non-numeric values such as "$" symbols are not acceptable. </font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1">
* &lt;g:salary&gt;55000&lt;/g:salary&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
*
* <td><font size="-1">
*
* float</font></td>
* </tr>
* </tbody></table>
* @param salary Salary for this position. Non-numeric values such as "$" symbols are not acceptable.
*/
public void setSalary(Float salary);
/**
* Salary for this position. Non-numeric values such as "$" symbols are not acceptable.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="salary"></a>salary</b></font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* Salary for this position. Non-numeric values such as "$" symbols are not acceptable. </font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1">
* &lt;g:salary&gt;55000&lt;/g:salary&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
*
* <td><font size="-1">
*
* float</font></td>
* </tr>
* </tbody></table>
* @return Salary for this position. Non-numeric values such as "$" symbols are not acceptable.
*/
public Float getSalary();
/**
* The type of salary included.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="salary_type"></a>salary_type</b></font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1"> The type of salary included.
* Accepted values are <EFBFBD>starting<EFBFBD> or <EFBFBD>negotiable;<EFBFBD> The default is <EFBFBD>starting
* at.<EFBFBD></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:salary_type&gt;negotiable&lt;/g:salary_type&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* "starting" or "negotiable"</font></td>
* </tr>
* </tbody></table>
* @param salaryType The type of salary included.
*/
public void setSalaryType(PriceTypeEnumeration salaryType);
/**
* The type of salary included.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="salary_type"></a>salary_type</b></font></td>
*
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1"> The type of salary included.
* Accepted values are <EFBFBD>starting<EFBFBD> or <EFBFBD>negotiable;<EFBFBD> The default is <EFBFBD>starting
* at.<EFBFBD></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:salary_type&gt;negotiable&lt;/g:salary_type&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* "starting" or "negotiable"</font></td>
* </tr>
* </tbody></table>
* @return The type of salary included.
*/
public PriceTypeEnumeration getSalaryType();
/**
* Currency of the price amount for an item.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="currency"></a>currency</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td> <font size="-1">Currency
* of the price amount for an item. Values must be in <a href="http://www.iso.org/iso/en/prods-services/popstds/currencycodeslist.html">ISO
* 4217</a> currency code format.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1"><em>Acceptable:</em><br>&lt;g:currency&gt;USD&lt;/g:currency&gt;<br>
*
* <em>Not acceptable:</em><br>&lt;g:currency&gt;US Dollars&lt;/g:currency&gt;</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td> <font size="-1">Events,
* Housing, Products, Services, Travel, Vehicles</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
* <td> <font size="-1">currencyEnumeration</font></td>
*
* </tr>
* </tbody></table>
* @param value Currency of the price amount for an item.
*/
public void setCurrency(CurrencyEnumeration value);
/**
* Currency of the price amount for an item.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="currency"></a>currency</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td> <font size="-1">Currency
* of the price amount for an item. Values must be in <a href="http://www.iso.org/iso/en/prods-services/popstds/currencycodeslist.html">ISO
* 4217</a> currency code format.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1"><em>Acceptable:</em><br>&lt;g:currency&gt;USD&lt;/g:currency&gt;<br>
*
* <em>Not acceptable:</em><br>&lt;g:currency&gt;US Dollars&lt;/g:currency&gt;</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td> <font size="-1">Events,
* Housing, Products, Services, Travel, Vehicles</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
* <td> <font size="-1">currencyEnumeration</font></td>
*
* </tr>
* </tbody></table>
* @return Currency of the price amount for an item.
*/
public CurrencyEnumeration getCurrency();
}

View file

@ -0,0 +1,830 @@
/*
* Person.java
*
* Created on November 16, 2005, 1:26 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import org.rometools.feed.module.base.types.GenderEnumeration;
/** This is an interface for the GoogleBase plug in that exposes methods used for
* Person (personal ad, resume, profile) entry types.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public interface Person extends GlobalInterface {
/**
* Age of the individual.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr bgcolor="#dddddd" valign="top">
* <td colspan="2" nowrap="nowrap"><font size="-1"><strong><a name="age"></a>age</strong></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><strong><font size="-1">Details</font></strong></td>
* <td><font size="-1">Minimum age requirement for the event or the age of the individual in a People profiles
* bulk upload entry.</font></td>
*
* </tr>
* <tr valign="top">
* <td><strong><font size="-1">Example</font></strong></td>
* <td><font size="-1"><em>Acceptable:</em><br>
* &lt;
* g:age&gt;18&lt;/g:age&gt;<br>
* <em>Not acceptable:</em><br>
*
* &lt;
* g:age&gt;18 and over&lt;/g:age&gt;</font></td>
* </tr>
* <tr valign="top">
* <td><strong><font size="-1">Attribute of</font></strong></td>
* <td><font size="-1">Events, People profiles</font></td>
*
* </tr>
*
* <tr valign="top">
* <td><strong><font size="-1">Content type</font></strong></td>
* <td><font size="-1">integer</font></td>
* </tr>
* </tbody></table>
* @param age Age of the individual.
*/
public void setAge(Integer age);
/**
* Age of the individual.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr bgcolor="#dddddd" valign="top">
* <td colspan="2" nowrap="nowrap"><font size="-1"><strong><a name="age"></a>age</strong></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><strong><font size="-1">Details</font></strong></td>
* <td><font size="-1">Minimum age requirement for the event or the age of the individual in a People profiles
* bulk upload entry.</font></td>
*
* </tr>
* <tr valign="top">
* <td><strong><font size="-1">Example</font></strong></td>
* <td><font size="-1"><em>Acceptable:</em><br>
* &lt;
* g:age&gt;18&lt;/g:age&gt;<br>
* <em>Not acceptable:</em><br>
*
* &lt;
* g:age&gt;18 and over&lt;/g:age&gt;</font></td>
* </tr>
* <tr valign="top">
* <td><strong><font size="-1">Attribute of</font></strong></td>
* <td><font size="-1">Events, People profiles</font></td>
*
* </tr>
*
* <tr valign="top">
* <td><strong><font size="-1">Content type</font></strong></td>
* <td><font size="-1">integer</font></td>
* </tr>
* </tbody></table>
* @return Age of the individual.
*/
public Integer getAge();
/**
* Education of the individual.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="education"></a>education</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Level of education required for an employment
* position.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">&lt;g:education&gt;PhD&lt;/g:education&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @param education Education of the individual.
*/
public void setEducation(String education);
/**
* Education of the individual.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="education"></a>education</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Level of education required for an employment
* position.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">&lt;g:education&gt;PhD&lt;/g:education&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @return Education of the individual.
*/
public String getEducation();
/**
* Individuals employer.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="employer"></a>employer</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> Company providing employment.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1">&lt;g:employer&gt;Google, Inc&lt;/g:employer&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @param employer Individuals employer.
*/
public void setEmployer(String employer);
/**
* Individuals employer.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="employer"></a>employer</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> Company providing employment.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td> <font size="-1">&lt;g:employer&gt;Google, Inc&lt;/g:employer&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> Jobs</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> string</font></td>
* </tr>
* </tbody></table>
* @return Individuals employer.
*/
public String getEmployer();
/**
* Ethnicity of the individual in the People profiles bulk upload entry.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="ethnicity"></a>ethnicity</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Ethnicity of the individual in the People profiles
* bulk upload entry.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">&lt;g:ethnicity&gt;Latino&lt;/g:ethnicity&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
*
* <td><font size="-1"> People profiles</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> string</font></td>
* </tr>
*
* </tbody></table>
* @param ethnicities Ethnicity of the individual in the People profiles bulk upload entry.
*/
public void setEthnicities(String[] ethnicities);
/**
* Ethnicity of the individual in the People profiles bulk upload entry.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="ethnicity"></a>ethnicity</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Ethnicity of the individual in the People profiles
* bulk upload entry.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
* <td> <font size="-1">&lt;g:ethnicity&gt;Latino&lt;/g:ethnicity&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
*
* <td><font size="-1"> People profiles</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
*
* <td><font size="-1"> string</font></td>
* </tr>
*
* </tbody></table>
* @return Ethnicity of the individual in the People profiles bulk upload entry.
*/
public String[] getEthnicities();
/**
* Gender of an individual in a People profiles bulk upload.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="gender"></a>gender</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Gender of an individual in a People profiles bulk upload
* item. Acceptable values are <EFBFBD>Male<EFBFBD>, <EFBFBD>M<EFBFBD>,
* <EFBFBD>Female<EFBFBD>, or <EFBFBD>F<EFBFBD>.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;gender&gt;Female&lt;/gender&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> People profiles</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> genderEnumeration</font></td>
* </tr>
* </tbody></table>
* @param gender Gender of an individual in a People profiles bulk upload.
*/
public void setGender(GenderEnumeration gender);
/**
* Gender of an individual in a People profiles bulk upload.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="gender"></a>gender</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td><font size="-1"> Gender of an individual in a People profiles bulk upload
* item. Acceptable values are <EFBFBD>Male<EFBFBD>, <EFBFBD>M<EFBFBD>,
* <EFBFBD>Female<EFBFBD>, or <EFBFBD>F<EFBFBD>.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;gender&gt;Female&lt;/gender&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
* <td><font size="-1"> People profiles</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> genderEnumeration</font></td>
* </tr>
* </tbody></table>
* @return Gender of an individual in a People profiles bulk upload.
*/
public GenderEnumeration getGender();
/**
* Interest of a person being profiled.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="interested_in"></a>interested_in</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> Interest of a person being profiled.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;g:interested_in&gt;Long walks on the beach.&lt;/g:interested_in&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
*
* <td><font size="-1">People profiles</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> string</font></td>
* </tr>
*
* </tbody></table>
* @param interestedIn Interest of a person being profiled.
*/
public void setInterestedIn(String[] interestedIn);
/**
* Interest of a person being profiled.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="interested_in"></a>interested_in</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td><font size="-1"> Interest of a person being profiled.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;g:interested_in&gt;Long walks on the beach.&lt;/g:interested_in&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute of</b></font></td>
*
* <td><font size="-1">People profiles</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content type</b></font></td>
* <td><font size="-1"> string</font></td>
* </tr>
*
* </tbody></table>
* @return Interest of a person being profiled.
*/
public String[] getInterestedIn();
/**
* Location of a person.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="location"></a>location</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1"> Location of a property. Should
* include street, city, state, postal code, and country, in that order. </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* <em>Acceptable:</em><br>
* &lt;g:location&gt;<st1:place>123 Main St, <st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
*
* <em>Not acceptable:</em><br>
* &lt;g:location&gt;<st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
* &lt;g:location&gt;
* <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, Events, Housing, Jobs, News and Articles,
* People profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* locationType</font></td>
* </tr>
* </tbody></table>
* @param location Location of a person.
*/
public void setLocation(String location);
/**
* Location of a person.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="location"></a>location</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1"> Location of a property. Should
* include street, city, state, postal code, and country, in that order. </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* <em>Acceptable:</em><br>
* &lt;g:location&gt;<st1:place>123 Main St, <st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
*
* <em>Not acceptable:</em><br>
* &lt;g:location&gt;<st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
* &lt;g:location&gt;
* <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, Events, Housing, Jobs, News and Articles,
* People profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* locationType</font></td>
* </tr>
* </tbody></table>
* @return Location of a person.
*/
public String getLocation();
/**
* Marital status of an individual.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="marital_status"></a>marital_status</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1"> Marital status of an individual
* in a People profiles bulk upload entry.
* For example -single, divorced, separated, widowed, married, and <EFBFBD>in
* relationship.<EFBFBD></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;g:marital_status&gt;single&lt;/g:marital_status&gt;<br>
*
* </font></td></tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* People profiles</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* string</font></td>
* </tr>
* </tbody></table>
* @param maritalStatus Marital status of an individual.
*/
public void setMaritalStatus(String maritalStatus);
/**
* Marital status of an individual.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="marital_status"></a>marital_status</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1"> Marital status of an individual
* in a People profiles bulk upload entry.
* For example -single, divorced, separated, widowed, married, and <EFBFBD>in
* relationship.<EFBFBD></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;g:marital_status&gt;single&lt;/g:marital_status&gt;<br>
*
* </font></td></tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* People profiles</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* string</font></td>
* </tr>
* </tbody></table>
* @return Marital status of an individual.
*/
public String getMaritalStatus();
/**
* Occupation of an individual.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="occupation"></a>occupation</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* Industry the individual in a People profiles bulk upload
* is employed in.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:occupation&gt;Sales&lt;/g:occupation&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* People profiles</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @param occupation Occupation of an individual.
*/
public void setOccupation(String occupation);
/**
* Occupation of an individual.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="occupation"></a>occupation</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* Industry the individual in a People profiles bulk upload
* is employed in.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:occupation&gt;Sales&lt;/g:occupation&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* People profiles</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @return Occupation of an individual.
*/
public String getOccupation();
/**
* Individual's sexual orientation.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="sexual_orientation"></a>sexual_orientation</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Sexual orientation of an individual in a People profiles information type..</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:sexual_orientation&gt;straight&lt;/g:sexual_orientation&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* Personal</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @param sexualOrientation Individual's sexual orientation.
*/
public void setSexualOrientation(String sexualOrientation);
/**
* Individual's sexual orientation.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="sexual_orientation"></a>sexual_orientation</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Sexual orientation of an individual in a People profiles information type..</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:sexual_orientation&gt;straight&lt;/g:sexual_orientation&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* Personal</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @return Individual's sexual orientation.
*/
public String getSexualOrientation();
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,836 @@
/*
* Review.java
*
* Created on November 16, 2005, 1:58 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import org.rometools.feed.module.base.types.FloatUnit;
import java.net.URL;
import java.util.Date;
/**
* This is an interface for the GoogleBase plug in that exposes methods used for
* critical reviews of other things.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public interface Review extends GlobalInterface {
/**
* Author of the item.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="author"></a>author</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Author of the item.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:author&gt;John Steinbeck&lt;/g:author&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param authors Author of the item.
*/
public void setAuthors(String[] authors);
/**
* Author of the item.
*
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="author"></a>author</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Author of the item.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:author&gt;John Steinbeck&lt;/g:author&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return Author of the item.
*/
public String[] getAuthors();
/**
* Additional instructions to explain the items delivery process.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="delivery_notes"></a>delivery_notes</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td> <font size="-1">Additional instructions to explain the items delivery process.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
* <td>
* <font size="-1">&lt;g:delivery_notes&gt;Items usually shipped within 24 hours.&lt;g:/delivery_notes&gt;<br>
*
* </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td>
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted
* Ads. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
*
* <td> <font size="-1">string</font></td>
* </tr>
* </tbody></table>
* @param deliveryNotes Additional instructions to explain the items delivery process.
*/
public void setDeliveryNotes(String deliveryNotes);
/**
* Additional instructions to explain the items delivery process.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="delivery_notes"></a>delivery_notes</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td> <font size="-1">Additional instructions to explain the items delivery process.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
* <td>
* <font size="-1">&lt;g:delivery_notes&gt;Items usually shipped within 24 hours.&lt;g:/delivery_notes&gt;<br>
*
* </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td>
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted
* Ads. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
*
* <td> <font size="-1">string</font></td>
* </tr>
* </tbody></table>
* @return Additional instructions to explain the items delivery process.
*/
public String getDeliveryNotes();
/**
* The maximum distance you will deliver an item in any direction.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="delivery_radius"></a>delivery_radius</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td> <font size="-1">The maximum
* distance you will deliver an item in any direction. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
*
* <td>
* <font size="-1">&lt;g:delivery_radius&gt;10&lt;g:/delivery_radius&gt;
* </font>
* <br><font size="-1">&lt;g:delivery_radius&gt;10km&lt;/g:delivery_radius&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
*
* <td>
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted
* Ads. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
* <td> <font size="-1">floatUnit</font></td>
* </tr>
*
* </tbody></table>
* @param deliveryRadius The maximum distance you will deliver an item in any direction.
*/
public void setDeliveryRadius(FloatUnit deliveryRadius);
/**
* The maximum distance you will deliver an item in any direction.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="delivery_radius"></a>delivery_radius</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td> <font size="-1">The maximum
* distance you will deliver an item in any direction. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
*
* <td>
* <font size="-1">&lt;g:delivery_radius&gt;10&lt;g:/delivery_radius&gt;
* </font>
* <br><font size="-1">&lt;g:delivery_radius&gt;10km&lt;/g:delivery_radius&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
*
* <td>
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted
* Ads. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
* <td> <font size="-1">floatUnit</font></td>
* </tr>
*
* </tbody></table>
* @return The maximum distance you will deliver an item in any direction.
*/
public FloatUnit getDeliveryRadius();
/**
* The name of an item being reviewed.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="name_of_item_being_reviewed"></a>name_of_item_being_reviewed</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
*
* The name of an item being reviewed.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:name_of_item_being__reviewed&gt;Fleur de lys Restaurant&lt;/g:name_of_item_being_reviewed&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reviews</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param nameOfItemBeingReviewed The name of an item being reviewed.
*/
public void setNameOfItemBeingReviewed(String nameOfItemBeingReviewed);
/**
* The name of an item being reviewed.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="name_of_item_being_reviewed"></a>name_of_item_being_reviewed</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
*
* The name of an item being reviewed.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:name_of_item_being__reviewed&gt;Fleur de lys Restaurant&lt;/g:name_of_item_being_reviewed&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reviews</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return The name of an item being reviewed.
*/
public String getNameOfItemBeingReviewed();
/**
* Date the item was published.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publish_date"></a>publish_date</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Date the item was published in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DD</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:publish_date&gt;2005-12-20&lt;/g:publish_date&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* Reference Items</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* date</font></td>
*
* </tr>
* </tbody></table>
* @param publishDate Date the item was published.
*/
public void setPublishDate(Date publishDate);
/**
* Date the item was published.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publish_date"></a>publish_date</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Date the item was published in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DD</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:publish_date&gt;2005-12-20&lt;/g:publish_date&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* Reference Items</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* date</font></td>
*
* </tr>
* </tbody></table>
* @return Date the item was published.
*/
public Date getPublishDate();
/**
* Rating of the product or service on a scale of 1-5, with 5 as the best.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="rating"></a>rating</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* Rating of the product or service
* on a scale of 1-5, with 5 as the best. Numeric values only.</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1">
* <em>Acceptable:</em><br>
* &lt;g:rating&gt;4&lt;/g:rating&gt;<br>
*
* <em>Not acceptable:</em><br>
*
* &lt;g:rating&gt;good&lt;/g:rating&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reviews</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* string</font></td>
* </tr>
* </tbody></table>
* @param rating Rating of the product or service on a scale of 1-5, with 5 as the best.
*/
public void setRating(Float rating);
/**
* Rating of the product or service on a scale of 1-5, with 5 as the best.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="rating"></a>rating</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
* Rating of the product or service
* on a scale of 1-5, with 5 as the best. Numeric values only.</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1">
* <em>Acceptable:</em><br>
* &lt;g:rating&gt;4&lt;/g:rating&gt;<br>
*
* <em>Not acceptable:</em><br>
*
* &lt;g:rating&gt;good&lt;/g:rating&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reviews</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* string</font></td>
* </tr>
* </tbody></table>
* @return Rating of the product or service on a scale of 1-5, with 5 as the best.
*/
public Float getRating();
/**
* The category of the item being reviewed.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="review_type"></a>review_type</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
*
* <td><font size="-1"> The category of the item being reviewed.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;g:review_type&gt;toy&lt;/g:review_type&gt;<br>
*
* &lt;g:review_type&gt;music&lt;/g:review_type&gt;<br>
* &lt;g:review_type&gt;restaraunt&lt;/g:review_type&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reviews</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @param reviewType The category of the item being reviewed.
*/
public void setReviewType(String reviewType);
/**
* The category of the item being reviewed.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="review_type"></a>review_type</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
*
* <td><font size="-1"> The category of the item being reviewed.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* &lt;g:review_type&gt;toy&lt;/g:review_type&gt;<br>
*
* &lt;g:review_type&gt;music&lt;/g:review_type&gt;<br>
* &lt;g:review_type&gt;restaraunt&lt;/g:review_type&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reviews</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @return The category of the item being reviewed.
*/
public String getReviewType();
/**
* The type of rating being provided: editorial (a
* review written by a member of your staff) or user ( a review written by a
* user of your site).
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="reviewer_type"></a>reviewer_type</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1"> The type of rating being provided: editorial (a
* review written by a member of your staff) or user ( a review written by a
* user of your site)</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1">
* &lt;g:reviewer_type&gt;editorial&lt;/g:reviewer_type&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reviews</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @param reviewerType The type of rating being provided: editorial (a
* review written by a member of your staff) or user ( a review written by a
* user of your site).
*/
public void setReviewerType(String reviewerType);
/**
* The type of rating being provided: editorial (a
* review written by a member of your staff) or user ( a review written by a
* user of your site).
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="reviewer_type"></a>reviewer_type</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1"> The type of rating being provided: editorial (a
* review written by a member of your staff) or user ( a review written by a
* user of your site)</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1">
* &lt;g:reviewer_type&gt;editorial&lt;/g:reviewer_type&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reviews</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
*
* </tr>
* </tbody></table>
* @return The type of rating being provided: editorial (a
* review written by a member of your staff) or user ( a review written by a
* user of your site).
*/
public String getReviewerType();
/**
* The web page of an item being reviewed.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="url_of_item_being_reviewed"></a>url_of_item_being_reviewed</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* The web page of an item being reviewed.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:url_of_item_being_reviewed&gt;http://www.fleurdelyssf.com/&lt;/g:url_of_item_being_reviewed&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* Reviews</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* uri</font></td>
* </tr>
*
* </tbody></table>
* @param urlOfItemBeingReviewed The web page of an item being reviewed.
*/
public void setUrlOfItemBeingReviewed(URL urlOfItemBeingReviewed);
/**
* The web page of an item being reviewed.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="url_of_item_being_reviewed"></a>url_of_item_being_reviewed</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* The web page of an item being reviewed.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1"> &lt;g:url_of_item_being_reviewed&gt;http://www.fleurdelyssf.com/&lt;/g:url_of_item_being_reviewed&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
*
* Reviews</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* uri</font></td>
* </tr>
*
* </tbody></table>
* @return The web page of an item being reviewed.
*/
public URL getUrlOfItemBeingReviewed();
}

View file

@ -0,0 +1,482 @@
/*
* ScholarlyArticle.java
*
* Created on November 16, 2005, 1:55 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import java.util.Date;
/**
* This is an interface for the GoogleBase plug in that exposes methods used for
* Scholarly publication, research studies and reference materials.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public interface ScholarlyArticle extends GlobalInterface {
/**
* Array of Author Names. Limit 10.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="author"></a>author</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Author of the item.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:author&gt;John Steinbeck&lt;/g:author&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param authors Array of Author Names. Limit 10.
*/
public void setAuthors(String[] authors);
/**
* Array of Author Names. Limit 10.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="author"></a>author</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
*
* <td><font size="-1">
* Author of the item.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:author&gt;John Steinbeck&lt;/g:author&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return Array of author names.
*/
public String[] getAuthors();
/**
* Number of pages in the article.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="pages"></a>pages</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
*
* The number of pages in the publication.</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:pages&gt;18&lt;/g:pages&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* integer</font></td>
* </tr>
* </tbody></table>
* @param pages Number of pages in the article
*/
public void setPages(Integer pages);
/**
* Number of pages in the article.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="pages"></a>pages</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
*
* The number of pages in the publication.</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:pages&gt;18&lt;/g:pages&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, News and Articles</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* integer</font></td>
* </tr>
* </tbody></table>
* @return Number of pages in the article
*/
public Integer getPages();
/**
* Name of the publication.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publication_name"></a>publication_name</b></font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
*
* Name of the publication.</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:publication_name&gt; Journal of Appropriate Technology&lt;/g:publication_name&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Research studies and publications</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param publicationName Name of the publication.
*/
public void setPublicationName(String publicationName);
/**
* Name of the publication.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
*
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publication_name"></a>publication_name</b></font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
*
* Name of the publication.</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:publication_name&gt; Journal of Appropriate Technology&lt;/g:publication_name&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Research studies and publications</font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return Name of the publication.
*/
public String getPublicationName();
/**
* Volume of the publication.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publication_volume"></a>publication_volume</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
*
* Volume of the publication.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1">&lt;g:publication_volume&gt;VI&lt;/g:publication_volume&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
*
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @param publicationVolume Volume of the publication.
*/
public void setPublicationVolume(String publicationVolume);
/**
* Volume of the publication.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publication_volume"></a>publication_volume</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1">
*
* Volume of the publication.</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
* <td><font size="-1">&lt;g:publication_volume&gt;VI&lt;/g:publication_volume&gt;</font></td>
*
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
*
* <td><font size="-1">
* string</font></td>
* </tr>
* </tbody></table>
* @return Volume of the publication.
*/
public String getPublicationVolume();
/**
* Date article was published.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publish_date"></a>publish_date</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* Date the item was published in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DD</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:publish_date&gt;2005-12-20&lt;/g:publish_date&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reference Items</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* date</font></td>
* </tr>
* </tbody></table>
* @param publishDate Date article was published
*/
public void setPublishDate(Date publishDate);
/**
* Date article was published.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd"><font size="-1">
* <b><a name="publish_date"></a>publish_date</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Details</b></font></td>
* <td><font size="-1">
* Date the item was published in <a href="http://www.iso.org/iso/en/prods-services/popstds/datesandtime.html">ISO 8601</a> format:
* YYYY-MM-DD</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Example</b></font></td>
* <td><font size="-1"> &lt;g:publish_date&gt;2005-12-20&lt;/g:publish_date&gt;</font></td>
* </tr>
*
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
*
* <td><font size="-1">
* Reference Items</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
*
* <b>Content type</b></font></td>
* <td><font size="-1">
*
* date</font></td>
* </tr>
* </tbody></table>
* @return Date article was published
*/
public Date getPublishDate();
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,78 @@
/*
* Unknown.java
*
* Created on November 18, 2005, 1:34 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import java.net.URL;
import org.rometools.feed.module.base.types.IntUnit;
/**
* This interface contains all the other schema elements that the document
* doesn't associate with a particular type.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet"
* Cooper</a>
*/
public interface Unknown extends GlobalInterface {
public void setLicenses(String[] licenses);
public String[] getLicenses();
public void setOperatingSystems(String systems);
public String getOperatingSystems();
public void setProgrammingLanguages(String[] languages);
public String[] getProgrammingLanguages();
public void setRelatedLinks(URL[] links);
public URL[] getRelatedLinks();
public void setSquareFootages(IntUnit[] squareFootages);
public IntUnit[] getSquareFootages();
public void setSubjectAreas(String[] subjectAreas);
public String[] getSubjectAreas();
}

View file

@ -0,0 +1,35 @@
/*
* ValidationException.java
*
* Created on November 20, 2005, 3:14 PM
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.rometools.feed.module.base;
/** This is an unchecked exception that is thrown when a data value violates
* the Google Schema limits.
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ValidationException extends RuntimeException{
/** Creates a new instance of ValidationException */
public ValidationException(String message) {
super( message );
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,306 @@
/*
* Wanted.java
*
* Created on November 16, 2005, 3:32 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base;
import org.rometools.feed.module.base.types.FloatUnit;
/**This is an interface for the GoogleBase plug in that exposes methods used for
* wanted ads.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public interface Wanted extends GlobalInterface {
/**
* Additional instructions to explain the items delivery process.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="delivery_notes"></a>delivery_notes</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td> <font size="-1">Additional instructions to explain the items delivery process.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
* <td>
* <font size="-1">&lt;g:delivery_notes&gt;Items usually shipped within 24 hours.&lt;g:/delivery_notes&gt;<br>
*
* </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td>
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted
* Ads. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
*
* <td> <font size="-1">string</font></td>
* </tr>
* </tbody></table>
* @param deliveryNotes Additional instructions to explain the items delivery process.
*/
public void setDeliveryNotes(String deliveryNotes);
/**
* Additional instructions to explain the items delivery process.
*
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="delivery_notes"></a>delivery_notes</b></font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
*
* <td> <font size="-1">Additional instructions to explain the items delivery process.</font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
* <td>
* <font size="-1">&lt;g:delivery_notes&gt;Items usually shipped within 24 hours.&lt;g:/delivery_notes&gt;<br>
*
* </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
* <td>
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted
* Ads. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
*
* <td> <font size="-1">string</font></td>
* </tr>
* </tbody></table>
* @return Additional instructions to explain the items delivery process.
*/
public String getDeliveryNotes();
/**
* The maximum distance you will deliver an item in any direction.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="delivery_radius"></a>delivery_radius</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td> <font size="-1">The maximum
* distance you will deliver an item in any direction. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
*
* <td>
* <font size="-1">&lt;g:delivery_radius&gt;10&lt;g:/delivery_radius&gt;
* </font>
* <br><font size="-1">&lt;g:delivery_radius&gt;10km&lt;/g:delivery_radius&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
*
* <td>
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted
* Ads. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
* <td> <font size="-1">floatUnit</font></td>
* </tr>
*
* </tbody></table>
* @param deliveryRadius The maximum distance you will deliver an item in any direction.
*/
public void setDeliveryRadius(FloatUnit deliveryRadius);
/**
* The maximum distance you will deliver an item in any direction.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
* <td colspan="2" bgcolor="#dddddd" valign="top"> <font size="-1"><b><a name="delivery_radius"></a>delivery_radius</b></font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Details</b></font></td>
* <td> <font size="-1">The maximum
* distance you will deliver an item in any direction. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1"><b>Example</b></font></td>
*
* <td>
* <font size="-1">&lt;g:delivery_radius&gt;10&lt;g:/delivery_radius&gt;
* </font>
* <br><font size="-1">&lt;g:delivery_radius&gt;10km&lt;/g:delivery_radius&gt;</font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Attribute
* of</b></font></td>
*
* <td>
* <font size="-1">Events, Products, Reviews, Services, Travel, Vehicles, Wanted
* Ads. </font></td>
* </tr>
* <tr valign="top">
* <td width="120"> <font size="-1"><b>Content
* type</b></font></td>
* <td> <font size="-1">floatUnit</font></td>
* </tr>
*
* </tbody></table>
* @return The maximum distance you will deliver an item in any direction.
*/
public FloatUnit getDeliveryRadius();
/**
* Location of the property.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="location"></a>location</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1"> Location of a property. Should
* include street, city, state, postal code, and country, in that order. </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* <em>Acceptable:</em><br>
* &lt;g:location&gt;<st1:place>123 Main St, <st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
*
* <em>Not acceptable:</em><br>
* &lt;g:location&gt;<st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
* &lt;g:location&gt;
* <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, Events, Housing, Jobs, News and Articles,
* People profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* locationType</font></td>
* </tr>
* </tbody></table>
* @param location Location of the property.
*/
public void setLocation(String location);
/**
* Location of the property.
* <table border="1" cellpadding="5" cellspacing="0" width="640">
* <tbody><tr valign="top">
*
* <td colspan="2" bgcolor="#dddddd" valign="top"><font size="-1">
* <b><a name="location"></a>location</b></font></td>
* </tr>
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Details</b></font></td>
* <td><font size="-1"> Location of a property. Should
* include street, city, state, postal code, and country, in that order. </font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Example</b></font></td>
*
* <td><font size="-1">
* <em>Acceptable:</em><br>
* &lt;g:location&gt;<st1:place>123 Main St, <st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
*
* <em>Not acceptable:</em><br>
* &lt;g:location&gt;<st1:place><st1:city>123</st1:city> Main St,, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;<br>
* &lt;g:location&gt;
* <st1:place><st1:city>Anytown</st1:city>, <st1:state>CA</st1:state>, <st1:postalcode>12345</st1:postalcode>, <st1:country-region>USA</st1:country-region></st1:place>&lt;/g:location&gt;</font></td>
*
* </tr>
* <tr valign="top">
* <td width="120"><font size="-1">
* <b>Attribute of</b></font></td>
* <td><font size="-1">
* Reference Items, Events, Housing, Jobs, News and Articles,
* People profiles, Products, Reviews, Services, Travel, Vehicles, Wanted Ads.</font></td>
* </tr>
*
* <tr valign="top">
*
* <td width="120"><font size="-1">
* <b>Content type</b></font></td>
* <td><font size="-1">
* locationType</font></td>
* </tr>
* </tbody></table>
* @return Location of the property.
*/
public String getLocation();
}

View file

@ -0,0 +1,135 @@
/*
* CustomTagGenerator.java
*
* Created on February 6, 2006, 1:08 AM
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.rometools.feed.module.base.io;
import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.base.CustomTag;
import org.rometools.feed.module.base.CustomTagImpl;
import org.rometools.feed.module.base.CustomTags;
import org.rometools.feed.module.base.types.DateTimeRange;
import org.rometools.feed.module.base.types.FloatUnit;
import org.rometools.feed.module.base.types.IntUnit;
import org.rometools.feed.module.base.types.ShortDate;
import com.sun.syndication.io.ModuleGenerator;
import org.jdom.Element;
import java.net.URL;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
/**
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class CustomTagGenerator implements ModuleGenerator {
static final HashSet NAMESPACES = new HashSet();
static {
NAMESPACES.add(CustomTagParser.NS);
}
/** Creates a new instance of CustomTagGenerator */
public CustomTagGenerator() {
}
public String getNamespaceUri() {
return CustomTags.URI;
}
public java.util.Set getNamespaces() {
return NAMESPACES;
}
public void generate(Module module,Element element) {
if(!(module instanceof CustomTags)) {
return;
}
List tags = ((CustomTags)module).getValues();
Iterator it = tags.iterator();
while(it.hasNext()) {
CustomTag tag = (CustomTag)it.next();
if(tag.getValue() instanceof DateTimeRange) {
DateTimeRange dtr = (DateTimeRange)tag.getValue();
Element newTag = new Element(tag.getName(),CustomTagParser.NS);
newTag.setAttribute("type","dateTimeRange");
newTag.addContent(this.generateSimpleElement("start",GoogleBaseParser.LONG_DT_FMT.format(dtr.getStart())));
newTag.addContent(this.generateSimpleElement("end",GoogleBaseParser.LONG_DT_FMT.format(dtr.getEnd())));
element.addContent(newTag);
} else if(tag.getValue() instanceof ShortDate) {
ShortDate sd = (ShortDate)tag.getValue();
Element newTag = this.generateSimpleElement(tag.getName(),GoogleBaseParser.SHORT_DT_FMT.format(sd));
newTag.setAttribute("type","date");
element.addContent(newTag);
} else if(tag.getValue() instanceof Date) {
Date d = (Date)tag.getValue();
Element newTag = this.generateSimpleElement(tag.getName(),GoogleBaseParser.SHORT_DT_FMT.format(d));
newTag.setAttribute("type","dateTime");
element.addContent(newTag);
} else if(tag.getValue() instanceof Integer) {
Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
newTag.setAttribute("type","int");
element.addContent(newTag);
} else if(tag.getValue() instanceof IntUnit) {
Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
newTag.setAttribute("type","intUnit");
element.addContent(newTag);
} else if(tag.getValue() instanceof Float) {
Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
newTag.setAttribute("type","float");
element.addContent(newTag);
} else if(tag.getValue() instanceof FloatUnit) {
Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
newTag.setAttribute("type","floatUnit");
element.addContent(newTag);
} else if(tag.getValue() instanceof String) {
Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
newTag.setAttribute("type","string");
element.addContent(newTag);
} else if(tag.getValue() instanceof URL) {
Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
newTag.setAttribute("type","url");
element.addContent(newTag);
} else if(tag.getValue() instanceof Boolean) {
Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
newTag.setAttribute("type","boolean");
element.addContent(newTag);
} else if( tag.getValue() instanceof CustomTagImpl.Location ){
Element newTag = this.generateSimpleElement(tag.getName(),tag.getValue().toString());
newTag.setAttribute("type","location");
element.addContent(newTag);
}
}
}
protected Element generateSimpleElement(String name,String value) {
Element element = new Element(name,CustomTagParser.NS);
element.addContent(value);
return element;
}
}

View file

@ -0,0 +1,122 @@
/*
* CustomTagParser.java
*
* Created on February 6, 2006, 12:40 AM
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.rometools.feed.module.base.io;
import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.base.CustomTagImpl;
import org.rometools.feed.module.base.CustomTags;
import org.rometools.feed.module.base.CustomTagsImpl;
import org.rometools.feed.module.base.types.DateTimeRange;
import org.rometools.feed.module.base.types.FloatUnit;
import org.rometools.feed.module.base.types.IntUnit;
import org.rometools.feed.module.base.types.ShortDate;
import com.sun.syndication.io.ModuleParser;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jdom.Element;
import org.jdom.Namespace;
/**
* @version $Revision: 1.4 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class CustomTagParser implements ModuleParser {
private static final Logger log = Logger.getAnonymousLogger();
static final Namespace NS = Namespace.getNamespace( "g-custom", CustomTags.URI );
/** Creates a new instance of CustomTagParser */
public CustomTagParser() {
}
public Module parse(Element element) {
CustomTags module = new CustomTagsImpl();
ArrayList tags = new ArrayList();
List elements = element.getChildren();
Iterator it = elements.iterator();
while( it.hasNext() ){
Element child = (Element) it.next();
if( child.getNamespace().equals( NS ) ){
String type = child.getAttributeValue( "type" );
try{
if( type == null ){
continue;
} else if( type.equals( "string") ){
tags.add( new CustomTagImpl( child.getName(), child.getText() ) );
} else if( type.equals( "int") ){
tags.add( new CustomTagImpl( child.getName(), new Integer( child.getTextTrim() )));
} else if( type.equals( "float") ){
tags.add( new CustomTagImpl( child.getName(), new Float( child.getTextTrim() ) ) );
} else if( type.equals("intUnit") ){
tags.add( new CustomTagImpl( child.getName(), new IntUnit( child.getTextTrim()) ) );
} else if( type.equals( "floatUnit") ){
tags.add( new CustomTagImpl( child.getName(), new FloatUnit( child.getTextTrim()) ) );
} else if( type.equals( "date") ){
try{
tags.add( new CustomTagImpl( child.getName(), new ShortDate( GoogleBaseParser.SHORT_DT_FMT.parse( child.getTextTrim()))) );
} catch( ParseException e ){
log.log( Level.WARNING, "Unable to parse date type on "+child.getName(), e );
}
} else if( type.equals( "dateTime") ){
try{
tags.add( new CustomTagImpl( child.getName(), GoogleBaseParser.LONG_DT_FMT.parse( child.getTextTrim() )));
} catch(ParseException e){
log.log( Level.WARNING, "Unable to parse date type on "+child.getName(), e );
}
} else if( type.equals( "dateTimeRange") ){
try{
tags.add( new CustomTagImpl( child.getName(), new DateTimeRange(GoogleBaseParser.LONG_DT_FMT.parse(child.getChild("start",CustomTagParser.NS).getText().trim()),GoogleBaseParser.LONG_DT_FMT.parse(child.getChild("end",CustomTagParser.NS).getText().trim()))));
} catch(Exception e){
log.log( Level.WARNING, "Unable to parse date type on "+child.getName(), e );
}
} else if( type.equals( "url") ){
try{
tags.add( new CustomTagImpl( child.getName(), new URL( child.getTextTrim() )) );
} catch( MalformedURLException e){
log.log( Level.WARNING, "Unable to parse URL type on "+child.getName(), e );
}
} else if( type.equals( "boolean") ){
tags.add( new CustomTagImpl( child.getName(), new Boolean( child.getTextTrim().toLowerCase()) ));
} else if( type.equals( "location") ) {
tags.add( new CustomTagImpl( child.getName(), new CustomTagImpl.Location( child.getText() )));
} else {
throw new Exception( "Unknown type: "+ type );
}
} catch(Exception e){
log.log( Level.WARNING, "Unable to parse type on "+child.getName(), e );
}
}
}
module.setValues( tags );
return module;
}
public String getNamespaceUri() {
return CustomTags.URI;
}
}

View file

@ -0,0 +1,166 @@
/*
* GoogleBaseGenerator.java
*
* Created on November 17, 2005, 2:46 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.io;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
import org.rometools.feed.module.base.GoogleBase;
import org.rometools.feed.module.base.GoogleBaseImpl;
import org.rometools.feed.module.base.types.CurrencyEnumeration;
import org.rometools.feed.module.base.types.DateTimeRange;
import org.rometools.feed.module.base.types.FloatUnit;
import org.rometools.feed.module.base.types.GenderEnumeration;
import org.rometools.feed.module.base.types.IntUnit;
import org.rometools.feed.module.base.types.PaymentTypeEnumeration;
import org.rometools.feed.module.base.types.PriceTypeEnumeration;
import org.rometools.feed.module.base.types.ShippingType;
import org.rometools.feed.module.base.types.ShortDate;
import org.rometools.feed.module.base.types.Size;
import org.rometools.feed.module.base.types.YearType;
import org.jdom.Element;
import org.jdom.Namespace;
import java.beans.PropertyDescriptor;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
/**
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper
* @version $Revision: 1.1 $
*/
public class GoogleBaseGenerator implements ModuleGenerator {
private static final Namespace NS = Namespace.getNamespace("g-core",GoogleBase.URI);
/** Creates a new instance of GoogleBaseGenerator */
public GoogleBaseGenerator() {
super();
}
public String getNamespaceUri() {
return GoogleBase.URI;
}
public Set getNamespaces() {
HashSet set = new HashSet();
set.add(GoogleBaseGenerator.NS);
return set;
}
public void generate(Module module,Element element) {
GoogleBaseImpl mod = (GoogleBaseImpl)module;
HashMap props2tags = new HashMap(GoogleBaseParser.PROPS2TAGS);
PropertyDescriptor[] pds = GoogleBaseParser.pds;
for(int i = 0; i < pds.length; i++) {
String tagName = (String)props2tags.get(pds[i].getName());
if(tagName == null) {
continue;
}
Object[] values = null;
try {
if(pds[i].getPropertyType().isArray()) {
values = (Object[])pds[i].getReadMethod().invoke(mod,(Object[])null);
} else {
values = new Object[] {
pds[i].getReadMethod().invoke(mod,(Object[])null)
};
}
for(int j = 0; (values != null)&&(j < values.length); j++) {
if(values[j] != null) {
element.addContent(this.generateTag(values[j],tagName));
}
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
public Element generateTag(Object o,String tagName) {
if(o instanceof URL||o instanceof Float||o instanceof Boolean||o instanceof Integer||o instanceof String||o instanceof FloatUnit||o instanceof IntUnit||o instanceof GenderEnumeration||o instanceof PaymentTypeEnumeration||o instanceof PriceTypeEnumeration||o instanceof CurrencyEnumeration||o instanceof Size||o instanceof YearType) {
return this.generateSimpleElement(tagName,o.toString());
} else if(o instanceof ShortDate) {
return this.generateSimpleElement(tagName,GoogleBaseParser.SHORT_DT_FMT.format(o));
} else if(o instanceof Date) {
return this.generateSimpleElement(tagName,GoogleBaseParser.LONG_DT_FMT.format(o));
} else if(o instanceof ShippingType) {
ShippingType st = (ShippingType)o;
Element element = new Element(tagName,GoogleBaseGenerator.NS);
element.addContent(this.generateSimpleElement("country",st.getCountry()));
element.addContent(this.generateSimpleElement("service", st.getService().toString() ));
element.addContent(this.generateSimpleElement("price",st.getPrice().toString()));
return element;
} else if(o instanceof DateTimeRange) {
DateTimeRange dtr = (DateTimeRange)o;
Element element = new Element(tagName,GoogleBaseGenerator.NS);
element.addContent(this.generateSimpleElement("start",GoogleBaseParser.LONG_DT_FMT.format(dtr.getStart())));
element.addContent(this.generateSimpleElement("end",GoogleBaseParser.LONG_DT_FMT.format(dtr.getEnd())));
return element;
}
throw new RuntimeException("Unknown class type to handle: " + o.getClass().getName());
}
protected Element generateSimpleElement(String name,String value) {
Element element = new Element(name,GoogleBaseGenerator.NS);
element.addContent(value);
return element;
}
}

View file

@ -0,0 +1,245 @@
/*
* GoogleBaseParser.java
*
* Created on November 17, 2005, 11:31 AM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.io;
import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.base.GoogleBase;
import org.rometools.feed.module.base.GoogleBaseImpl;
import com.sun.syndication.io.ModuleParser;
import org.rometools.feed.module.base.types.CurrencyEnumeration;
import org.rometools.feed.module.base.types.DateTimeRange;
import org.rometools.feed.module.base.types.FloatUnit;
import org.rometools.feed.module.base.types.GenderEnumeration;
import org.rometools.feed.module.base.types.IntUnit;
import org.rometools.feed.module.base.types.PaymentTypeEnumeration;
import org.rometools.feed.module.base.types.PriceTypeEnumeration;
import org.rometools.feed.module.base.types.ShippingType;
import org.rometools.feed.module.base.types.Size;
import org.rometools.feed.module.base.types.YearType;
import org.jdom.Element;
import org.jdom.Namespace;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.IOException;
import java.lang.reflect.Array;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* DOCUMENT ME!
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet"
* Cooper</a>
* @version $Revision: 1.3 $
*/
public class GoogleBaseParser implements ModuleParser {
private static final Logger log = Logger.getAnonymousLogger();
public static final char[] INTEGER_CHARS = "-1234567890".toCharArray();
public static final char[] FLOAT_CHARS = "-1234567890.".toCharArray();
public static final SimpleDateFormat SHORT_DT_FMT = new SimpleDateFormat("yyyy-MM-dd");
public static final SimpleDateFormat LONG_DT_FMT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
static final Namespace NS = Namespace.getNamespace(GoogleBase.URI);
static final Properties PROPS2TAGS = new Properties();
static PropertyDescriptor[] pds = null;
static {
try {
pds = Introspector.getBeanInfo(GoogleBaseImpl.class).getPropertyDescriptors();
PROPS2TAGS.load(GoogleBaseParser.class.getResourceAsStream("/org/rometools/feed/module/base/io/tags.properties"));
} catch(IOException e) {
e.printStackTrace();
log.log(Level.SEVERE,"Unable to read properties file for Google Base tags!",e);
} catch(IntrospectionException e) {
e.printStackTrace();
log.log(Level.SEVERE,"Unable to get property descriptors for GoogleBaseImpl!",e);
}
}
/**
* Creates a new instance of GoogleBaseParser
*/
public GoogleBaseParser() {
super();
}
public Module parse(Element element) {
HashMap tag2pd = new HashMap();
GoogleBaseImpl module = new GoogleBaseImpl();
try {
for(int i = 0; i < pds.length; i++) {
PropertyDescriptor pd = pds[i];
String tagName = GoogleBaseParser.PROPS2TAGS.getProperty(pd.getName());
if(tagName == null) {
log.log(Level.FINE,"Property: " + pd.getName() + " doesn't have a tag mapping. ");
} else {
tag2pd.put(tagName,pd);
}
}
} catch(Exception e) {
throw new RuntimeException("Exception building tag to property mapping. ",e);
}
List children = element.getChildren();
Iterator it = children.iterator();
while(it.hasNext()) {
Element child = (Element)it.next();
if(child.getNamespace().equals(GoogleBaseParser.NS)) {
PropertyDescriptor pd = (PropertyDescriptor)tag2pd.get(child.getName());
if(pd != null) {
try {
this.handleTag(child,pd,module);
} catch(Exception e) {
log.log(Level.WARNING,"Unable to handle tag: " + child.getName(),e);
e.printStackTrace();
}
}
}
}
return module;
}
public static String stripNonValidCharacters(char[] validCharacters,String input) {
StringBuffer newString = new StringBuffer();
for(int i = 0; i < input.length(); i++) {
for(int j = 0; j < validCharacters.length; j++) {
if(input.charAt(i) == validCharacters[j]) {
newString.append(validCharacters[j]);
}
}
}
return newString.toString();
}
public String getNamespaceUri() {
return GoogleBase.URI;
}
private void handleTag(Element tag,PropertyDescriptor pd,GoogleBase module) throws Exception {
Object tagValue = null;
if((pd.getPropertyType() == Integer.class)||(pd.getPropertyType().getComponentType() == Integer.class)) {
tagValue = new Integer(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.INTEGER_CHARS,tag.getText()));
} else if((pd.getPropertyType() == Float.class)||(pd.getPropertyType().getComponentType() == Float.class)) {
tagValue = new Float(GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.FLOAT_CHARS,tag.getText()));
} else if((pd.getPropertyType() == String.class)||(pd.getPropertyType().getComponentType() == String.class)) {
tagValue = tag.getText();
} else if((pd.getPropertyType() == URL.class)||(pd.getPropertyType().getComponentType() == URL.class)) {
tagValue = new URL(tag.getText().trim());
} else if((pd.getPropertyType() == Boolean.class)||(pd.getPropertyType().getComponentType() == Boolean.class)) {
tagValue = new Boolean(tag.getText().trim());
} else if((pd.getPropertyType() == Date.class)||(pd.getPropertyType().getComponentType() == Date.class)) {
String text = tag.getText().trim();
if(text.length() > 10) {
tagValue = GoogleBaseParser.LONG_DT_FMT.parse(text);
} else {
tagValue = GoogleBaseParser.SHORT_DT_FMT.parse(text);
}
} else if((pd.getPropertyType() == IntUnit.class)||(pd.getPropertyType().getComponentType() == IntUnit.class)) {
tagValue = new IntUnit(tag.getText());
} else if((pd.getPropertyType() == FloatUnit.class)||(pd.getPropertyType().getComponentType() == FloatUnit.class)) {
tagValue = new FloatUnit(tag.getText());
} else if((pd.getPropertyType() == DateTimeRange.class)||(pd.getPropertyType().getComponentType() == DateTimeRange.class)) {
tagValue = new DateTimeRange(LONG_DT_FMT.parse(tag.getChild("start",GoogleBaseParser.NS).getText().trim()),LONG_DT_FMT.parse(tag.getChild("end",GoogleBaseParser.NS).getText().trim()));
} else if((pd.getPropertyType() == ShippingType.class)||(pd.getPropertyType().getComponentType() == ShippingType.class)) {
FloatUnit price = new FloatUnit(tag.getChild("price",GoogleBaseParser.NS).getText().trim());
ShippingType.ServiceEnumeration service = ShippingType.ServiceEnumeration.findByValue(tag.getChild("service",GoogleBaseParser.NS).getText().trim());
if(service == null) {
service = ShippingType.ServiceEnumeration.STANDARD;
}
String country = tag.getChild("country",GoogleBaseParser.NS).getText().trim();
tagValue = new ShippingType(price,service,country);
} else if((pd.getPropertyType() == PaymentTypeEnumeration.class)||(pd.getPropertyType().getComponentType() == PaymentTypeEnumeration.class)) {
tagValue = PaymentTypeEnumeration.findByValue(tag.getText().trim());
} else if((pd.getPropertyType() == PriceTypeEnumeration.class)||(pd.getPropertyType().getComponentType() == PriceTypeEnumeration.class)) {
tagValue = PriceTypeEnumeration.findByValue(tag.getText().trim());
} else if((pd.getPropertyType() == CurrencyEnumeration.class)||(pd.getPropertyType().getComponentType() == CurrencyEnumeration.class)) {
tagValue = CurrencyEnumeration.findByValue(tag.getText().trim());
} else if((pd.getPropertyType() == GenderEnumeration.class)||(pd.getPropertyType().getComponentType() == GenderEnumeration.class)) {
tagValue = GenderEnumeration.findByValue(tag.getText().trim());
} else if((pd.getPropertyType() == YearType.class)||(pd.getPropertyType().getComponentType() == YearType.class)) {
tagValue = new YearType(tag.getText().trim());
} else if((pd.getPropertyType() == Size.class)||(pd.getPropertyType().getComponentType() == Size.class)) {
tagValue = new Size(tag.getText().trim());
}
if(!pd.getPropertyType().isArray()) {
pd.getWriteMethod().invoke(module,new Object[] {tagValue});
} else {
Object[] current = (Object[])pd.getReadMethod().invoke(module,(Object[])null);
int newSize = (current == null) ? 1 : (current.length + 1);
Object setValue = Array.newInstance(pd.getPropertyType().getComponentType(),newSize);
int i = 0;
for(; (current != null)&&(i < current.length); i++) {
Array.set(setValue,i,current[i]);
}
Array.set(setValue,i,tagValue);
pd.getWriteMethod().invoke(module,new Object[] {setValue});
}
}
}

View file

@ -0,0 +1,72 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
This is the base package for the Google Base ROME module.
<p>This package contains the core module interface <code>GoogleBase</code>,
as well as the implementation class <code>GoogleBaseImpl</code>. If you want
to work with a specific type of Google Base entry, you can cast it to a
specific item type interface, such as <code>Vehicle</code>.</p>
<p>Sample Useage:
<pre>
SyndEntry entry = new SyndEntryImpl();
// set up the entry...
Vehicle vehicle = new GoogleBaseImpl();
vehicle.setMake("Honda");
vehicle.setModel("Insight");
vehicle.setYear( new Year("2000"));
List modules = new ArrayList();
modules.add( vehicle );
entry.setModules( modules );
//Optionally, to get Google Base information from a Feed:
Article article = entry.getModule( "http://base.google.com/ns/1.0" );
System.out.println( article.getPages() );
</pre>
</p>
<p>Google Base is a trademark of Google, Inc. The authors of this software
are not affiliated with Google, Inc. and Google does not endorse, support,
blah blah blah.
</p>
<pre>
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
</pre>
</body>
</html>

View file

@ -0,0 +1,50 @@
/*
* CloneableType.java
*
* Created on November 18, 2005, 10:42 AM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
/**
* This is just a holder interface for cloneable elements.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public interface CloneableType extends Cloneable {
public Object clone();
}

View file

@ -0,0 +1,599 @@
/*
* CurrencyEnumeration.java
*
* Created on November 18, 2005, 11:33 AM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
import java.util.HashMap;
/**
* An Enumeration of valid currency types.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public class CurrencyEnumeration {
private static final HashMap lookup = new HashMap();
//<xs:restriction base="xs:string">
// <xs:enumeration value="AED"/>
public static final CurrencyEnumeration AED = new CurrencyEnumeration("AED");
// <xs:enumeration value="AFA"/>
public static final CurrencyEnumeration AFA = new CurrencyEnumeration("AFA");
// <xs:enumeration value="ALL"/>
public static final CurrencyEnumeration ALL = new CurrencyEnumeration("ALL");
// <xs:enumeration value="AMD"/>
public static final CurrencyEnumeration AMD = new CurrencyEnumeration("AMD");
// <xs:enumeration value="ANG"/>
public static final CurrencyEnumeration ANG = new CurrencyEnumeration("ANG");
// <xs:enumeration value="AOA"/>
public static final CurrencyEnumeration AOA = new CurrencyEnumeration("AOA");
// <xs:enumeration value="ARS"/>
public static final CurrencyEnumeration ARS = new CurrencyEnumeration("ARS");
// <xs:enumeration value="AUD"/>
public static final CurrencyEnumeration AUD = new CurrencyEnumeration("AUD");
// <xs:enumeration value="AWG"/>
public static final CurrencyEnumeration AWG = new CurrencyEnumeration("AWG");
// <xs:enumeration value="AZM"/>
public static final CurrencyEnumeration AZM = new CurrencyEnumeration("AZM");
// <xs:enumeration value="BAM"/>
public static final CurrencyEnumeration BAM = new CurrencyEnumeration("BAM");
// <xs:enumeration value="BBD"/>
public static final CurrencyEnumeration BBD = new CurrencyEnumeration("BBD");
// <xs:enumeration value="BDT"/>
public static final CurrencyEnumeration BDT = new CurrencyEnumeration("BDT");
// <xs:enumeration value="BGN"/>
public static final CurrencyEnumeration BGN = new CurrencyEnumeration("BGN");
// <xs:enumeration value="BHD"/>
public static final CurrencyEnumeration BHD = new CurrencyEnumeration("BHD");
// <xs:enumeration value="BIF"/>
public static final CurrencyEnumeration BIF = new CurrencyEnumeration("BIF");
// <xs:enumeration value="BMD"/>
public static final CurrencyEnumeration BMD = new CurrencyEnumeration("BMD");
// <xs:enumeration value="BND"/>
public static final CurrencyEnumeration BND = new CurrencyEnumeration("BND");
// <xs:enumeration value="BOB"/>
public static final CurrencyEnumeration BOB = new CurrencyEnumeration("BOB");
// <xs:enumeration value="BRL"/>
public static final CurrencyEnumeration BRL = new CurrencyEnumeration("BRL");
// <xs:enumeration value="BSD"/>
public static final CurrencyEnumeration BSD = new CurrencyEnumeration("BSD");
// <xs:enumeration value="BTN"/>
public static final CurrencyEnumeration BTN = new CurrencyEnumeration("BTN");
// <xs:enumeration value="BWP"/>
public static final CurrencyEnumeration BWP = new CurrencyEnumeration("BWP");
// <xs:enumeration value="BYR"/>
public static final CurrencyEnumeration BYR = new CurrencyEnumeration("BYR");
// <xs:enumeration value="BZD"/>
public static final CurrencyEnumeration BZD = new CurrencyEnumeration("BZD");
// <xs:enumeration value="CAD"/>
public static final CurrencyEnumeration CAD = new CurrencyEnumeration("CAD");
// <xs:enumeration value="CDF"/>
public static final CurrencyEnumeration CDF = new CurrencyEnumeration("CDF");
// <xs:enumeration value="CHF"/>
public static final CurrencyEnumeration CHF = new CurrencyEnumeration("CHF");
// <xs:enumeration value="CLP"/>
public static final CurrencyEnumeration CLP = new CurrencyEnumeration("CLP");
// <xs:enumeration value="CNY"/>
public static final CurrencyEnumeration CNY = new CurrencyEnumeration("CNY");
// <xs:enumeration value="CRC"/>
public static final CurrencyEnumeration CRC = new CurrencyEnumeration("CRC");
// <xs:enumeration value="CSD"/>
public static final CurrencyEnumeration CSD = new CurrencyEnumeration("CSD");
// <xs:enumeration value="CUP"/>
public static final CurrencyEnumeration CUP = new CurrencyEnumeration("CUP");
// <xs:enumeration value="CVE"/>
public static final CurrencyEnumeration CVE = new CurrencyEnumeration("CVE");
// <xs:enumeration value="CYP"/>
public static final CurrencyEnumeration CYP = new CurrencyEnumeration("CYP");
// <xs:enumeration value="CZK"/>
public static final CurrencyEnumeration CZK = new CurrencyEnumeration("CZK");
// <xs:enumeration value="DJF"/>
public static final CurrencyEnumeration DJF = new CurrencyEnumeration("DJF");
// <xs:enumeration value="DKK"/>
public static final CurrencyEnumeration DKK = new CurrencyEnumeration("DKK");
// <xs:enumeration value="DOP"/>
public static final CurrencyEnumeration DOP = new CurrencyEnumeration("DOP");
// <xs:enumeration value="DZD"/>
public static final CurrencyEnumeration DZD = new CurrencyEnumeration("DZD");
// <xs:enumeration value="EEK"/>
public static final CurrencyEnumeration EEK = new CurrencyEnumeration("EEK");
// <xs:enumeration value="EGP"/>
public static final CurrencyEnumeration EGP = new CurrencyEnumeration("EGP");
// <xs:enumeration value="ERN"/>
public static final CurrencyEnumeration ERN = new CurrencyEnumeration("ERN");
// <xs:enumeration value="ETB"/>
public static final CurrencyEnumeration ETB = new CurrencyEnumeration("ETB");
// <xs:enumeration value="EUR"/>
public static final CurrencyEnumeration EUR = new CurrencyEnumeration("EUR");
// <xs:enumeration value="FJD"/>
public static final CurrencyEnumeration FJD = new CurrencyEnumeration("FJD");
// <xs:enumeration value="FKP"/>
public static final CurrencyEnumeration FKP = new CurrencyEnumeration("FKP");
// <xs:enumeration value="GBP"/>
public static final CurrencyEnumeration GBP = new CurrencyEnumeration("GBP");
// <xs:enumeration value="GEL"/>
public static final CurrencyEnumeration GEL = new CurrencyEnumeration("GEL");
// <xs:enumeration value="GGP"/>
public static final CurrencyEnumeration GGP = new CurrencyEnumeration("GGP");
// <xs:enumeration value="GHC"/>
public static final CurrencyEnumeration GHC = new CurrencyEnumeration("GHC");
// <xs:enumeration value="GIP"/>
public static final CurrencyEnumeration GIP = new CurrencyEnumeration("GIP");
// <xs:enumeration value="GMD"/>
public static final CurrencyEnumeration GMD = new CurrencyEnumeration("GMD");
// <xs:enumeration value="GNF"/>
public static final CurrencyEnumeration GNF = new CurrencyEnumeration("GNF");
// <xs:enumeration value="GTQ"/>
public static final CurrencyEnumeration GTQ = new CurrencyEnumeration("GTQ");
// <xs:enumeration value="GYD"/>
public static final CurrencyEnumeration GYD = new CurrencyEnumeration("GYD");
// <xs:enumeration value="HKD"/>
public static final CurrencyEnumeration HKD = new CurrencyEnumeration("HKD");
// <xs:enumeration value="HNL"/>
public static final CurrencyEnumeration HNL = new CurrencyEnumeration("HNL");
// <xs:enumeration value="HRK"/>
public static final CurrencyEnumeration HRK = new CurrencyEnumeration("HRK");
// <xs:enumeration value="HTG"/>
public static final CurrencyEnumeration HTG = new CurrencyEnumeration("HTG");
// <xs:enumeration value="HUF"/>
public static final CurrencyEnumeration HUF = new CurrencyEnumeration("HUF");
// <xs:enumeration value="IDR"/>
public static final CurrencyEnumeration IDR = new CurrencyEnumeration("IDR");
// <xs:enumeration value="ILS"/>
public static final CurrencyEnumeration ILS = new CurrencyEnumeration("ILS");
// <xs:enumeration value="IMP"/>
public static final CurrencyEnumeration IMP = new CurrencyEnumeration("IMP");
// <xs:enumeration value="INR"/>
public static final CurrencyEnumeration INR = new CurrencyEnumeration("INR");
// <xs:enumeration value="IQD"/>
public static final CurrencyEnumeration IQD = new CurrencyEnumeration("IQD");
// <xs:enumeration value="IRR"/>
public static final CurrencyEnumeration IRR = new CurrencyEnumeration("IRR");
// <xs:enumeration value="ISK"/>
public static final CurrencyEnumeration ISK = new CurrencyEnumeration("ISK");
// <xs:enumeration value="JEP"/>
public static final CurrencyEnumeration JEP = new CurrencyEnumeration("JEP");
// <xs:enumeration value="JMD"/>
public static final CurrencyEnumeration JMD = new CurrencyEnumeration("JMD");
// <xs:enumeration value="JOD"/>
public static final CurrencyEnumeration JOD = new CurrencyEnumeration("JOD");
// <xs:enumeration value="JPY"/>
public static final CurrencyEnumeration JPY = new CurrencyEnumeration("JPY");
// <xs:enumeration value="KES"/>
public static final CurrencyEnumeration KES = new CurrencyEnumeration("KES");
// <xs:enumeration value="KGS"/>
public static final CurrencyEnumeration KGS = new CurrencyEnumeration("KGS");
// <xs:enumeration value="KHR"/>
public static final CurrencyEnumeration KHR = new CurrencyEnumeration("KHR");
// <xs:enumeration value="KMF"/>
public static final CurrencyEnumeration KMF = new CurrencyEnumeration("KMF");
// <xs:enumeration value="KPW"/>
public static final CurrencyEnumeration KPW = new CurrencyEnumeration("KPW");
// <xs:enumeration value="KRW"/>
public static final CurrencyEnumeration KRW = new CurrencyEnumeration("KRW");
// <xs:enumeration value="KWD"/>
public static final CurrencyEnumeration KWD = new CurrencyEnumeration("KWD");
// <xs:enumeration value="KYD"/>
public static final CurrencyEnumeration KYD = new CurrencyEnumeration("KYD");
// <xs:enumeration value="KZT"/>
public static final CurrencyEnumeration KZT = new CurrencyEnumeration("KZT");
// <xs:enumeration value="LAK"/>
public static final CurrencyEnumeration LAK = new CurrencyEnumeration("LAK");
// <xs:enumeration value="LBP"/>
public static final CurrencyEnumeration LBP = new CurrencyEnumeration("LBP");
// <xs:enumeration value="LKR"/>
public static final CurrencyEnumeration LKR = new CurrencyEnumeration("LKR");
// <xs:enumeration value="LRD"/>
public static final CurrencyEnumeration LRD = new CurrencyEnumeration("LRD");
// <xs:enumeration value="LSL"/>
public static final CurrencyEnumeration LSL = new CurrencyEnumeration("LSL");
// <xs:enumeration value="LTL"/>
public static final CurrencyEnumeration LTL = new CurrencyEnumeration("LTL");
// <xs:enumeration value="LVL"/>
public static final CurrencyEnumeration LVL = new CurrencyEnumeration("LVL");
// <xs:enumeration value="LYD"/>
public static final CurrencyEnumeration LYD = new CurrencyEnumeration("LYD");
// <xs:enumeration value="MAD"/>
public static final CurrencyEnumeration MAD = new CurrencyEnumeration("MAD");
// <xs:enumeration value="MDL"/>
public static final CurrencyEnumeration MDL = new CurrencyEnumeration("MDL");
// <xs:enumeration value="MGA"/>
public static final CurrencyEnumeration MGA = new CurrencyEnumeration("MGA");
// <xs:enumeration value="MKD"/>
public static final CurrencyEnumeration MKD = new CurrencyEnumeration("MKD");
// <xs:enumeration value="MMK"/>
public static final CurrencyEnumeration MMK = new CurrencyEnumeration("MMK");
// <xs:enumeration value="MNT"/>
public static final CurrencyEnumeration MNT = new CurrencyEnumeration("MNT");
// <xs:enumeration value="MOP"/>
public static final CurrencyEnumeration MOP = new CurrencyEnumeration("MOP");
// <xs:enumeration value="MRO"/>
public static final CurrencyEnumeration MRO = new CurrencyEnumeration("MRO");
// <xs:enumeration value="MTL"/>
public static final CurrencyEnumeration MTL = new CurrencyEnumeration("MTL");
// <xs:enumeration value="MUR"/>
public static final CurrencyEnumeration MUR = new CurrencyEnumeration("MUR");
// <xs:enumeration value="MVR"/>
public static final CurrencyEnumeration MVR = new CurrencyEnumeration("MVR");
// <xs:enumeration value="MWK"/>
public static final CurrencyEnumeration MWK = new CurrencyEnumeration("MWK");
// <xs:enumeration value="MXN"/>
public static final CurrencyEnumeration MXN = new CurrencyEnumeration("MXN");
// <xs:enumeration value="MYR"/>
public static final CurrencyEnumeration MYR = new CurrencyEnumeration("MYR");
// <xs:enumeration value="MZM"/>
public static final CurrencyEnumeration MZM = new CurrencyEnumeration("MZM");
// <xs:enumeration value="NAD"/>
public static final CurrencyEnumeration NAD = new CurrencyEnumeration("NAD");
// <xs:enumeration value="NGN"/>
public static final CurrencyEnumeration NGN = new CurrencyEnumeration("NGN");
// <xs:enumeration value="NIO"/>
public static final CurrencyEnumeration NIO = new CurrencyEnumeration("NIO");
// <xs:enumeration value="NOK"/>
public static final CurrencyEnumeration NOK = new CurrencyEnumeration("NOK");
// <xs:enumeration value="NPR"/>
public static final CurrencyEnumeration NPR = new CurrencyEnumeration("NPR");
// <xs:enumeration value="NZD"/>
public static final CurrencyEnumeration NZD = new CurrencyEnumeration("NZD");
// <xs:enumeration value="OMR"/>
public static final CurrencyEnumeration OMR = new CurrencyEnumeration("OMR");
// <xs:enumeration value="PAB"/>
public static final CurrencyEnumeration PAB = new CurrencyEnumeration("PAB");
// <xs:enumeration value="PEN"/>
public static final CurrencyEnumeration PEN = new CurrencyEnumeration("PEN");
// <xs:enumeration value="PGK"/>
public static final CurrencyEnumeration PGK = new CurrencyEnumeration("PGK");
// <xs:enumeration value="PHP"/>
public static final CurrencyEnumeration PHP = new CurrencyEnumeration("PHP");
// <xs:enumeration value="PKR"/>
public static final CurrencyEnumeration PKR = new CurrencyEnumeration("PKR");
// <xs:enumeration value="PLN"/>
public static final CurrencyEnumeration PLN = new CurrencyEnumeration("PLN");
// <xs:enumeration value="PYG"/>
public static final CurrencyEnumeration PYG = new CurrencyEnumeration("PYG");
// <xs:enumeration value="QAR"/>
public static final CurrencyEnumeration QAR = new CurrencyEnumeration("QAR");
// <xs:enumeration value="RON"/>
public static final CurrencyEnumeration RON = new CurrencyEnumeration("RON");
// <xs:enumeration value="RUB"/>
public static final CurrencyEnumeration RUB = new CurrencyEnumeration("RUB");
// <xs:enumeration value="RWF"/>
public static final CurrencyEnumeration RWF = new CurrencyEnumeration("MOP");
// <xs:enumeration value="SAR"/>
public static final CurrencyEnumeration SAR = new CurrencyEnumeration("SAR");
// <xs:enumeration value="SBD"/>
public static final CurrencyEnumeration SBD = new CurrencyEnumeration("SBD");
// <xs:enumeration value="SCR"/>
public static final CurrencyEnumeration SCR = new CurrencyEnumeration("SCR");
// <xs:enumeration value="SDD"/>
public static final CurrencyEnumeration SDD = new CurrencyEnumeration("SDD");
// <xs:enumeration value="SEK"/>
public static final CurrencyEnumeration SEK = new CurrencyEnumeration("SEK");
// <xs:enumeration value="SGD"/>
public static final CurrencyEnumeration SGD = new CurrencyEnumeration("SGD");
// <xs:enumeration value="SHP"/>
public static final CurrencyEnumeration SHP = new CurrencyEnumeration("SHP");
// <xs:enumeration value="SIT"/>
public static final CurrencyEnumeration SIT = new CurrencyEnumeration("SIT");
// <xs:enumeration value="SKK"/>
public static final CurrencyEnumeration SKK = new CurrencyEnumeration("SKK");
// <xs:enumeration value="SLL"/>
public static final CurrencyEnumeration SLL = new CurrencyEnumeration("SLL");
// <xs:enumeration value="SOS"/>
public static final CurrencyEnumeration SOS = new CurrencyEnumeration("SOS");
// <xs:enumeration value="SPL"/>
public static final CurrencyEnumeration SPL = new CurrencyEnumeration("SPL");
// <xs:enumeration value="SRD"/>
public static final CurrencyEnumeration SRD = new CurrencyEnumeration("SRD");
// <xs:enumeration value="STD"/>
public static final CurrencyEnumeration STD = new CurrencyEnumeration("STD");
// <xs:enumeration value="SVC"/>
public static final CurrencyEnumeration SVC = new CurrencyEnumeration("SVC");
// <xs:enumeration value="SYP"/>
public static final CurrencyEnumeration SYP = new CurrencyEnumeration("SYP");
// <xs:enumeration value="SZL"/>
public static final CurrencyEnumeration SZL = new CurrencyEnumeration("SZL");
// <xs:enumeration value="THB"/>
public static final CurrencyEnumeration THB = new CurrencyEnumeration("THB");
// <xs:enumeration value="TJS"/>
public static final CurrencyEnumeration TJS = new CurrencyEnumeration("TJS");
// <xs:enumeration value="TMM"/>
public static final CurrencyEnumeration TMM = new CurrencyEnumeration("TMM");
// <xs:enumeration value="TND"/>
public static final CurrencyEnumeration TND = new CurrencyEnumeration("TND");
// <xs:enumeration value="TOP"/>
public static final CurrencyEnumeration TOP = new CurrencyEnumeration("TOP");
// <xs:enumeration value="TRL"/>
public static final CurrencyEnumeration TRL = new CurrencyEnumeration("TRL");
// <xs:enumeration value="TRY"/>
public static final CurrencyEnumeration TRY = new CurrencyEnumeration("TRY");
// <xs:enumeration value="TTD"/>
public static final CurrencyEnumeration TTD = new CurrencyEnumeration("TTD");
// <xs:enumeration value="TVD"/>
public static final CurrencyEnumeration TVD = new CurrencyEnumeration("TVD");
// <xs:enumeration value="TWD"/>
public static final CurrencyEnumeration TWD = new CurrencyEnumeration("TWD");
// <xs:enumeration value="TZS"/>
public static final CurrencyEnumeration TZS = new CurrencyEnumeration("TZS");
// <xs:enumeration value="UAH"/>
public static final CurrencyEnumeration UAH = new CurrencyEnumeration("UAH");
// <xs:enumeration value="UGX"/>
public static final CurrencyEnumeration UGX = new CurrencyEnumeration("UGX");
// <xs:enumeration value="USD"/>
public static final CurrencyEnumeration USD = new CurrencyEnumeration("USD");
// <xs:enumeration value="UYU"/>
public static final CurrencyEnumeration UYU = new CurrencyEnumeration("UYU");
// <xs:enumeration value="UZS"/>
public static final CurrencyEnumeration UZS = new CurrencyEnumeration("UZS");
// <xs:enumeration value="VEB"/>
public static final CurrencyEnumeration VEB = new CurrencyEnumeration("VEB");
// <xs:enumeration value="VND"/>
public static final CurrencyEnumeration VND = new CurrencyEnumeration("VND");
// <xs:enumeration value="VUV"/>
public static final CurrencyEnumeration VUV = new CurrencyEnumeration("VUV");
// <xs:enumeration value="WST"/>
public static final CurrencyEnumeration WST = new CurrencyEnumeration("WST");
// <xs:enumeration value="XAF"/>
public static final CurrencyEnumeration XAF = new CurrencyEnumeration("XAF");
// <xs:enumeration value="XAG"/>
public static final CurrencyEnumeration XAG = new CurrencyEnumeration("XAG");
// <xs:enumeration value="XAU"/>
public static final CurrencyEnumeration XAU = new CurrencyEnumeration("XAU");
// <xs:enumeration value="XCD"/>
public static final CurrencyEnumeration XCD = new CurrencyEnumeration("XCD");
// <xs:enumeration value="XDR"/>
public static final CurrencyEnumeration XDR = new CurrencyEnumeration("XDR");
// <xs:enumeration value="XOF"/>
public static final CurrencyEnumeration XOF = new CurrencyEnumeration("XOF");
// <xs:enumeration value="XPD"/>
public static final CurrencyEnumeration XPD = new CurrencyEnumeration("XPD");
// <xs:enumeration value="XPF"/>
public static final CurrencyEnumeration XPF = new CurrencyEnumeration("XPF");
// <xs:enumeration value="XPT"/>
public static final CurrencyEnumeration XPT = new CurrencyEnumeration("XPT");
// <xs:enumeration value="YER"/>
public static final CurrencyEnumeration YER = new CurrencyEnumeration("YER");
// <xs:enumeration value="ZAR"/>
public static final CurrencyEnumeration ZAR = new CurrencyEnumeration("ZAR");
// <xs:enumeration value="ZMK"/>
public static final CurrencyEnumeration ZMK = new CurrencyEnumeration("ZMK");
// <xs:enumeration value="ZWD"/>
public static final CurrencyEnumeration ZWD = new CurrencyEnumeration("ZWD");
//</xs:restriction>
private String value;
/**
* Creates a new instance of CurrencyEnumeration
*
* @param value DOCUMENT ME!
*/
private CurrencyEnumeration(String value) {
this.value = value;
lookup.put(value,this);
}
public String getValue() {
return this.value;
}
public Object clone() {
return this;
}
public static CurrencyEnumeration findByValue(String value) {
return (CurrencyEnumeration)lookup.get(value.trim().toUpperCase());
}
public String toString() {
return value;
}
}

View file

@ -0,0 +1,127 @@
/*
* DateTimeRange.java
*
* Created on November 16, 2005, 11:14 AM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
import java.util.Date;
/** Represents a time range.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public class DateTimeRange implements CloneableType {
/**
* end time
*/
private Date end;
/**
* start time
*/
private Date start;
/**
* Creates a new instance of DateTimeRange
* @param start Beginning of the timeframe.
* @param end End of the Timeframe.
*/
public DateTimeRange(Date start, Date end) {
this.start= start;
this.end = end ;
}
/**
* The end of the timeframe.
* @return The end of the timeframe.
*/
public Date getEnd() {
return end;
}
/**
* The beginning of the timeframe.
* @return The beginning of the timeframe.
*/
public Date getStart() {
return start;
}
/**
* Clones the object
* @return Duplicate of this object.
*/
public Object clone() {
DateTimeRange retValue = new DateTimeRange(null, null);
if (this.getStart() != null) {
retValue.start = ((Date) this.getStart().clone());
}
if (this.getEnd() != null) {
retValue.end = ((Date) this.getEnd().clone());
}
return retValue;
}
/**
* String representation of the object.
* @return String representation of the object.
*/
public String toString() {
return "Start: " + this.start + " End: " + this.end;
}
public boolean equals( Object o ){
if( !(o instanceof DateTimeRange ) || o == null )
return false;
DateTimeRange d = (DateTimeRange) o;
if( this.start == d.getStart() && this.end == d.getEnd() ){
return true;
}
if( this.start != null && !this.start.equals( d.getStart()) )
return false;
if( this.end != null && !this.end.equals( d.getEnd()) )
return false;
return true;
}
}

View file

@ -0,0 +1,159 @@
/*
* FloatUnit.java
*
* Created on November 16, 2005, 11:43 AM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
import org.rometools.feed.module.base.io.GoogleBaseParser;
/** This class represents a quantity consisting of a float value and an optional
* units specification.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public class FloatUnit implements CloneableType {
/**
* Units
*/
private String units;
/**
* Float value
*/
private float value;
/**
* Looks for a char in an array
* @param find char to search for
* @param array array to search
* @return boolean indicating presence.
*/
private boolean inCharArray( char find, char[] array ){
for( int i=0; i < array.length; i++ ){
if( find == array[i])
return true;
}
return false;
}
/**
* Creates a new float unit by parsing a String value
* @param source String value to parse
*/
public FloatUnit(String source) {
String parse = source.trim();
int space = -1;
for( int i=0; i < parse.length(); i++ ){
if( !inCharArray( parse.charAt(i), GoogleBaseParser.FLOAT_CHARS ) ){
space = i;
break;
}
}
if (space == -1) {
space = parse.length();
}
this.value = Float.parseFloat(
GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.FLOAT_CHARS, parse.substring(0, space)));
if (space != parse.length()) {
this.units = parse.substring(space, parse.length()).trim();
}
}
/**
* Creates a new instance of FloatUnit
* @param value float value
* @param units Units represented, or null.
*/
public FloatUnit(float value, String units) {
this.value = value;
this.units = units;
}
/**
* Returns the units.
* @return Returns the units.
*/
public String getUnits() {
return units;
}
/**
* Returns the float value.
* @return Returns the float value.
*/
public float getValue() {
return value;
}
/**
* Duplicates the object.
* @return Duplicate FloatUnit
*/
public Object clone() {
return new FloatUnit(0 + this.value, this.units);
}
/**
* Returns a String representation of the object.
* @return Returns a String representation of the object.
*/
public String toString() {
if ((this.units != null) && (this.units.trim().length() > 0)) {
return this.value + " " + this.units;
} else {
return Float.toString(value);
}
}
public boolean equals( Object o ){
if(!(o instanceof FloatUnit) )
return false;
FloatUnit f = (FloatUnit) o;
if( f.getValue() != this.value ){
return false;
}
if( this.units == f.getUnits() || ( this.units != null && this.units.equals( f.getUnits() )) ){
return true;
}
return false;
}
}

View file

@ -0,0 +1,88 @@
/*
* GenderEnumeration.java
*
* Created on November 16, 2005, 2:35 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
/** Simple enumeration for Genders.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public class GenderEnumeration implements CloneableType {
/** Men */
public static final GenderEnumeration MALE = new GenderEnumeration("Male");
/** Women */
public static final GenderEnumeration FEMALE = new GenderEnumeration("Female");
private String value;
private GenderEnumeration(String value) {
this.value = value;
}
/** Returns the proper instance based on the string value */
public static GenderEnumeration findByValue(String value) {
if (value == null) {
return null;
}
String gender = value.toUpperCase();
if (gender.charAt(0) == 'M') {
return GenderEnumeration.MALE;
} else if (gender.charAt(0) == 'F') {
return GenderEnumeration.FEMALE;
} else {
return null;
}
}
/** Returns the value of the instance */
public String getValue() {
return this.value;
}
/** Returns a reference to the same object. :P */
public Object clone() {
return this;
}
public String toString() {
return value;
}
}

View file

@ -0,0 +1,119 @@
/*
* IntUnit.java
*
* Created on November 16, 2005, 12:49 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
import org.rometools.feed.module.base.io.GoogleBaseParser;
/**
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public class IntUnit implements CloneableType {
private String units;
private int value;
private boolean inCharArray( char find, char[] array ){
for( int i=0; i < array.length; i++ ){
if( find == array[i])
return true;
}
return false;
}
public IntUnit(String source) {
String parse = source.trim();
int space = -1;
for( int i=0; i < parse.length(); i++ ){
if( !inCharArray( parse.charAt(i), GoogleBaseParser.INTEGER_CHARS ) ){
space = i;
break;
}
}
if (space == -1) {
space = parse.length();
}
this.value = Integer.parseInt(
GoogleBaseParser.stripNonValidCharacters(GoogleBaseParser.INTEGER_CHARS, parse.substring(0, space)));
if (space != parse.length()) {
this.units = parse.substring(space, parse.length()).trim();
}
}
/** Creates a new instance of IntUnit */
public IntUnit(int value, String units) {
this.value = value;
this.units = units;
}
public String getUnits() {
return units;
}
public int getValue() {
return value;
}
public Object clone() {
return new IntUnit(this.value, this.units);
}
public String toString() {
if ((this.units != null) && (this.units.trim().length() > 0)) {
return this.value + " " + this.units;
} else {
return Integer.toString(value);
}
}
public boolean equals( Object o ){
if(!(o instanceof IntUnit) )
return false;
IntUnit f = (IntUnit) o;
if( f.getValue() != this.value ){
return false;
}
if( this.units == f.getUnits() || ( this.units != null && this.units.equals( f.getUnits() )) ){
return true;
}
return false;
}
}

View file

@ -0,0 +1,83 @@
/*
* PaymentTypeEnumeration.java
*
* Created on November 16, 2005, 11:49 AM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
import java.util.HashMap;
/**
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public class PaymentTypeEnumeration {
private static final HashMap lookup = new HashMap();
public static final PaymentTypeEnumeration CASH = new PaymentTypeEnumeration("Cash");
public static final PaymentTypeEnumeration CHECK = new PaymentTypeEnumeration("Check");
public static final PaymentTypeEnumeration TRAVELERS_CHECK = new PaymentTypeEnumeration("Traveler<EFBFBD>s Check");
public static final PaymentTypeEnumeration VISA = new PaymentTypeEnumeration("Visa");
public static final PaymentTypeEnumeration MASTERCARD = new PaymentTypeEnumeration("MasterCard");
public static final PaymentTypeEnumeration AMERICAN_EXPRESS = new PaymentTypeEnumeration("American Express");
public static final PaymentTypeEnumeration DISCOVER = new PaymentTypeEnumeration("Discover");
public static final PaymentTypeEnumeration WIRE_TRANSFER = new PaymentTypeEnumeration("Wire transfer");
public static final PaymentTypeEnumeration PAYPAL = new PaymentTypeEnumeration("Paypal");
private String value;
/** Creates a new instance of PaymentTypeEnumeration */
private PaymentTypeEnumeration(String value) {
this.value = value;
lookup.put(this.value.toUpperCase(), this);
}
public String getValue() {
return value;
}
public static PaymentTypeEnumeration findByValue(String value) {
return (PaymentTypeEnumeration) lookup.get(value.toUpperCase());
}
public Object clone() {
return this;
}
public String toString() {
return value;
}
}

View file

@ -0,0 +1,107 @@
/*
* PriceTypeEnumeration.java
*
* Created on November 16, 2005, 11:45 AM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
/**
* Enumeration of values suitable for "price_type" or "salary_type".
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public class PriceTypeEnumeration implements CloneableType {
/**
* Indicates the value is a starting value.
*/
public static final PriceTypeEnumeration STARTING = new PriceTypeEnumeration("starting");
/**
* Indicates the value is negotiable
*/
public static final PriceTypeEnumeration NEGOTIABLE = new PriceTypeEnumeration("negotiable");
/**
* String value encapsulated
*/
private String value;
/**
* Creates a new instance of PriceTypeEnumeration
* @param value Value to encapsulate
*/
private PriceTypeEnumeration(String value) {
this.value = value;
}
/**
* Returns the string value of this instance.
* @return Returns the string value of this instance.
*/
public String getValue() {
return value;
}
/**
* Returns a PriceTypeEnumeration based on the String value or null.
* @param value Value to search for.
* @return PriceTypeEnumeration or null.
*/
public static PriceTypeEnumeration findByValue(String value) {
if (value.equalsIgnoreCase("negotiable")) {
return PriceTypeEnumeration.NEGOTIABLE;
} else {
return PriceTypeEnumeration.STARTING;
}
}
/**
* Returns a duplicate of this instance
* @return The same instance.
*/
public Object clone() {
return this;
}
/**
* Returns the string value of this instance.
* @return Returns the string value of this instance.
*/
public String toString() {
return value;
}
}

View file

@ -0,0 +1,182 @@
/*
* ShippingType.java
*
* Created on November 16, 2005, 12:05 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
import java.util.HashMap;
/**
* This class represents a specific shipping option for an item.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public class ShippingType implements CloneableType {
/**
* price of the shipping.
*/
private FloatUnit price;
/**
* Service used.
*/
private ServiceEnumeration service;
/**
* Country to ship to
*/
private String country;
/**
* Creates a new instance of ShippingType
* @param price The price of the shipping option
* @param service Shipping service used.
* @param country Country shipped to.
*/
public ShippingType(FloatUnit price, ServiceEnumeration service, String country) {
this.price = price;
this.service = service;
this.country = country;
}
/**
* Returns the destination country.
* @return Returns the destination country.
*/
public String getCountry() {
return country;
}
/**
* Returns the price of this shipping option.
* @return Returns the price of this shipping option.
*/
public FloatUnit getPrice() {
return price;
}
/**
* Returns the ServiceEnumeration instance for the shipping service used.
* @return Returns the ServiceEnumeration instance for the shipping service used.
*/
public ServiceEnumeration getService() {
return service;
}
/**
* Clones this object.
* @return Duplicate ShippingType object.
*/
public Object clone() {
return new ShippingType(this.price, this.service, this.country);
}
/**
* Returns a String representation of this object.
* @return String representation of this object.
*/
public String toString() {
return this.country + " " + this.price + " " + this.service;
}
public boolean equals( Object o ){
if( !(o instanceof ShippingType))
return false;
if( this.toString().equals( o.toString() ) )
return true;
return false;
}
/**
* Enumeration class of valid options for ServiceType.
*/
public static class ServiceEnumeration {
/**
* Looks up a ServiceEnumeration based on the string value.
*/
private static final HashMap lookup = new HashMap();
/**
* Standard
*/
public static final ServiceEnumeration STANDARD = new ServiceEnumeration("Standard");
/**
* Freight
*/
public static final ServiceEnumeration FREIGHT = new ServiceEnumeration("Freight");
/**
* Overnight
*/
public static final ServiceEnumeration OVERNIGHT = new ServiceEnumeration("Overnight");
/**
* String value
*/
private String value;
/**
* Creates a new instance of ServiceEnumeration.
* @param value String value to encapsulate.
*/
private ServiceEnumeration(String value) {
this.value = value;
lookup.put(this.value.toUpperCase(), this);
}
/**
* String value of this Service.
* @return String value of this Service.
*/
public String getValue() {
return this.value;
}
/**
* Looks up a ServiceEnumeration based on the string value.
* @param value String value to search for.
* @return ServiceEnumeration or null.
*/
public static ServiceEnumeration findByValue(String value) {
return (ServiceEnumeration) lookup.get(value.toUpperCase());
}
/**
* String value of this Service.
* @return String value of this Service.
*/
public String toString() {
return this.value;
}
}
}

View file

@ -0,0 +1,83 @@
/*
* ShortDate.java
*
* Created on November 17, 2005, 1:04 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
import java.util.Date;
/**
* This is a simple wrapper for java.util.Date that indicates it should be
* formatted without time of day for Google Base. It should be transparent to
* module developers.
*
* Move along. Nothing to see here.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public class ShortDate extends Date implements CloneableType {
/** Creates a new instance of ShortDate */
public ShortDate() {
super();
}
/**
* Creates a new Short Date based on a Date value.
* @param date Date value to read from.
*/
public ShortDate(Date date) {
super(date.getTime());
}
/**
* Creates a new ShortDate based on a millisecond time.
* @param time Millisecond time to start with.
*/
public ShortDate(long time) {
super(time);
}
/**
* Returns a duplicate of this object.
* @return Duplicate of the object.
*/
public Object clone() {
return new ShortDate(this.getTime());
}
}

View file

@ -0,0 +1,154 @@
/*
* Size.java
*
* Created on November 16, 2005, 1:51 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
import java.util.StringTokenizer;
/** Represents the size on an item in 2 or 3 dimensions.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public class Size implements CloneableType {
/**
* height
*/
private FloatUnit height;
/**
* length
*/
private FloatUnit length;
/**
* width
*/
private FloatUnit width;
/**
* Creates a new Size object parsing a string value.
* @param source String value to parse
*/
public Size(String source) {
StringTokenizer tok = new StringTokenizer(source, "Xx");
this.length = new FloatUnit( tok.nextToken());
this.width = new FloatUnit( tok.nextToken());
if (tok.hasMoreTokens()) {
this.height = new FloatUnit( tok.nextToken());
}
}
/**
* Creates a new instance of Size
* @param length lenght value
* @param width width value
*/
public Size(FloatUnit length, FloatUnit width) {
this.length = length;
this.width = width;
}
/**
* Creates a new instance of Size.
* @param length Length value.
* @param width Width value.
* @param height Height value.
*/
public Size(FloatUnit length, FloatUnit width, FloatUnit height) {
this.length = length;
this.width = width;
this.height = height;
}
/**
* Height value.
* @return Height value.
*/
public FloatUnit getHeight() {
return height;
}
/**
* Length value.
* @return Length value.
*/
public FloatUnit getLength() {
return length;
}
/**
* Width value.
* @return Width value.
*/
public FloatUnit getWidth() {
return width;
}
/**
* Duplicates this object.
* @return A duplicate Size object.
*/
public Object clone() {
if (this.height != null) {
return new Size(this.length, this.width, this.height);
} else {
return new Size(this.length, this.width);
}
}
/**
* Returns a string representation of this object.
* @return A string representation of this object.
*/
public String toString() {
if (height != null) {
return length + "x" + width + "x" + height;
} else {
return length + "x" + width;
}
}
public boolean equals( Object o ){
if( !(o instanceof Size))
return false;
if( this.toString().equals( o.toString() ) )
return true;
return false;
}
}

View file

@ -0,0 +1,98 @@
/*
* YearType.java
*
* Created on November 17, 2005, 11:42 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.base.types;
import java.util.Calendar;
import java.util.Date;
/** This class represents a simple 4 digit year.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.1 $
*/
public class YearType implements CloneableType {
/**
* year value
*/
int year;
/**
* Creates a new year from a string value.
* @param year String to parse.
*/
public YearType(String year) {
this.year = Integer.parseInt(year.trim());
}
/**
* Creates a new instance of YearType
* @param date Date to get the year from.
*/
public YearType(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
this.year = cal.get( Calendar.YEAR );
}
/**
* Duplicates this object.
* @return Cloned Year.
*/
public Object clone() {
return new YearType(Integer.toString(this.year));
}
/**
* Returns a String representation of this object.
* @return Returns a String representation of this object.
*/
public String toString() {
return Integer.toString(year);
}
public boolean equals( Object o ){
if( !(o instanceof YearType))
return false;
if( this.toString().equals( o.toString() ) )
return true;
return false;
}
}

View file

@ -0,0 +1,45 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
This package contains complex and utility datatypes for use with Google Base.
<pre>
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
</pre>
</body>
</html>

View file

@ -0,0 +1,59 @@
/*
* CreativeCommons.java
*
* Created on November 20, 2005, 5:05 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.cc;
import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.cc.types.License;
/**
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public interface CreativeCommons extends Module {
public static final String URI = "rome:CreativeCommons";
public License[] getAllLicenses();
public void setAllLicenses(License[] licenses);
public License[] getLicenses();
public void setLicenses(License[] license );
}

View file

@ -0,0 +1,124 @@
/*
* AbstractCreativeCommons.java
*
* Created on November 20, 2005, 5:12 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.cc;
import com.sun.syndication.feed.impl.EqualsBean;
import com.sun.syndication.feed.impl.ToStringBean;
import org.rometools.feed.module.cc.types.License;
import java.lang.reflect.Array;
/**
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class CreativeCommonsImpl implements CreativeCommons {
public static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
public static final String RSS2_URI ="http://backend.userland.com/creativeCommonsRssModule";
public static final String RSS1_URI = "http://web.resource.org/cc/";
private License[] allLicenses;
private License[] licenses;
protected Object arrayCopy(Object[] source) {
if(source == null) {
return null;
}
Object[] array = (Object[])Array.newInstance(source.getClass().getComponentType(),source.length);
for(int i = 0; i < source.length; i++) {
array[i] = source[i];
}
return array;
}
public License[] getAllLicenses() {
return allLicenses;
}
public void setAllLicenses(License[] allLicenses) {
this.allLicenses = allLicenses;
}
public Class getInterface() {
return CreativeCommons.class;
}
public String getUri() {
return CreativeCommons.URI;
}
public Object clone() {
CreativeCommonsImpl clone = new CreativeCommonsImpl();
clone.copyFrom( this );
return clone;
}
public void copyFrom(Object object) {
CreativeCommons source = (CreativeCommons) object;
this.setAllLicenses( (License[]) arrayCopy( source.getAllLicenses() ));
this.setLicenses( source.getLicenses() );
}
public boolean equals(Object obj) {
EqualsBean eBean = new EqualsBean(this.getClass(),this);
return eBean.beanEquals(obj);
}
public License[] getLicenses() {
return licenses;
}
public void setLicenses(License[] licenses) {
this.licenses = licenses;
}
public String toString() {
ToStringBean tsb = new ToStringBean( CreativeCommonsImpl.class, this );
return tsb.toString();
}
}

View file

@ -0,0 +1,142 @@
/*
* CCModuleGenerator.java
*
* Created on November 20, 2005, 5:23 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.cc.io;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
import org.rometools.feed.module.cc.CreativeCommons;
import org.rometools.feed.module.cc.CreativeCommonsImpl;
import org.rometools.feed.module.cc.types.License;
import java.util.HashSet;
import java.util.Set;
import org.jdom.Element;
import org.jdom.Namespace;
/**
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class CCModuleGenerator implements ModuleGenerator{
private static final Namespace RSS1 = Namespace.getNamespace( "cc", CreativeCommonsImpl.RSS1_URI );
private static final Namespace RSS2 = Namespace.getNamespace( "creativeCommons", CreativeCommonsImpl.RSS2_URI);
private static final Namespace RSS = Namespace.getNamespace("http://purl.org/rss/1.0/");
private static final Namespace RDF = Namespace.getNamespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
private static final HashSet NAMESPACES = new HashSet();
static{
NAMESPACES.add( RSS1 );
NAMESPACES.add( RSS2 );
NAMESPACES.add( RDF );
}
/**
* Creates a new instance of CCModuleGenerator
*/
public CCModuleGenerator() {
super();
}
public void generate(Module module, Element element) {
Element root = element;
while( root.getParentElement() != null ){
root = root.getParentElement();
}
if( root.getNamespace().equals( RDF )|| root.getNamespace().equals( RSS )){
generateRSS1( (CreativeCommons) module, element);
} else {
generateRSS2( (CreativeCommons) module, element);
}
}
public Set getNamespaces() {
return NAMESPACES;
}
public String getNamespaceUri() {
return CreativeCommons.URI;
}
private void generateRSS1( CreativeCommons module, Element element ){
//throw new RuntimeException( "Generating RSS1 Feeds not currently Supported.");
System.out.println(element.getName());
if( element.getName().equals("channel")){
// Do all licenses list.
License[] all = module.getAllLicenses();
for( int i=0; i < all.length ; i++){
Element license = new Element( "License", RSS1 );
license.setAttribute( "about", all[i].getValue(), RDF );
License.Behaviour[] permits = all[i].getPermits();
for( int j=0; permits != null && j < permits.length; j++ ){
Element permit = new Element( "permits", RSS1 );
permit.setAttribute( "resource", permits[j].toString(), RDF);
license.addContent( permit );
}
License.Behaviour[] requires = all[i].getPermits();
for( int j=0; requires != null && j < requires.length; j++ ){
Element permit = new Element( "requires", RSS1 );
permit.setAttribute( "resource", permits[j].toString(), RDF);
license.addContent( permit );
}
System.out.println("Is Root?"+element.getParentElement());
element.getParentElement().addContent( license );
}
}
//Do local licenses
License[] licenses = module.getLicenses();
for( int i=0; i < licenses.length; i++ ){
Element license = new Element( "license", RSS1 );
license.setAttribute( "resource", licenses[i].getValue(), RDF);
element.addContent( license );
}
}
private void generateRSS2( CreativeCommons module, Element element ){
License[] licenses = module.getLicenses();
for( int i=0; licenses != null && i < licenses.length; i++ ){
Element license = new Element( "license", RSS2 );
license.setText( licenses[i].getValue() );
element.addContent( license );
}
}
}

View file

@ -0,0 +1,133 @@
/*
* CCModuleParser.java
*
* Created on November 20, 2005, 5:23 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.cc.io;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleParser;
import org.rometools.feed.module.cc.CreativeCommonsImpl;
import org.rometools.feed.module.cc.types.License;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jdom.Element;
import org.jdom.Namespace;
/**
* @version $Revision: 1.3 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ModuleParserRSS1 implements ModuleParser {
private static final Namespace NS = Namespace.getNamespace( CreativeCommonsImpl.RSS1_URI );
static final Namespace RDF = Namespace.getNamespace( CreativeCommonsImpl.RDF_URI );
/**
* Creates a new instance of ModuleParserRSS1
*/
public ModuleParserRSS1() {
}
public Module parse(Element element) {
CreativeCommonsImpl module = new CreativeCommonsImpl();
{
// Parsing Channel level.
Element root =element;
while(root.getParentElement() != null )
root = root.getParentElement();
List licenseList = root.getChildren( "License", NS );
ArrayList licenses = new ArrayList();
Iterator it = licenseList.iterator();
while( it.hasNext() ){
Element licenseTag = (Element) it.next();
String licenseURI = licenseTag.getAttributeValue("about", RDF);
if( licenseURI == null )
continue;
License license = License.findByValue( licenseURI );
{
ArrayList permitsValues = new ArrayList();
ArrayList requiresValues = new ArrayList();
List permitsTags = licenseTag.getChildren("permits", NS );
Iterator sit = permitsTags.iterator();
while(sit.hasNext() ){
Element permitTag = (Element) sit.next();
permitsValues.add( License.Behaviour.findByValue( permitTag.getAttributeValue( "resource", RDF) ));
}
List requiresTags = licenseTag.getChildren( "requires", NS);
sit = requiresTags.iterator();
while(sit.hasNext()){
Element requireTag = (Element) sit.next();
requiresValues.add( License.Behaviour.findByValue(requireTag.getAttributeValue("resource", RDF)));
}
license = new License( licenseURI,
(License.Behaviour[]) requiresValues.toArray( new License.Behaviour[requiresValues.size()]),
(License.Behaviour[]) permitsValues.toArray( new License.Behaviour[permitsValues.size()]) );
}
licenses.add( license );
}
module.setAllLicenses( (License[]) licenses.toArray( new License[0] ) );
}
ArrayList licenses = new ArrayList();
List licenseTags = element.getChildren( "license", NS );
Iterator lit = licenseTags.iterator();
while( lit.hasNext() ){
Element licenseTag = (Element) lit.next();
licenses.add( License.findByValue( licenseTag.getAttributeValue( "resource", RDF)));
}
if( licenses.size() > 0 ){
module.setLicenses( (License[]) licenses.toArray( new License[licenses.size()]));
}
if( module.getLicenses() != null || module.getAllLicenses() != null ){
return module;
} else {
return null;
}
}
public String getNamespaceUri() {
return CreativeCommonsImpl.RSS1_URI;
}
}

View file

@ -0,0 +1,119 @@
/*
* ModuleParserRSS2.java
*
* Created on November 20, 2005, 6:15 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.cc.io;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleParser;
import org.rometools.feed.module.cc.CreativeCommonsImpl;
import org.rometools.feed.module.cc.types.License;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.jdom.Element;
import org.jdom.Namespace;
/**
*
* @version $Revision: 1.3 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ModuleParserRSS2 implements ModuleParser {
private static final Namespace NS = Namespace.getNamespace( CreativeCommonsImpl.RSS2_URI );
/** Creates a new instance of ModuleParserRSS2 */
public ModuleParserRSS2() {
}
public Module parse(Element element) {
CreativeCommonsImpl module = new CreativeCommonsImpl();
//Do channel global
{
Element root = element;
while( !root.getName().equals("channel") && !root.getName().equals("feed") )
root = root.getParentElement();
ArrayList licenses = new ArrayList();
List items = null;
if( root.getName().equals("channel"))
items = root.getChildren("item");
else
items = root.getChildren("entry");
Iterator iit = items.iterator();
while( iit.hasNext() ){
Element item = (Element) iit.next();
List licenseTags = item.getChildren( "license", NS );
Iterator lit = licenseTags.iterator();
while(lit.hasNext() ){
Element licenseTag = (Element) lit.next();
License license = License.findByValue( licenseTag.getTextTrim() );
if( !licenses.contains( license ));
licenses.add( license );
}
}
if( licenses.size() > 0 ){
module.setAllLicenses( (License[]) licenses.toArray( new License[0] ) );
}
}
// do element local
ArrayList licenses = new ArrayList();
List licenseTags = element.getChildren( "license", NS );
Iterator it = licenseTags.iterator();
while( it.hasNext() ){
Element licenseTag = (Element) it.next();
licenses.add( License.findByValue(licenseTag.getTextTrim() ));
}
if( licenses.size() > 0 ){
module.setLicenses( (License[]) licenses.toArray( new License[0]));
}
if( module.getLicenses() != null && module.getAllLicenses() != null ){
return module;
} else {
return null;
}
}
public String getNamespaceUri() {
return CreativeCommonsImpl.RSS2_URI;
}
}

View file

@ -0,0 +1,80 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
This is a module for ROME that supports both the
<a href="http://web.resource.org/rss/1.0/modules/cc/">"CC" RSS1</a> module and the
<a href="backend.userland.com/creativeCommonsRssModule"> RSS 2 (and Atom)</a>
module in a unified manner.
<p>It does this by superimposing the "rome:creativecommon" namespace over both of them
for the purposes of the module, and synchronizes them into a unified structure. For RSS2
it attempts to correlate the license into a code-capable fashion. If the license link
goes to one of the standard licenses at creativecommons.org, it will populate the permissions
based on it's know set (See License.Behaviour).</p>
<p>The module has 2 fields on it. One is "allLicenses". This is simply an array of all licenses
in a feed. The second one "licenses" contains licenses that apply to a specific element (feed or
entry). Licenses then contain "permits" and "requires" behaviours. If a license is used that
the system can't determine anything about, these will be null. Zero-lenght means "known and
empty."</p>
<p>At this time, because of a ROME limitation, writing RSS1 feeds is not possible. However,
if you read an RSS1 feed, you can convert it to an RSS2 feed properly.</p>
<p>Sample Usage:
<pre>
CreativeCommons commons = new CreativeCommonsImpl();
commons.setLicense( new License[]{ License.NONCOMMERCIAL } );
// Note, you do not have to setAllLicenses right now. When the RSS1 functionality is
// added, this will be required at the Feed level only.
ArrayList modules = new ArrayList()
modules.add( commons );
syndEntry.setModules( commons );
//Alternately, to get the module:
CreativeCommons commons = (CreativeCommons) syndFeed.getModule( CreativeCommons.URI );
</pre>
</p>
<pre>
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
</pre>
</body>
</html>

View file

@ -0,0 +1,202 @@
/*
* LicenseEnumeration.java
*
* Created on November 20, 2005, 3:20 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.cc.types;
import com.sun.syndication.feed.impl.EqualsBean;
import com.sun.syndication.feed.impl.ToStringBean;
import java.util.HashMap;
import java.util.Iterator;
import java.util.StringTokenizer;
/**
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class License {
private static final String CC_START = "http://creativecommons.org/licenses/";
private static final HashMap lookupLicense = new HashMap();
public static final License NO_DERIVS = new License("http://creativecommons.org/licenses/nd/1.0/",new Behaviour[0],new Behaviour[] {
Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION
});
public static final License NO_DERIVS_NONCOMMERCIAL = new License("http://creativecommons.org/licenses/nd-nc/1.0/",new Behaviour[] {
Behaviour.NONCOMMERCIAL
},new Behaviour[] {Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION});
public static final License NONCOMMERCIAL = new License("http://creativecommons.org/licenses/nc/1.0/",new Behaviour[] {
Behaviour.NONCOMMERCIAL
},new Behaviour[] {
Behaviour.DERIVATIVE,Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION
});
public static final License SHARE_ALIKE = new License("http://creativecommons.org/licenses/sa/1.0/",new Behaviour[] {
Behaviour.COPYLEFT
},new Behaviour[] {
Behaviour.DERIVATIVE,Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION
});
public static final License SHARE_ALIKE_NONCOMMERCIAL = new License("http://creativecommons.org/licenses/nc-sa/1.0/",new Behaviour[] {
Behaviour.COPYLEFT,Behaviour.NONCOMMERCIAL
},new Behaviour[] {
Behaviour.DERIVATIVE,Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION
});
public static final License SHARE_ALIKE_ATTRIBUTION = new License("http://creativecommons.org/licenses/by-sa/2.5/",new Behaviour[] {
Behaviour.COPYLEFT,Behaviour.ATTRIBUTION
},new Behaviour[] {
Behaviour.DERIVATIVE,Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION
});
public static final License SHARE_ALIKE_NONCOMMERCIAL_ATTRIBUTION = new License("http://creativecommons.org/licenses/by-nc-sa/2.5/",new Behaviour[] {
Behaviour.COPYLEFT,Behaviour.ATTRIBUTION,Behaviour.NONCOMMERCIAL
},new Behaviour[] {
Behaviour.DERIVATIVE,Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION
});
public static final License NONCOMMERCIAL_ATTRIBUTION = new License("http://creativecommons.org/licenses/by-nc/2.5/",new Behaviour[] {
Behaviour.ATTRIBUTION,Behaviour.NONCOMMERCIAL
},new Behaviour[] {
Behaviour.DERIVATIVE,Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION
});
public static final License NONCOMMERCIAL_ATTRIBUTION_NO_DERIVS = new License("http://creativecommons.org/licenses/by-nc-nd/2.5/",new Behaviour[] {
Behaviour.ATTRIBUTION,Behaviour.NONCOMMERCIAL
},new Behaviour[] {Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION});
public static final License ATTRIBUTION_NO_DERIVS = new License("http://creativecommons.org/licenses/by-nd/2.5/",new Behaviour[] {
Behaviour.ATTRIBUTION
},new Behaviour[] {Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION});
public static final License ATTRIBUTION = new License("http://creativecommons.org/licenses/by/2.5/",new Behaviour[] {
Behaviour.ATTRIBUTION
},new Behaviour[] {
Behaviour.DERIVATIVE,Behaviour.DISTRIBUTION,Behaviour.REPRODUCTION
});
private String uri;
private Behaviour[] permits;
private Behaviour[] requires;
/**
* Creates a new instance of License
*/
public License(String uri,Behaviour[] requires,Behaviour[] permits) {
this.requires = requires;
this.permits = permits;
this.uri = uri;
License.lookupLicense.put(uri,this);
if(this.uri.endsWith("/")) {
//System.out.println(uri.substring(0,this.uri.lastIndexOf("/")));
License.lookupLicense.put(uri.substring(0,this.uri.lastIndexOf("/")),this);
}
}
public static License findByValue(String uri) {
License found = (License)License.lookupLicense.get(uri);
//No I am going to try an guess about unknown licenses
// This is try and match known CC licenses of other versions or various URLs to
// current licenses, then make a new one with the same permissions.
if(found == null && uri.startsWith("http://") && uri.toLowerCase().indexOf("creativecommons.org") != -1) {
Iterator it = License.lookupLicense.keySet().iterator();
while(it.hasNext()&&(found == null)) {
try{
String key = (String)it.next();
if(key.startsWith( CC_START ) ){
String licensePath = key.substring( CC_START.length(), key.length() );
StringTokenizer tok = new StringTokenizer( licensePath, "/");
String license = tok.nextToken();
String version = tok.nextToken();
if( uri.toLowerCase().indexOf("creativecommons.org/licenses/"+license) != -1){
License current = (License) lookupLicense.get( key );
found = new License( uri, current.getRequires(), current.getPermits() );
}
}
} catch(Exception e){
e.printStackTrace();
}
}
}
//OK, we got here. If we haven't found a match, return a new License with unknown permissions.
if( found == null ){
found = new License( uri, null, null );
}
return found;
}
public Behaviour[] getPermits() {
return this.permits;
}
public Behaviour[] getRequires() {
return this.requires;
}
public String toString() {
ToStringBean tsb = new ToStringBean( License.class, this );
return tsb.toString();
}
public String getValue() {
return this.uri;
}
public boolean equals(Object obj) {
EqualsBean eBean = new EqualsBean(License.class,this);
return eBean.beanEquals(obj);
}
public int hashCode() {
EqualsBean equals = new EqualsBean(License.class,this);
return equals.beanHashCode();
}
public static class Behaviour {
private static final HashMap lookup = new HashMap();
public static final Behaviour REPRODUCTION = new Behaviour("http://web.resource.org/cc/Reproduction");
public static final Behaviour DISTRIBUTION = new Behaviour("http://web.resource.org/cc/Distribution");
public static final Behaviour DERIVATIVE = new Behaviour("http://web.resource.org/cc/DerivativeWorks");
public static final Behaviour NOTICE = new Behaviour("http://web.resource.org/cc/Notice");
public static final Behaviour ATTRIBUTION = new Behaviour("http://web.resource.org/cc/Attribution");
public static final Behaviour COPYLEFT = new Behaviour("http://web.resource.org/cc/Copyleft");
public static final Behaviour NONCOMMERCIAL = new Behaviour("http://web.resource.org/cc/Noncommercial");
private String uri;
private Behaviour(String uri) {
this.uri = uri;
Behaviour.lookup.put(uri,this);
}
public static Behaviour findByValue(String uri) {
return (Behaviour)Behaviour.lookup.get(uri);
}
public String toString() {
return this.uri;
}
}
}

View file

@ -0,0 +1,45 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
This package contains datatypes for use with the plug in.
<pre>
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
</pre>
</body>
</html>

View file

@ -0,0 +1,203 @@
/*
* ContentItem.java
*
* Created on January 12, 2005, 8:52 AM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.rometools.feed.module.content;
import java.util.List;
/** This class represents a content item per the "Original Syntax".
* http://purl.org/rss/1.0/modules/content/
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ContentItem implements Cloneable {
private String contentFormat;
private String contentEncoding;
private String contentValue;
private List contentValueDOM;
private String contentAbout;
private String contentValueParseType;
private List contentValueNamespace;
private String contentResource;
/** Creates a new instance of ContentItem */
public ContentItem() {
}
public String getContentFormat() {
return this.contentFormat;
}
public void setContentFormat(String contentFormat) {
this.contentFormat = contentFormat;
}
public String getContentEncoding() {
return this.contentEncoding;
}
public void setContentEncoding(String contentEncoding) {
this.contentEncoding = contentEncoding;
}
public String getContentValue() {
return this.contentValue;
}
public void setContentValue(String contentValue) {
this.contentValue = contentValue;
}
public List getContentValueDOM() {
return this.contentValueDOM;
}
public void setContentValueDOM(List contentValueDOM) {
this.contentValueDOM = contentValueDOM;
}
public String getContentAbout() {
return this.contentAbout;
}
public void setContentAbout(String contentAbout) {
this.contentAbout = contentAbout;
}
public String getContentValueParseType() {
return this.contentValueParseType;
}
public void setContentValueParseType(String contentValueParseType) {
this.contentValueParseType = contentValueParseType;
}
public List getContentValueNamespaces() {
return this.contentValueNamespace;
}
public void setContentValueNamespaces(List contentValueNamespace) {
this.contentValueNamespace = contentValueNamespace;
}
public String getContentResource() {
return this.contentResource;
}
public void setContentResource(String contentResource) {
this.contentResource = contentResource;
}
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ContentItem other = (ContentItem) obj;
if ((this.contentFormat == null) ? (other.contentFormat != null) : !this.contentFormat.equals(other.contentFormat)) {
//System.out.println("format");
return false;
}
if ((this.contentEncoding == null) ? (other.contentEncoding != null) : !this.contentEncoding.equals(other.contentEncoding)) {
//System.out.println("enc");
return false;
}
String thisCV = this.contentValue.replaceAll(" xmlns=\"http://www.w3.org/1999/xhtml\"", "").trim();;
String thatCV = other.contentValue.replaceAll(" xmlns=\"http://www.w3.org/1999/xhtml\"", "").trim();
if ((this.contentValue == null) ? (other.contentValue != null) : !thisCV.equals(thatCV)) {
return false;
}
if (this.contentValueDOM != other.contentValueDOM && (this.contentValueDOM == null || !this.contentValueDOM.equals(other.contentValueDOM))) {
//System.out.println("vd");
return false;
}
if ((this.contentAbout == null) ? (other.contentAbout != null) : !this.contentAbout.equals(other.contentAbout)) {
//System.out.println("abt");
return false;
}
if ((this.contentValueParseType == null) ? (other.contentValueParseType != null) : !this.contentValueParseType.equals(other.contentValueParseType)) {
//System.out.println("pt");
return false;
}
if (this.contentValueNamespace != other.contentValueNamespace && (this.contentValueNamespace == null || !this.contentValueNamespace.equals(other.contentValueNamespace))) {
//System.out.println("ns");
return false;
}
if ((this.contentResource == null) ? (other.contentResource != null) : !this.contentResource.equals(other.contentResource)) {
//System.out.println("res");
return false;
}
return true;
}
public int hashCode() {
int hash = 7;
hash = 97 * hash + (this.contentFormat != null ? this.contentFormat.hashCode() : 0);
hash = 97 * hash + (this.contentEncoding != null ? this.contentEncoding.hashCode() : 0);
hash = 97 * hash + (this.contentValue != null ? this.contentValue.hashCode() : 0);
hash = 97 * hash + (this.contentValueDOM != null ? this.contentValueDOM.hashCode() : 0);
hash = 97 * hash + (this.contentAbout != null ? this.contentAbout.hashCode() : 0);
hash = 97 * hash + (this.contentValueParseType != null ? this.contentValueParseType.hashCode() : 0);
hash = 97 * hash + (this.contentValueNamespace != null ? this.contentValueNamespace.hashCode() : 0);
hash = 97 * hash + (this.contentResource != null ? this.contentResource.hashCode() : 0);
return hash;
}
public Object clone() {
ContentItem o = new ContentItem();
o.contentAbout = this.contentAbout;
o.contentEncoding = this.contentEncoding;
o.contentFormat = this.contentFormat;
o.contentResource = this.contentResource;
o.contentValue = this.contentValue;
o.contentValueDOM = this.contentValueDOM;
o.contentValueNamespace = this.contentValueNamespace;
o.contentValueParseType = this.contentValueParseType;
return o;
}
}

View file

@ -0,0 +1,97 @@
/*
* ContentModule.java
*
* Created on January 11, 2005, 1:02 PM
*
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.content;
import java.util.List;
/**
* @version $Revision: 1.1 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public interface ContentModule extends com.sun.syndication.feed.module.Module {
public static final String URI = "http://purl.org/rss/1.0/modules/content/";
public static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
/** Returns a List of Strings containing the New Syntax Encoded values
* are in the element.
* @return List of content Strings
*/
public List getEncodeds();
/** Sets a List of Strings containing the New Syntax Encoded values
* are in the element.
* @return List of content Strings
*/
public void setEncodeds(List encodeds);
public void copyFrom(Object obj);
public Class getInterface();
public String getUri();
public String toString(String str);
/** Contains a list of ContentItems that represent the "Original Syntax" set.
* @see com.totsp.xml.syndication.content.ContentItem
* @return List of ContentItems.
*/
public List getContentItems();
/** Contains a list of ContentItems that represent the "Original Syntax" set.
* @see com.totsp.xml.syndication.content.ContentItem
* @param List of ContentItems.
*/
public void setContentItems(List list);
/** Returns a List of Strings containing whatever new or original syntax items
* are in the element.
* @return List of content Strings
*/
public List getContents();
/** Sets a List of Strings containing whatever new or original syntax items
* are in the element.
* @return List of content Strings
*/
public void setContents(List contents);
}

View file

@ -0,0 +1,108 @@
/*
* ContentModuleImpl.java
*
* Created on January 11, 2005, 1:07 PM
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.rometools.feed.module.content;
import java.util.ArrayList;
import java.util.List;
/**
* @version $Revision: 1.4 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ContentModuleImpl extends com.sun.syndication.feed.module.ModuleImpl implements ContentModule {
private List encodeds;
private List contents;
private List contentItems;
public ContentModuleImpl() {
super(ContentModuleImpl.class, URI);
}
protected ContentModuleImpl(java.lang.Class beanClass, java.lang.String uri) {
super(beanClass, uri);
}
public List getEncodeds() {
this.encodeds = this.encodeds == null ? new ArrayList() : this.encodeds;
return this.encodeds;
}
public void setEncodeds(List encodeds) {
this.encodeds = encodeds;
}
public void copyFrom(Object obj) {
ContentModule cm = (ContentModule) obj;
this.setEncodeds(cm.getEncodeds());
this.setContentItems(cm.getContentItems());
this.setContents(cm.getContents());
}
public Class getInterface() {
return ContentModule.class;
}
public List getContentItems() {
this.contentItems = this.contentItems == null ? new ArrayList() : this.contentItems;
return this.contentItems;
}
public void setContentItems(List list) {
this.contentItems = list;
}
public List getContents() {
this.contents = this.contents == null ? new ArrayList() : this.contents;
return this.contents;
}
public void setContents(List contents) {
this.contents = contents;
}
public String toString(String str) {
return contentItems.toString();
}
}

View file

@ -0,0 +1,194 @@
/*
* ContentModuleGenerator.java
*
* Created on January 11, 2005, 1:41 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.rometools.feed.module.content.io;
import org.rometools.feed.module.content.ContentItem;
import org.rometools.feed.module.content.ContentModule;
import org.jdom.Attribute;
import org.jdom.CDATA;
import org.jdom.Content;
import org.jdom.Element;
import org.jdom.Namespace;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @version $Revision: 1.2 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ContentModuleGenerator implements com.sun.syndication.io.ModuleGenerator {
private static final Namespace CONTENT_NS = Namespace.getNamespace("content", ContentModule.URI);
private static final Namespace RDF_NS = Namespace.getNamespace("rdf", ContentModule.RDF_URI);
private static final Set NAMESPACES;
static {
Set nss = new HashSet();
nss.add(CONTENT_NS);
NAMESPACES = Collections.unmodifiableSet(nss);
}
/** Creates a new instance of ContentModuleGenerator */
public ContentModuleGenerator() {
}
public void generate(com.sun.syndication.feed.module.Module module, org.jdom.Element element) {
// this is not necessary, it is done to avoid the namespace definition in every item.
Element root = element;
while ((root.getParent() != null) && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
root.addNamespaceDeclaration(CONTENT_NS);
if (!(module instanceof ContentModule)) {
return;
}
ContentModule cm = (ContentModule) module;
List encodeds = cm.getEncodeds();
//
if (encodeds != null) {
System.out.println(cm.getEncodeds().size());
for (int i = 0; i < encodeds.size(); i++) {
element.addContent(generateCDATAElement("encoded", encodeds.get(i).toString()));
}
}
List contentItems = cm.getContentItems();
if ((contentItems != null) && (contentItems.size() > 0)) {
Element items = new Element("items", CONTENT_NS);
Element bag = new Element("Bag", RDF_NS);
items.addContent(bag);
for (int i = 0; i < contentItems.size(); i++) {
ContentItem contentItem = (ContentItem) contentItems.get(i);
Element li = new Element("li", RDF_NS);
Element item = new Element("item", CONTENT_NS);
if (contentItem.getContentAbout() != null) {
Attribute about = new Attribute("about", contentItem.getContentAbout(), RDF_NS);
item.setAttribute(about);
}
if (contentItem.getContentFormat() != null) {
//System.out.println( "Format");
Element format = new Element("format", CONTENT_NS);
Attribute formatResource = new Attribute("resource", contentItem.getContentFormat(), RDF_NS);
format.setAttribute(formatResource);
item.addContent(format);
}
if (contentItem.getContentEncoding() != null) {
//System.out.println( "Encoding");
Element encoding = new Element("encoding", CONTENT_NS);
Attribute encodingResource = new Attribute("resource", contentItem.getContentEncoding(), RDF_NS);
encoding.setAttribute(encodingResource);
item.addContent(encoding);
}
if (contentItem.getContentValue() != null) {
Element value = new Element("value", RDF_NS);
if (contentItem.getContentValueParseType() != null) {
Attribute parseType = new Attribute("parseType", contentItem.getContentValueParseType(), RDF_NS);
value.setAttribute(parseType);
}
if (contentItem.getContentValueNamespaces() != null) {
List namespaces = contentItem.getContentValueNamespaces();
for (int ni = 0; ni < namespaces.size(); ni++) {
value.addNamespaceDeclaration((Namespace) namespaces.get(ni));
}
}
List detached = new ArrayList();
for (int c = 0;
c < contentItem.getContentValueDOM().size(); c++) {
detached.add(((Content) ((Content) contentItem.getContentValueDOM().get(c)).clone()).detach());
}
value.setContent(detached);
item.addContent(value);
} // end value
li.addContent(item);
bag.addContent(li);
} //end contentItems loop
element.addContent(items);
}
}
protected Element generateSimpleElement(String name, String value) {
Element element = new Element(name, CONTENT_NS);
element.addContent(value);
return element;
}
protected Element generateCDATAElement(String name, String value) {
Element element = new Element(name, CONTENT_NS);
CDATA cdata = new CDATA(value);
element.addContent(cdata);
return element;
}
public String getNamespaceUri() {
return ContentModule.URI;
}
public java.util.Set getNamespaces() {
return NAMESPACES;
}
}

View file

@ -0,0 +1,158 @@
/*
* ContentModuleParser.java
*
* Created on January 11, 2005, 1:23 PM
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.rometools.feed.module.content.io;
import org.rometools.feed.module.content.ContentItem;
import org.rometools.feed.module.content.ContentModule;
import org.rometools.feed.module.content.ContentModuleImpl;
import org.jdom.Attribute;
import org.jdom.Element;
import org.jdom.Namespace;
import org.jdom.output.XMLOutputter;
import java.util.ArrayList;
import java.util.List;
/**
* @version $Revision: 1.3 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ContentModuleParser implements com.sun.syndication.io.ModuleParser {
private static final Namespace CONTENT_NS = Namespace.getNamespace("content", ContentModule.URI);
private static final Namespace RDF_NS = Namespace.getNamespace("rdf", ContentModule.RDF_URI);
/** Creates a new instance of ContentModuleParser */
public ContentModuleParser() {
}
public String getNamespaceUri() {
return ContentModule.URI;
}
public com.sun.syndication.feed.module.Module parse(org.jdom.Element element) {
boolean foundSomething = false;
ContentModule cm = new ContentModuleImpl();
List encodeds = element.getChildren("encoded", CONTENT_NS);
ArrayList contentStrings = new ArrayList();
ArrayList encodedStrings = new ArrayList();
if (encodeds.size() > 0) {
foundSomething = true;
for (int i = 0; i < encodeds.size(); i++) {
Element encodedElement = (Element) encodeds.get(i);
encodedStrings.add(encodedElement.getText());
contentStrings.add(encodedElement.getText());
}
}
ArrayList contentItems = new ArrayList();
List items = element.getChildren("items", CONTENT_NS);
for (int i = 0; i < items.size(); i++) {
foundSomething = true;
List lis = ((Element) items.get(i)).getChild("Bag", RDF_NS).getChildren("li", RDF_NS);
for (int j = 0; j < lis.size(); j++) {
ContentItem ci = new ContentItem();
Element li = (Element) lis.get(j);
Element item = li.getChild("item", CONTENT_NS);
Element format = item.getChild("format", CONTENT_NS);
Element encoding = item.getChild("encoding", CONTENT_NS);
Element value = item.getChild("value", RDF_NS);
if (value != null) {
if (value.getAttributeValue("parseType", RDF_NS) != null) {
ci.setContentValueParseType(value.getAttributeValue("parseType", RDF_NS));
}
if ((ci.getContentValueParseType() != null) && ci.getContentValueParseType().equals("Literal")) {
ci.setContentValue(getXmlInnerText(value));
contentStrings.add(getXmlInnerText(value));
ci.setContentValueNamespaces(value.getAdditionalNamespaces());
} else {
ci.setContentValue(value.getText());
contentStrings.add(value.getText());
}
ci.setContentValueDOM(((Element) value.clone()).getContent());
}
if (format != null) {
ci.setContentFormat(format.getAttribute("resource", RDF_NS).getValue());
}
if (encoding != null) {
ci.setContentEncoding(encoding.getAttribute("resource", RDF_NS).getValue());
}
if (item != null) {
Attribute about = item.getAttribute("about", RDF_NS);
if (about != null) {
ci.setContentAbout(about.getValue());
}
}
contentItems.add(ci);
}
}
cm.setEncodeds(encodedStrings);
cm.setContentItems(contentItems);
cm.setContents(contentStrings);
return (foundSomething) ? cm : null;
}
protected String getXmlInnerText(Element e) {
StringBuffer sb = new StringBuffer();
XMLOutputter xo = new XMLOutputter();
List children = e.getContent();
sb.append(xo.outputString(children));
return sb.toString();
}
}

View file

@ -0,0 +1,66 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
This is a ROME plug in that implements the Content RSS extension.
http://purl.org/rss/1.0/modules/content/
Note, this supports both the "Original" syntax via the ContentItem object
and the "New" Syntax via the ".getEncodeds()" method on the ContentModule.
<h2>Sample Usage:</h2>
<pre>
SyndFeedInput input = new SyndFeedInput();
SyndFeed syndfeed = input.build(new XmlReader(feed.toURL()));
Module module = syndfeed.getModule("http://purl.org/rss/1.0/modules/content/");
ContentModule content = (ContentModule) module;
Iterator it = content.getEncodeds().iterator();
System.out.println( it.next() );
</pre>
<pre>
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
</pre>
</body>
</html>

View file

@ -0,0 +1,163 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
import java.util.*;
import org.jdom.Element;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
import org.rometools.feed.module.georss.geometries.*;
/**
* GMLGenerator produces georss elements in georss GML format.
*
* @author Marc Wick
* @version $Id: GMLGenerator.java,v 1.1 2007/04/18 09:59:29 marcwick Exp $
*
*/
public class GMLGenerator implements ModuleGenerator {
private static final Set NAMESPACES;
static {
Set nss = new HashSet();
nss.add(GeoRSSModule.GML_NS);
NAMESPACES = Collections.unmodifiableSet(nss);
}
private Element createPosListElement(PositionList posList) {
Element posElement = new Element("posList", GeoRSSModule.GML_NS);
StringBuffer sb = new StringBuffer();
for (int i=0; i<posList.size(); ++i)
sb.append(posList.getLatitude(i)).append(" ").append(posList.getLongitude(i)).append(" ");
posElement.addContent(sb.toString());
return posElement;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleGenerator#getNamespaceUri()
*/
public String getNamespaceUri() {
return GeoRSSModule.GEORSS_GML_URI;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleGenerator#getNamespaces()
*/
public Set getNamespaces() {
return NAMESPACES;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleGenerator#generate(com.sun.syndication.feed.module.Module,
* org.jdom.Element)
*/
public void generate(Module module, Element element) {
// this is not necessary, it is done to avoid the namespace definition
// in every item.
Element root = element;
while (root.getParent() != null && root.getParent() instanceof Element) {
root = (Element) element.getParent();
}
root.addNamespaceDeclaration(GeoRSSModule.SIMPLE_NS);
root.addNamespaceDeclaration(GeoRSSModule.GML_NS);
Element whereElement= new Element("where", GeoRSSModule.SIMPLE_NS);
element.addContent(whereElement);
GeoRSSModule geoRSSModule = (GeoRSSModule) module;
AbstractGeometry geometry = geoRSSModule.getGeometry();
if (geometry instanceof Point) {
Position pos = ((Point)geometry).getPosition();
Element pointElement = new Element("Point", GeoRSSModule.GML_NS);
whereElement.addContent(pointElement);
Element posElement = new Element("pos", GeoRSSModule.GML_NS);
posElement.addContent(String.valueOf(pos.getLatitude()) + " "
+ String.valueOf(pos.getLongitude()));
pointElement.addContent(posElement);
}
else if (geometry instanceof LineString) {
PositionList posList = ((LineString) geometry).getPositionList();
Element lineElement = new Element("LineString", GeoRSSModule.GML_NS);
lineElement.addContent(createPosListElement(posList));
whereElement.addContent(lineElement);
} else if (geometry instanceof Polygon) {
Element polygonElement = new Element("Polygon", GeoRSSModule.GML_NS);
{
AbstractRing ring = ((Polygon) geometry).getExterior();
if (ring instanceof LinearRing) {
Element exteriorElement = new Element("exterior", GeoRSSModule.GML_NS);
polygonElement.addContent(exteriorElement);
Element ringElement = new Element("LinearRing", GeoRSSModule.GML_NS);
exteriorElement.addContent(ringElement);
ringElement.addContent(createPosListElement(((LinearRing) ring).getPositionList()));
} else {
System.err.println("GeoRSS GML format can't handle rings of type: " + ring.getClass().getName());
}
}
List interiorList = ((Polygon) geometry).getInterior();
Iterator it = interiorList.iterator();
while (it.hasNext()) {
AbstractRing ring = (AbstractRing)it.next();
if (ring instanceof LinearRing) {
Element interiorElement = new Element("interior", GeoRSSModule.GML_NS);
polygonElement.addContent(interiorElement);
Element ringElement = new Element("LinearRing", GeoRSSModule.GML_NS);
interiorElement.addContent(ringElement);
ringElement.addContent(createPosListElement(((LinearRing) ring).getPositionList()));
} else {
System.err.println("GeoRSS GML format can't handle rings of type: " + ring.getClass().getName());
}
}
whereElement.addContent(polygonElement);
} else if (geometry instanceof Envelope) {
Envelope envelope = (Envelope)geometry;
Element envelopeElement = new Element("Envelope", GeoRSSModule.GML_NS);
whereElement.addContent(envelopeElement);
Element lowerElement = new Element("lowerCorner", GeoRSSModule.GML_NS);
lowerElement.addContent(String.valueOf(envelope.getMinLatitude()) + " "
+ String.valueOf(envelope.getMinLongitude()));
envelopeElement.addContent(lowerElement);
Element upperElement = new Element("upperCorner", GeoRSSModule.GML_NS);
upperElement.addContent(String.valueOf(envelope.getMaxLatitude()) + " "
+ String.valueOf(envelope.getMaxLongitude()));
envelopeElement.addContent(upperElement);
} else {
System.err.println("GeoRSS GML format can't handle geometries of type: " + geometry.getClass().getName());
}
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
/**
* GMLModuleImpl is the implementation of the {@link GeoRSSModule} Interface
* for the gml GeoRSS format.
*
* @author Marc Wick
* @version $Id: GMLModuleImpl.java,v 1.1 2007/04/18 09:59:29 marcwick Exp $
*
*/
public class GMLModuleImpl extends GeoRSSModule {
public GMLModuleImpl() {
super(GeoRSSModule.class, GeoRSSModule.GEORSS_GML_URI);
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.feed.CopyFrom#getInterface()
*/
public Class getInterface() {
return GeoRSSModule.class;
}
}

View file

@ -0,0 +1,155 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
import org.jdom.Element;
import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.georss.geometries.LineString;
import org.rometools.feed.module.georss.geometries.LinearRing;
import org.rometools.feed.module.georss.geometries.Point;
import org.rometools.feed.module.georss.geometries.Polygon;
import org.rometools.feed.module.georss.geometries.Envelope;
import org.rometools.feed.module.georss.geometries.Position;
import org.rometools.feed.module.georss.geometries.PositionList;
import com.sun.syndication.io.ModuleParser;
import java.util.*;
/**
* GMLParser is a parser for the GML georss format.
*
* @author Marc Wick
* @version $Id: GMLParser.java,v 1.2 2007/06/05 20:44:53 marcwick Exp $
*
*/
public class GMLParser implements ModuleParser {
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleParser#getNamespaceUri()
*/
public String getNamespaceUri() {
return GeoRSSModule.GEORSS_GEORSS_URI;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleParser#parse(org.jdom.Element)
*/
public Module parse(Element element) {
Module geoRssModule = parseGML(element);
return geoRssModule;
}
private static PositionList parsePosList(Element element) {
String coordinates = element.getText();
String[] coord = GeoRSSUtils.trimWhitespace(coordinates).split(" ");
PositionList posList = new PositionList();
for (int i=0; i<coord.length; i += 2) {
posList.add(Double.parseDouble(coord[i]), Double.parseDouble(coord[i+1]));
}
return posList;
}
static Module parseGML(Element element) {
GeoRSSModule geoRSSModule = null;
Element pointElement = element.getChild("Point",
GeoRSSModule.GML_NS);
Element lineStringElement = element.getChild("LineString",
GeoRSSModule.GML_NS);
Element polygonElement = element.getChild("Polygon",
GeoRSSModule.GML_NS);
Element envelopeElement = element.getChild("Envelope",
GeoRSSModule.GML_NS);
if (pointElement != null) {
Element posElement = pointElement.getChild("pos", GeoRSSModule.GML_NS);
if (posElement != null) {
geoRSSModule = new GMLModuleImpl();
String coordinates = posElement.getText();
String[] coord = GeoRSSUtils.trimWhitespace(coordinates).split(" ");
Position pos = new Position(Double.parseDouble(coord[0]), Double.parseDouble(coord[1]));
geoRSSModule.setGeometry(new Point(pos));
}
} else if (lineStringElement != null) {
Element posListElement = lineStringElement.getChild("posList", GeoRSSModule.GML_NS);
if (posListElement != null) {
geoRSSModule = new GMLModuleImpl();
geoRSSModule.setGeometry(new LineString(parsePosList(posListElement)));
}
} else if (polygonElement != null) {
Polygon poly = null;
// The external ring
Element exteriorElement = polygonElement.getChild("exterior", GeoRSSModule.GML_NS);
if (exteriorElement != null) {
Element linearRingElement = exteriorElement.getChild("LinearRing", GeoRSSModule.GML_NS);
if (linearRingElement != null) {
Element posListElement = linearRingElement.getChild("posList", GeoRSSModule.GML_NS);
if (posListElement != null) {
if (poly == null)
poly = new Polygon();
poly.setExterior(new LinearRing(parsePosList(posListElement)));
}
}
}
// The internal rings (holes)
List interiorElementList = polygonElement.getChildren("interior", GeoRSSModule.GML_NS);
Iterator it = interiorElementList.iterator();
while (it.hasNext()) {
Element interiorElement = (Element)it.next();
if (interiorElement != null) {
Element linearRingElement = interiorElement.getChild("LinearRing", GeoRSSModule.GML_NS);
if (linearRingElement != null) {
Element posListElement = linearRingElement.getChild("posList", GeoRSSModule.GML_NS);
if (posListElement != null) {
if (poly == null)
poly = new Polygon();
poly.getInterior().add(new LinearRing(parsePosList(posListElement)));
}
}
}
}
if (poly != null) {
geoRSSModule = new GMLModuleImpl();
geoRSSModule.setGeometry(poly);
}
} else if (envelopeElement != null) {
Element lowerElement = envelopeElement.getChild("lowerCorner", GeoRSSModule.GML_NS);
Element upperElement = envelopeElement.getChild("upperCorner", GeoRSSModule.GML_NS);
if (lowerElement != null && upperElement != null) {
geoRSSModule = new GMLModuleImpl();
String lowerCoordinates = lowerElement.getText();
String[] lowerCoord = GeoRSSUtils.trimWhitespace(lowerCoordinates).split(" ");
String upperCoordinates = upperElement.getText();
String[] upperCoord = GeoRSSUtils.trimWhitespace(upperCoordinates).split(" ");
Envelope envelope = new Envelope(Double.parseDouble(lowerCoord[0]), Double.parseDouble(lowerCoord[1]),
Double.parseDouble(upperCoord[0]), Double.parseDouble(upperCoord[1]));
geoRSSModule.setGeometry(envelope);
}
}
return geoRSSModule;
}
}

View file

@ -0,0 +1,146 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
import org.jdom.Namespace;
import com.sun.syndication.feed.module.ModuleImpl;
import org.rometools.feed.module.georss.geometries.AbstractGeometry;
import org.rometools.feed.module.georss.geometries.Position;
import org.rometools.feed.module.georss.geometries.Point;
/**
* GeoRSSModule is the main georss interface defining the methods to produce and
* consume georss elements.
*
* @author Marc Wick
* @version $Id: GeoRSSModule.java,v 1.8 2007/06/06 09:47:32 marcwick Exp $
*/
public abstract class GeoRSSModule extends ModuleImpl implements Cloneable {
protected AbstractGeometry geometry;
public static final String version = "0.9.8";
/**
* namespace URI for georss simple: <i>"http://www.georss.org/georss"</i>
*/
public static final String GEORSS_GEORSS_URI = "http://www.georss.org/georss";
/**
* namespace URI for w3c georss :
* <i>"http://www.w3.org/2003/01/geo/wgs84_pos#"</i>
*/
public static final String GEORSS_W3CGEO_URI = "http://www.w3.org/2003/01/geo/wgs84_pos#";
/**
* namespace URI for GML georss : <i>"http://www.opengis.net/gml"</i>
*/
public static final String GEORSS_GML_URI = "http://www.opengis.net/gml";
/**
* Namespace for georss simple :
* <i>xmlns:georss="http://www.georss.org/georss"</i>
*/
public static final Namespace SIMPLE_NS = Namespace.getNamespace("georss",
GeoRSSModule.GEORSS_GEORSS_URI);
/**
*
* Namespace for w3c georss :
* <i>xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"</i>
*/
public static final Namespace W3CGEO_NS = Namespace.getNamespace("geo",
GeoRSSModule.GEORSS_W3CGEO_URI);
/**
*
* Namespace for gml georss : <i>xmlns:gml="http://www.opengis.net/gml"</i>
*/
public static final Namespace GML_NS = Namespace.getNamespace("gml",
GeoRSSModule.GEORSS_GML_URI);
protected GeoRSSModule(java.lang.Class beanClass, java.lang.String uri) {
super(beanClass, uri);
}
/**
* Set geometry of georss element
*
* @param geometry
* geometry
*/
public void setGeometry(AbstractGeometry geometry) {
this.geometry = geometry;
}
/**
* returns the geometry
*
* @return geometry
*/
public AbstractGeometry getGeometry() {
return geometry;
}
/**
* Convenience method to return point geometry.
* Returns null if the geometry is non-point.
*
* @return geometry
*/
public Position getPosition() {
if (geometry instanceof Point)
return ((Point)geometry).getPosition();
return null;
}
/**
* Convenience method to set point geometry.
*
* @return geometry
*/
public void setPosition(Position pos) {
if (pos != null)
geometry = new Point(pos);
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.feed.CopyFrom#copyFrom(java.lang.Object)
*/
public void copyFrom(Object obj) {
GeoRSSModule geoRSSModule = (GeoRSSModule) obj;
geometry = geoRSSModule.getGeometry();
try {
geometry = (AbstractGeometry)geometry.clone();
} catch (CloneNotSupportedException ex) {
ex.printStackTrace();
}
}
public Object clone() throws CloneNotSupportedException {
try {
GeoRSSModule retval = (GeoRSSModule)super.clone();
if (geometry != null)
retval.geometry = (AbstractGeometry)geometry.clone();
return retval;
} catch(Exception ex) {ex.printStackTrace();}
throw new CloneNotSupportedException();
}
}

View file

@ -0,0 +1,62 @@
/*
* Copyright 2007 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
/**
* @author marc
*
*/
public class GeoRSSPoint implements Cloneable {
private double latitude;
private double longitude;
/**
* @return the latitude
*/
public double getLatitude() {
return latitude;
}
/**
* @param latitude
* the latitude to set
*/
public void setLatitude(double latitude) {
this.latitude = latitude;
}
/**
* @return the longitude
*/
public double getLongitude() {
return longitude;
}
/**
* @param longitude
* the longitude to set
*/
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}

View file

@ -0,0 +1,130 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
/**
* static utility methods for georss.
*
* @author Marc Wick
* @version $Id: GeoRSSUtils.java,v 1.4 2007/04/18 09:59:29 marcwick Exp $
*
*/
public class GeoRSSUtils {
static String trimWhitespace(String in) {
StringBuffer strbuf = new StringBuffer();
int i = 0;
for (; i<in.length() && Character.isWhitespace(in.charAt(i)); ++i);
boolean wasWhite = false;
for (; i< in.length(); ++i) {
char ch=in.charAt(i);
if (Character.isWhitespace(ch))
wasWhite = true;
else {
if (wasWhite)
strbuf.append(' ');
strbuf.append(ch);
wasWhite = false;
}
}
return strbuf.toString();
}
/**
* This convenience method checks whether there is any geoRss Element and
* will return it (georss simple or W3GGeo).
*
* @param entry
* the element in the feed which might have a georss element
* @return a georssmodule or null if none is present
*/
public static GeoRSSModule getGeoRSS(SyndEntry entry) {
GeoRSSModule simple = (GeoRSSModule) entry
.getModule(GeoRSSModule.GEORSS_GEORSS_URI);
GeoRSSModule w3cGeo = (GeoRSSModule) entry
.getModule(GeoRSSModule.GEORSS_W3CGEO_URI);
GeoRSSModule gml = (GeoRSSModule) entry
.getModule(GeoRSSModule.GEORSS_GML_URI);
if (gml != null)
return gml;
if (simple != null)
return simple;
if (w3cGeo != null)
return w3cGeo;
return null;
/*
if (geoRSSModule == null && w3cGeo != null) {
geoRSSModule = w3cGeo;
} else if (geoRSSModule == null && gml != null) {
geoRSSModule = gml;
} else if (geoRSSModule != null && w3cGeo != null) {
// sanity check
if (!geoRSSModule.getGeometry().equals(w3cGeo.getGeometry())) {
throw new Error("geometry of simple and w3c do not match");
}
}
return geoRSSModule;
*/
}
/**
* This convenience method checks whether there is any geoRss Element and
* will return it (georss simple or W3GGeo).
*
* @param feed
* the element in the feed which might have a georss element
* @return a georssmodule or null if none is present
*/
public static GeoRSSModule getGeoRSS(SyndFeed feed) {
GeoRSSModule simple = (GeoRSSModule) feed
.getModule(GeoRSSModule.GEORSS_GEORSS_URI);
GeoRSSModule w3cGeo = (GeoRSSModule) feed
.getModule(GeoRSSModule.GEORSS_W3CGEO_URI);
GeoRSSModule gml = (GeoRSSModule) feed
.getModule(GeoRSSModule.GEORSS_GML_URI);
if (gml != null)
return gml;
if (simple != null)
return simple;
if (w3cGeo != null)
return w3cGeo;
return null;
/*
if (geoRSSModule == null && w3cGeo != null) {
geoRSSModule = w3cGeo;
} else if (geoRSSModule == null && gml != null) {
geoRSSModule = gml;
} else if (geoRSSModule != null && w3cGeo != null) {
// sanity check
if (!geoRSSModule.getGeometry().equals(w3cGeo.getGeometry())) {
throw new Error("geometry of simple and w3c do not match");
}
}
return geoRSSModule;
*/
}
}

View file

@ -0,0 +1,133 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.jdom.Element;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
import org.rometools.feed.module.georss.geometries.*;
/**
* SimpleGenerator produces georss elements in georss simple format.
*
* @author Marc Wick
* @version $Id: SimpleGenerator.java,v 1.4 2007/04/18 09:59:29 marcwick Exp $
*
*/
public class SimpleGenerator implements ModuleGenerator {
private static final Set NAMESPACES;
static {
Set nss = new HashSet();
nss.add(GeoRSSModule.SIMPLE_NS);
NAMESPACES = Collections.unmodifiableSet(nss);
}
private String posListToString(PositionList posList) {
StringBuffer sb = new StringBuffer();
for (int i=0; i<posList.size(); ++i)
sb.append(posList.getLatitude(i)).append(" ").append(posList.getLongitude(i)).append(" ");
return sb.toString();
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleGenerator#getNamespaceUri()
*/
public String getNamespaceUri() {
return GeoRSSModule.GEORSS_GEORSS_URI;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleGenerator#getNamespaces()
*/
public Set getNamespaces() {
return NAMESPACES;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleGenerator#generate(com.sun.syndication.feed.module.Module,
* org.jdom.Element)
*/
public void generate(Module module, Element element) {
// this is not necessary, it is done to avoid the namespace definition
// in every item.
Element root = element;
while (root.getParent() != null && root.getParent() instanceof Element) {
root = (Element) element.getParent();
}
root.addNamespaceDeclaration(GeoRSSModule.SIMPLE_NS);
GeoRSSModule geoRSSModule = (GeoRSSModule) module;
AbstractGeometry geometry = geoRSSModule.getGeometry();
if (geometry instanceof Point) {
Position pos = ((Point) geometry).getPosition();
Element pointElement = new Element("point", GeoRSSModule.SIMPLE_NS);
pointElement.addContent(pos.getLatitude() + " "
+ pos.getLongitude());
element.addContent(pointElement);
}
else if (geometry instanceof LineString) {
PositionList posList = ((LineString) geometry).getPositionList();
Element lineElement = new Element("line", GeoRSSModule.SIMPLE_NS);
lineElement.addContent(posListToString(posList));
element.addContent(lineElement);
}
else if (geometry instanceof Polygon) {
AbstractRing ring = ((Polygon) geometry).getExterior();
if (ring instanceof LinearRing) {
PositionList posList = ((LinearRing) ring).getPositionList();
Element polygonElement = new Element("polygon", GeoRSSModule.SIMPLE_NS);
polygonElement.addContent(posListToString(posList));
element.addContent(polygonElement);
}
else {
System.err.println("GeoRSS simple format can't handle rings of type: " + ring.getClass().getName());
}
if (((Polygon) geometry).getInterior() != null || !((Polygon) geometry).getInterior().isEmpty()) {
System.err.println("GeoRSS simple format can't handle interior rings (ignored)");
}
}
else if (geometry instanceof Envelope) {
Envelope envelope = (Envelope)geometry;
Element boxElement = new Element("box", GeoRSSModule.SIMPLE_NS);
boxElement.addContent(envelope.getMinLatitude() + " " + envelope.getMinLongitude() + " " +
envelope.getMaxLatitude() + " " + envelope.getMaxLongitude());
element.addContent(boxElement);
}
else {
System.err.println("GeoRSS simple format can't handle geometries of type: " + geometry.getClass().getName());
}
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
/**
* SimpleModuleImpl is the implementation of the {@link GeoRSSModule} Interface
* for the GeoRSS Simple format.
*
* @author Marc Wick
* @version $Id: SimpleModuleImpl.java,v 1.4 2007/04/18 09:59:29 marcwick Exp $
*
*/
public class SimpleModuleImpl extends GeoRSSModule {
public SimpleModuleImpl() {
super(GeoRSSModule.class, GeoRSSModule.GEORSS_GEORSS_URI);
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.feed.CopyFrom#getInterface()
*/
public Class getInterface() {
return GeoRSSModule.class;
}
}

View file

@ -0,0 +1,105 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
import org.jdom.Element;
import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.georss.GMLParser;
import com.sun.syndication.io.ModuleParser;
import org.rometools.feed.module.georss.geometries.*;
/**
* SimpleParser is a parser for the GeoRSS Simple format.
*
* @author Marc Wick
* @version $Id: SimpleParser.java,v 1.4 2007/04/18 09:59:29 marcwick Exp $
*
*/
public class SimpleParser implements ModuleParser {
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleParser#getNamespaceUri()
*/
public String getNamespaceUri() {
return GeoRSSModule.GEORSS_GEORSS_URI;
}
private static PositionList parsePosList(Element element) {
String coordinates = element.getText();
String[] coord = GeoRSSUtils.trimWhitespace(coordinates).split(" ");
PositionList posList = new PositionList();
for (int i=0; i<coord.length; i += 2) {
posList.add(Double.parseDouble(coord[i]), Double.parseDouble(coord[i+1]));
}
return posList;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleParser#parse(org.jdom.Element)
*/
public Module parse(Element element) {
Module geoRssModule = parseSimple(element);
return geoRssModule;
}
static Module parseSimple(Element element) {
GeoRSSModule geoRSSModule = null;
Element pointElement = element.getChild("point",
GeoRSSModule.SIMPLE_NS);
Element lineElement = element.getChild("line",
GeoRSSModule.SIMPLE_NS);
Element polygonElement = element.getChild("polygon",
GeoRSSModule.SIMPLE_NS);
Element boxElement = element.getChild("box",
GeoRSSModule.SIMPLE_NS);
Element whereElement = element
.getChild("where", GeoRSSModule.SIMPLE_NS);
if (pointElement != null) {
geoRSSModule = new SimpleModuleImpl();
String coordinates = pointElement.getText();
String[] coord = GeoRSSUtils.trimWhitespace(coordinates).split(" ");
Position pos = new Position(Double.parseDouble(coord[0]), Double.parseDouble(coord[1]));
geoRSSModule.setGeometry(new Point(pos));
} else if (lineElement != null) {
geoRSSModule = new SimpleModuleImpl();
PositionList posList = parsePosList(lineElement);
geoRSSModule.setGeometry(new LineString(posList));
} else if (polygonElement != null) {
geoRSSModule = new SimpleModuleImpl();
PositionList posList = parsePosList(polygonElement);
Polygon poly = new Polygon();
poly.setExterior(new LinearRing(posList));
geoRSSModule.setGeometry(poly);
} else if (boxElement != null) {
geoRSSModule = new SimpleModuleImpl();
String coordinates = boxElement.getText();
String[] coord = GeoRSSUtils.trimWhitespace(coordinates).split(" ");
Envelope envelope = new Envelope(Double.parseDouble(coord[0]), Double.parseDouble(coord[1]),
Double.parseDouble(coord[2]), Double.parseDouble(coord[3]));
geoRSSModule.setGeometry(envelope);
} else if (whereElement != null) {
geoRSSModule = (GeoRSSModule)GMLParser.parseGML(whereElement);
}
return geoRSSModule;
}
}

View file

@ -0,0 +1,108 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.jdom.Element;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;
import org.rometools.feed.module.georss.geometries.*;
/**
* W3CGeoGenerator produces georss elements in georss W3C geo format.
*
* @author Marc Wick
* @version $Id: W3CGeoGenerator.java,v 1.3 2007/04/18 09:59:30 marcwick Exp $
*
*/
public class W3CGeoGenerator implements ModuleGenerator {
private static boolean isShort = true;
private static final Set NAMESPACES;
static {
Set nss = new HashSet();
nss.add(GeoRSSModule.W3CGEO_NS);
NAMESPACES = Collections.unmodifiableSet(nss);
}
public static void enableDefaultPointElement(){
isShort = false;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleGenerator#getNamespaceUri()
*/
public String getNamespaceUri() {
return GeoRSSModule.GEORSS_W3CGEO_URI;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleGenerator#getNamespaces()
*/
public Set getNamespaces() {
return NAMESPACES;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleGenerator#generate(com.sun.syndication.feed.module.Module,
* org.jdom.Element)
*/
public void generate(Module module, Element element) {
// this is not necessary, it is done to avoid the namespace definition
// in every item.
Element root = element;
while (root.getParent() != null && root.getParent() instanceof Element) {
root = (Element) element.getParent();
}
root.addNamespaceDeclaration(GeoRSSModule.W3CGEO_NS);
Element pointElement = element;
if (!isShort) {
pointElement = new Element("Point", GeoRSSModule.W3CGEO_NS);
element.addContent(pointElement);
}
GeoRSSModule geoRSSModule = (GeoRSSModule) module;
AbstractGeometry geometry = geoRSSModule.getGeometry();
if (geometry instanceof Point) {
Position pos = ((Point)geometry).getPosition();
Element latElement = new Element("lat", GeoRSSModule.W3CGEO_NS);
latElement.addContent(String.valueOf(pos.getLatitude()));
pointElement.addContent(latElement);
Element lngElement = new Element("long", GeoRSSModule.W3CGEO_NS);
lngElement.addContent(String.valueOf(pos.getLongitude()));
pointElement.addContent(lngElement);
}
else {
System.err.println("W3C Geo format can't handle geometries of type: " + geometry.getClass().getName());
}
}
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
/**
* W3CGeoModuleImpl is the implementation of the {@link GeoRSSModule} Interface
* for the W3C geo format.
*
* @author Marc Wick
* @version $Id: W3CGeoModuleImpl.java,v 1.2 2007/04/18 09:59:29 marcwick Exp $
*
*/
public class W3CGeoModuleImpl extends GeoRSSModule {
public W3CGeoModuleImpl() {
super(GeoRSSModule.class, GeoRSSModule.GEORSS_W3CGEO_URI);
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.feed.CopyFrom#getInterface()
*/
public Class getInterface() {
return GeoRSSModule.class;
}
}

View file

@ -0,0 +1,79 @@
/*
* Copyright 2006 Marc Wick, geonames.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.georss;
import org.jdom.Element;
import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleParser;
import org.rometools.feed.module.georss.geometries.*;
/**
* W3CGeoParser is a parser for the W3C geo format.
*
* @author Marc Wick
* @version $Id: W3CGeoParser.java,v 1.4 2007/04/18 09:59:29 marcwick Exp $
*
*/
public class W3CGeoParser implements ModuleParser {
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleParser#getNamespaceUri()
*/
public String getNamespaceUri() {
return GeoRSSModule.GEORSS_W3CGEO_URI;
}
static Module parseW3C(Element element) {
GeoRSSModule geoRSSModule = null;
// do we have an optional "Point" element ?
Element pointElement = element
.getChild("Point", GeoRSSModule.W3CGEO_NS);
// we don't have an optional "Point" element
if (pointElement == null) {
pointElement = element;
}
Element lat = pointElement.getChild("lat", GeoRSSModule.W3CGEO_NS);
Element lng = pointElement.getChild("long", GeoRSSModule.W3CGEO_NS);
if (lng == null)
lng = pointElement.getChild("lon", GeoRSSModule.W3CGEO_NS);
if (lat != null && lng != null) {
geoRSSModule = new W3CGeoModuleImpl();
Position pos = new Position(Double.parseDouble(lat.getText()), Double.parseDouble(lng.getText()));
geoRSSModule.setGeometry(new Point(pos));
}
return geoRSSModule;
}
/*
* (non-Javadoc)
*
* @see com.sun.syndication.io.ModuleParser#parse(org.jdom.Element)
*/
public Module parse(Element element) {
Module geoRssModule = parseW3C(element);
return geoRssModule;
}
}

View file

@ -0,0 +1,22 @@
/*
* Curve.java
*
* Created on 8. februar 2007, 10:39
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
/**
* Abstract base class for Curves (linear objects)
* @author runaas
*/
public abstract class AbstractCurve extends AbstractGeometricPrimitive {
/** Creates a new instance of Curve */
public AbstractCurve() {
}
}

View file

@ -0,0 +1,23 @@
/*
* GeometricPrimitive.java
*
* Created on 8. februar 2007, 10:09
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
/**
* Abstract base class for geometric primitives (non-composite geometric objects)
* @author runaas
*/
public abstract class AbstractGeometricPrimitive extends AbstractGeometry {
/** Creates a new instance of GeometricPrimitive */
public AbstractGeometricPrimitive() {
}
}

View file

@ -0,0 +1,36 @@
/*
* Geometry.java
*
* Created on 8. februar 2007, 10:00
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
import java.io.Serializable;
/**
* Abstract base class for geometries.
*
* @author runaas
*/
public abstract class AbstractGeometry implements Cloneable, Serializable {
/** Creates a new instance of Geometry */
public AbstractGeometry() {
}
/**
* Make a deep copy of the geometric object
* @return A copy of the object
*/
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public boolean equals(Object obj) {
return obj != null && obj.getClass() == getClass();
}
}

View file

@ -0,0 +1,27 @@
/*
* AbstractRing.java
*
* Created on 8. februar 2007, 11:14
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
import java.io.Serializable;
/**
* Abstract base class for rings (closed linear objects used for polygon borders)
* @author runaas
*/
public abstract class AbstractRing implements Cloneable, Serializable {
/** Creates a new instance of AbstractRing */
public AbstractRing() {
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}

View file

@ -0,0 +1,22 @@
/*
* Surface.java
*
* Created on 8. februar 2007, 10:41
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
/**
* Abstract base class for surface (area) objects
* @author runaas
*/
public abstract class AbstractSurface extends AbstractGeometricPrimitive {
/** Creates a new instance of Surface */
public AbstractSurface() {
}
}

View file

@ -0,0 +1,96 @@
/*
* Envelope.java
*
* Created on 12. februar 2007, 13:07
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
/**
* Envelope, a bounding box spanned by an upper right and lower left corner point.
* Note that if the box spans the -180 180 degree meridian the numerical value of the
* minLongitude may be greater than the maxLongitude.
*
* @author runaas
*/
public class Envelope extends AbstractGeometry {
protected double minLatitude, minLongitude, maxLatitude, maxLongitude;
/** Creates a new instance of Envelope */
public Envelope() {
minLatitude = minLongitude = maxLatitude = maxLongitude = Double.NaN;
}
/**
* Construct object from coordinate values
*
* @param minLatitude
* @param minLongitude
* @param maxLatitude
* @param maxLongitude
*/
public Envelope(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude) {
this.minLatitude = minLatitude;
this.minLongitude = minLongitude;
this.maxLatitude = maxLatitude;
this.maxLongitude = maxLongitude;
}
/**
* @return the minimum longitude
*/
public double getMinLongitude() {
return minLongitude;
}
/**
* @return the minimum latitude
*/
public double getMinLatitude() {
return minLatitude;
}
/**
* @return the maximum longitude
*/
public double getMaxLongitude() {
return maxLongitude;
}
/**
* @return the maximum latitude
*/
public double getMaxLatitude() {
return maxLatitude;
}
/**
* @param v minimum longitude
*/
public void setMinLongitude(double v) {
minLongitude = v;
}
/**
* @param v minimum latitude
*/
public void setMinLatitude(double v) {
minLatitude = v;
}
/**
* @param v maximum longitude
*/
public void setMaxLongitude(double v) {
maxLongitude = v;
}
/**
* @param v maximum latitude
*/
public void setMaxLatitude(double v) {
maxLatitude = v;
}
}

View file

@ -0,0 +1,65 @@
/*
* LineString.java
*
* Created on 8. februar 2007, 10:40
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
/**
* Linear object constructed by linear interpolation between points
* @author runaas
*/
public final class LineString extends AbstractCurve {
private PositionList posList;
/** Creates a new instance of LineString */
public LineString() {
}
/**
* Construct object from a position list
*/
public LineString(PositionList posList) {
this.posList = posList;
}
public Object clone() throws CloneNotSupportedException {
LineString retval = (LineString)super.clone();
if (posList != null)
retval.posList = (PositionList)posList.clone();
return retval;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
return getPositionList().equals(((LineString)obj).getPositionList());
}
/**
* Get the position list
*
* @return the positionlist
*/
public PositionList getPositionList() {
if (posList == null)
posList = new PositionList();
return posList;
}
/**
* Set the position list
*
* @param posList the new position list
*/
public void setPositionList(PositionList posList) {
this.posList = posList;
}
}

View file

@ -0,0 +1,62 @@
/*
* LinearLing.java
*
* Created on 8. februar 2007, 11:14
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
/**
* Linear boundary object constructed by linear interpolation between points.
* Start and end point should be identical.
* @author runaas
*/
public final class LinearRing extends AbstractRing {
private PositionList posList;
/** Creates a new instance of LinearLing */
public LinearRing() {
}
public LinearRing(PositionList posList) {
this.posList = posList;
}
public Object clone() throws CloneNotSupportedException {
LinearRing retval = (LinearRing)super.clone();
if (posList != null)
retval.posList = (PositionList)posList.clone();
return retval;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
return getPositionList().equals(((LinearRing)obj).getPositionList());
}
/**
* Get the position list
*
* @return the positionlist
*/
public PositionList getPositionList() {
if (posList == null)
posList = new PositionList();
return posList;
}
/**
* Set the position list
*
* @param posList the new position list
*/
public void setPositionList(PositionList posList) {
this.posList = posList;
}
}

View file

@ -0,0 +1,62 @@
/*
* Point.java
*
* Created on 8. februar 2007, 10:24
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
/**
* Point object, contains a position
* @author runaas
*/
public final class Point extends AbstractGeometricPrimitive {
private Position pos;
/** Creates a new instance of Point */
public Point() {
}
public Point(Position pos) {
this.pos = pos;
}
public Object clone() throws CloneNotSupportedException {
Point retval = (Point)super.clone();
if (pos != null)
retval.pos = (Position)pos.clone();
return retval;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
return getPosition().equals(((Point)obj).getPosition());
}
/**
* Get the position
*
* @return the position
*/
public Position getPosition() {
if (pos == null)
pos = new Position();
return pos;
}
/**
* Set the position
*
* @param pos the new position
*/
public void setPosition(Position pos) {
this.pos = pos;
}
}

View file

@ -0,0 +1,104 @@
/*
* Polygon.java
*
* Created on 8. februar 2007, 10:41
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
import java.util.*;
/**
* Polygon, a surface object bounded by one external ring and zero or more internal rings
* @author runaas
*/
public final class Polygon extends AbstractSurface implements Cloneable {
private AbstractRing exterior;
private List interior;
/** Creates a new instance of Polygon */
public Polygon() {
}
public Object clone() throws CloneNotSupportedException {
Polygon retval = (Polygon)super.clone();
if (exterior != null)
retval.exterior = (AbstractRing)exterior.clone();
if (interior != null) {
retval.interior = new ArrayList();
Iterator it = interior.iterator();
while (it.hasNext()) {
AbstractRing r = (AbstractRing)it.next();
retval.interior.add(r.clone());
}
}
return retval;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
Polygon pol = (Polygon)obj;
if (exterior == null && pol.exterior == null)
;
else if (exterior == null || pol.exterior == null)
return false;
else if (!exterior.equals(pol.exterior))
return false;
// Not efficient.... (but the number of internal ringr is usually small).
Iterator it = interior.iterator();
while (it.hasNext())
if (!pol.interior.contains(it.next()))
return false;
it = pol.interior.iterator();
while (it.hasNext())
if (!interior.contains(it.next()))
return false;
return true;
}
/**
* Retrieve the outer border
*
* @return the border ring
*/
public AbstractRing getExterior() {
return exterior;
}
/**
* Retrieve the inner border
*
* @return the list of border rings
*/
public List getInterior() {
if (interior == null)
interior = new ArrayList();
return interior;
}
/**
* Set the outer border
*
* @param exterior the outer ring
*/
public void setExterior(AbstractRing exterior) {
this.exterior = exterior;
}
/**
* Set the list of inner borders (holes)
*
* @param interior the list of inner rings
*/
public void setInterior(List interior) {
this.interior = interior;
}
}

View file

@ -0,0 +1,84 @@
/*
* Position.java
*
* Created on 8. februar 2007, 11:11
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
import java.io.Serializable;
/**
* A two dimensional position represented by latitude and longitude decimal degrees in WGS84
* @author runaas
*/
public class Position implements Cloneable, Serializable {
private double latitude;
private double longitude;
/** Creates a new instance of Position */
public Position() {
latitude = Double.NaN;
longitude = Double.NaN;
}
/**
* Create Position from a pair of coordinate values
*
* @param latitude
* @param longitude
*/
public Position(double latitude, double longitude) {
this.latitude = latitude;
this.longitude = longitude;
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
Position p = (Position)obj;
return p.latitude == latitude && p.longitude == longitude;
}
/**
* @return latitude
*/
public double getLatitude() {
return latitude;
}
/**
* Set the latitude
*
* @param latitude the new latitude
*/
public void setLatitude(double latitude) {
this.latitude = latitude;
}
/**
* @return longitude
*/
public double getLongitude() {
return longitude;
}
/**
* Set the longitude
*
* @param longitude the new longitude
*/
public void setLongitude(double longitude) {
this.longitude = longitude;
}
}

View file

@ -0,0 +1,144 @@
/*
* PositionList.java
*
* Created on 8. februar 2007, 11:12
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.georss.geometries;
import java.io.Serializable;
/**
* A list of geographic positions, latitude, longitude decimal degrees WGS84
* @author runaas
*/
public class PositionList implements Cloneable, Serializable {
private double [] latitude;
private double [] longitude;
private int size;
/** Creates a new empty instance of PositionList */
public PositionList() {
size = 0;
}
public Object clone() throws CloneNotSupportedException {
PositionList retval = (PositionList)super.clone();
if (latitude != null)
retval.latitude = (double [])(latitude.clone());
if (longitude != null)
retval.longitude = (double [])(longitude.clone());
retval.size = size;
return retval;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
PositionList p = (PositionList)obj;
if (p.size != size)
return false;
for (int i=0; i<size; ++i)
if (p.latitude[i] != latitude[i] || p.longitude[i] != longitude[i])
return false;
return true;
}
private void ensureCapacity(int new_size) {
if (longitude != null && longitude.length >= new_size)
return;
if (new_size < 4)
new_size = 4;
else
new_size = (int)Math.ceil(Math.pow(2, Math.ceil(Math.log(new_size)/Math.log(2))));
double [] tmp = new double[new_size];
if (longitude != null)
System.arraycopy(longitude, 0, tmp, 0, size);
longitude = tmp;
tmp = new double[new_size];
if (latitude != null)
System.arraycopy(latitude, 0, tmp, 0, size);
latitude = tmp;
}
/**
* @return the number of positions in the list
*/
public int size() {
return size;
}
/**
* @param pos position index
* @return longitude for position
*/
public double getLongitude(int pos) {
return longitude[pos];
}
/**
* @param pos position index
* @return latitude for position
*/
public double getLatitude(int pos) {
return latitude[pos];
}
/**
* Add a position at the end of the list
* @param latitude
* @param longitude
*/
public void add(double latitude, double longitude) {
ensureCapacity(size+1);
this.longitude[size] = longitude;
this.latitude[size] = latitude;
++size;
}
/**
* Add a position at a given index in the list. The rest of the list is
* shifted one place to the "right"
*
* @param pos position index
* @param latitude
* @param longitude
*/
public void insert(int pos, double latitude, double longitude) {
ensureCapacity(size+1);
System.arraycopy(this.longitude, pos, this.longitude, pos+1, size-pos);
System.arraycopy(this.latitude, pos, this.latitude, pos+1, size-pos);
this.longitude[pos] = longitude;
this.latitude[pos] = latitude;
++size;
}
/**
* Replace the position at the index with new values
*
* @param pos position index
* @param latitude
* @param longitude
*/
public void replace(int pos, double latitude, double longitude) {
this.longitude[pos] = longitude;
this.latitude[pos] = latitude;
}
/**
* Remove the position at the index, the rest of the list is shifted one place to the "left"
*
* @param pos position index
*/
public void remove(int pos) {
System.arraycopy(longitude, pos+1, longitude, pos, size-pos-1);
System.arraycopy(latitude, pos+1, latitude, pos, size-pos-1);
--size;
}
}

View file

@ -0,0 +1,14 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Geometry package documetation</title>
</head>
<body>
This package contains classes for handling of geometric objects in a
geographical context, mainly for
use with the GeoRSS library. The geometry objects closely mimics the model
used for the geometry part of <a href="http://www.opengis.net/gml">GML</a>
3.1.1 "simple features", and supports the whole GeoRSS GML profile.
</body>
</html>

View file

@ -0,0 +1,46 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>GeoRSS package documentation</title>
</head>
<body>
This package contains classes to enable the rome rss library with georss support.
GeoRSS describes a number of ways to encoding location in RSS feeds
<h3>Code Examples </h3>
<h4>GeoRSS Consumer</h4>
<pre> SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(new URL(
"http://www.geonames.org/recent-changes.xml")));
List&lt;syndentry&gt; entries = feed.getEntries();
for (SyndEntry entry : entries) {
GeoRSSModule geoRSSModule = GeoRSSUtils.getGeoRSS(entry);
System.out.println(entry.getTitle() + " : lat="
+ geoRSSModule.getPosition().getLatitude() + ",lng="
+ geoRSSModule.getPosition().getLongitude() + ", desc="
+ entry.getDescription().getValue() + "; time="
+ entry.getPublishedDate());
}
</pre>
<h4>GeoRSS Producer</h4>
<pre> GeoRSSModule geoRSSModule = new W3CGeoModuleImpl();
//GeoRSSModule geoRSSModule = new SimpleModuleImpl();
geoRSSModule.setPosition(new Position(47.0, 9.0));
entry.getModules().add(geoRSSModule);
</pre>
</body>
</html>

View file

@ -0,0 +1,226 @@
/*
* AbstractITunesObject.java
*
* Created on August 1, 2005, 7:37 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.itunes;
/**
* This is an abstract object that implements the attributes common across Feeds
* or Items in an iTunes compatible RSS feed.
* @version $Revision: 1.4 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public abstract class AbstractITunesObject implements ITunes, java.lang.Cloneable {
/**
* The URI that iTunes used for its custom tags.
* <p>What is up with using a versioned DTD anyway?</p>\
*/
public static final String URI = "http://www.itunes.com/dtds/podcast-1.0.dtd";
/**
* The RDF namespace URI.
*/
public static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
/**
* A default prefix to use for itunes tags.
*/
public static final String PREFIX = "itunes";
private String author;
private boolean block;
private boolean explicit;
private String[] keywords;
private String subtitle;
private String summary;
/**
* Defined by the ROME module API
* @param obj Object to copy from
*/
public abstract void copyFrom(Object obj);
/**
* Defined by the ROME API
* @return Class of the Interface for this module.
*/
public Class getInterface() {
return getClass();
}
/**
* The URI this module implements
* @return "http://www.itunes.com/dtds/podcast-1.0.dtd"
*/
public String getUri() {
return AbstractITunesObject.URI;
}
/**
* Required by the ROME API
* @return A clone of this module object
*/
public abstract Object clone();
/**
* Returns the author string for this feed or entry
* @return Returns the author string for this feed or entry
*/
public String getAuthor() {
return author;
}
/**
* Sets the author string for this feed or entry
* @param author Sets the author string for this feed or entry
*/
public void setAuthor(String author) {
this.author = author;
}
/**
* Boolean as to whether to block this feed or entry
* @return Boolean as to whether to block this feed or entry
*/
public boolean getBlock() {
return block;
}
/**
* Boolean as to whether to block this feed or entry
* @param block Boolean as to whether to block this feed or entry
*/
public void setBlock(boolean block) {
this.block = block;
}
/**
* Boolean as to whether this feed or entry contains adult content
* @return Boolean as to whether this feed or entry contains adult content
*/
public boolean getExplicit() {
return explicit;
}
/**
* Boolean as to whether this feed or entry contains adult content
* @param explicit Boolean as to whether this feed or entry contains adult content
*/
public void setExplicit(boolean explicit) {
this.explicit = explicit;
}
/**
* A list of keywords for this feed or entry
*
* Must not contain spaces
* @return A list of keywords for this feed or entry
*/
public String[] getKeywords() {
return keywords == null ? new String[0] : keywords;
}
/**
* A list of keywords for this feed or entry
*
* Must not contain spaces
* @param keywords A list of keywords for this feed or enty
*/
public void setKeywords(String[] keywords) {
this.keywords = keywords;
}
/**
* A subtitle for this feed or entry
* @return A subtitle for this feed or entry
*/
public String getSubtitle() {
return subtitle;
}
/**
* A subtitle for this feed or entry
* @param subtitle A subtitle for this feed or entry
*/
public void setSubtitle(String subtitle) {
this.subtitle = subtitle;
}
/**
* A subtitle for this feed or entry
* @return A subtitle for this feed or entry
*/
public String getSummary() {
return summary;
}
/**
* A subtitle for this feed or entry
* @param summary A subtitle for this feed or entry
*/
public void setSummary(String summary) {
this.summary = summary;
}
public String toString() {
StringBuffer sb = new StringBuffer("[");
sb.append(" Author: ");
sb.append(this.getAuthor());
sb.append(" Block: ");
sb.append(this.getBlock());
sb.append(" Explicit: ");
sb.append(this.getExplicit());
sb.append(" Keywords: ");
if (this.getKeywords() != null) {
for (int i = 0; i < keywords.length; i++) {
sb.append("'" + this.getKeywords()[i] + "'");
}
}
sb.append(" Subtitle: ");
sb.append(this.getSubtitle());
sb.append(" Summary: ");
sb.append(this.getSummary());
sb.append("]");
return sb.toString();
}
}

View file

@ -0,0 +1,67 @@
/*
* EntryInformation.java
*
* Created on November 19, 2005, 10:56 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.itunes;
import org.rometools.feed.module.itunes.types.Duration;
/**
* This class contains information for iTunes podcast feeds that exist at the Item level.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*
*/
public interface EntryInformation extends ITunes{
/**
* Returns the Duration object for this Item
* @return Returns the Duration object for this Item
*/
public Duration getDuration();
/**
* Sets the Duration object for this Item
* @param duration Sets the Duration object for this Item
*/
public void setDuration(Duration duration) ;
}

View file

@ -0,0 +1,119 @@
/*
* EntryInformation.java
*
* Created on August 1, 2005, 7:37 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.itunes;
import org.rometools.feed.module.itunes.types.Duration;
/**
* This class contains information for iTunes podcast feeds that exist at the Item level.
* @version $Revision: 1.2 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class EntryInformationImpl extends AbstractITunesObject implements EntryInformation {
private Duration duration;
/**
* Creates a new instance of EntryInformationImpl
*/
public EntryInformationImpl() {
}
/**
* Returns the Duration object for this Item
* @return Returns the Duration object for this Item
*/
public Duration getDuration() {
return duration;
}
/**
* Sets the Duration object for this Item
* @param duration Sets the Duration object for this Item
*/
public void setDuration(Duration duration) {
this.duration = duration;
}
/**
* Defined by the ROME module API
* @param obj Object to copy from
*/
public void copyFrom(Object obj) {
EntryInformationImpl info = (EntryInformationImpl) obj;
this.setAuthor(info.getAuthor());
this.setBlock(info.getBlock());
if (info.getDuration() != null) {
this.setDuration(new Duration(info.getDuration().getMilliseconds()));
}
this.setExplicit(info.getExplicit());
if (info.getKeywords() != null) {
this.setKeywords((String[]) info.getKeywords().clone());
}
this.setSubtitle(info.getSubtitle());
this.setSummary(info.getSummary());
}
/**
* Required by the ROME API
* @return A clone of this module object
*/
public Object clone() {
EntryInformationImpl info = new EntryInformationImpl();
info.copyFrom(this);
return info;
}
public String toString() {
StringBuffer sb = new StringBuffer("[");
sb.append(" Duration: ");
sb.append(this.getDuration());
sb.append("]");
sb.append(super.toString());
return sb.toString();
}
}

View file

@ -0,0 +1,106 @@
/*
* FeedInformation.java
*
* Created on November 19, 2005, 10:57 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.itunes;
import java.net.URL;
import java.util.List;
/**
* This class contains information for iTunes podcast feeds that exist at the Channel level.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public interface FeedInformation extends ITunes {
/**
* The parent categories for this feed
* @return The parent categories for this feed
*/
public List getCategories() ;
/**
* The parent categories for this feed
* @param categories The parent categories for this feed
*/
public void setCategories(List categories);
/**
* Sets the URL for the image.
*
* NOTE: To specification images should be in PNG or JPEG format.
* @param image Sets the URL for the image.
*/
public void setImage(URL image);
/**
* Returns the URL for the image.
*
* NOTE: To specification images should be in PNG or JPEG format.
* @return Returns the URL for the image.
*/
public URL getImage();
/**
* Sets the owner email address for the feed.
* @param ownerEmailAddress Sets the owner email address for the feed.
*/
public void setOwnerEmailAddress(String ownerEmailAddress);
/**
* Returns the owner email address for the feed.
* @return Returns the owner email address for the feed.
*/
public String getOwnerEmailAddress();
/**
* Sets the owner name for the feed
* @param ownerName Sets the owner name for the feed
*/
public void setOwnerName(String ownerName);
/**
* Returns the owner name for the feed
* @return Returns the owner name for the feed
*/
public String getOwnerName();
}

View file

@ -0,0 +1,197 @@
/*
* FeedInformation.java
*
* Created on August 1, 2005, 7:11 PM
*
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.itunes;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Logger;
/**
* This class contains information for iTunes podcast feeds that exist at the Channel level.
* @version $Revision: 1.2 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class FeedInformationImpl extends AbstractITunesObject implements FeedInformation {
private String ownerName;
private String ownerEmailAddress;
private URL image;
private List categories;
/**
* Creates a new instance of FeedInformationImpl
*/
public FeedInformationImpl() {
}
/**
* The parent categories for this feed
* @return The parent categories for this feed
*/
public List getCategories() {
return (categories==null) ? (categories=new ArrayList()) : categories;
}
/**
* The parent categories for this feed
* @param categories The parent categories for this feed
*/
public void setCategories(List categories) {
this.categories = categories;
}
/**
* Returns the owner name for the feed
* @return Returns the owner name for the feed
*/
public String getOwnerName() {
return ownerName;
}
/**
* Sets the owner name for the feed
* @param ownerName Sets the owner name for the feed
*/
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
/**
* Returns the owner email address for the feed.
* @return Returns the owner email address for the feed.
*/
public String getOwnerEmailAddress() {
return ownerEmailAddress;
}
/**
* Sets the owner email address for the feed.
* @param ownerEmailAddress Sets the owner email address for the feed.
*/
public void setOwnerEmailAddress(String ownerEmailAddress) {
this.ownerEmailAddress = ownerEmailAddress;
}
/**
* Returns the URL for the image.
*
* NOTE: To specification images should be in PNG or JPEG format.
* @return Returns the URL for the image.
*/
public URL getImage() {
return image;
}
/**
* Sets the URL for the image.
*
* NOTE: To specification images should be in PNG or JPEG format.
* @param image Sets the URL for the image.
*/
public void setImage(URL image) {
this.image = image;
}
/**
* Required by the ROME API
* @param obj object to copy property values from
*/
public void copyFrom(Object obj) {
FeedInformationImpl info = (FeedInformationImpl) obj;
this.setAuthor(info.getAuthor());
this.setBlock(info.getBlock());
this.getCategories().clear();
if (info.getCategories() != null) {
this.getCategories().addAll(info.getCategories());
}
this.setExplicit(info.getExplicit());
try {
if (info.getImage() != null) {
this.setImage(new URL(info.getImage().toExternalForm()));
}
} catch (MalformedURLException e) {
Logger.getAnonymousLogger().fine("Error copying URL:" + info.getImage());
}
if (info.getKeywords() != null) {
this.setKeywords((String[]) info.getKeywords().clone());
}
this.setOwnerEmailAddress(info.getOwnerEmailAddress());
this.setOwnerName(info.getOwnerName());
this.setSubtitle(info.getSubtitle());
this.setSummary(info.getSummary());
}
/**
* Returns a copy of this FeedInformationImpl object
*
* @return Returns a copy of this FeedInformationImpl object
*/
public Object clone() {
FeedInformationImpl info = new FeedInformationImpl();
info.copyFrom(this);
return info;
}
public String toString() {
StringBuffer sb = new StringBuffer("[");
sb.append(" email: ");
sb.append(this.getOwnerEmailAddress());
sb.append(" name: ");
sb.append(this.getOwnerName());
sb.append(" image: ");
sb.append(this.getImage());
sb.append(" categories: ");
sb.append(this.getCategories());
sb.append("]");
sb.append(super.toString());
return sb.toString();
}
}

View file

@ -0,0 +1,132 @@
/*
* ITunes.java
*
* Created on November 19, 2005, 10:58 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.itunes;
import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.itunes.types.Category;
/**
* This interface contains the methods common to all iTunes module points.
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.3 $
*/
public interface ITunes extends Module {
public static final String URI = AbstractITunesObject.URI;
/**
* Returns the author string for this feed or entry
* @return Returns the author string for this feed or entry
*/
public String getAuthor();
/**
* Sets the author string for this feed or entry
* @param author Sets the author string for this feed or entry
*/
public void setAuthor(String author) ;
/**
* Boolean as to whether to block this feed or entry
* @return Boolean as to whether to block this feed or entry
*/
public boolean getBlock();
/**
* Boolean as to whether to block this feed or entry
* @param block Boolean as to whether to block this feed or entry
*/
public void setBlock(boolean block) ;
/**
* Boolean as to whether this feed or entry contains adult content
* @return Boolean as to whether this feed or entry contains adult content
*/
public boolean getExplicit() ;
/**
* Boolean as to whether this feed or entry contains adult content
* @param explicit Boolean as to whether this feed or entry contains adult content
*/
public void setExplicit(boolean explicit) ;
/**
* A list of keywords for this feed or entry
*
* Must not contain spaces
* @return A list of keywords for this feed or entry
*/
public String[] getKeywords() ;
/**
* A list of keywords for this feed or entry
*
* Must not contain spaces
* @param keywords A list of keywords for this feed or enty
*/
public void setKeywords(String[] keywords);
/**
* A subtitle for this feed or entry
* @return A subtitle for this feed or entry
*/
public String getSubtitle();
/**
* A subtitle for this feed or entry
* @param subtitle A subtitle for this feed or entry
*/
public void setSubtitle(String subtitle);
/**
* A subtitle for this feed or entry
* @return A subtitle for this feed or entry
*/
public String getSummary() ;
/**
* A subtitle for this feed or entry
* @param summary A subtitle for this feed or entry
*/
public void setSummary(String summary);
}

View file

@ -0,0 +1,182 @@
/*
* ITunesGenerator.java
*
* Created on August 1, 2005, 10:44 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.itunes.io;
import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.itunes.AbstractITunesObject;
import org.rometools.feed.module.itunes.EntryInformationImpl;
import org.rometools.feed.module.itunes.FeedInformationImpl;
import org.rometools.feed.module.itunes.types.Category;
import com.sun.syndication.io.ModuleGenerator;
import org.jdom.Element;
import org.jdom.Namespace;
import java.util.HashSet;
import java.util.Iterator;
/**
* @version $Revision: 1.3 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ITunesGenerator implements ModuleGenerator {
private static final HashSet SET = new HashSet();
private static final Namespace NS = Namespace.getNamespace(AbstractITunesObject.PREFIX, AbstractITunesObject.URI);
static {
SET.add(NS);
}
/** Creates a new instance of ITunesGenerator */
public ITunesGenerator() {
}
public void generate(Module module, Element element) {
Element root = element;
while ((root.getParent() != null) && root.getParent() instanceof Element) {
root = (Element) root.getParent();
}
root.addNamespaceDeclaration(NS);
if (!(module instanceof AbstractITunesObject)) {
return;
}
AbstractITunesObject itunes = (AbstractITunesObject) module;
if (itunes instanceof FeedInformationImpl) {
//Do Channel Specific Stuff.
FeedInformationImpl info = (FeedInformationImpl) itunes;
Element owner = this.generateSimpleElement("owner", "");
Element email = this.generateSimpleElement("email", info.getOwnerEmailAddress());
owner.addContent(email);
Element name = this.generateSimpleElement("name", info.getOwnerName());
owner.addContent(name);
element.addContent(owner);
if (info.getImage() != null) {
Element image = this.generateSimpleElement("image", "");
image.setAttribute("href", info.getImage().toExternalForm());
element.addContent(image);
}
for (Iterator it = info.getCategories().iterator(); it.hasNext();) {
Category cat = (Category) it.next();
Element category = this.generateSimpleElement("category", "");
category.setAttribute("text", cat.getName());
if (cat.getSubcategory() != null) {
Element subcat = this.generateSimpleElement("category", "");
subcat.setAttribute("text", cat.getSubcategory().getName());
category.addContent(subcat);
}
element.addContent(category);
}
} else if (itunes instanceof EntryInformationImpl) {
EntryInformationImpl info = (EntryInformationImpl) itunes;
if (info.getDuration() != null) {
element.addContent(this.generateSimpleElement("duration", info.getDuration().toString()));
}
}
if (itunes.getAuthor() != null) {
element.addContent(this.generateSimpleElement("author", itunes.getAuthor()));
}
if (itunes.getBlock()) {
element.addContent(this.generateSimpleElement("block", ""));
}
if (itunes.getExplicit()) {
element.addContent(this.generateSimpleElement("explicit", "yes"));
} else {
element.addContent(this.generateSimpleElement("explicit", "no"));
}
if (itunes.getKeywords() != null) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < itunes.getKeywords().length; i++) {
if (i != 0) {
sb.append(", ");
}
sb.append(itunes.getKeywords()[i]);
}
element.addContent(this.generateSimpleElement("keywords", sb.toString()));
}
if (itunes.getSubtitle() != null) {
element.addContent(this.generateSimpleElement("subtitle", itunes.getSubtitle()));
}
if (itunes.getSummary() != null) {
element.addContent(this.generateSimpleElement("summary", itunes.getSummary()));
}
}
/** Returns the list of namespaces this module uses.
* @return set of Namespace objects.
*/
public java.util.Set getNamespaces() {
return SET;
}
/** Returns the namespace URI this module handles.
* @return Returns the namespace URI this module handles.
*/
public String getNamespaceUri() {
return AbstractITunesObject.URI;
}
protected Element generateSimpleElement(String name, String value) {
Element element = new Element(name, NS);
element.addContent(value);
return element;
}
}

View file

@ -0,0 +1,209 @@
/*
* ITunesParser.java
*
* Created on August 1, 2005, 8:29 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.itunes.io;
import org.rometools.feed.module.itunes.AbstractITunesObject;
import org.rometools.feed.module.itunes.EntryInformationImpl;
import org.rometools.feed.module.itunes.FeedInformationImpl;
import com.sun.syndication.io.ModuleParser;
import org.rometools.feed.module.itunes.types.Category;
import org.rometools.feed.module.itunes.types.Duration;
import org.rometools.feed.module.itunes.types.Subcategory;
import com.sun.syndication.io.WireFeedParser;
import org.jdom.Element;
import org.jdom.Namespace;
import org.jdom.output.XMLOutputter;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
import java.util.logging.Logger;
/**
* @version $Revision: 1.10 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ITunesParser implements ModuleParser {
static Logger log = Logger.getLogger(ITunesParser.class.getName());
Namespace ns = Namespace.getNamespace(AbstractITunesObject.URI);
/** Creates a new instance of ITunesParser */
public ITunesParser() {
}
public void setParser(WireFeedParser feedParser) {
}
public String getNamespaceUri() {
return AbstractITunesObject.URI;
}
public com.sun.syndication.feed.module.Module parse(org.jdom.Element element) {
AbstractITunesObject module = null;
if (element.getName().equals("channel")) {
FeedInformationImpl feedInfo = new FeedInformationImpl();
module = feedInfo;
//Now I am going to get the channel specific tags
Element owner = element.getChild("owner", ns);
if (owner != null) {
Element name = owner.getChild("name", ns);
if (name != null) {
feedInfo.setOwnerName(name.getValue().trim());
}
Element email = owner.getChild("email", ns);
if (email != null) {
feedInfo.setOwnerEmailAddress(email.getValue().trim());
}
}
Element image = element.getChild("image", ns);
if ((image != null) && (image.getAttributeValue("href") != null)) {
try {
URL imageURL = new URL(image.getAttributeValue("href").trim());
feedInfo.setImage(imageURL);
} catch (MalformedURLException e) {
log.finer("Malformed URL Exception reading itunes:image tag: " + image.getAttributeValue("href"));
}
}
List categories = element.getChildren("category", ns);
for (Iterator it = categories.iterator(); it.hasNext();) {
Element category = (Element) it.next();
if ((category != null) && (category.getAttribute("text") != null)) {
Category cat = new Category();
cat.setName(category.getAttribute("text").getValue().trim());
Element subcategory = category.getChild("category", ns);
if (subcategory != null && subcategory.getAttribute("text") != null) {
Subcategory subcat = new Subcategory();
subcat.setName(subcategory.getAttribute("text").getValue().trim());
cat.setSubcategory(subcat);
}
feedInfo.getCategories().add(cat);
}
}
} else if (element.getName().equals("item")) {
EntryInformationImpl entryInfo = new EntryInformationImpl();
module = entryInfo;
//Now I am going to get the item specific tags
Element duration = element.getChild("duration", ns);
if (duration != null && duration.getValue() != null ) {
Duration dur = new Duration(duration.getValue().trim());
entryInfo.setDuration(dur);
}
}
if (module != null) {
//All these are common to both Channel and Item
Element author = element.getChild("author", ns);
if (author != null && author.getText() != null ) {
module.setAuthor(author.getText());
}
Element block = element.getChild("block", ns);
if (block != null) {
module.setBlock(true);
}
Element explicit = element.getChild("explicit", ns);
if ((explicit != null) && explicit.getValue() != null
&& explicit.getValue().trim().equalsIgnoreCase("yes")) {
module.setExplicit(true);
}
Element keywords = element.getChild("keywords", ns);
if (keywords != null) {
StringTokenizer tok = new StringTokenizer(getXmlInnerText(keywords).trim(), ",");
String[] keywordsArray = new String[tok.countTokens()];
for (int i = 0; tok.hasMoreTokens(); i++) {
keywordsArray[i] = tok.nextToken();
}
module.setKeywords(keywordsArray);
}
Element subtitle = element.getChild("subtitle", ns);
if (subtitle != null) {
module.setSubtitle(subtitle.getTextTrim());
}
Element summary = element.getChild("summary", ns);
if (summary != null) {
module.setSummary(summary.getTextTrim());
}
}
return module;
}
protected String getXmlInnerText(Element e) {
StringBuffer sb = new StringBuffer();
XMLOutputter xo = new XMLOutputter();
List children = e.getContent();
sb.append(xo.outputString(children));
return sb.toString();
}
}

View file

@ -0,0 +1,43 @@
/*
* ITunesParserOldNamespace.java
*
* Created on April 23, 2006, 2:09 AM
*
* Copyright Robert Cooper, Temple of the Screaming Penguin
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
*/
package org.rometools.feed.module.itunes.io;
import org.jdom.Namespace;
import com.sun.syndication.io.WireFeedParser;
/**
*
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class ITunesParserOldNamespace extends ITunesParser{
String URI = "http://www.itunes.com/DTDs/Podcast-1.0.dtd";
/** Creates a new instance of ITunesParserOldNamespace */
public ITunesParserOldNamespace() {
super();
super.ns = Namespace.getNamespace( URI );
}
public String getNamespaceUri() {
return URI;
}
}

View file

@ -0,0 +1,74 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
This is a ROME plug in that implements the iTunes RSS extensions as defined
<a href="http://phobos.apple.com/static/iTunesRSS.html">by Apple</a> in their
documentation. BTW, an anti-shoutout to Apple for moving the original
<a href="http://phobos.apple.com/static/podcast_specifications.pdf">PDF spec
</a>. Thanks for making it harder than it needed to be.
<h2>Sample Usage:</h2>
<pre>
SyndFeedInput input = new SyndFeedInput();
SyndFeed syndfeed = input.build(new XmlReader(feed.toURL()));
Module module = syndfeed.getModule("http://www.itunes.com/DTDs/Podcast-1.0.dtd");
FeedInformation feedInfo = (FeedInformation) module;
System.out.println( feedInfo.getImage() );
System.out.println( feedInfo.getCategory() );
// Or to create a feed..
ArrayList modules = new ArrayList();
EntryInformation e = new EntryInformationImpl();
e.setDuration( new Duration( 10000 ) );
modules.add( e );
syndEntry.setModules( modules );
</pre>
Similarly you can get an EntryInformation object off SyndEntries or Items.
<pre>
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
</pre>
</body>
</html>

View file

@ -0,0 +1,123 @@
/*
* Category.java
*
* Created on August 1, 2005, 7:24 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.itunes.types;
import java.io.Serializable;
/**
* This Category information. Basically a name and an optional Subcategory.
* Categories are defined by Apple. See ITMS for a view.
* @version $Revision: 1.2 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class Category implements Serializable {
private String name;
private Subcategory subcategory;
/** Creates a new instance of Category */
public Category() {
}
/** Creates a new instance of Category with a given name.
* @param name Name of the category.
*/
public Category(String name) {
this.setName(name);
}
/**
* Returns the name of the category
* @return Returns the name of the category
*/
public String getName() {
return name;
}
/**
* Sets the name of the category
* @param name Sets the name of the category
*/
public void setName(String name) {
this.name = name;
}
/**
* Returns the Subcategory object for this category
* @return Returns the Subcategory object for this category
*/
public Subcategory getSubcategory() {
return subcategory;
}
/**
* Sets the Subcategory object for this category
* @param subcategory Sets the Subcategory object for this category
*/
public void setSubcategory(Subcategory subcategory) {
this.subcategory = subcategory;
}
/**
* Returns a copy of this category.
* @return Returns a copy of this category.
*/
public Object clone() {
Category c = new Category();
c.setName(this.getName());
if (this.getSubcategory() != null) {
c.setSubcategory((Subcategory) this.getSubcategory().clone());
}
return c;
}
public String toString() {
StringBuffer sb = new StringBuffer(this.getName());
if (this.getSubcategory() != null) {
sb.append(" -> " + this.getSubcategory().toString());
}
return sb.toString();
}
}

View file

@ -0,0 +1,157 @@
/*
* Duration.java
*
* Created on August 1, 2005, 7:45 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.itunes.types;
import java.text.NumberFormat;
import java.util.StringTokenizer;
import java.io.Serializable;
import com.sun.syndication.io.impl.NumberParser;
/**
* An encapsulation of the duration of a podcast. This will serialize (via .toString())
* to HH:MM:SS format, and can parse [H]*H:[M]*M:[S]*S or [M]*M:[S]*S.
* @version $Revision: 1.7 $
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
*/
public class Duration implements Serializable {
static final long SECOND = 1000;
static final long MINUTE = SECOND * 60;
static final long HOUR = MINUTE * 60;
static final NumberFormat NUM_FORMAT = NumberFormat.getNumberInstance();
static{
NUM_FORMAT.setMinimumFractionDigits(0);
NUM_FORMAT.setMaximumFractionDigits(0);
NUM_FORMAT.setMinimumIntegerDigits(2);
NUM_FORMAT.setGroupingUsed(false);
}
private long milliseconds;
/**
* Creates a new Duration object with 0 length.
*/
public Duration() {
super();
}
/**
* Creates a new instance of Duration specifying a length in milliseconds
* @param milliseconds Creates a new instance of Duration specifying a length in milliseconds
*/
public Duration(final long milliseconds) {
this.setMilliseconds(milliseconds);
}
/**
* Creates a new duration object with the given hours, minutes and seconds
* @param hours number of hours
* @param minutes number of minutes
* @param seconds number of seconds
*/
public Duration(final int hours, final int minutes, final float seconds) {
this.setMilliseconds((hours * HOUR) + (minutes * MINUTE) +
(long)(seconds * SECOND));
}
/**
* Creates a new Duration parsing the String value.
* @param duration A String to parse
*/
public Duration( final String duration ){
StringTokenizer tok = new StringTokenizer( duration, ":" );
switch (tok.countTokens() ){
case 1:
this.setMilliseconds( (long) (NumberParser.parseFloat(tok.nextToken(), 0f) * SECOND) );
break;
case 2:
this.setMilliseconds(NumberParser.parseLong( tok.nextToken(), 0l ) * MINUTE + (long) (NumberParser.parseFloat(tok.nextToken(), 0f) * SECOND) );
break;
case 3:
this.setMilliseconds(NumberParser.parseLong(tok.nextToken(), 0l) * HOUR + NumberParser.parseLong(tok.nextToken(), 0l) * MINUTE + (long) (NumberParser.parseFloat(tok.nextToken(), 0f) * SECOND) );
break;
default:
throw new RuntimeException("Illegal time value: "+ duration);
}
}
/**
* Returns a String representation in the formation HH:MM:SS
* @return Returns a String representation in the formation HH:MM:SS
*/
public String toString() {
Time time = new Time();
return NUM_FORMAT.format(time.hours) + ":" + NUM_FORMAT.format(time.minutes) + ":" +
NUM_FORMAT.format( Math.round(time.seconds) );
}
/**
* Returns the millisecond length
* @return the millisecond length
*/
public long getMilliseconds() {
return milliseconds;
}
/**
* Sets the millisecond length
* @param milliseconds the millisecond length
*/
public void setMilliseconds(long milliseconds) {
this.milliseconds = milliseconds;
}
private class Time {
int hours;
int minutes;
float seconds;
public Time() {
long time = getMilliseconds();
hours = (int) (time / HOUR);
time = time - (long) hours * HOUR;
minutes = (int) (time / MINUTE);
time = time - (long) minutes * MINUTE;
seconds = (float) ( (float) time / (float) SECOND);
}
}
}

View file

@ -0,0 +1,99 @@
/*
* SubCategory.java
*
* Created on August 1, 2005, 7:24 PM
*
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.itunes.types;
import java.io.Serializable;
/**
* This class represents a Subcategor of a Category.
* @author <a href="mailto:cooper@screaming-penguin.com">Robert "kebernet" Cooper</a>
* @version $Revision: 1.2 $
*/
public class Subcategory implements Serializable {
private String name;
/** Creates a new instance of SubCategory */
public Subcategory() {
}
/** Creates a new instance of Category with a given name.
* @param name Name of the category.
*/
public Subcategory(String name) {
this.setName(name);
}
/**
* Returns the name of the subcategory.
* @return Returns the name of the subcategory.
*/
public String getName() {
return name;
}
/**
* Set the name of the subcategory.
* @param name Set the name of the subcategory.
*/
public void setName(String name) {
this.name = name;
}
/**
* Clones the object.
* @return Clone of the object.
*/
public Object clone() {
Subcategory sc = new Subcategory();
sc.setName(this.getName());
return sc;
}
/**
* String representation of the object.
* @return String representation of the object.
*/
public String toString() {
return new StringBuffer(this.getName()).toString();
}
}

View file

@ -0,0 +1,47 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
This package contains data types for use wit the iTunes plug in.
<pre>
* This library is provided under dual licenses.
* You may choose the terms of the Lesser General Public License or the Apache
* License at your discretion.
*
* Copyright (C) 2005 Robert Cooper, Temple of the Screaming Penguin
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
</pre>
</body>
</html>

View file

@ -0,0 +1,45 @@
/*
* MediaEntryModule.java
*
* Created on April 19, 2006, 1:15 AM
*
* This code is currently released under the Mozilla Public License.
* http://www.mozilla.org/MPL/
*
* Alternately you may apply the terms of the Apache Software License
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.mediarss;
import org.rometools.feed.module.mediarss.types.MediaContent;
import org.rometools.feed.module.mediarss.types.MediaGroup;
/**
* Represents entry/item level information.
* @author cooper
*/
public interface MediaEntryModule extends MediaModule {
/**
* Returns the MediaContent items for the entry.
* @return Returns the MediaContent items for the entry.
*/
public MediaContent[] getMediaContents();
/**
* Returns the media groups for the entry.
* @return Returns the media groups for the entry.
*/
public MediaGroup[] getMediaGroups();
}

View file

@ -0,0 +1,116 @@
/*
* Copyright 2006 Nathanial X. Freitas, openvision.tv
*
* This code is currently released under the Mozilla Public License.
* http://www.mozilla.org/MPL/
*
* Alternately you may apply the terms of the Apache Software License
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.mediarss;
import java.io.Serializable;
import com.sun.syndication.feed.impl.EqualsBean;
import com.sun.syndication.feed.impl.ToStringBean;
import org.rometools.feed.module.mediarss.types.MediaContent;
import org.rometools.feed.module.mediarss.types.MediaGroup;
import org.rometools.feed.module.mediarss.types.Metadata;
/**
* Represents information for an Entry/Item level.
* @author Nathanial X. Freitas
*/
public class MediaEntryModuleImpl extends MediaModuleImpl
implements MediaEntryModule, Cloneable, Serializable {
private static final long serialVersionUID = -1564409507033924835L;
/*
* the variables in the MediaModule are set when they apply to
* all MediaContent instances in the set
*/
private MediaContent[] mediaContents = new MediaContent[0];
private MediaGroup[] mediaGroups = new MediaGroup[0];
/**
* Creates a new instance.
*/
public MediaEntryModuleImpl() {
super(MediaEntryModule.class, MediaModule.URI);
}
/**
* MediaContent items for the entry
* @param mediaContents MediaContent items for the entry
*/
public void setMediaContents(MediaContent[] mediaContents) {
this.mediaContents = (mediaContents == null) ? new MediaContent[0]
: mediaContents;
}
/**
* MediaContent items for the entry
* @return MediaContent items for the entry
*/
public MediaContent[] getMediaContents() {
return mediaContents;
}
/**
* MediaGroups for the entry
* @param mediaGroups MediaGroups for the entry
*/
public void setMediaGroups(MediaGroup[] mediaGroups) {
this.mediaGroups = (mediaGroups == null) ? new MediaGroup[0] : mediaGroups;
}
/**
* MediaGroups for the entry
* @return MediaGroups for the entry
*/
public MediaGroup[] getMediaGroups() {
return mediaGroups;
}
public Object clone() {
MediaEntryModuleImpl m = new MediaEntryModuleImpl();
m.setMediaContents((MediaContent[]) mediaContents.clone());
m.setMediaGroups((MediaGroup[]) mediaGroups.clone());
m.setMetadata((getMetadata() == null) ? null
: (Metadata) getMetadata().clone());
m.setPlayer(getPlayer());
return m;
}
public boolean equals(Object obj) {
EqualsBean eBean = new EqualsBean(MediaEntryModuleImpl.class, this);
return eBean.beanEquals(obj);
}
public int hashCode() {
EqualsBean equals = new EqualsBean(MediaEntryModuleImpl.class, this);
return equals.beanHashCode();
}
public String toString() {
ToStringBean tsBean = new ToStringBean(MediaEntryModuleImpl.class, this);
return tsBean.toString();
}
}

View file

@ -0,0 +1,51 @@
/*
* Copyright 2006 Nathanial X. Freitas, openvision.tv
*
* This code is currently released under the Mozilla Public License.
* http://www.mozilla.org/MPL/
*
* Alternately you may apply the terms of the Apache Software License
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.rometools.feed.module.mediarss;
import com.sun.syndication.feed.module.Module;
import org.rometools.feed.module.mediarss.types.Metadata;
import org.rometools.feed.module.mediarss.types.PlayerReference;
/**
* This is the base module for MediaRSS.
* <p>It represents information that can be stored at the feed level,
* as well is a base for entry level information, as the same
* information can apply.</p>
* @author Nathanial X. Freitas
*/
public interface MediaModule extends Module {
//the URI of the MediaRSS specification as hosted by yahoo
public final static String URI = "http://search.yahoo.com/mrss/";
/**
* Returns Metadata associated with the feed.
* @return Returns Metadata associated with the feed.
*/
public Metadata getMetadata();
/**
* Returns a player reference associated with the feed.
* @return Returns a player reference associated with the feed.
*/
public PlayerReference getPlayer();
}

View file

@ -0,0 +1,110 @@
/*
* MediaModuleImpl.java
*
* Created on April 19, 2006, 1:17 AM
*
* This code is currently released under the Mozilla Public License.
* http://www.mozilla.org/MPL/
*
* Alternately you may apply the terms of the Apache Software License
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.rometools.feed.module.mediarss;
import java.io.Serializable;
import com.sun.syndication.feed.module.ModuleImpl;
import org.rometools.feed.module.mediarss.types.Metadata;
import org.rometools.feed.module.mediarss.types.PlayerReference;
/**
*
* This class represents feed/channel level elements for MediaRSS
* @author cooper
*/
public class MediaModuleImpl extends ModuleImpl implements MediaModule, Serializable {
private static final long serialVersionUID = 1506805082848531979L;
private Metadata metadata;
private PlayerReference player;
/** Creates a new instance of MediaModuleImpl */
public MediaModuleImpl() {
this(MediaModule.class, MediaModule.URI);
}
/**
* constructor that passes values up to ModuleImpl.
* @param clazz
* @param uri
*/
public MediaModuleImpl(Class clazz, String uri) {
super(clazz, uri);
}
public Class getInterface() {
return MediaModule.class;
}
/**
* Metadata for a feed.
* @param metadata Metadata for a feed.
*/
public void setMetadata(Metadata metadata) {
this.metadata = metadata;
}
/**
* Metadata for a feed.
* @return Metadata for a feed.
*/
public Metadata getMetadata() {
return metadata;
}
/**
* Player for a feed.
* @param player Player for a feed.
*/
public void setPlayer(PlayerReference player) {
this.player = player;
}
/**
* Player for a feed.
* @return Player for a feed.
*/
public PlayerReference getPlayer() {
return player;
}
public String getUri() {
return MediaModule.URI;
}
public Object clone() {
MediaModuleImpl m = new MediaModuleImpl();
m.setMetadata((Metadata) metadata.clone());
m.setPlayer(player);
return m;
}
public void copyFrom(Object obj) {
MediaModule m = (MediaModule) obj;
this.metadata = (Metadata) m.getMetadata().clone();
this.player = m.getPlayer();
}
}

View file

@ -0,0 +1,35 @@
/*
* AlternateMediaModuleParser.java
*
* Created on August 20, 2006, 5:52 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package org.rometools.feed.module.mediarss.io;
import org.jdom.Namespace;
/**
*
* @author cooper
*/
public class AlternateMediaModuleParser extends MediaModuleParser {
private static final Namespace NS = Namespace.getNamespace("http://search.yahoo.com/mrss");
/** Creates a new instance of AlternateMediaModuleParser */
public AlternateMediaModuleParser() {
super();
}
public String getNamespaceUri() {
return "http://search.yahoo.com/mrss";
}
public Namespace getNS(){
return AlternateMediaModuleParser.NS;
}
}

Some files were not shown because too many files have changed in this diff Show more