use of org.apache.cxf.service.factory.FactoryBeanListener in project fabric8 by jboss-fuse.
the class ManagedApiFeature method initializeProvider.
@Override
protected void initializeProvider(InterceptorProvider provider, final Bus bus) {
if (provider instanceof Endpoint) {
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);
}
} else if (provider instanceof Bus) {
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];
initialize(server, bus);
}
}
});
} else {
List<Feature> features = (List<Feature>) bus.getFeatures();
if (features == null) {
features = new ArrayList<Feature>();
features.add(this);
} else {
features.add(this);
}
}
}
use of org.apache.cxf.service.factory.FactoryBeanListener in project fabric8 by fabric8io.
the class ManagedApiFeature method initialize.
@Override
public void initialize(final Bus bus) {
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];
initialize(server, bus);
}
}
});
}
use of org.apache.cxf.service.factory.FactoryBeanListener in project fabric8 by jboss-fuse.
the class ManagedApiFeature method initialize.
@Override
public void initialize(final Bus bus) {
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];
initialize(server, bus);
}
}
});
}
use of org.apache.cxf.service.factory.FactoryBeanListener in project fabric8 by jboss-fuse.
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 fabric8 by fabric8io.
the class ManagedApiFeature method initializeProvider.
@Override
protected void initializeProvider(InterceptorProvider provider, final Bus bus) {
if (provider instanceof Endpoint) {
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);
}
} else if (provider instanceof Bus) {
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];
initialize(server, bus);
}
}
});
} else {
List<Feature> features = (List<Feature>) bus.getFeatures();
if (features == null) {
features = new ArrayList<Feature>();
features.add(this);
} else {
features.add(this);
}
}
}
Aggregations