You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by jo...@apache.org on 2007/01/09 22:07:21 UTC

svn commit: r494575 [2/5] - in /webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api: ./ src/main/ src/main/java/ src/main/java/javax/ src/main/java/javax/xml/ src/main/java/javax/xml/bind/ src/main/java/javax/xml/bind/annotation/ src/main/java/javax/xml/bi...

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXB.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXB.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXB.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXB.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,377 @@
+/*
+ * 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 javax.xml.bind;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+
+import java.beans.Introspector;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.Writer;
+import java.lang.ref.WeakReference;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+
+/**
+ * <p>A utility class, which provides convenience methods for
+ * simplyfying the creation of JAXB applications.</p>
+ * <p><em>Note</em>: These methods aren't optimized for
+ * performance. In particular, you should consider additional
+ * steps, if the same operation is repeated frequently.</p>
+ * @since JAXB 2.1
+ */
+public final class JAXB {
+    /**
+     * Prevent instance creation.
+     */
+    private JAXB() {
+        // Does nothing.
+    }
+
+    private static final Map<Class<?>, WeakReference<JAXBContext>> map
+        = new WeakHashMap<Class<?>, WeakReference<JAXBContext>>();
+
+    private static <T> JAXBContext getContext(Class<T> pType) throws JAXBException {
+        WeakReference<JAXBContext> ref;
+        synchronized (map) {
+            ref = map.get(pType);
+        }
+        if (ref != null) {
+            JAXBContext ctx = ref.get();
+            if (ctx != null) {
+                return ctx;
+            }
+        }
+        JAXBContext ctx = JAXBContext.newInstance(pType);
+        ref = new WeakReference<JAXBContext>(ctx);
+        synchronized (map) {
+            map.put(pType, ref);
+        }
+        return ctx;
+    }
+
+    private static final URI asURI(String pURI) {
+        try {
+            return new URI(pURI);
+        } catch (URISyntaxException e) {
+            return new File(pURI).toURI();
+        }
+    }
+    /**
+     * Reads the given files contents and converts it into
+     * a JAXB object.
+     * @param pFile The file to read.
+     * @param pType Type of the JAXB object, which is being returned.
+     * @throws DataBindingException A {@link JAXBException}
+     *   was raised and may be read as the {@link DataBindingException
+     *   DataBindingException's} cause.
+     */
+    public static <T> T unmarshal(File pFile, Class<T> pType) {
+        return unmarshal(new StreamSource(pFile), pType);
+    }
+
+    /**
+     * Reads the given URL's contents and converts it into
+     * a JAXB object.
+     * @param pURL The URL to read.
+     * @param pType Type of the JAXB object, which is being returned.
+     * @throws DataBindingException A {@link JAXBException}
+     *   was raised and may be read as the {@link DataBindingException
+     *   DataBindingException's} cause.
+     */
+    public static <T> T unmarshal(URL pURL, Class<T> pType) {
+        InputStream stream = null;
+        try {
+            stream = pURL.openStream();
+            InputSource isource = new InputSource(stream);
+            isource.setSystemId(pURL.toExternalForm());
+            T result = unmarshal(new SAXSource(isource), pType);
+            stream.close();
+            stream = null;
+            return result;
+        } catch (IOException e) {
+            throw new DataBindingException(e);
+        } finally {
+            if (stream != null) { try { stream.close(); } catch (Throwable t) { /* Ignore me */ } }
+        }
+    }
+
+    /**
+     * Reads the given URI's contents and converts it into
+     * a JAXB object.
+     * @param pURI The URI to read.
+     * @param pType Type of the JAXB object, which is being returned.
+     * @throws DataBindingException A {@link JAXBException}
+     *   was raised and may be read as the {@link DataBindingException
+     *   DataBindingException's} cause.
+     */
+    public static <T> T unmarshal(URI pURI, Class<T> pType) {
+        try {
+            return unmarshal(pURI.toURL(), pType);
+        } catch (MalformedURLException e) {
+            throw new DataBindingException(e);
+        }
+    }
+
+    /**
+     * Reads the given URI's contents and converts it into
+     * a JAXB object.
+     * @param pURI The URI to read.
+     * @param pType Type of the JAXB object, which is being returned.
+     * @throws DataBindingException A {@link JAXBException}
+     *   was raised and may be read as the {@link DataBindingException
+     *   DataBindingException's} cause.
+     */
+    public static <T> T unmarshal(String pURI, Class<T> type) {
+        return unmarshal(asURI(pURI), type);
+    }
+
+    /**
+     * Reads the given byte streams contents and converts it into
+     * a JAXB object.
+     * @param pStream The stream to read; will be closed by this
+     *   method upon successful completion
+     * @param pType Type of the JAXB object, which is being returned.
+     * @throws DataBindingException A {@link JAXBException}
+     *   was raised and may be read as the {@link DataBindingException
+     *   DataBindingException's} cause.
+     */
+    public static <T> T unmarshal(InputStream pStream, Class<T> pType) {
+        T result = unmarshal(new StreamSource(pStream), pType);
+        try {
+            pStream.close();
+        } catch (IOException e) {
+            throw new DataBindingException(e);
+        }
+        return result;
+    }
+
+    /**
+     * Reads the given character streams contents and converts it into
+     * a JAXB object.
+     * @param pStream The stream to read; will be closed by this
+     *   method upon successful completion
+     * @param pType Type of the JAXB object, which is being returned.
+     * @throws DataBindingException A {@link JAXBException}
+     *   was raised and may be read as the {@link DataBindingException
+     *   DataBindingException's} cause.
+     */
+    public static <T> T unmarshal(Reader pStream, Class<T> pType) {
+        T result = unmarshal(new StreamSource(pStream), pType);
+        try {
+            pStream.close();
+        } catch (IOException e) {
+            throw new DataBindingException(e);
+        }
+        return result;
+    }
+
+    /**
+     * Reads the given source and converts it into
+     * a JAXB object.
+     * @param pSource The XML document to read.
+     * @param pType Type of the JAXB object, which is being returned.
+     * @throws DataBindingException A {@link JAXBException}
+     *   was raised and may be read as the {@link DataBindingException
+     *   DataBindingException's} cause.
+     */
+    public static <T> T unmarshal(Source pSource, Class<T> pType) {
+        try {
+            JAXBElement<T> item = getContext(pType).createUnmarshaller().unmarshal(pSource, pType);
+            T result = item.getValue();
+            return result;
+        } catch (JAXBException e) {
+            throw new DataBindingException(e);
+        }
+    }
+
+    /**
+     * Writes the given JAXB object to the given file.
+     *
+     * @param pObject The object being written.
+     * @param pFile The target file.
+     * @throws DataBindingException
+     *      If the operation fails, such as due to I/O error, unbindable classes.
+     */
+    public static void marshal(Object pObject, File pFile) {
+        marshal(pObject, new StreamResult(pFile));
+    }
+
+    /**
+     * Writes the given JAXB object to the given URL.
+     *
+     * @param pObject The object being written.
+     * @param pFile The target file.
+     * @throws DataBindingException
+     *      If the operation fails, such as due to I/O error, unbindable classes.
+     */
+    public static void marshal(Object pObject, URL pURL) {
+        URLConnection con = null;
+        HttpURLConnection httpCon = null;
+        OutputStream ostream = null;
+        try {
+            con = pURL.openConnection();
+            httpCon = (con instanceof HttpURLConnection) ? ((HttpURLConnection) con) : null;
+            con.setDoOutput(true);
+            con.setDoInput(false);
+            con.connect();
+            ostream = con.getOutputStream();
+            marshal(pObject, new StreamResult(ostream));
+            if (ostream != null) {
+                ostream.close();
+                ostream = null;
+            }
+            if (httpCon != null) {
+                httpCon.disconnect();
+                httpCon = null;
+            }
+        } catch (IOException e) {
+            throw new DataBindingException(e);
+        } finally {
+            if (ostream != null) {
+                try {
+                    ostream.close();
+                } catch (Throwable t) {
+                    // Ignore me
+                }
+            }
+            if (httpCon != null) {
+                try {
+                    httpCon.disconnect();
+                } catch (Throwable t) {
+                    // Ignore me
+                }
+            }
+        }
+    }
+
+    /**
+     * Writes the given JAXB object to the given URI.
+     *
+     * @param pObject The object being written.
+     * @param pFile The target file.
+     * @throws DataBindingException
+     *      If the operation fails, such as due to I/O error, unbindable classes.
+     */
+    public static void marshal(Object pObject, URI pURI) {
+        try {
+            marshal(pObject, pURI.toURL());
+        } catch (MalformedURLException e) {
+            throw new DataBindingException(e);
+        }
+    }
+
+    /**
+     * Writes a Java object tree to XML and store it to the specified location.
+     *
+     * @param jaxbObject
+     *      The Java object to be marshalled into XML. If this object is
+     *      a {@link JAXBElement}, it will provide the root tag name and
+     *      the body. If this object has {@link XmlRootElement}
+     *      on its class definition, that will be used as the root tag name
+     *      and the given object will provide the body. Otherwise,
+     *      the root tag name is {@link Introspector#decapitalize(String) infered} from
+     *      {@link Class#getSimpleName() the short class name}.
+     *      This parameter must not be null.
+     *
+     * @param xml
+     *      The string is first interpreted as an absolute <tt>URI</tt>.
+     *      If it's not {@link URI#isAbsolute() a valid absolute URI},
+     *      then it's interpreted as a <tt>File</tt>
+     *
+     * @throws DataBindingException
+     *      If the operation fails, such as due to I/O error, unbindable classes.
+     */
+    public static void marshal(Object pObject, String pURI) {
+        marshal(pObject, asURI(pURI));
+    }
+
+    /**
+     * Writes the given JAXB object to the given {@link OutputStream}.
+     *
+     * @param pObject The object being written.
+     * @param pFile The target file.
+     * @throws DataBindingException
+     *      If the operation fails, such as due to I/O error, unbindable classes.
+     */
+    public static void marshal(Object pObject, OutputStream pStream) {
+        marshal(pObject, pStream);
+    }
+
+    /**
+     * Writes the given JAXB object to the given {@link Writer}.
+     *
+     * @param pObject The object being written.
+     * @param pFile The target file.
+     * @throws DataBindingException
+     *      If the operation fails, such as due to I/O error, unbindable classes.
+     */
+    public static void marshal(Object pObject, Writer pWriter) {
+        marshal(pObject, new StreamResult(pWriter));
+    }
+
+    /**
+     * Writes the given JAXB object to the given location.
+     *
+     * @param pObject The object being written.
+     * @param pFile The target file.
+     * @throws DataBindingException
+     *      If the operation fails, such as due to I/O error, unbindable classes.
+     */
+    @SuppressWarnings("unchecked")
+    public static void marshal(Object pObject, Result pTarget) {
+        Object obj = pObject;
+        try {
+            JAXBContext ctx;
+            if (obj instanceof JAXBElement) {
+                ctx = getContext(((JAXBElement<?>) obj).getDeclaredType());
+            } else {
+                Class<?> clazz = obj.getClass();
+                XmlRootElement r = clazz.getAnnotation(XmlRootElement.class);
+                ctx = getContext(clazz);
+                if (r == null) {
+                    // we need to infer the name
+                    obj = new JAXBElement(new QName(Introspector.decapitalize(clazz.getSimpleName())), clazz, obj);
+                }
+            }
+    
+            Marshaller m = ctx.createMarshaller();
+            m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+            m.marshal(obj, pTarget);
+        } catch (JAXBException e) {
+            throw new DataBindingException(e);
+        }
+    }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBContext.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBContext.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBContext.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBContext.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,334 @@
+/*
+ * 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 javax.xml.bind;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Map;
+
+import org.w3c.dom.Node;
+
+
+/** <p>The <code>JAXBContext</code> provides the JAXB users anchor to
+ * the implmentation and hos generated classes. A JAXBContext is used to
+ * obtain instances of {@link javax.xml.bind.Marshaller},
+ * {@link javax.xml.bind.Unmarshaller}, and
+ * {@link javax.xml.bind.Validator}. To obtain a JAXBContext, the
+ * application invokes
+ * <pre>
+ *   JAXBContext context = JAXBContext.newInstance("com.mycompany:com.mycompany.xml");
+ * </pre>
+ * The list of colon separated package names matches the list in the
+ * schemas used to generate classes. In other words: If you have a
+ * schema using package name "com.mycompany.xml", then this package
+ * name has to be part of the list.</p>
+ * <p>The <code>JAXBContext</code> class will scan the given list of packages
+ * for a file called <samp>jaxb.properties</samp>. This file contains the
+ * name of an instantiation class in the property
+ * {@link #JAXB_CONTEXT_FACTORY}. (See {@link #newInstance(String)} for
+ * details on how the class name is obtained.) Once such a file is found, the
+ * given class is loaded via {@link ClassLoader#loadClass(java.lang.String)}.
+ * The <code>JAXBContext</code> class demands, that the created object
+ * has a method
+ * <pre>
+ *   public static JAXBContext createContext(String pPath, ClassLoader pClassLoader)
+ *     throws JAXBException;
+ * </pre>
+ * This method is invoked with the same path and {@link ClassLoader} than
+ * above. See {@link #newInstance(String,ClassLoader)}} for details on the choice
+ * of the {@link ClassLoader}.</p>
+ * <p>The created context will scan the same package path for implementation
+ * specific configuration details (in the case of the <code>JaxMe</code>
+ * application a file called <samp>Configuration.xml</samp> in any of the
+ * packages) and do whatever else is required to initialize the runtime.
+ * In particular it will invoke
+ * {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface)}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ * @see Marshaller
+ * @see Unmarshaller
+ * @see Validator
+ */
+public abstract class JAXBContext {
+    private static final Map<String,?> EMPTY_MAP = Collections.emptyMap();
+
+    /**
+     * Creates a new instance.
+     */
+    protected JAXBContext() {
+        // Does nothing
+    }
+
+    /** <p>This is the name of the property used to determine the name
+     * of the initialization class: "javax.xml.bind.context.factory".
+     * The name is used by {@link #newInstance(String)} and
+     * {@link #newInstance(String,ClassLoader)}. It contains a class
+     * name. The class must contain a static method
+     * <pre>
+     *   public static JAXBContext createContext(String, ClassLoader) throws JAXBException;
+     * </pre>
+     * which is invoked to create the actual instance of JAXBContext.</p>
+     */
+    public static final java.lang.String JAXB_CONTEXT_FACTORY = "javax.xml.bind.context.factory";
+
+    /**
+     * <p>Creates a new instance of <code>JAXBContext</code> by applying
+     * the following algorithm:
+     * <ol>
+     *   <li>The first step is to determine the name of an initialization class.
+     *     For any of the package names in the list given by
+     *     <code>pPath</code> the <code>JAXBContext</code> class will try to find a file
+     *     called <samp>jaxb.properties</samp>. This file's got to be in
+     *     standard property file format. The <code>JAXBContext</code> class
+     *     will load the property file.</li>
+     *   <li>A property called "javax.xml.bind.context.factory" (see
+     *     {@link #JAXB_CONTEXT_FACTORY}) is evaluated. It must contain the
+     *     name of an initialization class. The initialization class is
+     *     loaded via
+     *     <code>Thread.currentThread().getContextClassLoader().loadClass(String)</code>.</li>
+     *   <li>The initialization class must contain a method
+     *     <pre>
+     *       public static JAXBContext createContext(String, ClassLoader) throws JAXBException;
+     *     </pre>
+     *     which is invoked with the <code>pPath</code> argument and the
+     *     {@link ClassLoader} of the <code>JAXBContext</class> class as
+     *     parameters. The result of this method is also used as the
+     *     result of the <code>newInstance(String)</code> method.</li>
+     * </ol>
+     * @param pPath A colon separated path of package names where to look for
+     *   <samp>jaxb.properties</samp> files. The package names must match the
+     *   generated classes which you are going to use in your application.
+     * @return An initialized instance of <code>JAXBContext</code>.
+     * @throws JAXBException An error occurred while creating the JAXBContext instance. 
+     */  
+    public static JAXBContext newInstance(java.lang.String pPath) throws JAXBException {
+        return newInstance(pPath, Thread.currentThread().getContextClassLoader());
+    }
+
+    /**
+     * <p>Creates a new instance of <code>JAXBContext</code> by applying
+     * the following algorithm:
+     * <ol>
+     *   <li>The first step is to determine the name of an initialization class.
+     *     For any of the package names in the list given by
+     *     <code>pPath</code> the <code>JAXBContext</code> class will try to find a file
+     *     called <samp>jaxb.properties</samp>. This file's got to be in
+     *     standard property file format. The <code>JAXBContext</code> class
+     *     will load the property file.</li>
+     *   <li>A property called "javax.xml.bind.context.factory" (see
+     *     {@link #JAXB_CONTEXT_FACTORY}) is evaluated. It must contain the
+     *     name of an initialization class. The initialization class is
+     *     loaded via
+     *     <code>pClassLoader.loadClass(String)</code>.</li>
+     *   <li>The initialization class must contain a method
+     *     <pre>
+     *       public static JAXBContext createContext(String, ClassLoader) throws JAXBException;
+     *     </pre>
+     *     which is invoked with the parameters <code>pPath</code> and
+     *     <code>pClassLoader</code>. The result of this method is also
+     *     used as the result of the <code>newInstance(String)</code>
+     *     method.</li>
+     * </ol>
+     * @param pPath A colon separated path of package names where to look for
+     *   <samp>jaxb.properties</samp> files. The package names must match the
+     *   generated classes which you are going to use in your application.
+     * @param pClassLoader The {@link ClassLoader} to use for loading
+     *   resources and classes.
+     * @return An initialized instance of <code>JAXBContext</code>.
+     * @throws JAXBException An error occurred while creating the JAXBContext instance.
+     */
+    public static JAXBContext newInstance(String pPath, ClassLoader pClassLoader) throws JAXBException {
+        return newInstance(pPath, pClassLoader, EMPTY_MAP);
+    }
+
+    /**
+     * <p>Creates a new instance of <code>JAXBContext</code>.
+     * This is mostly the same than {@link #newInstance(String, ClassLoader)},
+     * except that it accepts provider-specific properties for configuring
+     * the new context.</p>
+     * @param pPath A colon separated path of package names where to look for
+     *   <samp>jaxb.properties</samp> files. The package names must match the
+     *   generated classes which you are going to use in your application.
+     * @param pClassLoader The {@link ClassLoader} to use for loading
+     *   resources and classes.
+     * @param pProperties A set of properties, which allow to configure the
+     *   new <code>JAXBContext</code>.
+     * @return An initialized instance of <code>JAXBContext</code>.
+     * @throws JAXBException An error occurred while creating the JAXBContext instance.
+     * @since JAXB2.0
+     */
+    public static JAXBContext newInstance( String pPath, ClassLoader pClassLoader, Map<String,?>  pProperties  )
+        throws JAXBException {
+        return ContextCreator.newContext(JAXB_CONTEXT_FACTORY,
+                pPath, pClassLoader, pProperties);
+    }
+
+    /**
+     * <p>Creates a new instance of <code>JAXBContext</code> by applying
+     * the following algorithm:
+     * <ol>
+     *   <li>The first step is to determine the name of an initialization
+     *     class. For any of the package names in the list given by
+     *     <code>pClasses</code> the <code>JAXBContext</code> class will
+     *     try to find a file called <samp>jaxb.properties</samp>. This
+     *     file's got to be in standard property file format. The
+     *     <code>JAXBContext</code> class will load the property file.</li>
+     *   <li>A property called "javax.xml.bind.context.factory" (see
+     *     {@link #JAXB_CONTEXT_FACTORY}) is evaluated. It must contain the
+     *     name of an initialization class.</li>
+     *   <li>The initialization class must contain a method
+     *     <pre>
+     *       public static JAXBContext createContext(Class[], Map) throws JAXBException;
+     *     </pre>
+     *     which is invoked with the parameters <code>pClasses</code> and
+     *     an empty property set. The result of this method is also
+     *     used as the result of the <code>newInstance(String)</code>
+     *     method.</li>
+     * </ol>
+     * @param pClasses Array of JAXB object classes, which must be
+     *   supported by the created JAXBContext.
+     * @throws JAXBException An error occurred while creating the JAXBContext instance.
+     * @throws IllegalArgumentException The parameter or an element
+     *   in the array is null.
+     * @since JAXB2.0
+     */
+    public static JAXBContext newInstance(Class<?>... pClasses)
+        throws JAXBException {
+        return newInstance(pClasses, EMPTY_MAP);
+    }
+
+    /**
+     * <p>Creates a new instance of <code>JAXBContext</code> by applying
+     * the following algorithm:
+     * <ol>
+     *   <li>The first step is to determine the name of an initialization
+     *     class. For any of the package names in the list given by
+     *     <code>pClasses</code> the <code>JAXBContext</code> class will
+     *     try to find a file called <samp>jaxb.properties</samp>. This
+     *     file's got to be in standard property file format. The
+     *     <code>JAXBContext</code> class will load the property file.</li>
+     *   <li>A property called "javax.xml.bind.context.factory" (see
+     *     {@link #JAXB_CONTEXT_FACTORY}) is evaluated. It must contain the
+     *     name of an initialization class.</li>
+     *   <li>The initialization class must contain a method
+     *     <pre>
+     *       public static JAXBContext createContext(Class[], Map) throws JAXBException;
+     *     </pre>
+     *     which is invoked with the parameters <code>pClasses</code> and
+     *     <code>pProperties</code>. The result of this method is also
+     *     used as the result of the <code>newInstance(String)</code>
+     *     method.</li>
+     * </ol>
+     * @param pClasses Array of JAXB object classes, which must be
+     *   supported by the created JAXBContext.
+     * @param pProperties Property set for configuring the
+     *   created JAXBContext.
+     * @throws JAXBException An error occurred while creating the JAXBContext instance.
+     * @throws IllegalArgumentException The parameter or an element
+     *   in the array is null.
+     * @since JAXB2.0
+     */
+    public static JAXBContext newInstance(Class<?>[] pClasses,
+            Map<String,?> pProperties) throws JAXBException {
+        if (pClasses == null) {
+            throw new IllegalArgumentException("The parameter must not be null.");
+        }
+        for (int i = 0;  i < pClasses.length;  i++) {
+            if (pClasses[i] == null) {
+                throw new IllegalArgumentException("The pClasses argument must not contain null arguments.");
+            }
+        }
+        return ContextCreator.newContext(JAXB_CONTEXT_FACTORY, pClasses, pProperties);
+    }
+
+    /** <p>Creates a new instance of {@link Marshaller}. The
+     * {@link Marshaller} can be used
+     * to convert JAXB objects into XML data.</p>
+     * <p><em>Note</em>: Marshallers are reusable, but not reentrant (thread safe).</p>
+     */
+    public abstract Marshaller createMarshaller() throws JAXBException;
+
+    /** <p>Creates a new instance of {@link Unmarshaller}. The
+     * {@link Unmarshaller} can be used
+     * to convert XML data into JAXB objects.</p>
+     * <p><em>Note</em>: Unmarshallers are reusable, but not reentrant (thread safe).</p>
+     */
+    public abstract Unmarshaller createUnmarshaller() throws JAXBException;
+
+    /** <p>Creates a new instance of {@link Validator}. The
+     * {@link Validator} can be used to validate JAXB objects.</p>
+     * @deprecated Validators are deprecated in favour of the
+     * {@link javax.xml.validation.Validator validation framework}
+     * from JAXP 1.3.
+     */
+    @SuppressWarnings("deprecation")
+    public abstract Validator createValidator() throws JAXBException;
+
+    /**
+     * Creates a {@link Binder}, which may be used to associate
+     * JAXB objects with XML nodes.
+     * @param domType A class, which indicates the DOM API to
+     *   use for the XML nodes. This is typically the node class,
+     *   for example {@link Node}.
+     * @return A new {@link Binder}.
+     * @throws UnsupportedOperationException The DOM API given
+     *   by <code>pDomType</code> is unknown.
+     * @since JAXB 2.0
+     */
+    public <T> Binder<T> createBinder(
+            @SuppressWarnings("unused") Class<T> pDomType) {
+        throw new UnsupportedOperationException("Creating Binders is unsupported");
+    }
+
+    /**
+     * Creates a {@link Binder}, which may be used to associate
+     * JAXB objects with DOM nodes.
+     * @return A new {@link Binder}.
+     * @throws UnsupportedOperationException The JAXB Provider doesn't
+     *   support Binders.
+     * @since JAXB 2.0
+     */
+    public Binder<Node> createBinder() {
+        return createBinder(Node.class);
+    }
+
+    /**
+     * Creates a {@link JAXBIntrospector} for introspecting JAXB objects.
+     * @return A new {@link JAXBIntrospector}.
+     * @throws UnsupportedOperationException The JAXB Provider doesn't
+     *   support JAXBIntrospectors.
+     * @since JAXB 2.0
+     */
+    public JAXBIntrospector createJAXBIntrospector() {
+        throw new UnsupportedOperationException("Creating JAXBIntrospectors is unsupported.");
+    }
+
+    /**
+     * Writes this contexts schema documents to the given destination.
+     * @param pResolver An object, which controls the destination.
+     * @throws IOException An error occurred while writing the schema
+     *   documents.
+     * @throws UnsupportedOperationException The JAXB Provider doesn't
+     *   support writing schema documents.
+     * @since JAXB 2.0
+     */
+    @SuppressWarnings("unused")
+    public void generateSchema(SchemaOutputResolver pResolver) throws IOException  {
+        throw new UnsupportedOperationException("Writing schema documents is unsupported.");
+    }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBElement.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBElement.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBElement.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBElement.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,174 @@
+/*
+ * 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 javax.xml.bind;
+
+import javax.xml.namespace.QName;
+import java.io.Serializable;
+
+
+/**
+ * @since JAXB 2.0
+ */
+public class JAXBElement<T> implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * Marker class for an element with global scope.
+     */
+    public static final class GlobalScope {
+        // This class is intentionally empty.
+    }
+
+    /**
+     * The XML elements tag name.
+     */
+    protected final QName name;
+    /**
+     * The type, to which the XML element is bound.
+     */
+    protected final Class<T> declaredType;
+    /**
+     * Scope of the XML elements declaration, either of
+     * <ul>
+     *   <li>{@link GlobalScope}, if this is a globally declared element.</li>
+     *   <li>A locally declared complex types class representation.</li>
+     * </ul>
+     */
+    protected final Class<?> scope;
+    /**
+     * The actual element value.
+     */
+    protected T value;
+    /**
+     * Value of the XML elements xsi:nil attribute.
+     * (Defaults to false.)
+     */
+    protected boolean nil;
+
+    /**
+     * Creates a new instance.
+     * @param pName The XML elements tag name.
+     * @param pType The type, to which the XML element is bound.
+     * @param pScope The XML elements scope, either of
+     *   {@link GlobalScope GlobalScope.class} (default) or
+     *   a locally declared complex types Java representation.
+     * @param pValue The actual XML elements value.
+     * @see #getScope()
+     * @see #isTypeSubstituted()
+     */
+    public JAXBElement(QName pName, Class<T> pType, 
+		       Class<?> pScope, T pValue) {
+        if (pType == null) {
+            throw new IllegalArgumentException("The type argument must not be null.");
+        }
+        if (pName==null) {
+            throw new IllegalArgumentException("The name argument must not be null.");
+        }
+        declaredType = pType;
+        scope = pScope == null ? GlobalScope.class : pScope;
+        name = pName;
+        setValue(pValue);
+    }
+
+    /**
+     * Creates a new instance with global scope. Shortcut for
+     * <pre>JAXBElement(pName, pType, null, pValue)</pre>.
+     */
+    public JAXBElement(QName pName, Class<T> pType, T pValue ) {
+        this(pName, pType, null, pValue);
+    }
+
+    /**
+     * Returns the type, to which the XML element is bound.
+     */
+    public Class<T> getDeclaredType() {
+        return declaredType;
+    }
+
+    /**
+     * Returns the XML elements tag name.
+     */
+    public QName getName() {
+        return name;
+    }
+
+    /**
+     * Sets the actual XML elements value.
+     * Setting this property to null is allowed, if {@link #isNil()}
+     * returns true.
+     * @see #isTypeSubstituted()
+     */
+    public void setValue(T t) {
+        this.value = t;
+    }
+
+    /**
+     * Returns the actual XML elements value.
+     * This property might return null, if {@link #isNil()}
+     * returns true.
+     */
+    public T getValue() {
+        return value;
+    }
+
+    /**
+     * Returns the scope of the XML elements declaration, either of
+     * <ul>
+     *   <li>{@link GlobalScope}, if this is a globally declared element.</li>
+     *   <li>A locally declared complex types class representation.</li>
+     * </ul>
+     */
+    public Class<?> getScope() {
+        return scope;
+    }
+    
+    /**
+     * Returns, whether this XML elements content model is nil.
+     * This is the case, if {@link #getValue()} return null, or
+     * if {@link #setNil(boolean)} was invoked with the value
+     * true.
+     */
+    public boolean isNil() {
+        return value == null ||  nil;
+    }
+
+    /**
+     * Sets, whether this XML elements content model is nil.
+     * @see #isNil()
+     */
+    public void setNil(boolean pNil) {
+        nil = pNil;
+    }
+    
+    /**
+     * Returns true, if this is a globally declared element.
+     * Shortcut for <pre>getScope() == GlobalScope.class</pre>.
+     */
+    public boolean isGlobalScope() {
+        return scope == GlobalScope.class;
+    }
+
+    /**
+     * Returns true, if this XML elements actual value has
+     * a different value than the declared class. Shortcut
+     * for <pre>getValue().getClass() != getType()</pre>.
+     */
+    public boolean isTypeSubstituted() {
+        return value != null  &&  value.getClass() != declaredType;
+    }
+
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBException.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBException.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBException.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBException.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,159 @@
+/*
+ * 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 javax.xml.bind;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+/** <p>This is the main exception class of JAXB. All other
+ * exception classes (except the {@link javax.xml.bind.TypeConstraintException},
+ * which is a {@link java.lang.RuntimeException} are derived from the
+ * <code>JAXBException</code>.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class JAXBException extends Exception {
+    private static final long serialVersionUID = -5621384651494307979L;
+    private String errorCode;
+    private Throwable linkedException;
+    
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * detail message.</p>
+     * @param pMessage The detail message.
+     */
+    public JAXBException(String pMessage) {
+        super(pMessage);
+    }
+
+    private static String formatMessage(String pErrorCode, String pMessage, Throwable pThr) {
+    	String msg = null;
+        if (pMessage == null) {
+            if (pThr != null) {
+            	msg = pThr.getMessage();
+                if (msg == null) {
+                	msg = pThr.getClass().getName();
+                }
+            }
+        } else {
+        	msg = pMessage;
+        }
+        if (pErrorCode == null) {
+        	return msg;
+        }
+        if (msg == null) {
+            return pErrorCode;
+        }
+        return pErrorCode + ": " + msg;
+    }
+
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * detail message and vendor specific error code.</p>
+     * @param pMessage The detail message.
+     * @param pErrorCode The error code.
+     */
+    public JAXBException(String pMessage, String pErrorCode) {
+        this(pMessage, pErrorCode, null);
+    }
+    
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * linked exception.</p>
+     * @param pLinkedException The linked exception.
+     */
+    public JAXBException(Throwable pLinkedException) {
+        this(null, null, pLinkedException);
+    }
+    
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * detail message and linked exception.</p>
+     * @param pMessage The detail message.
+     * @param pLinkedException The linked exception.
+     */
+    public JAXBException(String pMessage, Throwable pLinkedException) {
+        this(pMessage, null, pLinkedException);
+    }
+    
+    /** <p>Creates a new <code>JAXBException</code> with the specified
+     * detail message, error code, and linked exception.</p>
+     * @param pMessage The detail message.
+     * @param pErrorCode The vendor specific error code.
+     * @param pLinkedException The linked exception.
+     */
+    public JAXBException(String pMessage, String pErrorCode,
+						 Throwable pLinkedException) {
+        super(formatMessage(pErrorCode, pMessage, pLinkedException));
+        errorCode = pErrorCode;
+        linkedException = pLinkedException;
+    }
+    
+    /** <p>Returns the vendor specific error code, if any, or null.</p>
+     */
+    public String getErrorCode() {
+        return errorCode;
+    }
+    
+    /** <p>Returns the linked exception, if any, or null.</p>
+     */
+    public Throwable getLinkedException() {
+        return linkedException;
+    }
+    
+    /** <p>Sets the linked exception.</p>
+     * @param pLinkedException The linked exception or null.
+     */
+    public void setLinkedException(Throwable pLinkedException) {
+        linkedException = pLinkedException;
+    }
+    
+    /** <p>Converts the linked exception into a String. Overridden,
+     * because the returned string should contain the vendor specific
+     * error code, if any.</p>
+     */
+    public String toString() {
+        if (errorCode == null  ||  errorCode.length() == 0) {
+            return super.toString();
+        }
+        return errorCode + ": " + super.toString();
+    }
+
+    public void printStackTrace() {
+        printStackTrace(System.err);
+    }
+
+    public void printStackTrace(PrintStream pStream) {
+        super.printStackTrace(pStream);
+        Throwable t = getLinkedException();
+        if (t != null) {
+            pStream.println("Caused by:");
+            t.printStackTrace(pStream);
+        }
+    }
+
+    public void printStackTrace(PrintWriter pWriter) {
+        super.printStackTrace(pWriter);
+        Throwable t = getLinkedException();
+        if (t != null) {
+            pWriter.println("Caused by:");
+            t.printStackTrace(pWriter);
+        }
+    }
+
+    @Override
+    public Throwable getCause() {
+        return linkedException;
+    }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBIntrospector.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBIntrospector.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBIntrospector.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/JAXBIntrospector.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,62 @@
+/*
+ * 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 javax.xml.bind;
+
+import  javax.xml.namespace.QName;
+
+
+/**
+ * An instance of this class is created by the {@link JAXBContext}.
+ * It's purpose is to provide metadata for JAXB objects.
+ * @see JAXBContext#createJAXBIntrospector()
+ * @since JAXB 2.0
+ */
+public abstract class JAXBIntrospector {
+    /**
+     * Returns, whether the given object is a JAXB element.
+     * In other words, it returns whether the object is an
+     * instance of {@link JAXBElement} or its class is
+     * annotated with {@code &#64XmlRootElement}.
+     */
+    public abstract boolean isElement(Object object);
+
+    /**
+     * Returns the given JAXB elements tag name.
+     * @param jaxbElement A JAXB element, as indicated by
+     *   {@link #isElement(Object)}.
+     * @return The JAXB elements tag name or null, if the object
+     *   is no JAXB element.
+     */
+    public abstract QName getElementName(Object jaxbElement);
+
+    /**
+     * Returns the JAXB elements actual value. This is a
+     * convenience method, which allows to handle
+     * instances of {@link JAXBElement} in the same way
+     * than instances of a Java class, which is annotated
+     * with {@code &#64XmlRootElement}.
+     * @param jaxbElement A JAXB element, as indicated by
+     *   {@link #isElement(Object)}.
+     * @return The element value of the <code>jaxbElement</code>.
+     */
+    public static Object getValue(Object jaxbElement) {
+        if (jaxbElement instanceof JAXBElement) {
+            return ((JAXBElement)jaxbElement).getValue();
+        }
+        return jaxbElement;
+    }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/MarshalException.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/MarshalException.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/MarshalException.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/MarshalException.java Tue Jan  9 13:07:17 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 javax.xml.bind;
+
+/** <p>The <code>MarshalException</code> is a subclass of the
+ * {@link javax.xml.bind.JAXBException} being thrown if the
+ * marshalling of a JAXB object failed.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+@SuppressWarnings("serial") // Not provided by RI
+public class MarshalException extends JAXBException {
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * detail message.</p>
+   * @param pMessage The detail message.
+   */
+  public MarshalException(String pMessage) {
+    super(pMessage);
+  }
+
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * detail message and vendor specific error code.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The error code.
+   */
+  public MarshalException(String pMessage, String pErrorCode) {
+    super(pMessage, pErrorCode);
+  }
+
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * linked exception.</p>
+   * @param pLinkedException The linked exception.
+   */
+  public MarshalException(Throwable pLinkedException) {
+    super(pLinkedException);
+  }
+
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * detail message and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pLinkedException The linked exception.
+   */
+  public MarshalException(String pMessage, Throwable pLinkedException) {
+    super(pMessage, pLinkedException);
+  }
+
+  /** <p>Creates a new <code>MarshalException</code> with the specified
+   * detail message, error code, and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The vendor specific error code.
+   * @param pLinkedException The linked exception.
+   */
+  public MarshalException(String pMessage, String pErrorCode,
+                           Throwable pLinkedException) {
+    super(pMessage, pErrorCode, pLinkedException);
+  }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/Marshaller.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/Marshaller.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/Marshaller.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/Marshaller.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,465 @@
+/*
+ * 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 javax.xml.bind;
+
+import java.io.File;
+import java.io.OutputStream;
+import java.io.Writer;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import javax.xml.bind.attachment.AttachmentMarshaller;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import javax.xml.validation.Schema;
+
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+
+/** <p>An instance of <code>Marshaller</code> may be obtained by the
+ * JAXB user to serialize JAXB objects to various flavours of XML.
+ * The created XML may be:
+ * <table border="1">
+ *   <tr><th>A byte stream<br>{@link java.io.OutputStream}</th>
+ *     <td>{@link #marshal(Object, java.io.OutputStream)}</td>
+ *   </tr>
+ *   <tr><th>A character stream<br>{@link java.io.Writer}</th>
+ *     <td>{@link #marshal(Object, java.io.Writer)}</td>
+ *   </tr>
+ * </table>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface Marshaller {
+    /**
+     * An instance of this class may be registered as
+     * an event listener on the {@link Marshaller}.
+     * @since JAXB 2.0
+     */
+    public static abstract class Listener {
+        /**
+         * This method is invoked before marshalling the JAXB object
+         * {@code pObject}.
+         * @param pObject An object, which has been passed to either
+         *   of the marshal methods.
+         */
+        public void beforeMarshal(
+                @SuppressWarnings("unused") Object pObject) {
+            // Does nothing.
+        }
+
+        /**
+         * This method is invoked after marshalling the JAXB object
+         * {@code pObject}.
+         * @param pObject An object, which has been passed to either
+         *   of the marshal methods.
+         */
+        public void afterMarshal(
+                @SuppressWarnings("unused") Object pObject) {
+            // Does nothing.
+        }
+    }
+
+    /** <p>Name of the property that allows to choose the encoding.
+     * The encoding applies when marshalling to an
+     * {@link java.io.OutputStream}, to a {@link java.io.Writer},
+     * or to a {@link javax.xml.transform.stream.StreamResult}.
+     * It is ignored, if the target is a {@link org.xml.sax.ContentHandler},
+     * a DOM {@link org.w3c.dom.Node}, or another flavour of
+     * {@link javax.xml.transform.Result}.</p>
+     * <p>The encoding may be used both to choose the characters
+     * being escaped (as <samp>&amp;#ddd;</samp>) or to convert
+     * characters into byte sequences.</p>
+     * <p>The property value is the encoding name, for example
+     * <samp>UTF-8</samp>, which is the default. Note, that a
+     * JAXB implementation need not support other encodings than
+     * <samp>UTF-8</samp>, <samp>UTF-16</samp>, and <samp>US-ASCII</samp>.
+     * Usually you may expect that the encodings supported by the
+     * JVM itself will work for the <code>Marshaller</code> as well.</p>
+     *
+     * @see #marshal(Object, java.io.OutputStream)
+     * @see #marshal(Object, java.io.Writer)
+     * @see #marshal(Object, javax.xml.transform.Result)
+     */
+    public static final String JAXB_ENCODING = "jaxb.encoding";
+
+    /** <p>Name of the property that allows to choose whether the
+     * generated XML should be formatted (human readable, indented)
+     * or not. By default the generated XML is formatted.
+     * The property value is an instance of {@link Boolean},
+     * by default {@link Boolean#TRUE}.</p>
+     * <p>The formatting property is supported when marshalling to
+     * a character or byte stream. It is ignored, if the target is
+     * a {@link org.xml.sax.ContentHandler}, a DOM
+     * {@link org.w3c.dom.Node}, or an instance of
+     * {@link javax.xml.transform.Result}, the exception being a
+     * {@link javax.xml.transform.stream.StreamResult}, which is
+     * in fact a character or byte stream.</p>
+     *
+     * @see #marshal(Object, java.io.OutputStream)
+     * @see #marshal(Object, java.io.Writer)
+     * @see #marshal(Object, javax.xml.transform.Result)
+     */
+    public static final String JAXB_FORMATTED_OUTPUT = "jaxb.formatted.output";
+
+    /** <p>If this property is set to another value than null,
+     * then the <code>Marshaller</code> will create an attribute
+     * <samp>xsi:schemaLocation</samp>. The attribute value is
+     * the property value. By default the property is set to
+     * null and no such attribute is generated.</p>
+     *
+     * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+     */
+    public static final String JAXB_SCHEMA_LOCATION = "jaxb.schemaLocation";
+
+    /** <p>If this property is set to another value than null,
+     * then the <code>Marshaller</code> will create an attribute
+     * <samp>xsi:noNamespaceSchemaLocation</samp>. The attribute
+     * value is the property value. By default the property is set to
+     * null and no such attribute is generated.</p>
+     *
+     * @see #JAXB_SCHEMA_LOCATION
+     */
+    public static final String JAXB_NO_NAMESPACE_SCHEMA_LOCATION = "jaxb.noNamespaceSchemaLocation";
+
+    /**
+     * If this property is set to true, then the marshaller will generate
+     * document level events like {@link ContentHandler#startDocument()},
+     * or {@link ContentHandler#endDocument()}.
+     */
+    public static final String JAXB_FRAGMENT = "jaxb.fragment";
+
+    /** <p>Marshals the given JAXB object <code>pObject</code> to the
+     * {@link javax.xml.transform.Result} <code>pTarget</code>. All
+     * JAXB provider must support {@link javax.xml.transform.dom.DOMResult},
+     * {@link javax.xml.transform.sax.SAXResult}, and
+     * {@link javax.xml.transform.stream.StreamResult}, which can easily
+     * be mapped to {@link #marshal(Object, org.w3c.dom.Node)},
+     * {@link #marshal(Object, org.xml.sax.ContentHandler)},
+     * {@link #marshal(Object,java.io.OutputStream)}, or
+     * {@link #marshal(Object,java.io.Writer)}. The use of a
+     * {@link javax.xml.transform.Result} as a target isn't
+     * portable beyond these subinterfaces.</p>
+     *
+     * @param pObject The JAXB object being marshalled.
+     * @param pTarget The {@link Result} being created.
+     * @throws JAXBException An unexcpected problem occurred. This may be used,
+     *   for example, to throw a nested {@link java.io.IOException}.
+     * @throws MarshalException Whereever possible, one should throw a
+     *   {@link MarshalException}, and not a {@link JAXBException}.
+     * @throws IllegalArgumentException Any of the parameters was null.
+     * @see #JAXB_SCHEMA_LOCATION
+     * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+     */
+    void marshal(Object pObject, Result pTarget) throws JAXBException;
+
+    /** <p>Marshals the given JAXB object <code>pObject</code> and
+     * serializes it into the byte stream <code>pTarget</code>. Note,
+     * that serialization into a byte stream demands the use of an
+     * encoding. It may be required to set the parameter
+     * {@link #JAXB_ENCODING}. By default the created output is
+     * formatted, which may be turned off using
+     * {@link #JAXB_FORMATTED_OUTPUT}.</p>
+     *
+     * @param pObject The JAXB object being marshalled.
+     * @param pTarget The output byte stream.
+     * @throws JAXBException An unexpected problem occurred. This may be used,
+     *   for example, to throw a nested {@link java.io.IOException}.
+     * @throws MarshalException Whereever possible, one should prefer the
+     *   {@link MarshalException} over the {@link JAXBException}.
+     * @throws IllegalArgumentException Any of the parameters was null.
+     * @see #JAXB_ENCODING
+     * @see #JAXB_FORMATTED_OUTPUT
+     * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+     * @see #JAXB_SCHEMA_LOCATION
+     */
+    void marshal(Object pObject, OutputStream pTarget) throws JAXBException;
+
+    /** <p>Marshals the given JAXB object <code>pObject</code> and
+     * serializes it into the character stream <code>pTarget</code>.
+     * Unlike serialization to a byte stream, an encoding is not
+     * required, but a <code>Marshaller</code> may use the encoding
+     * whether to escape a character or not. Use of the 
+     * {@link #JAXB_ENCODING} property is still recommended. By
+     * default the created output is
+     * formatted, which may be turned off using
+     * {@link #JAXB_FORMATTED_OUTPUT}.</p>
+     *
+     * @param pObject The JAXB object being marshalled.
+     * @param pTarget The output character stream.
+     * @throws JAXBException An unexpected problem occurred. This may be used,
+     *   for example, to throw a nested {@link java.io.IOException}.
+     * @throws MarshalException Whereever possible, one should prefer the
+     *   {@link MarshalException} over the {@link JAXBException}.
+     * @throws IllegalArgumentException Any of the parameters was null.
+     * @see #JAXB_ENCODING
+     * @see #JAXB_FORMATTED_OUTPUT
+     * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+     * @see #JAXB_SCHEMA_LOCATION
+     */
+    void marshal(Object pObject, Writer pTarget) throws JAXBException;
+
+    /** <p>Marshals the given JAXB object by emitting SAX events into
+     * into the given SAX {@link org.xml.sax.ContentHandler}. This
+     * includes the events {@link org.xml.sax.ContentHandler#startDocument()}
+     * and {@link org.xml.sax.ContentHandler#endDocument()}.</p>
+     *
+     * @param pObject The JAXB Object being marshalled.
+     * @param pTarget The target event handler.
+     * @throws JAXBException An unexpected problem occurred. This may be used,
+     *   for example, to throw a nested {@link org.xml.sax.SAXException}.
+     * @throws MarshalException Whereever possible, one should prefer the
+     *   {@link MarshalException} over the {@link JAXBException}.
+     * @throws IllegalArgumentException Any of the parameters was null.
+     * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+     * @see #JAXB_SCHEMA_LOCATION
+     * @see #JAXB_FRAGMENT
+     */
+    void marshal(Object pObject, ContentHandler pTarget) throws JAXBException;
+
+    /**
+     * <p>Marshals the given JAXB object by creating a DOM tree below
+     * the given node.</p>
+     *
+     * @param pObject The JAXB object being marshalled.
+     * @param pTarget The target node. This node must be ready to accept a
+     *   child element. For example, it may be a {@link org.w3c.dom.Document},
+     *   a {@link org.w3c.dom.DocumentFragment}, or an
+     *   {@link org.w3c.dom.Element}.
+     * @throws JAXBException An unexpected problem occurred. This may be used,
+     *   for example, to throw a nested {@link org.w3c.dom.DOMException}.
+     * @throws MarshalException Whereever possible, one should prefer the
+     *   {@link MarshalException} over the {@link JAXBException}.
+     * @throws IllegalArgumentException Any of the parameters was null.
+     * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+     * @see #JAXB_SCHEMA_LOCATION
+     */
+    void marshal(Object pObject, Node pTarget) throws JAXBException;
+
+    /**
+     * <p>Marshals the given JAXB object by creating the given file.</p>
+     *
+     * @param pObject The JAXB object being marshalled.
+     * @param pFile The file being created.
+     * @throws JAXBException An unexpected problem occurred.
+     * @throws MarshalException Whereever possible, one should prefer the
+     *   {@link MarshalException} over the {@link JAXBException}.
+     * @throws IllegalArgumentException Any of the parameters was null.
+     * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+     * @see #JAXB_SCHEMA_LOCATION
+     * @see #JAXB_ENCODING
+     * @see #JAXB_FORMATTED_OUTPUT
+     */
+    void marshal(Object pObject, File pFile) throws JAXBException;
+
+    /**
+     * Marshals the given JAXB object by using the given
+     * {@link XMLStreamWriter}.
+     * 
+     * @param pObject The JAXB object being marshalled.
+     * @param pWriter The target writer.
+     * 
+     * @throws JAXBException An unexpected problem occurred.
+     * @throws MarshalException Whereever possible, one should prefer the
+     *   {@link MarshalException} over the {@link JAXBException}.
+     * @throws IllegalArgumentException Either of the parameters was null.
+     * @since JAXB 2.0
+     * @see #JAXB_FRAGMENT
+     * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+     * @see #JAXB_SCHEMA_LOCATION
+     */
+    void marshal(Object pObject, XMLStreamWriter pWriter) throws JAXBException;
+
+    /**
+     * Marshals the given JAXB object by raising events on the
+     * given {@link XMLEventWriter}.
+     * 
+     * @param pObject The JAXB object being marshalled.
+     * @param pWriter The event writer to call.
+     * 
+     * @throws JAXBException An unexpected problem occurred.
+     * @throws MarshalException Whereever possible, one should prefer the
+     *   {@link MarshalException} over the {@link JAXBException}.
+     * @throws IllegalArgumentException Either of the parameters was null.
+     * @since JAXB 2.0
+     * @see #JAXB_FRAGMENT
+     * @see #JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+     * @see #JAXB_SCHEMA_LOCATION
+     */
+    void marshal(Object pObject, XMLEventWriter pWriter) throws JAXBException;
+
+    /** <p>Returns a DOM view of the given JAXB object. This view is life
+     * in the sense that modifications of its DOM tree will trigger
+     * updates on the original JAXB object.</p>
+     * <p><em>Note</em>: This is an optional feature and not supported
+     * by all JAXB providers.</p>
+     * @param pObject The JAXB object being viewed.
+     * @throws UnsupportedOperationException The JAXB provider does not
+     *   support DOM views.
+     * @throws JAXBException An unexpected problem occurred. This may be used,
+     *   for example, to throw a nested {@link org.w3c.dom.DOMException}.
+     * @throws IllegalArgumentException The parameter was null.
+     */
+    Node getNode(Object pObject) throws JAXBException;
+
+    /** <p>Sets the marshaller property <code>pName</code> to the value
+     * <code>pValue</code>. Note, that the value type depends on the
+     * property being set. For example, the property
+     * {@link #JAXB_ENCODING} requires a string, but the property
+     * {@link #JAXB_FORMATTED_OUTPUT} requires a {@link Boolean}.</p>
+     * @param pName The property name.
+     * @throws PropertyException An error occurred while processing the property.
+     * @throws IllegalArgumentException The name parameter was null.
+     */
+    void setProperty(String pName, Object pValue) throws PropertyException;
+
+    /** <p>Returns the value of the marshaller property <code>pName</code>.
+     * Note, that the value type depends on the
+     * property being set. For example, the property
+     * {@link #JAXB_ENCODING} requires a string, but the property
+     * {@link #JAXB_FORMATTED_OUTPUT} requires a {@link Boolean}.</p>
+     * @param pName The property name.
+     * @throws PropertyException An error occurred while processing the property.
+     * @throws IllegalArgumentException The name parameter was null.
+     */
+    Object getProperty(String pName) throws PropertyException;
+
+    /** <p>Allows the application to set an event handler. The event handler
+     * will be invoked in case of a validation event.</p>
+     * <p><em>Note</em>: The ability to register an event handler does not
+     * indicate that a JAXB provider is required to validate the objects
+     * being marshalled. If you want to ensure, that only valid objects
+     * are marshalled, you should perform an explicit validation using a
+     * {@link javax.xml.bind.Validator}.</p>
+     * @param pHandler An application specific event handler or null to
+     *   revert to the default event handler. The default handler is
+     *   throwing an exception in case of errors.
+     */
+    void setEventHandler(ValidationEventHandler pHandler) throws JAXBException;
+
+    /** <p>Returns an event handler previously registered by the application.
+     * The event handler will be invoked in case of a validation event.</p>
+     * <p><em>Note</em>: The ability to register an event handler does not
+     * indicate that a JAXB provider is required to validate the objects
+     * being marshalled. If you want to ensure, that only valid objects
+     * are marshalled, you should perform an explicit validation using a
+     * {@link javax.xml.bind.Validator}.</p>
+     * @return An event handler previously set by the application or
+     *   the default event handler. The default handler is simply throwing
+     *   exceptions.
+     * @throws JAXBException An error occurred while getting the event
+     *   handler.
+     */
+    ValidationEventHandler getEventHandler() throws JAXBException;
+
+    /**
+     * Sets an adapter for conversion of Java/XML types.
+     * Shortcut for
+     * <pre>setAdapter(adapter.getClass(),adapter)</pre>
+     *
+     * @see #setAdapter(Class,XmlAdapter)
+     * @throws IllegalArgumentException The parameter is null.
+     * @throws UnsupportedOperationException The marshaller
+     *   doesn't support adapters.
+     * @since JAXB 2.0
+     */
+    void setAdapter(XmlAdapter<?,?> adapter );
+
+    /**
+     * Sets an adapter for conversion of Java/XML types.
+     * @param pType The adapter type, as referenced by
+     *   {@link javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value()}.
+     * @param pAdapter The adapter instance or null to remove the adapter
+     *   for {@code pType}.
+     * @throws IllegalArgumentException The type parameter is null.
+     * @throws UnsupportedOperationException The marshaller
+     *   doesn't support adapters.
+     * @since JAXB 2.0
+     */
+    public <A extends XmlAdapter<?,?>> void setAdapter(Class<A> pType, A pAdapter);
+
+    /**
+     * Returns the adapter, which is currently registered for the
+     * given type.
+     * @param pType The adapter type, as referenced by
+     *   {@link javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value()}.
+     * @return Currently registered adapter, if any, or null.
+     *
+     * @throws IllegalArgumentException The type parameter is null.
+     * @throws UnsupportedOperationException The marshaller
+     *   doesn't support adapters.
+     * @since JAXB 2.0
+     */
+    public <A extends XmlAdapter<?,?>> A getAdapter(Class<A> pType);
+
+    /**
+     * Sets an attachment handler, which allows to marshal parts
+     * of the XML document as binary attachments.
+     * @throws IllegalStateException The marshaller is currently in use.
+     */
+    void setAttachmentMarshaller(AttachmentMarshaller am);
+
+    /**
+     * Returns an attachment handler, which allows to marshal parts
+     * of the XML document as binary attachments.
+     */
+    AttachmentMarshaller getAttachmentMarshaller();
+
+    /**
+     * Sets a schema, which shall be used to validate objects
+     * while marshalling them. Defaults to null (validation is
+     * disabled).
+     *
+     * @param pSchema Non-null schema object to turn on validation
+     *   or null to turn off.
+     * @throws UnsupportedOperationException The marshaller doesn't
+     *   support schema validation.
+     * @since JAXB 2.0
+     */
+    void setSchema(Schema pSchema);
+
+    /**
+     * Returns a schema, which shall be used to validate objects
+     * while marshalling them. Defaults to null (validation is
+     * disabled).
+     *
+     * @return Non-null schema object, if validation is turned on,
+     *   otherwise null.
+     * @throws UnsupportedOperationException The marshaller doesn't
+     *   support schema validation.
+     * @since JAXB 2.0
+     */
+    Schema getSchema();
+
+    /**
+     * Registers an event listener, which is invoked by the marshaller.
+     * If an event listener is already registered, the current one
+     * will be replaced.
+     * @param pListener The event listener to register.
+     * @since JAXB 2.0
+     */
+    void setListener(Listener pListener);
+
+    /**
+     * Returns the current event listener.
+     * @return The current event listener, if any, or null.
+     * @since JAXB 2.0
+     */
+    Listener getListener();
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/NotIdentifiableEvent.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/NotIdentifiableEvent.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/NotIdentifiableEvent.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/NotIdentifiableEvent.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,28 @@
+/*
+ * 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 javax.xml.bind;
+
+/** <p>This event is triggered by the various <code>printFoo()</code>
+ * methods of the {@link DatatypeConverterInterface}, if they are
+ * unable to create a lexical representation of their input.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface NotIdentifiableEvent extends ValidationEvent {
+    // No additional methods.
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/ParseConversionEvent.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/ParseConversionEvent.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/ParseConversionEvent.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/ParseConversionEvent.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,26 @@
+/*
+ * 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 javax.xml.bind;
+
+/** <p>This event indicates a problem while resolving an IDREF.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface ParseConversionEvent extends ValidationEvent {
+    // No additional methods.
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/PrintConversionEvent.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/PrintConversionEvent.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/PrintConversionEvent.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/PrintConversionEvent.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,26 @@
+/*
+ * 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 javax.xml.bind;
+
+/** <p>This event indicates a problem while resolving an IDREF.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface PrintConversionEvent extends ValidationEvent {
+    // No additional methods.
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/PropertyException.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/PropertyException.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/PropertyException.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/PropertyException.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,82 @@
+/*
+ * 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 javax.xml.bind;
+
+/** <p>The <code>PropertyException</code> is a subclass of the
+ * {@link javax.xml.bind.JAXBException} being thrown if setting
+ * or getting a property failed.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+@SuppressWarnings("serial") // Not provided by RI
+public class PropertyException extends JAXBException {
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * detail message.</p>
+   * @param pMessage The detail message.
+   */
+  public PropertyException(String pMessage) {
+    super(pMessage);
+  }
+
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * detail message and vendor specific error code.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The error code.
+   */
+  public PropertyException(String pMessage, String pErrorCode) {
+    super(pMessage, pErrorCode);
+  }
+
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * linked exception.</p>
+   * @param pLinkedException The linked exception.
+   */
+  public PropertyException(Throwable pLinkedException) {
+    super(pLinkedException);
+  }
+
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * detail message and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pLinkedException The linked exception.
+   */
+  public PropertyException(String pMessage, Throwable pLinkedException) {
+    super(pMessage, pLinkedException);
+  }
+
+  /** <p>Creates a new <code>PropertyException</code> with the specified
+   * detail message, error code, and linked exception.</p>
+   * @param pMessage The detail message.
+   * @param pErrorCode The vendor specific error code.
+   * @param pLinkedException The linked exception.
+   */
+  public PropertyException(String pMessage, String pErrorCode,
+                           Throwable pLinkedException) {
+    super(pMessage, pErrorCode, pLinkedException);
+  }
+
+  /** <p>Creates a new <code>PropertyException> by invoking
+   * {@link #PropertyException(String)} with a message derived from
+   * <code>pName</code> and <code>pValue.toString()</code>.</p>
+   * @param pName A Property name.
+   * @param pValue A property value.
+   */
+  public PropertyException(String pName, Object pValue) {
+    super("Property error: name=" + pName + ", value=" + pValue);
+  }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/SchemaOutputResolver.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/SchemaOutputResolver.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/SchemaOutputResolver.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/SchemaOutputResolver.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,37 @@
+/*
+ * 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 javax.xml.bind;
+
+import javax.xml.transform.Result;
+import java.io.IOException;
+
+
+/**
+ * An object, which controls the target of a set of
+ * schema documents.
+ */
+public abstract class SchemaOutputResolver {
+    /**
+     * Returns an instance of {@link Result}, to which the
+     * given schema document shall be written.
+     * @param pNamespaceURI The schema documents namespace URI.
+     * @param pFileName The suggested schema documents file name.
+     * @return A valid instance of {@link Result} or null, if the
+     *   schema document shall be skipped.
+     */
+    public abstract Result createOutput(String pNamespaceURI, String pFileName) throws IOException;
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/TypeConstraintException.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/TypeConstraintException.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/TypeConstraintException.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/TypeConstraintException.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,148 @@
+/*
+ * 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 javax.xml.bind;
+
+import java.io.PrintStream;
+
+/** <p>This is a runtime exception. The desired use is for
+ * generated set methods which would like to indicate that the
+ * specified value is invalid, for example, because a facet
+ * restriction wasn't met.</p>
+ * <p>If a generated setter throws a <code>TypeConstraintException</code>,
+ * then it is the JAXB providers task to ensure, that the object,
+ * on which the setter is invoked, remains unchanged.</p>
+ *
+ * @author JSR-31
+ * @since JAXB 1.0
+ */
+@SuppressWarnings("serial") // Not provided by RI
+public class TypeConstraintException extends RuntimeException {
+    private String errorCode;
+    private Throwable linkedException;
+
+    /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+     * detail message.</p>
+     * @param pMessage The detail message.
+     */
+    public TypeConstraintException(String pMessage) {
+        super(pMessage);
+    }
+
+    /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+     * detail message and vendor specific error code.</p>
+     * @param pMessage The detail message.
+     * @param pErrorCode The error code.
+     */
+    public TypeConstraintException(String pMessage, String pErrorCode) {
+        super(pMessage);
+        errorCode = pErrorCode;
+    }
+
+    /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+     * linked exception.</p>
+     * @param pLinkedException The linked exception.
+     */
+    public TypeConstraintException(Throwable pLinkedException) {
+        linkedException = pLinkedException;
+    }
+
+    /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+     * detail message and linked exception.</p>
+     * @param pMessage The detail message.
+     * @param pLinkedException The linked exception.
+     */
+    public TypeConstraintException(String pMessage, Throwable pLinkedException) {
+        super(pMessage);
+        linkedException = pLinkedException;
+    }
+
+    /** <p>Creates a new <code>TypeConstraintException</code> with the specified
+     * detail message, error code, and linked exception.</p>
+     * @param pMessage The detail message.
+     * @param pErrorCode The vendor specific error code.
+     * @param pLinkedException The linked exception.
+     */
+    public TypeConstraintException(String pMessage, String pErrorCode,
+            Throwable pLinkedException) {
+        super(pMessage);
+        errorCode = pErrorCode;
+        linkedException = pLinkedException;
+    }
+
+    /** <p>Returns the vendor specific error code, if any, or null.</p>
+     */
+    public String getErrorCode() {
+        return errorCode;
+    }
+
+    /** <p>Returns the linked exception, if any, or null.</p>
+     */
+    public Throwable getLinkedException() {
+        return linkedException;
+    }
+
+    /** <p>Sets the linked exception.</p>
+     * @param pLinkedException The linked exception or null.
+     */
+    public void setLinkedException(Throwable pLinkedException) {
+        linkedException = pLinkedException;
+    }
+
+    /** <p>Converts the linked exception into a String. Overridden,
+     * because the returned string should contain the vendor specific
+     * error code, if any.</p>
+     */
+    @Override
+    public String toString() {
+        final String s;
+        if (errorCode == null  ||  errorCode.length() == 0) {
+            s = super.toString();
+        } else {
+            s = errorCode + ": " + super.toString();
+        }
+        if (linkedException == null) {
+            return s;
+        }
+        return s + "\n - with linked exception:\n[" +
+                                    linkedException.toString()+ "]";
+    }
+
+    /**
+     * Prints this exceptions stack trace to the stream
+     * {@code pStream}. Includes the stack trace of the
+     * linked exception.
+     * @param pStream Target stream
+     */
+    @Override
+    public void printStackTrace(PrintStream pStream) {
+        if (linkedException != null) {
+          linkedException.printStackTrace(pStream);
+          pStream.println("--------------- linked to ------------------");
+        }
+        super.printStackTrace(pStream);
+    }
+ 
+    /**
+     * Prints this exceptions stack trace to System.err
+     * {@code pStream}. Includes the stack trace of the
+     * linked exception.
+     */
+    @Override
+    public void printStackTrace() {
+        printStackTrace(System.err);
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org