You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fg...@apache.org on 2009/06/11 19:09:48 UTC

svn commit: r783850 [2/3] - in /incubator/chemistry/trunk/chemistry: chemistry-api/src/main/java/org/apache/chemistry/ chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/ chemistry-atompub-client/src/main/java/org/apache/chemist...

Copied: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/DefaultIOProvider.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java?p2=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/DefaultIOProvider.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/DefaultIOProvider.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java Thu Jun 11 17:09:45 2009
@@ -14,23 +14,23 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.app;
+package org.apache.chemistry.atompub.client.connector;
 
 import java.util.List;
 import java.util.Map;
 
 import org.apache.chemistry.ObjectEntry;
 import org.apache.chemistry.Type;
-import org.apache.chemistry.atompub.client.app.model.APPObjectEntryReader;
-import org.apache.chemistry.atompub.client.app.model.APPObjectEntryWriter;
-import org.apache.chemistry.atompub.client.app.model.APPObjectFeedReader;
-import org.apache.chemistry.atompub.client.app.model.APPServiceDocumentReader;
-import org.apache.chemistry.atompub.client.app.model.TypeEntryReader;
-import org.apache.chemistry.atompub.client.app.model.TypeFeedReader;
-import org.apache.chemistry.atompub.client.common.atom.EntryReader;
-import org.apache.chemistry.atompub.client.common.atom.FeedReader;
-import org.apache.chemistry.atompub.client.common.atom.ServiceDocumentReader;
-import org.apache.chemistry.atompub.client.common.atom.XmlObjectWriter;
+import org.apache.chemistry.atompub.client.APPObjectEntryReader;
+import org.apache.chemistry.atompub.client.APPObjectEntryWriter;
+import org.apache.chemistry.atompub.client.APPObjectFeedReader;
+import org.apache.chemistry.atompub.client.APPServiceDocumentReader;
+import org.apache.chemistry.atompub.client.TypeEntryReader;
+import org.apache.chemistry.atompub.client.TypeFeedReader;
+import org.apache.chemistry.atompub.client.stax.EntryReader;
+import org.apache.chemistry.atompub.client.stax.FeedReader;
+import org.apache.chemistry.atompub.client.stax.ServiceDocumentReader;
+import org.apache.chemistry.atompub.client.stax.XmlObjectWriter;
 
 /**
  *

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/DefaultIOProvider.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/httpclient/HttpClientConnector.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java?p2=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/httpclient/HttpClientConnector.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/httpclient/HttpClientConnector.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java Thu Jun 11 17:09:45 2009
@@ -14,33 +14,28 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.app.httpclient;
+package org.apache.chemistry.atompub.client.connector;
 
+import java.io.IOException;
+import java.io.OutputStream;
 import java.util.List;
 
 import org.apache.chemistry.ObjectEntry;
 import org.apache.chemistry.Repository;
 import org.apache.chemistry.Type;
+import org.apache.chemistry.atompub.client.ContentManager;
 import org.apache.chemistry.atompub.client.ContentManagerException;
-import org.apache.chemistry.atompub.client.app.APPContentManager;
-import org.apache.chemistry.atompub.client.app.Connector;
-import org.apache.chemistry.atompub.client.app.Request;
-import org.apache.chemistry.atompub.client.app.Response;
-import org.apache.chemistry.atompub.client.common.atom.ReadContext;
-import org.apache.chemistry.atompub.client.common.atom.XmlObjectWriter;
-import org.apache.commons.httpclient.Credentials;
+import org.apache.chemistry.atompub.client.stax.ReadContext;
+import org.apache.chemistry.atompub.client.stax.XmlObjectWriter;
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpMethod;
 import org.apache.commons.httpclient.NameValuePair;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthScheme;
-import org.apache.commons.httpclient.auth.CredentialsNotAvailableException;
-import org.apache.commons.httpclient.auth.CredentialsProvider;
 import org.apache.commons.httpclient.methods.DeleteMethod;
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.HeadMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.commons.httpclient.methods.RequestEntity;
 
 /**
  *
@@ -49,18 +44,15 @@
 
     protected HttpClient client;
 
-    protected APPContentManager cm;
+    protected final IOProvider io;
 
-    public HttpClientConnector(APPContentManager cm) {
-        this.cm = cm;
+    public HttpClientConnector(IOProvider io, ContentManager cm) {
+        this.io = io;
         this.client = new HttpClient();
         this.client.getParams().setAuthenticationPreemptive(true);
-        this.client.getParams().setParameter(CredentialsProvider.PROVIDER,
-                new MyCredentialsProvider());
-    }
-
-    public APPContentManager getAPPContentManager() {
-        return cm;
+        this.client.getParams().setParameter(
+                org.apache.commons.httpclient.auth.CredentialsProvider.PROVIDER,
+                cm.getCredentialsProvider());
     }
 
     protected void setMethodParams(HttpMethod method, Request request) {
@@ -93,7 +85,7 @@
             setMethodParams(method, request);
             setMethodHeaders(method, request);
             client.executeMethod(method);
-            return new HttpClientResponse(this, method);
+            return new HttpClientResponse(method, io);
         } catch (Exception e) {
             throw new ContentManagerException("GET request failed", e);
         }
@@ -105,7 +97,7 @@
             setMethodParams(method, request);
             setMethodHeaders(method, request);
             client.executeMethod(method);
-            return new HttpClientResponse(this, method);
+            return new HttpClientResponse(method, io);
         } catch (Exception e) {
             throw new ContentManagerException("DELETE request failed", e);
         }
@@ -117,7 +109,7 @@
             setMethodParams(method, request);
             setMethodHeaders(method, request);
             client.executeMethod(method);
-            return new HttpClientResponse(this, method);
+            return new HttpClientResponse(method, io);
         } catch (Exception e) {
             throw new ContentManagerException("HEAD request failed", e);
         }
@@ -131,7 +123,7 @@
             setMethodHeaders(method, request);
             method.setRequestEntity(new ObjectRequestEntity<T>(writer, object));
             client.executeMethod(method);
-            return new HttpClientResponse(this, method);
+            return new HttpClientResponse(method, io);
         } catch (Exception e) {
             throw new ContentManagerException("POST request failed", e);
         }
@@ -145,7 +137,7 @@
             setMethodHeaders(method, request);
             method.setRequestEntity(new ObjectRequestEntity<T>(writer, object));
             client.executeMethod(method);
-            return new HttpClientResponse(this, method);
+            return new HttpClientResponse(method, io);
         } catch (Exception e) {
             throw new ContentManagerException("PUT request failed", e);
         }
@@ -211,38 +203,49 @@
 
     public Response putObject(Request req, ObjectEntry entry)
             throws ContentManagerException {
-        return put(req, cm.getIO().getObjectEntryWriter(), entry);
+        return put(req, io.getObjectEntryWriter(), entry);
     }
 
     public Response putQuery(Request req, String query)
             throws ContentManagerException {
-        return put(req, cm.getIO().getQueryWriter(), query);
+        return put(req, io.getQueryWriter(), query);
     }
 
     public Response postObject(Request req, ObjectEntry entry)
             throws ContentManagerException {
-        return post(req, cm.getIO().getObjectEntryWriter(), entry);
+        return post(req, io.getObjectEntryWriter(), entry);
     }
 
     public Response postQuery(Request req, String query)
             throws ContentManagerException {
-        return post(req, cm.getIO().getQueryWriter(), query);
+        return post(req, io.getQueryWriter(), query);
     }
 
-    protected class MyCredentialsProvider implements CredentialsProvider {
-        public Credentials getCredentials(AuthScheme scheme, String host,
-                int port, boolean proxy)
-                throws CredentialsNotAvailableException {
-            org.apache.chemistry.atompub.client.CredentialsProvider login = (org.apache.chemistry.atompub.client.CredentialsProvider) cm.getCurrentLogin();
-            if (login == null) {
-                return null;
-            }
-            org.apache.chemistry.atompub.client.Credentials credentials = login.getCredentials();
-            if (credentials == null) {
-                return null;
-            }
-            return new UsernamePasswordCredentials(credentials.getUsername(),
-                    new String(credentials.getPassword()));
+    public static class ObjectRequestEntity<T> implements RequestEntity {
+
+        protected XmlObjectWriter<T> writer;
+
+        protected T obj;
+
+        public ObjectRequestEntity(XmlObjectWriter<T> writer, T obj) {
+            this.writer = writer;
+            this.obj = obj;
+        }
+
+        public long getContentLength() {
+            return -1;
+        }
+
+        public String getContentType() {
+            return writer.getContentType();
+        }
+
+        public boolean isRepeatable() {
+            return false;
+        }
+
+        public void writeRequest(OutputStream out) throws IOException {
+            writer.write(obj, out);
         }
     }
 

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientConnector.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientResponse.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/httpclient/HttpClientResponse.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientResponse.java?p2=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientResponse.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/httpclient/HttpClientResponse.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/httpclient/HttpClientResponse.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientResponse.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.app.httpclient;
+package org.apache.chemistry.atompub.client.connector;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -28,9 +28,7 @@
 import org.apache.chemistry.Repository;
 import org.apache.chemistry.Type;
 import org.apache.chemistry.atompub.client.ContentManagerException;
-import org.apache.chemistry.atompub.client.app.Connector;
-import org.apache.chemistry.atompub.client.app.Response;
-import org.apache.chemistry.atompub.client.common.atom.ReadContext;
+import org.apache.chemistry.atompub.client.stax.ReadContext;
 import org.apache.commons.httpclient.Header;
 import org.apache.commons.httpclient.HttpMethod;
 
@@ -45,11 +43,11 @@
 
     protected HttpMethod method;
 
-    protected Connector connector;
+    protected final IOProvider io;
 
-    public HttpClientResponse(Connector connector, HttpMethod method) {
+    public HttpClientResponse(HttpMethod method, IOProvider io) {
         this.method = method;
-        this.connector = connector;
+        this.io = io;
     }
 
     public String getHeader(String key) {
@@ -116,8 +114,7 @@
     public ObjectEntry getObject(ReadContext ctx)
             throws ContentManagerException {
         try {
-            return connector.getAPPContentManager().getIO().getObjectEntryReader().read(
-                    ctx, getStream());
+            return io.getObjectEntryReader().read(ctx, getStream());
         } catch (XMLStreamException e) {
             throw new ContentManagerException(e);
         }
@@ -125,8 +122,7 @@
 
     public Type getType(ReadContext ctx) throws ContentManagerException {
         try {
-            return connector.getAPPContentManager().getIO().getTypeEntryReader().read(
-                    ctx, getStream());
+            return io.getTypeEntryReader().read(ctx, getStream());
         } catch (XMLStreamException e) {
             throw new ContentManagerException(e);
         }
@@ -135,8 +131,7 @@
     public Map<String, Type> getTypeFeed(ReadContext ctx)
             throws ContentManagerException {
         try {
-            return connector.getAPPContentManager().getIO().getTypeFeedReader().read(
-                    ctx, getStream());
+            return io.getTypeFeedReader().read(ctx, getStream());
         } catch (XMLStreamException e) {
             throw new ContentManagerException(e);
         }
@@ -145,8 +140,7 @@
     public List<ObjectEntry> getObjectFeed(ReadContext ctx)
             throws ContentManagerException {
         try {
-            return connector.getAPPContentManager().getIO().getObjectFeedReader().read(
-                    ctx, getStream());
+            return io.getObjectFeedReader().read(ctx, getStream());
         } catch (XMLStreamException e) {
             throw new ContentManagerException(e);
         }
@@ -155,8 +149,7 @@
     public Repository[] getServiceDocument(ReadContext ctx)
             throws ContentManagerException {
         try {
-            return connector.getAPPContentManager().getIO().getServiceDocumentReader().read(
-                    ctx, getStream());
+            return io.getServiceDocumentReader().read(ctx, getStream());
         } catch (IOException e) {
             throw new ContentManagerException(e);
         }

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientResponse.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/HttpClientResponse.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/IOProvider.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java?p2=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/IOProvider.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/IOProvider.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java Thu Jun 11 17:09:45 2009
@@ -14,20 +14,20 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.app;
+package org.apache.chemistry.atompub.client.connector;
 
 import java.util.List;
 import java.util.Map;
 
 import org.apache.chemistry.ObjectEntry;
 import org.apache.chemistry.Type;
-import org.apache.chemistry.atompub.client.common.atom.EntryReader;
-import org.apache.chemistry.atompub.client.common.atom.FeedReader;
-import org.apache.chemistry.atompub.client.common.atom.ServiceDocumentReader;
-import org.apache.chemistry.atompub.client.common.atom.XmlObjectWriter;
+import org.apache.chemistry.atompub.client.stax.EntryReader;
+import org.apache.chemistry.atompub.client.stax.FeedReader;
+import org.apache.chemistry.atompub.client.stax.ServiceDocumentReader;
+import org.apache.chemistry.atompub.client.stax.XmlObjectWriter;
 
 /**
- *
+ * This abstracts the operations used to read and write objects from XML streams.
  */
 public interface IOProvider {
 

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/IOProvider.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Request.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/Request.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Request.java?p2=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Request.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/Request.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/Request.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Request.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.app;
+package org.apache.chemistry.atompub.client.connector;
 
 import java.util.ArrayList;
 import java.util.List;

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Request.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Request.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Response.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/Response.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Response.java?p2=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Response.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/Response.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/app/Response.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Response.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.app;
+package org.apache.chemistry.atompub.client.connector;
 
 import java.io.InputStream;
 import java.util.List;
@@ -24,7 +24,7 @@
 import org.apache.chemistry.Repository;
 import org.apache.chemistry.Type;
 import org.apache.chemistry.atompub.client.ContentManagerException;
-import org.apache.chemistry.atompub.client.common.atom.ReadContext;
+import org.apache.chemistry.atompub.client.stax.ReadContext;
 
 /**
  *

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Response.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/connector/Response.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractEntryReader.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractEntryReader.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractEntryReader.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractEntryReader.java Thu Jun 11 17:09:45 2009
@@ -14,48 +14,25 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
+import org.apache.chemistry.atompub.Atom;
 import org.apache.chemistry.atompub.CMIS;
-import org.apache.chemistry.atompub.client.common.xml.ChildrenNavigator;
-import org.apache.chemistry.atompub.client.common.xml.StaxReader;
+import org.apache.chemistry.xml.stax.ChildrenNavigator;
+import org.apache.chemistry.xml.stax.StaxReader;
 
 /**
  *
  */
-public abstract class AbstractEntryReader<T> implements EntryReader<T>, ATOM {
+public abstract class AbstractEntryReader<T> implements EntryReader<T> {
 
     protected abstract T createObject(ReadContext ctx);
 
-    public T read(ReadContext ctx, File file) throws XMLStreamException,
-            IOException {
-        InputStream in = new FileInputStream(file);
-        try {
-            return read(ctx, in);
-        } finally {
-            in.close();
-        }
-    }
-
-    public T read(ReadContext ctx, URL url) throws XMLStreamException,
-            IOException {
-        InputStream in = url.openStream();
-        try {
-            return read(ctx, in);
-        } finally {
-            in.close();
-        }
-    }
-
     public T read(ReadContext ctx, InputStream in) throws XMLStreamException {
         return read(ctx, StaxReader.newReader(in));
     }
@@ -66,7 +43,7 @@
     }
 
     public T read(ReadContext ctx, StaxReader reader) throws XMLStreamException {
-        if (!reader.getFirstTag(ATOM.ENTRY)) {
+        if (!reader.getFirstTag(Atom.ATOM_ENTRY)) {
             return null;
         }
         T object = createObject(ctx);
@@ -88,7 +65,7 @@
 
     protected void readEntryElement(ReadContext ctx, StaxReader reader, T object)
             throws XMLStreamException {
-        if (reader.getNamespaceURI().equals(ATOM.ATOM_NS)) {
+        if (reader.getNamespaceURI().equals(Atom.ATOM_NS)) {
             readAtomElement(ctx, reader, object);
         } else {
             readExtensionElement(ctx, reader, object);

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractFeedReader.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractFeedReader.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractFeedReader.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractFeedReader.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -25,13 +25,14 @@
 
 import javax.xml.stream.XMLStreamException;
 
-import org.apache.chemistry.atompub.client.common.xml.ChildrenNavigator;
-import org.apache.chemistry.atompub.client.common.xml.StaxReader;
+import org.apache.chemistry.atompub.Atom;
+import org.apache.chemistry.xml.stax.ChildrenNavigator;
+import org.apache.chemistry.xml.stax.StaxReader;
 
 /**
  *
  */
-public abstract class AbstractFeedReader<T, E> implements FeedReader<T>, ATOM {
+public abstract class AbstractFeedReader<T, E> implements FeedReader<T> {
 
     protected EntryReader<E> entryBuilder;
 
@@ -90,7 +91,7 @@
     }
 
     public T read(ReadContext ctx, StaxReader reader) throws XMLStreamException {
-        if (!reader.getFirstTag(ATOM.FEED)) {
+        if (!reader.getFirstTag(Atom.ATOM_FEED)) {
             throw new XMLStreamException("Parse error: Not an atom feed");
         }
         // create a new feed object to be filled
@@ -98,7 +99,7 @@
         ChildrenNavigator nav = reader.getChildren();
         while (nav.next() && !isDone(ctx, reader)) {
             String nsUri = reader.getNamespaceURI();
-            if (ATOM.ATOM_NS.equals(nsUri)) {
+            if (Atom.ATOM_NS.equals(nsUri)) {
                 if ("entry".equals(reader.getLocalName())) {
                     addEntry(feed, entryBuilder.read(ctx, reader));
                 } else {

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractObjectReader.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractObjectReader.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractObjectReader.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractObjectReader.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import java.util.ArrayList;
 
@@ -23,9 +23,9 @@
 import org.apache.chemistry.Property;
 import org.apache.chemistry.Type;
 import org.apache.chemistry.atompub.CMIS;
-import org.apache.chemistry.atompub.client.common.xml.ChildrenNavigator;
-import org.apache.chemistry.atompub.client.common.xml.ParseException;
-import org.apache.chemistry.atompub.client.common.xml.StaxReader;
+import org.apache.chemistry.xml.stax.ChildrenNavigator;
+import org.apache.chemistry.xml.stax.ParseException;
+import org.apache.chemistry.xml.stax.StaxReader;
 
 /**
  *

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractXmlObjectWriter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractXmlObjectWriter.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractXmlObjectWriter.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/AbstractXmlObjectWriter.java Thu Jun 11 17:09:45 2009
@@ -14,16 +14,13 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
-import java.io.File;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.io.Writer;
 
-import org.apache.chemistry.atompub.client.common.xml.XMLWriter;
+import org.apache.chemistry.xml.stax.XMLWriter;
 
 /**
  *
@@ -32,23 +29,10 @@
 
     public abstract String getContentType();
 
-    public void write(T object, File file) throws IOException {
-        FileWriter w = new FileWriter(file);
-        try {
-            write(object, w);
-        } finally {
-            w.close();
-        }
-    }
-
     public void write(T object, OutputStream out) throws IOException {
         write(object, new XMLWriter(new OutputStreamWriter(out)));
     }
 
-    public void write(T object, Writer writer) throws IOException {
-        write(object, new XMLWriter(writer));
-    }
-
     public abstract void write(T object, XMLWriter writer) throws IOException;
 
 }

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/EntryReader.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/EntryReader.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/EntryReader.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/EntryReader.java Thu Jun 11 17:09:45 2009
@@ -14,27 +14,20 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
-import java.io.File;
-import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.chemistry.atompub.client.common.xml.StaxReader;
+import org.apache.chemistry.xml.stax.StaxReader;
 
 /**
  *
  */
 public interface EntryReader<T> {
 
-    T read(ReadContext ctx, URL url) throws XMLStreamException, IOException;
-
-    T read(ReadContext ctx, File file) throws XMLStreamException, IOException;
-
     T read(ReadContext ctx, InputStream in) throws XMLStreamException;
 
     T read(ReadContext ctx, XMLStreamReader xr) throws XMLStreamException;

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/FeedReader.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/FeedReader.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/FeedReader.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/FeedReader.java Thu Jun 11 17:09:45 2009
@@ -14,27 +14,19 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
-import java.io.File;
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
-import java.net.URL;
 
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 
-import org.apache.chemistry.atompub.client.common.xml.StaxReader;
+import org.apache.chemistry.xml.stax.StaxReader;
 
 /**
  *
  */
-public interface FeedReader<T> extends XMLStreamConstants, ATOM {
-
-    T read(ReadContext ctx, URL url) throws XMLStreamException, IOException;
-
-    T read(ReadContext ctx, File file) throws XMLStreamException, IOException;
+public interface FeedReader<T> {
 
     T read(ReadContext ctx, InputStream in) throws XMLStreamException;
 

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ObjectEntryWriter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ObjectEntryWriter.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ObjectEntryWriter.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ObjectEntryWriter.java Thu Jun 11 17:09:45 2009
@@ -14,15 +14,16 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import java.io.IOException;
 import java.util.Date;
 
 import org.apache.chemistry.ObjectEntry;
 import org.apache.chemistry.Property;
+import org.apache.chemistry.atompub.Atom;
 import org.apache.chemistry.atompub.CMIS;
-import org.apache.chemistry.atompub.client.common.xml.XMLWriter;
+import org.apache.chemistry.xml.stax.XMLWriter;
 
 /**
  *
@@ -39,7 +40,7 @@
     public void write(ObjectEntry object, XMLWriter xw) throws IOException {
         try {
             xw.start();
-            xw.element("entry").xmlns(ATOM.ATOM_NS).xmlns(CMIS.CMIS_PREFIX,
+            xw.element("entry").xmlns(Atom.ATOM_NS).xmlns(CMIS.CMIS_PREFIX,
                     CMIS.CMIS_NS);
             xw.start();
             // atom requires an ID to be set even on new created entries ..

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/PropertyIterator.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/PropertyIterator.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/PropertyIterator.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/PropertyIterator.java Thu Jun 11 17:09:45 2009
@@ -14,27 +14,28 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import java.util.ArrayList;
 
 import javax.xml.stream.XMLStreamException;
 
 import org.apache.chemistry.atompub.CMIS;
-import org.apache.chemistry.atompub.client.common.xml.ChildrenIterator;
-import org.apache.chemistry.atompub.client.common.xml.StaxReader;
+import org.apache.chemistry.xml.stax.ChildrenIterator;
+import org.apache.chemistry.xml.stax.StaxReader;
 
 /**
- * Iterate over property elements in the current CMIS object on the stream. Each
- * iteration produces a {@link XmlProperty} object. The returned object is not
- * yet ready to use since it have a null property definition. The property
+ * Iterate over property elements in the current CMIS object on the stream.
+ * <p>
+ * Each iteration produces a {@link XmlProperty} object. The returned object is
+ * not yet ready to use since it has a null property definition. The property
  * definition cannot be known before the object type is detected. This means the
- * caller is responsible to fill in the property definition as soon as it
+ * caller is responsible for filling in the property definition as soon as it
  * detects the object type. To be able to choose the right property definition
  * the caller must know the name of the property. This name will be passed
- * through the value member. The caller must reset this member to
- * {@link XmlProperty#NULL} after the property definition will be set on the
- * property.
+ * through the {@link XmlProperty#value} member. The caller must reset this
+ * member to {@link XmlProperty#NULL} after the property definition has been set
+ * on the property.
  */
 public class PropertyIterator extends ChildrenIterator<XmlProperty> {
 

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ReadContext.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ReadContext.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ReadContext.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ReadContext.java Thu Jun 11 17:09:45 2009
@@ -14,20 +14,17 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
-
-import java.util.HashMap;
+package org.apache.chemistry.atompub.client.stax;
 
 import org.apache.chemistry.Connection;
 import org.apache.chemistry.Repository;
 import org.apache.chemistry.Type;
+import org.apache.chemistry.atompub.client.ContentManager;
 
 /**
  *
  */
-public class ReadContext extends HashMap<Object, Object> {
-
-    private static final long serialVersionUID = 1L;
+public class ReadContext {
 
     protected Type type;
 
@@ -35,6 +32,8 @@
 
     protected Connection connection;
 
+    protected ContentManager contentManager;
+
     public ReadContext() {
 
     }
@@ -47,6 +46,10 @@
         this(repository, null);
     }
 
+    public ReadContext(ContentManager contentManager) {
+        this.contentManager = contentManager;
+    }
+
     public ReadContext(Repository repository, Type type) {
         this.type = type;
         this.repository = repository;
@@ -74,6 +77,10 @@
         return connection;
     }
 
+    public ContentManager getContentManager() {
+        return contentManager;
+    }
+
     public Type getType() {
         return type;
     }

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ServiceDocumentReader.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ServiceDocumentReader.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ServiceDocumentReader.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ServiceDocumentReader.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -31,12 +31,13 @@
 import org.apache.chemistry.QueryCapability;
 import org.apache.chemistry.Repository;
 import org.apache.chemistry.RepositoryInfo;
+import org.apache.chemistry.atompub.Atom;
 import org.apache.chemistry.atompub.CMIS;
-import org.apache.chemistry.atompub.client.app.model.APPRepository;
-import org.apache.chemistry.atompub.client.app.model.APPRepositoryCapabilities;
-import org.apache.chemistry.atompub.client.app.model.APPRepositoryInfo;
-import org.apache.chemistry.atompub.client.common.xml.ChildrenNavigator;
-import org.apache.chemistry.atompub.client.common.xml.StaxReader;
+import org.apache.chemistry.atompub.client.APPRepository;
+import org.apache.chemistry.atompub.client.APPRepositoryCapabilities;
+import org.apache.chemistry.atompub.client.APPRepositoryInfo;
+import org.apache.chemistry.xml.stax.ChildrenNavigator;
+import org.apache.chemistry.xml.stax.StaxReader;
 
 /**
  * Base class for service document reader implementations.
@@ -62,7 +63,7 @@
                 ChildrenNavigator children = reader.getChildren();
                 while (children.next()) {
                     QName name = reader.getName();
-                    if (name.equals(ATOM.COLLECTION)) {
+                    if (name.equals(Atom.APP_COLLECTION)) {
                         String href = reader.getAttributeValue("href");
                         String type = reader.getAttributeValue("collectionType");
                         addCollection(repo, href, type);

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ValueAdapter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ValueAdapter.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ValueAdapter.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ValueAdapter.java Thu Jun 11 17:09:45 2009
@@ -13,8 +13,9 @@
  *
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
+ *     Florent Guillaume, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -31,7 +32,7 @@
 import org.apache.chemistry.atompub.CMIS;
 
 /**
- *
+ * Adapter between a Java value and a XML String representation.
  */
 public abstract class ValueAdapter {
 
@@ -43,7 +44,7 @@
 
     public abstract QName getPropertyName();
 
-    public static final ValueAdapter STRING = new ValueAdapter() {
+    protected static final class StringValueAdapter extends ValueAdapter {
         @Override
         public Serializable readValue(String xml) {
             return xml;
@@ -63,12 +64,12 @@
         public QName getPropertyName() {
             return CMIS.PROPERTY_STRING;
         }
-    };
+    }
 
-    public static final ValueAdapter XML = new ValueAdapter() {
+    protected static final class DecimalValueAdapter extends ValueAdapter {
         @Override
         public Serializable readValue(String xml) {
-            return xml;
+            return new BigDecimal(xml);
         }
 
         @Override
@@ -78,19 +79,19 @@
 
         @Override
         public Serializable[] createArray(int size) {
-            return new String[size];
+            return new BigDecimal[size];
         }
 
         @Override
         public QName getPropertyName() {
-            return CMIS.PROPERTY_XML;
+            return CMIS.PROPERTY_DECIMAL;
         }
-    };
+    }
 
-    public static final ValueAdapter HTML = new ValueAdapter() {
+    protected static final class IntegerValueAdapter extends ValueAdapter {
         @Override
         public Serializable readValue(String xml) {
-            return xml;
+            return Integer.valueOf(xml);
         }
 
         @Override
@@ -100,16 +101,16 @@
 
         @Override
         public Serializable[] createArray(int size) {
-            return new String[size];
+            return new Integer[size];
         }
 
         @Override
         public QName getPropertyName() {
-            return CMIS.PROPERTY_HTML;
+            return CMIS.PROPERTY_INTEGER;
         }
-    };
+    }
 
-    public static final ValueAdapter BOOLEAN = new ValueAdapter() {
+    protected static final class BooleanValueAdapter extends ValueAdapter {
         @Override
         public Serializable readValue(String xml) {
             return Boolean.valueOf(xml);
@@ -129,34 +130,40 @@
         public QName getPropertyName() {
             return CMIS.PROPERTY_BOOLEAN;
         }
-    };
+    }
 
-    public static final ValueAdapter INTEGER = new ValueAdapter() {
+    protected static final class DateTimeValueAdapter extends ValueAdapter {
         @Override
         public Serializable readValue(String xml) {
-            return Integer.valueOf(xml);
+            return AtomDate.valueOf(xml).getCalendar();
         }
 
+        // accepts both Calendar and Date
         @Override
         public String writeValue(Serializable val) {
-            return val.toString();
+            return val.getClass() == Calendar.class ? AtomDate.format(((Calendar) val).getTime())
+                    : AtomDate.format((Date) val);
         }
 
         @Override
         public Serializable[] createArray(int size) {
-            return new Integer[size];
+            return new Calendar[size];
         }
 
         @Override
         public QName getPropertyName() {
-            return CMIS.PROPERTY_INTEGER;
+            return CMIS.PROPERTY_DATETIME;
         }
-    };
+    }
 
-    public static final ValueAdapter DECIMAL = new ValueAdapter() {
+    protected static final class UriValueAdapter extends ValueAdapter {
         @Override
         public Serializable readValue(String xml) {
-            return new BigDecimal(xml);
+            try {
+                return new URI(xml);
+            } catch (Exception e) {
+                throw new IllegalArgumentException("Invalid URI: " + xml);
+            }
         }
 
         @Override
@@ -166,40 +173,38 @@
 
         @Override
         public Serializable[] createArray(int size) {
-            return new BigDecimal[size];
+            return new String[size];
         }
 
         @Override
         public QName getPropertyName() {
-            return CMIS.PROPERTY_DECIMAL;
+            return CMIS.PROPERTY_URI;
         }
-    };
+    }
 
-    public static final ValueAdapter DATE = new ValueAdapter() {
+    protected static final class IdValueAdapter extends ValueAdapter {
         @Override
         public Serializable readValue(String xml) {
-            return AtomDate.valueOf(xml).getCalendar();
+            return xml;
         }
 
-        // accepts both Calendar and Date
         @Override
         public String writeValue(Serializable val) {
-            return val.getClass() == Calendar.class ? AtomDate.format(((Calendar) val).getTime())
-                    : AtomDate.format((Date) val);
+            return val.toString();
         }
 
         @Override
         public Serializable[] createArray(int size) {
-            return new Calendar[size];
+            return new String[size];
         }
 
         @Override
         public QName getPropertyName() {
-            return CMIS.PROPERTY_DATETIME;
+            return CMIS.PROPERTY_ID;
         }
-    };
+    }
 
-    public static final ValueAdapter ID = new ValueAdapter() {
+    protected static final class XmlValueAdapter extends ValueAdapter {
         @Override
         public Serializable readValue(String xml) {
             return xml;
@@ -217,18 +222,14 @@
 
         @Override
         public QName getPropertyName() {
-            return CMIS.PROPERTY_ID;
+            return CMIS.PROPERTY_XML;
         }
-    };
+    }
 
-    public static final ValueAdapter URI = new ValueAdapter() {
+    protected static final class HtmlValueAdapter extends ValueAdapter {
         @Override
         public Serializable readValue(String xml) {
-            try {
-                return new URI(xml);
-            } catch (Exception e) {
-                throw new IllegalArgumentException("Invalid URI: " + xml);
-            }
+            return xml;
         }
 
         @Override
@@ -243,64 +244,43 @@
 
         @Override
         public QName getPropertyName() {
-            return CMIS.PROPERTY_URI;
+            return CMIS.PROPERTY_HTML;
         }
-    };
+    }
 
-    private final static Map<String, ValueAdapter> adapters = new HashMap<String, ValueAdapter>();
-    static {
-        adapters.put("String", STRING);
-        adapters.put("Boolean", BOOLEAN);
-        adapters.put("Integer", INTEGER);
-        adapters.put("Decimal", DECIMAL);
-        adapters.put("DateTime", DATE);
-        adapters.put("Id", ID);
-        adapters.put("Uri", URI);
-        adapters.put("Xml", XML);
-        adapters.put("Html", HTML);
-
-        adapters.put("string", STRING);
-        adapters.put("boolean", BOOLEAN);
-        adapters.put("integer", INTEGER);
-        adapters.put("decimal", DECIMAL);
-        adapters.put("datetime", DATE);
-        adapters.put("id", ID);
-        adapters.put("uri", URI);
-        adapters.put("xml", XML);
-        adapters.put("html", HTML);
+    public static final ValueAdapter STRING = new StringValueAdapter();
 
-    }
+    public static final ValueAdapter DECIMAL = new DecimalValueAdapter();
 
-    public static void registerAdapter(String type, ValueAdapter va) {
-        adapters.put(type, va);
-    }
+    public static final ValueAdapter INTEGER = new IntegerValueAdapter();
+
+    public static final ValueAdapter BOOLEAN = new BooleanValueAdapter();
+
+    public static final ValueAdapter DATETIME = new DateTimeValueAdapter();
+
+    public static final ValueAdapter URI = new UriValueAdapter();
+
+    public static final ValueAdapter ID = new IdValueAdapter();
 
-    public static ValueAdapter getAdapter(String type) {
-        return adapters.get(type);
+    public static final ValueAdapter XML = new XmlValueAdapter();
+
+    public static final ValueAdapter HTML = new HtmlValueAdapter();
+
+    private final static Map<Integer, ValueAdapter> adapters = new HashMap<Integer, ValueAdapter>();
+    static {
+        adapters.put(Integer.valueOf(PropertyType.STRING_ORD), STRING);
+        adapters.put(Integer.valueOf(PropertyType.DECIMAL_ORD), DECIMAL);
+        adapters.put(Integer.valueOf(PropertyType.INTEGER_ORD), INTEGER);
+        adapters.put(Integer.valueOf(PropertyType.BOOLEAN_ORD), BOOLEAN);
+        adapters.put(Integer.valueOf(PropertyType.DATETIME_ORD), DATETIME);
+        adapters.put(Integer.valueOf(PropertyType.URI_ORD), URI);
+        adapters.put(Integer.valueOf(PropertyType.ID_ORD), ID);
+        adapters.put(Integer.valueOf(PropertyType.XML_ORD), XML);
+        adapters.put(Integer.valueOf(PropertyType.HTML_ORD), HTML);
     }
 
     public static ValueAdapter getAdapter(PropertyType type) {
-        switch (type.ordinal()) {
-        case PropertyType.STRING_ORD:
-            return ValueAdapter.STRING;
-        case PropertyType.BOOLEAN_ORD:
-            return ValueAdapter.BOOLEAN;
-        case PropertyType.DATETIME_ORD:
-            return ValueAdapter.DATE;
-        case PropertyType.ID_ORD:
-            return ValueAdapter.ID;
-        case PropertyType.INTEGER_ORD:
-            return ValueAdapter.INTEGER;
-        case PropertyType.URI_ORD:
-            return ValueAdapter.URI;
-        case PropertyType.DECIMAL_ORD:
-            return ValueAdapter.DECIMAL;
-        case PropertyType.XML_ORD:
-            return ValueAdapter.XML;
-        case PropertyType.HTML_ORD:
-            return ValueAdapter.HTML;
-        }
-        return null;
+        return adapters.get(Integer.valueOf(type.ordinal()));
     }
 
 }

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ValueIterator.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ValueIterator.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ValueIterator.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/ValueIterator.java Thu Jun 11 17:09:45 2009
@@ -14,13 +14,13 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import javax.xml.stream.XMLStreamException;
 
 import org.apache.chemistry.atompub.CMIS;
-import org.apache.chemistry.atompub.client.common.xml.ChildrenIterator;
-import org.apache.chemistry.atompub.client.common.xml.StaxReader;
+import org.apache.chemistry.xml.stax.ChildrenIterator;
+import org.apache.chemistry.xml.stax.StaxReader;
 
 /**
  *

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlObject.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlObject.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlObject.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlObject.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import java.io.Serializable;
 import java.util.HashMap;

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlObjectWriter.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlObjectWriter.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlObjectWriter.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlObjectWriter.java Thu Jun 11 17:09:45 2009
@@ -14,14 +14,12 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.Writer;
 
-import org.apache.chemistry.atompub.client.common.xml.XMLWriter;
+import org.apache.chemistry.xml.stax.XMLWriter;
 
 /**
  *
@@ -30,12 +28,8 @@
 
     String getContentType();
 
-    void write(T object, File file) throws IOException;
-
     void write(T object, OutputStream out) throws IOException;
 
-    void write(T object, Writer writer) throws IOException;
-
     void write(T object, XMLWriter writer) throws IOException;
 
 }

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlProperty.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlProperty.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlProperty.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/stax/XmlProperty.java Thu Jun 11 17:09:45 2009
@@ -13,8 +13,9 @@
  *
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
+ *     Florent Guillaume, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import java.io.Serializable;
 import java.util.List;
@@ -24,13 +25,19 @@
 import org.apache.chemistry.PropertyType;
 
 /**
- * Implementation of a CMIS property to be used when reading data from XML. This
- * implementation is creating value objects from the XML strings only when first
- * accessed, this ensure faster loading of big feeds.
+ * Implementation of a CMIS property to be used when reading data from XML.
+ * <p>
+ * This implementation is creating value objects from the XML strings only when
+ * first accessed, this ensures faster loading of big feeds.
  */
 public class XmlProperty implements Property {
 
-    protected static final String NULL = new String();
+    private static enum NoValue {
+        @SuppressWarnings("hiding")
+        NULL
+    };
+
+    public static final Serializable NULL = NoValue.NULL;
 
     protected PropertyDefinition def;
 
@@ -39,7 +46,6 @@
     protected Object xmlValue;
 
     public XmlProperty() {
-
     }
 
     public XmlProperty(PropertyDefinition def) {
@@ -57,32 +63,36 @@
     }
 
     /**
-     * Get the property name
-     *
-     * @return the property name
+     * Gets the property name.
      */
     public String getName() {
         return def.getName();
     }
 
     /**
-     * Get the property adapter which know how to convert the raw value into a
-     * suitable Java object
-     *
-     * @return
+     * Gets the property adapter which knows how to convert the raw value into a
+     * suitable Java object.
+     * <p>
+     * Only useable if a property definition has been set for this property.
      */
     public ValueAdapter getAdapter() {
+        if (def == null) {
+            throw new NullPointerException("No definition set for: " + this);
+        }
         return ValueAdapter.getAdapter(def.getType());
     }
 
     /**
-     * Get the property value. The returned object is either null either one of
-     * the following types: <li> <code>String</code> or <code>String[]</code> if
-     * an array <li> <code>Calendar</code> or <code>Calendar[]</code> if an array
-     * <li> <code>Boolean</code> or <code>Boolean[]</code> if an array <li>
-     * <code>Integer</code> or <code>Integer[]</code> if an array <li>
-     * <code>URI</code> or <code>URI[]</code> if an array <li>
-     * <code>BugDecimail</code> or <code>BigDecimal[]</code> if an array
+     * Gets the property value. The returned object is either {@code null} or
+     * one of the following types:
+     * <ul>
+     * <li> <code>String</code> or <code>String[]</code>
+     * <li> <code>Calendar</code> or <code>Calendar[]</code>
+     * <li> <code>Boolean</code> or <code>Boolean[]</code>
+     * <li> <code>Integer</code> or <code>Integer[]</code>
+     * <li> <code>URI</code> or <code>URI[]</code>
+     * <li> <code>BigDecimal</code> or <code>BigDecimal[]</code>
+     * </ul>
      */
     @SuppressWarnings("unchecked")
     public Serializable getValue() {
@@ -95,7 +105,7 @@
                     throw new IllegalArgumentException("Unknow property type: "
                             + def.getType());
                 }
-                if (xmlValue.getClass() == String.class) {
+                if (xmlValue instanceof String) {
                     if (def.isMultiValued()) {
                         Serializable[] ar = va.createArray(1);
                         ar[0] = va.readValue((String) xmlValue);
@@ -106,10 +116,8 @@
                 } else { // a list
                     List<String> list = (List<String>) xmlValue;
                     if (def.isMultiValued()) {
-                        if (def.getType() == PropertyType.STRING) { // optimization
-                            // for
-                            // string
-                            // lists
+                        if (def.getType() == PropertyType.STRING) {
+                            // optimization for string lists
                             value = list.toArray(va.createArray(list.size()));
                         } else {
                             Serializable[] ar = va.createArray(list.size());
@@ -122,7 +130,7 @@
                         // TODO throw an exception ?
                         throw new IllegalArgumentException(
                                 "Multiple value set on a scalar property: "
-                                        + getName());
+                                        + this);
                     }
                 }
             }
@@ -133,10 +141,8 @@
 
     public void setValue(Serializable value) {
         if (!def.validates(value)) {
-            throw new IllegalArgumentException("Not a valid value: " + value); // TODO
-            // use
-            // custom
-            // exceptions
+            throw new IllegalArgumentException("Not a valid value: " + value);
+            // TODO use custom exceptions
         }
         this.value = value;
     }
@@ -173,7 +179,8 @@
 
     @Override
     public String toString() {
-        return getName() + "=" + (xmlValue == null ? value : xmlValue);
+        return this.getClass().getSimpleName() + '(' + getName() + "="
+                + (xmlValue == null ? value : xmlValue) + ')';
     }
 
 }

Modified: incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/test/java/org/apache/chemistry/atompub/client/stax/TestPropertyIterator.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/test/java/org/apache/chemistry/atompub/client/stax/TestPropertyIterator.java?rev=783850&r1=783040&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/test/java/org/apache/chemistry/atompub/client/stax/TestPropertyIterator.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/test/java/org/apache/chemistry/atompub/client/stax/TestPropertyIterator.java Thu Jun 11 17:09:45 2009
@@ -15,7 +15,7 @@
  *     Bogdan Stefanescu, Nuxeo
  *     Florent Guillaume, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub.client.stax;
 
 import java.io.Serializable;
 import java.net.URL;
@@ -26,7 +26,9 @@
 import junit.framework.TestCase;
 
 import org.apache.chemistry.atompub.CMIS;
-import org.apache.chemistry.atompub.client.common.xml.StaxReader;
+import org.apache.chemistry.atompub.client.stax.PropertyIterator;
+import org.apache.chemistry.atompub.client.stax.XmlProperty;
+import org.apache.chemistry.xml.stax.StaxReader;
 
 /**
  *

Copied: incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/Atom.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/atom/ATOM.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/Atom.java?p2=incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/Atom.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/atom/ATOM.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/atom/ATOM.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/Atom.java Thu Jun 11 17:09:45 2009
@@ -14,24 +14,29 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.atom;
+package org.apache.chemistry.atompub;
 
 import javax.xml.namespace.QName;
 
 /**
- *
+ * Utility class providing various Atom- and AtomPub-related constants.
  */
-public interface ATOM {
+public class Atom {
 
-    public final static String APP_NS = "http://www.w3.org/2007/app";
+    // utility class
+    private Atom() {
+    }
 
-    public final static String ATOM_NS = "http://www.w3.org/2005/Atom";
+    public static final String ATOM_NS = "http://www.w3.org/2005/Atom";
 
-    public final static QName FEED = new QName(ATOM_NS, "feed");
+    public static final String APP_NS = "http://www.w3.org/2007/app";
 
-    public final static QName ENTRY = new QName(ATOM_NS, "entry");
+    public static final QName ATOM_FEED = new QName(ATOM_NS, "feed");
 
-    public final static QName LINK = new QName(ATOM_NS, "link");
+    public static final QName ATOM_ENTRY = new QName(ATOM_NS, "entry");
+
+    public static final QName ATOM_LINK = new QName(ATOM_NS, "link");
+
+    public static final QName APP_COLLECTION = new QName(APP_NS, "collection");
 
-    public final static QName COLLECTION = new QName(APP_NS, "collection");
 }

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/Atom.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-atompub/src/main/java/org/apache/chemistry/atompub/Atom.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/pom.xml
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/pom.xml?rev=783850&r1=783849&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/pom.xml (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/pom.xml Thu Jun 11 17:09:45 2009
@@ -33,6 +33,10 @@
       <groupId>org.apache.chemistry</groupId>
       <artifactId>chemistry-api</artifactId>
     </dependency>
+    <dependency>
+      <groupId>stax</groupId>
+      <artifactId>stax-api</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>junit</groupId>

Modified: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimplePropertyDefinition.java
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimplePropertyDefinition.java?rev=783850&r1=783849&r2=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimplePropertyDefinition.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/impl/simple/SimplePropertyDefinition.java Thu Jun 11 17:09:45 2009
@@ -18,9 +18,7 @@
 
 import java.io.Serializable;
 import java.lang.reflect.Array;
-import java.math.BigDecimal;
 import java.net.URI;
-import java.util.Calendar;
 import java.util.Collections;
 import java.util.List;
 
@@ -206,34 +204,8 @@
             return multi ? "Property is multi-valued"
                     : "Property is single-valued";
         }
-        Class<?> klass;
-        switch (type.ordinal()) {
-        case PropertyType.STRING_ORD:
-        case PropertyType.ID_ORD:
-            klass = String.class;
-            break;
-        case PropertyType.DECIMAL_ORD:
-            klass = BigDecimal.class;
-            break;
-        case PropertyType.INTEGER_ORD:
-            klass = Integer.class; // TODO Long
-            break;
-        case PropertyType.BOOLEAN_ORD:
-            klass = Boolean.class;
-            break;
-        case PropertyType.DATETIME_ORD:
-            klass = Calendar.class;
-            break;
-        case PropertyType.URI_ORD:
-            klass = URI.class;
-            break;
-        case PropertyType.XML_ORD:
-            klass = String.class; // TODO
-            break;
-        case PropertyType.HTML_ORD:
-            klass = String.class; // TODO
-            break;
-        default:
+        Class<?> klass = type.klass();
+        if (klass == null) {
             throw new UnsupportedOperationException(type.toString());
         }
         if (multi) {

Copied: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenIterator.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ChildrenIterator.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenIterator.java?p2=incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenIterator.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ChildrenIterator.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ChildrenIterator.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenIterator.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.xml;
+package org.apache.chemistry.xml.stax;
 
 import javax.xml.stream.XMLStreamException;
 

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenIterator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenNavigator.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ChildrenNavigator.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenNavigator.java?p2=incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenNavigator.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ChildrenNavigator.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ChildrenNavigator.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenNavigator.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.xml;
+package org.apache.chemistry.xml.stax;
 
 import javax.xml.stream.XMLStreamException;
 

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenNavigator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ChildrenNavigator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ElementIterator.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ElementIterator.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ElementIterator.java?p2=incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ElementIterator.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ElementIterator.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ElementIterator.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ElementIterator.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.xml;
+package org.apache.chemistry.xml.stax;
 
 import java.util.Iterator;
 import java.util.NoSuchElementException;

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ElementIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ElementIterator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/FilteredChildrenNavigator.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/FilteredChildrenNavigator.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/FilteredChildrenNavigator.java?p2=incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/FilteredChildrenNavigator.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/FilteredChildrenNavigator.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/FilteredChildrenNavigator.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/FilteredChildrenNavigator.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.xml;
+package org.apache.chemistry.xml.stax;
 
 import javax.xml.stream.XMLStreamException;
 

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/FilteredChildrenNavigator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/FilteredChildrenNavigator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ParseException.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ParseException.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ParseException.java?p2=incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ParseException.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ParseException.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/ParseException.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ParseException.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.xml;
+package org.apache.chemistry.xml.stax;
 
 import javax.xml.stream.XMLStreamReader;
 

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ParseException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/ParseException.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/SiblingsIterator.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/SiblingsIterator.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/SiblingsIterator.java?p2=incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/SiblingsIterator.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/SiblingsIterator.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/SiblingsIterator.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/SiblingsIterator.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.xml;
+package org.apache.chemistry.xml.stax;
 
 import javax.xml.stream.XMLStreamException;
 

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/SiblingsIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/SiblingsIterator.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/StaxReader.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/StaxReader.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/StaxReader.java?p2=incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/StaxReader.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/StaxReader.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/StaxReader.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/StaxReader.java Thu Jun 11 17:09:45 2009
@@ -14,7 +14,7 @@
  * Authors:
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.xml;
+package org.apache.chemistry.xml.stax;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/StaxReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/StaxReader.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/XMLWriter.java (from r783040, incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/XMLWriter.java)
URL: http://svn.apache.org/viewvc/incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/XMLWriter.java?p2=incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/XMLWriter.java&p1=incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/XMLWriter.java&r1=783040&r2=783850&rev=783850&view=diff
==============================================================================
--- incubator/chemistry/trunk/chemistry/chemistry-atompub-client/src/main/java/org/apache/chemistry/atompub/client/common/xml/XMLWriter.java (original)
+++ incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/XMLWriter.java Thu Jun 11 17:09:45 2009
@@ -15,7 +15,7 @@
  *     Original org.apache.commons.betwixt.XMLUtils authors
  *     Bogdan Stefanescu, Nuxeo
  */
-package org.apache.chemistry.atompub.client.common.xml;
+package org.apache.chemistry.xml.stax;
 
 import java.io.IOException;
 import java.io.Writer;
@@ -27,14 +27,14 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.chemistry.atompub.client.common.DateParser;
-
 // This file contains code from org.apache.commons.betwixt.XMLUtils
 /**
  *
  */
 public class XMLWriter {
 
+    private static final TimeZone TIMEZONE_UTC = TimeZone.getTimeZone("GMT");
+
     protected static String CRLF = System.getProperty("line.separator");
 
     protected int indent;
@@ -241,7 +241,7 @@
     }
 
     public XMLWriter content(Date value) throws IOException {
-        return content(DateParser.formatW3CDateTime(value));
+        return content(formatDate(value));
     }
 
     public XMLWriter text(String text) throws IOException {
@@ -298,7 +298,7 @@
     }
 
     public XMLWriter date(Date value) throws IOException {
-        writer.write(format(value));
+        writer.write(formatDate(value));
         writer.write("\"");
         return this;
     }
@@ -384,9 +384,16 @@
         return date(resolve(name), value);
     }
 
-    public static String format(Date date) {
+    /**
+     * Formats a Date in the JSR-170 format (subset of RFC3339, itself a subset
+     * of ISO8601): {@code YYYY-MM-DDThh:mm:ss.sssZ}
+     *
+     * @param date the date
+     * @return the formatted date
+     */
+    public static String formatDate(Date date) {
         StringBuilder sb = new StringBuilder(24);
-        Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+        Calendar c = Calendar.getInstance(TIMEZONE_UTC);
         c.setTime(date);
         sb.append(c.get(Calendar.YEAR));
         sb.append('-');

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/XMLWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/chemistry/trunk/chemistry/chemistry-commons/src/main/java/org/apache/chemistry/xml/stax/XMLWriter.java
------------------------------------------------------------------------------
    svn:keywords = Id