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 [4/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/annotation/XmlElementWrapper.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlElementWrapper.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlElementWrapper.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlElementWrapper.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,69 @@
+/*
+ * 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.annotation;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+
+/**
+ * Used to create a wrapper element for multivalued fields
+ * or properties.
+ * @see XmlElement 
+ * @see XmlElements
+ * @see XmlElementRef
+ * @see XmlElementRefs
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({FIELD, METHOD})
+public @interface XmlElementWrapper {
+    /**
+     * Name of the wrapper element. The default value is
+     * "##default" and indicates, that the element name is
+     * being derived from the field or property name.
+     */
+    String name() default "##default";
+
+    /**
+     * Namespace of the wrapper element. The default value
+     * is "##default" and indicates, that the namespace
+     * is the schemas target namespace (if
+     * {@link XmlSchema#elementFormDefault() elementFormDefault}
+     * is true) or "" (default namespace).
+     */
+    String namespace() default "##default";
+
+    /**
+     * If this property is true, then the wrapper element is
+     * always present {@code xsi:nil} is used to indicate the
+     * null value. Otherwise the wrapper element is omitted
+     * to indicate the null value. Defaults to false.
+     */
+    boolean nillable() default false;
+
+    /**
+     * Indicates whether the wrapper element is required.
+     * This is used to derive the wrapper elements {@code minOccurs}
+     * value.
+     * @since JAXB 2.1
+     */
+    boolean required() default false;
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlElements.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlElements.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlElements.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlElements.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.annotation;
+
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation collects multiple {@link XmlElement @XmlElement}
+ * annotations. It is used to overcome the problem, that an object
+ * must not have multiple annotations of the same type.
+ * @see XmlElement 
+ * @see XmlElementRef
+ * @see XmlElementRefs
+ * @see XmlJavaTypeAdapter
+ * @since JAXB2.0
+ */
+@Retention(RUNTIME) @Target({FIELD,METHOD})
+public @interface XmlElements {
+    /**
+     * The actual {@link XmlElement @XmlElement} annotations.
+     */
+    XmlElement[] value();
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlEnum.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlEnum.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlEnum.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlEnum.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.annotation;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+
+/**
+ * Indicates, that an {@link Enum} is being mapped to an
+ * XML enumeration.
+ * @since JAXB 2.0
+ */
+
+@Retention(RUNTIME)
+@Target({TYPE})
+public @interface XmlEnum {
+    /**
+     * Specifies the Java type, which is being used as the
+     * enumerations base type. Defaults to {@link String}.
+     */
+    Class<?> value() default String.class;
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlEnumValue.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlEnumValue.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlEnumValue.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlEnumValue.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+
+
+/**
+ * Specifies the value, to which an enumerations constant
+ * is mapped in an XML enumeration.
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({FIELD})
+public @interface XmlEnumValue {
+    String value();
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlID.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlID.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlID.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlID.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,38 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+
+/**
+ * Indicates, that a field or property is being mapped to
+ * an {@code xs:ID}.
+ * @see XmlIDREF
+ * @since JAXB2.0
+ */
+
+@Retention(RUNTIME) @Target({FIELD, METHOD})
+public @interface XmlID {
+    // No properties
+}
+
+
+

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlIDREF.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlIDREF.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlIDREF.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlIDREF.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Indicates, that a field or property is being mapped to
+ * an {@code xs:ID}.
+ * @see XmlID
+ * @since JAXB 2.0
+ */
+
+@Retention(RUNTIME)
+@Target({FIELD, METHOD})
+public @interface XmlIDREF {
+    // No properties
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlInlineBinaryData.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlInlineBinaryData.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlInlineBinaryData.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlInlineBinaryData.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates, that a field or property is being transmitted inline,
+ * even if attachments are enabled.
+ * @since JAXB2.0
+ */
+@Retention(RUNTIME)
+@Target({FIELD,METHOD,TYPE})
+public @interface XmlInlineBinaryData {
+    // No properties
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlList.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlList.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlList.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlList.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+
+/**
+ * Indicates, that a multivalued field or property is being
+ * mapped to a {@code xs:list} type.
+ * @since JAXB2.0
+ */
+@Retention(RUNTIME)
+@Target({FIELD,METHOD,PARAMETER})
+public @interface XmlList {
+    // No properties
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlMimeType.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlMimeType.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlMimeType.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlMimeType.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates a fields or properties MIME type. This is used, if the
+ * field or property value is transmitted as an attachment.
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({FIELD,METHOD,PARAMETER})
+public @interface XmlMimeType {
+    /**
+     * The fields or properties MIME type.
+     */
+    String value();
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlMixed.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlMixed.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlMixed.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlMixed.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.annotation;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates, that a multi-values field or property has mixed
+ * content.
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({FIELD,METHOD})
+public @interface XmlMixed {
+    // No properties
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlNs.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlNs.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlNs.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlNs.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Maps a namespace URI to some namespace prefix.
+ * @since JAXB2.0
+ */
+@Retention(RUNTIME)
+@Target({})
+public @interface XmlNs {
+    /**
+     * The namespace prefix.
+     */
+    String prefix();
+
+    /**
+     * The namespace URI.
+     */
+    String namespaceURI(); 
+}
+
+

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlNsForm.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlNsForm.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlNsForm.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlNsForm.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,27 @@
+/*
+ * 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.annotation;
+
+/**
+ * This enumeration is used to control values like
+ * {@code elementFormDefault} or {@code attributeFormDefault}.
+ * @since JAXB 2.0
+ */
+public enum XmlNsForm {UNQUALIFIED, QUALIFIED, UNSET}
+
+
+

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlRegistry.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlRegistry.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlRegistry.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlRegistry.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Marks an object factory class. Such an class may have methods
+ * with the {@link XmlElementDecl &#64;XmlElementDecl} annotations.
+ * @since JAXB 2.0
+ * @see XmlElementDecl
+ */
+@Retention(RUNTIME)
+@Target({TYPE})
+public @interface XmlRegistry {
+    // No properties
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlRootElement.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlRootElement.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlRootElement.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlRootElement.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,47 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.TYPE;
+
+
+/**
+ * This annotation indicates, that a bean class is being mapped
+ * as an XML element.
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({TYPE})
+public @interface XmlRootElement {
+    /**
+     * Namespace of the XML element; if the default value
+     * ("##default") is used, then the namespace will be
+     * derived from the package name.
+     */
+    String namespace() default "##default";
+
+    /**
+     * Local name of the XML element; if the default value
+     * ("##default") is used, then the name will be derived
+     * from the class name.
+     */
+    String name() default "##default";
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchema.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchema.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchema.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchema.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,67 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Used to control schema settings.
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target(PACKAGE)
+public @interface XmlSchema {
+    /**
+     * Creates a mapping of namespace URI's to prefixes.
+     */
+    XmlNs[]  xmlns() default {};
+
+    /**
+     * The schemas target namespace. Defaults to "" (default namespace).
+     */
+    String namespace() default "";
+
+    /**
+     * Whether local elements are inheriting the target namespace.
+     * Defaults to {@link XmlNsForm#UNSET}.
+     */
+    XmlNsForm elementFormDefault() default XmlNsForm.UNSET;
+
+    /**
+     * Whether attributes are inheriting the target namespace.
+     * Defaults to {@link XmlNsForm#UNSET}.
+     */
+    XmlNsForm attributeFormDefault() default XmlNsForm.UNSET;
+
+    /**
+     * Indicates that this namespace (specified by {@link #namespace()})
+     * has a schema already available exeternally, available at this location.
+     * @since JAXB 2.1
+     */
+    String location() default NO_LOCATION;
+
+    /**
+     * The default value of the {@link #location()} attribute,
+     * which indicates that the schema generator will generate
+     * components in this namespace.
+     */
+    static final String NO_LOCATION = "##generate";
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchemaType.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchemaType.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchemaType.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchemaType.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Maps a fields or properties type to one of the simple types,
+ * which are builtin to XML schema.
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({FIELD,METHOD,PACKAGE})        
+public @interface XmlSchemaType {
+    /**
+     * The XML schema types local name.
+     */
+    String name();
+
+    /**
+     * The XML schema types namespace; defaults to
+     * "http://www.w3.org/2001/XMLSchema".
+     */
+    String namespace() default "http://www.w3.org/2001/XMLSchema";
+
+    /**
+     * If the annotated object is a package, then the mapped
+     * Java type must be specified as well. By default, the
+     * annotated fields or properties type is mapped.
+     */
+    Class<?> type() default DEFAULT.class;
+
+    /**
+     * Used by {@link XmlSchemaType#type()} to indicate
+     * that the field or properties Java type is being
+     * used.
+     */
+    static final class DEFAULT {
+        // Does nothing.
+    }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchemaTypes.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchemaTypes.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchemaTypes.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSchemaTypes.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,39 @@
+/*
+ * 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.annotation;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.PACKAGE;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * This container annotations solves the problem, that a package
+ * can carry a single {@link XmlSchemaType &#64;XmlSchemaType}
+ * annotation only.
+ * @see XmlSchemaType
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({PACKAGE})
+public @interface XmlSchemaTypes {
+    /**
+     * Contains the packages set of
+     * {@link XmlSchemaType &#64;XmlSchemaType} annotations.
+     */
+    XmlSchemaType[] value();
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSeeAlso.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSeeAlso.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSeeAlso.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlSeeAlso.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.annotation;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+
+/**
+ * This annotation indicates, that some other class must be bound
+ * together with this class.
+ * @since JAXB 2.1
+ */
+@Target({ElementType.TYPE})
+@Retention(RUNTIME)
+public @interface XmlSeeAlso {
+    Class<?>[] value();
+}
\ No newline at end of file

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlTransient.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlTransient.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlTransient.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlTransient.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Indicates that the annotated object must not be
+ * mapped by JAXB.
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({FIELD, METHOD, TYPE})
+public @interface XmlTransient {
+    // No properties.
+}
+   

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlType.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlType.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlType.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlType.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.annotation;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates, that the annotated class or enumeration is being
+ * mapped as an XML Schema type.
+ * @see XmlElement
+ * @see XmlAttribute
+ * @see XmlValue
+ * @see XmlSchema
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({TYPE})
+public @interface XmlType {
+    /**
+     * Local name of the XML Schema type. The default value
+     * of "##default" indicates, that the name is being
+     * derived from the class name.
+     */
+    String name() default "##default" ;
+ 
+    /**
+     * Specifies the order of the types fields or properies
+     * in the XML Schema type. Contains a list of field or
+     * property names.
+     */
+    String[] propOrder() default {""};
+
+    /**
+     * Namespace of the XML Schema type. The default value
+     * of "##default" indicates, that the packages target
+     * namespace is being used.
+     */
+    String namespace() default "##default" ;
+   
+    /**
+     * Indicates the factory class for creating an instance.
+     */
+    Class<?> factoryClass() default DEFAULT.class;
+
+    /**
+     * Used by {@link XmlType#factoryClass()} as a default
+     * value. 
+     */
+    static final class DEFAULT {
+        // No fields or methods.
+    }
+
+    /**
+     * Name of the factory method in the class specified by
+     * {@link #factoryClass()}. The default value of ""
+     * indicates, that no factory method is being used.
+     * 
+     */
+    String factoryMethod() default "";
+}
+
+

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlValue.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlValue.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlValue.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/XmlValue.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+
+/**
+ * Maps a class to an XML Schema complex type with simple content.
+ * More precisely, the annotated field or property carries the
+ * element value.
+ * @see XmlType
+ * @since JAXB 2.0
+ */
+@Retention(RUNTIME)
+@Target({FIELD, METHOD})
+public @interface XmlValue {
+    // No fields or properties.
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,92 @@
+/*
+ * 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.annotation.adapters;
+
+
+
+/**
+ * Predefined {@link XmlAdapter} for implementing {@code xs:token}.
+ * Removes leading and trailing whitespace and converts sequences
+ * of whitespace characters into a single blank.
+ * @since JAXB 2.0
+ */
+public class CollapsedStringAdapter extends XmlAdapter<String,String> {
+    /**
+     * Removes leading and trailing whitespace and converts sequences
+     * of whitespace characters into a single blank.
+     */
+    public String unmarshal(String text) {
+        if (text==null) {
+            return null;
+        }
+
+        final int len = text.length();
+        int start = len;
+        for (int i = 0;  i < len;  i++) {
+            if (!isWhiteSpace(text.charAt(i))) {
+                start = i;
+                break;
+            }
+        }
+        if (start == len) {
+            return "";
+        }
+        int end = start;
+        for (int i = len-1;  i > start;  i--) {
+            if (!isWhiteSpace(text.charAt(i))) {
+                end = i;
+                break;
+            }
+        }
+
+        StringBuffer sb = new StringBuffer(end-start+1);
+        boolean inWhitespace = false;
+        for (int i = start;  i <= end;  i++) {
+            char c = text.charAt(i);
+            if (isWhiteSpace(c)) {
+                if (inWhitespace) {
+                    continue;
+                }
+                inWhitespace = true;
+                sb.append(' ');
+            } else {
+                sb.append(c);
+                inWhitespace = false;
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
+     * Returns the unmodified string.
+     */
+    public String marshal(String s) {
+        return s;
+    }
+
+
+    /**
+     * Returns, whether the given character is a whitespace character.
+     */
+    protected static boolean isWhiteSpace(char ch) {
+        if (ch>0x20) {
+            // Return fast, if possible
+            return false;
+        }
+        return ch == 0x9 || ch == 0xA || ch == 0xD || ch == 0x20;
+    }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/HexBinaryAdapter.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/HexBinaryAdapter.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/HexBinaryAdapter.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/HexBinaryAdapter.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,40 @@
+/*
+ * 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.annotation.adapters;
+
+import javax.xml.bind.DatatypeConverter;
+
+
+/**
+ * Predefined {@link XmlAdapter} for implementing {@code xs:hexBinary}.
+ * @since JAXB 2.0
+ */
+public final class HexBinaryAdapter extends XmlAdapter<String,byte[]> {
+    public byte[] unmarshal(String s) {
+        if (s == null) {
+            return null;
+        }
+        return DatatypeConverter.parseHexBinary(s);
+    }
+
+    public String marshal(byte[] bytes) {
+        if (bytes == null) {
+            return null;
+        }
+        return DatatypeConverter.printHexBinary(bytes);
+    }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package javax.xml.bind.annotation.adapters;
+
+
+
+/**
+ * Predefined {@link XmlAdapter} for implementing {@code xs:token}.
+ * Replaces any tab, CR, and LF with a blank character.
+ * @since JAXB 2.0
+ */
+public final class NormalizedStringAdapter extends XmlAdapter<String,String> {
+    /**
+     * Replaces any tab, CR, and LF with a blank character.
+     */
+    public String unmarshal(String text) {
+        if (text==null) {
+            return null;
+        }
+
+        final int len = text.length();
+        int start = len;
+        for (int i = 0;  i < len;  i++) {
+            if (isWhiteSpaceExceptSpace(text.charAt(i))) {
+                start = i;
+                break;
+            }
+        }
+        if (start == len) {
+            return text;
+        }
+        final char[] result = new char[len];
+        for (int i = 0;  i < start;  i++) {
+            result[i] = text.charAt(i);
+        }
+        for (int i = start;  i < len;  i++) {
+            final char c = text.charAt(i);
+            if (isWhiteSpaceExceptSpace(c)) {
+                result[i] = ' ';
+            } else {
+                result[i] = c;
+            }
+        }
+        return new String(result);
+    }
+
+    /**
+     * Returns the unmodified input string.
+     */
+    public String marshal(String s) {
+        return s;
+    }
+
+
+    /**
+     * Returns, whether the given character is a tab,
+     * CR or LF.
+     */
+    protected static boolean isWhiteSpaceExceptSpace(char ch) {
+        return ch == 0x9 || ch == 0xA || ch == 0xD;
+    }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlAdapter.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlAdapter.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlAdapter.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlAdapter.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.annotation.adapters;
+
+import java.util.Set;
+
+import javax.xml.bind.ValidationEvent;
+
+/**
+ * An adapter allows to implement a mapping between Java types
+ * and a particular XML representations. For example, you would
+ * want to use this for mapping a {@link Set}: The XML
+ * representation might be a list of keys.
+ * @param <BoundType> The actual object type. In the above example,
+ *   this would be a {@link Set}.
+ * @param <ValueType> The mapped type. In the above example, this
+ *   would be a list.
+ * @since JAXB 2.0
+ */
+public abstract class XmlAdapter<ValueType,BoundType> {
+    /**
+     * Protected constructor for access by derived classes
+     * only.
+     */
+    protected XmlAdapter() {
+        // Does nothing
+    }
+
+    /**
+     * Called for converting an instance of the value type
+     * to an instance of the bound type.
+     *
+     * @param pValue The value being converted, may be null.
+     * @throws Exception An error occurred while converting
+     *   the value. The caller must raise an
+     *   {@link ValidationEvent}.
+     */
+    public abstract BoundType unmarshal(ValueType pValue) throws Exception;
+
+    /**
+     * Called for converting an instance of the bound type
+     * into an instance of the value type.
+     *
+     * @param pValue The value being converted, may be null.
+     * @throws Exception An error occurred while converting
+     *   the value. The caller must raise an
+     *   {@link ValidationEvent}.
+     */
+    public abstract ValueType marshal(BoundType pValue) throws Exception;
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,58 @@
+/*
+ * 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.annotation.adapters;
+
+import java.lang.annotation.Target;
+import java.lang.annotation.Retention;
+
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.PACKAGE;
+
+
+/**
+ * An annotation, which allows to specify an {@link XmlAdapter}
+ * for custom marshalling and unmarshalling.
+ * @since JAXB 2.0
+ */
+
+@Retention(RUNTIME)
+@Target({PACKAGE,FIELD,METHOD,TYPE,PARAMETER})        
+public @interface XmlJavaTypeAdapter {
+    /**
+     * Specifies the {@link XmlAdapter} class, which converts
+     * bound types to values and vice versa.
+     */
+    Class<? extends XmlAdapter<?,?>> value();
+
+    /**
+     * Specifies the annotated objects type. This is usually
+     * not required, unless you use this annotation at the
+     * package level.
+     */
+    Class<?> type() default DEFAULT.class;
+
+    /**
+     * Used as the default in {@link #type()} to indicate,
+     * that the type should be derived from the annotated
+     * object.
+     */
+    static final class DEFAULT { /* Do nothing */ }
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,43 @@
+/*
+ * 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.annotation.adapters;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation allows to specify multiple
+ * {@link XmlJavaTypeAdapter} annotations at the package level.
+ * This "array notation" is required, because multiple annotations
+ * of the same type aren't allowed. Use the
+ * {@link XmlJavaTypeAdapters} annotation like this:
+ * <pre>
+ * &#64;XmlJavaTypeAdapters ({ &#64;XmlJavaTypeAdapter(...),&#64;XmlJavaTypeAdapter(...) })
+ * </pre>
+ *
+ * @see XmlJavaTypeAdapter
+ * @since JAXB2.0
+ */
+@Retention(RUNTIME) @Target({PACKAGE})
+public @interface XmlJavaTypeAdapters {
+    /**
+     * Collection of @{@link XmlJavaTypeAdapter} annotations
+     */
+    XmlJavaTypeAdapter[] value();
+}

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/attachment/AttachmentMarshaller.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/attachment/AttachmentMarshaller.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/attachment/AttachmentMarshaller.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/attachment/AttachmentMarshaller.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,63 @@
+/*
+ * 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.attachment;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.Marshaller;
+
+/**
+ * The attachment marshaller allows to supply some parts
+ * of the generated XML as binary attachments (MTOM
+ * or SWA attachments).
+ * @since JAXB 2.0
+ * @see Marshaller#setAttachmentMarshaller(AttachmentMarshaller)
+ * @see <a href="http://www.w3.org/TR/2005/REC-xop10-20050125/">XML-binary Optimized Packaging</a>
+ * @see <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html">WS-I Attachments Profile Version 1.0.</a>
+ */
+public abstract class AttachmentMarshaller {
+    /**
+     * Asks, whether the given element is being attached via
+     * MTOM or marshalled inline.
+     * @return Null, if the element is being marshalled inline.
+     *   Otherwise, it returns the content ID of the attachment.
+     */
+    public abstract String addMtomAttachment(DataHandler data,
+            String elementNamespace, String elementLocalName);
+
+    /**
+     * Asks, whether the given element is being attached via
+     * MTOM or marshalled inline.
+     * @return Null, if the element is being marshalled inline.
+     *   Otherwise, it returns the content ID of the attachment.
+     */
+    public abstract String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String elementNamespace, String elementLocalName);
+
+    /**
+     * Returns, whether the marshaller ought to support XOP
+     * processing.
+     */
+    public boolean isXOPPackage() { return false; }
+
+   /**
+     * Asks, whether the given element is being attached via
+     * SWA or marshalled inline.
+     * @return Null, if the element is being marshalled inline.
+     *   Otherwise, it returns the content ID of the attachment.
+    */
+    public abstract String addSwaRefAttachment(DataHandler data);
+}
+

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/attachment/AttachmentUnmarshaller.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/attachment/AttachmentUnmarshaller.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/attachment/AttachmentUnmarshaller.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/attachment/AttachmentUnmarshaller.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.attachment;
+
+import javax.activation.DataHandler;
+
+/**
+ * The attachment unmarshaller allows to read some parts
+ * of the generated XML as binary attachments (MTOM
+ * or SWA attachments).
+ * @since JAXB 2.0
+ * @see javax.xml.bind.Unmarshaller#setAttachmentUnmarshaller(AttachmentUnmarshaller)
+ * @see <a href="http://www.w3.org/TR/2005/REC-xop10-20050125/">XML-binary Optimized Packaging</a>
+ * @see <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html">WS-I Attachments Profile Version 1.0.</a>
+ * @see <a href="http://www.w3.org/TR/xml-media-types/">Describing Media Content of Binary Data in XML</a>
+ */
+public abstract class AttachmentUnmarshaller {
+   /**
+    * Asks for an attachments data and returns it as a
+    * {@link DataHandler}.
+    * @param Content ID of the attachment.
+    * @return A {@link DataHandler} for reading the attachments data.
+    * @throws IllegalArgumentException The content ID is unknown.
+    */
+   public abstract DataHandler getAttachmentAsDataHandler(String cid);
+
+    /**
+    * Asks for an attachments data and returns it as a
+    * byte array.
+    * @param Content ID of the attachment.
+    * @return A byte array with the attachments data.
+    * @throws IllegalArgumentException The content ID is unknown.
+     */
+    public abstract byte[] getAttachmentAsByteArray(String cid);
+
+    /**
+     * Returns, whether the unmarshaller ought to support XOP
+     * processing.
+     */
+    public boolean isXOPPackage() { return false; } 
+}
+
+

Added: webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/helpers/AbstractMarshallerImpl.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/helpers/AbstractMarshallerImpl.java?view=auto&rev=494575
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/helpers/AbstractMarshallerImpl.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/jaxme-jaxb-api/src/main/java/javax/xml/bind/helpers/AbstractMarshallerImpl.java Tue Jan  9 13:07:17 2007
@@ -0,0 +1,389 @@
+/*
+ * 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.helpers;
+
+import java.io.File;
+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.bind.annotation.adapters.XmlAdapter;
+import javax.xml.bind.attachment.AttachmentMarshaller;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.validation.Schema;
+
+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 boolean fragment;
+    private ValidationEventHandler eventHandler = DefaultValidationEventHandler.theInstance;
+
+    /**
+     * <p>Creates a new instance of <code>AbstractMarshallerImpl</code>.</p>
+     */
+    public AbstractMarshallerImpl() {
+        // Does nothing.
+    }
+
+    /* @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 if (Marshaller.JAXB_FRAGMENT.equals(pName)) {
+            if (pValue == null) {
+                setFragment(false);
+            } else {
+                setFragment(((Boolean) pValue).booleanValue());
+            }
+        } 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 if (Marshaller.JAXB_FRAGMENT.equals(pName)) {
+            return isFragment() ? Boolean.TRUE : Boolean.FALSE;
+        } 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;
+    }
+
+    private static final String[] aliases = {
+        "UTF-8", "UTF8",
+        "UTF-16", "Unicode",
+        "UTF-16BE", "UnicodeBigUnmarked",
+        "UTF-16LE", "UnicodeLittleUnmarked",
+        "US-ASCII", "ASCII",
+        "TIS-620", "TIS620",
+        
+        // taken from the project-X parser
+        "ISO-10646-UCS-2", "Unicode",
+    
+        "EBCDIC-CP-US", "cp037",
+        "EBCDIC-CP-CA", "cp037",
+        "EBCDIC-CP-NL", "cp037",
+        "EBCDIC-CP-WT", "cp037",
+    
+        "EBCDIC-CP-DK", "cp277",
+        "EBCDIC-CP-NO", "cp277",
+        "EBCDIC-CP-FI", "cp278",
+        "EBCDIC-CP-SE", "cp278",
+    
+        "EBCDIC-CP-IT", "cp280",
+        "EBCDIC-CP-ES", "cp284",
+        "EBCDIC-CP-GB", "cp285",
+        "EBCDIC-CP-FR", "cp297",
+    
+        "EBCDIC-CP-AR1", "cp420",
+        "EBCDIC-CP-HE", "cp424",
+        "EBCDIC-CP-BE", "cp500",
+        "EBCDIC-CP-CH", "cp500",
+    
+        "EBCDIC-CP-ROECE", "cp870",
+        "EBCDIC-CP-YU", "cp870",
+        "EBCDIC-CP-IS", "cp871",
+        "EBCDIC-CP-AR2", "cp918",
+        
+        // IANA also defines two that JDK 1.2 doesn't handle:
+        //  EBCDIC-CP-GR        --> CP423
+        //  EBCDIC-CP-TR        --> CP905
+    };
+
+    /** <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 {
+        try {
+            "1".getBytes(pEncoding);
+            return pEncoding;
+        } catch(UnsupportedEncodingException e) {
+            // try known alias
+            for (int i=0;  i < aliases.length;  i+=2) {
+                if (pEncoding.equals(aliases[i])) {
+                    "1".getBytes(aliases[i+1]);
+                    return aliases[i+1];
+                }
+            }
+            
+            throw new UnsupportedEncodingException(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;
+    }
+
+    /**
+     * Returns, whether the marshaller will create root
+     * node events.
+     * @see javax.xml.bind.Marshaller#JAXB_FRAGMENT
+     */
+    protected boolean isFragment() {
+        return fragment;
+    }
+
+    /**
+     * Sets, whether the marshaller will create root
+     * node events.
+     * @see javax.xml.bind.Marshaller#JAXB_FRAGMENT
+     */
+    protected void setFragment(boolean v) {
+        fragment = v;
+    }
+
+    /* @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);
+    }
+
+    /*
+     * @see javax.xml.bind.Marshaller#marshal(Object, java.io.File)
+     */
+    public void marshal(Object pObject, File pFile)
+            throws JAXBException {
+        StreamResult sr = new StreamResult(pFile);
+        marshal(pObject, sr);
+    }
+
+    /** <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.");
+    }
+
+    public void marshal(Object obj, XMLEventWriter writer)
+    throws JAXBException {
+
+        throw new UnsupportedOperationException();
+    }
+
+    public void marshal(Object obj, XMLStreamWriter writer)
+    throws JAXBException {
+
+        throw new UnsupportedOperationException();
+    }
+
+    public void setSchema(Schema schema) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Schema getSchema() {
+        throw new UnsupportedOperationException();
+    }
+
+    @SuppressWarnings("unchecked")
+    public void setAdapter(XmlAdapter<?,?> adapter) {
+        if(adapter==null)
+            throw new IllegalArgumentException();
+        setAdapter((Class)adapter.getClass(),adapter);
+    }
+
+    public <A extends XmlAdapter<?,?>> void setAdapter(Class<A> type, A adapter) {
+        throw new UnsupportedOperationException();
+    }
+
+    public <A extends XmlAdapter<?,?>> A getAdapter(Class<A> type) {
+        throw new UnsupportedOperationException();
+    }
+
+    public void setAttachmentMarshaller(AttachmentMarshaller am) {
+        throw new UnsupportedOperationException();
+    }
+
+    public AttachmentMarshaller getAttachmentMarshaller() {
+        throw new UnsupportedOperationException();
+    }
+
+    public void setListener(Listener listener) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Listener getListener() {
+        throw new UnsupportedOperationException();
+    }
+}



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