Author: alessio.soldano(a)jboss.com
Date: 2009-01-23 10:18:55 -0500 (Fri, 23 Jan 2009)
New Revision: 9106
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/annotation/SchemaValidation.java
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientFeatureProcessor.java
Log:
[JBWS-2446] Improving check of supported features
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/annotation/SchemaValidation.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/annotation/SchemaValidation.java 2009-01-23
10:52:49 UTC (rev 9105)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/annotation/SchemaValidation.java 2009-01-23
15:18:55 UTC (rev 9106)
@@ -26,6 +26,8 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import javax.xml.ws.spi.WebServiceFeatureAnnotation;
+
import org.jboss.ws.extensions.validation.StrictlyValidErrorHandler;
import org.jboss.ws.feature.SchemaValidationFeature;
@@ -39,6 +41,7 @@
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = { ElementType.TYPE })
@EndpointFeature( id = SchemaValidationFeature.ID)
+@WebServiceFeatureAnnotation(id = SchemaValidationFeature.ID, bean =
SchemaValidationFeature.class)
public @interface SchemaValidation
{
/**
Modified:
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientFeatureProcessor.java
===================================================================
---
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientFeatureProcessor.java 2009-01-23
10:52:49 UTC (rev 9105)
+++
stack/native/branches/jaxws21/modules/core/src/main/java/org/jboss/ws/core/jaxws/client/ClientFeatureProcessor.java 2009-01-23
15:18:55 UTC (rev 9106)
@@ -37,7 +37,9 @@
import org.jboss.ws.extensions.addressing.jaxws.WSAddressingClientHandler;
import org.jboss.ws.feature.FastInfosetFeature;
import org.jboss.ws.feature.JsonEncodingFeature;
+import org.jboss.ws.feature.SchemaValidationFeature;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.FeatureSet;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.ws.metadata.wsdl.Extendable;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
@@ -59,18 +61,26 @@
{
private static Logger log = Logger.getLogger(ClientFeatureProcessor.class);
+ private static FeatureSet supportedFeatures = new FeatureSet();
+ static
+ {
+ supportedFeatures.addFeature(new FastInfosetFeature());
+ supportedFeatures.addFeature(new JsonEncodingFeature());
+ supportedFeatures.addFeature(new SchemaValidationFeature());
+ supportedFeatures.addFeature(new AddressingFeature());
+ supportedFeatures.addFeature(new MTOMFeature());
+ supportedFeatures.addFeature(new RespectBindingFeature());
+ }
+
public static <T> void processFeature(WebServiceFeature feature,
EndpointMetaData epMetaData, T stub)
{
- boolean supportedFeature = false;
- if (feature instanceof FastInfosetFeature || feature instanceof
JsonEncodingFeature)
- supportedFeature = true;
- supportedFeature = supportedFeature || processAddressingFeature(feature,
epMetaData, stub);
- supportedFeature = supportedFeature || processMTOMFeature(feature, epMetaData,
stub);
- supportedFeature = supportedFeature || processRespectBindingFeature(feature,
epMetaData, stub);
- if (!supportedFeature)
+ if (!supportedFeatures.hasFeature(feature.getClass()))
{
throw new IllegalArgumentException("Unsupported feature: " +
feature);
}
+ processAddressingFeature(feature, epMetaData, stub);
+ processMTOMFeature(feature, epMetaData, stub);
+ processRespectBindingFeature(feature, epMetaData, stub);
epMetaData.addFeature(feature);
}
@@ -85,7 +95,7 @@
* @return
*/
@SuppressWarnings("unchecked")
- private static <T> boolean processAddressingFeature(WebServiceFeature feature,
EndpointMetaData epMetaData, T stub)
+ private static <T> void processAddressingFeature(WebServiceFeature feature,
EndpointMetaData epMetaData, T stub)
{
if (feature instanceof AddressingFeature && feature.isEnabled())
{
@@ -93,9 +103,7 @@
List<Handler> handlers = bindingExt.getHandlerChain(HandlerType.POST);
handlers.add(new WSAddressingClientHandler());
bindingExt.setHandlerChain(handlers, HandlerType.POST);
- return true;
}
- return false;
}
/**
@@ -108,15 +116,13 @@
* @param stub
* @return
*/
- private static <T> boolean processMTOMFeature(WebServiceFeature feature,
EndpointMetaData epMetaData, T stub)
+ private static <T> void processMTOMFeature(WebServiceFeature feature,
EndpointMetaData epMetaData, T stub)
{
if (feature instanceof MTOMFeature)
{
SOAPBinding binding = (SOAPBinding)((BindingProvider)stub).getBinding();
binding.setMTOMEnabled(feature.isEnabled());
- return true;
}
- return false;
}
/**
@@ -129,7 +135,7 @@
* @param stub
* @return
*/
- private static <T> boolean processRespectBindingFeature(WebServiceFeature
feature, EndpointMetaData epMetaData, T stub)
+ private static <T> void processRespectBindingFeature(WebServiceFeature feature,
EndpointMetaData epMetaData, T stub)
{
if (feature instanceof RespectBindingFeature && feature.isEnabled())
{
@@ -156,9 +162,7 @@
log.warn("Cannot find port " + epMetaData.getPortName());
}
}
- return true;
}
- return false;
}
private static void checkNotUnderstoodExtElements(Extendable extendable,
EndpointMetaData epMetaData)