You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2014/01/08 16:25:40 UTC
[24/51] [abbrv] [partial] MARMOTTA-397: Reorganized and renamed
Marmotta Sesame Tools
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/PositionList.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/PositionList.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/PositionList.java
new file mode 100644
index 0000000..61f383e
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/PositionList.java
@@ -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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/package.html
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/package.html b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/package.html
new file mode 100644
index 0000000..2d7654a
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/geometries/package.html
@@ -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>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/package.html
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/package.html b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/package.html
new file mode 100644
index 0000000..bf84f47
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/georss/package.html
@@ -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<syndentry> 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>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/AbstractITunesObject.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/AbstractITunesObject.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/AbstractITunesObject.java
new file mode 100644
index 0000000..637a23b
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/AbstractITunesObject.java
@@ -0,0 +1,228 @@
+/*
+ * 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;
+
+import com.sun.syndication.feed.CopyFrom;
+
+
+
+/**
+ * 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(CopyFrom 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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformation.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformation.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformation.java
new file mode 100644
index 0000000..afca1a8
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformation.java
@@ -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) ;
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformationImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformationImpl.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformationImpl.java
new file mode 100644
index 0000000..5631842
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/EntryInformationImpl.java
@@ -0,0 +1,120 @@
+/*
+ * 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 com.sun.syndication.feed.CopyFrom;
+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(CopyFrom 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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformation.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformation.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformation.java
new file mode 100644
index 0000000..be0a4e4
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformation.java
@@ -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();
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformationImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformationImpl.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformationImpl.java
new file mode 100644
index 0000000..134f8fb
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/FeedInformationImpl.java
@@ -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 com.sun.syndication.feed.CopyFrom;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+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(CopyFrom 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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/ITunes.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/ITunes.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/ITunes.java
new file mode 100644
index 0000000..d26e5cd
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/ITunes.java
@@ -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);
+
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesGenerator.java
new file mode 100644
index 0000000..303ba6b
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesGenerator.java
@@ -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.jdom2.Element;
+import org.jdom2.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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParser.java
new file mode 100644
index 0000000..f532c0a
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParser.java
@@ -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.jdom2.Element;
+import org.jdom2.Namespace;
+
+import org.jdom2.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.jdom2.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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParserOldNamespace.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParserOldNamespace.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParserOldNamespace.java
new file mode 100644
index 0000000..26ad89d
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/io/ITunesParserOldNamespace.java
@@ -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.jdom2.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;
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/package.html
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/package.html b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/package.html
new file mode 100644
index 0000000..a618e26
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/package.html
@@ -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>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Category.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Category.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Category.java
new file mode 100644
index 0000000..8cd0505
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Category.java
@@ -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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Duration.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Duration.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Duration.java
new file mode 100644
index 0000000..d7c179c
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Duration.java
@@ -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);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Subcategory.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Subcategory.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Subcategory.java
new file mode 100644
index 0000000..405e61d
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/Subcategory.java
@@ -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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/package.html
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/package.html b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/package.html
new file mode 100644
index 0000000..98e5105
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/itunes/types/package.html
@@ -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>
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaEntryModule.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaEntryModule.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaEntryModule.java
new file mode 100644
index 0000000..9f52962
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaEntryModule.java
@@ -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();
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaEntryModuleImpl.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaEntryModuleImpl.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaEntryModuleImpl.java
new file mode 100644
index 0000000..eb26c06
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaEntryModuleImpl.java
@@ -0,0 +1,130 @@
+/*
+ * 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.CopyFrom;
+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;
+ }
+
+ @Override
+ 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;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ EqualsBean eBean = new EqualsBean(MediaEntryModuleImpl.class, this);
+
+ return eBean.beanEquals(obj);
+ }
+
+ @Override
+ public int hashCode() {
+ EqualsBean equals = new EqualsBean(MediaEntryModuleImpl.class, this);
+
+ return equals.beanHashCode();
+ }
+
+ @Override
+ public String toString() {
+ ToStringBean tsBean = new ToStringBean(MediaEntryModuleImpl.class, this);
+
+ return tsBean.toString();
+ }
+
+ public void copyFrom(CopyFrom obj) {
+ MediaEntryModuleImpl other = (MediaEntryModuleImpl) obj;
+ other = (MediaEntryModuleImpl) other.clone();
+ this.setMediaContents(other.getMediaContents());
+ this.setMediaGroups(other.getMediaGroups());
+ this.setMetadata(other.getMetadata());
+ this.setPlayer(other.getPlayer());
+ }
+}
http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaModule.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaModule.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaModule.java
new file mode 100644
index 0000000..13d51e5
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/org/rometools/feed/module/mediarss/MediaModule.java
@@ -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();
+}