abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r601147 [3/3] - in /incubator/abdera/java/trunk: build/ client/src/main/java/org/apache/abdera/protocol/client/ contrib/rss/src/main/java/org/apache/abdera/contrib/rss/ core/src/main/java/org/apache/abdera/factory/ core/src/main/java/org/ap...
Date Tue, 04 Dec 2007 23:23:42 GMT
Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMDocument.java Tue Dec  4 15:23:33 2007
@@ -31,6 +31,7 @@
 import org.apache.abdera.factory.Factory;
 import org.apache.abdera.i18n.iri.IRI;
 import org.apache.abdera.i18n.lang.Lang;
+import org.apache.abdera.model.Base;
 import org.apache.abdera.model.Document;
 import org.apache.abdera.model.Element;
 import org.apache.abdera.model.ElementWrapper;
@@ -104,20 +105,22 @@
     return (T) factory.getElementWrapper((T) this.getOMDocumentElement());
   }
 
-  public void setRoot(T root) {
+  public Document<T> setRoot(T root) {
     if (root instanceof OMElement) {
       this.setOMDocumentElement((OMElement) root);
     } else if (root instanceof ElementWrapper) {
       this.setOMDocumentElement((OMElement) ((ElementWrapper)root).getInternal());
     }
+    return this;
   }
 
   public IRI getBaseUri() {
     return base;
   }
 
-  public void setBaseUri(String base) {
+  public Document<T> setBaseUri(String base) {
     this.base = new IRI(base);
+    return this;
   }
 
   public void writeTo(
@@ -192,7 +195,7 @@
     return contentType;
   }
   
-  public void setContentType(String contentType) {
+  public Document<T> setContentType(String contentType) {
     try {
       this.contentType = new MimeType(contentType);
       if (this.contentType.getParameter("charset") != null)
@@ -200,14 +203,16 @@
     } catch (javax.activation.MimeTypeParseException e) {
       throw new org.apache.abdera.util.MimeTypeParseException(e);
     }
+    return this;
   }
   
   public Date getLastModified() {
     return this.lastModified;
   }
   
-  public void setLastModified(Date lastModified) {
+  public Document<T> setLastModified(Date lastModified) {
     this.lastModified = lastModified;
+    return this;
   }
   
   public Object clone() {
@@ -241,8 +246,9 @@
     return this.getCharsetEncoding();
   }
 
-  public void setCharset(String charset) {
+  public Document<T> setCharset(String charset) {
     this.setCharsetEncoding(charset);
+    return this;
   }
 
   public Factory getFactory() {
@@ -262,7 +268,7 @@
     return values.toArray(new String[values.size()]);
   }
 
-  public void addProcessingInstruction(String target, String value) {
+  public Document<T> addProcessingInstruction(String target, String value) {
     OMProcessingInstruction pi = 
       this.factory.createOMProcessingInstruction(
         null, target, value);
@@ -271,9 +277,10 @@
     } else {
       this.addChild(pi);
     }
+    return this;
   }
 
-  public void addStylesheet(String href, String media) {
+  public Document<T> addStylesheet(String href, String media) {
     if (media == null) {
       addProcessingInstruction(
         "xml-stylesheet", "href=\"" + href + "\"");
@@ -282,9 +289,10 @@
         "xml-stylesheet", "href=\"" + href + 
         "\" media=\"" + media + "\"");
     }
+    return this;
   }
 
-  public void addComment(String value) {
+  public <T extends Base>T addComment(String value) {
     OMComment comment =
       this.factory.createOMComment(null, value);
     if (this.getOMDocumentElement() != null) {
@@ -292,18 +300,21 @@
     } else {
       this.addChild(comment);
     }
+    return (T)this;
   }
 
   public EntityTag getEntityTag() {
     return etag;
   }
 
-  public void setEntityTag(EntityTag tag) {
+  public Document<T> setEntityTag(EntityTag tag) {
     this.etag = tag;
+    return this;
   }
 
-  public void setEntityTag(String tag) {
+  public Document<T> setEntityTag(String tag) {
     this.etag = new EntityTag(tag);
+    return this;
   }
   
   public String getLanguage() {
@@ -315,24 +326,27 @@
     return (lang != null) ? new Lang(lang) : null;
   }
   
-  public void setLanguage(String lang) {
+  public Document<T> setLanguage(String lang) {
     this.language = lang;
+    return this;
   }
   
   public String getSlug() {
     return slug;
   }
   
-  public void setSlug(String slug) {
+  public Document<T> setSlug(String slug) {
     this.slug = slug;
+    return this;
   }
   
   public boolean getMustPreserveWhitespace() {
     return preserve;
   }
   
-  public void setMustPreserveWhitespace(boolean preserve) {
+  public Document<T> setMustPreserveWhitespace(boolean preserve) {
     this.preserve = preserve;
+    return this;
   }
 
   public XMLVersion getXmlVersion() {
@@ -350,8 +364,9 @@
    * ensure that this particular object is fully parsed and ready 
    * to be modified.
    */
-  public void complete() {
+  public <T extends Base>T complete() {
     if (!isComplete() && getRoot() != null) getRoot().complete();
+    return (T)this;
   }
 
   public void writeTo(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMElement.java Tue Dec  4 15:23:33 2007
@@ -150,11 +150,12 @@
     super.setParent((OMContainer)parent);
   }
   
-  public void setParentElement(Element parent) {
+  public <T extends Element>T setParentElement(Element parent) {
     if (parent instanceof ElementWrapper) {
       parent = ((ElementWrapper)parent).getInternal();
     }
     super.setParent((FOMElement)parent);
+    return (T)this;
   }
 
   
@@ -226,8 +227,9 @@
         ((Document)parent).getLanguage(): null;
   }
 
-  public void setLanguage(String language) {
+  public <T extends Element>T setLanguage(String language) {
     setAttributeValue(LANG,language);
+    return (T)this;
   }
 
   public IRI getBaseUri() {
@@ -261,13 +263,15 @@
     return uri;    
   }
   
-  public void setBaseUri(IRI base) {
+  public <T extends Element>T setBaseUri(IRI base) {
     complete();
     setAttributeValue(BASE,_getStringValue(base));
+    return (T)this;
   }
   
-  public void setBaseUri(String base) {
+  public <T extends Element>T setBaseUri(String base) {
     setBaseUri((base != null) ? new IRI(base) : null);
+    return (T)this;
   }
   
   public String getAttributeValue(QName qname) {
@@ -276,7 +280,7 @@
     return getMustPreserveWhitespace() || value == null ? value : value.trim();
   }
   
-  public void setAttributeValue(QName qname, String value) {
+  public <T extends Element>T setAttributeValue(QName qname, String value) {
     OMAttribute attr = this.getAttribute(qname);
     if (attr != null && value != null) {
       attr.setAttributeValue(value);
@@ -300,6 +304,7 @@
         removeAttribute(attr);
       }
     }
+    return (T)this;
   }
   
   protected <E extends Element>List<E> _getChildrenAsSet(QName qname) {
@@ -411,8 +416,9 @@
     return getAttributeValue(new QName(name));
   }
   
-  public void setAttributeValue(String name, String value) {
+  public <T extends Element>T setAttributeValue(String name, String value) {
     setAttributeValue(new QName(name), value);
+    return (T)this;
   }
   
   protected void _setElementValue(QName qname, String value) {
@@ -503,7 +509,7 @@
     return text;
   }
   
-  public void setText(String text) {
+  public <T extends Element>T setText(String text) {
     complete();
     if (text != null) {
       OMNode child = this.getFirstOMChild();
@@ -516,6 +522,7 @@
       getOMFactory().createOMText(this, text);
     } else 
       _removeAllChildren();
+    return (T)this;
   }
 
   public String getText() {
@@ -576,14 +583,16 @@
     return doc.getRoot();
   }
 
-  public void removeAttribute(QName qname) {
+  public <T extends Element>T removeAttribute(QName qname) {
     OMAttribute attr = getAttribute(qname);
     if (attr != null) removeAttribute(attr);
+    return (T)this;
   }
   
-  public void removeAttribute(String name) {
+  public <T extends Element>T removeAttribute(String name) {
     OMAttribute attr = getAttribute(new QName(name));
     if (attr != null) getAttribute(new QName(name));
+    return (T)this;
   }
   
   protected void _removeChildren(QName qname, boolean many) {
@@ -693,8 +702,9 @@
 //    super.internalSerialize(writer, bool);
 //  }
   
-  public void addComment(String value) {
+  public <T extends Base>T addComment(String value) {
     factory.createOMComment(this, value);
+    return (T)this;
   }
   
   public Locale getLocale() {
@@ -730,10 +740,11 @@
     return null;
   }
   
-  public void declareNS(String uri, String prefix) {
+  public <T extends Element>T declareNS(String uri, String prefix) {
     if (!isDeclared(uri,prefix)) {
       super.declareNamespace(uri,prefix);
     }
+    return (T)this;
   }
   
   protected boolean isDeclared(String ns, String prefix) {
@@ -793,17 +804,19 @@
         ((Document)parent).getMustPreserveWhitespace() : true;
   }
   
-  public void setMustPreserveWhitespace(boolean preserve) {
+  public <T extends Element>T setMustPreserveWhitespace(boolean preserve) {
     if (preserve && !getMustPreserveWhitespace()) {
       setAttributeValue(SPACE, "preserve");
     } else if (!preserve && getMustPreserveWhitespace()) {
       setAttributeValue(SPACE, "default");
     }
+    return (T)this;
   }
   
-  public void setText(DataHandler handler) {
+  public <T extends Element>T setText(DataHandler handler) {
     _removeAllChildren();
     addChild(factory.createOMText(handler, true));
+    return (T)this;
   }
 
   public WriterOptions getDefaultWriterOptions() {
@@ -821,8 +834,9 @@
    * that the underlying stream is fully consumed, only that
    * that particular element has been completely parsed.
    */
-  public void complete() {
+  public <T extends Base>T complete() {
     if (!isComplete() && builder != null) super.build();
+    return (T)this;
   }
 
   /**

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMEntry.java Tue Dec  4 15:23:33 2007
@@ -112,9 +112,10 @@
     return _getChildrenAsSet(AUTHOR);
   }
 
-  public void addAuthor(Person person) {
+  public Entry addAuthor(Person person) {
     complete();
     addChild((OMElement)person);
+    return this;
   }
   
   public Person addAuthor(String name) {
@@ -143,7 +144,7 @@
     return FOMHelper.getCategories(this, scheme);
   }
 
-  public void addCategory(Category category) {
+  public Entry addCategory(Category category) {
     complete();
     Element el = category.getParentElement();
     if (el != null && el instanceof Categories) {
@@ -157,6 +158,7 @@
       }
     }
     addChild((OMElement)category);
+    return this;
   }
 
   public Category addCategory(String term) {
@@ -181,13 +183,14 @@
     return (Content)getFirstChildWithName(CONTENT);
   }
 
-  public void setContentElement(Content content) {
+  public Entry setContentElement(Content content) {
     complete();
     if (content != null) {
       _setChild(CONTENT, (OMElement)content);
     } else {
       _removeChildren(CONTENT, false);
     }
+    return this;
   }
   
   /**
@@ -326,9 +329,10 @@
     return _getChildrenAsSet(CONTRIBUTOR);
   }
 
-  public void addContributor(Person person) {
+  public Entry addContributor(Person person) {
     complete();
     addChild((OMElement)person);
+    return this;
   }
 
   public Person addContributor(String name) {
@@ -356,12 +360,13 @@
     return (IRIElement)getFirstChildWithName(ID);
   }
 
-  public void setIdElement(IRIElement id) {
+  public Entry setIdElement(IRIElement id) {
     complete();
     if (id != null)
       _setChild(ID, (OMElement)id);
     else
       _removeChildren(ID, false);
+    return this;
   }
 
   public IRI getId() {
@@ -408,9 +413,10 @@
     return FOMHelper.getLinks(this, rels);
   }
 
-  public void addLink(Link link) {
+  public Entry addLink(Link link) {
     complete();
     addChild((OMElement)link);
+    return this;
   }
 
   public Link addLink(String href) {
@@ -450,12 +456,13 @@
     return (DateTime)getFirstChildWithName(PUBLISHED);
   }
 
-  public void setPublishedElement(DateTime dateTime) {
+  public Entry setPublishedElement(DateTime dateTime) {
     complete();
     if (dateTime != null)
       _setChild(PUBLISHED, (OMElement)dateTime);
     else
       _removeChildren(PUBLISHED, false);
+    return this;
   }
 
   public Date getPublished() {
@@ -493,9 +500,10 @@
     return getTextElement(RIGHTS);
   }
 
-  public void setRightsElement(Text text) {
+  public Entry setRightsElement(Text text) {
     complete();
     setTextElement(RIGHTS, text, false);
+    return this;
   }
   
   public Text setRights(String value) {
@@ -538,7 +546,7 @@
     return (Source)getFirstChildWithName(SOURCE);
   }
 
-  public void setSource(Source source) {
+  public Entry setSource(Source source) {
     complete();
     if (source != null) {
       if (source instanceof Feed)
@@ -547,15 +555,17 @@
     } else {
       _removeChildren(SOURCE, false);
     }
+    return this;
   }
 
   public Text getSummaryElement() {
     return getTextElement(SUMMARY);
   }
 
-  public void setSummaryElement(Text text) {
+  public Entry setSummaryElement(Text text) {
     complete();
     setTextElement(SUMMARY, text, false);
+    return this;
   }
   
   public Text setSummary(String value) {
@@ -598,9 +608,10 @@
     return getTextElement(TITLE);
   }
 
-  public void setTitleElement(Text title) {
+  public Entry setTitleElement(Text title) {
     complete();
     setTextElement(TITLE, title, false);
+    return this;
   }
 
   public Text setTitle(String value) {
@@ -643,12 +654,13 @@
     return (DateTime)getFirstChildWithName(UPDATED);
   }
 
-  public void setUpdatedElement(DateTime updated) {
+  public Entry setUpdatedElement(DateTime updated) {
     complete();
     if (updated != null)
       _setChild(UPDATED, (OMElement)updated);
     else 
       _removeChildren(UPDATED, false);
+    return this;
   }
 
   public Date getUpdated() {
@@ -746,13 +758,14 @@
     return control;
   }
 
-  public void setControl(Control control) {
+  public Entry setControl(Control control) {
     complete();
     _removeChildren(PRE_RFC_CONTROL,true);
     if (control != null) 
       _setChild(CONTROL, (OMElement)control);
     else 
       _removeChildren(CONTROL, false);
+    return this;
   }
 
   public Link getLink(String rel) {
@@ -878,13 +891,14 @@
     return (link != null) ? link.getResolvedHref() : null;
   }
   
-  public void setDraft(boolean draft) {
+  public Entry setDraft(boolean draft) {
     complete();
     Control control = getControl();
     if (control == null && draft) {
       control = ((FOMFactory)factory).newControl(this);
     }
     if (control != null) control.setDraft(draft);
+    return this;
   }
   
   /**

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMExtensibleElement.java Tue Dec  4 15:23:33 2007
@@ -92,7 +92,7 @@
     return (T) ((t != null) ? factory.getElementWrapper(t) : null);
   }
   
-  public void addExtension(Element extension) {
+  public <T extends ExtensibleElement>T addExtension(Element extension) {
     complete();
     if (extension instanceof ElementWrapper) {
       ElementWrapper wrapper = (ElementWrapper) extension;
@@ -102,6 +102,7 @@
     String prefix = qname.getPrefix();
     declareIfNecessary(qname.getNamespaceURI(), prefix);
     addChild((OMElement)extension);
+    return (T)this;
   }
   
   public <T extends Element>T addExtension(QName qname) {
@@ -195,7 +196,7 @@
     return element;
   }
   
-  public void addExtension(Element extension, Element before) {
+  public <T extends ExtensibleElement>T addExtension(Element extension, Element before) {
     complete();
     extension = getInternal(extension);
     before = getInternal(before);
@@ -209,6 +210,7 @@
       extension.setParentElement(this);
       ((OMElement)before).insertSiblingBefore((OMElement)extension);
     }
+    return (T)this;
   }
 
   public <T extends Element> T addExtension(QName qname, QName before) {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFactory.java Tue Dec  4 15:23:33 2007
@@ -787,8 +787,9 @@
     return element;
   }
 
-  public void registerExtension(ExtensionFactory factory) {
+  public Factory registerExtension(ExtensionFactory factory) {
     factoriesMap.addFactory(factory);
+    return this;
   }
 
   public Categories newCategories() {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMFeed.java Tue Dec  4 15:23:33 2007
@@ -92,9 +92,10 @@
     return _getChildrenAsSet(ENTRY);
   }
 
-  public void addEntry(Entry entry) {
+  public Feed addEntry(Entry entry) {
     complete();
     addChild((OMElement)entry);
+    return this;
   }
 
   public Entry addEntry() {
@@ -103,7 +104,7 @@
     return fomfactory.newEntry(this);
   }
   
-  public void insertEntry(Entry entry) {
+  public Feed insertEntry(Entry entry) {
     complete();
     OMElement el = getFirstChildWithName(ENTRY);
     if (el == null) {
@@ -112,6 +113,7 @@
       entry.setParentElement(this);
       el.insertSiblingBefore((OMElement)entry);
     }
+    return this;
   }
   
   public Entry insertEntry() {
@@ -150,24 +152,27 @@
     super.addChild(node);
   }
  
-  public void sortEntriesByUpdated(boolean new_first) {
+  public Feed sortEntriesByUpdated(boolean new_first) {
     complete();
     sortEntries(new UpdatedComparator(new_first));
+    return this;
   }
   
-  public void sortEntriesByEdited(boolean new_first) {
+  public Feed sortEntriesByEdited(boolean new_first) {
     complete();
     sortEntries(new EditedComparator(new_first));
+    return this;
   }
   
-  public void sortEntries(Comparator<Entry> comparator) {
+  public Feed sortEntries(Comparator<Entry> comparator) {
     complete();
-    if (comparator == null) return;
+    if (comparator == null) return this;
     List<Entry> entries = this.getEntries();
     Entry[] a = entries.toArray(new Entry[entries.size()]);
     Arrays.sort(a, comparator);
     for (Entry e: entries) { e.discard(); }
     for (Entry e: a) { addEntry(e); }
+    return this;
   }
   
   private static class EditedComparator implements Comparator<Entry> {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMGenerator.java Tue Dec  4 15:23:33 2007
@@ -20,6 +20,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Generator;
 import org.apache.abdera.util.Constants;
 import org.apache.axiom.om.OMContainer;
@@ -44,7 +45,7 @@
     String uri) 
       {
     this();
-    setText(value);
+    ((Element)this).setText(value);
     setVersion(version);
     setUri(uri);
   }
@@ -97,24 +98,26 @@
     return _resolve(getResolvedBaseUri(), getUri());
   }
 
-  public void setUri(String uri) {
+  public Generator setUri(String uri) {
     complete();
     if (uri != null)
       setAttributeValue(AURI, (new IRI(uri)).toString());
     else 
       removeAttribute(AURI);
+    return this;
   }
   
   public String getVersion() {
     return getAttributeValue(VERSION);
   }
 
-  public void setVersion(String version) {
+  public Generator setVersion(String version) {
     complete();
     if (version != null)
       setAttributeValue(VERSION, version);
     else
       removeAttribute(VERSION);
+    return this;
   }
 
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMIRI.java Tue Dec  4 15:23:33 2007
@@ -20,6 +20,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Element;
 import org.apache.abdera.model.IRIElement;
 import org.apache.abdera.util.URIHelper;
 import org.apache.axiom.om.OMContainer;
@@ -73,23 +74,24 @@
     return _getUriValue(getText());
   }
 
-  public void setValue(String iri) {
+  public IRIElement setValue(String iri) {
     complete();
     if (iri != null)
-      setText((new IRI(iri)).toString());
+      ((Element)this).setText((new IRI(iri)).toString());
     else
       _removeAllChildren();
-
+    return this;
   }
   
   public IRI getResolvedValue() {
     return _resolve(getResolvedBaseUri(), getValue());
   }
 
-  public void setNormalizedValue(String uri) {
+  public IRIElement setNormalizedValue(String uri) {
     if (uri != null)
       setValue(URIHelper.normalize(uri));
     else 
       setValue(null);
+    return this;
   }
 }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java Tue Dec  4 15:23:33 2007
@@ -24,6 +24,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.abdera.i18n.iri.IRI;
+import org.apache.abdera.model.Element;
 import org.apache.abdera.model.Link;
 import org.apache.abdera.util.Constants;
 import org.apache.abdera.util.URIHelper;
@@ -108,21 +109,23 @@
     return _resolve(getResolvedBaseUri(), getHref());
   }
   
-  public void setHref(String href) {
+  public Link setHref(String href) {
     complete();
     if (href != null)
       setAttributeValue(HREF, (new IRI(href)).toString());
     else 
       removeAttribute(HREF);
+    return this;
   }
   
   public String getRel() {
     return getAttributeValue(REL);
   }
 
-  public void setRel(String rel) {
+  public Link setRel(String rel) {
     complete();
     setAttributeValue(REL, rel);
+    return this;
   }
 
   public MimeType getMimeType() {
@@ -139,7 +142,7 @@
     setAttributeValue(TYPE, (type != null) ? type.toString() : null);
   }
 
-  public void setMimeType(String type) {
+  public Link setMimeType(String type) {
     complete();
     try {
       if (type != null) 
@@ -149,30 +152,33 @@
     } catch (javax.activation.MimeTypeParseException e) {
       throw new org.apache.abdera.util.MimeTypeParseException(e);
     }
+    return this;
   }
 
   public String getHrefLang() {
     return getAttributeValue(HREFLANG);
   }
 
-  public void setHrefLang(String lang) {
+  public Link setHrefLang(String lang) {
     complete();
     if (lang != null)
       setAttributeValue(HREFLANG, lang);
     else 
       removeAttribute(HREFLANG);
+    return this;
   }
 
   public String getTitle() {
     return getAttributeValue(ATITLE);
   }
 
-  public void setTitle(String title) {
+  public Link setTitle(String title) {
     complete();
     if (title != null)
       setAttributeValue(ATITLE, title);
     else 
       removeAttribute(ATITLE);
+    return this;
   }
 
   public long getLength() {
@@ -180,12 +186,13 @@
     return (l != null) ? Long.valueOf(l) : -1;
   }
 
-  public void setLength(long length) {
+  public Link setLength(long length) {
     complete();
     if (length > -1)
       setAttributeValue(LENGTH, (length >= 0) ? String.valueOf(length) : "0");
     else
       removeAttribute(LENGTH);
+    return this;
   }
 
   
@@ -222,7 +229,7 @@
   public void setValue(String value) {
     complete();
     if (value != null)
-      setText(value);
+      ((Element)this).setText(value);
     else
       _removeAllChildren();
   }

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMPerson.java Tue Dec  4 15:23:33 2007
@@ -90,12 +90,13 @@
     return (Element)getFirstChildWithName(NAME);
   }
 
-  public void setNameElement(Element element) {
+  public Person setNameElement(Element element) {
     complete();
     if (element != null)
       _setChild(NAME, (OMElement)element);
     else 
       _removeChildren(NAME, false);
+    return this;
   }
 
   public Element setName(String name) {
@@ -121,12 +122,13 @@
     return (Element)getFirstChildWithName(EMAIL);
   }
 
-  public void setEmailElement(Element element) {
+  public Person setEmailElement(Element element) {
     complete();
     if (element != null)
       _setChild(EMAIL, (OMElement)element);
     else 
       _removeChildren(EMAIL, false);
+    return this;
   }
 
   public Element setEmail(String email) {
@@ -152,12 +154,13 @@
     return (IRIElement)getFirstChildWithName(URI);
   }
 
-  public void setUriElement(IRIElement uri) {
+  public Person setUriElement(IRIElement uri) {
     complete();
     if (uri != null) 
       _setChild(URI, (OMElement)uri);
     else 
       _removeChildren(URI, false);
+    return this;
   }
 
   public IRIElement setUri(String uri) {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMProcessingInstruction.java Tue Dec  4 15:23:33 2007
@@ -58,9 +58,10 @@
     return getValue();
   }
 
-  public void setText(String text) {
+  public <T extends ProcessingInstruction>T setText(String text) {
     if (!isComplete() && builder != null) build();
     setValue(text);
+    return (T)this;
   }
 
   public String toString() {
@@ -70,4 +71,10 @@
     } catch (Exception e) {}
     return w.toString();
   }
+
+  public <T extends ProcessingInstruction>T setTarget(String target) {
+    super.setTarget(target);
+    return (T)this;
+  }
+  
 }

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=601147&r1=601146&r2=601147&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 Tue Dec  4 15:23:33 2007
@@ -112,9 +112,10 @@
     return workspace;
   }
 
-  public void addWorkspace(Workspace workspace) {
+  public Service addWorkspace(Workspace workspace) {
     complete();
     addChild((OMElement) workspace);
+    return this;
   }
   
   public Workspace addWorkspace(String title) {

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMSource.java Tue Dec  4 15:23:33 2007
@@ -109,9 +109,10 @@
     return _getChildrenAsSet(AUTHOR);
   }
 
-  public void addAuthor(Person person) {
+  public <T extends Source>T addAuthor(Person person) {
     complete();
     addChild((OMElement)person);
+    return (T)this;
   }
   
   public Person addAuthor(String name) {
@@ -140,7 +141,7 @@
     return FOMHelper.getCategories(this, scheme);
   }
   
-  public void addCategory(Category category) {
+  public <T extends Source>T addCategory(Category category) {
     complete();
     Element el = category.getParentElement();
     if (el != null && el instanceof Categories) {
@@ -154,6 +155,7 @@
       }
     }
     addChild((OMElement)category);
+    return (T)this;
   }
 
   public Category addCategory(String term) {
@@ -178,9 +180,10 @@
     return _getChildrenAsSet(CONTRIBUTOR);
   }
 
-  public void addContributor(Person person) {
+  public <T extends Source>T addContributor(Person person) {
     complete();
     addChild((OMElement)person);
+    return (T)this;
   }
 
   public Person addContributor(String name) {
@@ -205,12 +208,13 @@
     return (IRIElement)getFirstChildWithName(ID);
   }
 
-  public void setIdElement(IRIElement id) {
+  public <T extends Source>T setIdElement(IRIElement id) {
     complete();
     if (id != null)
       _setChild(ID, (OMElement)id);
     else 
       _removeChildren(ID, false);
+    return (T)this;
   }
 
   public IRI getId() {
@@ -258,9 +262,10 @@
     return FOMHelper.getLinks(this, rels);
   }
 
-  public void addLink(Link link) {
+  public <T extends Source>T addLink(Link link) {
     complete();
     addChild((OMElement)link);
+    return (T)this;
   }
 
   public Link addLink(String href) {
@@ -293,9 +298,10 @@
     return getTextElement(RIGHTS);
   }
 
-  public void setRightsElement(Text text) {
+  public <T extends Source>T setRightsElement(Text text) {
     complete();
     setTextElement(RIGHTS, text, false);
+    return (T)this;
   }
 
   public Text setRights(String value) {
@@ -338,9 +344,10 @@
     return getTextElement(SUBTITLE);
   }
 
-  public void setSubtitleElement(Text text) {
+  public <T extends Source>T setSubtitleElement(Text text) {
     complete();
     setTextElement(SUBTITLE, text, false);
+    return (T)this;
   }
 
   public Text setSubtitle(String value) {
@@ -383,9 +390,10 @@
     return getTextElement(TITLE);
   }
 
-  public void setTitleElement(Text text) {
+  public <T extends Source>T setTitleElement(Text text) {
     complete();
     setTextElement(TITLE, text, false);
+    return (T)this;
   }
 
   public Text setTitle(String value) {
@@ -428,12 +436,13 @@
     return (DateTime)getFirstChildWithName(UPDATED);
   }
 
-  public void setUpdatedElement(DateTime updated) {
+  public <T extends Source>T setUpdatedElement(DateTime updated) {
     complete();
     if (updated != null)
       _setChild(UPDATED, (OMElement)updated);
     else 
       _removeChildren(UPDATED, false);
+    return (T)this;
   }
 
   public String getUpdatedString() {
@@ -476,12 +485,13 @@
     return (Generator)getFirstChildWithName(GENERATOR);
   }
 
-  public void setGenerator(Generator generator) {
+  public <T extends Source>T setGenerator(Generator generator) {
     complete();
     if (generator != null)
       _setChild(GENERATOR, (OMElement) generator);
     else 
       _removeChildren(GENERATOR, false);
+    return (T)this;
   }
 
   public Generator setGenerator(
@@ -501,12 +511,13 @@
     return (IRIElement)getFirstChildWithName(ICON);
   }
 
-  public void setIconElement(IRIElement iri) {
+  public <T extends Source>T setIconElement(IRIElement iri) {
     complete();
     if (iri != null)
       _setChild(ICON, (OMElement) iri);
     else 
       _removeChildren(ICON, false);
+    return (T)this;
   }
 
   public IRIElement setIcon(String value) {
@@ -532,12 +543,13 @@
     return (IRIElement)getFirstChildWithName(LOGO);
   }
 
-  public void setLogoElement(IRIElement iri) {
+  public <T extends Source>T setLogoElement(IRIElement iri) {
     complete();
     if (iri != null)
       _setChild(LOGO, (OMElement)iri);
     else 
       _removeChildren(LOGO, false);
+    return (T)this;
   }
 
   public IRIElement setLogo(String value) {
@@ -608,7 +620,7 @@
     return coll;
   }
   
-  public void setCollection(Collection collection) {
+  public <T extends Source>T setCollection(Collection collection) {
     complete();
     if (collection != null) {
       _removeChildren(PRE_RFC_COLLECTION, true);
@@ -616,6 +628,7 @@
     } else { 
       _removeChildren(COLLECTION, false);
     }
+    return (T)this;
   }
   
   public Link getAlternateLink(

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java (original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMText.java Tue Dec  4 15:23:33 2007
@@ -29,6 +29,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 FOMText 
@@ -91,16 +92,17 @@
     return type;
   }
 
-  public void setTextType(Type type) {
+  public Text setTextType(Type type) {
     complete();
     init(type);
+    return this;
   }
   
   public Div getValueElement() {
     return (Div)this.getFirstChildWithName(Constants.DIV);
   }
 
-  public void setValueElement(Div value) {
+  public Text setValueElement(Div value) {
     complete();
     if (value != null) {
       if (this.getFirstChildWithName(Constants.DIV) != null)
@@ -109,6 +111,7 @@
       this.setFirstChild((OMElement)value);
     } else
       _removeAllChildren();
+    return this;
   }
 
   public String getValue() {
@@ -124,19 +127,34 @@
     return val;
   }
 
-  public void setText(String value) {
+  public <T extends Element>T setText(String value) {
+    return (T)setText(Text.Type.TEXT,value);
+  }
+  
+  public <T extends Element>T setText(Text.Type type, String value) {
     complete();
-    init(Text.Type.TEXT);
-    super.setText(value);
+    init(type);
+    if (value != null) {
+      OMNode child = this.getFirstOMChild();
+      while (child != null) {
+          if (child.getType() == OMNode.TEXT_NODE) {
+              child.detach();
+          }
+          child = child.getNextOMSibling();
+      }
+      getOMFactory().createOMText(this, value);
+    } else 
+      _removeAllChildren();
+    return (T)this;
   }
   
-  public void setValue(String value) {
+  public Text setValue(String value) {
     complete();
     if (value != null) {
       if (Type.TEXT.equals(type)) {
-        super.setText(value);
+        setText(type,value);
       } else if (Type.HTML.equals(type)) {
-        super.setText(value);
+        setText(type,value);
       } else if (Type.XHTML.equals(type)) {
         IRI baseUri = null;
         value = "<div xmlns=\"" + XHTML_NS + "\">" + value + "</div>";
@@ -150,6 +168,7 @@
       }
     } else 
       _removeAllChildren();
+    return this;
   }
 
   public String getWrappedValue() {
@@ -160,7 +179,7 @@
     }
   }
 
-  public void setWrappedValue(String wrappedValue) {
+  public Text setWrappedValue(String wrappedValue) {
     complete();
     if (Type.XHTML.equals(type)) {
       IRI baseUri = null;
@@ -175,6 +194,7 @@
     } else {
       setValue(wrappedValue);
     }
+    return this;
   }
 
   @Override

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=601147&r1=601146&r2=601147&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 Tue Dec  4 15:23:33 2007
@@ -138,9 +138,10 @@
     return col;
   }
 
-  public void addCollection(Collection collection) {
+  public Workspace addCollection(Collection collection) {
     complete();
     addChild((OMElement)collection);
+    return this;
   }
 
   public Collection addCollection(String title, String href) {

Modified: incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/error/Error.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/error/Error.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/error/Error.java (original)
+++ incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/error/Error.java Tue Dec  4 15:23:33 2007
@@ -59,7 +59,7 @@
    * The code should typically match the HTTP status code; however, certain
    * application scenarios may require the use of a different code
    */
-  public void setCode(int code) {
+  public Error setCode(int code) {
     if (code > -1) {
       Element element = getExtension(CODE);
       if (element != null) {
@@ -71,6 +71,7 @@
       Element element = getExtension(CODE);
       if (element != null) element.discard();
     }
+    return this;
   }
  
   /**
@@ -83,7 +84,7 @@
   /**
    * Human-readable, language-sensitive description of the error
    */
-  public void setMessage(String message) {
+  public Error setMessage(String message) {
     if (message != null) {
       Element element = getExtension(MESSAGE);
       if (element != null) {
@@ -95,6 +96,7 @@
       Element element = getExtension(MESSAGE);
       if (element != null) element.discard();
     }
+    return this;
   }
   
   /**
@@ -109,18 +111,14 @@
    * Create a new Error object
    */
   public static Error create(Abdera abdera, int code, String message) {
-    Document<Error> doc = abdera.getFactory().newDocument();
-    Error error = abdera.getFactory().newElement(ERROR,doc);
-    error.setCode(code);
-    error.setMessage(message);
-    return error;
+    return create(abdera,code,message,null);
   }
   
   public static Error create(Abdera abdera, int code, String message, Throwable t) {
     Document<Error> doc = abdera.getFactory().newDocument();
     Error error = abdera.getFactory().newElement(ERROR,doc);
-    error.setCode(code);
-    error.setMessage(message);
+    error.setCode(code)
+         .setMessage(message);
     return error;
   }
   

Modified: incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java (original)
+++ incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractRequest.java Tue Dec  4 15:23:33 2007
@@ -77,32 +77,39 @@
     return check(ONLYIFCACHED);
   }
 
-  public void setMaxAge(long max_age) {
+  public AbstractRequest setMaxAge(long max_age) {
     this.max_age = max_age;
+    return this;
   }
   
-  public void setMaxStale(long max_stale) {
+  public AbstractRequest setMaxStale(long max_stale) {
     this.max_stale = max_stale;
+    return this;
   }
   
-  public void setMinFresh(long min_fresh) {
+  public AbstractRequest setMinFresh(long min_fresh) {
     this.min_fresh = min_fresh;
+    return this;
   }
 
-  public void setNoCache(boolean val) {
+  public AbstractRequest setNoCache(boolean val) {
     toggle(val, NOCACHE);
+    return this;
   }
   
-  public void setNoStore(boolean val) {
+  public AbstractRequest setNoStore(boolean val) {
     toggle(val, NOSTORE);
+    return this;
   }
   
-  public void setNoTransform(boolean val) {
+  public AbstractRequest setNoTransform(boolean val) {
     toggle(val, NOTRANSFORM);
+    return this;
   }
   
-  public void setOnlyIfCached(boolean val) {
+  public AbstractRequest setOnlyIfCached(boolean val) {
     toggle(val, ONLYIFCACHED);
+    return this;
   }
 
 }

Modified: incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java (original)
+++ incubator/abdera/java/trunk/protocol/src/main/java/org/apache/abdera/protocol/util/AbstractResponse.java Tue Dec  4 15:23:33 2007
@@ -103,45 +103,55 @@
     return check(PUBLIC);
   }
 
-  public void setMaxAge(long max_age) {
+  public AbstractResponse setMaxAge(long max_age) {
     this.max_age = max_age;
+    return this;
   }
   
-  public void setMustRevalidate(boolean val) {
+  public AbstractResponse setMustRevalidate(boolean val) {
     toggle(val, REVALIDATE);
+    return this;
   }
   
-  public void setProxyRevalidate(boolean val) {
+  public AbstractResponse setProxyRevalidate(boolean val) {
     toggle(val, PROXYREVALIDATE);
+    return this;
   }
   
-  public void setNoCache(boolean val) {
+  public AbstractResponse setNoCache(boolean val) {
     toggle(val, NOCACHE);
+    return this;
   }
   
-  public void setNoStore(boolean val) {
+  public AbstractResponse setNoStore(boolean val) {
     toggle(val, NOSTORE);
+    return this;
   }
   
-  public void setNoTransform(boolean val) {
+  public AbstractResponse setNoTransform(boolean val) {
     toggle(val, NOTRANSFORM);
+    return this;
   }
   
-  public void setPublic(boolean val) {
+  public AbstractResponse setPublic(boolean val) {
     toggle(val, PUBLIC);
+    return this;
   }
   
-  public void setPrivate(boolean val) {
+  public AbstractResponse setPrivate(boolean val) {
     if (val) flags |= PRIVATE;
     else if (isPrivate()) flags ^= PRIVATE;
+    return this;
   }
   
-  public void setPrivateHeaders(String... headers) {
+  public AbstractResponse setPrivateHeaders(String... headers) {
     this.private_headers = headers;
+    return this;
   }
   
-  public void setNoCacheHeaders(String... headers) {
+  public AbstractResponse setNoCacheHeaders(String... headers) {
     this.nocache_headers = headers;
+    return this;
   }
 
 }

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/EncryptionOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/EncryptionOptions.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/EncryptionOptions.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/EncryptionOptions.java Tue Dec  4 15:23:33 2007
@@ -33,7 +33,7 @@
   /**
    * Set the secret key used to encrypt/decrypt the document content
    */
-  void setDataEncryptionKey(Key key);
+  EncryptionOptions setDataEncryptionKey(Key key);
   
   /**
    * Return the secret key used to encrypt/decrypt the data encryption key
@@ -43,7 +43,7 @@
   /**
    * Set the secret key used to encrypt/decrypt the data encryption key
    */
-  void setKeyEncryptionKey(Key key);
+  EncryptionOptions setKeyEncryptionKey(Key key);
   
   /**
    * Return the cipher algorithm used to decrypt/encrypt the data encryption key
@@ -55,7 +55,7 @@
    * Set the cipher algorithm used to decrypt/encrypt the data encryption key
    * The default is "http://www.w3.org/2001/04/xmlenc#kw-aes128"
    */
-  void setKeyCipherAlgorithm(String alg);
+  EncryptionOptions setKeyCipherAlgorithm(String alg);
   
   /**
    * Return the cipher algorithm used to decrypt/encrypt the document content
@@ -67,7 +67,7 @@
    * Set the cipher algorithm used to decyrpt/encrypt the document content
    * The default is "http://www.w3.org/2001/04/xmlenc#aes128-cbc"
    */
-  void setDataCipherAlgorithm(String alg);
+  EncryptionOptions setDataCipherAlgorithm(String alg);
   
   /**
    * Return true if the encryption should include information about the key
@@ -79,6 +79,6 @@
    * Set whether the encryption should include information about the key
    * The default is false
    */
-  void setIncludeKeyInfo(boolean includeKeyInfo);
+  EncryptionOptions setIncludeKeyInfo(boolean includeKeyInfo);
   
 }

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/SecurityOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/SecurityOptions.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/SecurityOptions.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/SecurityOptions.java Tue Dec  4 15:23:33 2007
@@ -26,6 +26,6 @@
 
   Parser getParser();
   
-  void setParser(Parser parser);
+  <T extends SecurityOptions>T setParser(Parser parser);
   
 }

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/SignatureOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/SignatureOptions.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/SignatureOptions.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/SignatureOptions.java Tue Dec  4 15:23:33 2007
@@ -29,7 +29,7 @@
 
   String getSigningAlgorithm();
   
-  void setSigningAlgorithm(String algorithm);
+  SignatureOptions setSigningAlgorithm(String algorithm);
   
   /**
    * Return the private key with which to sign the element
@@ -39,7 +39,7 @@
   /**
    * Set the private key with which to sign the element
    */
-  void setSigningKey(PrivateKey privateKey);
+  SignatureOptions setSigningKey(PrivateKey privateKey);
   
   /**
    * Return the X.509 cert to associated with the signature
@@ -49,7 +49,7 @@
   /**
    * Set the X.509 cert to associate with the signature
    */
-  void setCertificate(X509Certificate cert);
+  SignatureOptions setCertificate(X509Certificate cert);
   
   /**
    * Get the public key associated with the signature
@@ -59,9 +59,9 @@
   /**
    * Set the public key to associate with the signature
    */
-  void setPublicKey(PublicKey publickey);
+  SignatureOptions setPublicKey(PublicKey publickey);
 
-  void addReference(String href);
+  SignatureOptions addReference(String href);
   
   String[] getReferences();
   
@@ -69,7 +69,7 @@
    * True if atom:link/@href and atom:content/@src targets should be 
    * included in the signature
    */
-  void setSignLinks(boolean signlinks);
+  SignatureOptions setSignLinks(boolean signlinks);
   
   /**
    * True if atom:link/@href and atom:content/@src targets should be 
@@ -80,7 +80,7 @@
   /**
    * Only sign links whose link rels match those provided in the list
    */
-  void setSignedLinkRels(String... rel);
+  SignatureOptions setSignedLinkRels(String... rel);
   
   /**
    * Get the list of link relations to sign

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/DHContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/DHContext.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/DHContext.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/util/DHContext.java Tue Dec  4 15:23:33 2007
@@ -22,7 +22,6 @@
 import java.security.AlgorithmParameterGenerator;
 import java.security.AlgorithmParameters;
 import java.security.InvalidAlgorithmParameterException;
-import java.security.spec.InvalidParameterSpecException;
 import java.security.InvalidKeyException;
 import java.security.Key;
 import java.security.KeyFactory;
@@ -30,6 +29,7 @@
 import java.security.KeyPairGenerator;
 import java.security.NoSuchAlgorithmException;
 import java.security.spec.InvalidKeySpecException;
+import java.security.spec.InvalidParameterSpecException;
 import java.security.spec.X509EncodedKeySpec;
 
 import javax.crypto.KeyAgreement;
@@ -185,7 +185,7 @@
     return keyFact.generatePublic(x509KeySpec);
   }
   
-  public void setPublicKey(
+  public DHContext setPublicKey(
     String dh) 
       throws NoSuchAlgorithmException, 
              InvalidKeySpecException {
@@ -201,6 +201,7 @@
         key = Base64.decode(value);
     }
     publicKey = decode(key);
+    return this;
   }
   
   public Key generateSecret() 

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryptionOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryptionOptions.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryptionOptions.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlEncryptionOptions.java Tue Dec  4 15:23:33 2007
@@ -40,39 +40,44 @@
     return dek;
   }
 
-  public void setDataEncryptionKey(Key key) {
+  public EncryptionOptions setDataEncryptionKey(Key key) {
     this.dek = key;
+    return this;
   }
 
   public Key getKeyEncryptionKey() {
     return kek;
   }
 
-  public void setKeyEncryptionKey(Key key) {
+  public EncryptionOptions setKeyEncryptionKey(Key key) {
     this.kek = key;
+    return this;
   }
 
   public String getKeyCipherAlgorithm() {
     return kca;
   }
 
-  public void setKeyCipherAlgorithm(String alg) {
+  public EncryptionOptions setKeyCipherAlgorithm(String alg) {
     this.kca = alg;
+    return this;
   }
 
   public String getDataCipherAlgorithm() {
     return dca;
   }
 
-  public void setDataCipherAlgorithm(String alg) {
+  public EncryptionOptions setDataCipherAlgorithm(String alg) {
     this.dca = alg;
+    return this;
   }
 
   public boolean includeKeyInfo() {
     return setki;
   }
 
-  public void setIncludeKeyInfo(boolean includeKeyInfo) {
+  public EncryptionOptions setIncludeKeyInfo(boolean includeKeyInfo) {
     this.setki = includeKeyInfo;
+    return this;
   }
 }

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSecurityOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSecurityOptions.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSecurityOptions.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSecurityOptions.java Tue Dec  4 15:23:33 2007
@@ -36,8 +36,10 @@
     return (parser != null) ? parser : abdera.getParser();
   }
 
-  public void setParser(Parser parser) {
+  @SuppressWarnings("unchecked") 
+  public <T extends SecurityOptions>T setParser(Parser parser) {
     this.parser = parser;
+    return (T)this;
   }
 
 }

Modified: incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignatureOptions.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignatureOptions.java?rev=601147&r1=601146&r2=601147&view=diff
==============================================================================
--- incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignatureOptions.java (original)
+++ incubator/abdera/java/trunk/security/src/main/java/org/apache/abdera/security/xmlsec/XmlSignatureOptions.java Tue Dec  4 15:23:33 2007
@@ -42,8 +42,9 @@
     return algo;
   }
   
-  public void setSigningAlgorithm(String algorithm) {
+  public SignatureOptions setSigningAlgorithm(String algorithm) {
     this.algo = algorithm;
+    return this;
   }
   
   protected XmlSignatureOptions(Abdera abdera) {
@@ -55,20 +56,23 @@
     return signingKey;
   }
 
-  public void setSigningKey(PrivateKey privateKey) {
+  public SignatureOptions setSigningKey(PrivateKey privateKey) {
     this.signingKey = privateKey;
+    return this;
   }
 
   public X509Certificate getCertificate() {
     return cert;
   }
 
-  public void setCertificate(X509Certificate cert) {
+  public SignatureOptions setCertificate(X509Certificate cert) {
     this.cert = cert;
+    return this;
   }
 
-  public void addReference(String href) {
+  public SignatureOptions addReference(String href) {
     if (!references.contains(href)) references.add(href);
+    return this;
   }
 
   public String[] getReferences() {
@@ -79,24 +83,27 @@
     return publickey;
   }
 
-  public void setPublicKey(PublicKey publickey) {
+  public SignatureOptions setPublicKey(PublicKey publickey) {
     this.publickey = publickey;
+    return this;
   }
 
   public boolean isSignLinks() {
     return signlinks;
   }
 
-  public void setSignLinks(boolean signlinks) {
+  public SignatureOptions setSignLinks(boolean signlinks) {
     this.signlinks = signlinks;
+    return this;
   }
 
   public String[] getSignLinkRels() {
     return this.linkrels;
   }
 
-  public void setSignedLinkRels(String... rel) {
+  public SignatureOptions setSignedLinkRels(String... rel) {
     this.linkrels = rel;
+    return this;
   }
 
 }



Mime
View raw message