use of org.apache.cxf.service.factory.FactoryBeanListener in project fabric8 by fabric8io.
the class SwaggerFeature method initializeProvider.
@Override
protected void initializeProvider(InterceptorProvider provider, final Bus bus) {
if (!(provider instanceof Endpoint)) {
FactoryBeanListenerManager factoryBeanListenerManager = bus.getExtension(FactoryBeanListenerManager.class);
if (factoryBeanListenerManager == null) {
factoryBeanListenerManager = new FactoryBeanListenerManager(bus);
}
factoryBeanListenerManager.addListener(new FactoryBeanListener() {
@Override
public void handleEvent(Event arg0, AbstractServiceFactoryBean arg1, Object... arg2) {
if (arg0.equals(Event.SERVER_CREATED) && (arg2[0] instanceof Server)) {
Server server = (Server) arg2[0];
if (server.getEndpoint().getEndpointInfo().getBinding().getBindingId().equals("http://apache.org/cxf/binding/jaxrs")) {
initialize(server, bus);
}
}
}
});
return;
}
EndpointImpl endpointImpl = (EndpointImpl) provider;
List<Feature> features = endpointImpl.getActiveFeatures();
if (features == null) {
features = new ArrayList<Feature>();
features.add(this);
endpointImpl.initializeActiveFeatures(features);
} else {
features.add(this);
}
}
use of org.apache.cxf.service.factory.FactoryBeanListener in project cxf by apache.
the class PolicyEngineImpl method setBus.
@Resource
public final void setBus(Bus b) {
if (this.bus == b) {
// avoid bus init twice through injection
return;
}
bus = b;
addBusInterceptors();
FactoryBeanListenerManager fblm = bus.getExtension(FactoryBeanListenerManager.class);
if (fblm != null) {
for (FactoryBeanListener l : fblm.getListeners()) {
if (l instanceof PolicyAnnotationListener) {
return;
}
}
fblm.addListener(new PolicyAnnotationListener(bus));
}
}
Aggregations