abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r473189 - in /incubator/abdera/java/trunk/extensions/src/main: java/org/apache/abdera/ext/media/ resources/META-INF/services/
Date Fri, 10 Nov 2006 04:57:38 GMT
Author: jmsnell
Date: Thu Nov  9 20:57:35 2006
New Revision: 473189

URL: http://svn.apache.org/viewvc?view=rev&rev=473189
Log:
An implementation of the Yahoo Media RSS extensions.  I put these together as a proof that RSS
extensions work just fine within Atom.  These also demonstrate how simple it is to use the new
enhanced extension stuff.  These were put together in less than about two hours.  Expect some 
bugs as I haven't fully tested everything yet. I'll check in some test cases tomorrow.

Added:
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaAdult.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCategory.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaConstants.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaContent.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCopyright.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCredit.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaDescription.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaGroup.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaHash.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaKeywords.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaPlayer.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRating.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRestriction.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaText.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaThumbnail.java
    incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaTitle.java
Modified:
    incubator/abdera/java/trunk/extensions/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaAdult.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaAdult.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaAdult.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaAdult.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,37 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+/**
+ * @deprecated Use MediaRating instead
+ */
+public class MediaAdult extends ElementWrapper {
+
+  protected MediaAdult(Element internal) {
+    super(internal);
+  }
+
+  public MediaAdult(Factory factory) {
+    super(factory, MediaConstants.ADULT);
+  }
+
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCategory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCategory.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCategory.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCategory.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,60 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.util.iri.IRI;
+import org.apache.abdera.util.iri.IRISyntaxException;
+
+public class MediaCategory extends ElementWrapper {
+
+  public MediaCategory(Element internal) {
+    super(internal);
+  }
+
+  public MediaCategory(Factory factory) {
+    super(factory, MediaConstants.CATEGORY);
+  }
+
+  public IRI getScheme() throws IRISyntaxException {
+    String scheme = getAttributeValue("scheme");
+    return (scheme != null) ? new IRI(scheme) : null;
+  }
+  
+  public void setScheme(String scheme) throws IRISyntaxException {
+    if (scheme != null)
+      setAttributeValue("scheme",(new IRI(scheme)).toString());
+    else 
+      removeAttribute(new QName("scheme"));
+  }
+  
+  public String getLabel() {
+    return getAttributeValue("label");
+  }
+  
+  public void setLabel(String label) {
+    if (label != null)
+      setAttributeValue("label", label);
+    else 
+      removeAttribute(new QName("label"));
+  }
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaConstants.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaConstants.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaConstants.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaConstants.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,66 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+public interface MediaConstants {
+
+  public enum Type { PLAIN, HTML }
+  public enum Algo { SHA1, MD5 }
+  public enum Relationship { ALLOW, DENY }
+  public enum RestrictionType { COUNTRY, URI }
+  public enum Medium { IMAGE, AUDIO, VIDEO, DOCUMENT, EXECUTABLE }
+  public enum Expression { FULL, SAMPLE, NONSTOP }
+  
+  public static final String MEDIA_NS = "http://search.yahoo.com/mrss/";
+  public static final String MEDIA_PREFIX = "media";
+  public static final String LN_GROUP = "group";
+  public static final String LN_CONTENT = "content";
+  public static final String LN_ADULT = "adult";
+  public static final String LN_RATING = "rating";
+  public static final String LN_TITLE = "title";
+  public static final String LN_DESCRIPTION = "description";
+  public static final String LN_KEYWORDS = "keywords";
+  public static final String LN_THUMBNAIL = "thumbnail";
+  public static final String LN_CATEGORY = "category";
+  public static final String LN_HASH = "hash";
+  public static final String LN_PLAYER = "player";
+  public static final String LN_CREDIT = "credit";
+  public static final String LN_COPYRIGHT = "copyright";
+  public static final String LN_TEXT = "text";
+  public static final String LN_RESTRICTION = "restriction";
+  
+  public static final QName GROUP = new QName(MEDIA_NS, LN_GROUP, MEDIA_PREFIX);
+  public static final QName CONTENT = new QName(MEDIA_NS, LN_CONTENT, MEDIA_PREFIX);
+  public static final QName ADULT = new QName(MEDIA_NS, LN_ADULT, MEDIA_PREFIX);
+  public static final QName RATING = new QName(MEDIA_NS, LN_RATING, MEDIA_PREFIX);
+  public static final QName TITLE = new QName(MEDIA_NS, LN_TITLE, MEDIA_PREFIX);
+  public static final QName DESCRIPTION = new QName(MEDIA_NS, LN_DESCRIPTION, MEDIA_PREFIX);
+  public static final QName KEYWORDS = new QName(MEDIA_NS, LN_KEYWORDS, MEDIA_PREFIX);
+  public static final QName THUMBNAIL = new QName(MEDIA_NS, LN_THUMBNAIL, MEDIA_PREFIX);
+  public static final QName CATEGORY = new QName(MEDIA_NS, LN_CATEGORY, MEDIA_PREFIX);
+  public static final QName HASH = new QName(MEDIA_NS, LN_HASH, MEDIA_PREFIX);
+  public static final QName PLAYER = new QName(MEDIA_NS, LN_PLAYER, MEDIA_PREFIX);
+  public static final QName CREDIT = new QName(MEDIA_NS, LN_CREDIT, MEDIA_PREFIX);
+  public static final QName COPYRIGHT = new QName(MEDIA_NS, LN_COPYRIGHT, MEDIA_PREFIX);
+  public static final QName TEXT = new QName(MEDIA_NS, LN_TEXT, MEDIA_PREFIX);
+  public static final QName RESTRICTION = new QName(MEDIA_NS, LN_RESTRICTION, MEDIA_PREFIX);
+  
+}
+

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaContent.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaContent.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaContent.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaContent.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,203 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.activation.MimeType;
+import javax.activation.MimeTypeParseException;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+import org.apache.abdera.util.iri.IRI;
+import org.apache.abdera.util.iri.IRISyntaxException;
+
+public class MediaContent 
+  extends ExtensibleElementWrapper {
+
+  public MediaContent(Element internal) {
+    super(internal);
+  }
+
+  public MediaContent(Factory factory) {
+    super(factory, MediaConstants.CONTENT);
+  }
+  
+  public IRI getUrl() throws IRISyntaxException {
+    String url = getAttributeValue("url");
+    return (url != null) ? new IRI(url) : null;
+  }
+  
+  public void setUrl(String url) throws IRISyntaxException {
+    if (url != null)
+      setAttributeValue("url", (new IRI(url)).toString());
+    else
+      removeAttribute(new QName("url"));
+  }
+  
+  public long getFilesize() {
+    String size = getAttributeValue("filesize");
+    return (size != null) ? Long.parseLong(size) : -1;
+  }
+  
+  public void setFilesize(long size) {
+    if (size > -1) 
+      setAttributeValue("filesize", String.valueOf(size));
+    else 
+      removeAttribute(new QName("filesize"));
+  }
+  
+  public MimeType getType() throws MimeTypeParseException {
+    String type = getAttributeValue("type");
+    return (type != null) ? new MimeType(type) : null;
+  }
+  
+  public void setType(String type) {
+    if (type != null)
+      setAttributeValue("type", type);
+    else 
+      removeAttribute(new QName(type));
+  }
+  
+  public MediaConstants.Medium getMedium() {
+    String medium = getAttributeValue("medium");
+    return (medium != null) ? MediaConstants.Medium.valueOf(medium.toUpperCase()) : null;
+  }
+  
+  public void setMedium(MediaConstants.Medium medium) {
+    if (medium != null) 
+      setAttributeValue("medium", medium.name().toLowerCase());
+    else 
+      removeAttribute(new QName("medium"));
+  }
+  
+  public boolean isDefault() {
+    String def = getAttributeValue("isDefault");
+    return (def != null) ? def.equalsIgnoreCase("true") : false;
+  }
+  
+  public MediaConstants.Expression getExpression() {
+    String exp = getAttributeValue("expression");
+    return (exp != null) ? MediaConstants.Expression.valueOf(exp.toUpperCase()) : null;
+  }
+  
+  public void setExpression(MediaConstants.Expression exp) {
+    if (exp != null) 
+      setAttributeValue("expression", exp.name().toLowerCase());
+    else 
+      removeAttribute(new QName("expression"));
+  }
+  
+  public int getBitrate() {
+    String bitrate = getAttributeValue("bitrate");
+    return (bitrate != null) ? Integer.parseInt(bitrate) : -1;
+  }
+  
+  public void setBitrate(int bitrate) {
+    if (bitrate > -1)
+      setAttributeValue("bitrate", String.valueOf(bitrate));
+    else
+      removeAttribute(new QName("bitrate"));
+  }
+  
+  public int getFramerate() {
+    String framerate = getAttributeValue("framerate");
+    return (framerate != null) ? Integer.parseInt(framerate) : -1;
+  }
+  
+  public void setFramerate(int framerate) {
+    if (framerate > -1)
+      setAttributeValue("framerate", String.valueOf(framerate));
+    else
+      removeAttribute(new QName("framerate"));
+  }
+  
+  public double getSamplingRate() {
+    String rate = getAttributeValue("samplingrate");
+    return (rate != null) ? Double.parseDouble(rate) : -1;
+  }
+  
+  public void setSamplingRate(double samplingrate) {
+    if (samplingrate > Double.parseDouble("-1"))
+      setAttributeValue("samplingrate", String.valueOf(samplingrate));
+    else 
+      removeAttribute(new QName("samplingrate"));
+  }
+  
+  public int getChannels() {
+    String c = getAttributeValue("channels");
+    return (c != null) ? Integer.parseInt(c) : -1;
+  }
+  
+  public void setChannels(int channels) {
+    if (channels > -1) 
+      setAttributeValue("channels", String.valueOf(channels));
+    else
+      removeAttribute(new QName("channels"));
+  }
+  
+  public int getDuration() {
+    String c = getAttributeValue("duration");
+    return (c != null) ? Integer.parseInt(c) : -1;
+  }
+  
+  public void setDuration(int duration) {
+    if (duration > -1) 
+      setAttributeValue("duration", String.valueOf(duration));
+    else
+      removeAttribute(new QName("duration"));
+  }
+  
+  public int getWidth() {
+    String width = getAttributeValue("width");
+    return (width != null) ? Integer.parseInt(width) : -1;
+  }
+  
+  public void setWidth(int width) {
+    if (width > -1) {
+      setAttributeValue("width", String.valueOf(width));
+    } else {
+      removeAttribute(new QName("width"));
+    }
+  }
+  
+  public int getHeight() {
+    String height = getAttributeValue("height");
+    return (height != null) ? Integer.parseInt(height) : -1;
+  }
+  
+  public void setHeight(int height) {
+    if (height > -1) {
+      setAttributeValue("height", String.valueOf(height));
+    } else {
+      removeAttribute(new QName("height"));
+    }
+  }
+
+  public String getLang() {
+    return getAttributeValue("lang");
+  }
+  
+  public void setLang(String lang) {
+    if (lang != null)
+      setAttributeValue("lang", lang);
+    else
+      removeAttribute(new QName("lang"));
+  }
+
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCopyright.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCopyright.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCopyright.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCopyright.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.util.iri.IRI;
+import org.apache.abdera.util.iri.IRISyntaxException;
+
+public class MediaCopyright extends ElementWrapper {
+
+  public MediaCopyright(Element internal) {
+    super(internal);
+  }
+
+  public MediaCopyright(Factory factory) {
+    super(factory, MediaConstants.COPYRIGHT);
+  }
+  
+  public IRI getUrl() throws IRISyntaxException {
+    String url = getAttributeValue("url");
+    return (url != null) ? new IRI(url) : null;
+  }
+  
+  public void setUrl(String url) throws IRISyntaxException {
+    if (url != null)
+      setAttributeValue("url", (new IRI(url)).toString());
+    else
+      removeAttribute(new QName("url"));
+  }
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCredit.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCredit.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCredit.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaCredit.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,61 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.util.iri.IRI;
+import org.apache.abdera.util.iri.IRISyntaxException;
+
+public class MediaCredit extends ElementWrapper {
+
+  public MediaCredit(Element internal) {
+    super(internal);
+  }
+
+  public MediaCredit(Factory factory) {
+    super(factory, MediaConstants.CREDIT);
+  }
+  
+  public IRI getScheme() throws IRISyntaxException {
+    String scheme = getAttributeValue("scheme");
+    return (scheme != null) ? new IRI(scheme) : null;
+  }
+  
+  public void setScheme(String scheme) throws IRISyntaxException {
+    if (scheme != null)
+      setAttributeValue("scheme",(new IRI(scheme)).toString());
+    else
+      removeAttribute(new QName("scheme"));
+  }
+
+  public String getRole() {
+    return getAttributeValue("role");
+  }
+  
+  public void setRole(String role) {
+    if (role != null)
+      setAttributeValue("role", role);
+    else 
+      removeAttribute(new QName("role"));
+  }
+  
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaDescription.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaDescription.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaDescription.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaDescription.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,48 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class MediaDescription extends ElementWrapper {
+
+  public MediaDescription(Element internal) {
+    super(internal);
+  }
+
+  public MediaDescription(Factory factory) {
+    super(factory, MediaConstants.DESCRIPTION);
+  }
+  
+  public void setType(MediaConstants.Type type) {
+    switch(type) {
+      case PLAIN: setAttributeValue("type", "plain"); break;
+      case HTML:  setAttributeValue("type", "html"); break;
+      default:    removeAttribute(new QName("type"));
+    }
+  }
+  
+  public MediaConstants.Type getType() {
+    String type = getAttributeValue("type");
+    return (type != null) ? MediaConstants.Type.valueOf(type.toUpperCase()) : null;
+  }
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaExtensionFactory.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,59 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.ExtensionFactory;
+import org.apache.abdera.model.Element;
+
+public class MediaExtensionFactory implements ExtensionFactory {
+
+  @SuppressWarnings({ "unchecked", "deprecation" })
+  public <T extends Element> T getElementWrapper(Element internal) {
+    QName qname = internal.getQName();
+    if (qname.equals(MediaConstants.ADULT)) return (T) new MediaAdult(internal);
+    if (qname.equals(MediaConstants.CATEGORY)) return (T) new MediaCategory(internal);
+    if (qname.equals(MediaConstants.CONTENT)) return (T) new MediaContent(internal);
+    if (qname.equals(MediaConstants.COPYRIGHT)) return (T) new MediaCopyright(internal);
+    if (qname.equals(MediaConstants.CREDIT)) return (T) new MediaCredit(internal);
+    if (qname.equals(MediaConstants.DESCRIPTION)) return (T) new MediaDescription(internal);
+    if (qname.equals(MediaConstants.GROUP)) return (T) new MediaGroup(internal);
+    if (qname.equals(MediaConstants.HASH)) return (T) new MediaHash(internal);
+    if (qname.equals(MediaConstants.KEYWORDS)) return (T) new MediaKeywords(internal);
+    if (qname.equals(MediaConstants.PLAYER)) return (T) new MediaPlayer(internal);
+    if (qname.equals(MediaConstants.RATING)) return (T) new MediaRating(internal);
+    if (qname.equals(MediaConstants.RESTRICTION)) return (T) new MediaRestriction(internal);
+    if (qname.equals(MediaConstants.TEXT)) return (T) new MediaText(internal);
+    if (qname.equals(MediaConstants.THUMBNAIL)) return (T) new MediaThumbnail(internal);
+    if (qname.equals(MediaConstants.TITLE)) return (T) new MediaTitle(internal);
+    return null;
+  }
+
+  public List<String> getNamespaces() {
+    return java.util.Arrays.asList(new String[] {MediaConstants.MEDIA_NS});
+  }
+
+  public boolean handlesNamespace(String namespace) {
+    return namespace.equals(MediaConstants.MEDIA_NS);
+  }
+
+}
+

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaGroup.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaGroup.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaGroup.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaGroup.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,34 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ExtensibleElementWrapper;
+
+public class MediaGroup extends ExtensibleElementWrapper {
+
+  public MediaGroup(Element internal) {
+    super(internal);
+  }
+
+  public MediaGroup(Factory factory) {
+    super(factory, MediaConstants.GROUP);
+  }
+  
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaHash.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaHash.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaHash.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaHash.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,53 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class MediaHash extends ElementWrapper {
+
+  public MediaHash(Element internal) {
+    super(internal);
+  }
+
+  public MediaHash(Factory factory) {
+    super(factory, MediaConstants.HASH);
+  }
+  
+  public MediaConstants.Algo getAlgorithm() {
+    String algo = getAttributeValue("algo");
+    if (algo == null) return null;
+    if (algo.equalsIgnoreCase("sha-1")) return MediaConstants.Algo.SHA1;
+    if (algo.equalsIgnoreCase("md5")) return MediaConstants.Algo.MD5;
+    return null;
+  }
+  
+  public void setAlgorithm(MediaConstants.Algo algorithm) {
+    switch (algorithm) {
+      case SHA1: setAttributeValue("algo", "sha-1"); break;
+      case MD5: setAttributeValue("algo", "md5"); break;
+      default: removeAttribute(new QName("algo"));
+    }
+  }
+  
+  // TODO: Helper methods for calculating the hash
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaKeywords.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaKeywords.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaKeywords.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaKeywords.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,34 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class MediaKeywords extends ElementWrapper {
+
+  public MediaKeywords(Element internal) {
+    super(internal);
+  }
+
+  public MediaKeywords(Factory factory) {
+    super(factory, MediaConstants.KEYWORDS);
+  }
+  
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaPlayer.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaPlayer.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaPlayer.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaPlayer.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,76 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.util.iri.IRI;
+import org.apache.abdera.util.iri.IRISyntaxException;
+
+public class MediaPlayer extends ElementWrapper {
+
+  public MediaPlayer(Element internal) {
+    super(internal);
+  }
+
+  public MediaPlayer(Factory factory) {
+    super(factory, MediaConstants.PLAYER);
+  }
+  
+  public IRI getUrl() throws IRISyntaxException {
+    String url = getAttributeValue("url");
+    return (url != null) ? new IRI(url) : null;
+  }
+  
+  public void setUrl(String url) throws IRISyntaxException {
+    if (url != null) {
+      setAttributeValue("url", (new IRI(url)).toString());
+    } else {
+      removeAttribute(new QName("url"));
+    }
+  }
+  
+  public int getWidth() {
+    String width = getAttributeValue("width");
+    return (width != null) ? Integer.parseInt(width) : -1;
+  }
+  
+  public void setWidth(int width) {
+    if (width > -1) {
+      setAttributeValue("width", String.valueOf(width));
+    } else {
+      removeAttribute(new QName("width"));
+    }
+  }
+  
+  public int getHeight() {
+    String height = getAttributeValue("height");
+    return (height != null) ? Integer.parseInt(height) : -1;
+  }
+  
+  public void setHeight(int height) {
+    if (height > -1) {
+      setAttributeValue("height", String.valueOf(height));
+    } else {
+      removeAttribute(new QName("height"));
+    }
+  }
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRating.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRating.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRating.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRating.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,57 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.util.iri.IRI;
+import org.apache.abdera.util.iri.IRISyntaxException;
+
+public class MediaRating extends ElementWrapper {
+
+  public MediaRating(Element internal) {
+    super(internal);
+  }
+
+  public MediaRating(Factory factory) {
+    super(factory, MediaConstants.RATING);
+  }
+  
+  public IRI getScheme() throws IRISyntaxException {
+    String scheme = getAttributeValue("scheme");
+    return (scheme != null) ? new IRI(scheme) : null;
+  }
+  
+  public void setScheme(String scheme) throws IRISyntaxException {
+    setAttributeValue("scheme",(new IRI(scheme)).toString());
+  }
+  
+  public void setAdult(boolean adult) {
+    try {
+      setScheme("urn:simple");
+      setText(adult?"adult":"nonadult");
+    } catch (Exception e) {}
+  }
+  
+  public boolean isAdult() {
+    String scheme = getAttributeValue("scheme");
+    String text = getText();
+    return scheme.equals("urn:simple") && "adult".equalsIgnoreCase(text);
+  }
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRestriction.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRestriction.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRestriction.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaRestriction.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,61 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class MediaRestriction extends ElementWrapper {
+
+  public MediaRestriction(Element internal) {
+    super(internal);
+  }
+
+  public MediaRestriction(Factory factory) {
+    super(factory, MediaConstants.RESTRICTION);
+  }
+  
+  public void setRelationship(MediaConstants.Relationship type) {
+    switch(type) {
+      case ALLOW: setAttributeValue("relationship", "allow"); break;
+      case DENY:  setAttributeValue("relationship", "deny"); break;
+      default:    removeAttribute(new QName("relationship"));
+    }
+  }
+  
+  public MediaConstants.Relationship getRelationship() {
+    String rel = getAttributeValue("relationship");
+    return (rel != null) ? MediaConstants.Relationship.valueOf(rel.toUpperCase()) : null;
+  }
+  
+  public void setType(MediaConstants.RestrictionType type) {
+    switch(type) {
+      case COUNTRY: setAttributeValue("type", "country"); break;
+      case URI:  setAttributeValue("type", "uri"); break;
+      default:    removeAttribute(new QName("type"));
+    }
+  }
+  
+  public MediaConstants.RestrictionType getType() {
+    String type = getAttributeValue("type");
+    return (type != null) ? MediaConstants.RestrictionType.valueOf(type.toUpperCase()) : null;
+  }
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaText.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaText.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaText.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaText.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,81 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class MediaText extends ElementWrapper {
+
+  public MediaText(Element internal) {
+    super(internal);
+  }
+
+  public MediaText(Factory factory) {
+    super(factory, MediaConstants.TEXT);
+  }
+  
+  public void setType(MediaConstants.Type type) {
+    switch(type) {
+      case PLAIN: setAttributeValue("type", "plain"); break;
+      case HTML:  setAttributeValue("type", "html"); break;
+      default:    removeAttribute(new QName("type"));
+    }
+  }
+  
+  public MediaConstants.Type getType() {
+    String type = getAttributeValue("type");
+    return (type != null) ? MediaConstants.Type.valueOf(type.toUpperCase()) : null;
+  }
+  
+  public String getLang() {
+    return getAttributeValue("lang");
+  }
+  
+  public void setLang(String lang) {
+    if (lang != null)
+      setAttributeValue("lang", lang);
+    else
+      removeAttribute(new QName("lang"));
+  }
+  
+  public String getStart() {
+    return getAttributeValue("start");
+  }
+  
+  public void setStart(String start) {
+    if (start != null)
+      setAttributeValue("start", start);
+    else 
+      removeAttribute(new QName("start"));
+  }
+  
+  public String getEnd() {
+    return getAttributeValue("end");
+  }
+  
+  public void setEnd(String end) {
+    if (end != null)
+      setAttributeValue("end", end);
+    else
+      removeAttribute(new QName("end"));
+  }
+}

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaThumbnail.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaThumbnail.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaThumbnail.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaThumbnail.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,90 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+import org.apache.abdera.util.iri.IRI;
+import org.apache.abdera.util.iri.IRISyntaxException;
+
+public class MediaThumbnail extends ElementWrapper {
+
+  public MediaThumbnail(Element internal) {
+    super(internal);
+  }
+
+  public MediaThumbnail(Factory factory) {
+    super(factory, MediaConstants.THUMBNAIL);
+  }
+  
+  public IRI getUrl() throws IRISyntaxException {
+    String url = getAttributeValue("url");
+    return (url != null) ? new IRI(url) : null;
+  }
+  
+  public void setUrl(String url) throws IRISyntaxException {
+    if (url != null) {
+      setAttributeValue("url", (new IRI(url)).toString());
+    } else {
+      removeAttribute(new QName("url"));
+    }
+  }
+  
+  public int getWidth() {
+    String width = getAttributeValue("width");
+    return (width != null) ? Integer.parseInt(width) : -1;
+  }
+  
+  public void setWidth(int width) {
+    if (width > -1) {
+      setAttributeValue("width", String.valueOf(width));
+    } else {
+      removeAttribute(new QName("width"));
+    }
+  }
+  
+  public int getHeight() {
+    String height = getAttributeValue("height");
+    return (height != null) ? Integer.parseInt(height) : -1;
+  }
+  
+  public void setHeight(int height) {
+    if (height > -1) {
+      setAttributeValue("height", String.valueOf(height));
+    } else {
+      removeAttribute(new QName("height"));
+    }
+  }
+  
+  public String getTime() {
+    return getAttributeValue("time");
+  }
+  
+  public void setTime(String time) {
+    if (time != null)
+      setAttributeValue("time", time);
+    else 
+      removeAttribute(new QName("time"));
+  }
+  
+}
+
+

Added: incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaTitle.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaTitle.java?view=auto&rev=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaTitle.java (added)
+++ incubator/abdera/java/trunk/extensions/src/main/java/org/apache/abdera/ext/media/MediaTitle.java Thu Nov  9 20:57:35 2006
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+package org.apache.abdera.ext.media;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera.factory.Factory;
+import org.apache.abdera.model.Element;
+import org.apache.abdera.model.ElementWrapper;
+
+public class MediaTitle extends ElementWrapper {
+
+  public MediaTitle(Element internal) {
+    super(internal);
+  }
+
+  public MediaTitle(Factory factory) {
+    super(factory, MediaConstants.TITLE);
+  }
+  
+  public void setType(MediaConstants.Type type) {
+    switch(type) {
+      case PLAIN: setAttributeValue("type", "plain"); break;
+      case HTML:  setAttributeValue("type", "html"); break;
+      default:    removeAttribute(new QName("type"));
+    }
+  }
+  
+  public MediaConstants.Type getType() {
+    String type = getAttributeValue("type");
+    return (type != null) ? MediaConstants.Type.valueOf(type.toUpperCase()) : null;
+  }
+  
+}

Modified: incubator/abdera/java/trunk/extensions/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/extensions/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory?view=diff&rev=473189&r1=473188&r2=473189
==============================================================================
--- incubator/abdera/java/trunk/extensions/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory (original)
+++ incubator/abdera/java/trunk/extensions/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory Thu Nov  9 20:57:35 2006
@@ -1,2 +1,3 @@
 org.apache.abdera.ext.thread.ThreadExtensionFactory
-org.apache.abdera.ext.opensearch.OpenSearchExtensionFactory
\ No newline at end of file
+org.apache.abdera.ext.opensearch.OpenSearchExtensionFactory
+org.apache.abdera.ext.media.MediaExtensionFactory
\ No newline at end of file



Mime
View raw message