use of jakarta.xml.ws.WebServiceProvider in project metro-jax-ws by eclipse-ee4j.
the class EndpointFactory method getDefaultServiceName.
@NotNull
public static QName getDefaultServiceName(Class<?> implType, boolean isStandard, MetadataReader metadataReader) {
if (metadataReader == null) {
metadataReader = new ReflectAnnotationReader();
}
QName serviceName;
WebServiceProvider wsProvider = metadataReader.getAnnotation(WebServiceProvider.class, implType);
if (wsProvider != null) {
String tns = wsProvider.targetNamespace();
String local = wsProvider.serviceName();
serviceName = new QName(tns, local);
} else {
serviceName = RuntimeModeler.getServiceName(implType, metadataReader, isStandard);
}
assert serviceName != null;
return serviceName;
}
use of jakarta.xml.ws.WebServiceProvider in project metro-jax-ws by eclipse-ee4j.
the class EndpointFactory method getDefaultPortName.
@NotNull
public static QName getDefaultPortName(QName serviceName, Class<?> implType, boolean isStandard, MetadataReader metadataReader) {
if (metadataReader == null) {
metadataReader = new ReflectAnnotationReader();
}
QName portName;
WebServiceProvider wsProvider = metadataReader.getAnnotation(WebServiceProvider.class, implType);
if (wsProvider != null) {
String tns = wsProvider.targetNamespace();
String local = wsProvider.portName();
portName = new QName(tns, local);
} else {
portName = RuntimeModeler.getPortName(implType, metadataReader, serviceName.getNamespaceURI(), isStandard);
}
assert portName != null;
return portName;
}
use of jakarta.xml.ws.WebServiceProvider 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.WebServiceProvider in project metro-jax-ws by eclipse-ee4j.
the class WebServiceAp method process.
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
if (context.getRound() != 1) {
return true;
}
context.incrementRound();
WebService webService;
WebServiceProvider webServiceProvider;
WebServiceVisitor webServiceVisitor = new WebServiceWrapperGenerator(this, context);
boolean processedEndpoint = false;
Collection<TypeElement> classes = new ArrayList<>();
filterClasses(classes, roundEnv.getRootElements());
for (TypeElement element : classes) {
webServiceProvider = element.getAnnotation(WebServiceProvider.class);
webService = element.getAnnotation(WebService.class);
if (webServiceProvider != null) {
if (webService != null) {
processError(WebserviceapMessages.WEBSERVICEAP_WEBSERVICE_AND_WEBSERVICEPROVIDER(element.getQualifiedName()));
}
processedEndpoint = true;
}
if (webService == null) {
continue;
}
element.accept(webServiceVisitor, null);
processedEndpoint = true;
}
if (!processedEndpoint) {
if (isCommandLineInvocation) {
if (!ignoreNoWebServiceFoundWarning) {
processWarning(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
}
} else {
processError(WebserviceapMessages.WEBSERVICEAP_NO_WEBSERVICE_ENDPOINT_FOUND());
}
}
return true;
}
Aggregations