use of org.apache.cxf.binding.BindingFactory in project cxf by apache.
the class AbstractJAXRSFactoryBean method createBindingInfo.
protected BindingInfo createBindingInfo() {
BindingFactoryManager mgr = getBus().getExtension(BindingFactoryManager.class);
String binding = getBindingId();
BindingConfiguration bindingConfig = getBindingConfig();
if (binding == null && bindingConfig != null) {
binding = bindingConfig.getBindingId();
}
if (binding == null) {
binding = JAXRSBindingFactory.JAXRS_BINDING_ID;
}
try {
BindingFactory bindingFactory = mgr.getBindingFactory(binding);
setBindingFactory(bindingFactory);
BindingInfo bi = bindingFactory.createBindingInfo(serviceFactory.getService(), binding, bindingConfig);
for (BindingOperationInfo boi : bi.getOperations()) {
serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_OPERATION_CREATED, bi, boi, null);
}
serviceFactory.sendEvent(FactoryBeanListener.Event.BINDING_CREATED, bi);
return bi;
} catch (BusException ex) {
ex.printStackTrace();
// do nothing
}
return null;
}
use of org.apache.cxf.binding.BindingFactory in project cxf by apache.
the class STSUtils method createSTSEndpoint.
// CHECKSTYLE:OFF
private static Endpoint createSTSEndpoint(Bus bus, String namespace, String transportId, String location, String soapVersion, Policy policy, QName epName, boolean sc) throws BusException, EndpointException {
// CHECKSTYLE:ON
String ns = namespace + "/wsdl";
ServiceInfo si = new ServiceInfo();
QName iName = new QName(ns, sc ? "SecureConversationTokenService" : "SecurityTokenService");
si.setName(iName);
InterfaceInfo ii = new InterfaceInfo(si, iName);
OperationInfo ioi = addIssueOperation(ii, namespace, ns);
OperationInfo coi = addCancelOperation(ii, namespace, ns);
OperationInfo roi = addRenewOperation(ii, namespace, ns);
si.setInterface(ii);
Service service = new ServiceImpl(si);
BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);
BindingFactory bindingFactory = bfm.getBindingFactory(soapVersion);
BindingInfo bi = bindingFactory.createBindingInfo(service, soapVersion, null);
si.addBinding(bi);
if (transportId == null) {
ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
ConduitInitiator ci = cim.getConduitInitiatorForUri(location);
transportId = ci.getTransportIds().get(0);
}
EndpointInfo ei = new EndpointInfo(si, transportId);
ei.setBinding(bi);
ei.setName(epName == null ? iName : epName);
ei.setAddress(location);
si.addEndpoint(ei);
if (policy != null) {
ei.addExtensor(policy);
}
BindingOperationInfo boi = bi.getOperation(ioi);
SoapOperationInfo soi = boi.getExtensor(SoapOperationInfo.class);
if (soi == null) {
soi = new SoapOperationInfo();
boi.addExtensor(soi);
}
soi.setAction(namespace + (sc ? "/RST/SCT" : "/RST/Issue"));
boi = bi.getOperation(coi);
soi = boi.getExtensor(SoapOperationInfo.class);
if (soi == null) {
soi = new SoapOperationInfo();
boi.addExtensor(soi);
}
soi.setAction(namespace + (sc ? "/RST/SCT/Cancel" : "/RST/Cancel"));
boi = bi.getOperation(roi);
soi = boi.getExtensor(SoapOperationInfo.class);
if (soi == null) {
soi = new SoapOperationInfo();
boi.addExtensor(soi);
}
soi.setAction(namespace + (sc ? "/RST/SCT/Renew" : "/RST/Renew"));
service.setDataBinding(new SourceDataBinding());
return new EndpointImpl(bus, service, ei);
}
use of org.apache.cxf.binding.BindingFactory in project cxf by apache.
the class WSDLServiceUtils method getBindingFactory.
public static BindingFactory getBindingFactory(Binding binding, Bus bus, StringBuilder sb) {
BindingFactory factory = null;
for (Object obj : binding.getExtensibilityElements()) {
if (obj instanceof ExtensibilityElement) {
ExtensibilityElement ext = (ExtensibilityElement) obj;
sb.delete(0, sb.length());
sb.append(ext.getElementType().getNamespaceURI());
try {
BindingFactoryManager manager = bus.getExtension(BindingFactoryManager.class);
if (manager != null) {
factory = manager.getBindingFactory(sb.toString());
}
} catch (BusException e) {
// ignore, we'll use a generic BindingInfo
}
if (factory != null) {
break;
}
}
}
return factory;
}
Aggregations