use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.
the class SimpleImplGenerator method generate.
public void generate(ToolContext penv) throws ToolException {
this.env = penv;
JavaModel javaModel = env.get(JavaModel.class);
if (passthrough()) {
return;
}
Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
for (JavaInterface intf : interfaces.values()) {
clearAttributes();
setAttributes("intf", intf);
setAttributes("seiClass", env.get(ToolConstants.SEI_CLASS));
setCommonAttributes();
doWrite(IMPL_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName() + "Impl"));
env.put(ToolConstants.IMPL_CLASS, intf.getFullClassName() + "Impl");
}
}
use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.
the class PortTypeProcessor method process.
public void process(ServiceInfo serviceInfo) throws ToolException {
operationMap.clear();
JavaModel jmodel = context.get(JavaModel.class);
InterfaceInfo interfaceInfo = serviceInfo.getInterface();
if (interfaceInfo == null) {
return;
}
JavaInterface intf = getInterface(context, serviceInfo, interfaceInfo);
intf.setJavaModel(jmodel);
Element handler = (Element) context.get(ToolConstants.HANDLER_CHAIN);
intf.setHandlerChains(handler);
Collection<OperationInfo> operations = interfaceInfo.getOperations();
for (OperationInfo operation : operations) {
if (isOverloading(operation.getName())) {
LOG.log(Level.WARNING, "SKIP_OVERLOADED_OPERATION", operation.getName());
continue;
}
OperationProcessor operationProcessor = new OperationProcessor(context);
operationProcessor.process(intf, operation);
}
jmodel.setLocation(intf.getLocation());
jmodel.addInterface(intf.getName(), intf);
}
use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.
the class ServiceProcessor method processPort.
private JavaPort processPort(JavaModel model, ServiceInfo si, EndpointInfo port) throws ToolException {
BindingInfo binding = port.getBinding();
String portType = binding.getInterface().getName().getLocalPart();
JavaInterface intf = PortTypeProcessor.getInterface(context, si, binding.getInterface());
JavaPort jport = new JavaPort(NameUtil.mangleNameToClassName(port.getName().getLocalPart()));
jport.setPackageName(intf.getPackageName());
jport.setPortName(port.getName().getLocalPart());
jport.setBindingAdress(port.getAddress());
jport.setBindingName(binding.getName().getLocalPart());
jport.setPortType(portType);
jport.setInterfaceClass(intf.getName());
bindingType = getBindingType(binding);
if (bindingType == null) {
org.apache.cxf.common.i18n.Message msg = new org.apache.cxf.common.i18n.Message("BINDING_SPECIFY_ONE_PROTOCOL", LOG, binding.getName());
throw new ToolException(msg);
}
if (isSoapBinding()) {
SoapBinding spbd = SOAPBindingUtil.getProxy(SoapBinding.class, this.bindingObj);
jport.setStyle(SOAPBindingUtil.getSoapStyle(spbd.getStyle()));
jport.setTransURI(spbd.getTransportURI());
}
Collection<BindingOperationInfo> operations = binding.getOperations();
for (BindingOperationInfo bop : operations) {
processOperation(model, bop, binding);
}
jport.setJavaDoc(port.getDocumentation());
JAXWSBinding bind = port.getExtensor(JAXWSBinding.class);
if (bind != null) {
jport.setMethodName(bind.getMethodName());
jport.setJavaDoc(bind.getMethodJavaDoc());
}
return jport;
}
use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.
the class BindingAnnotator method annotate.
public void annotate(JavaAnnotatable ja) {
JavaInterface intf;
if (ja instanceof JavaInterface) {
intf = (JavaInterface) ja;
} else {
throw new RuntimeException("BindingAnnotator can only annotate JavaInterface");
}
if (processBinding(intf)) {
JAnnotation bindingAnnotation = new JAnnotation(SOAPBinding.class);
if (!SOAPBinding.Style.DOCUMENT.equals(intf.getSOAPStyle())) {
bindingAnnotation.addElement(new JAnnotationElement("style", intf.getSOAPStyle()));
}
if (!SOAPBinding.Use.LITERAL.equals(intf.getSOAPUse())) {
bindingAnnotation.addElement(new JAnnotationElement("use", intf.getSOAPUse()));
}
if (intf.getSOAPStyle() == SOAPBinding.Style.DOCUMENT && intf.getSOAPParameterStyle() != SOAPBinding.ParameterStyle.WRAPPED) {
bindingAnnotation.addElement(new JAnnotationElement("parameterStyle", intf.getSOAPParameterStyle()));
}
intf.addAnnotation(bindingAnnotation);
}
for (JavaMethod method : intf.getMethods()) {
if (!method.isAsync()) {
method.annotate(new SoapBindingAnnotator());
}
}
}
use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.
the class WebServiceAnnotator method annotate.
public void annotate(JavaAnnotatable ja) {
JavaInterface intf = null;
if (ja instanceof JavaInterface) {
intf = (JavaInterface) ja;
} else {
throw new RuntimeException("WebService can only annotate JavaInterface");
}
JAnnotation serviceAnnotation = new JAnnotation(WebService.class);
serviceAnnotation.addElement(new JAnnotationElement("targetNamespace", intf.getNamespace()));
serviceAnnotation.addElement(new JAnnotationElement("name", intf.getWebServiceName()));
intf.addAnnotation(serviceAnnotation);
}
Aggregations