use of org.apache.cxf.service.ServiceBuilder in project cxf by apache.
the class JavaToWSDLProcessor method process.
public void process() throws ToolException {
String oldClassPath = System.getProperty(JAVA_CLASS_PATH);
LOG.log(Level.FINE, "OLD_CP", oldClassPath);
if (context.get(ToolConstants.CFG_CLASSPATH) != null) {
String newCp = (String) context.get(ToolConstants.CFG_CLASSPATH);
System.setProperty(JAVA_CLASS_PATH, newCp + File.pathSeparator + oldClassPath);
LOG.log(Level.FINE, "NEW_CP", newCp);
}
// check for command line specification of data binding.
ServiceBuilder builder = getServiceBuilder();
ServiceInfo service = builder.createService();
customize(service);
File wsdlFile = getOutputFile(builder.getOutputFile(), service.getName().getLocalPart() + ".wsdl");
File outputDir = getOutputDir(wsdlFile);
if (context.containsKey(ToolConstants.CFG_WSDL)) {
generators.add(getWSDLGenerator(wsdlFile));
}
if (context.containsKey(ToolConstants.CFG_WRAPPERBEAN)) {
generators.add(getWrapperBeanGenerator());
generators.add(getFaultBeanGenerator());
}
generate(service, outputDir);
List<ServiceInfo> serviceList = new ArrayList<>();
serviceList.add(service);
context.put(ToolConstants.SERVICE_LIST, serviceList);
System.setProperty(JAVA_CLASS_PATH, oldClassPath);
LOG.log(Level.FINE, "RESUME_CP", oldClassPath);
}
use of org.apache.cxf.service.ServiceBuilder in project cxf by apache.
the class SpringServiceBuilderFactory method newBuilder.
@Override
public ServiceBuilder newBuilder(FrontendFactory.Style s) {
ApplicationContext applicationContext = getApplicationContext(beanDefinitions);
DataBinding dataBinding;
String databindingBeanName = databindingNameToBeanName(databindingName);
try {
dataBinding = (DataBinding) applicationContext.getBean(databindingBeanName);
} catch (RuntimeException e) {
throw new ToolException("Cannot get databinding bean " + databindingBeanName + " for databinding " + databindingName, e);
}
String beanName = getBuilderBeanName(s);
ServiceBuilder builder = null;
try {
builder = applicationContext.getBean(beanName, ServiceBuilder.class);
AbstractServiceFactory serviceFactory = (AbstractServiceFactory) builder;
serviceFactory.setDataBinding(dataBinding);
} catch (RuntimeException e) {
throw new ToolException("Can not get ServiceBuilder bean " + beanName + "to initialize the ServiceBuilder for style: " + s + " Reason: \n" + e.getMessage(), e);
}
builder.setServiceClass(serviceClass);
return builder;
}
Aggregations