use of jakarta.xml.ws.Provider in project metro-jax-ws by eclipse-ee4j.
the class EndpointFactory method verifyImplementorClass.
/**
* Verifies if the endpoint implementor class has @WebService or @WebServiceProvider
* annotation; passing MetadataReader instance allows to read annotations from
* xml descriptor instead of class's annotations
*
* @return
* true if it is a Provider or AsyncProvider endpoint
* false otherwise
* @throws java.lang.IllegalArgumentException
* If it doesn't have any one of @WebService or @WebServiceProvider
* If it has both @WebService and @WebServiceProvider annotations
*/
public static boolean verifyImplementorClass(Class<?> clz, MetadataReader metadataReader) {
if (metadataReader == null) {
metadataReader = new ReflectAnnotationReader();
}
WebServiceProvider wsProvider = metadataReader.getAnnotation(WebServiceProvider.class, clz);
WebService ws = metadataReader.getAnnotation(WebService.class, clz);
if (wsProvider == null && ws == null) {
throw new IllegalArgumentException(clz + " has neither @WebService nor @WebServiceProvider annotation");
}
if (wsProvider != null && ws != null) {
throw new IllegalArgumentException(clz + " has both @WebService and @WebServiceProvider annotations");
}
if (wsProvider != null) {
if (Provider.class.isAssignableFrom(clz) || AsyncProvider.class.isAssignableFrom(clz)) {
return true;
}
throw new IllegalArgumentException(clz + " doesn't implement Provider or AsyncProvider interface");
}
return false;
}
use of jakarta.xml.ws.Provider in project metro-jax-ws by eclipse-ee4j.
the class HandlerAnnotationProcessor method getSEI.
static Class getSEI(Class<?> clazz, MetadataReader metadataReader) {
if (metadataReader == null) {
metadataReader = new ReflectAnnotationReader();
}
if (Provider.class.isAssignableFrom(clazz) || AsyncProvider.class.isAssignableFrom(clazz)) {
// No SEI for Provider Implementation
return null;
}
if (Service.class.isAssignableFrom(clazz)) {
// No SEI for Service class
return null;
}
WebService webService = metadataReader.getAnnotation(WebService.class, clazz);
if (webService == null) {
throw new UtilException("util.handler.no.webservice.annotation", clazz.getCanonicalName());
}
String ei = webService.endpointInterface();
if (ei.length() > 0) {
clazz = getClass(webService.endpointInterface());
WebService ws = metadataReader.getAnnotation(WebService.class, clazz);
if (ws == null) {
throw new UtilException("util.handler.endpoint.interface.no.webservice", webService.endpointInterface());
}
return clazz;
}
return null;
}
Aggregations