Author: jason.greene(a)jboss.com
Date: 2006-10-31 00:34:33 -0500 (Tue, 31 Oct 2006)
New Revision: 1334
Modified:
branches/JEE5_TCK/src/main/java/org/jboss/ws/deployment/JSR181ClientMetaDataBuilder.java
branches/JEE5_TCK/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
Log:
Fix revision 1327
Switch jaxb context creation back to eager design (was always initialized to null anyway)
Modified:
branches/JEE5_TCK/src/main/java/org/jboss/ws/deployment/JSR181ClientMetaDataBuilder.java
===================================================================
---
branches/JEE5_TCK/src/main/java/org/jboss/ws/deployment/JSR181ClientMetaDataBuilder.java 2006-10-31
04:00:38 UTC (rev 1333)
+++
branches/JEE5_TCK/src/main/java/org/jboss/ws/deployment/JSR181ClientMetaDataBuilder.java 2006-10-31
05:34:33 UTC (rev 1334)
@@ -76,7 +76,8 @@
// Process @WebMethod
processWebMethods(epMetaData, wsClass, true);
- // Populate parameter xmlTypes
+ // Initialize types
+ createJAXBContext(epMetaData);
populateXmlTypes(epMetaData);
// Eager initialization
Modified:
branches/JEE5_TCK/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
===================================================================
---
branches/JEE5_TCK/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-10-31
04:00:38 UTC (rev 1333)
+++
branches/JEE5_TCK/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-10-31
05:34:33 UTC (rev 1334)
@@ -196,7 +196,8 @@
boolean includeAllMethods = (wsClass == seiClass);
processWebMethods(sepMetaData, wsClass, includeAllMethods);
- // Populate parameter xmlTypes
+ // Initialize types
+ createJAXBContext(sepMetaData);
populateXmlTypes(sepMetaData);
// Process or generate WSDL
@@ -214,10 +215,10 @@
// Init the endpoint address
initEndpointAddress(udi, sepMetaData, linkName);
-
+
// replace the SOAP address
replaceAddressLocation(sepMetaData);
-
+
// Process an optional @SOAPMessageHandlers annotation
if (sepClass.isAnnotationPresent(SOAPMessageHandlers.class) ||
wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
log.warn("@SOAPMessageHandlers is deprecated as of JSR-181 2.0 with no
replacement.");
@@ -259,22 +260,18 @@
jaxbCtx = null;
}
- protected JAXBRIContext getJAXBContext(EndpointMetaData epMetaData)
+ protected void createJAXBContext(EndpointMetaData epMetaData)
{
- if (jaxbCtx == null)
- {
- try
- {
- String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
- log.debug("JAXBContext [types=" + javaTypes + ",tns=" +
targetNS + "]");
- jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]),
typeRefs, targetNS, false);
- }
- catch (JAXBException ex)
- {
- log.error("Cannot build JAXB context", ex);
- }
- }
- return jaxbCtx;
+ try
+ {
+ String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
+ log.debug("JAXBContext [types=" + javaTypes + ",tns=" + targetNS
+ "]");
+ jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]), typeRefs,
targetNS, false);
+ }
+ catch (JAXBException ex)
+ {
+ throw new IllegalStateException("Cannot build JAXB context", ex);
+ }
}
protected void populateXmlTypes(EndpointMetaData epMetaData)
@@ -295,7 +292,6 @@
{
EndpointMetaData epMetaData =
paramMetaData.getOperationMetaData().getEndpointMetaData();
TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
- JAXBRIContext jaxbCtx = getJAXBContext(epMetaData);
QName xmlName = paramMetaData.getXmlName();
QName xmlType = paramMetaData.getXmlType();
@@ -306,14 +302,11 @@
{
xmlType = jaxbCtx.getTypeName(new TypeReference(xmlName, javaType));
if (xmlType == null)
- log.warn("Cannot obtain xml type for: [xmlName=" + xmlName +
",javaName=" + javaName + "]");
-
- if (xmlType != null)
- {
- paramMetaData.setXmlType(xmlType);
- types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName));
- }
+ throw new IllegalStateException("Cannot obtain xml type for:
[xmlName=" + xmlName + ",javaName=" + javaName + "]");
+ paramMetaData.setXmlType(xmlType);
}
+
+ types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName));
}
protected void processSOAPBinding(EndpointMetaData epMetaData, Class wsClass)
@@ -901,7 +894,7 @@
{
String serviceName = serviceMetaData.getServiceName().getLocalPart();
- WSDLGenerator generator = new JAXBWSDLGenerator(getJAXBContext(epMetaData));
+ WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData);
ServerConfigFactory factory = ServerConfigFactory.getInstance();
Show replies by date