abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r1173209 [36/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/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Text.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Text.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Text.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Text.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,36 @@
+/*
+ * 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.ext.serializer.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+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 org.apache.abdera2.ext.serializer.impl.TextSerializer;
+
+@Retention(RUNTIME)
+@Target( {TYPE, METHOD, FIELD})
+@Convention(".*text")
+@Serializer(TextSerializer.class)
+public @interface Text {
+    org.apache.abdera2.model.Text.Type type() default org.apache.abdera2.model.Text.Type.TEXT;
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Text.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Title.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Title.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Title.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Title.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,35 @@
+/*
+ * 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.ext.serializer.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+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 org.apache.abdera2.ext.serializer.impl.TextSerializer;
+
+@Retention(RUNTIME)
+@Target( {TYPE, METHOD, FIELD})
+@Convention(".*title")
+@Serializer(TextSerializer.class)
+public @interface Title {
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Title.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/URI.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/URI.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/URI.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/URI.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,32 @@
+/*
+ * 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.ext.serializer.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target( {METHOD, FIELD})
+@Convention(".*uri")
+public @interface URI {
+    String value() default "##default";
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/URI.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Updated.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Updated.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Updated.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Updated.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.ext.serializer.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.apache.abdera2.ext.serializer.impl.DateTimeSerializer;
+
+@Retention(RUNTIME)
+@Target( {METHOD, FIELD})
+@Convention(".*updated")
+@Serializer(DateTimeSerializer.class)
+public @interface Updated {
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Updated.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Value.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Value.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Value.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Value.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,32 @@
+/*
+ * 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.ext.serializer.annotation;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target( {TYPE, METHOD, FIELD})
+@Convention(".*value")
+public @interface Value {
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Value.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Version.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Version.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Version.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Version.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,32 @@
+/*
+ * 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.ext.serializer.annotation;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.FIELD;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Retention(RUNTIME)
+@Target( {METHOD, FIELD})
+@Convention(".*version")
+public @interface Version {
+    String value() default "##default";
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Version.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Workspace.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Workspace.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Workspace.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Workspace.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,35 @@
+/*
+ * 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.ext.serializer.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+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 org.apache.abdera2.ext.serializer.impl.WorkspaceSerializer;
+
+@Retention(RUNTIME)
+@Target( {TYPE, METHOD, FIELD})
+@Convention(".*workspace")
+@Serializer(WorkspaceSerializer.class)
+public @interface Workspace {
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/annotation/Workspace.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategoriesSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategoriesSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategoriesSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategoriesSerializer.java Tue Sep 20 15:56:46 2011
@@ -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.abdera2.ext.serializer.impl;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Category;
+
+public class CategoriesSerializer extends ElementSerializer {
+
+    public CategoriesSerializer() {
+        super(Constants.CATEGORIES);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        writeExtensions(source, objectContext, context, conventions);
+        writeElements(Category.class, new CategorySerializer(), source, objectContext, context, conventions);
+    }
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategoriesSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategorySerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategorySerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategorySerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategorySerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,99 @@
+/*
+ * 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.ext.serializer.impl;
+
+import java.lang.reflect.AccessibleObject;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Category;
+import org.apache.abdera2.ext.serializer.annotation.Label;
+import org.apache.abdera2.ext.serializer.annotation.Scheme;
+import org.apache.abdera2.ext.serializer.annotation.Value;
+import org.apache.abdera2.writer.StreamWriter;
+
+public class CategorySerializer extends ElementSerializer {
+
+    public CategorySerializer() {
+        super(Constants.CATEGORY);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+
+        StreamWriter sw = context.getStreamWriter();
+        Category _category = objectContext.getAnnotation(Category.class);
+
+        String scheme = null;
+        AccessibleObject accessor = objectContext.getAccessor(Scheme.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                scheme = toString(value);
+        }
+        if (scheme == null) {
+            Scheme _scheme = objectContext.getAnnotation(Scheme.class);
+            if (_scheme != null && !_scheme.value().equals(DEFAULT)) {
+                scheme = _scheme.value();
+            }
+        }
+        if (scheme == null && _category != null && !_category.scheme().equals(DEFAULT)) {
+            scheme = _category.scheme();
+        }
+        if (scheme != null)
+            sw.writeAttribute("scheme", scheme);
+
+        String label = null;
+        accessor = objectContext.getAccessor(Label.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                label = toString(value);
+        }
+        if (label == null) {
+            Label _label = objectContext.getAnnotation(Label.class);
+            if (_label != null && !_label.value().equals(DEFAULT)) {
+                label = _label.value();
+            }
+        }
+        if (label == null && _category != null && !_category.label().equals(DEFAULT)) {
+            label = _category.label();
+        }
+        if (label != null)
+            sw.writeAttribute("label", label);
+
+        String term = null;
+        accessor = objectContext.getAccessor(Value.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                term = toString(value);
+        }
+        if (term == null)
+            term = toString(source);
+        if (term != null)
+            sw.writeAttribute("term", term);
+
+        writeAttributes(source, objectContext, context, conventions);
+        writeExtensions(source, objectContext, context, conventions);
+    }
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CategorySerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CollectionSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CollectionSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CollectionSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CollectionSerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.ext.serializer.impl;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Accept;
+import org.apache.abdera2.ext.serializer.annotation.Categories;
+import org.apache.abdera2.ext.serializer.annotation.Title;
+
+public class CollectionSerializer extends ElementSerializer {
+
+    public CollectionSerializer() {
+        super(Constants.COLLECTION);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        writeElement(Title.class, new TextSerializer(Constants.TITLE), source, objectContext, context, conventions);
+        writeElements(Accept.class,
+                      new SimpleElementSerializer(Constants.ACCEPT),
+                      source,
+                      objectContext,
+                      context,
+                      conventions);
+        writeElements(Categories.class, new CategoriesSerializer(), source, objectContext, context, conventions);
+        writeExtensions(source, objectContext, context, conventions);
+    }
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/CollectionSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ContentSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ContentSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ContentSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ContentSerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,134 @@
+/*
+ * 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.ext.serializer.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.lang.reflect.AccessibleObject;
+
+import javax.activation.DataHandler;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.SerializationException;
+import org.apache.abdera2.ext.serializer.annotation.Content;
+import org.apache.abdera2.ext.serializer.annotation.MediaType;
+import org.apache.abdera2.ext.serializer.annotation.Value;
+import org.apache.abdera2.model.Div;
+import org.apache.abdera2.model.Document;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.model.Content.Type;
+import org.apache.abdera2.writer.StreamWriter;
+
+public class ContentSerializer extends ElementSerializer {
+
+    public ContentSerializer() {
+        super(Constants.CONTENT);
+    }
+
+    protected void init(Object source,
+                        ObjectContext objectContext,
+                        SerializationContext context,
+                        Conventions conventions) {
+
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+
+        Type type = Type.TEXT;
+        Object contentValue = null;
+        ObjectContext valueContext = null;
+        AccessibleObject accessor = objectContext.getAccessor(Value.class, conventions);
+        if (accessor != null && !(source instanceof Element)) {
+            contentValue = eval(accessor, source);
+            valueContext = new ObjectContext(contentValue, source, accessor);
+            Content _content = valueContext.getAnnotation(Content.class);
+            type = _content != null ? _content.type() : type;
+        } else {
+            Content _content = objectContext.getAnnotation(Content.class);
+            type = _content != null ? _content.type() : type;
+            contentValue = source;
+            valueContext = objectContext;
+        }
+
+        StreamWriter sw = context.getStreamWriter();
+        sw.startContent(type);
+        writeAttributes(source, objectContext, context, conventions);
+
+        if (type == Type.MEDIA || type == Type.XML) {
+            String mediatype = null;
+            AccessibleObject mtaccessor = valueContext.getAccessor(MediaType.class, conventions);
+            if (mtaccessor != null) {
+                Object mtvalue = eval(mtaccessor, contentValue);
+                mediatype = mtvalue != null ? toString(mtvalue) : null;
+            }
+            if (mediatype == null) {
+                MediaType mt = valueContext.getAnnotation(MediaType.class);
+                mediatype = mt != null && !mt.value().equals(DEFAULT) ? mt.value() : null;
+            }
+            if (mediatype != null)
+                sw.writeAttribute("type", mediatype);
+        }
+
+        switch (type) {
+            case TEXT:
+            case HTML:
+                sw.writeElementText(toString(contentValue));
+                break;
+            case XHTML:
+                Div div = null;
+                if (contentValue instanceof Div)
+                    div = (Div)contentValue;
+                else {
+                    div = context.getAbdera().getFactory().newDiv();
+                    div.setValue(toString(contentValue));
+                }
+                context.serialize(div, new ObjectContext(div));
+                break;
+            case XML:
+                Element el = null;
+                if (contentValue instanceof Element)
+                    el = (Element)contentValue;
+                else {
+                    StringReader sr = new StringReader(toString(contentValue));
+                    Document<Element> doc = context.getAbdera().getParser().parse(sr);
+                    el = doc.getRoot();
+                }
+                context.serialize(el, new ObjectContext(el));
+                break;
+            case MEDIA:
+                try {
+                    if (contentValue instanceof DataHandler)
+                        sw.writeElementText((DataHandler)contentValue);
+                    else if (contentValue instanceof InputStream)
+                        sw.writeElementText((InputStream)contentValue);
+                    else
+                        sw.writeElementText(toString(contentValue));
+                } catch (IOException e) {
+                    throw new SerializationException(e);
+                }
+        }
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ContentSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ControlSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ControlSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ControlSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ControlSerializer.java Tue Sep 20 15:56:46 2011
@@ -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.abdera2.ext.serializer.impl;
+
+import java.lang.reflect.AccessibleObject;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.Serializer;
+import org.apache.abdera2.ext.serializer.annotation.Draft;
+
+public class ControlSerializer extends ElementSerializer {
+
+    public ControlSerializer() {
+        super(Constants.CONTROL);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        AccessibleObject accessor = objectContext.getAccessor(Draft.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value instanceof Boolean) {
+                String val = ((Boolean)value).booleanValue() ? "yes" : "no";
+                ObjectContext valueContext = new ObjectContext(val);
+                Serializer ser = new SimpleElementSerializer(Constants.DRAFT);
+                ser.serialize(val, valueContext, context);
+            } else {
+                ObjectContext valueContext = new ObjectContext(value);
+                context.serialize(value, valueContext);
+            }
+        }
+        writeExtensions(source, objectContext, context, conventions);
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ControlSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/DateTimeSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/DateTimeSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/DateTimeSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/DateTimeSerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,86 @@
+/*
+ * 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.ext.serializer.impl;
+
+import java.lang.reflect.AccessibleObject;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Value;
+import org.apache.abdera2.common.date.DateTime;
+import org.apache.abdera2.writer.StreamWriter;
+
+public class DateTimeSerializer extends ElementSerializer {
+
+    public DateTimeSerializer(QName qname) {
+        super(qname);
+    }
+
+    public DateTimeSerializer() {
+        super(null);
+    }
+
+    protected void init(Object source,
+                        ObjectContext objectContext,
+                        SerializationContext context,
+                        Conventions conventions) {
+        QName qname = this.qname != null ? this.qname : getQName(objectContext.getAccessor());
+        StreamWriter sw = context.getStreamWriter();
+        sw.startElement(qname);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+
+        writeAttributes(source, objectContext, context, conventions);
+        Object value = null;
+        if (!(source instanceof Long)) {
+            AccessibleObject accessor = objectContext.getAccessor(Value.class, conventions);
+            if (accessor != null) {
+                value = eval(accessor, source);
+            }
+        }
+        writeValue(value != null ? value : source, context);
+    }
+
+    private void writeValue(Object value, SerializationContext context) {
+        StreamWriter sw = context.getStreamWriter();
+        Date date = null;
+        if (value == null)
+            return;
+        if (value instanceof Date) {
+            date = (Date)value;
+        } else if (value instanceof Calendar) {
+            date = ((Calendar)value).getTime();
+        } else if (value instanceof Long) {
+            date = new Date(((Long)value).longValue());
+        } else if (value instanceof String) {
+            date = DateTime.parse((String)value);
+        } else {
+            date = DateTime.parse(value.toString());
+        }
+        sw.writeElementText(date);
+    }
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/DateTimeSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ElementSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ElementSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ElementSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ElementSerializer.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.ext.serializer.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.ext.serializer.BaseSerializer;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.writer.StreamWriter;
+
+public class ElementSerializer extends BaseSerializer {
+
+    protected final QName qname;
+
+    public ElementSerializer(QName qname) {
+        this.qname = qname;
+    }
+
+    public ElementSerializer() {
+        this.qname = null;
+    }
+
+    protected void finish(Object source,
+                          ObjectContext objectContext,
+                          SerializationContext context,
+                          Conventions conventions) {
+        context.getStreamWriter().endElement();
+    }
+
+    protected void init(Object source,
+                        ObjectContext objectContext,
+                        SerializationContext context,
+                        Conventions conventions) {
+        QName qname = this.qname != null ? this.qname : getQName(objectContext.getAccessor());
+        StreamWriter sw = context.getStreamWriter();
+        sw.startElement(qname);
+        writeCommon(source, objectContext, context, conventions);
+
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ElementSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/EntrySerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/EntrySerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/EntrySerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/EntrySerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,85 @@
+/*
+ * 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.ext.serializer.impl;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Author;
+import org.apache.abdera2.ext.serializer.annotation.Category;
+import org.apache.abdera2.ext.serializer.annotation.Content;
+import org.apache.abdera2.ext.serializer.annotation.Contributor;
+import org.apache.abdera2.ext.serializer.annotation.Control;
+import org.apache.abdera2.ext.serializer.annotation.Edited;
+import org.apache.abdera2.ext.serializer.annotation.ID;
+import org.apache.abdera2.ext.serializer.annotation.Link;
+import org.apache.abdera2.ext.serializer.annotation.Published;
+import org.apache.abdera2.ext.serializer.annotation.Rights;
+import org.apache.abdera2.ext.serializer.annotation.Summary;
+import org.apache.abdera2.ext.serializer.annotation.Title;
+import org.apache.abdera2.ext.serializer.annotation.Updated;
+
+public class EntrySerializer extends ElementSerializer {
+
+    public EntrySerializer() {
+        super(Constants.ENTRY);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        writeElement(ID.class, new IRISerializer(Constants.ID), source, objectContext, context, conventions);
+        writeElement(Title.class, new TextSerializer(Constants.TITLE), source, objectContext, context, conventions);
+        writeElement(Summary.class, new TextSerializer(Constants.SUMMARY), source, objectContext, context, conventions);
+        writeElement(Rights.class, new TextSerializer(Constants.RIGHTS), source, objectContext, context, conventions);
+        writeElement(Updated.class,
+                     new DateTimeSerializer(Constants.UPDATED),
+                     source,
+                     objectContext,
+                     context,
+                     conventions);
+        writeElement(Published.class,
+                     new DateTimeSerializer(Constants.PUBLISHED),
+                     source,
+                     objectContext,
+                     context,
+                     conventions);
+        writeElement(Edited.class,
+                     new DateTimeSerializer(Constants.EDITED),
+                     source,
+                     objectContext,
+                     context,
+                     conventions);
+        writeElement(Content.class, new ContentSerializer(), source, objectContext, context, conventions);
+        writeElement(Control.class, new ControlSerializer(), source, objectContext, context, conventions);
+        writeElements(Link.class, new LinkSerializer(), source, objectContext, context, conventions);
+        writeElements(Category.class, new CategorySerializer(), source, objectContext, context, conventions);
+        writeElements(Author.class, new PersonSerializer(Constants.AUTHOR), source, objectContext, context, conventions);
+        writeElements(Contributor.class,
+                      new PersonSerializer(Constants.CONTRIBUTOR),
+                      source,
+                      objectContext,
+                      context,
+                      conventions);
+        writeExtensions(source, objectContext, context, conventions);
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/EntrySerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ExtensionSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ExtensionSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ExtensionSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ExtensionSerializer.java Tue Sep 20 15:56:46 2011
@@ -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.abdera2.ext.serializer.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+
+public class ExtensionSerializer extends ElementSerializer {
+
+    public ExtensionSerializer() {
+        super(null);
+    }
+
+    public ExtensionSerializer(QName qname) {
+        super(qname);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        writeExtensions(source, objectContext, context, conventions);
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ExtensionSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FOMSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FOMSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FOMSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FOMSerializer.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.ext.serializer.impl;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.ext.serializer.BaseSerializer;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.model.Comment;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.model.ProcessingInstruction;
+import org.apache.abdera2.model.TextValue;
+import org.apache.abdera2.writer.StreamWriter;
+import org.apache.abdera2.xpath.XPath;
+
+public class FOMSerializer extends BaseSerializer {
+
+    public FOMSerializer() {
+    }
+
+    protected void finish(Object source,
+                          ObjectContext objectContext,
+                          SerializationContext context,
+                          Conventions conventions) {
+    }
+
+    protected void init(Object source,
+                        ObjectContext objectContext,
+                        SerializationContext context,
+                        Conventions conventions) {
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        StreamWriter sw = context.getStreamWriter();
+        if (!(source instanceof Element))
+            return;
+        Element element = (Element)source;
+        sw.startElement(element.getQName());
+        for (QName attr : element.getAttributes())
+            sw.writeAttribute(attr, element.getAttributeValue(attr));
+        XPath xpath = context.getAbdera().getXPath();
+        List<?> children = xpath.selectNodes("node()", element);
+        for (Object child : children) {
+            if (child instanceof Element) {
+                process(child, new ObjectContext(child), context, conventions);
+            } else if (child instanceof Comment) {
+                Comment comment = (Comment)child;
+                sw.writeComment(comment.getText());
+            } else if (child instanceof ProcessingInstruction) {
+                ProcessingInstruction pi = (ProcessingInstruction)child;
+                sw.writePI(pi.getText(), pi.getTarget());
+            } else if (child instanceof TextValue) {
+                TextValue tv = (TextValue)child;
+                sw.writeElementText(tv.getText());
+            }
+        }
+        sw.endElement();
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FOMSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FeedSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FeedSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FeedSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FeedSerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,39 @@
+/*
+ * 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.ext.serializer.impl;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Entry;
+
+public class FeedSerializer extends SourceSerializer {
+
+    public FeedSerializer() {
+        super(Constants.FEED);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        super.process(source, objectContext, context, conventions);
+        writeElements(Entry.class, new EntrySerializer(), source, objectContext, context, conventions);
+    }
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/FeedSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/GeneratorSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/GeneratorSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/GeneratorSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/GeneratorSerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,85 @@
+/*
+ * 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.ext.serializer.impl;
+
+import java.lang.reflect.AccessibleObject;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Generator;
+import org.apache.abdera2.ext.serializer.annotation.URI;
+import org.apache.abdera2.writer.StreamWriter;
+
+public class GeneratorSerializer extends ElementSerializer {
+
+    public GeneratorSerializer() {
+        super(Constants.GENERATOR);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        StreamWriter sw = context.getStreamWriter();
+        Generator _generator = objectContext.getAnnotation(Generator.class);
+
+        String uri = null;
+        AccessibleObject accessor = objectContext.getAccessor(URI.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                uri = toString(value);
+        }
+        if (uri == null) {
+            URI _uri = objectContext.getAnnotation(URI.class);
+            if (_uri != null && !_uri.value().equals(DEFAULT)) {
+                uri = _uri.value();
+            }
+        }
+        if (uri == null && _generator != null && !_generator.uri().equals(DEFAULT)) {
+            uri = _generator.uri();
+        }
+        if (uri != null)
+            sw.writeAttribute("uri", uri);
+
+        String version = null;
+        accessor = objectContext.getAccessor(URI.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                version = toString(value);
+        }
+        if (version == null) {
+            URI _version = objectContext.getAnnotation(URI.class);
+            if (_version != null && !_version.value().equals(DEFAULT)) {
+                version = _version.value();
+            }
+        }
+        if (version == null && _generator != null && !_generator.version().equals(DEFAULT)) {
+            version = _generator.version();
+        }
+        if (version != null)
+            sw.writeAttribute("version", version);
+
+        writeTextValue(source, objectContext, context, conventions);
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/GeneratorSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/IRISerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/IRISerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/IRISerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/IRISerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.ext.serializer.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.writer.StreamWriter;
+
+public class IRISerializer extends ElementSerializer {
+
+    public IRISerializer(QName qname) {
+        super(qname);
+    }
+
+    public IRISerializer() {
+        super(null);
+    }
+
+    protected void init(Object source,
+                        ObjectContext objectContext,
+                        SerializationContext context,
+                        Conventions conventions) {
+        QName qname = this.qname != null ? this.qname : getQName(objectContext.getAccessor());
+        StreamWriter sw = context.getStreamWriter();
+        sw.startElement(qname);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        writeTextValue(source, objectContext, context, conventions);
+    }
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/IRISerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/LinkSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/LinkSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/LinkSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/LinkSerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,133 @@
+/*
+ * 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.ext.serializer.impl;
+
+import java.lang.reflect.AccessibleObject;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.HrefLanguage;
+import org.apache.abdera2.ext.serializer.annotation.Link;
+import org.apache.abdera2.ext.serializer.annotation.MediaType;
+import org.apache.abdera2.ext.serializer.annotation.Rel;
+import org.apache.abdera2.ext.serializer.annotation.Title;
+import org.apache.abdera2.ext.serializer.annotation.Value;
+import org.apache.abdera2.writer.StreamWriter;
+
+public class LinkSerializer extends ElementSerializer {
+
+    public LinkSerializer() {
+        super(Constants.LINK);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+
+        StreamWriter sw = context.getStreamWriter();
+        Link _link = objectContext.getAnnotation(Link.class);
+
+        String rel = null;
+        AccessibleObject accessor = objectContext.getAccessor(Rel.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                rel = toString(value);
+        }
+        if (rel == null) {
+            Rel _rel = objectContext.getAnnotation(Rel.class);
+            if (_rel != null && !_rel.value().equals(DEFAULT)) {
+                rel = _rel.value();
+            }
+        }
+        if (rel == null && _link != null && !_link.rel().equals(DEFAULT)) {
+            rel = _link.rel();
+        }
+        if (rel != null)
+            sw.writeAttribute("rel", rel);
+
+        String type = null;
+        accessor = objectContext.getAccessor(MediaType.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                type = toString(value);
+        }
+        if (type == null) {
+            MediaType _type = objectContext.getAnnotation(MediaType.class);
+            if (_type != null && !_type.value().equals(DEFAULT)) {
+                type = _type.value();
+            }
+        }
+        if (type == null && _link != null && !_link.type().equals(DEFAULT)) {
+            type = _link.type();
+        }
+        if (type != null)
+            sw.writeAttribute("type", type);
+
+        String title = null;
+        accessor = objectContext.getAccessor(Title.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                title = toString(value);
+        }
+        if (title == null && _link != null && !_link.title().equals(DEFAULT)) {
+            title = _link.title();
+        }
+        if (title != null)
+            sw.writeAttribute("title", title);
+
+        String hreflang = null;
+        accessor = objectContext.getAccessor(HrefLanguage.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                hreflang = toString(value);
+        }
+        if (hreflang == null) {
+            HrefLanguage _hreflang = objectContext.getAnnotation(HrefLanguage.class);
+            if (_hreflang != null && !_hreflang.value().equals(DEFAULT)) {
+                hreflang = _hreflang.value();
+            }
+        }
+        if (hreflang == null && _link != null && !_link.hreflang().equals(DEFAULT)) {
+            hreflang = _link.hreflang();
+        }
+        if (hreflang != null)
+            sw.writeAttribute("hreflang", hreflang);
+
+        String href = null;
+        accessor = objectContext.getAccessor(Value.class, conventions);
+        if (accessor != null) {
+            Object value = eval(accessor, source);
+            if (value != null)
+                href = toString(value);
+        }
+        if (href == null)
+            href = toString(source);
+        if (href != null)
+            sw.writeAttribute("href", href);
+
+        writeAttributes(source, objectContext, context, conventions);
+        writeExtensions(source, objectContext, context, conventions);
+    }
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/LinkSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/PersonSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/PersonSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/PersonSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/PersonSerializer.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.ext.serializer.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Email;
+import org.apache.abdera2.ext.serializer.annotation.URI;
+import org.apache.abdera2.ext.serializer.annotation.Value;
+import org.apache.abdera2.writer.StreamWriter;
+
+public class PersonSerializer extends ElementSerializer {
+
+    public PersonSerializer(QName qname) {
+        super(qname);
+    }
+
+    public PersonSerializer() {
+        super(null);
+    }
+
+    protected void init(Object source,
+                        ObjectContext objectContext,
+                        SerializationContext context,
+                        Conventions conventions) {
+        QName qname = this.qname != null ? this.qname : getQName(objectContext.getAccessor());
+        StreamWriter sw = context.getStreamWriter();
+        sw.startElement(qname);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        if (!writeElement(Value.class,
+                          new SimpleElementSerializer(Constants.NAME),
+                          source,
+                          objectContext,
+                          context,
+                          conventions)) {
+            context.getStreamWriter().startElement(Constants.NAME).writeElementText(toString(source)).endElement();
+        }
+        writeElement(Email.class,
+                     new SimpleElementSerializer(Constants.EMAIL),
+                     source,
+                     objectContext,
+                     context,
+                     conventions);
+        writeElement(URI.class, new SimpleElementSerializer(Constants.URI), source, objectContext, context, conventions);
+        writeExtensions(source, objectContext, context, conventions);
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/PersonSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ServiceSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ServiceSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ServiceSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ServiceSerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,41 @@
+/*
+ * 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.ext.serializer.impl;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Workspace;
+
+public class ServiceSerializer extends ElementSerializer {
+
+    public ServiceSerializer() {
+        super(Constants.SERVICE);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        writeExtensions(source, objectContext, context, conventions);
+        writeElements(Workspace.class, new WorkspaceSerializer(), source, objectContext, context, conventions);
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/ServiceSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SimpleElementSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SimpleElementSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SimpleElementSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SimpleElementSerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,41 @@
+/*
+ * 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.ext.serializer.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+
+public class SimpleElementSerializer extends ElementSerializer {
+
+    public SimpleElementSerializer(QName qname) {
+        super(qname);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+
+        writeAttributes(source, objectContext, context, conventions);
+
+        writeTextValue(source, objectContext, context, conventions);
+    }
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SimpleElementSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SourceSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SourceSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SourceSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SourceSerializer.java Tue Sep 20 15:56:46 2011
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  The ASF licenses this file to You
+ * under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
+package org.apache.abdera2.ext.serializer.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.common.Constants;
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Author;
+import org.apache.abdera2.ext.serializer.annotation.Category;
+import org.apache.abdera2.ext.serializer.annotation.Contributor;
+import org.apache.abdera2.ext.serializer.annotation.ID;
+import org.apache.abdera2.ext.serializer.annotation.Icon;
+import org.apache.abdera2.ext.serializer.annotation.Link;
+import org.apache.abdera2.ext.serializer.annotation.Logo;
+import org.apache.abdera2.ext.serializer.annotation.Rights;
+import org.apache.abdera2.ext.serializer.annotation.Subtitle;
+import org.apache.abdera2.ext.serializer.annotation.Title;
+import org.apache.abdera2.ext.serializer.annotation.Updated;
+
+public class SourceSerializer extends ElementSerializer {
+
+    public SourceSerializer() {
+        super(Constants.SOURCE);
+    }
+
+    protected SourceSerializer(QName qname) {
+        super(qname);
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+        writeAttributes(source, objectContext, context, conventions);
+        writeElement(ID.class, new IRISerializer(Constants.ID), source, objectContext, context, conventions);
+        writeElement(Icon.class, new IRISerializer(Constants.ICON), source, objectContext, context, conventions);
+        writeElement(Logo.class, new IRISerializer(Constants.LOGO), source, objectContext, context, conventions);
+        writeElement(Title.class, new TextSerializer(Constants.TITLE), source, objectContext, context, conventions);
+        writeElement(Subtitle.class,
+                     new TextSerializer(Constants.SUBTITLE),
+                     source,
+                     objectContext,
+                     context,
+                     conventions);
+        writeElement(Rights.class, new TextSerializer(Constants.RIGHTS), source, objectContext, context, conventions);
+        writeElement(Updated.class,
+                     new DateTimeSerializer(Constants.UPDATED),
+                     source,
+                     objectContext,
+                     context,
+                     conventions);
+        writeElements(Link.class, new LinkSerializer(), source, objectContext, context, conventions);
+        writeElements(Category.class, new CategorySerializer(), source, objectContext, context, conventions);
+        writeElements(Author.class, new PersonSerializer(Constants.AUTHOR), source, objectContext, context, conventions);
+        writeElements(Contributor.class,
+                      new PersonSerializer(Constants.CONTRIBUTOR),
+                      source,
+                      objectContext,
+                      context,
+                      conventions);
+        writeExtensions(source, objectContext, context, conventions);
+    }
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/SourceSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/TextSerializer.java
URL: http://svn.apache.org/viewvc/abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/TextSerializer.java?rev=1173209&view=auto
==============================================================================
--- abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/TextSerializer.java (added)
+++ abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/TextSerializer.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.ext.serializer.impl;
+
+import java.lang.reflect.AccessibleObject;
+
+import javax.xml.namespace.QName;
+
+import org.apache.abdera2.ext.serializer.Conventions;
+import org.apache.abdera2.ext.serializer.ObjectContext;
+import org.apache.abdera2.ext.serializer.SerializationContext;
+import org.apache.abdera2.ext.serializer.annotation.Text;
+import org.apache.abdera2.ext.serializer.annotation.Value;
+import org.apache.abdera2.model.Div;
+import org.apache.abdera2.model.Element;
+import org.apache.abdera2.model.Text.Type;
+import org.apache.abdera2.writer.StreamWriter;
+
+public class TextSerializer extends ElementSerializer {
+
+    public TextSerializer(QName qname) {
+        super(qname);
+    }
+
+    public TextSerializer() {
+        super(null);
+    }
+
+    protected void init(Object source,
+                        ObjectContext objectContext,
+                        SerializationContext context,
+                        Conventions conventions) {
+
+    }
+
+    protected void process(Object source,
+                           ObjectContext objectContext,
+                           SerializationContext context,
+                           Conventions conventions) {
+
+        Type type = Type.TEXT;
+        Object contentValue = null;
+        ObjectContext valueContext = null;
+        AccessibleObject accessor = objectContext.getAccessor(Value.class, conventions);
+        if (accessor != null && !(source instanceof Element)) {
+            contentValue = eval(accessor, source);
+            valueContext = new ObjectContext(contentValue, source, accessor);
+            Text _text = valueContext.getAnnotation(Text.class);
+            type = _text != null ? _text.type() : type;
+        } else {
+            Text _text = objectContext.getAnnotation(Text.class);
+            type = _text != null ? _text.type() : type;
+            contentValue = source;
+            valueContext = objectContext;
+        }
+        QName qname = this.qname != null ? this.qname : getQName(objectContext.getAccessor());
+        StreamWriter sw = context.getStreamWriter();
+        sw.startText(qname, type);
+        writeAttributes(source, objectContext, context, conventions);
+
+        switch (type) {
+            case TEXT:
+            case HTML:
+                sw.writeElementText(toString(contentValue));
+                break;
+            case XHTML:
+                Div div = null;
+                if (contentValue instanceof Div)
+                    div = (Div)contentValue;
+                else {
+                    div = context.getAbdera().getFactory().newDiv();
+                    div.setValue(toString(contentValue));
+                }
+                context.serialize(div, new ObjectContext(div));
+                break;
+        }
+    }
+
+}

Propchange: abdera/abdera2/ext/src/main/java/org/apache/abdera2/ext/serializer/impl/TextSerializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message