use of org.apache.cxf.frontend.AbstractServiceFactory in project cxf by apache.
the class DefaultServiceBuilderFactory method newBuilder.
@Override
public ServiceBuilder newBuilder(FrontendFactory.Style s) {
DataBinding dataBinding;
final String dbn = getDatabindingName();
if (ToolConstants.JAXB_DATABINDING.equals(dbn)) {
dataBinding = new JAXBDataBinding();
} else if (ToolConstants.AEGIS_DATABINDING.equals(dbn)) {
dataBinding = new AegisDatabinding();
} else {
throw new ToolException("Unsupported databinding: " + dbn);
}
AbstractServiceFactory builder = null;
if (Style.Jaxws.equals(s)) {
builder = new JaxwsServiceBuilder();
} else if (Style.Simple.equals(s)) {
builder = new SimpleServiceBuilder();
} else {
throw new ToolException("Unsupported frontend style: " + s);
}
builder.setDataBinding(dataBinding);
builder.setServiceClass(serviceClass);
return builder;
}
use of org.apache.cxf.frontend.AbstractServiceFactory 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