abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1173209 [17/49] - in /abdera/abdera2: ./ .settings/ activities/ activities/src/ activities/src/main/ activities/src/main/java/ activities/src/main/java/org/ activities/src/main/java/org/apache/ activities/src/main/java/org/apache/abdera2/ ...
Date Tue, 20 Sep 2011 15:57:20 GMT
Added: abdera/abdera2/core/pom.xml
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/pom.xml?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/pom.xml (added)
+++ abdera/abdera2/core/pom.xml Tue Sep 20 15:56:46 2011
@@ -0,0 +1,90 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" 
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.abdera2</groupId>
+    <artifactId>abdera2</artifactId>
+    <version>2.0-SNAPSHOT</version>  
+  </parent>
+  
+  <artifactId>abdera2-core</artifactId>
+  <packaging>bundle</packaging>
+  <name>Abdera2 Core</name>
+  <version>2.0-SNAPSHOT</version>  
+  <description>Atom Specification Implementation Core</description>
+  
+  <properties>
+    <topDir>${basedir}/..</topDir>
+    <!-- 
+    <abdera.osgi.default.exports>
+    org.apache.abdera2;
+    org.apache.abdera2.extra.*;
+    org.apache.abdera2.factory.*;
+    org.apache.abdera2.model.*;
+    org.apache.abdera2.model.selector.*;
+    org.apache.abdera2.parser.*;
+    org.apache.abdera2.parser.axiom.*;
+    org.apache.abdera2.parser.filter.*;
+    org.apache.abdera2.protocol;
+    org.apache.abdera2.protocol.error.*;
+    org.apache.abdera2.util.*;
+    org.apache.abdera2.writer.*;
+    org.apache.abdera2.xpath.*
+  </abdera.osgi.default.exports>
+    <abdera.osgi.default.imports>
+      org.apache.commons.codec*;version="[1.5,2)",
+      *
+    </abdera.osgi.default.imports>
+    -->
+  </properties>
+  
+  <dependencies>
+
+    <dependency>
+      <groupId>org.apache.abdera2</groupId>
+      <artifactId>abdera2-common</artifactId>
+      <version>2.0-SNAPSHOT</version>  
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.ws.commons.axiom</groupId>
+      <artifactId>axiom-impl</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-activation_1.1_spec</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+    </dependency>
+
+  </dependencies>
+  
+</project>

Propchange: abdera/abdera2/core/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/Abdera.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/Abdera.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/Abdera.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/Abdera.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,221 @@
+/*
+ * 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.abdera2;
+
+import org.apache.abdera2.common.Discover;
+import org.apache.abdera2.common.anno.Version;
+import org.apache.abdera2.factory.Factory;
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Categories;
+import org.apache.abdera2.model.Entry;
+import org.apache.abdera2.model.Feed;
+import org.apache.abdera2.model.Service;
+import org.apache.abdera2.parser.Parser;
+import org.apache.abdera2.parser.ParserFactory;
+import org.apache.abdera2.protocol.error.ErrorExtensionFactory;
+import org.apache.abdera2.util.AbderaConfiguration;
+import org.apache.abdera2.util.Configuration;
+import org.apache.abdera2.writer.Writer;
+import org.apache.abdera2.writer.WriterFactory;
+import org.apache.abdera2.xpath.XPath;
+
+/**
+ * The top level entry point for Abdera that provides access to various subcomponents. Upon creation, this class will
+ * attempt to create singleton instances of each of the various subcomponents components. These instances may be
+ * retrieved using the appropriate get___ methods. Alternatively, new instances may be created using the appropriate
+ * new___ methods. Instances of the Abdera object, and it's direct children (Parser, Factory, XPath, etc) are
+ * Threadsafe. Because of the dynamic configuration model Abdera uses, creating a new instance of the Abdera object can
+ * be time consuming. It is, therefore, a good idea for applications to create only a single static instance of the
+ * Abdera object (see the Abdera.getInstance() method). Abdera's configuration model depends heavily on the context
+ * classloader. Extension Factories, custom writers, custom parsers, etc are all discovered automatically by searching
+ * the classpath. This means that care needs to be taken when using Abdera in environments that utilize multiple
+ * classloaders (such as Web application servers).
+ */
+@Version(value="v2.0-SNAPSHOT",
+         name="Abdera",
+         uri="http://abdera.apache.org")
+public class Abdera {
+
+    /** A static instance of Abdera **/
+    private static Abdera instance;
+
+    /**
+     * Get a static instance of the Abdera object.
+     */
+    public static synchronized Abdera getInstance() {
+        if (instance == null)
+            instance = new Abdera();
+        return instance;
+    }
+    
+    private final Configuration config;
+    private final Factory factory;
+    private final Parser parser;
+    private final XPath xpath;
+    private final ParserFactory parserFactory;
+    private final WriterFactory writerFactory;
+    private final Writer writer;
+
+    private Abdera() {
+        this(null);
+    }
+
+    /**
+     * Init the configuration. This will search the classpath for
+     * a configured Configuration instance or will use the 
+     * default AbderaConfiguration. 
+     */
+    private static Configuration initConfig(Abdera abdera) {
+      return Discover.locate(
+        Configuration.class, 
+        AbderaConfiguration.class.getName(), abdera);
+    }
+    
+    /**
+     * Initialize using the specified Abdera Configuration
+     * 
+     * @param config The Abdera Configuration to use
+     */
+    public Abdera(Configuration config) {
+        this.config = config!=null?config:initConfig(this);
+        factory = create(Factory.class);
+        xpath = create(XPath.class);
+        parserFactory = create(ParserFactory.class);
+        writerFactory = create(WriterFactory.class);
+        writer = create(Writer.class);
+        parser = create(Parser.class);
+    }
+
+    public org.apache.abdera2.protocol.error.Error newError() {
+      return getFactory().newExtensionElement(ErrorExtensionFactory.ERROR);
+    }
+    
+    /**
+     * Create a new Feed instance. This is a convenience shortcut for <code>abdera.getFactory().newFeed()</code>
+     * 
+     * @return A newly created feed element
+     */
+    public Feed newFeed() {
+        return getFactory().newFeed();
+    }
+
+    /**
+     * Create a new Entry instance. This is a convenience shortcut for <code>abdera.getFactory().newEntry()</code>
+     * 
+     * @return A newly created entry element
+     */
+    public Entry newEntry() {
+        return getFactory().newEntry();
+    }
+
+    /**
+     * Create a new Service instance. This is a convenience shortcut for <code>abdera.getFactory().newService()</code>
+     * 
+     * @return A newly created service element
+     */
+    public Service newService() {
+        return getFactory().newService();
+    }
+
+    /**
+     * Create a new Categories instance. This is a convenience shortcut for
+     * <code>abdera.getFactory().newCategories()</code>
+     * 
+     * @return A newly created categories element
+     */
+    public Categories newCategories() {
+        return getFactory().newCategories();
+    }
+    
+    /**
+     * Return the Abdera Configuration used to initialize this instance
+     * 
+     * @return The Abdera configuration
+     */
+    public Configuration getConfiguration() {
+        return config;
+    }
+
+    /**
+     * Return the singleton instance of org.apache.abdera.factory.Factory
+     * 
+     * @return The factory instance
+     */
+    public Factory getFactory() {
+        return factory;
+    }
+
+    /**
+     * Return the singleton instance of org.apache.abdera.parser.Parser
+     * 
+     * @return The parser instance
+     */
+    public Parser getParser() {
+        return parser;
+    }
+
+    /**
+     * Return the singleton instance of org.apache.abdera.xpath.XPath
+     * 
+     * @return The XPath instance
+     */
+    public XPath getXPath() {
+        return xpath;
+    }
+
+    /**
+     * Return the singleton instance of org.apache.abdera.parser.ParserFactory. The Parser Factory is used to acquire
+     * alternative parser implementation instances.
+     * 
+     * @return The ParserFactory instance
+     */
+    public ParserFactory getParserFactory() {
+        return parserFactory;
+    }
+
+    /**
+     * Return the singleton instance of org.apache.abdera.writer.WriterFactory. The Writer Factory is used to acquire
+     * alternative writer implementation instances.
+     * 
+     * @return The WriterFactory instance
+     */
+    public WriterFactory getWriterFactory() {
+        return writerFactory;
+    }
+
+    /**
+     * Return the singleton instance of the default org.apache.abdera.writer.Writer implementation.
+     * 
+     * @return The default writer implementation
+     */
+    public Writer getWriter() {
+        return writer;
+    }
+
+    /**
+     * Create an instance of the specified object using the Abdera Configuration
+     */
+    @SuppressWarnings("unchecked")
+    public <T>T create(Class<T> _class) {
+      if (Base.class.isAssignableFrom(_class)) {
+        return (T)getFactory().newElement(_class);
+      } else 
+        return config.newInstance(this, _class);
+    }
+    
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/Abdera.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaDataSource.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaDataSource.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaDataSource.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaDataSource.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,73 @@
+/*
+ * 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.abdera2.extra;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Element.Helper;
+
+/**
+ * Utility implementation of javax.activation.DataSource that wraps Abdera Base
+ */
+public final class AbderaDataSource implements DataSource {
+
+    private final byte[] data;
+    private final String mimetype;
+    private final String name;
+
+    public AbderaDataSource(Base base) {
+        this.data = read(base);
+        this.mimetype = Helper.getMimeType(base);
+        this.name = base.getClass().getName();
+    }
+
+    private byte[] read(Base base) {
+        byte[] data = null;
+        try {
+            ByteArrayOutputStream out = new ByteArrayOutputStream();
+            base.writeTo(out);
+            data = out.toByteArray();
+        } catch (IOException e) {
+        }
+        return data;
+    }
+
+    public String getContentType() {
+        return mimetype;
+    }
+
+    public InputStream getInputStream() throws IOException {
+        return new ByteArrayInputStream(data);
+    }
+
+    public String getName() {
+        return "Abdera Data Source::" + name;
+    }
+
+    public OutputStream getOutputStream() throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaDataSource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaResult.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaResult.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaResult.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaResult.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,82 @@
+/*
+ * 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.abdera2.extra;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+
+/**
+ * Provides a simple (and likely somewhat inefficient) implementation of javax.xml.transform.Result that allows Abdera
+ * objects to be used with the javax.xml.transform API's Only use this once per transform!!!
+ */
+public final class AbderaResult extends StreamResult implements Result {
+
+  private final Abdera abdera;
+  private final ByteArrayOutputStream out = 
+    new ByteArrayOutputStream();
+  private Document<?> doc;
+
+  public AbderaResult() {
+      this(Abdera.getInstance());
+  }
+
+  public AbderaResult(Abdera abdera) {
+      this.abdera = abdera;
+  }
+
+  @SuppressWarnings("unchecked")
+  public <T extends Element> Document<T> getDocument() {
+      if (doc == null) {
+          ByteArrayInputStream in = 
+            new ByteArrayInputStream(out.toByteArray());
+          doc = abdera.getParser().parse(in);
+      }
+      return (Document<T>)doc;
+  }
+
+  @Override
+  public OutputStream getOutputStream() {
+      return out;
+  }
+
+  @Override
+  public Writer getWriter() {
+      return new OutputStreamWriter(getOutputStream());
+  }
+
+  @Override
+  public void setOutputStream(OutputStream out) {
+      throw new UnsupportedOperationException();
+  }
+
+  @Override
+  public void setWriter(Writer out) {
+      throw new UnsupportedOperationException();
+  }
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaResult.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaSource.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaSource.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaSource.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaSource.java Tue Sep 20 15:56:46 2011
@@ -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.abdera2.extra;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.apache.abdera2.model.Base;
+
+/**
+ * Provides a simple (and likely somewhat inefficient) implementation of javax.xml.transform.Source that allows Abdera
+ * objects to be used with the javax.xml.transform API's
+ */
+public final class AbderaSource 
+  extends StreamSource 
+  implements Source {
+
+    private final byte[] buffer;
+
+    public AbderaSource(Base base) {
+        this.buffer = read(base);
+    }
+    
+    private byte[] read(Base base) {
+      byte[] data = null;
+      try {
+          ByteArrayOutputStream out = 
+            new ByteArrayOutputStream();
+          base.writeTo(out);
+          data = out.toByteArray();
+      } catch (IOException e) {
+      }
+      return data;
+    }
+
+    @Override
+    public InputStream getInputStream() {
+        // JIRA: https://issues.apache.org/jira/browse/ABDERA-235
+        return new ByteArrayInputStream(buffer);
+    }
+
+    @Override
+    public Reader getReader() {
+        return new InputStreamReader(getInputStream());
+    }
+
+    @Override
+    public void setInputStream(InputStream in) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setReader(Reader reader) {
+        throw new UnsupportedOperationException();
+    }
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/AbderaSource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/InputStreamDataSource.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/InputStreamDataSource.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/InputStreamDataSource.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/InputStreamDataSource.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,58 @@
+/*
+ * 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.abdera2.extra;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.activation.DataSource;
+
+public final class InputStreamDataSource implements DataSource {
+
+    public static final String DEFAULT_TYPE = "application/octet-stream";
+
+    private final InputStream in;
+    private final String ctype;
+
+    public InputStreamDataSource(InputStream in) {
+        this(in, null);
+    }
+
+    public InputStreamDataSource(InputStream in, String ctype) {
+        this.in = in;
+        this.ctype = (ctype != null) ? ctype : DEFAULT_TYPE;
+    }
+
+    public String getContentType() {
+        return ctype;
+    }
+
+    public String getName() {
+        return null;
+    }
+
+    public InputStream getInputStream() throws IOException {
+        return in;
+    }
+
+    public OutputStream getOutputStream() throws IOException {
+        return null;
+    }
+
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/extra/InputStreamDataSource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/AbstractExtensionFactory.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/AbstractExtensionFactory.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/AbstractExtensionFactory.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/AbstractExtensionFactory.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,280 @@
+/*
+ * 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.abdera2.factory;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.common.anno.AnnoUtil;
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.model.ElementWrapper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * <p>
+ * Provides a base implementation for ExtensionFactory instances. By extending this, specific extension factories need
+ * only to associate a QName with an implementation class, e.g.,
+ * </p>
+ * 
+ * <pre>
+ *  public class MyExtensionFactory
+ *    extends AbstractExtensionFactory {
+ * 
+ *    private String NS = "http://example.org/foo/ns"; 
+ *    private QName FOO = new QName(NS, "foo");
+ * 
+ *    public MyExtensionFactory() {
+ *      super(NS);
+ *      addImpl(FOO, Foo.class);
+ *    }
+ *  }
+ *  
+ *  public class Foo extends ElementWrapper { ... }
+ * </pre>
+ * 
+ * <p>As an alternative to manually calling the addImpl method to register 
+ * implementation classes, Annotations can be used by subclasses of the 
+ * AbstractExtensionFactory class.</p>
+ * 
+ * <pre>@Namespace({"http://example.org/foo/ns"})
+ @Impls({@Impl(Foo.class)})
+ public final class MyExtensionFactory 
+ extends AbstractExtensionFactory {}
+ <br />
+@QName(value="foo", ns="http://example.org/foo/ns")
+public class Foo extends ElementWrapper { ... }
+</pre>
+ * 
+ */
+public abstract class AbstractExtensionFactory 
+    implements ExtensionFactory {
+
+    private final static Log log = LogFactory.getLog(AbstractExtensionFactory.class);
+  
+    /** The set of namespaces supported by this factory **/
+    private final Set<String> namespaces = new HashSet<String>();
+    
+    /** A mapping of QNames to MimeTypes. **/
+    private final Map<QName, String> mimetypes = new HashMap<QName, String>();
+    
+    /** The mapping of QNames to implementation classes **/
+    private final Map<QName, Constructor<? extends ElementWrapper>> impls =
+        new HashMap<QName, Constructor<? extends ElementWrapper>>();
+
+    /**
+     * The default constructor will automatically search the subclass
+     * declaration for the appropriate Namespace and Impls annotations.
+     */
+    protected AbstractExtensionFactory() {
+      this.namespaces.addAll(AnnoUtil.getNamespaces(this));
+      addImpls(this,impls);
+    }
+    
+    /**
+     * Constructor that first calls the default no-arg constructor then
+     * appends the additional zero or more namespaces.
+     */
+    protected AbstractExtensionFactory(String... namespaces) {
+        this();
+        for (String ns : namespaces)
+            this.namespaces.add(ns);
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T extends Element> T getElementWrapper(Element internal) {
+        T t = null;
+        QName qname = internal.getQName();
+        Constructor<? extends ElementWrapper> con = impls.get(qname);        
+        if (con != null) {
+          try {
+            t = (T)con.newInstance(new Object[] {internal});
+          } catch (Throwable e) {}
+        }
+        return t != null ? t : (T)internal;
+    }
+
+    /**
+     * Associate a MIME media type for the specific QName
+     */
+    protected AbstractExtensionFactory addMimeType(QName qname, String mimetype) {
+        mimetypes.put(qname, mimetype);
+        return this;
+    }
+
+    /**
+     * Add the class to the implementation map. The QName annotation MUST
+     * be set to provide the QName for the class or the method will fail 
+     * with an IllegalArgumentException.
+     */
+    protected AbstractExtensionFactory addImpl(Class<? extends ElementWrapper> impl) {
+      QName qname = AnnoUtil.getQName(impl);
+      if (qname == null)
+        throw new IllegalArgumentException();
+      addImpl(qname,impl);
+      return this;
+    }
+    
+    /**
+     * Associate a QName with an implementation class. This version of the
+     * method ignores the QName annotation and uses the provided qname
+     */
+    protected AbstractExtensionFactory addImpl(QName qname, Class<? extends ElementWrapper> impl) {
+        if (qname == null || impl == null)
+          throw new IllegalArgumentException();
+        log.debug(String.format("Adding implementation for [%s] : %s",qname.toString(),impl));
+        Constructor<? extends ElementWrapper> con = constructor(impl);
+        if (con == null) {
+          log.debug("An appropriate ElementWrapper constructor could not be found");
+          throw new IllegalArgumentException("Missing Element Wrapper Constructor.");
+        }
+        impls.put(qname, con);
+        return this;
+    }
+   
+    public <T extends Base> String getMimeType(T base) {
+        Element element =
+            base instanceof Element ? 
+              (Element)base : 
+              base instanceof Document ? 
+                  ((Document<?>)base).getRoot() : 
+                  null;
+        QName qname = element != null ? element.getQName() : null;
+        return element != null && qname != null ? mimetypes.get(qname) : null;
+    }
+
+    public Iterable<String> getNamespaces() {
+        return namespaces;
+    }
+
+    public boolean handlesNamespace(String namespace) {
+        return namespaces.contains(namespace);
+    }
+
+    private static void addImpls(Object obj, Map<QName, Constructor<? extends ElementWrapper>> map) {
+      if (obj == null) return;
+      Class<?> _class = obj instanceof Class ? (Class<?>)obj : obj.getClass();
+      if (_class.isAnnotationPresent(Impls.class)) {
+        log.debug("@Impls annotation found... processing");
+        Impls impls = _class.getAnnotation(Impls.class);
+        Impl[] imps = impls.value();
+        for (Impl impl : imps) {
+          log.debug(String.format("Processing >> %s",impl.value().getName()));
+          QName qname = AnnoUtil.qNameFromAnno(impl.qname());
+          Class<? extends ElementWrapper> _impl = impl.value();
+          if (qname == null) {
+            if (_impl.isAnnotationPresent(org.apache.abdera2.common.anno.QName.class)) {
+              org.apache.abdera2.common.anno.QName qn = 
+                _impl.getAnnotation(org.apache.abdera2.common.anno.QName.class);
+              qname = AnnoUtil.qNameFromAnno(qn);
+            }
+          }
+          if (qname != null) {
+            log.debug(String.format("  Discovered QName: %s", qname.toString()));
+            Constructor<? extends ElementWrapper> con = 
+              constructor(_impl);
+            if (con != null) {
+              map.put(qname,con);
+            } else log.debug("  An appropriate ElementWrapper constructor could not be found! Ignoring implementation class");
+          } else log.debug("  A QName could not be found. Ignoring implementation class");
+        }
+      }
+    }
+    
+    private static Constructor<? extends ElementWrapper> constructor(Class<? extends ElementWrapper> _class) {
+      try {
+        return _class.getConstructor(new Class[] {Element.class});
+      } catch (Throwable t) {
+        log.error("Error retrieving constructor...",t);
+        return null;
+      }
+    }
+    
+    @Override
+    public int hashCode() {
+      final int prime = 31;
+      int result = 1;
+      result = prime * result + ((impls == null) ? 0 : impls.hashCode());
+      result = prime * result
+          + ((mimetypes == null) ? 0 : mimetypes.hashCode());
+      result = prime * result
+          + ((namespaces == null) ? 0 : namespaces.hashCode());
+      return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+      if (this == obj)
+        return true;
+      if (obj == null)
+        return false;
+      if (getClass() != obj.getClass())
+        return false;
+      AbstractExtensionFactory other = (AbstractExtensionFactory) obj;
+      if (impls == null) {
+        if (other.impls != null)
+          return false;
+      } else if (!impls.equals(other.impls))
+        return false;
+      if (mimetypes == null) {
+        if (other.mimetypes != null)
+          return false;
+      } else if (!mimetypes.equals(other.mimetypes))
+        return false;
+      if (namespaces == null) {
+        if (other.namespaces != null)
+          return false;
+      } else if (!namespaces.equals(other.namespaces))
+        return false;
+      return true;
+    }
+
+
+
+    /**
+     * Specifies a mapping between a QName and an implementation class
+     */
+    @Retention(RUNTIME)
+    @Target( {TYPE})
+    public static @interface Impl {
+      org.apache.abdera2.common.anno.QName qname() 
+        default @org.apache.abdera2.common.anno.QName("");
+      Class<? extends ElementWrapper> value();
+    }
+
+    /**
+     * A collection of Impl annotation
+     */
+    @Retention(RUNTIME)
+    @Target({TYPE})
+    public static @interface Impls {
+      Impl[] value();
+    }
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/AbstractExtensionFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactory.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactory.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactory.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactory.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,80 @@
+/*
+ * 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.abdera2.factory;
+
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Element;
+
+/**
+ * <p>
+ * Extension Factories are used to provide a means of dynamically resolving builders for namespaced extension elements
+ * </p>
+ * <p>
+ * There are four ways of supporting extension elements.
+ * </p>
+ * <ol>
+ * <li>Implement your own Factory (hard)</li>
+ * <li>Subclass the default Axiom-based Factory (also somewhat difficult)</li>
+ * <li>Implement and register an ExtensionFactory (wonderfully simple)</li>
+ * <li>Use the Feed Object Model's dynamic support for extensions (also very simple)</li>
+ * </ol>
+ * <p>
+ * Registering an Extension Factory requires generally nothing more than implementing ExtensionFactory and then creating
+ * a file called META-INF/services/org.apache.abdera.factory.ExtensionFactory and listing the class names of each
+ * ExtensionFactory you wish to register.
+ * </p>
+ * <p>
+ * ExtensionFactory implementations are assumed to be threadsafe
+ * </p>
+ */
+public interface ExtensionFactory {
+
+    /**
+     * Returns true if this extension factory handles the specified namespace
+     * 
+     * @param namespace The XML namespace of the extension
+     * @return True if the namespace is supported by the ExtensionFactory
+     */
+    boolean handlesNamespace(String namespace);
+
+    /**
+     * Returns the Namespace URIs handled by this Extension Factory
+     * 
+     * @return A List of Namespace URIs Supported by this Extension
+     */
+    Iterable<String> getNamespaces();
+
+    /**
+     * Abdera's support for static extensions is based on a simple delegation model. Static extension interfaces wrap
+     * the dynamic extension API. ExtensionFactory's are handed an internal dynamic element instance and are expected
+     * to hand back a static object wrapper allowing Abdera to decouple extensions from the underlying parser and 
+     * internal data model implementation.
+     * 
+     * @param internal The Abdera element that needs to be wrapped
+     * @return The wrapper element
+     */
+    <T extends Element> T getElementWrapper(Element internal);
+
+    /**
+     * Retrieve the mime type for the element
+     * 
+     * @param base An Abdera object
+     * @return A MIME media type for the object
+     */
+    <T extends Base> String getMimeType(T base);
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactoryMap.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactoryMap.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactoryMap.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactoryMap.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,94 @@
+/*
+ * 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.abdera2.factory;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+
+/**
+ * A utility implementation of ExtensionFactory used internally by Abdera. It maintains the collection ExtensionFactory
+ * instances discovered on the classpath and a cache of Internal-Wrapper mappings.
+ */
+public class ExtensionFactoryMap 
+  implements ExtensionFactory, Iterable<ExtensionFactory> {
+
+    private final Set<ExtensionFactory> factories = 
+      new HashSet<ExtensionFactory>();
+    
+    private final Set<String> namespaces = 
+      new HashSet<String>();
+    
+    public ExtensionFactoryMap(Iterable<ExtensionFactory> factories) {
+      for (ExtensionFactory factory : factories) {
+        addFactory(factory);
+      }
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T extends Element> T getElementWrapper(Element internal) {
+        if (internal == null)
+            return null;
+        T t = null;
+        QName qname = internal.getQName();
+        String ns = qname.getNamespaceURI();
+        for (ExtensionFactory factory : factories) {
+            if (ns == null || factory.handlesNamespace(ns)) {
+              t = (T)factory.getElementWrapper(internal);
+              if (t != null && t != internal)
+                  return t;
+            }
+        }
+        return (t != null) ? t : (T)internal;
+    }
+
+    public Iterable<String> getNamespaces() {
+        return namespaces;
+    }
+
+    public boolean handlesNamespace(String namespace) {
+        return namespaces.contains(namespace);
+    }
+
+    public ExtensionFactoryMap addFactory(ExtensionFactory factory) {
+        factories.add(factory);
+        for (String ns : factory.getNamespaces())
+          namespaces.add(ns);
+        return this;
+    }
+
+    public <T extends Base> String getMimeType(T base) {
+        Element element = base instanceof Element ? (Element)base : ((Document<?>)base).getRoot();
+        String namespace = element.getQName().getNamespaceURI();
+        for (ExtensionFactory factory : factories) {
+            if (factory.handlesNamespace(namespace))
+                return factory.getMimeType(base);
+        }
+        return null;
+    }
+
+    public Iterator<ExtensionFactory> iterator() {
+      return factories.iterator();
+    }
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/ExtensionFactoryMap.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/Factory.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/Factory.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/Factory.java (added)
+++ abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/Factory.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,747 @@
+/*
+ * 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.abdera2.factory;
+
+import javax.activation.MimeType;
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.Abdera;
+import org.apache.abdera2.common.anno.DefaultImplementation;
+import org.apache.abdera2.model.Base;
+import org.apache.abdera2.model.Categories;
+import org.apache.abdera2.model.Category;
+import org.apache.abdera2.model.Collection;
+import org.apache.abdera2.model.Content;
+import org.apache.abdera2.model.Control;
+import org.apache.abdera2.model.DateTime;
+import org.apache.abdera2.model.Div;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.model.Entry;
+import org.apache.abdera2.model.Feed;
+import org.apache.abdera2.model.Generator;
+import org.apache.abdera2.model.IRIElement;
+import org.apache.abdera2.model.Link;
+import org.apache.abdera2.model.Person;
+import org.apache.abdera2.model.Service;
+import org.apache.abdera2.model.Source;
+import org.apache.abdera2.model.Text;
+import org.apache.abdera2.model.Workspace;
+import org.apache.abdera2.parser.Parser;
+
+/**
+ * The Factory interface is the primary means by which Feed Object Model instances are built. Factories are specific to
+ * parser implementations. Users will generally not have to know anything about the Factory implementation, which will
+ * be automatically selected based on the Abdera configuration options.
+ */
+@DefaultImplementation("org.apache.abdera2.parser.axiom.FOMFactory")
+public interface Factory {
+
+    /**
+     * Create a new Parser instance.
+     * 
+     * @return A new instance of the Parser associated with this Factory
+     */
+    Parser newParser();
+
+    /**
+     * Create a new Document instance with a root Element of type T.
+     * 
+     * @return A new instance of a Document
+     */
+    <T extends Element> Document<T> newDocument();
+
+    /**
+     * Create a new Service element.
+     * 
+     * @return A newly created Service element
+     */
+    Service newService();
+
+    /**
+     * Create a new Service element as a child of the given Base.
+     * 
+     * @param parent The element or document to which the new Service should be added as a child
+     * @return A newly created Service element
+     */
+    Service newService(Base parent);
+
+    /**
+     * Create a new Workspace element.
+     * 
+     * @return A newly created Workspace element
+     */
+    Workspace newWorkspace();
+
+    /**
+     * Create a new Workspace element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Workspace should be added as a child
+     * @return A newly created Workspace element
+     */
+    Workspace newWorkspace(Element parent);
+
+    /**
+     * Create a new Collection element.
+     * 
+     * @return A newly created Collection element
+     */
+    Collection newCollection();
+
+    /**
+     * Create a new Collection element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Collection should be added as a child
+     * @return A newly created Collection element
+     */
+    Collection newCollection(Element parent);
+
+    /**
+     * Create a new Feed element. A new Document containing the Feed will be created automatically
+     * 
+     * @return A newly created Feed element.
+     */
+    Feed newFeed();
+
+    /**
+     * Create a new Feed element as a child of the given Base.
+     * 
+     * @param parent The element or document to which the new Feed should be added as a child
+     * @return A newly created Feed element
+     */
+    Feed newFeed(Base parent);
+
+    /**
+     * Create a new Entry element. A new Document containing the Entry will be created automatically
+     * 
+     * @return A newly created Entry element
+     */
+    Entry newEntry();
+
+    /**
+     * Create a new Entry element as a child of the given Base.
+     * 
+     * @param parent The element or document to which the new Entry should be added as a child
+     * @return A newly created Entry element
+     */
+    Entry newEntry(Base parent);
+
+    /**
+     * Create a new Category element.
+     * 
+     * @return A newly created Category element
+     */
+    Category newCategory();
+
+    /**
+     * Create a new Category element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Category should be added as a child
+     * @return A newly created Category element
+     */
+    Category newCategory(Element parent);
+
+    /**
+     * Create a new Content element.
+     * 
+     * @return A newly created Content element with type="text"
+     */
+    Content newContent();
+
+    /**
+     * Create a new Content element of the given Content.Type.
+     * 
+     * @param type The Content.Type for the newly created Content element.
+     * @return A newly created Content element using the specified type
+     */
+    Content newContent(Content.Type type);
+
+    /**
+     * Create a new Content element of the given Content.Type as a child of the given Element.
+     * 
+     * @param type The Content.Type for the newly created Content element.
+     * @param parent The element to which the new Content should be added as a child
+     * @return A newly created Content element using the specified type
+     */
+    Content newContent(Content.Type type, Element parent);
+
+    /**
+     * Create a new Content element of the given MediaType.
+     * 
+     * @param mediaType The MIME media type to be specified by the type attribute
+     * @return A newly created Content element using the specified MIME type
+     */
+    Content newContent(MimeType mediaType);
+
+    /**
+     * Create a new Content element of the given MediaType as a child of the given Element.
+     * 
+     * @param mediaType The MIME media type to be specified by the type attribute
+     * @param parent The element to which the new Content should be added as a child
+     * @return A newly created Content element using the specified mediatype.
+     */
+    Content newContent(MimeType mediaType, Element parent);
+
+    /**
+     * Create a new published element.
+     * 
+     * @return A newly created atom:published element
+     */
+    DateTime newPublished();
+
+    /**
+     * Create a new published element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Published element should be added as a child
+     * @return A newly created atom:published element
+     */
+    DateTime newPublished(Element parent);
+
+    /**
+     * Create a new updated element.
+     * 
+     * @return A newly created atom:updated element
+     */
+    DateTime newUpdated();
+
+    /**
+     * create a new updated element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Updated element should be added as a child
+     * @return A newly created atom:updated element
+     */
+    DateTime newUpdated(Element parent);
+
+    /**
+     * Create a new app:edited element. The app:edited element is defined by the Atom Publishing Protocol specification
+     * for use in atom:entry elements created and edited using that protocol. The element should only ever appear as a
+     * child of atom:entry.
+     * 
+     * @return A newly created app:edited element
+     */
+    DateTime newEdited();
+
+    /**
+     * Create a new app:edited element. The app:edited element is defined by the Atom Publishing Protocol specification
+     * for use in atom:entry elements created and edited using that protocol. The element should only ever appear as a
+     * child of atom:entry.
+     * 
+     * @param parent The element to which the new Edited element should be added as a child
+     * @return A newly created app:edited element
+     */
+    DateTime newEdited(Element parent);
+
+    /**
+     * Create a new DateTime element with the given QName as a child of the given Element. RFC4287 provides the abstract
+     * Atom Date Construct as a reusable component. Any extension element whose value is a Date/Time SHOULD reuse this
+     * construct to maintain consistency with the base specification.
+     * 
+     * @param qname The XML QName of the Atom Date element to create
+     * @param parent The element to which the new Atom Date element should be added as a child
+     * @return The newly created Atom Date Construct element
+     */
+    DateTime newDateTime(QName qname, Element parent);
+
+    /**
+     * Create a new DateTime element with the given QName as a child of the given Element. RFC4287 provides the abstract
+     * Atom Date Construct as a reusable component. Any extension element whose value is a Date/Time SHOULD reuse this
+     * construct to maintain consistency with the base specification.
+     * 
+     * @param _class
+     * @param parent The element to which the new Atom Date element should be added as a child
+     * @return The newly created Atom Date Construct element
+     */
+    DateTime newDateTime(Class<?> _class, Element parent);
+    
+    /**
+     * Create a new Generator with Abdera's default name and version.
+     * 
+     * @return A newly created and pre-populated atom:generator element
+     */
+    Generator newDefaultGenerator();
+
+    /**
+     * Create a new Generator using Abdera's default name and version as a child of the given Element.
+     * 
+     * @param parent The element to which the new Generator element should be added as a child
+     * @return A newly created and pre-populated atom:generator element
+     */
+    Generator newDefaultGenerator(Element parent);
+
+    /**
+     * Create a new Generator element.
+     * 
+     * @return A newly created atom:generator element
+     */
+    Generator newGenerator();
+
+    /**
+     * Create a new Generator element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Generator element should be added as a child
+     * @return A newly creatd atom:generator element
+     */
+    Generator newGenerator(Element parent);
+
+    /**
+     * Create a new id element.
+     * 
+     * @return A newly created atom:id element
+     */
+    IRIElement newID();
+
+    /**
+     * Create a new id element as a child of the given Element.
+     * 
+     * @param parent The element to which the new ID element should be added as a child
+     * @return A newly created atom:id element
+     */
+    IRIElement newID(Element parent);
+
+    /**
+     * Create a new icon element.
+     * 
+     * @return A newly created atom:icon element
+     */
+    IRIElement newIcon();
+
+    /**
+     * Create a new icon element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Icon element should be added as a child
+     * @return A newly created atom:icon element
+     */
+    IRIElement newIcon(Element parent);
+
+    /**
+     * Create a new logo element.
+     * 
+     * @return A newly created atom:logo element
+     */
+    IRIElement newLogo();
+
+    /**
+     * Create a new logo element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Logo element should be added as a child
+     * @return A newly created atom:logo element
+     */
+    IRIElement newLogo(Element parent);
+
+    /**
+     * Create a new uri element.
+     * 
+     * @return A newly created atom:uri element
+     */
+    IRIElement newUri();
+
+    /**
+     * Create a new uri element as a child of the given Element.
+     * 
+     * @param parent The element to which the new URI element should be added as a child
+     * @return A newly created atom:uri element
+     */
+    IRIElement newUri(Element parent);
+
+    /**
+     * Create a new IRI element with the given QName as a child of the given Element.
+     * 
+     * @param qname The XML QName of the new IRI element
+     * @param parent The element to which the new generic IRI element should be added as a child
+     * @return A newly created element whose text value can be an IRI
+     */
+    IRIElement newIRIElement(QName qname, Element parent);
+
+    IRIElement newIRIElement(Class<?> _class, Element parent);
+    
+    /**
+     * Create a new Link element.
+     * 
+     * @return A newly created atom:link element
+     */
+    Link newLink();
+
+    /**
+     * Create a new Link element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Link element should be added as a child
+     * @return A newly created atom:uri element
+     */
+    Link newLink(Element parent);
+
+    /**
+     * Create a new author element.
+     * 
+     * @return A newly created atom:author element
+     */
+    Person newAuthor();
+
+    /**
+     * Create a new author element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Author element should be added as a child
+     * @return A newly created atom:author element
+     */
+    Person newAuthor(Element parent);
+
+    /**
+     * Create a new contributor element.
+     * 
+     * @return A newly created atom:contributor element
+     */
+    Person newContributor();
+
+    /**
+     * Create a new contributor element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Contributor element should be added as a child
+     * @return A newly created atom:contributor element
+     */
+    Person newContributor(Element parent);
+
+    /**
+     * Create a new Person element with the given QName as a child of the given Element. RFC4287 provides the abstract
+     * Atom Person Construct to represent people and other entities within an Atom Document. Extensions that wish to
+     * represent people SHOULD reuse this construct.
+     * 
+     * @param qname The XML QName of the newly created Person element
+     * @param parent The element to which the new Person element should be added as a child
+     * @return A newly created Atom Person Construct element
+     */
+    Person newPerson(QName qname, Element parent);
+
+    Person newPerson(Class<?> _class, Element parent);
+    
+    /**
+     * Create a new Source element.
+     * 
+     * @return A newly created atom:source element
+     */
+    Source newSource();
+
+    /**
+     * Create a new Source element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Source element should be added as a child
+     * @return A newly created atom:source element
+     */
+    Source newSource(Element parent);
+
+    /**
+     * Create a new Text element with the given QName and Text.Type. RFC4287 provides the abstract Text Construct to
+     * represent simple Text, HTML or XHTML within a document. This construct is used by Atom core elements like
+     * atom:title, atom:summary, atom:rights, atom:subtitle, etc and SHOULD be reused by extensions that need a way of
+     * embedding text in a document.
+     * 
+     * @param qname The XML QName of the Text element to create
+     * @param type The type of text (plain text, HTML or XHTML)
+     * @return A newly created Atom Text Construct element
+     */
+    Text newText(QName qname, Text.Type type);
+
+    Text newText(Class<?> _class, Text.Type type);
+    
+    /**
+     * Create a new Text element with the given QName and Text.Type as a child of the given Element.
+     * 
+     * @param qname The XML QName of the Text element to create
+     * @param type The type of text (plain text, HTML or XHTML)
+     * @param parent The element to which the new Updated element should be added as a child
+     * @return A newly created Atom Text Construct element
+     */
+    Text newText(QName qname, Text.Type type, Element parent);
+    
+    Text newText(Class<?> _class, Text.Type type, Element parent);
+
+    /**
+     * Create a new title element.
+     * 
+     * @return A newly created atom:title element
+     */
+    Text newTitle();
+
+    /**
+     * Create a new title element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Title element should be added as a child
+     * @return A newly created atom:title element
+     */
+    Text newTitle(Element parent);
+
+    /**
+     * Create a new title element with the given Text.Type.
+     * 
+     * @param type The type of text used in the title (plain text, HTML, XHTML)
+     * @return A newly created atom:title element
+     */
+    Text newTitle(Text.Type type);
+
+    /**
+     * Create a new title element with the given Text.Type as a child of the given Element.
+     * 
+     * @param type The type of text used in the title (plain text, HTML, XHTML)
+     * @param parent The element to which the new Updated element should be added as a child
+     * @return A newly created atom:title element
+     */
+    Text newTitle(Text.Type type, Element parent);
+
+    /**
+     * Create a new subtitle element.
+     * 
+     * @return A newly created atom:subtitle element
+     */
+    Text newSubtitle();
+
+    /**
+     * Create a new subtitle element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Subtitle element should be added as a child
+     * @return A newly created atom:subtitle element
+     */
+    Text newSubtitle(Element parent);
+
+    /**
+     * Create a new subtitle element with the given Text.Type.
+     * 
+     * @param type The type of text used in the subtitle (plain text, HTML, XHTML)
+     * @return A newly created atom:subtitle element
+     */
+    Text newSubtitle(Text.Type type);
+
+    /**
+     * Create a new subtitle element with the given Text.Type as a child of the given Element.
+     * 
+     * @param type The type of text used i the subtitle (plain text, HTML, XHTML)
+     * @param parent The element to which the new Subtitle element should be added as a child
+     * @return A newly created atom:subtitle element
+     */
+    Text newSubtitle(Text.Type type, Element parent);
+
+    /**
+     * Create a new summary element.
+     * 
+     * @return A newly created atom:summary element
+     */
+    Text newSummary();
+
+    /**
+     * Create a new summary element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Summary element should be added as a child
+     * @return A newly created atom:summary element
+     */
+    Text newSummary(Element parent);
+
+    /**
+     * Create a new summary element with the given Text.Type.
+     * 
+     * @param type The type of text used in the summary (plain text, HTML, XHTML)
+     * @return A newly created atom:summary element
+     */
+    Text newSummary(Text.Type type);
+
+    /**
+     * Create a new summary element with the given Text.Type as a child of the given Element.
+     * 
+     * @param type The type of text used in the summary (plain text, HTML, XHTML)
+     * @param parent The element to which the new Summary element should be added as a child
+     * @return A newly created atom:summary element
+     */
+    Text newSummary(Text.Type type, Element parent);
+
+    /**
+     * Create a new rights element.
+     * 
+     * @return A newly created atom:rights element
+     */
+    Text newRights();
+
+    /**
+     * Create a new rights element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Rights element should be added as a child
+     * @return A newly created atom:rights element
+     */
+    Text newRights(Element parent);
+
+    /**
+     * Create a new rights element with the given Text.Type.
+     * 
+     * @param type The type of text used in the Rights (plain text, HTML, XHTML)
+     * @return A newly created atom:rights element
+     */
+    Text newRights(Text.Type type);
+
+    /**
+     * Create a new rights element with the given Text.Type as a child of the given Element.
+     * 
+     * @param type The type of text used in the Rights (plain text, HTML, XHTML)
+     * @param parent The element to which the new Rights element should be added as a child
+     * @return A newly created atom:rights element
+     */
+    Text newRights(Text.Type type, Element parent);
+
+    /**
+     * Create a new name element.
+     * 
+     * @return A newly created atom:name element
+     */
+    Element newName();
+
+    /**
+     * Create a new name element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Name element should be added as a child
+     * @return A newly created atom:summary element
+     */
+    Element newName(Element parent);
+
+    /**
+     * Create a new email element.
+     * 
+     * @return A newly created atom:email element
+     */
+    Element newEmail();
+
+    /**
+     * Create a new email element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Email element should be added as a child
+     * @return A newly created atom:email element
+     */
+    Element newEmail(Element parent);
+
+    /**
+     * Create a new Element with the given QName.
+     * 
+     * @return A newly created element
+     */
+    <T extends Element> T newElement(QName qname);
+    
+    <T extends Element> T newElement(Class<?> _class);
+
+    /**
+     * Create a new Element with the given QName as a child of the given Base.
+     * 
+     * @param qname The XML QName of the element to create
+     * @param parent The element or document to which the new element should be added as a child
+     * @return A newly created element
+     */
+    <T extends Element> T newElement(QName qname, Base parent);
+
+    <T extends Element> T newElement(Class<?> _class, Base parent);
+    
+    /**
+     * Create a new extension element with the given QName.
+     * 
+     * @param qname The XML QName of the element to create
+     * @return A newly created element
+     */
+    <T extends Element> T newExtensionElement(QName qname);
+    
+    <T extends Element> T newExtensionElement(Class<?> _class);
+
+    /**
+     * Create a new extension element with the given QName as a child of the given Base.
+     * 
+     * @param qname The XML QName of the element to create
+     * @param parent The element or document to which the new element should be added as a child
+     * @return A newly created element
+     */
+    <T extends Element> T newExtensionElement(QName qname, Base parent);
+
+    <T extends Element> T newExtensionElement(Class<?> _class, Base parent);
+    
+    /**
+     * Create a new Control element. The app:control element is introduced by the Atom Publishing Protocol as a means of
+     * allowing publishing clients to provide metadata to a server affecting the way an entry is published. The control
+     * element SHOULD only ever appear as a child of the atom:entry and MUST only ever appear once.
+     * 
+     * @return A newly app:control element
+     */
+    Control newControl();
+
+    /**
+     * Create a new Control element as a child of the given Element.
+     * 
+     * @param parent The element to which the new Control element should be added as a child
+     * @return A newly app:control element
+     */
+    Control newControl(Element parent);
+
+    /**
+     * Create a new Div element.
+     * 
+     * @return A newly xhtml:div element
+     */
+    Div newDiv();
+
+    /**
+     * Create a new Div element as a child of the given Base.
+     * 
+     * @param parent The element or document to which the new XHTML div element should be added as a child
+     * @return A newly xhtml:div element
+     */
+    Div newDiv(Base parent);
+
+    /**
+     * Registers an extension factory for this Factory instance only
+     * 
+     * @param extensionFactory An ExtensionFactory instance
+     */
+    Factory registerExtension(ExtensionFactory extensionFactory);
+
+    /**
+     * Create a new Categories element. The app:categories element is introduced by the Atom Publishing Protocol as a
+     * means of providing a listing of atom:category's that can be used by entries in a collection.
+     * 
+     * @return A newly app:categories element
+     */
+    Categories newCategories();
+
+    /**
+     * Create a new Categories element. The app:categories element is introduced by the Atom Publishing Protocol as a
+     * means of providing a listing of atom:category's that can be used by entries in a collection.
+     * 
+     * @param parent The element or document to which the new Categories element should be added as a child
+     * @return A newly app:categories element
+     */
+    Categories newCategories(Base parent);
+
+    /**
+     * Generate a new random UUID URI
+     */
+    String newUuidUri();
+
+    /**
+     * Get the Abdera instance for this factory
+     */
+    Abdera getAbdera();
+
+    /**
+     * Get the mime type for the specified extension element / document
+     */
+    <T extends Base> String getMimeType(T base);
+
+    /**
+     * Returns a listing of extension factories registered
+     */
+    Iterable<ExtensionFactory> listExtensionFactories();
+    
+    <T extends Element> T getElementWrapper(Element internal);
+}

Propchange: abdera/abdera2/core/src/main/java/org/apache/abdera2/factory/Factory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message