Search in sources :

Example 1 with WebServiceAnnotator

use of org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebServiceAnnotator in project cxf by apache.

the class WSDLToJavaProcessor method wsdlDefinitionToJavaModel.

private JavaModel wsdlDefinitionToJavaModel(ServiceInfo serviceInfo) throws ToolException {
    JavaModel javaModel = null;
    Map<QName, JavaModel> map = CastUtils.cast((Map<?, ?>) context.get(MODEL_MAP));
    if (map == null) {
        map = new LinkedHashMap<QName, JavaModel>();
        context.put(MODEL_MAP, map);
    }
    if (map.containsKey(serviceInfo.getName())) {
        javaModel = map.get(serviceInfo.getName());
    } else {
        javaModel = new JavaModel();
        map.put(serviceInfo.getName(), javaModel);
    }
    context.put(JavaModel.class, javaModel);
    List<JavaInterface> interfaces = new ArrayList<>();
    interfaces.addAll(javaModel.getInterfaces().values());
    PortTypeProcessor portTypeProcessor = new PortTypeProcessor(context);
    portTypeProcessor.process(serviceInfo);
    ServiceProcessor serviceProcessor = new ServiceProcessor(context);
    serviceProcessor.process(serviceInfo);
    for (JavaInterface intf : javaModel.getInterfaces().values()) {
        if (!interfaces.contains(intf)) {
            intf.annotate(new WebServiceAnnotator());
            intf.annotate(new XmlSeeAlsoAnnotator(context.get(ClassCollector.class)));
            intf.annotate(new BindingAnnotator());
        }
    }
    return javaModel;
}
Also used : PortTypeProcessor(org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.PortTypeProcessor) ServiceProcessor(org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ServiceProcessor) XmlSeeAlsoAnnotator(org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.XmlSeeAlsoAnnotator) JavaInterface(org.apache.cxf.tools.common.model.JavaInterface) QName(javax.xml.namespace.QName) JavaModel(org.apache.cxf.tools.common.model.JavaModel) ArrayList(java.util.ArrayList) WebServiceAnnotator(org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebServiceAnnotator) BindingAnnotator(org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.BindingAnnotator)

Aggregations

ArrayList (java.util.ArrayList)1 QName (javax.xml.namespace.QName)1 JavaInterface (org.apache.cxf.tools.common.model.JavaInterface)1 JavaModel (org.apache.cxf.tools.common.model.JavaModel)1 PortTypeProcessor (org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.PortTypeProcessor)1 ServiceProcessor (org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.ServiceProcessor)1 BindingAnnotator (org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.BindingAnnotator)1 WebServiceAnnotator (org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.WebServiceAnnotator)1 XmlSeeAlsoAnnotator (org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator.XmlSeeAlsoAnnotator)1