Return-Path: Delivered-To: apmail-incubator-abdera-commits-archive@locus.apache.org Received: (qmail 66975 invoked from network); 16 Jun 2006 20:12:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 16 Jun 2006 20:12:12 -0000 Received: (qmail 20172 invoked by uid 500); 16 Jun 2006 20:12:12 -0000 Delivered-To: apmail-incubator-abdera-commits-archive@incubator.apache.org Received: (qmail 20150 invoked by uid 500); 16 Jun 2006 20:12:12 -0000 Mailing-List: contact abdera-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: abdera-dev@incubator.apache.org Delivered-To: mailing list abdera-commits@incubator.apache.org Received: (qmail 20141 invoked by uid 99); 16 Jun 2006 20:12:11 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jun 2006 13:12:11 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Jun 2006 13:12:02 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 7B2CB1A9846; Fri, 16 Jun 2006 13:11:42 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r414893 [3/11] - in /incubator/abdera/java/trunk: ./ build/ core/ core/src/ core/src/main/ core/src/main/java/ core/src/main/java/org/ core/src/main/java/org/apache/ core/src/main/java/org/apache/abdera/ core/src/main/java/org/apache/abdera... Date: Fri, 16 Jun 2006 20:10:56 -0000 To: abdera-commits@incubator.apache.org From: jmsnell@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060616201142.7B2CB1A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Service.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Service.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Service.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Service.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,77 @@ +/* +* 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.model; + +import java.util.List; + +/** + *

Represents the root of an Atom Publishing Protocol Introspection Document.

+ * + *

Per APP Draft-08:

+ * + *
+ *  The root of an introspection document is the "app:service" element.
+ *
+ *  The "app:service" element is the container for introspection
+ *  information associated with one or more workspaces.  An app:service
+ *  element MUST contain one or more app:workspace elements.
+ *  
+ *  appService =
+ *     element app:service {
+ *        appCommonAttributes,
+ *       ( appWorkspace+
+ *          & extensionElement* )
+ *     }
+ * 
+ * + * @author James M Snell (jasnell@us.ibm.com) + */ +public interface Service + extends ExtensibleElement, ExtensionElement { + + /** + * Return the complete set of workspaces + */ + List getWorkspaces(); + + /** + * Return the named workspace + */ + Workspace getWorkspace(String title); + + /** + * Set the complete set of workspaces + */ + void setWorkspaces(List workspaces); + + /** + * Add an individual workspace + */ + void addWorkspace(Workspace workspace); + + /** + * Add an individual workspace + */ + Workspace addWorkspace(String title); + + /** + * Returns the named collection + */ + Collection getCollection(String workspace, String collection); + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Source.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,653 @@ +/* +* 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.model; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.activation.MimeType; +import javax.activation.MimeTypeParseException; + +/** + *

Per RFC4287:

+ * + *
+ *  If an atom:entry is copied from one feed into another feed, then the
+ *  source atom:feed's metadata (all child elements of atom:feed other
+ *  than the atom:entry elements) MAY be preserved within the copied
+ *  entry by adding an atom:source child element, if it is not already
+ *  present in the entry, and including some or all of the source feed's
+ *  Metadata elements as the atom:source element's children.  Such
+ *  metadata SHOULD be preserved if the source atom:feed contains any of
+ *  the child elements atom:author, atom:contributor, atom:rights, or
+ *  atom:category and those child elements are not present in the source
+ *  atom:entry.
+ *
+ *  atomSource =
+ *     element atom:source {
+ *        atomCommonAttributes,
+ *        (atomAuthor*
+ *         & atomCategory*
+ *         & atomContributor*
+ *         & atomGenerator?
+ *         & atomIcon?
+ *         & atomId?
+ *         & atomLink*
+ *         & atomLogo?
+ *         & atomRights?
+ *         & atomSubtitle?
+ *         & atomTitle?
+ *         & atomUpdated?
+ *         & extensionElement*)
+ *     }
+ *
+ *  The atom:source element is designed to allow the aggregation of
+ *  entries from different feeds while retaining information about an
+ *  entry's source feed.  For this reason, Atom Processors that are
+ *  performing such aggregation SHOULD include at least the required
+ *  feed-level Metadata elements (atom:id, atom:title, and atom:updated)
+ *  in the atom:source element.
+ * 
+ * + * @author James M Snell (jasnell@us.ibm.com) + */ +public interface Source + extends ExtensibleElement, ExtensionElement { + /** + * Returns the first author listed for the entry + */ + Person getAuthor(); + + /** + * Returns the complete set of authors listed for the entry + */ + List getAuthors(); + + /** + * Sets the complete set of authors for the entry + */ + void setAuthors(List people); + + /** + * Adds an individual author to the entry + */ + void addAuthor(Person person); + + /** + * Adds an author + * @throws URISyntaxException + */ + Person addAuthor(String name); + + /** + * Adds an author + * @throws URISyntaxException + */ + Person addAuthor(String name, String email, String uri) throws URISyntaxException; + + /** + * Adds an author + * @throws URISyntaxException + */ + Person addAuthor(String name, String email, URI uri) throws URISyntaxException; + + /** + * Lists the complete set of categories listed for the entry + */ + List getCategories(); + + /** + * Lists the complete set of categories using the specified scheme + * @throws URISyntaxException + */ + List getCategories(String scheme) throws URISyntaxException; + + /** + * Lists the complete set of categories using the specified scheme + */ + List getCategories(URI scheme); + + /** + * Sets the complete set of categories + */ + void setCategories(List categories); + + /** + * Adds an individual category to the entry + */ + void addCategory(Category category); + + /** + * Adds a category to the feed + */ + Category addCategory(String term); + + /** + * Adds a category to the feed + */ + Category addCategory(URI scheme, String term, String label); + + /** + * Adds a category to the feed + * @throws URISyntaxException + */ + Category addCategory(String scheme, String term, String label) throws URISyntaxException; + + /** + * Lists the complete set of contributors for this entry + */ + List getContributors(); + + /** + * Sets the complete list of contributors for this entry + */ + void setContributors(List people); + + /** + * Adds an individual contributor to this entry + */ + void addContributor(Person person); + + /** + * Adds an author + * @throws URISyntaxException + */ + Person addContributor(String name); + + /** + * Adds an author + * @throws URISyntaxException + */ + Person addContributor(String name, String email, String uri) throws URISyntaxException; + + /** + * Adds an author + * @throws URISyntaxException + */ + Person addContributor(String name, String email, URI uri) throws URISyntaxException; + + /** + * RFC4287: The "atom:generator" element's content identifies the + * agent used to generate a feed, for debugging and other purposes. + */ + Generator getGenerator(); + + /** + * RFC4287: The "atom:generator" element's content identifies the + * agent used to generate a feed, for debugging and other purposes. + */ + void setGenerator(Generator generator); + + /** + * RFC4287: The "atom:generator" element's content identifies the + * agent used to generate a feed, for debugging and other purposes. + */ + Generator setGenerator( + URI uri, + String version, + String value); + + /** + * RFC4287: The "atom:generator" element's content identifies the + * agent used to generate a feed, for debugging and other purposes. + */ + Generator setGenerator( + String uri, + String version, + String value) + throws URISyntaxException; + + /** + * RFC4287: The "atom:icon" element's content is an IRI reference + * [RFC3987] that identifies an image that provides iconic visual + * identification for a feed... The image SHOULD have an aspect ratio + * of one (horizontal) to one (vertical) and SHOULD be suitable for + * presentation at a small size. + */ + IRI getIconElement(); + + /** + * RFC4287: The "atom:icon" element's content is an IRI reference + * [RFC3987] that identifies an image that provides iconic visual + * identification for a feed... The image SHOULD have an aspect ratio + * of one (horizontal) to one (vertical) and SHOULD be suitable for + * presentation at a small size. + */ + void setIconElement(IRI iri); + + /** + * RFC4287: The "atom:icon" element's content is an IRI reference + * [RFC3987] that identifies an image that provides iconic visual + * identification for a feed... The image SHOULD have an aspect ratio + * of one (horizontal) to one (vertical) and SHOULD be suitable for + * presentation at a small size. + * @throws URISyntaxException + */ + IRI setIcon(String iri) throws URISyntaxException; + + /** + * RFC4287: The "atom:icon" element's content is an IRI reference + * [RFC3987] that identifies an image that provides iconic visual + * identification for a feed... The image SHOULD have an aspect ratio + * of one (horizontal) to one (vertical) and SHOULD be suitable for + * presentation at a small size. + */ + IRI setIcon(URI iri); + + /** + * RFC4287: The "atom:icon" element's content is an IRI reference + * [RFC3987] that identifies an image that provides iconic visual + * identification for a feed... The image SHOULD have an aspect ratio + * of one (horizontal) to one (vertical) and SHOULD be suitable for + * presentation at a small size. + * @throws URISyntaxException + */ + URI getIcon() throws URISyntaxException; + + /** + * RFC4287: The "atom:id" element conveys a permanent, universally unique + * identifier for an entry or feed. + */ + IRI getIdElement(); + + /** + * RFC4287: The "atom:id" element conveys a permanent, universally unique + * identifier for an entry or feed. + */ + void setIdElement(IRI id); + + /** + * Returns the universally unique identifier for this feed + * @throws URISyntaxException + */ + URI getId() throws URISyntaxException; + + /** + * Sets the universally unique identifier for this feed + */ + IRI setId(URI id) throws URISyntaxException; + + /** + * Sets the universally unique identifier for this feed + * @throws URISyntaxException + */ + IRI setId(String id) throws URISyntaxException; + + /** + * Sets the universally unique identifier for this feed + */ + IRI setId(URI id, boolean normalize) throws URISyntaxException; + + /** + * Sets the universally unique identifier for this feed + * @throws URISyntaxException + */ + IRI setId(String id, boolean normalize) throws URISyntaxException; + + /** + * Lists the complete set of links for this entry + */ + List getLinks(); + + /** + * Lists the complete set of links using the specified rel attribute value + */ + List getLinks(String rel); + + /** + * Sets the complete set of links for the entry + */ + void setLinks(List links); + + /** + * Adds an individual link to the entry + */ + void addLink(Link link); + + Link addLink(String href) throws URISyntaxException; + + Link addLink(String href, String rel) throws URISyntaxException; + + Link addLink(URI href); + + Link addLink(URI href, String rel); + + Link addLink(URI href, String rel, MimeType type, String title, String hreflang, long length); + + Link addLink(String href, String rel, MimeType type, String title, String hreflang, long length) throws URISyntaxException; + + Link addLink(URI href, String rel, String type, String title, String hreflang, long length) throws MimeTypeParseException; + + Link addLink(String href, String rel, String type, String title, String hreflang, long length) throws URISyntaxException, MimeTypeParseException; + + + /** + * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] + * that identifies an image that provides visual identification for a feed. + * The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical). + */ + IRI getLogoElement(); + + /** + * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] + * that identifies an image that provides visual identification for a feed. + * The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical). + */ + void setLogoElement(IRI iri); + + /** + * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] + * that identifies an image that provides visual identification for a feed. + * The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical). + * @throws URISyntaxException + */ + IRI setLogo(String iri) throws URISyntaxException; + + /** + * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] + * that identifies an image that provides visual identification for a feed. + * The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical). + */ + IRI setLogo(URI iri); + + /** + * RFC4287: The "atom:logo" element's content is an IRI reference [RFC3987] + * that identifies an image that provides visual identification for a feed. + * The image SHOULD have an aspect ratio of 2 (horizontal) to 1 (vertical). + * @throws URISyntaxException + */ + URI getLogo() throws URISyntaxException; + + /** + *

The rights element is typically used to convey a human readable + * copyright (e.g. "<atom:rights>Copyright (c), 2006</atom:rights>).

+ * + *

RFC4287: The "atom:rights" element is a Text construct that conveys + * information about rights held in and over an entry or feed.

+ */ + Text getRightsElement(); + + /** + *

The rights element is typically used to convey a human readable + * copyright (e.g. "<atom:rights>Copyright (c), 2006</atom:rights>).

+ * + *

RFC4287: The "atom:rights" element is a Text construct that conveys + * information about rights held in and over an entry or feed.

+ */ + void setRightsElement(Text text); + + /** + * Sets the text of atom:rights as type="text" + */ + Text setRightsAsText(String value); + + /** + * Sets the text of atom:rights as type="html" + */ + Text setRightsAsHtml(String value); + + /** + * Sets the content of atom:rights as type="xhtml" + */ + Text setRightsAsXhtml(String value); + + /** + * Sets the content of atom:rights as type="xhtml" + */ + Text setRightsAsXhtml(Div value); + + /** + * Sets the text of atom:rights as type="html" + */ + Text setRightsAsHtml(String value, URI baseUri); + + /** + * Sets the content of atom:rights as type="xhtml" + */ + Text setRightsAsXhtml(String value, URI baseUri); + + /** + * Sets the content of atom:rights as type="xhtml" + */ + Text setRightsAsXhtml(Div value, URI baseUri); + + /** + * Sets the text of atom:rights as type="html" + * @throws URISyntaxException + */ + Text setRightsAsHtml(String value, String baseUri) throws URISyntaxException; + + /** + * Sets the content of atom:rights as type="xhtml" + * @throws URISyntaxException + */ + Text setRightsAsXhtml(String value, String baseUri) throws URISyntaxException; + + /** + * Sets the content of atom:rights as type="xhtml" + * @throws URISyntaxException + */ + Text setRightsAsXhtml(Div value, String baseUri) throws URISyntaxException; + + /** + * Returns the text of atom:rights + */ + String getRights(); + + /** + * Returns the type of atom:rights + */ + Text.Type getRightsType(); + + /** + * RFC4287: The "atom:subtitle" element is a Text construct that + * conveys a human-readable description or subtitle for a feed. + */ + Text getSubtitleElement(); + + /** + * RFC4287: The "atom:subtitle" element is a Text construct that + * conveys a human-readable description or subtitle for a feed. + */ + void setSubtitleElement(Text text); + + /** + * Sets the value of atom:subtitle as type="text" + */ + Text setSubtitleAsText(String value); + + /** + * Sets the value of atom:subtitle as type="html + */ + Text setSubtitleAsHtml(String value); + + /** + * Sets the contnt of atom:subtitle as type="xhtml" + */ + Text setSubtitleAsXhtml(String value); + + /** + * Sets the content of atom:subtitle as type="xhtml" + */ + Text setSubtitleAsXhtml(Div value); + + /** + * Sets the value of atom:subtitle as type="html + */ + Text setSubtitleAsHtml(String value, URI baseUri); + + /** + * Sets the contnt of atom:subtitle as type="xhtml" + */ + Text setSubtitleAsXhtml(String value, URI baseUri); + + /** + * Sets the content of atom:subtitle as type="xhtml" + */ + Text setSubtitleAsXhtml(Div value, URI baseUri); + + /** + * Sets the value of atom:subtitle as type="html + * @throws URISyntaxException + */ + Text setSubtitleAsHtml(String value, String baseUri) throws URISyntaxException; + + /** + * Sets the contnt of atom:subtitle as type="xhtml" + * @throws URISyntaxException + */ + Text setSubtitleAsXhtml(String value, String baseUri) throws URISyntaxException; + + /** + * Sets the content of atom:subtitle as type="xhtml" + * @throws URISyntaxException + */ + Text setSubtitleAsXhtml(Div value, String baseUri) throws URISyntaxException; + + /** + * Returns the text value of atom:subtitle + */ + String getSubtitle(); + + /** + * Returns the atom:subtitle type + */ + Text.Type getSubtitleType(); + + /** + * RFC4287: The "atom:title" element is a Text construct that conveys a + * human-readable title for an entry or feed. + */ + Text getTitleElement(); + + /** + * RFC4287: The "atom:title" element is a Text construct that conveys a + * human-readable title for an entry or feed. + */ + void setTitleElement(Text text); + + /** + * Sets the value of atom:title as type="text" + */ + Text setTitleAsText(String value); + + /** + * Sets the value of atom:title as type="html" + */ + Text setTitleAsHtml(String value); + + /** + * Sets the content of atom:title as type="xhtml" + */ + Text setTitleAsXhtml(String value); + + /** + * Sets the content of atom:title as type="xhtml" + */ + Text setTitleAsXhtml(Div value); + + /** + * Sets the value of atom:title as type="html" + */ + Text setTitleAsHtml(String value, URI baseUri); + + /** + * Sets the content of atom:title as type="xhtml" + */ + Text setTitleAsXhtml(String value, URI baseUri); + + /** + * Sets the content of atom:title as type="xhtml" + */ + Text setTitleAsXhtml(Div value, URI baseUri); + + /** + * Sets the value of atom:title as type="html" + * @throws URISyntaxException + */ + Text setTitleAsHtml(String value, String baseUri) throws URISyntaxException; + + /** + * Sets the content of atom:title as type="xhtml" + * @throws URISyntaxException + */ + Text setTitleAsXhtml(String value, String baseUri) throws URISyntaxException; + + /** + * Sets the content of atom:title as type="xhtml" + * @throws URISyntaxException + */ + Text setTitleAsXhtml(Div value, String baseUri) throws URISyntaxException; + + /** + * Returns the text of atom:title + */ + String getTitle(); + + /** + * Returns the type of atom:title + */ + Text.Type getTitleType(); + + /** + * RFC4287: The "atom:updated" element is a Date construct indicating + * the most recent instant in time when an entry or feed was modified + * in a way the publisher considers significant. Therefore, not all + * modifications necessarily result in a changed atom:updated value. + */ + DateTime getUpdatedElement(); + + /** + * RFC4287: The "atom:updated" element is a Date construct indicating + * the most recent instant in time when an entry or feed was modified + * in a way the publisher considers significant. Therefore, not all + * modifications necessarily result in a changed atom:updated value. + */ + void setUpdatedElement(DateTime dateTime); + + String getUpdatedString(); + + Date getUpdated(); + + DateTime setUpdated(Date value); + + DateTime setUpdated(Calendar value); + + DateTime setUpdated(long value); + + DateTime setUpdated(String value); + + /** + * Returns the first link with the specified rel attribute value + */ + Link getLink(String rel); + + /** + * Returns the first link using the rel attribute value "self" + */ + Link getSelfLink(); + + /** + * Returns this entries first alternate link + */ + Link getAlternateLink(); + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/StringElement.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/StringElement.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/StringElement.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/StringElement.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,33 @@ +/* +* 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.model; + +/** + *

The StringElement interface provides a common base for a collection + * of elements whose content values may contain text

+ * + * @author James M Snell (jasnell@us.ibm.com) + */ +public interface StringElement + extends ExtensionElement { + + String getValue(); + + void setValue(String value); + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Text.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Text.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Text.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Text.java Fri Jun 16 13:10:47 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.model; + +/** +/** + *

Represents an Atom Text Contruct.

+ * + *

Atom allows three kinds of Text constructs:

+ * + *
    + *
  • Text, consisting of content that is to be interpreted as plain text with + * no markup. For instance, <title type="text">&lt;title&gt;</title> + * is interpreted as literal characer "<" followed by the word "content", + * followed by the literal character ">".
  • + *
  • HTML, consisting of content that is to be interpreted as escaped HTML + * markup. For instance, <title type="html">&lt;b&gt;title&lt;/b&gt;</title> + * is interpreted as the word "content" surrounded by the HTML <b> + * and </b> tags.
  • + *
  • XHTML, consisting of well-formed XHTML content wrapped in an XHTML div element. + * For instance, <title type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><b>Title</b></div></title>.
  • + *
+ * + *

Per RFC4287:

+ * + *
+ *  A Text construct contains human-readable text, usually in small
+ *  quantities.  The content of Text constructs is Language-Sensitive.
+ *
+ *  atomPlainTextConstruct =
+ *     atomCommonAttributes,
+ *     attribute type { "text" | "html" }?,
+ *     text
+ *
+ *  atomXHTMLTextConstruct =
+ *     atomCommonAttributes,
+ *     attribute type { "xhtml" },
+ *     xhtmlDiv
+ *
+ *  atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct
+ * 
+ * + * @author James M Snell (jasnell@us.ibm.com) + */ +public interface Text + extends StringElement { + + public static enum Type { + TEXT, HTML, XHTML; + + public static Type typeFromString(String val) { + Type type = TEXT; + if (val != null) { + if (val.equalsIgnoreCase("text")) + type = TEXT; + else if (val.equalsIgnoreCase("html")) + type = HTML; + else if (val.equalsIgnoreCase("xhtml")) + type = XHTML; + else + type = null; + } + return type; + } + + + }; + + Type getTextType(); + + Div getValueElement(); + + void setValueElement(Div value); + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Total.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Total.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Total.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Total.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,13 @@ +package org.apache.abdera.model; + +/** + * Provides an interface for the Atom Threading Extension total + * element. + */ +public interface Total extends ExtensionElement { + + int getValue(); + + void setValue(int value); + +} Added: 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=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/Workspace.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,98 @@ +/* +* 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.model; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + +/** + *

An Atom Publishing Protocol Introspection Document workspace element.

+ * + *

Per APP Draft-08

+ * + *
+ *  The "app:workspace" element contains information elements about the
+ *  collections of resources available for editing.  The app:workspace
+ *  element MUST contain one or more app:collection elements.
+ *
+ *  appWorkspace =
+ *     element app:workspace {
+ *        appCommonAttributes,
+ *        attribute title { text },
+ *        ( appCollection+
+ *          & extensionElement* )
+ *     }
+ *
+ * 
+ * + * @author James M Snell (jasnell@us.ibm.com) + */ +public interface Workspace + extends ExtensibleElement, ExtensionElement { + + /** + * 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(); + + /** + * 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); + + /** + * Returns the full set of collections in this workspace + */ + List getCollections(); + + /** + * Returns the named collection + */ + Collection getCollection(String title); + + /** + * Sets the full set of collections for this workspace + */ + void setCollection(List collections); + + /** + * Adds an individual collection to this workspace + */ + void addCollection(Collection collection); + + /** + * Adds an individual collection to this workspace + */ + Collection addCollection( + String title, + URI href); + + /** + * Adds an individual collection to this workspace + */ + Collection addCollection( + String title, + String href) + throws URISyntaxException; + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParseException.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParseException.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParseException.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParseException.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,44 @@ +/* +* 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.parser; + +/** + * @author James M Snell (jasnell@us.ibm.com) + */ +public class ParseException + extends RuntimeException { + + private static final long serialVersionUID = -2586758177341912116L; + + public ParseException() { + super(); + } + + public ParseException(String message) { + super(message); + } + + public ParseException(String message, Throwable cause) { + super(message, cause); + } + + public ParseException(Throwable cause) { + super(cause); + } + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/Parser.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/Parser.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/Parser.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/Parser.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,70 @@ +/* +* 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.parser; + +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; + +import org.apache.abdera.model.Document; +import org.apache.abdera.model.Element; +import org.apache.abdera.util.ServiceUtil; + + +/** + * @author James M Snell (jasnell@us.ibm.com) + * + * The Parser is the interface through which developers parse feed documents. + * + * Document doc = Parser.INSTANCE.parse(inputStream, baseUri, options); + */ +public interface Parser { + + /** + * The default Parser instance + */ + public static final Parser INSTANCE = ServiceUtil.newParserInstance(); + + Document parse( + InputStream in) + throws ParseException; + + Document parse( + InputStream in, + URI base) + throws ParseException; + + Document parse( + InputStream in, + URI base, + ParserOptions options) + throws ParseException; + + Document parse( + InputStream in, + String base) + throws ParseException, URISyntaxException; + + Document parse( + InputStream in, + String base, + ParserOptions options) + throws ParseException, URISyntaxException; + + ParserOptions getDefaultParserOptions(); +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParserOptions.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParserOptions.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParserOptions.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/parser/ParserOptions.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,79 @@ +/* +* 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.parser; + +import org.apache.abdera.factory.Factory; +import org.apache.abdera.filter.ParseFilter; +import org.apache.abdera.filter.TextFilter; + + +/** + * @author James M Snell (jasnell@us.ibm.com) + * + * Parser options are used to modify the behavior of the parser. + */ +public interface ParserOptions { + + /** + * Returns the factory the parser should use + */ + Factory getFactory(); + + /** + * Sets the factory the parser should use + */ + void setFactory(Factory factory); + + /** + * Returns the default character set to use for the parsed document + */ + String getCharset(); + + /** + * Sets the character set to use for the parsed document + */ + void setCharset(String charset); + + /** + * Returns the Parse Filter. The parse filter is a set of XML QNames that + * the parse should watch out for. If the filter is null, the parser will + * parse all elements in the document. I the filter is not null, the parser + * will only pay attention to elements whose QName's appear in the filter list. + */ + ParseFilter getParseFilter(); + + /** + * Sets the Parse Filter. The parse filter is a set of XML QNames that + * the parse should watch out for. If the filter is null, the parser will + * parse all elements in the document. I the filter is not null, the parser + * will only pay attention to elements whose QName's appear in the filter list. + */ + void setParseFilter(ParseFilter parseFilter); + + /** + * Returns the TextFilter. The text filter provides filtering for all + * character strings encountered during the parse process. + */ + TextFilter getTextFilter(); + + /** + * Sets the TextFilter. The text filter provides filtering for all + * character strings encountered during the parse process. + */ + void setTextFilter(TextFilter textFilter); +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParser.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParser.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParser.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParser.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,69 @@ +/* +* 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.util; + +import java.io.InputStream; +import java.net.URI; +import java.net.URISyntaxException; + +import org.apache.abdera.model.Document; +import org.apache.abdera.model.Element; +import org.apache.abdera.parser.ParseException; +import org.apache.abdera.parser.Parser; +import org.apache.abdera.parser.ParserOptions; + + +/** + * @author James M Snell (jasnell@us.ibm.com) + */ +public abstract class AbstractParser + implements Parser { + + public Document parse( + InputStream in) + throws ParseException { + return parse(in, (URI)null, getDefaultParserOptions()); + } + + public Document parse( + InputStream in, + URI base) + throws ParseException { + return parse(in, base, getDefaultParserOptions()); + } + + public Document parse( + InputStream in, + String base) + throws ParseException, + URISyntaxException { + return parse(in, new URI(base), getDefaultParserOptions()); + } + + public Document parse( + InputStream in, + String base, + ParserOptions options) + throws ParseException, + URISyntaxException { + return parse(in, new URI(base), options); + } + + public abstract ParserOptions getDefaultParserOptions(); + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParserOptions.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParserOptions.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParserOptions.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractParserOptions.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,71 @@ +/* +* 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.util; + +import org.apache.abdera.factory.Factory; +import org.apache.abdera.filter.ParseFilter; +import org.apache.abdera.filter.TextFilter; +import org.apache.abdera.parser.ParserOptions; + +/** + * @author James M Snell (jasnell@us.ibm.com) + */ +public abstract class AbstractParserOptions + implements ParserOptions { + + protected Factory factory = null; + protected String charset = null; + protected ParseFilter parseFilter = null; + protected TextFilter textFilter = null; + + protected abstract void initFactory(); + protected abstract void checkFactory(Factory factory); + + public Factory getFactory() { + if (factory == null) initFactory(); + return factory; + } + + public void setFactory(Factory factory) { + checkFactory(factory); + this.factory = factory; + } + + public String getCharset() { + return charset; + } + + public void setCharset(String charset) { + this.charset = charset; + } + + public ParseFilter getParseFilter() { + return parseFilter; + } + public void setParseFilter(ParseFilter parseFilter) { + this.parseFilter = parseFilter; + } + + public TextFilter getTextFilter() { + return textFilter; + } + + public void setTextFilter(TextFilter textFilter) { + this.textFilter = textFilter; + } +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractXPath.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractXPath.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractXPath.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/AbstractXPath.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,71 @@ +/* +* 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.util; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.abdera.model.Base; +import org.apache.abdera.xpath.XPath; +import org.apache.abdera.xpath.XPathException; + +public abstract class AbstractXPath + implements XPath { + + private Map namespaces = null; + + public Map getDefaultNamespaces() { + if (namespaces == null) + namespaces = new HashMap(); + namespaces.put(Constants.PREFIX, Constants.ATOM_NS); + namespaces.put(Constants.APP_PREFIX, Constants.APP_NS); + namespaces.put(Constants.CONTROL_PREFIX, Constants.CONTROL_NS); + namespaces.put(Constants.THR_PREFIX, Constants.THR_NS); + return namespaces; + } + + public void setDefaultNamespaces(Map namespaces) { + this.namespaces = namespaces; + } + + public List selectNodes(String path, Base base) throws XPathException { + return selectNodes(path, base, getDefaultNamespaces()); + } + + public Object selectSingleNode(String path, Base base) throws XPathException { + return selectSingleNode(path, base, getDefaultNamespaces()); + } + + public Object evaluate(String path, Base base) throws XPathException { + return evaluate(path, base, getDefaultNamespaces()); + } + + public String valueOf(String path, Base base) throws XPathException { + return valueOf(path, base, getDefaultNamespaces()); + } + + public boolean isTrue(String path, Base base) throws XPathException { + return isTrue(path, base, getDefaultNamespaces()); + } + + public Number numericValueOf(String path, Base base) throws XPathException { + return numericValueOf(path, base, getDefaultNamespaces()); + } + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/BlackListParseFilter.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/BlackListParseFilter.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/BlackListParseFilter.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/BlackListParseFilter.java Fri Jun 16 13:10:47 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.util; + +import javax.xml.namespace.QName; + +import org.apache.abdera.filter.ParseFilter; + +/** + * BlackList Implementation of ParseFilter. The + * QNames listed will be considered unacceptable + */ +public class BlackListParseFilter extends ParseFilter { + + public boolean acceptable(QName qname) { + return !contains(qname); + } + + public boolean acceptableAttribute(QName qname, QName attribute) { + return !containsAttribute(qname, attribute); + } +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ConfigProperties.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ConfigProperties.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ConfigProperties.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ConfigProperties.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,71 @@ +/* +* 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.util; + +import java.util.ResourceBundle; + +/** + * @author James M Snell (jasnell@us.ibm.com) + */ +public final class ConfigProperties + implements Constants { + + ConfigProperties() {} + + private static ResourceBundle BUNDLE = null; + private static String parser = null; + private static String factory = null; + private static String xpath = null; + + private static ResourceBundle getBundle() { + if (BUNDLE == null) { + try { + BUNDLE = ResourceBundle.getBundle("abdera"); + } catch (Exception e) {} + } + return BUNDLE; + } + + public static String getConfigurationOption(String id) { + String option = System.getProperty(id); + try { + if (getBundle() != null && option == null) + option = getBundle().getString(id); + } catch (Exception e) {} + return option; + } + + public static String getDefaultXPath() { + if (xpath == null) + xpath = getConfigurationOption(CONFIG_XPATH); + return (xpath != null) ? xpath : DEFAULT_XPATH; + } + + public static String getDefaultParser() { + if (parser == null) + parser = getConfigurationOption(CONFIG_PARSER); + return (parser != null) ? parser : DEFAULT_PARSER; + } + + public static String getDefaultFactory() { + if (factory == null) + factory = getConfigurationOption(CONFIG_FACTORY); + return (factory != null) ? factory : DEFAULT_FACTORY; + } + +} Added: 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=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Constants.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Constants.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,159 @@ +/* +* 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.util; + +import javax.xml.namespace.QName; + +/** + * @author James M Snell (jasnell@us.ibm.com) + */ +public interface Constants { + + public static final String CONFIG_PARSER = "org.apache.abdera.parser.Parser"; + public static final String CONFIG_FACTORY = "org.apache.abdera.factory.Factory"; + public static final String CONFIG_XPATH = "org.apache.abdera.xpath.XPath"; + public static final String DEFAULT_PARSER = "org.apache.abdera.parser.stax.FOMParser"; + public static final String DEFAULT_FACTORY = "org.apache.abdera.parser.stax.FOMFactory"; + public static final String DEFAULT_XPATH = "org.apache.abdera.parser.stax.FOMXPath"; + public static final String PREFIX = "a"; + public static final String APP_PREFIX = "app"; + public static final String CONTROL_PREFIX = "pub"; + + public static final String ATOM_MEDIA_TYPE = "application/atom+xml"; + public static final String MULTIPART_MEDIA_TYPE = "multipart/related"; + + public static final String ATOM_NS = "http://www.w3.org/2005/Atom"; + public static final String APP_NS = "http://purl.org/atom/app#"; + public static final String CONTROL_NS = "http://example.net/appns/"; + public static final String XML_NS = "http://www.w3.org/XML/1998/namespace"; + public static final String XHTML_NS = "http://www.w3.org/1999/xhtml"; + + public static final String LN_ACCEPT = "accept"; + public static final String LN_CLASS = "class"; + public static final String LN_DIV = "div"; + public static final String LN_FEED = "feed"; + public static final String LN_ENTRY = "entry"; + public static final String LN_SERVICE = "service"; + public static final String LN_AUTHOR = "author"; + public static final String LN_CATEGORY = "category"; + public static final String LN_CONTENT = "content"; + public static final String LN_CONTRIBUTOR = "contributor"; + public static final String LN_GENERATOR = "generator"; + public static final String LN_ICON = "icon"; + public static final String LN_ID = "id"; + public static final String LN_LOGO = "logo"; + public static final String LN_LINK = "link"; + public static final String LN_PUBLISHED = "published"; + public static final String LN_RIGHTS = "rights"; + public static final String LN_SOURCE = "source"; + public static final String LN_SUBTITLE = "subtitle"; + public static final String LN_SUMMARY = "summary"; + public static final String LN_TITLE = "title"; + public static final String LN_UPDATED = "updated"; + public static final String LN_TERM = "term"; + public static final String LN_SCHEME = "scheme"; + public static final String LN_LABEL = "label"; + public static final String LN_HREF = "href"; + public static final String LN_MEMBERTYPE = "member-type"; + public static final String LN_LANG = "lang"; + public static final String LN_BASE = "base"; + public static final String LN_URI = "uri"; + public static final String LN_VERSION = "version"; + public static final String LN_REL = "rel"; + public static final String LN_TYPE = "type"; + public static final String LN_HREFLANG = "hreflang"; + public static final String LN_LENGTH = "length"; + public static final String LN_NAME = "name"; + public static final String LN_EMAIL = "email"; + public static final String LN_WORKSPACE = "workspace"; + public static final String LN_SRC = "src"; + public static final String LN_COLLECTION = "collection"; + public static final String LN_CONTROL = "control"; + public static final String LN_DRAFT = "draft"; + + public static final QName DIV = new QName(XHTML_NS, LN_DIV, "xhtml"); + public static final QName CONTROL = new QName(CONTROL_NS, LN_CONTROL, CONTROL_PREFIX); + public static final QName DRAFT = new QName(CONTROL_NS, LN_DRAFT, CONTROL_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 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); + public static final QName CONTRIBUTOR = new QName(ATOM_NS, LN_CONTRIBUTOR, PREFIX); + public static final QName GENERATOR = new QName(ATOM_NS, LN_GENERATOR, PREFIX); + public static final QName ICON = new QName(ATOM_NS, LN_ICON, PREFIX); + public static final QName ID = new QName(ATOM_NS, LN_ID, PREFIX); + public static final QName LOGO = new QName(ATOM_NS, LN_LOGO, PREFIX); + public static final QName LINK = new QName(ATOM_NS, LN_LINK, PREFIX); + public static final QName PUBLISHED = new QName(ATOM_NS, LN_PUBLISHED, PREFIX); + public static final QName RIGHTS = new QName(ATOM_NS, LN_RIGHTS, PREFIX); + public static final QName SOURCE = new QName(ATOM_NS, LN_SOURCE, PREFIX); + 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 UPDATED = new QName(ATOM_NS, LN_UPDATED, PREFIX); + public static final QName ENTRY = new QName(ATOM_NS, LN_ENTRY, PREFIX); + public static final QName TERM = new QName(LN_TERM); + public static final QName SCHEME = new QName(LN_SCHEME); + public static final QName LABEL = new QName(LN_LABEL); + public static final QName ATITLE = new QName(LN_TITLE); + public static final QName HREF = new QName(LN_HREF); + public static final QName MEMBER_TYPE = new QName(APP_NS, LN_MEMBERTYPE, APP_PREFIX); + public static final QName ACCEPT = new QName(APP_NS, LN_ACCEPT, APP_PREFIX); + public static final QName LANG = new QName(XML_NS, LN_LANG, "xml"); + public static final QName BASE = new QName(XML_NS, LN_BASE, "xml"); + public static final QName AURI = new QName(LN_URI); + public static final QName VERSION = new QName(LN_VERSION); + public static final QName REL = new QName(LN_REL); + public static final QName TYPE = new QName(LN_TYPE); + public static final QName HREFLANG = new QName(LN_HREFLANG); + public static final QName LENGTH = new QName(LN_LENGTH); + public static final QName NAME = new QName(ATOM_NS, LN_NAME, PREFIX); + public static final QName EMAIL = new QName(ATOM_NS, LN_EMAIL, PREFIX); + public static final QName URI = new QName(ATOM_NS, LN_URI, PREFIX); + public static final QName WORKSPACE = new QName(APP_NS, LN_WORKSPACE, APP_PREFIX); + public static final QName SRC = new QName(LN_SRC); + public static final QName COLLECTION = new QName(APP_NS, LN_COLLECTION, APP_PREFIX); + public static final QName AID = new QName(LN_ID); + public static final QName CLASS = new QName(LN_CLASS); + + public static final String TEXT = "text"; + public static final String HTML = "html"; + public static final String XHTML = "xhtml"; + public static final String XML = "xml"; + public static final String YES = "yes"; + public static final String NO = "no"; + + // Atom Thread Extensions Support + public static final String THR_NS = "http://purl.org/syndication/thread/1.0"; + public static final String LN_INREPLYTO = "in-reply-to"; + public static final String LN_REF = "ref"; + public static final String LN_COUNT = "count"; + public static final String LN_WHEN = "when"; + public static final String LN_TOTAL = "total"; + public static final String THR_PREFIX = "thr"; + public static final QName IN_REPLY_TO = new QName(THR_NS, LN_INREPLYTO, THR_PREFIX); + public static final QName THRCOUNT = new QName(THR_NS, LN_COUNT, THR_PREFIX); + /** @deprecated Use Constants.THRUPDATED */ + public static final QName THRWHEN = new QName(THR_NS, LN_WHEN, THR_PREFIX); + public static final QName THRUPDATED = new QName(THR_NS, LN_UPDATED, THR_PREFIX); + public static final QName THRTOTAL = new QName(THR_NS, LN_TOTAL, THR_PREFIX); + public static final QName THRREF = new QName(LN_REF); + public static final QName THRSOURCE = new QName(LN_SOURCE); + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/MimeTypeHelper.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,64 @@ +/* +* 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.util; + +import javax.activation.MimeType; +import javax.activation.MimeTypeParseException; + +public class MimeTypeHelper { + + public static boolean isMatch(String a, String b) { + boolean answer = false; + try { + MimeType mta = new MimeType(a); + answer = mta.match(b); + } catch (Exception e) {} + return answer; + } + + public static boolean isXml(String a) { + boolean answer = isMatch("application/xml", a) || isMatch("text/xml", a); + if (!answer) { + try { + MimeType mta = new MimeType(a); + answer = + (("application".equalsIgnoreCase(mta.getPrimaryType()) || + "text".equalsIgnoreCase(mta.getPrimaryType())) && + mta.getSubType().equals("xml") || + mta.getSubType().endsWith("+xml")); + } catch (Exception e) {} + } + return answer; + } + + public static boolean isText(String a) { + boolean answer = isMatch("text/*", a); + return answer; + } + + public static boolean isMimeType(String a) { + boolean answer = false; + try { + new MimeType(a); + answer = true; + } catch (MimeTypeParseException e) { + answer = false; + } + return answer; + } +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/NonOpTextFilter.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/NonOpTextFilter.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/NonOpTextFilter.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/NonOpTextFilter.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,24 @@ +/* +* 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.util; + +import org.apache.abdera.filter.TextFilter; + +public class NonOpTextFilter extends TextFilter { + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ServiceUtil.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ServiceUtil.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ServiceUtil.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ServiceUtil.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,155 @@ +/* +* 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.util; + +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; + +import org.apache.abdera.factory.ExtensionFactory; +import org.apache.abdera.factory.Factory; +import org.apache.abdera.parser.Parser; +import org.apache.abdera.xpath.XPath; + + +/** + * @author James M Snell (jasnell@us.ibm.com) + */ +public final class ServiceUtil + implements Constants { + + ServiceUtil() {} + + static private ClassLoader classLoader = null; + + public static Object newInstance(String id, String _default) { + return ServiceUtil.locate(id, _default); + } + + public static XPath newXPathInstance() { + return (XPath) newInstance( + CONFIG_XPATH, + ConfigProperties.getDefaultXPath()); + } + + public static Parser newParserInstance() { + return (Parser) newInstance( + CONFIG_PARSER, + ConfigProperties.getDefaultParser()); + } + + public static Factory newFactoryInstance() { + return (Factory) newInstance( + CONFIG_FACTORY, + ConfigProperties.getDefaultFactory()); + } + + public static ClassLoader getClassLoader() { + if (classLoader == null) { + classLoader = Thread.currentThread().getContextClassLoader(); + } + return classLoader; + } + + public static void setClassLoader(ClassLoader classLoader) { + ServiceUtil.classLoader = classLoader; + } + + public static Object locate(String id, String _default) { + Object object = locate(id); + if (object == null && _default != null) { + try { + object = getClassLoader().loadClass(_default).newInstance(); + } catch (Exception e) {} + } + return object; + } + + public static Object locate(String id) { + Object service = checkConfigProperties(id); + return ((service != null) ? service : checkMetaInfServices(id)); + } + + static Object checkConfigProperties(String id) { + Object object = null; + String s = ConfigProperties.getConfigurationOption(id); + if (s != null) { + try { + object = getClassLoader().loadClass(s).newInstance(); + } catch (Exception e) {} + } + return object; + } + + static Object checkMetaInfServices(String id) { + Object object = null; + String sid = "META-INF/services/" + id; + ClassLoader loader = getClassLoader(); + try { + InputStream is = loader.getResourceAsStream(sid); + if (is != null) { + BufferedReader buf = new BufferedReader(new InputStreamReader(is)); + String line = buf.readLine(); + if (line != null) { + String s = line.split("#",2)[0].trim(); + object = loader.loadClass(s).newInstance(); + } + } + } catch (Exception e) {} + return object; + } + + private static List factories = null; + + public static List loadExtensionFactories(String id) { + if (factories == null) { + factories = new ArrayList(); + String sid = "META-INF/services/" + id; + ClassLoader loader = getClassLoader(); + try { + Enumeration e = loader.getResources(sid); + for (;e.hasMoreElements();) { + try { + URL url = (URL) e.nextElement(); + InputStream is = url.openStream(); + if (is != null) { + BufferedReader buf = + new BufferedReader( + new InputStreamReader(is)); + String line = null; + while ((line = buf.readLine()) != null) { + String s = line.split("#",2)[0].trim(); + if (!"".equals(s)) { + ExtensionFactory factory = + (ExtensionFactory) loader.loadClass(s).newInstance(); + factories.add(factory); + } + } + } + } catch (Exception ex) {} + } + } catch (Exception e) {} + } + return factories; + } + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ThreadHelper.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ThreadHelper.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ThreadHelper.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/ThreadHelper.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,63 @@ +/* +* 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.util; + +import java.util.Calendar; +import java.util.Date; + +import org.apache.abdera.model.AtomDate; +import org.apache.abdera.model.Link; + + +public final class ThreadHelper { + + ThreadHelper() {} + + public static int getCount(Link link) { + String val = link.getAttributeValue(Constants.THRCOUNT); + return (val != null) ? Integer.parseInt(val) : 0; + } + + @SuppressWarnings("deprecation") + public static AtomDate getUpdated(Link link) { + String val = link.getAttributeValue(Constants.THRUPDATED); + if (val == null) // thr:when was updated to thr:updated, some old impls may still be using thr:when + val = link.getAttributeValue(Constants.THRWHEN); + return (val != null) ? AtomDate.valueOf(val) : null; + } + + public void setCount(Link link, int count) { + link.setAttributeValue(Constants.THRCOUNT, String.valueOf(count).trim()); + } + + public void setUpdated(Link link, Date when) { + link.setAttributeValue(Constants.THRUPDATED, AtomDate.valueOf(when).getValue()); + } + + public void setUpdated(Link link, Calendar when) { + link.setAttributeValue(Constants.THRUPDATED, AtomDate.valueOf(when).getValue()); + } + + public void setUpdated(Link link, long when) { + link.setAttributeValue(Constants.THRUPDATED, AtomDate.valueOf(when).getValue()); + } + + public void setUpdated(Link link, String when) { + link.setAttributeValue(Constants.THRUPDATED, AtomDate.valueOf(when).getValue()); + } +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/URIHelper.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/URIHelper.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/URIHelper.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/URIHelper.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,56 @@ +/* +* 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.util; + +import java.net.URI; +import java.net.URISyntaxException; + +public class URIHelper { + + /** + * Normalize a URI as specified by RFC4287 Section 4.2.6 + */ + public static URI normalize( + URI uri) + throws URISyntaxException { + if (uri == null) return null; + // the normalization built into the URI class only gets us part of the way + uri = uri.normalize(); + String scheme = uri.getScheme().toLowerCase(); + String host = + (uri.getHost() != null) ? + uri.getHost().toLowerCase() : ""; + int port = -1; + if ("http".equalsIgnoreCase(scheme) && uri.getPort() != 80) + port = uri.getPort(); + else if ("https".equalsIgnoreCase(scheme) && uri.getPort() != 443) + port = uri.getPort(); + uri = new URI( + scheme, + uri.getUserInfo(), + host, port, + uri.getPath(), + uri.getQuery(), + uri.getFragment()); + return uri; + } + + public static String normalize(String uri) throws URISyntaxException { + return normalize(new URI(uri)).toString(); + } +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Version.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Version.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Version.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/Version.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,28 @@ +/* +* 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.util; + +/** + * @author James M Snell (jasnell@us.ibm.com) + */ +public abstract interface Version { + + public static final String APP_NAME = "Abdera"; + public static final String VERSION = "v0.1"; + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/WhiteListParseFilter.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/WhiteListParseFilter.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/WhiteListParseFilter.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/util/WhiteListParseFilter.java Fri Jun 16 13:10:47 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.util; + +import javax.xml.namespace.QName; + +import org.apache.abdera.filter.ParseFilter; + +/** + * WhiteList Implementation of ParseFilter. Only the + * QNames listed will be considered acceptable + */ +public class WhiteListParseFilter extends ParseFilter { + + boolean listAttributesExplicitly = false; + + public WhiteListParseFilter() {} + + public WhiteListParseFilter(boolean listAttributesExplicitly) { + this.listAttributesExplicitly = listAttributesExplicitly; + } + + public boolean acceptable(QName qname) { + return contains(qname); + } + + public boolean acceptableAttribute(QName qname, QName attribute) { + return (listAttributesExplicitly) ? + containsAttribute(qname, attribute) : + containsAttribute(qname, attribute) || acceptable(qname); + } + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/xpath/XPath.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/xpath/XPath.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/xpath/XPath.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/xpath/XPath.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,93 @@ +/* +* 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.xpath; + +import java.util.List; +import java.util.Map; + +import org.apache.abdera.model.Base; +import org.apache.abdera.util.ServiceUtil; + +/** + * Used to execute XPath queries over Feed Object Model instances. + */ +public interface XPath { + + public static final XPath INSTANCE = ServiceUtil.newXPathInstance(); + + Map getDefaultNamespaces(); + + void setDefaultNamespaces(Map namespaces); + + List selectNodes( + String path, + Base base) throws XPathException; + + Object selectSingleNode( + String path, + Base base) throws XPathException; + + Object evaluate( + String path, + Base base) throws XPathException; + + String valueOf( + String path, + Base base) throws XPathException; + + boolean isTrue( + String path, + Base base) throws XPathException; + + Number numericValueOf( + String path, + Base base) + throws XPathException; + + List selectNodes( + String path, + Base base, + Map namespaces) throws XPathException; + + Object selectSingleNode( + String path, + Base base, + Map namespaces) throws XPathException; + + Object evaluate( + String path, + Base base, + Map namespaces) throws XPathException; + + String valueOf( + String path, + Base base, + Map namespaces) throws XPathException; + + boolean isTrue( + String path, + Base base, + Map namespaces) throws XPathException; + + Number numericValueOf( + String path, + Base base, + Map namespaces) + throws XPathException; + +} Added: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/xpath/XPathException.java URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/xpath/XPathException.java?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/xpath/XPathException.java (added) +++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/xpath/XPathException.java Fri Jun 16 13:10:47 2006 @@ -0,0 +1,40 @@ +/* +* 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.xpath; + +public class XPathException extends Exception { + + private static final long serialVersionUID = 7373747391262088925L; + + public XPathException() { + super(); + } + + public XPathException(String message, Throwable cause) { + super(message, cause); + } + + public XPathException(String message) { + super(message); + } + + public XPathException(Throwable cause) { + super(cause); + } + +} Added: incubator/abdera/java/trunk/core/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory.example URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory.example?rev=414893&view=auto ============================================================================== --- incubator/abdera/java/trunk/core/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory.example (added) +++ incubator/abdera/java/trunk/core/src/main/resources/META-INF/services/org.apache.abdera.factory.ExtensionFactory.example Fri Jun 16 13:10:47 2006 @@ -0,0 +1,5 @@ +# To register Extension factories, rename this file to +# org.apache.abdera.factory.ExtensionFactory and list +# each of the Extension Factories below (as illustrated) +com.foo.factories.MyExtensionFactory +com.foo.factories.MyOtherExtensionFactory \ No newline at end of file