cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r515734 [8/11] - in /incubator/cxf/trunk/rt: ./ core/src/main/java/org/apache/cxf/endpoint/ databinding/aegis/ databinding/aegis/src/ databinding/aegis/src/main/ databinding/aegis/src/main/java/ databinding/aegis/src/main/java/org/ databind...
Date Wed, 07 Mar 2007 20:20:15 GMT
Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/stax/W3CNamespaceContext.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/stax/W3CNamespaceContext.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/stax/W3CNamespaceContext.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/stax/W3CNamespaceContext.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/**
+ * 
+ */
+package org.apache.cxf.aegis.util.stax;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.NamespaceContext;
+
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+public class W3CNamespaceContext implements NamespaceContext {
+    private Element currentNode;
+
+    public String getNamespaceURI(String prefix) {
+        String name = prefix;
+        if (name.length() == 0) {
+            name = "xmlns";
+        } else {
+            name = "xmlns:" + prefix;
+        }
+
+        return getNamespaceURI(currentNode, name);
+    }
+
+    private String getNamespaceURI(Element e, String name) {
+        Attr attr = e.getAttributeNode(name);
+        if (attr == null) {
+            Node n = e.getParentNode();
+            if (n instanceof Element && n != e) {
+                return getNamespaceURI((Element)n, name);
+            }
+        } else {
+            return attr.getValue();
+        }
+
+        return null;
+    }
+
+    public String getPrefix(String uri) {
+        return getPrefix(currentNode, uri);
+    }
+
+    private String getPrefix(Element e, String uri) {
+        NamedNodeMap attributes = e.getAttributes();
+        if (attributes != null) {
+            for (int i = 0; i < attributes.getLength(); i++) {
+                Attr a = (Attr)attributes.item(i);
+
+                String val = a.getValue();
+                if (val != null && val.equals(uri)) {
+                    String name = a.getNodeName();
+                    if (name.equals("xmlns")) {
+                        return "";
+                    } else {
+                        return name.substring(6);
+                    }
+                }
+            }
+        }
+
+        Node n = e.getParentNode();
+        if (n instanceof Element && n != e) {
+            return getPrefix((Element)n, uri);
+        }
+
+        return null;
+    }
+
+    public Iterator<String> getPrefixes(String uri) {
+        List<String> prefixes = new ArrayList<String>();
+
+        String prefix = getPrefix(uri);
+        if (prefix != null) {
+            prefixes.add(prefix);
+        }
+
+        return prefixes.iterator();
+    }
+
+    public Element getElement() {
+        return currentNode;
+    }
+
+    public void setElement(Element currentNode) {
+        this.currentNode = currentNode;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/stax/W3CNamespaceContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/util/stax/W3CNamespaceContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,139 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.cxf.aegis.DatabindingException;
+import org.apache.cxf.aegis.util.XmlConstants;
+
+/**
+ * Basic type conversions for reading messages.
+ * 
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public abstract class AbstractMessageReader implements MessageReader {
+    private static final QName XSI_NIL = new QName(XmlConstants.XSI_NS, "nil", XmlConstants.XSI_PREFIX);
+
+    public AbstractMessageReader() {
+    }
+
+    public void readToEnd() {
+        readToEnd(this);
+    }
+
+    private void readToEnd(MessageReader childReader) {
+        while (childReader.hasMoreElementReaders()) {
+            readToEnd(childReader.getNextElementReader());
+        }
+    }
+
+    public boolean isXsiNil() {
+        MessageReader nilReader = getAttributeReader(XSI_NIL);
+        boolean nil = false;
+        if (nilReader != null) {
+            String value = nilReader.getValue();
+            if (value != null && (value.equals("true") || value.equals("1"))) {
+                return true;
+            }
+        }
+
+        return nil;
+    }
+
+    public boolean hasValue() {
+        return getValue() != null;
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageReader#getValueAsCharacter()
+     */
+    public char getValueAsCharacter() {
+        if (getValue() == null) {
+            return 0;
+        }
+        return getValue().charAt(0);
+    }
+
+    public int getValueAsInt() {
+        if (getValue() == null) {
+            return 0;
+        }
+
+        return Integer.parseInt(getValue());
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageReader#getValueAsLong()
+     */
+    public long getValueAsLong() {
+        if (getValue() == null) {
+            return 0l;
+        }
+
+        return Long.parseLong(getValue());
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageReader#getValueAsDouble()
+     */
+    public double getValueAsDouble() {
+        if (getValue() == null) {
+            return 0d;
+        }
+
+        return Double.parseDouble(getValue());
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageReader#getValueAsFloat()
+     */
+    public float getValueAsFloat() {
+        if (getValue() == null) {
+            return 0f;
+        }
+
+        return Float.parseFloat(getValue());
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageReader#getValueAsBoolean()
+     */
+    public boolean getValueAsBoolean() {
+        String value = getValue();
+        if (value == null) {
+            return false;
+        }
+
+        if ("true".equalsIgnoreCase(value) || "1".equalsIgnoreCase(value)) {
+            return true;
+        }
+
+        if ("false".equalsIgnoreCase(value) || "0".equalsIgnoreCase(value)) {
+            return false;
+        }
+
+        throw new DatabindingException("Invalid boolean value: " + value);
+    }
+
+    public XMLStreamReader getXMLStreamReader() {
+        throw new UnsupportedOperationException();
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.aegis.util.XmlConstants;
+
+/**
+ * Basic type conversion functionality for writing messages.
+ * 
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public abstract class AbstractMessageWriter implements MessageWriter {
+    /**
+     * Create a LiteralWriter but without writing an element name.
+     * 
+     * @param writer
+     */
+    public AbstractMessageWriter() {
+    }
+
+    public void writeXsiType(QName type) {
+
+        /*
+         * Do not assume that the prefix supplied with the QName should be used
+         * in this case.
+         */
+        String prefix = getPrefixForNamespace(type.getNamespaceURI(), type.getPrefix());
+        String value;
+        if (prefix != null && prefix.length() > 0) {
+            StringBuffer sb = new StringBuffer(prefix.length() + 1 + type.getLocalPart().length());
+            sb.append(prefix);
+            sb.append(':');
+            sb.append(type.getLocalPart());
+            value = sb.toString();
+        } else {
+            value = type.getLocalPart();
+        }
+        getAttributeWriter("type", XmlConstants.XSI_NS).writeValue(value);
+    }
+
+    public void writeXsiNil() {
+        MessageWriter attWriter = getAttributeWriter("nil", XmlConstants.XSI_NS);
+        attWriter.writeValue("true");
+        attWriter.close();
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageWriter#writeValueAsInt(java.lang.Integer)
+     */
+    public void writeValueAsInt(Integer i) {
+        writeValue(i.toString());
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageWriter#writeValueAsDouble(java.lang.Double)
+     */
+    public void writeValueAsDouble(Double d) {
+        writeValue(d.toString());
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageWriter#writeValueAsCharacter(java.lang.Character)
+     */
+    public void writeValueAsCharacter(Character char1) {
+        writeValue(char1.toString());
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageWriter#writeValueAsLong(java.lang.Long)
+     */
+    public void writeValueAsLong(Long l) {
+        writeValue(l.toString());
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageWriter#writeValueAsFloat(java.lang.Float)
+     */
+    public void writeValueAsFloat(Float f) {
+        writeValue(f.toString());
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageWriter#writeValueAsBoolean(boolean)
+     */
+    public void writeValueAsBoolean(boolean b) {
+        writeValue(b ? "true" : "false");
+    }
+
+    public void writeValueAsShort(Short s) {
+        writeValue(s.toString());
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/AbstractMessageWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageReader.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageReader.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageReader.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+/**
+ * A MessageReader. You must call getNextChildReader() until
+ * hasMoreChildReaders() returns false.
+ * 
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public interface MessageReader {
+    public String getValue();
+
+    public boolean isXsiNil();
+
+    public int getValueAsInt();
+
+    public long getValueAsLong();
+
+    public double getValueAsDouble();
+
+    public float getValueAsFloat();
+
+    public boolean getValueAsBoolean();
+
+    public char getValueAsCharacter();
+
+    public MessageReader getAttributeReader(QName qName);
+
+    public boolean hasMoreAttributeReaders();
+
+    public MessageReader getNextAttributeReader();
+
+    public boolean hasMoreElementReaders();
+
+    public MessageReader getNextElementReader();
+
+    public QName getName();
+
+    /**
+     * Get the local name of the element this reader represents.
+     * 
+     * @return Local Name
+     */
+    public String getLocalName();
+
+    /**
+     * @return Namespace
+     */
+    public String getNamespace();
+
+    public String getNamespaceForPrefix(String prefix);
+
+    public XMLStreamReader getXMLStreamReader();
+
+    public void readToEnd();
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageWriter.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageWriter.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageWriter.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Writes messages to an output stream.
+ * 
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public interface MessageWriter {
+    void writeValue(Object value);
+
+    void writeValueAsInt(Integer i);
+
+    void writeValueAsCharacter(Character char1);
+
+    void writeValueAsDouble(Double double1);
+
+    void writeValueAsLong(Long l);
+
+    void writeValueAsFloat(Float f);
+
+    void writeValueAsShort(Short short1);
+
+    void writeValueAsBoolean(boolean b);
+
+    MessageWriter getAttributeWriter(String name);
+
+    MessageWriter getAttributeWriter(String name, String namespace);
+
+    MessageWriter getAttributeWriter(QName qname);
+
+    MessageWriter getElementWriter(String name);
+
+    MessageWriter getElementWriter(String name, String namespace);
+
+    MessageWriter getElementWriter(QName qname);
+
+    String getPrefixForNamespace(String namespace);
+
+    /**
+     * Get a prefix for a namespace. After calling this, the prefix returned is
+     * registered with the namespace. <p/> This method will make an attempt to
+     * use the hint prefix if possible. If the namespace is already registered
+     * or the hint is already registered with a different namespace then the
+     * behavior will be the same as the non-hint version.
+     * 
+     * @param namespace the namespace to retrieve the prefix for
+     * @param hint the hint for the prefix.
+     * @return the prefix associated with the namespace
+     */
+    String getPrefixForNamespace(String namespace, String hint);
+
+    /**
+     * Tells the MessageWriter that writing operations are completed so it can
+     * write the end element.
+     */
+    void close();
+
+    /**
+     * As per <a href="http://www.w3.org/TR/xmlschema-1/#xsi_type">2.6.1</a> in
+     * XML Schema Part 1: "An element information item in an instance may,
+     * however, explicitly assert its type using the attribute
+     * <code>xsi:type</code>."
+     * 
+     * @param type the QName of the type being referenced.
+     */
+    void writeXsiType(QName qn);
+
+    void writeXsiNil();
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/MessageWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/AttributeWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/AttributeWriter.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/AttributeWriter.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/AttributeWriter.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml.jdom;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.aegis.xml.AbstractMessageWriter;
+import org.apache.cxf.aegis.xml.MessageWriter;
+import org.jdom.Attribute;
+
+public class AttributeWriter extends AbstractMessageWriter {
+    private Attribute att;
+
+    public AttributeWriter(Attribute att) {
+        this.att = att;
+    }
+
+    public void writeValue(Object value) {
+        att.setValue(value.toString());
+    }
+
+    public MessageWriter getAttributeWriter(String name) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getAttributeWriter(String name, String namespace) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getAttributeWriter(QName qname) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getElementWriter(String name) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getElementWriter(String name, String namespace) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getElementWriter(QName qname) {
+        throw new IllegalStateException();
+    }
+
+    public String getPrefixForNamespace(String namespace) {
+        throw new IllegalStateException();
+    }
+
+    public String getPrefixForNamespace(String namespace, String hint) {
+        throw new IllegalStateException();
+    }
+
+    public void close() {
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/AttributeWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/AttributeWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMReader.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMReader.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMReader.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml.jdom;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.cxf.aegis.util.stax.JDOMStreamReader;
+import org.apache.cxf.aegis.xml.AbstractMessageReader;
+import org.apache.cxf.aegis.xml.MessageReader;
+import org.apache.cxf.aegis.xml.stax.AttributeReader;
+import org.jdom.Attribute;
+import org.jdom.Element;
+import org.jdom.Namespace;
+
+public class JDOMReader extends AbstractMessageReader implements MessageReader {
+    private Element element;
+    private int currentChild = 0;
+    private int currentAttribute = 0;
+    private List elements;
+    private QName qname;
+
+    public JDOMReader(Element element) {
+        this.element = element;
+        this.elements = element.getChildren();
+    }
+
+    public String getValue() {
+        return element.getValue();
+    }
+
+    public String getValue(String ns, String attr) {
+        return element.getAttributeValue(attr, ns);
+    }
+
+    public boolean hasMoreElementReaders() {
+        return (currentChild < elements.size());
+    }
+
+    public MessageReader getNextElementReader() {
+        currentChild++;
+        return new JDOMReader((Element)elements.get(currentChild - 1));
+    }
+
+    public QName getName() {
+        if (qname == null) {
+            qname = new QName(element.getNamespaceURI(), element.getName(), element.getNamespacePrefix());
+        }
+        return qname;
+    }
+
+    public String getLocalName() {
+        return element.getName();
+    }
+
+    public String getNamespace() {
+        return element.getNamespaceURI();
+    }
+
+    @Override
+    public XMLStreamReader getXMLStreamReader() {
+        return new JDOMStreamReader(element);
+    }
+
+    public boolean hasMoreAttributeReaders() {
+        return (currentAttribute < element.getAttributes().size());
+    }
+
+    public MessageReader getAttributeReader(QName attName) {
+        String value = element.getAttributeValue(attName.getLocalPart(), Namespace.getNamespace(attName
+            .getNamespaceURI()));
+        return new AttributeReader(attName, value);
+    }
+
+    public MessageReader getNextAttributeReader() {
+        Attribute att = (Attribute)element.getAttributes().get(currentAttribute);
+        currentAttribute++;
+
+        return new AttributeReader(new QName(att.getNamespaceURI(), att.getName()), att.getValue());
+    }
+
+    public String getNamespaceForPrefix(String prefix) {
+        Namespace namespace = element.getNamespace(prefix);
+        return null == namespace ? null : namespace.getURI();
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMWriter.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMWriter.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMWriter.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,104 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml.jdom;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.cxf.aegis.util.NamespaceHelper;
+import org.apache.cxf.aegis.xml.AbstractMessageWriter;
+import org.apache.cxf.aegis.xml.MessageWriter;
+import org.jdom.Attribute;
+import org.jdom.Element;
+import org.jdom.Namespace;
+
+public class JDOMWriter extends AbstractMessageWriter {
+    private Element element;
+
+    public JDOMWriter(Element element) {
+        this.element = element;
+    }
+
+    public void writeValue(Object value) {
+        element.addContent(value.toString());
+    }
+
+    public void writeValue(Object value, String ns, String attr) {
+        String prefix = NamespaceHelper.getUniquePrefix(element, ns);
+
+        element.setAttribute(new Attribute(attr, value.toString(), Namespace.getNamespace(prefix, ns)));
+    }
+
+    public MessageWriter getElementWriter(String name) {
+        return getElementWriter(name, element.getNamespaceURI());
+    }
+
+    public MessageWriter getElementWriter(String name, String namespace) {
+        String prefix = NamespaceHelper.getUniquePrefix(element, namespace);
+
+        Element child = new Element(name, Namespace.getNamespace(prefix, namespace));
+        element.addContent(child);
+
+        return new JDOMWriter(child);
+    }
+
+    public MessageWriter getElementWriter(QName qname) {
+        return getElementWriter(qname.getLocalPart(), qname.getNamespaceURI());
+    }
+
+    public String getPrefixForNamespace(String namespace) {
+        return NamespaceHelper.getUniquePrefix(element, namespace);
+    }
+
+    public XMLStreamWriter getXMLStreamWriter() {
+        throw new UnsupportedOperationException("Stream writing not supported from a JDOMWriter.");
+    }
+
+    public String getPrefixForNamespace(String namespace, String hint) {
+        // todo: this goes for the option of ignoring the hint - we should
+        // probably at least attempt to honour it
+        return NamespaceHelper.getUniquePrefix(element, namespace);
+    }
+
+    public MessageWriter getAttributeWriter(String name) {
+        Attribute att = new Attribute(name, "", element.getNamespace());
+        element.setAttribute(att);
+        return new AttributeWriter(att);
+    }
+
+    public MessageWriter getAttributeWriter(String name, String namespace) {
+        Attribute att;
+        if (namespace != null && namespace.length() > 0) {
+            String prefix = NamespaceHelper.getUniquePrefix(element, namespace);
+            att = new Attribute(name, "", Namespace.getNamespace(prefix, namespace));
+        } else {
+            att = new Attribute(name, "");
+        }
+
+        element.setAttribute(att);
+        return new AttributeWriter(att);
+    }
+
+    public MessageWriter getAttributeWriter(QName qname) {
+        return getAttributeWriter(qname.getLocalPart(), qname.getNamespaceURI());
+    }
+
+    public void close() {
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/jdom/JDOMWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeReader.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeReader.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeReader.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,78 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml.stax;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.aegis.xml.AbstractMessageReader;
+import org.apache.cxf.aegis.xml.MessageReader;
+
+public class AttributeReader extends AbstractMessageReader {
+    private QName name;
+    private String value;
+
+    public AttributeReader(QName name, String value) {
+        this.name = name;
+        this.value = value;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public boolean hasMoreAttributeReaders() {
+        return false;
+    }
+
+    public MessageReader getNextAttributeReader() {
+        throw new IllegalStateException();
+    }
+
+    public MessageReader getAttributeReader(QName qName) {
+        throw new IllegalStateException();
+    }
+
+    public MessageReader getAttributeReader(String n, String namespace) {
+        throw new IllegalStateException();
+    }
+
+    public boolean hasMoreElementReaders() {
+        return false;
+    }
+
+    public MessageReader getNextElementReader() {
+        throw new IllegalStateException();
+    }
+
+    public QName getName() {
+        return name;
+    }
+
+    public String getLocalName() {
+        return name.getLocalPart();
+    }
+
+    public String getNamespace() {
+        return name.getNamespaceURI();
+    }
+
+    public String getNamespaceForPrefix(String prefix) {
+        throw new IllegalStateException();
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeWriter.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeWriter.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeWriter.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml.stax;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.cxf.aegis.DatabindingException;
+import org.apache.cxf.aegis.util.NamespaceHelper;
+import org.apache.cxf.aegis.xml.AbstractMessageWriter;
+import org.apache.cxf.aegis.xml.MessageWriter;
+
+public class AttributeWriter extends AbstractMessageWriter {
+    private XMLStreamWriter writer;
+    private String namespace;
+    private String name;
+    private String prefix;
+
+    public AttributeWriter(XMLStreamWriter writer, String name, String namespace) {
+        this.writer = writer;
+        this.name = name;
+        this.namespace = namespace;
+
+        try {
+            if (namespace != null && namespace.length() > 0) {
+                prefix = NamespaceHelper.getUniquePrefix(writer, namespace, true);
+            } else {
+                prefix = "";
+            }
+        } catch (XMLStreamException e) {
+            throw new DatabindingException("Couldn't write to stream.");
+        }
+    }
+
+    public void writeValue(Object value) {
+        try {
+            writer.writeAttribute(prefix, namespace, name, value.toString());
+        } catch (XMLStreamException e) {
+            throw new DatabindingException("Error writing document.", e);
+        }
+    }
+
+    public MessageWriter getAttributeWriter(String name) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getAttributeWriter(String name, String namespace) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getAttributeWriter(QName qname) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getElementWriter(String name) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getElementWriter(String name, String namespace) {
+        throw new IllegalStateException();
+    }
+
+    public MessageWriter getElementWriter(QName qname) {
+        throw new IllegalStateException();
+    }
+
+    public String getPrefixForNamespace(String namespace) {
+        throw new IllegalStateException();
+    }
+
+    public String getPrefixForNamespace(String namespace, String hint) {
+        throw new IllegalStateException();
+    }
+
+    public void close() {
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/AttributeWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,268 @@
+package org.apache.cxf.aegis.xml.stax;
+
+import java.io.InputStream;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.cxf.aegis.DatabindingException;
+import org.apache.cxf.aegis.util.STAXUtils;
+import org.apache.cxf.aegis.util.XmlConstants;
+import org.apache.cxf.aegis.util.stax.DepthXMLStreamReader;
+import org.apache.cxf.aegis.xml.AbstractMessageReader;
+import org.apache.cxf.aegis.xml.MessageReader;
+
+/**
+ * Reads literal encoded messages.
+ * 
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public class ElementReader
+    extends AbstractMessageReader
+    implements MessageReader
+{
+    private static final Pattern QNAME_PATTERN = Pattern.compile("([^:]+):([^:]+)");
+
+    private DepthXMLStreamReader root;
+
+    private String value;
+
+    private String localName;
+
+    private QName name;
+
+    private QName xsiType;
+
+    private boolean hasCheckedChildren = false;
+
+    private boolean hasChildren = false;
+    
+    private String namespace;
+
+    private int depth;
+
+    private int currentAttribute = 0;
+
+    /**
+     * @param root
+     */
+    public ElementReader(DepthXMLStreamReader root)
+    {
+        this.root = root;
+        this.localName = root.getLocalName();
+        this.name = root.getName();
+        this.namespace = root.getNamespaceURI();
+
+        extractXsiType();
+
+        depth = root.getDepth();
+    }
+
+    public ElementReader(XMLStreamReader reader)
+    {
+        this(new DepthXMLStreamReader(reader));
+    }
+
+    /**
+     * @param is
+     * @throws XMLStreamException
+     */
+    public ElementReader(InputStream is) throws XMLStreamException
+    {
+        // XMLInputFactory factory = XMLInputFactory.newInstance();
+        // XMLStreamReader xmlReader = factory.createXMLStreamReader(is);
+        XMLStreamReader xmlReader = STAXUtils.createXMLStreamReader(is, null, null);
+
+        xmlReader.nextTag();
+
+        this.root = new DepthXMLStreamReader(xmlReader);
+        this.localName = root.getLocalName();
+        this.name = root.getName();
+        this.namespace = root.getNamespaceURI();
+
+        extractXsiType();
+
+        depth = root.getDepth();
+    }
+
+    private void extractXsiType()
+    {
+        /*
+         * We're making a conscious choice here -- garbage in == garbate out.
+         */
+        String xsiTypeQname = root.getAttributeValue(XmlConstants.XSI_NS, "type");
+        if (xsiTypeQname != null)
+        {
+            Matcher m = QNAME_PATTERN.matcher(xsiTypeQname);
+            if (m.matches())
+            {
+                NamespaceContext nc = root.getNamespaceContext();
+                this.xsiType = new QName(nc.getNamespaceURI(m.group(1)), m.group(2), m.group(1));
+            }
+            else
+            {
+                this.xsiType = new QName(this.namespace, xsiTypeQname, "");
+            }
+        }
+    }
+
+    /**
+     * @see org.codehaus.xfire.aegis.MessageReader#getValue()
+     */
+    public String getValue()
+    {
+        if (value == null) 
+        {
+            try
+            {
+                value = root.getElementText();
+
+                while (checkHasMoreChildReaders()) {}
+            }
+            catch (XMLStreamException e)
+            {
+                throw new DatabindingException("Could not read XML stream.", e);
+            }
+        }
+        return value.trim();
+    }
+
+    public String getValue(String ns, String attr)
+    {
+        return root.getAttributeValue(ns, attr);
+    }
+
+    public boolean hasMoreElementReaders()
+    {
+        // Check to see if we checked before,
+        // so we don't mess up the stream position.
+        if (!hasCheckedChildren)
+            checkHasMoreChildReaders();
+
+        return hasChildren;
+    }
+
+    private boolean checkHasMoreChildReaders()
+    {
+        try
+        {
+            int event = root.getEventType();
+            while (root.hasNext())
+            {
+                switch (event)
+                {
+                case XMLStreamReader.START_ELEMENT:
+                    if (root.getDepth() > depth)
+                    {
+                        hasCheckedChildren = true;
+                        hasChildren = true;
+
+                        return true;
+                    }
+                    break;
+                case XMLStreamReader.END_ELEMENT:
+                    if (root.getDepth() <= depth + 1)
+                    {
+                        hasCheckedChildren = true;
+                        hasChildren = false;
+
+                        if (root.hasNext())
+                        {
+                            root.next();
+                        }
+                        return false;
+                    }
+                    break;
+                case XMLStreamReader.END_DOCUMENT:
+                    // We should never get here...
+                    hasCheckedChildren = true;
+                    hasChildren = false;
+                    return false;
+                default:
+                    break;
+                }
+
+                if (root.hasNext())
+                    event = root.next();
+            }
+
+            hasCheckedChildren = true;
+            hasChildren = false;
+            return false;
+        }
+        catch (XMLStreamException e)
+        {
+            throw new DatabindingException("Error parsing document.", e);
+        }
+    }
+
+    public MessageReader getNextElementReader()
+    {
+        if (!hasCheckedChildren)
+            checkHasMoreChildReaders();
+
+        if (!hasChildren)
+            return null;
+
+        hasCheckedChildren = false;
+
+        return new ElementReader(root);
+    }
+
+    public QName getName()
+    {
+        return name;
+    }
+
+    public String getLocalName()
+    {
+        return localName;
+    }
+
+    public String getNamespace()
+    {
+        return namespace;
+    }
+
+    public QName getXsiType()
+    {
+        return xsiType;
+    }
+
+    public XMLStreamReader getXMLStreamReader()
+    {
+        return root;
+    }
+
+    public boolean hasMoreAttributeReaders()
+    {
+        if (!root.isStartElement())
+            return false;
+
+        return currentAttribute < root.getAttributeCount();
+    }
+
+    public MessageReader getAttributeReader(QName qName)
+    {
+        return new AttributeReader(qName, root.getAttributeValue(qName.getNamespaceURI(), qName
+                .getLocalPart()));
+    }
+
+    public MessageReader getNextAttributeReader()
+    {
+        MessageReader reader = new AttributeReader(root.getAttributeName(currentAttribute), root
+                .getAttributeValue(currentAttribute));
+        currentAttribute++;
+
+        return reader;
+    }
+
+    public String getNamespaceForPrefix(String prefix)
+    {
+        return root.getNamespaceURI(prefix);
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementReader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementWriter.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementWriter.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementWriter.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,222 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.xml.stax;
+
+import java.io.OutputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.cxf.aegis.DatabindingException;
+import org.apache.cxf.aegis.util.NamespaceHelper;
+import org.apache.cxf.aegis.xml.AbstractMessageWriter;
+import org.apache.cxf.aegis.xml.MessageWriter;
+
+/**
+ * LiteralWriter
+ * 
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public class ElementWriter extends AbstractMessageWriter implements MessageWriter {
+    private XMLStreamWriter writer;
+
+    private String namespace;
+
+    private String name;
+
+    private String prefix;
+
+    /**
+     * Create a LiteralWriter but without writing an element name.
+     * 
+     * @param writer
+     */
+    public ElementWriter(XMLStreamWriter writer) {
+        this.writer = writer;
+    }
+
+    public ElementWriter(XMLStreamWriter writer, String name, String namespace) {
+        this(writer, name, namespace, null);
+    }
+
+    public ElementWriter(XMLStreamWriter streamWriter, QName name) {
+        this(streamWriter, name.getLocalPart(), name.getNamespaceURI());
+    }
+
+    public ElementWriter(XMLStreamWriter writer, String name, String namespace, String prefix) {
+        this.writer = writer;
+        this.namespace = namespace;
+        this.name = name;
+        this.prefix = prefix;
+
+        try {
+            writeStartElement();
+        } catch (XMLStreamException e) {
+            throw new DatabindingException("Error writing document.", e);
+        }
+    }
+
+    /**
+     * @param os
+     * @throws XMLStreamException
+     */
+    public ElementWriter(OutputStream os, String name, String namespace) throws XMLStreamException {
+        XMLOutputFactory ofactory = XMLOutputFactory.newInstance();
+        this.writer = ofactory.createXMLStreamWriter(os);
+
+        this.namespace = namespace;
+        this.name = name;
+
+        try {
+            writeStartElement();
+        } catch (XMLStreamException e) {
+            throw new DatabindingException("Error writing document.", e);
+        }
+    }
+
+    private void writeStartElement() throws XMLStreamException {
+        if (namespace != null) {
+            boolean declare = false;
+
+            String decPrefix = writer.getNamespaceContext().getPrefix(namespace);
+
+            // If the user didn't specify a prefix, create one
+            if (prefix == null && decPrefix == null) {
+                declare = true;
+                prefix = NamespaceHelper.getUniquePrefix(writer);
+            } else if (prefix == null) {
+                prefix = decPrefix;
+            } else if (!prefix.equals(decPrefix)) {
+                declare = true;
+            }
+
+            writer.writeStartElement(prefix, name, namespace);
+
+            if (declare) {
+                writer.setPrefix(prefix, namespace);
+                writer.writeNamespace(prefix, namespace);
+            }
+        } else {
+            writer.writeStartElement(name);
+        }
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageWriter#writeValue(java.lang.Object)
+     */
+    public void writeValue(Object value) {
+        try {
+            if (value != null) {
+                writer.writeCharacters(value.toString());
+            }
+        } catch (XMLStreamException e) {
+            throw new DatabindingException("Error writing document.", e);
+        }
+    }
+
+    /**
+     * @see org.apache.cxf.aegis.xml.MessageWriter#getWriter(java.lang.String)
+     */
+    public MessageWriter getElementWriter(String name) {
+        return new ElementWriter(writer, name, namespace);
+    }
+
+    public MessageWriter getElementWriter(String name, String ns) {
+        return new ElementWriter(writer, name, ns);
+    }
+
+    public MessageWriter getElementWriter(QName qname) {
+        return new ElementWriter(writer, qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix());
+    }
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public void close() {
+        try {
+            writer.writeEndElement();
+        } catch (XMLStreamException e) {
+            throw new DatabindingException("Error writing document.", e);
+        }
+    }
+
+    public void flush() throws XMLStreamException {
+        writer.flush();
+    }
+
+    public XMLStreamWriter getXMLStreamWriter() {
+        return writer;
+    }
+
+    public MessageWriter getAttributeWriter(String name) {
+        return new AttributeWriter(writer, name, namespace);
+    }
+
+    public MessageWriter getAttributeWriter(String name, String namespace) {
+        return new AttributeWriter(writer, name, namespace);
+    }
+
+    public MessageWriter getAttributeWriter(QName qname) {
+        return new AttributeWriter(writer, qname.getLocalPart(), qname.getNamespaceURI());
+    }
+
+    public String getPrefixForNamespace(String namespace) {
+        try {
+            String prefix = writer.getPrefix(namespace);
+
+            if (prefix == null) {
+                prefix = NamespaceHelper.getUniquePrefix(writer);
+
+                writer.setPrefix(prefix, namespace);
+                writer.writeNamespace(prefix, namespace);
+            }
+
+            return prefix;
+        } catch (XMLStreamException e) {
+            throw new DatabindingException("Error writing document.", e);
+        }
+    }
+
+    public String getPrefixForNamespace(String namespace, String hint) {
+        try {
+            String prefix = writer.getPrefix(namespace);
+
+            if (prefix == null) {
+                String ns = writer.getNamespaceContext().getNamespaceURI(hint);
+                if (ns == null) {
+                    prefix = hint;
+                } else if (ns.equals(namespace)) {
+                    return prefix;
+                } else {
+                    prefix = NamespaceHelper.getUniquePrefix(writer);
+                }
+
+                writer.setPrefix(prefix, namespace);
+                writer.writeNamespace(prefix, namespace);
+            }
+
+            return prefix;
+        } catch (XMLStreamException e) {
+            throw new DatabindingException("Error writing document.", e);
+        }
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/xml/stax/ElementWriter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/schema/mapping.xsd
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/schema/mapping.xsd?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/schema/mapping.xsd (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/schema/mapping.xsd Wed Mar  7 12:20:07 2007
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements. See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership. The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License. You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied. See the License for the
+   specific language governing permissions and limitations
+   under the License.
+-->
+<schema xmlns="http://www.w3.org/2001/XMLSchema"
+  targetNamespace="http://xfire.codehaus.org/aegis/1.0"
+  xmlns:tns="http://xfire.codehaus.org/aegis/1.0"
+  elementFormDefault="unqualified" 
+  attributeFormDefault="unqualified" >
+
+  <element name="mappings">
+    <complexType>
+      <sequence>
+        <element name="mapping" minOccurs="0" maxOccurs="unbounded" type="tns:mappingType" />
+      </sequence>
+    </complexType>
+  </element>
+
+  <complexType name="mappingType">
+    <sequence>
+      <element minOccurs="0" maxOccurs="unbounded" ref="tns:property" />
+    </sequence>
+    <attribute name="uri" type="string"/>
+    <attribute name="name" type="string"/>
+  </complexType>
+
+  <element name="property">
+    <complexType>
+      <attributeGroup ref="tns:mappedType"/>
+      <anyAttribute namespace='##other' processContents='lax'/>
+    </complexType>
+  </element>
+  
+  <element name="return-type">
+    <complexType>
+      <attributeGroup ref="tns:mappedType"/>
+      <anyAttribute namespace='##other' processContents='lax'/>
+    </complexType>
+  </element>
+  
+  <element name="parameter">
+    <complexType>
+      <attribute name="index" type="int"/>
+      <attribute name="class" type="string"/>
+      <attributeGroup ref="tns:mappedType"/>
+      <anyAttribute namespace='##other' processContents='lax'/>
+    </complexType>
+  </element>
+
+  <element name="component">
+    <complexType>
+      <attribute name="class" type="string"/>
+      <attributeGroup ref="tns:mappedType"/>
+      <anyAttribute namespace='##other' processContents='lax'/>
+    </complexType>
+  </element>
+  
+  <attributeGroup name="mappedType">
+    <attribute name="name" type="string" />
+    <attribute name="type" type="string" />
+    <attribute name="typeName" type="string" />
+    <attribute name="mappedName" type="string" />
+    <attribute name="nillable" type="boolean" />
+    <attribute name="ignore" type="boolean" />
+    <attribute name="componentType" type="string" />
+    <attribute name="keyType" type="string" />
+    <attribute name="minOccurs" type="int"/>
+    <attribute name="style">
+      <simpleType>
+        <restriction base="string">
+          <enumeration value="attribute"/>
+          <enumeration value="element"/>
+        </restriction>
+      </simpleType>
+    </attribute>
+    <anyAttribute namespace='##other' processContents='lax'/>
+  </attributeGroup> 
+
+</schema>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/schema/mapping.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/schema/mapping.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/schema/mapping.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test-resources/xfire.jpg
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test-resources/xfire.jpg?view=auto&rev=515734
==============================================================================
Binary file - no diff available.

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test-resources/xfire.jpg
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test-resources/xfire.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/log4j.properties?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/log4j.properties (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/log4j.properties Wed Mar  7 12:20:07 2007
@@ -0,0 +1,29 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements. See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership. The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License. You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied. See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+# Set root logger level to DEBUG and its only appender to A1.
+log4j.rootLogger=INFO, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+
+log4j.category.org.apache.commons.httpclient = WARN
+log4j.category.httpclient = WARN
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/log4j.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,151 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis;
+
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusException;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.aegis.databinding.AegisServiceConfiguration;
+import org.apache.cxf.aegis.util.XmlConstants;
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.binding.soap.SoapBindingFactory;
+import org.apache.cxf.binding.soap.SoapTransportFactory;
+import org.apache.cxf.bus.extension.ExtensionManagerBus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerRegistry;
+import org.apache.cxf.frontend.AbstractEndpointFactory;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.test.AbstractCXFTest;
+import org.apache.cxf.transport.ConduitInitiatorManager;
+import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.transport.local.LocalTransportFactory;
+import org.apache.cxf.wsdl.WSDLManager;
+import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
+import org.apache.cxf.wsdl11.WSDLManagerImpl;
+
+public abstract class AbstractAegisTest extends AbstractCXFTest {
+    protected LocalTransportFactory localTransport;
+
+    private Bus bus;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        
+        bus = getBus();
+        
+        SoapBindingFactory bindingFactory = new SoapBindingFactory();
+
+        bus.getExtension(BindingFactoryManager.class)
+            .registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory);
+
+        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
+
+        SoapTransportFactory soapDF = new SoapTransportFactory();
+        soapDF.setBus(bus);
+        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
+        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/", soapDF);
+        dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", soapDF);
+        
+        localTransport = new LocalTransportFactory();
+        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
+        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
+        dfm.registerDestinationFactory("http://cxf.apache.org/bindings/xformat", localTransport);
+        dfm.registerDestinationFactory("http://cxf.apache.org/transports/local", localTransport);
+
+        ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
+        extension.registerConduitInitiator(LocalTransportFactory.TRANSPORT_ID, localTransport);
+        extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/", localTransport);
+        extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport);
+        extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/", localTransport);
+        
+        bus.setExtension(new WSDLManagerImpl(), WSDLManager.class);
+        
+
+        addNamespace("wsdl", XmlConstants.WSDL11_NS);
+        addNamespace("wsdlsoap", XmlConstants.WSDL11_SOAP_NS);
+        addNamespace("xsd", XmlConstants.XSD);
+
+
+    }
+
+    @Override
+    protected Bus createBus() throws BusException {
+        ExtensionManagerBus bus = new ExtensionManagerBus();
+        BusFactory.setDefaultBus(bus);
+        return bus;
+    }
+    
+    protected void invoke(String service, String message) throws Exception {
+        invoke(service, LocalTransportFactory.TRANSPORT_ID, message);
+    }
+    
+    public Server createService(Class serviceClass, QName name) {
+        return createService(serviceClass, serviceClass.getSimpleName(), name);
+    }
+    
+    public Server createService(Class serviceClass, 
+                                String address, QName name) {
+        ServerFactoryBean sf = createServiceFactory(serviceClass, address, name);
+        return sf.create();
+    }
+
+    protected ServerFactoryBean createServiceFactory(Class serviceClass, String address, QName name) {
+        ServerFactoryBean sf = new ServerFactoryBean();
+        sf.setServiceClass(serviceClass);
+        sf.getServiceFactory().setServiceName(name);
+        sf.setAddress(address);
+        setupAegis(sf);
+        return sf;
+    }
+
+    protected void setupAegis(AbstractEndpointFactory sf) {
+        sf.getServiceFactory().getServiceConfigurations().add(0, new AegisServiceConfiguration());
+        sf.getServiceFactory().setDataBinding(new AegisDatabinding());
+    }
+    
+
+    protected Document getWSDLDocument(String string) throws WSDLException {
+        ServerRegistry svrMan = getBus().getExtension(ServerRegistry.class);
+        for (Server s : svrMan.getServers()) {
+            Service svc = s.getEndpoint().getService();
+            if (svc.getName().getLocalPart().equals(string)) {
+                ServiceWSDLBuilder builder = new ServiceWSDLBuilder(svc.getServiceInfo());
+                Definition definition = builder.build();
+                
+                WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
+                return writer.getDocument(definition);
+            }
+        }
+        
+        return null;
+    }
+
+    
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/AbstractAegisTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Book.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Book.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Book.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Book.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.client;
+
+public class Book
+{
+    private String title;
+    private String isbn;
+    private String author;
+  
+    public String getIsbn()
+    {
+        return isbn;
+    }
+
+    public void setIsbn(String isbn)
+    {
+        this.isbn = isbn;
+    }
+
+    public String getTitle()
+    {
+        return title;
+    }
+
+    public void setTitle(String title)
+    {
+        this.title = title;
+    }
+ 
+    public String getAuthor()
+    {
+        return author;
+    }
+
+    public void setAuthor(String author)
+    {
+        this.author = author;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Book.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Book.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookDynamicClient.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookDynamicClient.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookDynamicClient.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookDynamicClient.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.client;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.aegis.type.TypeMapping;
+import org.apache.cxf.aegis.type.basic.ArrayType;
+import org.apache.cxf.aegis.type.basic.BeanType;
+import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.ClientImpl;
+import org.apache.cxf.service.Service;
+
+public class BookDynamicClient {
+    static final String ENCODED_NS = Soap11.getInstance().getSoapEncodingStyle();
+
+    public static void main(String args[]) {
+        // String serviceURL = "http://localhost:8080/BookService";
+        try {
+            Client client = new ClientImpl(new URL("http://localhost:6980/BookService?WSDL"));
+
+            Service s = client.getEndpoint().getService();
+            AegisDatabinding db = new AegisDatabinding();
+            s.setDataBinding(db);
+            db.initialize(s);
+            
+            TypeMapping tm = (TypeMapping) s.get(TypeMapping.class.getName());
+            BeanType type = new BeanType();
+            type.setSchemaType(new QName("http://org.codehaus.xfire.client", "Book"));
+            type.setTypeClass(Book.class);
+            type.setTypeMapping(tm);
+
+            System.out.println(type);
+
+            tm.register(type);
+
+            ArrayType aType = new ArrayType();
+            aType.setTypeClass(Book[].class);
+            aType.setSchemaType(new QName("http://client.xfire.codehaus.org", "ArrayOfBook"));
+            aType.setTypeMapping(tm);
+            tm.register(aType);
+
+            QName qn = tm.getTypeQName(Book.class);
+            System.out.println("QName(" + tm.isRegistered(Book.class) + ") = " + qn);
+
+            Book book = new Book();
+
+            book.setAuthor("Dan");
+            book.setIsbn("1");
+            book.setTitle("XFire in Action");
+            // client.invoke("addBook", new Object[] {book});
+
+            book.setAuthor("Dierk");
+            book.setIsbn("2");
+            book.setTitle("Groovy in Action");
+            // client.invoke("addBook", new Object[] {book});
+
+            Book[] books = (Book[])client.invoke("getBooks", new Object[] {})[0];
+
+            System.out.println("BOOKS:");
+
+            for (int i = 0; i < books.length; i++) {
+                System.out.println(books[i].getTitle());
+            }
+            /*
+             * Book[] books = (Book [])client.invoke("findBook", new Object[]
+             * {"2"});; System.out.println("ISBN :");
+             * System.out.println(books[0].getAuthor());
+             */
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookDynamicClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookDynamicClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookService.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookService.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookService.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,30 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.client;
+
+public interface BookService
+{
+    public Book[] getBooks();
+    
+    public Book findBook(String isbn);
+    
+    public void addBook(Book book);
+    
+    public void addBooks(Book[] books);
+ }

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookServiceImpl.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookServiceImpl.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookServiceImpl.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.client;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class BookServiceImpl implements BookService {
+    private List<Book> allBooks = new ArrayList<Book>();
+
+    public BookServiceImpl() {
+    }
+
+    public void addBook(Book book) {
+        allBooks.add(book);
+    }
+
+    public void addBooks(Book[] books) {
+        for (int i = 0; i < books.length; i++) {
+            allBooks.add(books[i]);
+        }
+    }
+
+    public Book[] getBooks() {
+        return allBooks.toArray(new Book[allBooks.size()]);
+    }
+
+    public Book findBook(String isbn) {
+        for (int i = 0; i < allBooks.size(); i++) {
+            Book book = allBooks.get(i);
+            if (isbn.equals(book.getIsbn()))
+                return book;
+        }
+
+        return null;
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/BookServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml Wed Mar  7 12:20:07 2007
@@ -0,0 +1,7 @@
+<mappings>
+  <mapping>
+    <method name="echo" xmlns:e="urn:echo:header">
+      <parameter index="1" componentType="java.lang.String"/>
+    </method>
+  </mapping>
+</mappings>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.aegis.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java?view=auto&rev=515734
==============================================================================
--- incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java (added)
+++ incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java Wed Mar  7 12:20:07 2007
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.aegis.client;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.WebParam.Mode;
+import javax.xml.ws.Holder;
+
+@WebService
+public interface Echo
+{
+    public String echo(String text,
+                       @WebParam(mode=Mode.OUT) Holder<String> textAgain);
+}

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/client/Echo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message