abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r438711 - in /incubator/abdera/java/trunk: core/src/main/java/org/apache/abdera/model/ core/src/main/java/org/apache/abdera/util/ parser/src/main/java/org/apache/abdera/parser/stax/
Date Wed, 30 Aug 2006 23:41:01 GMT
Author: jmsnell
Date: Wed Aug 30 16:41:01 2006
New Revision: 438711

URL: http://svn.apache.org/viewvc?rev=438711&view=rev
Log:
Ok, this is likely a bit premature, and against the advice of one of the co-chairs
of the APP working group but, there was a proposal on the table to use atom:title in 
app:workspace and app:collection instead of a title attribute.  It received a lot
of support and the co-chair indicated that the proposal would be considered accepted
unless folks stepped forward in the next couple of days and made an argument about 
why it is a bad thing.  So far, no one has stepped forward to argue it, but several
folks that were previously against an old version of the proposal have now indicated
support for it.  So here's the change.  We can easily roll this back if the decision
to accept the spec change is rescinded by the chairs.

Instead of...

  <collection title="foo" href="..." />

It is now...

  <collection href="...">
    <atom:title>foo</atom:title>
  </collection>


Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Constants.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java?rev=438711&r1=438710&r2=438711&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java
(original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Collection.java
Wed Aug 30 16:41:01 2006
@@ -47,20 +47,26 @@
 public interface Collection 
   extends ExtensibleElement {
 
-  /**
-   * APP Draft-08: The app:collection element MUST contain a "title" 
-   * attribute, whose value gives a human-readable name for the collection.  
-   * This attribute is Language-Sensitive.
-   */
   String getTitle();
 
-  /**
-   * APP Draft-08: The app:collection element MUST contain a "title" 
-   * attribute, whose value gives a human-readable name for the collection.  
-   * This attribute is Language-Sensitive.
-   */
-  void setTitle(String title);
+  Text setTitle(String title);
 
+  Text setTitleAsHtml(String title);
+  
+  Text setTitleAsXHtml(String title);
+  
+  Text getTitleElement();
+  
+  List<Text> getTitleElements();
+  
+  Text addTitle(String title);
+  
+  Text addTitleAsHtml(String title);
+  
+  Text addTitleAsXhtml(String title);
+  
+  void addTitle(Text title);
+  
   /**
    * APP Draft-08: The app:collection element MUST contain a "href" 
    * attribute, whose value gives the IRI of the collection.

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java?rev=438711&r1=438710&r2=438711&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java
(original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java
Wed Aug 30 16:41:01 2006
@@ -43,19 +43,25 @@
 public interface Workspace 
   extends ExtensibleElement {
 
-  /**
-   * APP Draft-08: The app:workspace element MUST contain a "title" 
-   * attribute, which gives a human-readable name for the workspace.  
-   * This attribute is Language-Sensitive.
-   */
   String getTitle();
+
+  Text setTitle(String title);
+
+  Text setTitleAsHtml(String title);
   
-  /**
-   * APP Draft-08: The app:workspace element MUST contain a "title" 
-   * attribute, which gives a human-readable name for the workspace.  
-   * This attribute is Language-Sensitive.
-   */
-  void setTitle(String title);
+  Text setTitleAsXHtml(String title);
+  
+  Text getTitleElement();
+  
+  List<Text> getTitleElements();
+  
+  Text addTitle(String title);
+  
+  Text addTitleAsHtml(String title);
+  
+  Text addTitleAsXhtml(String title);
+  
+  void addTitle(Text title);
   
   /**
    * Returns the full set of collections in this workspace 

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Constants.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Constants.java?rev=438711&r1=438710&r2=438711&view=diff
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Constants.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Constants.java Wed
Aug 30 16:41:01 2006
@@ -90,9 +90,9 @@
   public static final QName DIV                   = new QName(XHTML_NS, LN_DIV, "");
   public static final QName CONTROL               = new QName(APP_NS, LN_CONTROL, "app");
   public static final QName DRAFT                 = new QName(APP_NS, LN_DRAFT, "app");
-  public static final QName CATEGORIES            = new QName(APP_NS, LN_CATEGORIES, "app");
+  public static final QName CATEGORIES            = new QName(APP_NS, LN_CATEGORIES, APP_PREFIX);
   public static final QName FEED                  = new QName(ATOM_NS, LN_FEED, PREFIX);
-  public static final QName SERVICE               = new QName(APP_NS, LN_SERVICE, "app");
+  public static final QName SERVICE               = new QName(APP_NS, LN_SERVICE, APP_PREFIX);
   public static final QName AUTHOR                = new QName(ATOM_NS, LN_AUTHOR, PREFIX);
   public static final QName CATEGORY              = new QName(ATOM_NS, LN_CATEGORY, PREFIX);
   public static final QName CONTENT               = new QName(ATOM_NS, LN_CONTENT, PREFIX);
@@ -108,6 +108,7 @@
   public static final QName SUBTITLE              = new QName(ATOM_NS, LN_SUBTITLE, PREFIX);
   public static final QName SUMMARY               = new QName(ATOM_NS, LN_SUMMARY, PREFIX);
   public static final QName TITLE                 = new QName(ATOM_NS, LN_TITLE, PREFIX);
+  public static final QName PREFIXED_TITLE        = new QName(ATOM_NS, LN_TITLE, "atom");
   public static final QName UPDATED               = new QName(ATOM_NS, LN_UPDATED, PREFIX);
   public static final QName MODIFIED              = new QName(APP_NS, LN_MODIFIED, "app");
   public static final QName ENTRY                 = new QName(ATOM_NS, LN_ENTRY, PREFIX);

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java?rev=438711&r1=438710&r2=438711&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMCollection.java
Wed Aug 30 16:41:01 2006
@@ -27,6 +27,7 @@
 import org.apache.abdera.model.Categories;
 import org.apache.abdera.model.Category;
 import org.apache.abdera.model.Collection;
+import org.apache.abdera.model.Text;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.MimeTypeHelper;
 import org.apache.axiom.om.OMContainer;
@@ -34,6 +35,7 @@
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
 public class FOMCollection 
@@ -95,16 +97,66 @@
   }
   
   public String getTitle() {
-    return getAttributeValue(ATITLE);
+    Text title = this.getFirstChild(TITLE);
+    return (title != null) ? title.getValue() : null;
   }
 
-  public void setTitle(String title) {
-    if (title != null)
-      setAttributeValue(ATITLE, title);
-    else 
-      removeAttribute(ATITLE);
+  private Text setTitle(String title, Text.Type type) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Text text = fomfactory.newText(PREFIXED_TITLE,type);
+    text.setValue(title);
+    this._setChild(PREFIXED_TITLE, (OMElement) text);
+    return text;
+  }
+  
+  public Text setTitle(String title) {
+    return setTitle(title, Text.Type.TEXT);
   }
 
+  public Text setTitleAsHtml(String title) {
+    return setTitle(title, Text.Type.HTML);
+  }
+  
+  public Text setTitleAsXHtml(String title) {
+    return setTitle(title, Text.Type.XHTML);
+  }
+  
+  public Text getTitleElement() {
+    return getFirstChild(TITLE);
+  }
+  
+  public List<Text> getTitleElements() {
+    return _getChildrenAsSet(TITLE);
+  }
+  
+  public Text addTitle(String title) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Text text = fomfactory.newTitle(Text.Type.TEXT);
+    text.setValue(title);
+    this.addTitle(text);
+    return text;
+  }
+  
+  public Text addTitleAsHtml(String title) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Text text = fomfactory.newTitle(Text.Type.HTML);
+    text.setValue(title);
+    this.addTitle(text);
+    return text;
+  }
+  
+  public Text addTitleAsXhtml(String title) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Text text = fomfactory.newTitle(Text.Type.XHTML);
+    text.setValue(title);
+    this.addTitle(text);
+    return text;
+  }
+  
+  public void addTitle(Text title) {
+    addChild((OMNode) title);
+  }
+  
   public URI getHref() throws URISyntaxException {
     return _getUriValue(getAttributeValue(HREF));
   }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java?rev=438711&r1=438710&r2=438711&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMService.java
Wed Aug 30 16:41:01 2006
@@ -40,6 +40,7 @@
 
   public FOMService() {
     super(Constants.SERVICE, new FOMDocument(), new FOMFactory());
+    declareAtomNs();
   }
   
   public FOMService(
@@ -49,6 +50,7 @@
     OMFactory factory)
       throws OMException {
     super(name, namespace, parent, factory);
+    declareAtomNs();
   }
   
   public FOMService(
@@ -56,6 +58,7 @@
     OMContainer parent,
     OMFactory factory) {
       super(qname, parent, factory);
+      declareAtomNs();
   }
   
   public FOMService(
@@ -64,6 +67,7 @@
     OMFactory factory,
     OMXMLParserWrapper builder) {
       super(qname, parent, factory, builder);
+      declareAtomNs();
   }
   
   public FOMService(
@@ -71,6 +75,7 @@
     OMFactory factory) 
       throws OMException {
     super(SERVICE, parent, factory);
+    declareAtomNs();
   }
 
   public FOMService(
@@ -79,6 +84,12 @@
     OMXMLParserWrapper builder) 
       throws OMException {
     super(SERVICE, parent, factory, builder);
+    declareAtomNs();
+  }
+  
+  private void declareAtomNs() {
+    declareDefaultNamespace(APP_NS);
+    declareNamespace(ATOM_NS, "atom");
   }
   
   public List<Workspace> getWorkspaces() {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java?rev=438711&r1=438710&r2=438711&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMWorkspace.java
Wed Aug 30 16:41:01 2006
@@ -23,6 +23,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.model.Collection;
+import org.apache.abdera.model.Text;
 import org.apache.abdera.model.Workspace;
 import org.apache.abdera.util.Constants;
 import org.apache.axiom.om.OMContainer;
@@ -30,6 +31,7 @@
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 
 public class FOMWorkspace
@@ -89,11 +91,64 @@
   }
   
   public String getTitle() {
-    return getAttributeValue(ATITLE);
+    Text title = this.getFirstChild(TITLE);
+    return (title != null) ? title.getValue() : null;
   }
 
-  public void setTitle(String title) {
-    setAttributeValue(ATITLE, title);
+  private Text setTitle(String title, Text.Type type) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Text text = fomfactory.newText(PREFIXED_TITLE,type);
+    text.setValue(title);
+    this._setChild(PREFIXED_TITLE, (OMElement) text);
+    return text;
+  }
+  
+  public Text setTitle(String title) {
+    return setTitle(title, Text.Type.TEXT);
+  }
+
+  public Text setTitleAsHtml(String title) {
+    return setTitle(title, Text.Type.HTML);
+  }
+  
+  public Text setTitleAsXHtml(String title) {
+    return setTitle(title, Text.Type.XHTML);
+  }
+  
+  public Text getTitleElement() {
+    return getFirstChild(TITLE);
+  }
+  
+  public List<Text> getTitleElements() {
+    return _getChildrenAsSet(TITLE);
+  }
+  
+  public Text addTitle(String title) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Text text = fomfactory.newTitle(Text.Type.TEXT);
+    text.setValue(title);
+    this.addTitle(text);
+    return text;
+  }
+  
+  public Text addTitleAsHtml(String title) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Text text = fomfactory.newTitle(Text.Type.HTML);
+    text.setValue(title);
+    this.addTitle(text);
+    return text;
+  }
+  
+  public Text addTitleAsXhtml(String title) {
+    FOMFactory fomfactory = (FOMFactory) factory;
+    Text text = fomfactory.newTitle(Text.Type.XHTML);
+    text.setValue(title);
+    this.addTitle(text);
+    return text;
+  }
+  
+  public void addTitle(Text title) {
+    addChild((OMNode) title);
   }
 
   public List<Collection> getCollections() {



Mime
View raw message