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 2006/11/24 13:04:29 UTC
svn commit: r478847 [2/3] - in /webservices/jaxme/branches/MAVEN/jaxme-api:
./ src/ 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/helpers/ src/main/java/javax/xml/bind/...
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ParseConversionEvent.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ParseConversionEvent.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ParseConversionEvent.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ParseConversionEvent.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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 {
+
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/PrintConversionEvent.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/PrintConversionEvent.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/PrintConversionEvent.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/PrintConversionEvent.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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 {
+
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/PropertyException.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/PropertyException.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/PropertyException.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/PropertyException.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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
+ */
+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/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/TypeConstraintException.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/TypeConstraintException.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/TypeConstraintException.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/TypeConstraintException.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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 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 JAXB1.0
+ */
+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>
+ */
+ public String toString() {
+ if (errorCode == null || errorCode.length() == 0) {
+ return super.toString();
+ } else {
+ return errorCode + ": " + super.toString();
+ }
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/UnmarshalException.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/UnmarshalException.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/UnmarshalException.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/UnmarshalException.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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
+ * unmarshalling of a JAXB object failed.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class UnmarshalException extends JAXBException {
+ /** <p>Creates a new <code>UnmarshalException</code> with the specified
+ * detail message.</p>
+ * @param pMessage The detail message.
+ */
+ public UnmarshalException(String pMessage) {
+ super(pMessage);
+ }
+
+ /** <p>Creates a new <code>UnmarshalException</code> with the specified
+ * detail message and vendor specific error code.</p>
+ * @param pMessage The detail message.
+ * @param pErrorCode The error code.
+ */
+ public UnmarshalException(String pMessage, String pErrorCode) {
+ super(pMessage, pErrorCode);
+ }
+
+ /** <p>Creates a new <code>UnmarshalException</code> with the specified
+ * linked exception.</p>
+ * @param pLinkedException The linked exception.
+ */
+ public UnmarshalException(Throwable pLinkedException) {
+ super(pLinkedException);
+ }
+
+ /** <p>Creates a new <code>UnmarshalException</code> with the specified
+ * detail message and linked exception.</p>
+ * @param pMessage The detail message.
+ * @param pLinkedException The linked exception.
+ */
+ public UnmarshalException(String pMessage, Throwable pLinkedException) {
+ super(pMessage, pLinkedException);
+ }
+
+ /** <p>Creates a new <code>UnmarshalException</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 UnmarshalException(String pMessage, String pErrorCode,
+ Throwable pLinkedException) {
+ super(pMessage, pErrorCode, pLinkedException);
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/Unmarshaller.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/Unmarshaller.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/Unmarshaller.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/Unmarshaller.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,209 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.Source;
+
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/** <p>A <code>Unmarshaller</code> is the opposite of the {@link Marshaller}:
+ * It takes as input XML in either of several representations (byte or
+ * character stream, DOM node, or a series of SAX events) and returns
+ * a JAXB object with the same contents.</p>
+ * <p>If the JAXB user demands, the <code>Unmarshaller</code> may also
+ * validate the content tree that it sees.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ * @see JAXBContext
+ * @see Marshaller
+ * @see Validator
+ */
+public interface Unmarshaller {
+ /** <p>This method takes opens the given file <code>pFile</code>
+ * for input. The Unmarshaller reads the byte stream contained in
+ * the file and converts it into an equivalent JAXB object.</p>
+ * @param pFile The file being read.
+ * @return The JAXB object read from the file.
+ * @throws JAXBException An unexpected problem (for example an
+ * IOException) occurred.
+ * @throws UnmarshalException The JAXB object is invalid or could
+ * not be read from the byte stream for similar reasons.
+ * @throws IllegalArgumentException The parameter was null.
+ */
+ public java.lang.Object unmarshal(java.io.File pFile) throws JAXBException;
+
+ /** <p>The Unmarshaller reads the given byte stream
+ * and converts it into an equivalent JAXB object.</p>
+ * @param pStream The stream being read.
+ * @return The JAXB object read from the byte stream.
+ * @throws JAXBException An unexpected problem (for example an
+ * IOException) occurred.
+ * @throws UnmarshalException The JAXB object is invalid or could
+ * not be read from the byte stream for similar reasons.
+ * @throws IllegalArgumentException The parameter was null.
+ */
+ public java.lang.Object unmarshal(java.io.InputStream pStream) throws JAXBException;
+
+ /** <p>This method takes connects to the given <code>pURL</code>
+ * and opens a byte stream for input. The Unmarshaller reads the
+ * byte stream and converts it into an equivalent JAXB object.</p>
+ * @param pURL The URL being read.
+ * @return The JAXB object read from the URL.
+ * @throws JAXBException An unexpected problem (for example an
+ * IOException) occurred.
+ * @throws UnmarshalException The JAXB object is invalid or could
+ * not be read from the byte stream for similar reasons.
+ * @throws IllegalArgumentException The parameter was null.
+ */
+ public java.lang.Object unmarshal(java.net.URL pURL) throws JAXBException;
+
+ /** <p>The Unmarshaller reads the byte stream or character
+ * stream referred by the {@link org.xml.sax.InputSource}
+ * and converts it into an equivalent JAXB object.</p>
+ * @param pSource The {@link InputSource} referring to a byte or
+ * character stream. It is recommended, that the system ID is
+ * set. This may be required, if the XML in the stream refers
+ * to external entities.
+ * @return The JAXB object read from the byte or character stream.
+ * @throws JAXBException An unexpected problem (for example an
+ * IOException) occurred.
+ * @throws UnmarshalException The JAXB object is invalid or could
+ * not be read from the byte stream for similar reasons.
+ * @throws IllegalArgumentException The parameter was null.
+ */
+ public java.lang.Object unmarshal(InputSource pSource) throws JAXBException;
+
+ /** <p>The Unmarshaller converts the given node into an equivalent
+ * JAXB object.</p>
+ * @param pNode The node to convert. The JAXB provider must support
+ * documents and elements. Other node types may not work
+ * (document fragments) or cannot work (attributes, text nodes,
+ * and so on).
+ * @return The JAXB object read from the DOM node.
+ * @throws JAXBException An unexpected problem occurred.
+ * @throws UnmarshalException The JAXB object is invalid or could
+ * not be read for similar reasons.
+ * @throws IllegalArgumentException The parameter was null.
+ */
+ public java.lang.Object unmarshal(Node pNode) throws JAXBException;
+
+ /** <p>The Unmarshaller reads the XML representation from the given
+ * {@link Source} and converts it into an equivalent JAXB object.</p>
+ * <p>The JAXB provider must support at least
+ * {@link javax.xml.transform.sax.SAXSource},
+ * {@link javax.xml.transform.dom.DOMSource}, and
+ * {@link javax.xml.transform.stream.StreamSource}. A possible
+ * implementation could validate whether the argument is actually
+ * an instance of these subinterfaces. If so, it might simply
+ * act like
+ * {@link #getUnmarshallerHandler()},
+ * {@link #unmarshal(org.w3c.dom.Node)},
+ * {@link #unmarshal(java.io.InputStream)}, or
+ * {@link #unmarshal(org.xml.sax.InputSource)}, respectively.</p>
+ * <p><em>Note</em>: If you are not using the standard JAXP
+ * mechanism for obtaining an {@link org.xml.sax.XMLReader},
+ * then you might create your own SAX parser and invoke the
+ * <code>pSource</code> arguments
+ * {@link javax.xml.transform.sax.SAXSource#setXMLReader(org.xml.sax.XMLReader)}.
+ * The JAXB provider will detect and use your SAX parser.</p>
+ *
+ * @return The JAXB object read from the DOM node.
+ * @param pSource The {@link Source} being read.
+ * @throws JAXBException An unexpected problem occurred.
+ * @throws UnmarshalException The JAXB object is invalid or could
+ * not be read for similar reasons.
+ * @throws IllegalArgumentException The parameter was null.
+ */
+ public java.lang.Object unmarshal(Source pSource) throws JAXBException;
+
+ /** <p>Returns a SAX 2 {@link org.xml.sax.ContentHandler}, which is
+ * able to parse a SAX event stream and convert it into a JAXB
+ * object. This is particularly useful in a stack of SAX
+ * handlers. (Think of Apache Cocoon.)</p>
+ * <p><em>Note</em>: The JAXB provider may choose to return the
+ * same handler again, if the method is invoked more than once.
+ * In other words, if you need to have multiple handlers (for
+ * example, because you have multiple threads), then you should
+ * create multiple <code>Unmarshallers</code>.</p>
+ */
+ public UnmarshallerHandler getUnmarshallerHandler() throws JAXBException;
+
+ /** <p>Sets whether the <code>Unmarshaller</code> is validating
+ * the objects that it reads. The default is false.</p>
+ * <p><em>Note</em>: A validating unmarshaller will rarely use
+ * a validating SAX parser by default! It does so, because the
+ * SAX parsers validation and the Unmarshallers builtin
+ * validation would most probably validate the same things,
+ * resulting in no additional safety at the cost of wasting
+ * performance. Second, a SAX parser is not always in use.
+ * For example, you do not need a parser when
+ * converting a DOM Node. If you insist in a validating XML
+ * parser, then you should create your own
+ * {@link org.xml.sax.XMLReader} and use the method
+ * {@link #unmarshal(javax.xml.transform.Source)}.</p>
+ * @param pValidating Whether the <code>Unmarshaller</code> should validate
+ * or not.
+ * @throws JAXBException Setting the property failed.
+ */
+ public void setValidating(boolean pValidating) throws JAXBException;
+
+ /** <p>Sets whether the <code>Unmarshaller</code> is validating
+ * the objects that it reads. The default is false.</p>
+ * @see #setValidating(boolean)
+ * @return True, if the <code>Unmarshaller</code> is validating the objects
+ * that it reads, false otherwise.
+ * @throws JAXBException Fetching the property value failed.
+ */
+ public boolean isValidating() throws JAXBException;
+
+ /** <p>An application may customize the Unmarshallers behaviour
+ * in case of validation problems by supplying a custom handler
+ * for validation events. The default handler will trigger an
+ * exception in case of errors and fatal errors.</p>
+ * @param pHandler The custom event handler or null to restore
+ * the default event handler.
+ * @throws JAXBException Setting the handler failed.
+ */
+ public void setEventHandler(ValidationEventHandler pHandler) throws JAXBException;
+
+ /** <p>If the JAXB application has registered a custom handler
+ * for validation events, returns that handler. Otherwise returns
+ * the default handler, which is triggering an exception in case
+ * of errors and fatal errors.</p>
+ */
+ public ValidationEventHandler getEventHandler() throws JAXBException;
+
+ /** <p>Sets the unmarshaller property <code>pName</code> to the value
+ * <code>pValue</code>. Note, that the value type depends on the
+ * property being set.</p>
+ * @param pName The property name.
+ * @throws PropertyException An error occurred while processing the property.
+ * @throws IllegalArgumentException The name parameter was null.
+ */
+ public void setProperty(String pName, Object pValue) throws PropertyException;
+
+ /** <p>Returnss the unmarshaller property <code>pName</code> to the value
+ * <code>pValue</code>. Note, that the value type depends on the
+ * property being set.</p>
+ * @param pName The property name.
+ * @throws PropertyException An error occurred while processing the property.
+ * @throws IllegalArgumentException The name parameter was null.
+ */
+ public java.lang.Object getProperty(String pName) throws PropertyException;
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/UnmarshallerHandler.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/UnmarshallerHandler.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/UnmarshallerHandler.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/UnmarshallerHandler.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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 org.xml.sax.ContentHandler;
+
+
+/** <p>This interface is the SAX {@link org.xml.sax.ContentHandler}
+ * representation of an {@link javax.xml.bind.Unmarshaller}, as
+ * returned by
+ * {@link javax.xml.bind.Unmarshaller#getUnmarshallerHandler()}.
+ * It can be embedded into a stack of SAX handlers, for example
+ * within Apache Cocoon.</p>
+ * <p>The <code>UnmarshallerHandler</code> is reusable: The
+ * <code>startDocument()</code> method is expected to perform
+ * a reinitialization. Like most other SAX handlers, the
+ * <code>UnmarshallerHandler</code> is never thread safe.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public interface UnmarshallerHandler extends ContentHandler {
+ /** <p>Returns the unmarshalled object. This method may be invoked
+ * after an <code>endDocument()</code> event only. An
+ * {@link IllegalStateException} is thrown otherwise.
+ * @return The unmarshalled object, never null. (An
+ * {@link IllegalStateException} is thrown, if no data is
+ * available.
+ * @throws JAXBException An error occurred. Note, that the
+ * {@link UnmarshallerHandler} throws a
+ * {@link org.xml.sax.SAXException} if an error occurs while
+ * unmarshalling the object. In such cases the
+ * {@link JAXBException} is typically nested within the
+ * {@link org.xml.sax.SAXException}.
+ * @throws IllegalStateException An <code>endDocument()</code>
+ * event has not yet been seen and no data is available.
+ */
+ public Object getResult() throws JAXBException, IllegalStateException;
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEvent.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEvent.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEvent.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEvent.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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>An instance of <code>ValidationEvent</code> indicates some
+ * error condition, which occurred when validating a JAXB object.
+ * The purpose of the {@link ValidationEventHandler} is to
+ * customize the reply on instances of <code>ValidationEvent</code>.
+ * The default event handler will throw an exception in case of
+ * events, but application specific validation event handlers need
+ * not do the same.</p>
+ *
+ * @see Validator
+ * @see ValidationEventHandler
+ * @since JAXB1.0
+ * @author JSR-31
+ */
+public interface ValidationEvent {
+ /** <p>In contrast to errors or fatal errors, this indicates an
+ * event which can possibly be ignored. This constant has the
+ * value 0. See section 1.2 of the W3C XML 1.0 Recommendation for
+ * details.</p>
+ * @see #ERROR
+ * @see #FATAL_ERROR
+ * @see #getSeverity()
+ */
+ public static final int WARNING = 0;
+
+ /** <p>This value indicates an "error", as specified by section
+ * 1.2 of the W3C XML 1.0 Recommendation. The constant value is
+ * 1.</p>
+ * @see #WARNING
+ * @see #FATAL_ERROR
+ * @see #getSeverity()
+ */
+ public static final int ERROR = 1;
+
+ /** <p>This value indicates a "fatal error", as specified by section
+ * 1.2 of the W3C XML 1.0 Recommendation. The constant value is
+ * 2.</p>
+ * @see #WARNING
+ * @see #ERROR
+ * @see #getSeverity()
+ */
+ public static final int FATAL_ERROR = 2;
+
+ /** <p>Returns the events severity: Either of
+ * {@link #WARNING}, {@link #ERROR}, or {@link #FATAL_ERROR}.</p>
+ * @return Returns the events severity.
+ */
+ public int getSeverity();
+
+ /** <p>Returns a textual description of the event.</p>
+ */
+ public java.lang.String getMessage();
+
+ /** <p>Returns a {@link Throwable} related to the event. In most cases
+ * an exception causing the event.</p>
+ */
+ public java.lang.Throwable getLinkedException();
+
+ /** <p>Returns a description of the location, where the event
+ * occurred.</p>
+ */
+ public ValidationEventLocator getLocator();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEventHandler.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEventHandler.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEventHandler.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEventHandler.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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>An instance of <code>ValidationEventHandler</code> allows
+ * to customize the reply to instances of
+ * {@link javax.xml.bind.ValidationEvent}. By default, there is
+ * a standard <code>ValidationEventHandler</code>, converting
+ * errors and fatal errors in Exceptions.</p>
+ * <p>The JAXB user creates instances of <code>ValidationEventHandler</code>
+ * and registers them with the {@link Marshaller}, {@link Unmarshaller},
+ * or {@link Validator}. The JAXB provider is required not to throw
+ * exceptions directly, but to convert all detected problems into events,
+ * which are fired on the <code>ValidationEventHandler</code>.</p>
+ *
+ * @since JAXB1.0
+ * @author JSR-31
+ * @see Marshaller
+ * @see Unmarshaller
+ * @see javax.xml.bind.ValidationEvent
+ */
+public interface ValidationEventHandler {
+ /** <p>The <code>handleEvent</code> method is invoked by the
+ * JAXB provider, if a problem was found. The events
+ * {@link javax.xml.bind.ValidationEventLocator} may be
+ * used to locate the source of the problem.</p>
+ *
+ * @param pEvent The event being reported to the JAXB user.
+ * @return True as an indicator that the JAXB provider should
+ * attempt to continue its current operation. (Marshalling,
+ * Unmarshalling, Validating) This will not always work.
+ * In particular, you cannot expect that the operation
+ * continues, if a fatal error was reported. False to
+ * indicate that the JAXB provider should terminate the
+ * operation and through an appropriate exception.
+ * @throws IllegalArgumentException The parameter is null.
+ */
+ public boolean handleEvent(ValidationEvent pEvent);
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEventLocator.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEventLocator.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEventLocator.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationEventLocator.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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 org.w3c.dom.Node;
+
+/** <p>The <code>ValidationEventLocator</code> is an abstract
+ * description of the place where a {@link javax.xml.bind.ValidationEvent}
+ * occurred.</p>
+ * <p>Depending on the source or target media (Unmarshalling, or Unmarshalling)
+ * or the object being validated, you will most probably find that different
+ * fields of the <code>ValidationEventHandler</code> are set. For example,
+ * if you are using a {@link org.xml.sax.ContentHandler}, you will most
+ * probably find that those fields are set, which are common to a
+ * {@link org.xml.sax.Locator}.</p>
+ *
+ * @see javax.xml.bind.ValidationEvent
+ * @since JAXB1.0
+ * @author JSR-31
+ */
+public interface ValidationEventLocator {
+ /** <p>Returns a URL related to the validation event, if available.
+ * For example, when parsing an {@link org.xml.sax.InputSource}, this
+ * might be the URL given by {@link org.xml.sax.InputSource#getSystemId()}.</p>
+ * @return The validation event URL, if available, or null.
+ */
+ public java.net.URL getURL();
+
+ /** <p>Returns a byte offset related to the validation event, if
+ * available. For example, when parsing an {@link java.io.InputStream},
+ * this might be the position where the event occurred.</p>
+ * @return Byte offset, if available, or -1.
+ */
+ public int getOffset();
+
+ /** <p>Returns a line number related to the validation event, if
+ * available. For example, when parsing an {@link java.io.InputStream},
+ * this might be the line, in which the event occurred.</p>
+ * @return Line number, if available, or -1.
+ */
+ public int getLineNumber();
+
+ /** <p>Returns a column number related to the validation event, if
+ * available. For example, when parsing an {@link java.io.InputStream},
+ * this might be the column, in which the event occurred.</p>
+ * @return Column number, if available, or -1.
+ */
+ public int getColumnNumber();
+
+ /** <p>Returns an object in the JAXB objects content tree related
+ * to the validation event. Usually this is the invalid object or
+ * child object.</p>
+ * @return Part of a JAXB object tree, if available, or null.
+ */
+ public java.lang.Object getObject();
+
+ /** <p>Returns a DOM node related to the validation event. For
+ * example, this might be an element node with a missing attribute.
+ * It might as well be an attribute node with an invalid value.</p>
+ * @return Invalid node, if available, or null.
+ */
+ public Node getNode();
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationException.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationException.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationException.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/ValidationException.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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
+ * validation of a JAXB object failed.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class ValidationException extends JAXBException {
+ /** <p>Creates a new <code>ValidationException</code> with the specified
+ * detail message.</p>
+ * @param pMessage The detail message.
+ */
+ public ValidationException(String pMessage) {
+ super(pMessage);
+ }
+
+ /** <p>Creates a new <code>ValidationException</code> with the specified
+ * detail message and vendor specific error code.</p>
+ * @param pMessage The detail message.
+ * @param pErrorCode The error code.
+ */
+ public ValidationException(String pMessage, String pErrorCode) {
+ super(pMessage, pErrorCode);
+ }
+
+ /** <p>Creates a new <code>ValidationException</code> with the specified
+ * linked exception.</p>
+ * @param pLinkedException The linked exception.
+ */
+ public ValidationException(Throwable pLinkedException) {
+ super(pLinkedException);
+ }
+
+ /** <p>Creates a new <code>ValidationException</code> with the specified
+ * detail message and linked exception.</p>
+ * @param pMessage The detail message.
+ * @param pLinkedException The linked exception.
+ */
+ public ValidationException(String pMessage, Throwable pLinkedException) {
+ super(pMessage, pLinkedException);
+ }
+
+ /** <p>Creates a new <code>ValidationException</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 ValidationException(String pMessage, String pErrorCode,
+ Throwable pLinkedException) {
+ super(pMessage, pErrorCode, pLinkedException);
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/Validator.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/Validator.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/Validator.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/Validator.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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>A <code>Validator</code> may be used to decide, whether
+ * a JAXB object is valid or not. If it is not, the JAXB user
+ * may decide to trigger an exception or not (via the
+ * {@link javax.xml.bind.ValidationEventHandler} and he may
+ * receive information on the problems location (via the
+ * event handlers {@link javax.xml.bind.ValidationEventLocator}.</p>
+ * <p>A Validator may be present implicitly, invoked by the
+ * Unmarshaller. See {@link javax.xml.bind.Unmarshaller#setValidating(boolean)} for
+ * more information on that.</p>
+ * @since JAXB1.0
+ * @author JSR-31
+ * @see ValidationEventHandler
+ * @see ValidationEvent
+ */
+public interface Validator {
+ /** <p>Registers an event handler that shall be invoked for
+ * notifications on problems detected by the <code>Validator</code>.
+ * If this method is not invoked, there is a default event handler.
+ * The default event handler will trigger an exception for
+ * errors and fatal errors.</p>
+ *
+ * @param pHandler The event handler being notified or null
+ * to restore the default event handler.
+ * @throws JAXBException Setting the event handler failed.
+ */
+ public void setEventHandler(ValidationEventHandler pHandler) throws JAXBException;
+
+ /** <p>Returns an event handler that shall be invoked for
+ * notifications on problems detected by the <code>Validator</code>.
+ * If no specific event handler was set, returns the default
+ * event handler. The default event handler will trigger an
+ * exception for errors and fatal errors.</p>
+ *
+ * @throws JAXBException Getting the event handler failed.
+ * @return The event handler previously set or the default
+ * handler.
+ */
+ public ValidationEventHandler getEventHandler() throws JAXBException;
+
+ /** <p>Validates the given JAXB object, invoking its error handler
+ * for any problems it detects. Detected problems may cause exceptions,
+ * for example, if the event handlers
+ * {@link ValidationEventHandler#handleEvent(ValidationEvent)}
+ * method returns false.</p>
+ *
+ * @param pObject The JAXB object being validated.
+ * @throws JAXBException An unexpected problem occurred during
+ * validation
+ * @throws ValidationException It was detected, that the
+ * object is invalid.
+ * @throws IllegalArgumentException The parameter was null.
+ * @see #validateRoot(Object)
+ */
+ public boolean validate(Object pObject) throws JAXBException;
+
+ /** <p>Validates the given JAXB object, but not its child
+ * elements.</p>
+ *
+ * @param pObject The JAXB object being validated.
+ * @throws JAXBException An unexpected problem occurred during
+ * validation
+ * @throws ValidationException It was detected, that the
+ * object is invalid.
+ * @throws IllegalArgumentException The parameter was null.
+ * @see #validate(Object)
+ */
+ public boolean validateRoot(Object pObject) throws JAXBException;
+
+ /** <p>Sets the <code>Validator</code> property <code>pName</code>
+ * to <code>pValue</code>.</p>
+ * <p><em>Note</em>: The values type depends on the property name.</p>
+ *
+ * @param pName The property name.
+ * @param pValue The property value.
+ * @throws PropertyException Setting the property failed.
+ * @throws IllegalArgumentException The <code>pName</code> parameter was null.
+ */
+ public void setProperty(String pName, Object pValue) throws PropertyException;
+
+ /** <p>Returns the marshallers property <code>pName</code>.</p>
+ * <p><em>Note</em>: The values type depends on the property name.</p>
+ *
+ * @param pName The property name.
+ * @return The property value.
+ * @throws PropertyException Fetching the property failed.
+ * @throws IllegalArgumentException The parameter was null.
+ */
+ public java.lang.Object getProperty(String pName) throws PropertyException;
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/AbstractMarshallerImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/AbstractMarshallerImpl.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/AbstractMarshallerImpl.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/AbstractMarshallerImpl.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,242 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.helpers;
+
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.PropertyException;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamResult;
+
+import org.w3c.dom.Node;
+import org.xml.sax.ContentHandler;
+
+
+/** <p>Default implementation of a Marshaller. The JAXB provider needs
+ * to implement only
+ * {@link javax.xml.bind.Marshaller#marshal(Object, javax.xml.transform.Result)}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ * @see javax.xml.bind.Marshaller
+ */
+public abstract class AbstractMarshallerImpl implements Marshaller {
+ private String encoding = "UTF-8";
+ private String schemaLocation, noNSSchemaLocation;
+ private boolean isFormattedOutput = true;
+ private ValidationEventHandler eventHandler = DefaultValidationEventHandler.theInstance;
+
+ /** <p>Creates a new instance of <code>AbstractMarshallerImpl</code>.</p>
+ */
+ public AbstractMarshallerImpl() {
+ }
+
+ /* @see javax.xml.bind.Marshaller#setValidationEventHandler(javax.xml.bind.ValidationEventHandler)}
+ */
+ public void setEventHandler(ValidationEventHandler pHandler) throws JAXBException {
+ eventHandler = pHandler;
+ }
+
+ /* @see javax.xml.bind.Marshaller#getValidationEventHandler()}
+ */
+ public ValidationEventHandler getEventHandler() throws JAXBException {
+ return eventHandler;
+ }
+
+ /** <p>Public interface to set the properties defined
+ * by the {@link javax.xml.bind.Marshaller} interface.
+ * Works by invocation of {@link #setEncoding(String)},
+ * {@link #setFormattedOutput(boolean)},
+ * {@link #setNoNSSchemaLocation(String)}, and
+ * {@link #setSchemaLocation(String)} internally.</p>
+ * <p>If you want to support additional properties,
+ * you have to override this method in a subclass.</p>
+ * @throws PropertyException Unknown property name
+ */
+ public void setProperty(String pName, Object pValue) throws PropertyException {
+ if (pName == null) {
+ throw new IllegalArgumentException("The property name must not be null.");
+ }
+ if (Marshaller.JAXB_ENCODING.equals(pName)) {
+ setEncoding((String) pValue);
+ } else if (Marshaller.JAXB_FORMATTED_OUTPUT.equals(pName)) {
+ if (pValue == null) {
+ setFormattedOutput(true);
+ } else {
+ setFormattedOutput(((Boolean) pValue).booleanValue());
+ }
+ } else if (Marshaller.JAXB_SCHEMA_LOCATION.equals(pName)) {
+ setSchemaLocation((String) pValue);
+ } else if (Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(pName)) {
+ setNoNSSchemaLocation((String) pValue);
+ } else {
+ throw new PropertyException("Unknown property name: " + pName);
+ }
+ }
+
+ /** <p>Public interface to get the properties defined
+ * by the {@link javax.xml.bind.Marshaller} interface.
+ * Works by invocation of {@link #getEncoding()},
+ * {@link #isFormattedOutput()},
+ * {@link #getNoNSSchemaLocation()}, and
+ * {@link #getSchemaLocation()} internally.</p>
+ * <p>If you want to support additional properties,
+ * you have to override this method in a subclass.</p>
+ * @throws PropertyException Unknown property name
+ */
+ public Object getProperty(String pName) throws PropertyException {
+ if (pName == null) {
+ throw new IllegalArgumentException("The property name must not be null.");
+ }
+ if (Marshaller.JAXB_ENCODING.equals(pName)) {
+ return getEncoding();
+ } else if (Marshaller.JAXB_FORMATTED_OUTPUT.equals(pName)) {
+ return isFormattedOutput() ? Boolean.TRUE : Boolean.FALSE;
+ } else if (Marshaller.JAXB_SCHEMA_LOCATION.equals(pName)) {
+ return getSchemaLocation();
+ } else if (Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION.equals(pName)) {
+ return getNoNSSchemaLocation();
+ } else {
+ throw new PropertyException("Unknown property name: " + pName);
+ }
+ }
+
+ /** <p>Returns the current output encoding.</p>
+ * @see javax.xml.bind.Marshaller#JAXB_ENCODING
+ * @return The current encoding, by default "UTF-8".
+ */
+ protected String getEncoding() {
+ return encoding;
+ }
+
+ /** <p>Converts the given IANA encoding name into a Java encoding
+ * name. This is a helper method for derived subclasses.</p>
+ */
+ protected String getJavaEncoding(String pEncoding)
+ throws UnsupportedEncodingException {
+ "".getBytes(pEncoding); // Throws an UnsupportedEncodingException,
+ // if the encoding is unknown.
+ return pEncoding;
+ }
+
+ /** <p>Sets the current output encoding.</p>
+ * @see javax.xml.bind.Marshaller#JAXB_ENCODING
+ */
+ protected void setEncoding(String pEncoding) {
+ encoding = pEncoding == null ? "UTF-8" : pEncoding;
+ }
+
+ /** <p>Sets the marshallers schema location.
+ * Defaults to null.</p>
+ * @see javax.xml.bind.Marshaller#JAXB_SCHEMA_LOCATION
+ */
+ protected void setSchemaLocation(String pSchemaLocation) {
+ schemaLocation = pSchemaLocation;
+ }
+
+ /** <p>Returns the marshallers schema location.
+ * Defaults to null.</p>
+ * @see javax.xml.bind.Marshaller#JAXB_SCHEMA_LOCATION
+ */
+ protected String getSchemaLocation() {
+ return schemaLocation;
+ }
+
+ /** <p>Sets the marshallers "no namespace" schema location.
+ * Defaults to null.</p>
+ * @see javax.xml.bind.Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+ */
+ protected void setNoNSSchemaLocation(String pNoNSSchemaLocation) {
+ noNSSchemaLocation = pNoNSSchemaLocation;
+ }
+
+ /** <p>Returns the marshallers "no namespace" schema location.
+ * Defaults to null.</p>
+ * @see javax.xml.bind.Marshaller#JAXB_NO_NAMESPACE_SCHEMA_LOCATION
+ */
+ protected String getNoNSSchemaLocation() {
+ return noNSSchemaLocation;
+ }
+
+ /** <p>Sets whether the marshaller will create formatted
+ * output or not. By default it does.</p>
+ * @see javax.xml.bind.Marshaller#JAXB_FORMATTED_OUTPUT
+ */
+ protected void setFormattedOutput(boolean pFormattedOutput) {
+ isFormattedOutput = pFormattedOutput;
+ }
+
+ /** <p>Returns whether the marshaller will create formatted
+ * output or not. By default it does.</p>
+ * @see javax.xml.bind.Marshaller#JAXB_FORMATTED_OUTPUT
+ */
+ protected boolean isFormattedOutput() {
+ return isFormattedOutput;
+ }
+
+ /* @see javax.xml.bind.Marshaller#marshal(Object, java.io.OutputStream)
+ */
+ public final void marshal(Object pObject, OutputStream pStream)
+ throws JAXBException {
+ StreamResult sr = new StreamResult();
+ sr.setOutputStream(pStream);
+ marshal(pObject, sr);
+ }
+
+ /* @see javax.xml.bind.Marshaller#marshal(Object, java.io.Writer)
+ */
+ public final void marshal(Object pObject, Writer pWriter)
+ throws JAXBException {
+ StreamResult sr = new StreamResult();
+ sr.setWriter(pWriter);
+ marshal(pObject, sr);
+ }
+
+ /* @see javax.xml.bind.Marshaller#marshal(Object, org.xml.sax.ContentHandler)
+ */
+ public final void marshal(Object pObject, ContentHandler pHandler)
+ throws JAXBException {
+ SAXResult sr = new SAXResult();
+ sr.setHandler(pHandler);
+ marshal(pObject, sr);
+ }
+
+ /* @see javax.xml.bind.Marshaller#marshal(Object, org.w3c.dom.Node)
+ */
+ public final void marshal(Object pObject, Node pNode)
+ throws JAXBException {
+ DOMResult dr = new DOMResult();
+ dr.setNode(pNode);
+ marshal(pObject, dr);
+ }
+
+ /** <p>This method is unsupported in the default implementation
+ * and throws an {@link UnsupportedOperationException}.</p>
+ * @throws UnsupportedOperationException This method is not available in the
+ * default implementation.
+ */
+ public Node getNode(Object obj) throws JAXBException {
+ throw new UnsupportedOperationException("This operation is unsupported.");
+ }
+}
+
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,257 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.helpers;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.PropertyException;
+import javax.xml.bind.UnmarshalException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.ValidationEventHandler;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+
+/** <p>This is an abstract default implementation of an
+ * {@link javax.xml.bind.Unmarshaller}. Subclasses only need to implement
+ * {@link javax.xml.bind.Unmarshaller#getUnmarshallerHandler()},
+ * {@link javax.xml.bind.Unmarshaller#unmarshal(org.w3c.dom.Node)}, and
+ * {@link #unmarshal(org.xml.sax.XMLReader, org.xml.sax.InputSource)}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public abstract class AbstractUnmarshallerImpl implements Unmarshaller {
+ private boolean isValidating;
+ private XMLReader xmlReader;
+ private static SAXParserFactory saxParserFactory;
+ private ValidationEventHandler validationEventHandler = DefaultValidationEventHandler.theInstance;
+
+ static {
+ saxParserFactory = SAXParserFactory.newInstance();
+ saxParserFactory.setNamespaceAware(true);
+ saxParserFactory.setValidating(false);
+ }
+
+ /** <p>Creates a new instance of AbstractUnmarshallerImpl.</p>
+ */
+ public AbstractUnmarshallerImpl() {
+ }
+
+ /** <p>Creates a configured {@link org.xml.sax.XMLReader}.
+ * Unmarshaller is not re-entrant, so we will use a single instance
+ * of {@link org.xml.sax.XMLReader}.</p>
+ * @throws JAXBException Encapsulates a
+ * {@link javax.xml.parsers.ParserConfigurationException}
+ */
+ protected XMLReader getXMLReader() throws JAXBException {
+ if (xmlReader == null) {
+ try {
+ SAXParser sp = saxParserFactory.newSAXParser();
+ xmlReader = sp.getXMLReader();
+ } catch (ParserConfigurationException e) {
+ throw new JAXBException("Failed to create a JAXP compliant SAX parser.", e);
+ } catch (SAXException e) {
+ throw new JAXBException("Failed to create a JAXP compliant SAX parser.", e);
+ }
+ }
+ return xmlReader;
+ }
+
+ /* @see javax.xml.bind.Unmarshaller#unmarshal(javax.xml.transform.Source)
+ */
+ public Object unmarshal(Source pSource) throws JAXBException {
+ if (pSource instanceof SAXSource) {
+ SAXSource ss = (SAXSource) pSource;
+ InputSource is = ss.getInputSource();
+ XMLReader xr = ss.getXMLReader();
+ if (xr == null) {
+ xr = getXMLReader();
+ }
+ return unmarshal(xr, is);
+ } else if (pSource instanceof StreamSource) {
+ StreamSource ss = (StreamSource) pSource;
+ InputSource is;
+ InputStream istream = ss.getInputStream();
+ if (istream == null) {
+ Reader r = ss.getReader();
+ if (r == null) {
+ throw new JAXBException("The specified StreamSource must have configured either of its InputStream or Reader.");
+ } else {
+ is = new InputSource(r);
+ }
+ } else {
+ is = new InputSource(istream);
+ }
+ is.setSystemId(ss.getSystemId());
+ is.setPublicId(ss.getPublicId());
+ return unmarshal(getXMLReader(), is);
+ } else if (pSource instanceof DOMSource) {
+ DOMSource ds = (DOMSource) pSource;
+ return unmarshal(ds.getNode());
+ } else {
+ throw new JAXBException("Unsupported type of " + Source.class.getName() +
+ ", expected either of " +
+ SAXSource.class.getName() + ", " +
+ StreamSource.class.getName() + ", or " +
+ DOMSource.class.getName());
+ }
+ }
+
+ /** <p>Unmarshals an object by using the given instance
+ * of {@link org.xml.sax.XMLReader} to parse the XML
+ * document read from the byte or character stream
+ * given by the {@link org.xml.sax.InputSource}
+ * <code>pSource</code>.</p>
+ * <p>The implementation should call the method
+ * {@link org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler)}
+ * in order to pass errors provided by the SAX parser to the
+ * {@link javax.xml.bind.ValidationEventHandler} provided by
+ * the client.</p>
+ * @throws JAXBException An error occurred while unmarshalling
+ * the JAXB object.
+ */
+ protected abstract java.lang.Object unmarshal(XMLReader pReader,
+ InputSource pSource)
+ throws JAXBException;
+
+ /* @see javax.xml.bind.Unmarshaller#unmarshal(org.xml.sax.InputSource)
+ */
+ public final Object unmarshal(InputSource pSource) throws JAXBException {
+ return unmarshal(getXMLReader(), pSource);
+ }
+
+ /* @see javax.xml.bind.Unmarshaller#unmarshal(java.net.URL)
+ */
+ public final java.lang.Object unmarshal(java.net.URL pURL) throws JAXBException {
+ InputSource isource;
+ try {
+ isource = new InputSource(pURL.openStream());
+ } catch (IOException e) {
+ throw new JAXBException("Failed to open URL " + pURL + ": " + e.getMessage(), e);
+ }
+ isource.setSystemId(pURL.toExternalForm());
+ return unmarshal(getXMLReader(), isource);
+ }
+
+ /* @see javax.xml.bind.Unmarshaller#unmarshal(java.io.File)
+ */
+ public final java.lang.Object unmarshal(java.io.File pFile) throws JAXBException {
+ InputSource isource;
+ try {
+ isource = new InputSource(new FileInputStream(pFile));
+ } catch (IOException e) {
+ throw new JAXBException("Failed to open file " + pFile + ": " + e.getMessage(), e);
+ }
+ try {
+ isource.setSystemId(pFile.toURL().toExternalForm());
+ } catch (IOException e) {
+ throw new JAXBException("Malformed URL: " + pFile, e);
+ }
+ return unmarshal(getXMLReader(), isource);
+ }
+
+ /* @see javax.xml.bind.Unmarshaller#unmarshal(java.io.InputStream)
+ */
+ public final java.lang.Object unmarshal(java.io.InputStream pSource)
+ throws JAXBException {
+ return unmarshal(getXMLReader(), new InputSource(pSource));
+ }
+
+ /* @see javax.xml.bind.Unmarshaller#isValidating()
+ */
+ public boolean isValidating() throws JAXBException {
+ return isValidating;
+ }
+
+ /* @see javax.xml.bind.Unmarshaller#setValidating(boolean)
+ */
+ public void setValidating(boolean pValidating) throws JAXBException {
+ isValidating = pValidating;
+ }
+
+ /* @see javax.xml.bind.Unmarshaller#getEventHandler()
+ */
+ public ValidationEventHandler getEventHandler()
+ throws JAXBException {
+ return validationEventHandler;
+ }
+
+ /* @see javax.xml.bind.Unmarshaller#setEventHandler(javax.xml.bind.ValidationEventHandler)
+ */
+ public void setEventHandler(ValidationEventHandler pHandler)
+ throws JAXBException {
+ validationEventHandler = pHandler;
+ }
+
+ /** <p>Helper method to concert a {@link org.xml.sax.SAXException}
+ * into an {@link javax.xml.bind.UnmarshalException}.</p>
+ * @param pException If the parameter contains a nested instance of
+ * {@link javax.xml.bind.UnmarshalException}, throws that instance.
+ * Otherwise wraps the parameter in a new
+ * {@link javax.xml.bind.UnmarshalException} and throws that.
+ */
+ protected UnmarshalException createUnmarshalException(SAXException pException) {
+ Exception ex = pException.getException();
+ if (ex != null && ex instanceof UnmarshalException) {
+ return (UnmarshalException) ex;
+ } else {
+ return new UnmarshalException(pException);
+ }
+ }
+
+ /** <p>Always throws a {@link javax.xml.bind.PropertyException},
+ * because the default implementation does not support any
+ * properties. If you want to change this, override the class.</p>
+ * @throws IllegalArgumentException The property name was null.
+ * @throws PropertyException The name was not null. :-)
+ */
+ public void setProperty(String pName, Object pValue) throws PropertyException {
+ if (pName == null) {
+ throw new IllegalArgumentException("The property name must not be null.");
+ } else {
+ throw new PropertyException("Unsupported property name: " + pName);
+ }
+ }
+
+ /** <p>Always throws a {@link javax.xml.bind.PropertyException},
+ * because the default implementation does not support any
+ * properties. If you want to change this, override the class.</p>
+ * @throws IllegalArgumentException The property name was null.
+ * @throws PropertyException The name was not null. :-)
+ */
+ public Object getProperty(String pName) throws PropertyException {
+ if (pName == null) {
+ throw new IllegalArgumentException("The property name must not be null.");
+ } else {
+ throw new PropertyException("Unsupported property name: " + pName);
+ }
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/DefaultValidationEventHandler.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/DefaultValidationEventHandler.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/DefaultValidationEventHandler.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/DefaultValidationEventHandler.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.helpers;
+
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventHandler;
+
+/** <p>Default implementation of a {@link javax.xml.bind.ValidationEventHandler}.
+ * Causes the validation to fail as soon as the first error or
+ * fatal error is encountered.</p>
+ * <p>This instance of {@link javax.xml.bind.ValidationEventHandler} is
+ * suitable for use of the unmarshallers or validators default event handler.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class DefaultValidationEventHandler implements ValidationEventHandler {
+ static final DefaultValidationEventHandler theInstance =
+ new DefaultValidationEventHandler();
+
+ /** <p>Creates a new instance of <code>DefaultValidationEventHandler</code>.</p>
+ */
+ public DefaultValidationEventHandler() {
+ }
+
+ public boolean handleEvent(ValidationEvent event) {
+ if (event.getSeverity() == ValidationEvent.WARNING) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/NotIdentifiableEventImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/NotIdentifiableEventImpl.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/NotIdentifiableEventImpl.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/NotIdentifiableEventImpl.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.helpers;
+
+import javax.xml.bind.ValidationEventLocator;
+
+/** <p>Default implementation of a {@link javax.xml.bind.NotIdentifiableEvent}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class NotIdentifiableEventImpl extends ValidationEventImpl
+ implements javax.xml.bind.NotIdentifiableEvent {
+
+ /** <p>Creates a new instance of <code>NotIdentifiableEventImpl</code>.</p>
+ */
+ public NotIdentifiableEventImpl(int pSeverity, String pMessage,
+ ValidationEventLocator pLocator) {
+ super(pSeverity, pMessage, pLocator);
+ }
+
+ /** <p>Creates a new instance of <code>NotIdentifiableEventImpl</code>.</p>
+ */
+ public NotIdentifiableEventImpl(int pSeverity, String pMessage,
+ ValidationEventLocator pLocator,
+ Throwable pLinkedException) {
+ super(pSeverity, pMessage, pLocator, pLinkedException);
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ParseConversionEventImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ParseConversionEventImpl.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ParseConversionEventImpl.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ParseConversionEventImpl.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.helpers;
+
+import javax.xml.bind.ValidationEventLocator;
+
+/** <p>Default implementation of a {@link javax.xml.bind.ParseConversionEvent}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class ParseConversionEventImpl extends ValidationEventImpl
+ implements javax.xml.bind.ParseConversionEvent {
+
+ /** <p>Creates a new instance of <code>ParseConversionEventImpl</code>.</p>
+ */
+ public ParseConversionEventImpl(int pSeverity, String pMessage,
+ ValidationEventLocator pLocator) {
+ super(pSeverity, pMessage, pLocator);
+ }
+
+ /** <p>Creates a new instance of <code>ParseConversionEventImpl</code>.</p>
+ */
+ public ParseConversionEventImpl(int pSeverity, String pMessage,
+ ValidationEventLocator pLocator,
+ Throwable pLinkedException) {
+ super(pSeverity, pMessage, pLocator, pLinkedException);
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/PrintConversionEventImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/PrintConversionEventImpl.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/PrintConversionEventImpl.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/PrintConversionEventImpl.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.helpers;
+
+import javax.xml.bind.ValidationEventLocator;
+
+/** <p>Default implementation of a {@link javax.xml.bind.PrintConversionEvent}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class PrintConversionEventImpl extends ValidationEventImpl
+ implements javax.xml.bind.PrintConversionEvent {
+
+ /** <p>Creates a new instance of <code>PrintConversionEventImpl</code>.</p>
+ */
+ public PrintConversionEventImpl(int pSeverity, String pMessage,
+ ValidationEventLocator pLocator) {
+ super(pSeverity, pMessage, pLocator);
+ }
+
+ /** <p>Creates a new instance of <code>PrintConversionEventImpl</code>.</p>
+ */
+ public PrintConversionEventImpl(int pSeverity, String pMessage,
+ ValidationEventLocator pLocator,
+ Throwable pLinkedException) {
+ super(pSeverity, pMessage, pLocator, pLinkedException);
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ValidationEventImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ValidationEventImpl.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ValidationEventImpl.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ValidationEventImpl.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.helpers;
+
+import javax.xml.bind.ValidationEvent;
+import javax.xml.bind.ValidationEventLocator;
+
+/** <p>Default implementation of a {@link javax.xml.bind.ValidationEvent}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class ValidationEventImpl implements ValidationEvent {
+ private int severity;
+ private String message;
+ private Throwable linkedException;
+ private ValidationEventLocator locator;
+
+ /** <p>Creates a new instance of <code>ValidationEventImpl</code>.</p>
+ */
+ public ValidationEventImpl(int pSeverity, String pMessage,
+ ValidationEventLocator pLocator) {
+ severity = pSeverity;
+ message = pMessage;
+ locator = pLocator;
+ }
+
+ /** <p>Creates a new instance of <code>ValidationEventImpl</code>.</p>
+ */
+ public ValidationEventImpl(int pSeverity, String pMessage,
+ ValidationEventLocator pLocator,
+ Throwable pLinkedException) {
+ severity = pSeverity;
+ message = pMessage;
+ linkedException = pLinkedException;
+ locator = pLocator;
+ }
+
+ /* @see javax.xml.bind.ValidationEvent#getSeverity()
+ */
+ public int getSeverity() {
+ return severity;
+ }
+
+ /** <p>Sets the events severity.</p>
+ * @param pSeverity The events severity, either of
+ * {@link javax.xml.bind.ValidationEvent#WARNING},
+ * {@link javax.xml.bind.ValidationEvent#ERROR}, or
+ * {@link javax.xml.bind.ValidationEvent#FATAL_ERROR}.</p>
+ */
+ public void setSeverity(int pSeverity) {
+ severity = pSeverity;
+ }
+
+ /* @see javax.xml.bind.ValidationEvent#getMessage()
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /** <p>Sets the events message.</p>
+ */
+ public void setMessage(String pMessage) {
+ message = pMessage;
+ }
+
+ /* @see javax.xml.bind.ValidationEvent#getLinkedException()
+ */
+ public Throwable getLinkedException() {
+ return linkedException;
+ }
+
+ /** <p>Sets the exception, which is linked to the event.</p>
+ */
+ public void setLinkedException(Throwable pLinkedException) {
+ linkedException = pLinkedException;
+ }
+
+ /* @see javax.xml.bind.ValidationEvent#getLocator()
+ */
+ public ValidationEventLocator getLocator() {
+ return locator;
+ }
+
+ /** <p>Sets the events locator.</p>
+ */
+ public void setLocator(ValidationEventLocator pLocator) {
+ locator = pLocator;
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ValidationEventLocatorImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ValidationEventLocatorImpl.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ValidationEventLocatorImpl.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/ValidationEventLocatorImpl.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.helpers;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.bind.ValidationEventLocator;
+
+import org.w3c.dom.Node;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
+
+
+/** <p>Default implementation of a {@link javax.xml.bind.ValidationEventLocator}.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class ValidationEventLocatorImpl implements ValidationEventLocator {
+ private URL url;
+ private int offset, lineNumber, columnNumber;
+ private Object object;
+ private Node node;
+
+ /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>.</p>
+ */
+ public ValidationEventLocatorImpl() {
+ offset = lineNumber = columnNumber = -1;
+ }
+
+ /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>
+ * by copying data from the given {@link org.xml.sax.Locator}.</p>
+ * @param pLocator The SAX locator where to copy from.
+ */
+ public ValidationEventLocatorImpl(Locator pLocator) {
+ if (pLocator == null) {
+ lineNumber = columnNumber = -1;
+ } else {
+ columnNumber = pLocator.getColumnNumber();
+ lineNumber = pLocator.getLineNumber();
+ String u = pLocator.getSystemId();
+ if (u != null) {
+ try {
+ url = new URL(pLocator.getSystemId());
+ } catch (MalformedURLException e) {
+ }
+ }
+ }
+ offset = -1;
+ }
+
+ /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>
+ * by setting the node property.</p>
+ * @param pNode The node being referenced.
+ */
+ public ValidationEventLocatorImpl(Node pNode) {
+ node = pNode;
+ offset = lineNumber = columnNumber = -1;
+ }
+
+ /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>
+ * by setting the object property.</p>
+ * @param pObject The object being referenced.
+ */
+ public ValidationEventLocatorImpl(Object pObject) {
+ object = pObject;
+ offset = lineNumber = columnNumber = -1;
+ }
+
+ /** <p>Creates a new instance of <code>ValidationEventLocatorImpl</code>
+ * by copying data from the given {@link org.xml.sax.SAXParseException}.</p>
+ * @param pException The SAX exception where to copy from.
+ */
+ public ValidationEventLocatorImpl(SAXParseException pException) {
+ columnNumber = pException.getColumnNumber();
+ lineNumber = pException.getLineNumber();
+ String u = pException.getSystemId();
+ if (u != null) {
+ try {
+ url = new URL(pException.getSystemId());
+ } catch (MalformedURLException e) {
+ }
+ }
+ offset = -1;
+ }
+
+ /** <p>Sets the URL.</p>
+ */
+ public void setURL(URL pURL) {
+ url = pURL;
+ }
+
+ /* @see javax.xml.bind.ValidationEventLocator#getURL()
+ */
+ public URL getURL() {
+ return url;
+ }
+
+ /** <p>Sets the offset.</p>
+ */
+ public void setOffset(int pOffset) {
+ offset = pOffset;
+ }
+
+ /* @see javax.xml.bind.ValidationEventLocator#getOffset()
+ */
+ public int getOffset() {
+ return offset;
+ }
+
+ /** <p>Sets the line number.</p>
+ */
+ public void setLineNumber(int pLineNumber) {
+ lineNumber = pLineNumber;
+ }
+
+ /* @see javax.xml.bind.ValidationEventLocator#getLineNumber()
+ */
+ public int getLineNumber() {
+ return lineNumber;
+ }
+
+ /** <p>Sets the column number.</p>
+ */
+ public void setColumnNumber(int pColumnNumber) {
+ columnNumber = pColumnNumber;
+ }
+
+ /* @see javax.xml.bind.ValidationEventLocator#getColumnNumber()
+ */
+ public int getColumnNumber() {
+ return columnNumber;
+ }
+
+ /** <p>Sets the object.</p>
+ */
+ public void setObject(Object pObject) {
+ object = pObject;
+ }
+
+ /* @see javax.xml.bind.ValidationEventLocator#getObject()
+ */
+ public Object getObject() {
+ return object;
+ }
+
+ /** <p>Sets the node.</p>
+ */
+ public void setNode(Node pNode) {
+ node = pNode;
+ }
+
+ /* @see javax.xml.bind.ValidationEventLocator#getNode()
+ */
+ public Node getNode() {
+ return node;
+ }
+}
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/package.html
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/package.html?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/package.html (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/helpers/package.html Fri Nov 24 04:04:25 2006
@@ -0,0 +1,30 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed 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.
+
+-->
+<html>
+ <head>
+ <title>
+Package Documentation for javax.xml.bind.helpers Package
+ </title>
+</head>
+ <body bgcolor="white">
+ <p>
+Helper classes for JAXB implementations.
+Contains standard implementations for several important JAXB interfaces.
+ </p>
+</body>
+</html>
\ No newline at end of file
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/package.html
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/package.html?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/package.html (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/package.html Fri Nov 24 04:04:25 2006
@@ -0,0 +1,29 @@
+<!--
+
+ Copyright 2004 The Apache Software Foundation.
+
+ Licensed 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.
+
+-->
+<html>
+ <head>
+ <title>
+Package Documentation for javax.xml.bind Package
+ </title>
+</head>
+ <body bgcolor="white">
+ <p>
+Clean room implementation of the JAXB standard xml-binding API.
+ </p>
+</body>
+</html>
\ No newline at end of file
Added: webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/util/JAXBResult.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/util/JAXBResult.java?view=auto&rev=478847
==============================================================================
--- webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/util/JAXBResult.java (added)
+++ webservices/jaxme/branches/MAVEN/jaxme-api/src/main/java/javax/xml/bind/util/JAXBResult.java Fri Nov 24 04:04:25 2006
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2003, 2004 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.UnmarshallerHandler;
+import javax.xml.transform.sax.SAXResult;
+
+
+/** <p>Utility class that allows to catch the result of a
+ * stylesheet transformation in a JAXB object.</p>
+ *
+ * @author JSR-31
+ * @since JAXB1.0
+ */
+public class JAXBResult extends SAXResult {
+ /** <p>Creates a new instance of <code>JAXBResult</code>.
+ * The instance will use the specified {@link javax.xml.bind.JAXBContext}
+ * to create an {@link javax.xml.bind.Unmarshaller}.</p>
+ */
+ public JAXBResult(javax.xml.bind.JAXBContext pContext) throws JAXBException {
+ this(pContext.createUnmarshaller());
+ }
+
+ /** <p>Creates a new instance of <code>JAXBResult</code>.
+ * The instance will use the given {@link javax.xml.bind.Unmarshaller}
+ * to create a {@link org.xml.sax.ContentHandler}.</p>
+ * <p>In most cases you will use the constructor taking a
+ * {@link javax.xml.bind.JAXBContext} as input. This additional
+ * constructor is required, if you want to configure the
+ * {@link javax.xml.bind.Unmarshaller}.</p>
+ * @param pUnmarshaller The Unmarshaller that may be queried for an
+ * {@link UnmarshallerHandler}.
+ */
+ public JAXBResult(javax.xml.bind.Unmarshaller pUnmarshaller) throws JAXBException {
+ super(pUnmarshaller.getUnmarshallerHandler());
+ }
+
+ /** <p>Returns the result of a previous transformation.</p>
+ */
+ public Object getResult() throws JAXBException {
+ return ((UnmarshallerHandler) super.getHandler()).getResult();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org