use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.
the class JavaFirstUtil method serviceInfo2JavaInf.
public static JavaInterface serviceInfo2JavaInf(ServiceInfo service) {
JavaInterface javaInf = new JavaInterface();
InterfaceInfo inf = service.getInterface();
for (OperationInfo op : inf.getOperations()) {
JavaMethod jm = new JavaMethod();
Method m = (Method) op.getProperty(ReflectionServiceFactoryBean.METHOD);
jm.setName(m.getName());
int i = 0;
for (Type type : m.getGenericParameterTypes()) {
JavaParameter jp = new JavaParameter();
jp.setClassName(getClassName(type));
jp.setStyle(Style.IN);
jp.setName("arg" + i++);
jm.addParameter(jp);
}
for (Type type : m.getGenericExceptionTypes()) {
JavaException jex = new JavaException();
String className = getClassName(type);
jex.setClassName(className);
jex.setName(className);
jm.addException(jex);
}
JavaReturn jreturn = new JavaReturn();
jreturn.setClassName(getClassName(m.getGenericReturnType()));
jreturn.setStyle(Style.OUT);
jm.setReturn(jreturn);
String pkg = PackageUtils.getPackageName(m.getDeclaringClass());
javaInf.setPackageName(pkg.length() == 0 ? ToolConstants.DEFAULT_PACKAGE_NAME : pkg);
javaInf.addMethod(jm);
javaInf.setName(inf.getName().getLocalPart());
jm.getParameterList();
}
return javaInf;
}
use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.
the class AntGenerator method generate.
public void generate(ToolContext penv) throws ToolException {
this.env = penv;
if (passthrough()) {
return;
}
JavaModel javaModel = env.get(JavaModel.class);
Map<String, JavaInterface> interfaces = javaModel.getInterfaces();
Map<String, String> serverClassNamesMap = new HashMap<>();
Map<String, String> clientClassNamesMap = new HashMap<>();
for (JavaInterface intf : interfaces.values()) {
clientClassNamesMap.put(intf.getName() + "Client", intf.getFullClassName() + "Client");
serverClassNamesMap.put(intf.getName() + "Server", intf.getFullClassName() + "Server");
}
clearAttributes();
setAttributes("clientClassNamesMap", clientClassNamesMap);
setAttributes("serverClassNamesMap", serverClassNamesMap);
setAttributes("srcdir", penv.get(ToolConstants.CFG_SOURCEDIR));
setAttributes("clsdir", penv.get(ToolConstants.CFG_CLASSDIR));
setAttributes("classpath", penv.get(ToolConstants.CFG_CLASSPATH));
setAttributes("classpath", penv.get(ToolConstants.CFG_CLASSPATH));
setCommonAttributes();
doWrite(BUILD_TEMPLATE, parseOutputName(null, "build", ".xml"));
}
use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.
the class JAXWSFrontEndProcessor method serviceInfo2JavaInf.
public JavaInterface serviceInfo2JavaInf(ServiceInfo service) {
JavaInterface javaInf = new JavaInterface();
InterfaceInfo inf = service.getInterface();
for (OperationInfo op : inf.getOperations()) {
JavaMethod jm = new JavaMethod();
Method m = (Method) op.getProperty(ReflectionServiceFactoryBean.METHOD);
jm.setName(m.getName());
int i = 0;
for (Type type : m.getGenericParameterTypes()) {
JavaParameter jp = new JavaParameter();
jp.setClassName(getClassName(type));
jp.setStyle(Style.IN);
jp.setName("arg" + i++);
jm.addParameter(jp);
}
for (Type type : m.getGenericExceptionTypes()) {
JavaException jex = new JavaException();
String className = getClassName(type);
jex.setClassName(className);
jex.setName(className);
jm.addException(jex);
}
JavaReturn jreturn = new JavaReturn();
jreturn.setClassName(getClassName(m.getGenericReturnType()));
jreturn.setStyle(Style.OUT);
jm.setReturn(jreturn);
String pkg = PackageUtils.getPackageName(m.getDeclaringClass());
javaInf.setPackageName(pkg.length() > 0 ? pkg : ToolConstants.DEFAULT_PACKAGE_NAME);
javaInf.addMethod(jm);
javaInf.setName(inf.getName().getLocalPart());
jm.getParameterList();
}
return javaInf;
}
use of org.apache.cxf.tools.common.model.JavaInterface in project cxf by apache.
the class JaxwsImplGenerator 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();
QName service = (QName) env.get(ToolConstants.SERVICE_NAME);
for (JavaInterface intf : interfaces.values()) {
clearAttributes();
setAttributes("intf", intf);
setAttributes("service", service);
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 JaxwsSEIGenerator 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);
setCommonAttributes();
doWrite(SEI_TEMPLATE, parseOutputName(intf.getPackageName(), intf.getName()));
env.put(ToolConstants.SEI_CLASS, intf.getFullClassName());
}
}
Aggregations