use of org.apache.cxf.databinding.DataBinding in project tomee by apache.
the class CxfUtil method configureEndpoint.
public static void configureEndpoint(final AbstractEndpointFactory svrFactory, final ServiceConfiguration configuration, final String prefix) {
final Properties beanConfig = configuration.getProperties();
if (beanConfig == null || beanConfig.isEmpty()) {
return;
}
final Collection<ServiceInfo> availableServices = configuration.getAvailableServices();
// endpoint properties
final Properties properties = ServiceInfos.serviceProperties(availableServices, beanConfig.getProperty(prefix + ENDPOINT_PROPERTIES));
if (properties != null) {
svrFactory.setProperties(PropertiesHelper.map(properties));
}
final String debugKey = prefix + DEBUG;
if ("true".equalsIgnoreCase(beanConfig.getProperty(debugKey, SystemInstance.get().getOptions().get(debugKey, "false")))) {
svrFactory.getProperties(true).put("faultStackTraceEnabled", "true");
}
// endpoint features
final String featuresIds = beanConfig.getProperty(prefix + FEATURES);
if (featuresIds != null) {
final List<? extends Feature> features = createFeatures(availableServices, featuresIds);
svrFactory.setFeatures(features);
}
configureInterceptors(svrFactory, prefix, availableServices, beanConfig);
// databinding
final String databinding = beanConfig.getProperty(prefix + DATABINDING);
if (databinding != null && !databinding.trim().isEmpty()) {
Object instance = ServiceInfos.resolve(availableServices, databinding);
if (instance == null) {
// maybe id == classname
try {
instance = Thread.currentThread().getContextClassLoader().loadClass(databinding).newInstance();
} catch (Exception e) {
// ignore
}
}
if (!DataBinding.class.isInstance(instance)) {
throw new OpenEJBRuntimeException(instance + " is not a " + DataBinding.class.getName() + ", please check configuration of service [id=" + databinding + "]");
}
svrFactory.setDataBinding((DataBinding) instance);
}
// address: easier than using openejb-jar.xml
final String changedAddress = beanConfig.getProperty(prefix + ADDRESS);
if (changedAddress != null && !changedAddress.trim().isEmpty()) {
svrFactory.setAddress(changedAddress);
}
// published url
final String publishedUrl = beanConfig.getProperty(prefix + PUBLISHED_URL);
if (publishedUrl != null && !publishedUrl.trim().isEmpty()) {
svrFactory.setPublishedEndpointUrl(publishedUrl);
}
}
use of org.apache.cxf.databinding.DataBinding in project tomee by apache.
the class CxfEndpoint method configureService.
protected static JaxWsServiceFactoryBean configureService(final JaxWsServiceFactoryBean serviceFactory, final ServiceConfiguration configuration, final String prefix) {
final Properties beanConfig = configuration.getProperties();
if (beanConfig == null || beanConfig.isEmpty()) {
return serviceFactory;
}
final Collection<ServiceInfo> availableServices = configuration.getAvailableServices();
// databinding
final String databinding = beanConfig.getProperty(prefix + CxfUtil.DATABINDING);
if (databinding != null && !databinding.trim().isEmpty()) {
Object instance = ServiceInfos.resolve(availableServices, databinding);
if (instance == null) {
// maybe id == classname
try {
instance = Thread.currentThread().getContextClassLoader().loadClass(databinding).newInstance();
} catch (Exception e) {
// ignore
}
}
if (!DataBinding.class.isInstance(instance)) {
throw new OpenEJBRuntimeException(instance + " is not a " + DataBinding.class.getName() + ", please check configuration of service [id=" + databinding + "]");
}
serviceFactory.setDataBinding((DataBinding) instance);
}
final String wsFeatures = beanConfig.getProperty(prefix + "wsFeatures");
if (wsFeatures != null) {
final Collection<Object> instances = ServiceInfos.resolve(availableServices, wsFeatures.split(" *, *"));
if (instances != null && !instances.isEmpty()) {
final List<WebServiceFeature> features = new ArrayList<>(instances.size());
for (final Object i : instances) {
if (!WebServiceFeature.class.isInstance(i)) {
throw new IllegalArgumentException("Not a WebServiceFeature: " + i);
}
features.add(WebServiceFeature.class.cast(i));
}
serviceFactory.setWsFeatures(features);
}
}
return serviceFactory;
}
Aggregations