You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2008/02/13 19:25:14 UTC
svn commit: r627555 - in /webservices/axis2/trunk/java/modules:
addressing/src/org/apache/axis2/handlers/addressing/
jaxws-api/src/javax/xml/ws/wsaddressing/
jaxws/src/org/apache/axis2/jaxws/addressing/
jaxws/src/org/apache/axis2/jaxws/addressing/facto...
Author: pradine
Date: Wed Feb 13 10:25:09 2008
New Revision: 627555
URL: http://svn.apache.org/viewvc?rev=627555&view=rev
Log:
More JAX-WS 2.1 WS-Addressing support related updates.
Modified:
webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/wsaddressing/W3CEndpointReference.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/SubmissionEndpointReference.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/InterfaceName.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/ServiceName.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/WSDLLocation.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/addressing/SubmissionAddressingFeature.java
webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java
Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingValidationHandler.java Wed Feb 13 10:25:09 2008
@@ -81,7 +81,8 @@
}
return;
}
- String addressingFlag = msgContext.getAxisService().getWSAddressingFlag();
+ String addressingFlag =
+ AddressingHelper.getAddressingRequirementParemeterValue(msgContext.getAxisService());
if (log.isTraceEnabled()) {
log.trace("checkUsingAddressing: WSAddressingFlag=" + addressingFlag);
}
Modified: webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/wsaddressing/W3CEndpointReference.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/wsaddressing/W3CEndpointReference.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/wsaddressing/W3CEndpointReference.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws-api/src/javax/xml/ws/wsaddressing/W3CEndpointReference.java Wed Feb 13 10:25:09 2008
@@ -23,7 +23,6 @@
import java.util.Map;
import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
@@ -72,8 +71,8 @@
"any"
})
public final class W3CEndpointReference extends EndpointReference {
- protected static volatile JAXBContext jaxbContext;
protected static final String NS = "http://www.w3.org/2005/08/addressing";
+ protected static JAXBContext jaxbContext;
@XmlElement(name = "Address", required = true)
protected AttributedURIType address;
@@ -85,6 +84,16 @@
protected List<Object> any;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+ static {
+ try {
+ jaxbContext = JAXBContext.newInstance(W3CEndpointReference.class);
+ }
+ catch (Exception e) {
+ //TODO NLS enable
+ throw new WebServiceException("JAXBContext creation failed.", e);
+ }
+ }
protected W3CEndpointReference() {
}
@@ -93,7 +102,6 @@
super();
try {
- JAXBContext jaxbContext = getJAXBContext();
Unmarshaller um = jaxbContext.createUnmarshaller();
W3CEndpointReference w3cEPR = (W3CEndpointReference) um.unmarshal(eprInfoset);
@@ -117,7 +125,6 @@
}
try {
- JAXBContext jaxbContext = getJAXBContext();
Marshaller m = jaxbContext.createMarshaller();
m.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
m.marshal(this, result);
@@ -126,19 +133,6 @@
//TODO NLS enable
throw new WebServiceException("writeTo failure.", e);
}
- }
-
- private JAXBContext getJAXBContext() throws JAXBException {
- //This is an implementation of double-checked locking.
- //It works because jaxbContext is volatile.
- if (jaxbContext == null) {
- synchronized (W3CEndpointReference.class) {
- if (jaxbContext == null)
- jaxbContext = JAXBContext.newInstance(W3CEndpointReference.class);
- }
- }
-
- return jaxbContext;
}
/**
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/SubmissionEndpointReference.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/SubmissionEndpointReference.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/SubmissionEndpointReference.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/SubmissionEndpointReference.java Wed Feb 13 10:25:09 2008
@@ -23,7 +23,6 @@
import java.util.Map;
import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
@@ -79,8 +78,8 @@
"any"
})
public class SubmissionEndpointReference extends EndpointReference {
- protected static volatile JAXBContext jaxbContext;
protected static final String NS = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+ protected static JAXBContext jaxbContext;
@XmlElement(name = "Address", required = true)
protected AttributedURI address;
@@ -96,6 +95,16 @@
protected List<Object> any;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+ static {
+ try {
+ jaxbContext = JAXBContext.newInstance(SubmissionEndpointReference.class);
+ }
+ catch (Exception e) {
+ //TODO NLS enable
+ throw new WebServiceException("JAXBContext creation failed.", e);
+ }
+ }
protected SubmissionEndpointReference() {
}
@@ -104,7 +113,6 @@
super();
try {
- JAXBContext jaxbContext = getJAXBContext();
Unmarshaller um = jaxbContext.createUnmarshaller();
SubmissionEndpointReference subEPR =
(SubmissionEndpointReference) um.unmarshal(eprInfoset);
@@ -131,7 +139,6 @@
}
try {
- JAXBContext jaxbContext = getJAXBContext();
Marshaller m = jaxbContext.createMarshaller();
m.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
m.marshal(this, result);
@@ -140,19 +147,6 @@
//TODO NLS enable
throw new WebServiceException("writeTo failure.", e);
}
- }
-
- private JAXBContext getJAXBContext() throws JAXBException {
- //This is an implementation of double-checked locking.
- //It works because jaxbContext is volatile.
- if (jaxbContext == null) {
- synchronized (SubmissionEndpointReference.class) {
- if (jaxbContext == null)
- jaxbContext = JAXBContext.newInstance(SubmissionEndpointReference.class);
- }
- }
-
- return jaxbContext;
}
/**
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/factory/JAXWSEndpointReferenceFactoryImpl.java Wed Feb 13 10:25:09 2008
@@ -23,6 +23,7 @@
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.Source;
import javax.xml.ws.EndpointReference;
+import javax.xml.ws.WebServiceException;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
import org.apache.axis2.addressing.AddressingConstants.Final;
@@ -31,14 +32,23 @@
import org.apache.axis2.jaxws.addressing.SubmissionEndpointReference;
public class JAXWSEndpointReferenceFactoryImpl implements JAXWSEndpointReferenceFactory {
- private static volatile JAXBContext jaxbContext;
+ private JAXBContext jaxbContext;
public JAXWSEndpointReferenceFactoryImpl() {
super();
+
+ try {
+ jaxbContext = JAXBContext.newInstance(W3CEndpointReference.class,
+ SubmissionEndpointReference.class);
+ }
+ catch (Exception e) {
+ //TODO NLS enable
+ throw new WebServiceException("JAXBContext creation failed.", e);
+ }
}
public EndpointReference createEndpointReference(Source eprInfoset) throws JAXBException {
- Unmarshaller um = getJAXBContext().createUnmarshaller();
+ Unmarshaller um = jaxbContext.createUnmarshaller();
return (EndpointReference) um.unmarshal(eprInfoset);
}
@@ -54,19 +64,5 @@
throw ExceptionFactory.makeWebServiceException("Unknown class type: " + clazz);
return addressingNamespace;
- }
-
- private JAXBContext getJAXBContext() throws JAXBException {
- //This is an implementation of double-checked locking.
- //It works because jaxbContext is volatile.
- if (jaxbContext == null) {
- synchronized (JAXWSEndpointReferenceFactoryImpl.class) {
- if (jaxbContext == null)
- jaxbContext = JAXBContext.newInstance(W3CEndpointReference.class,
- SubmissionEndpointReference.class);
- }
- }
-
- return jaxbContext;
}
}
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/addressing/util/EndpointReferenceUtils.java Wed Feb 13 10:25:09 2008
@@ -140,7 +140,8 @@
throws Exception {
if (portType != null) {
InterfaceName interfaceName = new InterfaceName(portType);
- OMElement omElement = interfaceName.toOM(interfaceType);
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMElement omElement = interfaceName.toOM(interfaceType, factory);
axis2EPR.addExtensibleElement(omElement);
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/EndpointReferenceHelper.java Wed Feb 13 10:25:09 2008
@@ -18,6 +18,7 @@
*/
package org.apache.axis2.addressing;
+import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
@@ -439,12 +440,13 @@
* @throws AxisFault
*/
public static void setServiceNameMetadata(EndpointReference epr, String addressingNamespace, ServiceName serviceName) throws AxisFault {
+ OMFactory factory = OMAbstractFactory.getOMFactory();
if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
- OMElement omElement = serviceName.toOM(ServiceName.subQName);
+ OMElement omElement = serviceName.toOM(factory, ServiceName.subQName);
epr.addExtensibleElement(omElement);
}
else {
- OMElement omElement = serviceName.toOM(ServiceName.finalQName);
+ OMElement omElement = serviceName.toOM(factory, ServiceName.finalQName);
epr.addMetaData(omElement);
}
}
@@ -457,7 +459,8 @@
* @throws AxisFault
*/
public static void setWSDLLocationMetadata(EndpointReference epr, String addressingNamespace, WSDLLocation wsdlLocation) throws AxisFault {
- OMAttribute attribute = wsdlLocation.toOM();
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMAttribute attribute = wsdlLocation.toOM(factory);
if (AddressingConstants.Submission.WSA_NAMESPACE.equals(addressingNamespace)) {
epr.addAttribute(attribute);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/InterfaceName.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/InterfaceName.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/InterfaceName.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/InterfaceName.java Wed Feb 13 10:25:09 2008
@@ -87,9 +87,10 @@
* </p>
*
* @param qname the <code>QName</code> that carries the namespace of the metadata element.
+ * @param fac TODO
* @return an OMElement that can be added to the metadata of an EndpointReference.
*/
- public OMElement toOM(QName qname) throws AxisFault {
+ public OMElement toOM(QName qname, OMFactory fac) throws AxisFault {
String prefix = qname.getPrefix();
if (prefix == null) {
throw new AxisFault("The prefix cannot be null.");
@@ -105,7 +106,6 @@
throw new AxisFault("The namespace canot be null.");
}
- OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace metadataNs = fac.createOMNamespace(namespace, prefix);
OMElement element = fac.createOMElement(localName, metadataNs);
element.setText(name);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/ServiceName.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/ServiceName.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/ServiceName.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/ServiceName.java Wed Feb 13 10:25:09 2008
@@ -116,11 +116,12 @@
* the difference being whether the EndpointReference is meant to represent a 2004/08
* (Submission) or 2005/08 (Final) EndpointReference, respectively.
* </p>
- *
+ * @param factory <code>OMFactory</code> to use when generating <code>OMElement</code>s
* @param qname the <code>QName</code> that carries the namespace of the metadata element.
+ *
* @return an OMElement that can be added to the metadata of an EndpointReference.
*/
- public OMElement toOM(QName qname) throws AxisFault {
+ public OMElement toOM(OMFactory factory, QName qname) throws AxisFault {
String localName = qname.getLocalPart();
if (!AddressingConstants.EPR_SERVICE_NAME.equals(localName)) {
throw new AxisFault("The local name must be 'ServiceName'.");
@@ -136,9 +137,8 @@
throw new AxisFault("The namespace canot be null.");
}
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace metadataNs = fac.createOMNamespace(namespace, prefix);
- OMElement element = fac.createOMElement(localName, metadataNs);
+ OMNamespace metadataNs = factory.createOMNamespace(namespace, prefix);
+ OMElement element = factory.createOMElement(localName, metadataNs);
element.setText(name);
if (endpointName != null) {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/WSDLLocation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/WSDLLocation.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/WSDLLocation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/metadata/WSDLLocation.java Wed Feb 13 10:25:09 2008
@@ -55,14 +55,14 @@
/**
* Convenience method to convert an object of this type to an <code>OMAttribute</code>
+ * @param factory <code>OMFactory</code> to use when generating <code>OMElement</code>s
*
* @return an <code>OMAttribute</code> that can be added to an <code>EndpointReference</code>
*/
- public OMAttribute toOM() {
+ public OMAttribute toOM(OMFactory factory) {
String value = new StringBuffer(targetNamespace).append(" ").append(wsdlURL).toString();
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMNamespace wsdliNs = fac.createOMNamespace(WSDLI.getNamespaceURI(), WSDLI.getPrefix());
- OMAttribute omAttribute = fac.createOMAttribute(WSDLI.getLocalPart(), wsdliNs, value);
+ OMNamespace wsdliNs = factory.createOMNamespace(WSDLI.getNamespaceURI(), WSDLI.getPrefix());
+ OMAttribute omAttribute = factory.createOMAttribute(WSDLI.getLocalPart(), wsdliNs, value);
return omAttribute;
}
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/addressing/SubmissionAddressingFeature.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/addressing/SubmissionAddressingFeature.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/addressing/SubmissionAddressingFeature.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/addressing/SubmissionAddressingFeature.java Wed Feb 13 10:25:09 2008
@@ -21,7 +21,7 @@
import javax.xml.ws.WebServiceFeature;
public final class SubmissionAddressingFeature extends WebServiceFeature {
- public static final String ID = "org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature";
+ public static final String ID = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
protected boolean required;
Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java?rev=627555&r1=627554&r2=627555&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/server/config/AddressingConfigurator.java Wed Feb 13 10:25:09 2008
@@ -23,6 +23,7 @@
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.AddressingHelper;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.engine.AxisConfiguration;
@@ -50,7 +51,7 @@
(SubmissionAddressing) ((EndpointDescriptionJava) endpointDescription).getAnnoFeature(SubmissionAddressingFeature.ID);
AxisService service = endpointDescription.getAxisService();
Parameter namespace = new Parameter(AddressingConstants.WS_ADDRESSING_VERSION, null);
- Parameter disable = new Parameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES, Boolean.FALSE);
+ Parameter disabled = new Parameter(AddressingConstants.DISABLE_ADDRESSING_FOR_IN_MESSAGES, Boolean.FALSE);
String addressingRequired = AddressingConstants.ADDRESSING_UNSPECIFIED;
if (addressing != null && submissionAddressing != null) {
@@ -82,7 +83,7 @@
addressingRequired = AddressingConstants.ADDRESSING_REQUIRED;
}
else {
- disable.setValue(Boolean.TRUE);
+ disabled.setValue(Boolean.TRUE);
}
}
else if (addressing != null) {
@@ -120,10 +121,10 @@
try {
service.addParameter(namespace);
- service.addParameter(disable);
- service.setWSAddressingFlag(addressingRequired);
+ service.addParameter(disabled);
+ AddressingHelper.setAddressingRequirementParemeterValue(service, addressingRequired);
- if (!(Boolean)disable.getValue()) {
+ if (!(Boolean)disabled.getValue()) {
ServiceDescription sd = endpointDescription.getServiceDescription();
AxisConfiguration axisConfig = sd.getAxisConfigContext().getAxisConfiguration();
if (!axisConfig.isEngaged(Constants.MODULE_ADDRESSING))
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org