Author: scheu
Date: Tue Mar 30 18:00:18 2010
New Revision: 929206
URL: http://svn.apache.org/viewvc?rev=929206&view=rev
Log:
AXIS2-4668
Contributor: Rich Scheuerle
Add precedence to the JAX-WS runtime's search for JAXBContext packages to avoid
duplicate @XmlTypes
Added verification test to validate the code.
Added:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntry.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntryResponse.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddressBookEntry.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/ObjectFactory.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/package-info.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddressBookTests.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBook.java
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBookImpl.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/AnnotationDesc.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationDescImpl.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/XMLRootElementUtil.java
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddressBookTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddressBookTests.java?rev=929206&r1=929205&r2=929206&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddressBookTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AddressBookTests.java
Tue Mar 30 18:00:18 2010
@@ -23,11 +23,11 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.axis2.jaxws.TestLogger;
import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.sample.addressbook.AddEntry;
-import org.apache.axis2.jaxws.sample.addressbook.AddEntryResponse;
+import org.apache.axis2.jaxws.sample.addressbook.data.AddEntry;
+import org.apache.axis2.jaxws.sample.addressbook.data.AddEntryResponse;
import org.apache.axis2.jaxws.sample.addressbook.AddressBook;
-import org.apache.axis2.jaxws.sample.addressbook.AddressBookEntry;
-import org.apache.axis2.jaxws.sample.addressbook.ObjectFactory;
+import org.apache.axis2.jaxws.sample.addressbook.data.AddressBookEntry;
+import org.apache.axis2.jaxws.sample.addressbook.data.ObjectFactory;
import javax.xml.bind.JAXBContext;
import javax.xml.namespace.QName;
@@ -63,7 +63,7 @@ public class AddressBookTests extends Ab
TestLogger.logger.debug("----------------------------------");
TestLogger.logger.debug("test: " + getName());
- JAXBContext jbc =
JAXBContext.newInstance("org.apache.axis2.jaxws.sample.addressbook");
+ JAXBContext jbc =
JAXBContext.newInstance("org.apache.axis2.jaxws.sample.addressbook.data");
// Create the JAX-WS client needed to send the request
Service service = Service.create(QNAME_SERVICE);
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBook.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBook.java?rev=929206&r1=929205&r2=929206&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBook.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBook.java
Tue Mar 30 18:00:18 2010
@@ -25,6 +25,7 @@ import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
+import org.apache.axis2.jaxws.sample.addressbook.data.AddressBookEntry;
@WebService(name = "AddressBook",
targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook")
@@ -39,8 +40,8 @@ public interface AddressBook {
*/
@WebMethod
@WebResult(name = "status", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook")
- @RequestWrapper(localName = "addEntry", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook", className =
"org.apache.axis2.jaxws.sample.addressbook.AddEntry")
- @ResponseWrapper(localName = "addEntryResponse", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook", className =
"org.apache.axis2.jaxws.sample.addressbook.AddEntryResponse")
+ @RequestWrapper(localName = "addEntry", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook", className =
"org.apache.axis2.jaxws.sample.addressbook.data.AddEntry")
+ @ResponseWrapper(localName = "addEntryResponse", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook", className =
"org.apache.axis2.jaxws.sample.addressbook.data.AddEntryResponse")
public boolean addEntry(
@WebParam(name = "entry", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook")
AddressBookEntry entry);
@@ -54,8 +55,8 @@ public interface AddressBook {
*/
@WebMethod
@WebResult(name = "entry", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook")
- @RequestWrapper(localName = "findEntryByName", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook", className =
"org.apache.axis2.jaxws.sample.addressbook.FindEntryByName")
- @ResponseWrapper(localName = "findEntryByNameResponse", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook", className =
"org.apache.axis2.jaxws.sample.addressbook.FindEntryByNameResponse")
+ @RequestWrapper(localName = "findEntryByName", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook", className =
"org.apache.axis2.jaxws.sample.addressbook.data.FindEntryByName")
+ @ResponseWrapper(localName = "findEntryByNameResponse", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook", className =
"org.apache.axis2.jaxws.sample.addressbook.data.FindEntryByNameResponse")
public AddressBookEntry findEntryByName(
@WebParam(name = "firstname", targetNamespace =
"http://org/apache/axis2/jaxws/sample/addressbook")
String firstname,
Modified:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBookImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBookImpl.java?rev=929206&r1=929205&r2=929206&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBookImpl.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/AddressBookImpl.java
Tue Mar 30 18:00:18 2010
@@ -24,6 +24,8 @@ import org.apache.axis2.jaxws.TestLogger
import javax.jws.WebService;
import java.util.ArrayList;
import java.util.Iterator;
+import org.apache.axis2.jaxws.sample.addressbook.data.AddressBookEntry;
+import org.apache.axis2.jaxws.sample.addressbook.data.ObjectFactory;
@WebService(serviceName="AddressBookService",
endpointInterface="org.apache.axis2.jaxws.sample.addressbook.AddressBook")
Added:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntry.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntry.java?rev=929206&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntry.java
(added)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntry.java
Tue Mar 30 18:00:18 2010
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.sample.addressbook.data;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for addEntry element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="addEntry">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="entry"
type="{http://org/apache/axis2/jaxws/sample/addressbook}AddressBookEntry"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
+...@xmlaccessortype(XmlAccessType.FIELD)
+...@xmltype(name = "", propOrder = {
+ "entry"
+})
+...@xmlrootelement(name = "addEntry")
+public class AddEntry {
+
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true)
+ protected AddressBookEntry entry;
+
+ /**
+ * Gets the value of the entry property.
+ *
+ * @return
+ * possible object is
+ * {...@link AddressBookEntry }
+ *
+ */
+ public AddressBookEntry getEntry() {
+ return entry;
+ }
+
+ /**
+ * Sets the value of the entry property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link AddressBookEntry }
+ *
+ */
+ public void setEntry(AddressBookEntry value) {
+ this.entry = value;
+ }
+
+}
Added:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntryResponse.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntryResponse.java?rev=929206&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntryResponse.java
(added)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddEntryResponse.java
Tue Mar 30 18:00:18 2010
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.sample.addressbook.data;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for addEntryResponse element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="addEntryResponse">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="status"
type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
+...@xmlaccessortype(XmlAccessType.FIELD)
+...@xmltype(name = "", propOrder = {
+ "status"
+})
+...@xmlrootelement(name = "addEntryResponse")
+public class AddEntryResponse {
+
+ @XmlElement(namespace = "http://org/apache/axis2/jaxws/sample/addressbook")
+ protected boolean status;
+
+ /**
+ * Gets the value of the status property.
+ *
+ */
+ public boolean isStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the value of the status property.
+ *
+ */
+ public void setStatus(boolean value) {
+ this.status = value;
+ }
+
+}
Added:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddressBookEntry.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddressBookEntry.java?rev=929206&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddressBookEntry.java
(added)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/AddressBookEntry.java
Tue Mar 30 18:00:18 2010
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.sample.addressbook.data;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for AddressBookEntry complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <complexType name="AddressBookEntry">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="firstName"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="lastName"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="phone"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="street"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="city"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="state"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+...@xmlaccessortype(XmlAccessType.FIELD)
+...@xmltype(name = "AddressBookEntry", propOrder = {
+ "firstName",
+ "lastName",
+ "phone",
+ "street",
+ "city",
+ "state"
+})
+public class AddressBookEntry {
+
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true)
+ protected String firstName;
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true)
+ protected String lastName;
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true, nillable =
true)
+ protected String phone;
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true, nillable =
true)
+ protected String street;
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true, nillable =
true)
+ protected String city;
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true, nillable =
true)
+ protected String state;
+
+ /**
+ * Gets the value of the firstName property.
+ *
+ * @return
+ * possible object is
+ * {...@link String }
+ *
+ */
+ public String getFirstName() {
+ return firstName;
+ }
+
+ /**
+ * Sets the value of the firstName property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link String }
+ *
+ */
+ public void setFirstName(String value) {
+ this.firstName = value;
+ }
+
+ /**
+ * Gets the value of the lastName property.
+ *
+ * @return
+ * possible object is
+ * {...@link String }
+ *
+ */
+ public String getLastName() {
+ return lastName;
+ }
+
+ /**
+ * Sets the value of the lastName property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link String }
+ *
+ */
+ public void setLastName(String value) {
+ this.lastName = value;
+ }
+
+ /**
+ * Gets the value of the phone property.
+ *
+ * @return
+ * possible object is
+ * {...@link String }
+ *
+ */
+ public String getPhone() {
+ return phone;
+ }
+
+ /**
+ * Sets the value of the phone property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link String }
+ *
+ */
+ public void setPhone(String value) {
+ this.phone = value;
+ }
+
+ /**
+ * Gets the value of the street property.
+ *
+ * @return
+ * possible object is
+ * {...@link String }
+ *
+ */
+ public String getStreet() {
+ return street;
+ }
+
+ /**
+ * Sets the value of the street property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link String }
+ *
+ */
+ public void setStreet(String value) {
+ this.street = value;
+ }
+
+ /**
+ * Gets the value of the city property.
+ *
+ * @return
+ * possible object is
+ * {...@link String }
+ *
+ */
+ public String getCity() {
+ return city;
+ }
+
+ /**
+ * Sets the value of the city property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link String }
+ *
+ */
+ public void setCity(String value) {
+ this.city = value;
+ }
+
+ /**
+ * Gets the value of the state property.
+ *
+ * @return
+ * possible object is
+ * {...@link String }
+ *
+ */
+ public String getState() {
+ return state;
+ }
+
+ /**
+ * Sets the value of the state property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link String }
+ *
+ */
+ public void setState(String value) {
+ this.state = value;
+ }
+
+}
Added:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java?rev=929206&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java
(added)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByName.java
Tue Mar 30 18:00:18 2010
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.sample.addressbook.data;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for findEntryByName element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="findEntryByName">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="firstname"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="lastname"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
+...@xmlaccessortype(XmlAccessType.FIELD)
+...@xmltype(name = "", propOrder = {
+ "firstname",
+ "lastname"
+})
+...@xmlrootelement(name = "findEntryByName")
+public class FindEntryByName {
+
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true, nillable =
true)
+ protected String firstname;
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true)
+ protected String lastname;
+
+ /**
+ * Gets the value of the firstname property.
+ *
+ * @return
+ * possible object is
+ * {...@link String }
+ *
+ */
+ public String getFirstname() {
+ return firstname;
+ }
+
+ /**
+ * Sets the value of the firstname property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link String }
+ *
+ */
+ public void setFirstname(String value) {
+ this.firstname = value;
+ }
+
+ /**
+ * Gets the value of the lastname property.
+ *
+ * @return
+ * possible object is
+ * {...@link String }
+ *
+ */
+ public String getLastname() {
+ return lastname;
+ }
+
+ /**
+ * Sets the value of the lastname property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link String }
+ *
+ */
+ public void setLastname(String value) {
+ this.lastname = value;
+ }
+
+}
Added:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java?rev=929206&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java
(added)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/FindEntryByNameResponse.java
Tue Mar 30 18:00:18 2010
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.sample.addressbook.data;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for findEntryByNameResponse element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="findEntryByNameResponse">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="entry"
type="{http://org/apache/axis2/jaxws/sample/addressbook}AddressBookEntry"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
+...@xmlaccessortype(XmlAccessType.FIELD)
+...@xmltype(name = "", propOrder = {
+ "entry"
+})
+...@xmlrootelement(name = "findEntryByNameResponse")
+public class FindEntryByNameResponse {
+
+ @XmlElement(namespace =
"http://org/apache/axis2/jaxws/sample/addressbook", required = true)
+ protected AddressBookEntry entry;
+
+ /**
+ * Gets the value of the entry property.
+ *
+ * @return
+ * possible object is
+ * {...@link AddressBookEntry }
+ *
+ */
+ public AddressBookEntry getEntry() {
+ return entry;
+ }
+
+ /**
+ * Sets the value of the entry property.
+ *
+ * @param value
+ * allowed object is
+ * {...@link AddressBookEntry }
+ *
+ */
+ public void setEntry(AddressBookEntry value) {
+ this.entry = value;
+ }
+
+}
Added:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/ObjectFactory.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/ObjectFactory.java?rev=929206&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/ObjectFactory.java
(added)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/ObjectFactory.java
Tue Mar 30 18:00:18 2010
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.jaxws.sample.addressbook.data;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.apache.axis2.jaxws.sample.addressbook package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+...@xmlregistry
+public class ObjectFactory {
+
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of
schema derived classes for package: org.apache.axis2.jaxws.sample.addressbook
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {...@link FindEntryByName }
+ *
+ */
+ public FindEntryByName createFindEntryByName() {
+ return new FindEntryByName();
+ }
+
+ /**
+ * Create an instance of {...@link AddEntry }
+ *
+ */
+ public AddEntry createAddEntry() {
+ return new AddEntry();
+ }
+
+ /**
+ * Create an instance of {...@link AddressBookEntry }
+ *
+ */
+ public AddressBookEntry createAddressBookEntry() {
+ return new AddressBookEntry();
+ }
+
+ /**
+ * Create an instance of {...@link AddEntryResponse }
+ *
+ */
+ public AddEntryResponse createAddEntryResponse() {
+ return new AddEntryResponse();
+ }
+
+ /**
+ * Create an instance of {...@link FindEntryByNameResponse }
+ *
+ */
+ public FindEntryByNameResponse createFindEntryByNameResponse() {
+ return new FindEntryByNameResponse();
+ }
+
+}
Added:
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/package-info.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/package-info.java?rev=929206&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/package-info.java
(added)
+++
axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/addressbook/data/package-info.java
Tue Mar 30 18:00:18 2010
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
[email protected](namespace =
"http://org/apache/axis2/jaxws/sample/addressbook")
+package org.apache.axis2.jaxws.sample.addressbook.data;
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java?rev=929206&r1=929205&r2=929206&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/JAXBUtils.java
Tue Mar 30 18:00:18 2010
@@ -286,13 +286,18 @@ public class JAXBUtils {
TreeSet<String> validContextPackages = new
TreeSet<String>(contextPackages);
+ pruneDirectives(validContextPackages);
+
+ int numPackages = validContextPackages.size();
+
ClassLoader tryCl = cl;
contextValue =
createJAXBContextValue(validContextPackages, cl, forceArrays, properties);
// If we don't get all the classes, try the cached
classloader
- if (cacheKey != null && validContextPackages.size() !=
contextPackages.size()) {
+ if (cacheKey != null && numPackages !=
validContextPackages.size()) {
tryCl = cacheKey;
validContextPackages = new
TreeSet<String>(contextPackages);
+ pruneDirectives(validContextPackages);
contextValue =
createJAXBContextValue(validContextPackages, cacheKey,
forceArrays,
properties);
}
@@ -349,6 +354,74 @@ public class JAXBUtils {
constructionType.value = contextValue.constructionType;
return contextValue.jaxbContext;
}
+
+ /**
+ * The contextPackages may declare overrides.
+ * Example:
+ * "com.A"
+ * "com.B"
+ * "com.C"
+ * "@com.A" <-- Indicates a reference to a class (versus ns 2 pkg
conversion)
+ * "com.A > com.B" <-- This says com.A overrides com.B
+ *
+ * This method prunes the overrides and overriden packages.
+ * Example return:
+ * "com.A"
+ * "com.C"
+ * @param contextPackages
+ */
+ protected static void pruneDirectives(TreeSet<String> contextPackages) {
+ List<String> removePkgsList = new ArrayList<String>();
+ List<String> strongPkgsList = new ArrayList<String>();
+
+ // Walk the contextPackages looking for entries representing directives
+ Iterator<String> it = contextPackages.iterator();
+ while (it.hasNext()) {
+ String entry = it.next();
+ // If the entry contains an override character
+ if (entry.contains(">")) {
+ if (log.isDebugEnabled()) {
+ log.debug("Override found:" + entry);
+ }
+ // Remove the entry using an iterator remove()
+ it.remove();
+
+ // Store the overridden package
+ String removePkg = entry.substring(entry.indexOf(">") + 1);
+ removePkg = removePkg.trim();
+ removePkgsList.add(removePkg);
+ }
+ if (entry.startsWith("@")) {
+ if (log.isDebugEnabled()) {
+ log.debug("Strong (class) reference found:" + entry);
+ }
+ // Remove the entry using an iterator remove()
+ it.remove();
+
+ // Store the overridden package
+ String strongPkg = entry.substring(1);
+ strongPkg = strongPkg.trim();
+ strongPkgsList.add(strongPkg);
+ }
+ }
+
+ // Now walk the contextPackages and remove the overriden packages
+ it = contextPackages.iterator();
+ while (it.hasNext()) {
+ String entry = it.next();
+ // If the entry contains an override character
+ if (removePkgsList.contains(entry)) {
+ if (log.isDebugEnabled()) {
+ log.debug("Removing override package:" + entry);
+ }
+ // Remove the overridden package using an iterator remove()
+ it.remove();
+ }
+ }
+
+ // Now add back all of the strong packages
+ contextPackages.addAll(strongPkgsList);
+ }
/**
* Create a JAXBContext using the contextPackages
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/AnnotationDesc.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/AnnotationDesc.java?rev=929206&r1=929205&r2=929206&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/AnnotationDesc.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/AnnotationDesc.java
Tue Mar 30 18:00:18 2010
@@ -35,4 +35,19 @@ public interface AnnotationDesc {
* @return @XmlSeeAlso classes or null
*/
public Class[] getXmlSeeAlsoClasses();
+
+ /**
+ * @return true if the class has an @XmlType
+ */
+ public boolean hasXmlType();
+
+ /**
+ * @return @XmlTypeName or (null if no @XmlType)
+ */
+ public String getXmlTypeName();
+
+ /**
+ * @return @XmlType namepsace (null if no @XmlType)
+ */
+ public String getXmlTypeNamespace();
}
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationDescImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationDescImpl.java?rev=929206&r1=929205&r2=929206&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationDescImpl.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/AnnotationDescImpl.java
Tue Mar 30 18:00:18 2010
@@ -40,6 +40,9 @@ class AnnotationDescImpl implements Anno
private String _XmlRootElementName = null;
private String _XmlRootElementNamespace = null;
private Class[] _XmlSeeAlsoClasses = null;
+ private boolean _hasXmlType = false;
+ private String _XmlTypeName = null;
+ private String _XmlTypeNamespace = null;
private AnnotationDescImpl() {
super();
@@ -56,6 +59,19 @@ class AnnotationDescImpl implements Anno
public String getXmlRootElementNamespace() {
return _XmlRootElementNamespace;
}
+
+ public boolean hasXmlType() {
+ return _hasXmlType;
+ }
+
+
+ public String getXmlTypeName() {
+ return _XmlTypeName;
+ }
+
+ public String getXmlTypeNamespace() {
+ return _XmlTypeNamespace;
+ }
static AnnotationDesc create(Class cls) {
AnnotationDescImpl aDesc = new AnnotationDescImpl();
@@ -76,6 +92,13 @@ class AnnotationDescImpl implements Anno
aDesc._XmlRootElementName = qName.getLocalPart();
aDesc._XmlRootElementNamespace = qName.getNamespaceURI();
}
+
+ qName = XMLRootElementUtil.getXmlTypeQName(cls);
+ if (qName != null) {
+ aDesc._hasXmlType = true;
+ aDesc._XmlTypeName = qName.getLocalPart();
+ aDesc._XmlTypeNamespace = qName.getNamespaceURI();
+ }
return aDesc;
}
@@ -92,6 +115,15 @@ class AnnotationDescImpl implements Anno
string.append(newline);
string.append(" @XMLRootElement name = " +
this.getXmlRootElementName());
}
+
+ string.append(newline);
+ string.append(" @XmlType exists = " + this.hasXmlType());
+ if (this.hasXmlRootElement()) {
+ string.append(newline);
+ string.append(" @XmlType namespace = " +
this.getXmlTypeNamespace());
+ string.append(newline);
+ string.append(" @XmlType name = " +
this.getXmlTypeName());
+ }
if (this._XmlSeeAlsoClasses != null) {
for (int i=0; i<_XmlSeeAlsoClasses.length; i++) {
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java?rev=929206&r1=929205&r2=929206&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java
Tue Mar 30 18:00:18 2010
@@ -302,6 +302,7 @@ public class PackageSetBuilder {
}
if (requestWrapperPkg != null) {
set.add(requestWrapperPkg);
+ set.add("@" + requestWrapperPkg); // Indicates a package from an
actual class reference (versus namespace)
}
String responseWrapperPkg =
getPackageFromClassName(msrd.getResponseWrapperClassName(opDesc));
if (log.isDebugEnabled()) {
@@ -309,6 +310,7 @@ public class PackageSetBuilder {
}
if (responseWrapperPkg != null) {
set.add(responseWrapperPkg);
+ set.add("@" + responseWrapperPkg); // Indicates a package from an
actual class reference (versus namespace)
}
// The wrapper class and the element defining the wrapper may be
@@ -350,6 +352,7 @@ public class PackageSetBuilder {
}
if (pkg != null) {
set.add(pkg);
+ set.add("@" + pkg); // Indicates a package from an actual
class reference (versus namespace)
}
}
}
@@ -380,6 +383,7 @@ public class PackageSetBuilder {
}
if (pkg != null) {
set.add(pkg);
+ set.add("@" + pkg); // Indicates a package from an
actual class reference (versus namespace)
}
}
}
@@ -466,6 +470,32 @@ public class PackageSetBuilder {
if (pkg != null) {
set.add(pkg);
+ set.add("@" + pkg); // Indicates a package from an actual
class reference (versus namespace)
+ }
+ // If there is an xmlType, and it maps to a package then add
+ // an override if the package is different.
+ if (pkg != null) {
+ AnnotationDesc ad = msrd.getAnnotationDesc(tClass);
+ if (ad != null && ad.hasXmlType()) {
+ String ns = ad.getXmlTypeNamespace();
+ if (ns != null && ns.length() > 0) {
+ List pkgs = makePackages(ns);
+ if (pkgs != null) {
+ for (int i=0; i<pkgs.size(); i++) {
+ String pkg2 = (String) pkgs.get(i);
+ if (!pkg.equals(pkg2)) {
+ String override = pkg + " > " + pkg2;
+ if (!set.contains(override)) {
+ set.add(override);
+ if (log.isDebugEnabled()) {
+ log.debug("Adding override=" +
override);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
addXmlSeeAlsoPackages(tClass, msrd, set);
}
@@ -488,6 +518,31 @@ public class PackageSetBuilder {
String pkg = (elementPkg != null) ? elementPkg.getName() :
null;
if (pkg != null) {
set.add(pkg);
+ set.add("@" + pkg); // Indicates a package from an actual
class reference (versus namespace)
+ }
+
+ if (pkg != null) {
+ AnnotationDesc ad = msrd.getAnnotationDesc(tClass);
+ if (ad != null && ad.hasXmlRootElement()) {
+ String ns = ad.getXmlRootElementNamespace();
+ if (ns != null && ns.length() > 0) {
+ List pkgs = makePackages(ns);
+ if (pkgs != null) {
+ for (int i=0; i<pkgs.size(); i++) {
+ String pkg2 = (String) pkgs.get(i);
+ if (!pkg.equals(pkg2)) {
+ String override = pkg + " > " + pkg2;
+ if (!set.contains(override)) {
+ set.add(override);
+ if (log.isDebugEnabled()) {
+ log.debug("Adding override=" +
override);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
addXmlSeeAlsoPackages(tClass, msrd, set);
}
@@ -605,6 +660,7 @@ public class PackageSetBuilder {
log.debug(" adding package = " + pkg);
}
set.add(pkg);
+ set.add("@" + pkg); // Indicates a package from
an actual class reference (versus namespace)
}
}
}
Modified:
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/XMLRootElementUtil.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/XMLRootElementUtil.java?rev=929206&r1=929205&r2=929206&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/XMLRootElementUtil.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/XMLRootElementUtil.java
Tue Mar 30 18:00:18 2010
@@ -28,6 +28,7 @@ import javax.xml.bind.annotation.XmlElem
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchema;
+import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.namespace.QName;
import java.beans.IntrospectionException;
@@ -110,7 +111,7 @@ public class XMLRootElementUtil {
/**
* @param clazz
- * @return namespace of root element qname or null if this is not object
does not represent a root element
+ * @return namespace of root element qname or null if this is object does
not represent a root element
*/
public static String getEnumValue(Enum myEnum){
Field f;
@@ -134,6 +135,40 @@ public class XMLRootElementUtil {
return value;
}
+
+ /**
+ * @param clazz
+ * @return namespace of @XmlType or null if this is object does not
represent a root element
+ */
+ public static QName getXmlTypeQName(Class clazz) {
+
+ // See if the object has an @XmlType
+ XmlType t = (XmlType) getAnnotation(clazz,XmlType.class);
+ if (t == null) {
+ return null;
+ }
+
+ String name = t.name();
+ String namespace = t.namespace();
+
+ // The name may need to be defaulted
+ if (name == null || name.length() == 0 || name.equals("##default")) {
+ name = getSimpleName(clazz.getCanonicalName());
+ }
+
+ // The namespace may need to be defaulted
+ if (namespace == null || namespace.length() == 0 ||
namespace.equals("##default")) {
+ Package pkg = clazz.getPackage();
+ XmlSchema schema = (XmlSchema) getAnnotation(pkg,XmlSchema.class);
+ if (schema != null) {
+ namespace = schema.namespace();
+ } else {
+ namespace = "";
+ }
+ }
+
+ return new QName(namespace, name);
+ }
/**
* utility method to get the last token in a "."-delimited
package+classname string