use of org.apache.cxf.configuration.ConfiguredBeanLocator in project cxf by apache.
the class BindingFactoryManagerImpl method loadActivationNamespace.
private BindingFactory loadActivationNamespace(final String namespace) {
final ConfiguredBeanLocator locator = bus.getExtension(ConfiguredBeanLocator.class);
// Second attempt will be to examine the factory class
// for a DEFAULT_NAMESPACES field and if it doesn't exist, try
// using the older activation ns things. This will then load most
// of the "older" things
ConfiguredBeanLocator.BeanLoaderListener<BindingFactory> listener = new ConfiguredBeanLocator.BeanLoaderListener<BindingFactory>() {
public boolean beanLoaded(String name, BindingFactory bean) {
loaded.add(name);
return bindingFactories.containsKey(namespace);
}
public boolean loadBean(String name, Class<? extends BindingFactory> type) {
if (loaded.contains(name)) {
return false;
}
try {
type.getField("DEFAULT_NAMESPACES");
return false;
} catch (Exception ex) {
// ignore
}
return locator.hasConfiguredPropertyValue(name, "activationNamespaces", namespace);
}
};
locator.loadBeansOfType(BindingFactory.class, listener);
return bindingFactories.get(namespace);
}
use of org.apache.cxf.configuration.ConfiguredBeanLocator in project cxf by apache.
the class WorkQueueManagerImpl method setBus.
@Resource
public final void setBus(Bus bus) {
this.bus = bus;
if (null != bus) {
bus.setExtension(this, WorkQueueManager.class);
imanager = bus.getExtension(InstrumentationManager.class);
if (null != imanager) {
try {
imanager.register(new WorkQueueManagerImplMBeanWrapper(this));
} catch (JMException jmex) {
LOG.log(Level.WARNING, jmex.getMessage(), jmex);
}
}
ConfiguredBeanLocator locator = bus.getExtension(ConfiguredBeanLocator.class);
Collection<? extends AutomaticWorkQueue> q = locator.getBeansOfType(AutomaticWorkQueue.class);
if (q != null) {
for (AutomaticWorkQueue awq : q) {
addNamedWorkQueue(awq.getName(), awq);
}
}
if (!namedQueues.containsKey(DEFAULT_QUEUE_NAME)) {
AutomaticWorkQueue defaultQueue = locator.getBeanOfType(DEFAULT_WORKQUEUE_BEAN_NAME, AutomaticWorkQueue.class);
if (defaultQueue != null) {
addNamedWorkQueue(DEFAULT_QUEUE_NAME, defaultQueue);
}
}
bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(new WQLifecycleListener());
}
}
use of org.apache.cxf.configuration.ConfiguredBeanLocator in project cxf by apache.
the class SpringBus method setApplicationContext.
/**
* {@inheritDoc}
*/
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
ctx = (AbstractApplicationContext) applicationContext;
@SuppressWarnings("rawtypes") ApplicationListener listener = new ApplicationListener() {
public void onApplicationEvent(ApplicationEvent event) {
SpringBus.this.onApplicationEvent(event);
}
};
ctx.addApplicationListener(listener);
ApplicationContext ac = applicationContext.getParent();
while (ac != null) {
if (ac instanceof AbstractApplicationContext) {
((AbstractApplicationContext) ac).addApplicationListener(listener);
}
ac = ac.getParent();
}
// set the classLoader extension with the application context classLoader
setExtension(applicationContext.getClassLoader(), ClassLoader.class);
setExtension(new ConfigurerImpl(applicationContext), Configurer.class);
ResourceManager m = getExtension(ResourceManager.class);
m.addResourceResolver(new BusApplicationContextResourceResolver(applicationContext));
setExtension(applicationContext, ApplicationContext.class);
ConfiguredBeanLocator loc = getExtension(ConfiguredBeanLocator.class);
if (!(loc instanceof SpringBeanLocator)) {
setExtension(new SpringBeanLocator(applicationContext, this), ConfiguredBeanLocator.class);
}
if (getState() != BusState.RUNNING) {
initialize();
}
}
use of org.apache.cxf.configuration.ConfiguredBeanLocator in project cxf by apache.
the class ExtensionManagerBus method createConfiguredBeanLocator.
protected final synchronized ConfiguredBeanLocator createConfiguredBeanLocator() {
ConfiguredBeanLocator loc = (ConfiguredBeanLocator) extensions.get(ConfiguredBeanLocator.class);
if (loc == null) {
loc = extensionManager;
this.setExtension(loc, ConfiguredBeanLocator.class);
}
return loc;
}
use of org.apache.cxf.configuration.ConfiguredBeanLocator in project cxf by apache.
the class FactoryBeanListenerManager method setBus.
@Resource
public final void setBus(Bus bus) {
this.bus = bus;
this.bus.setExtension(this, FactoryBeanListenerManager.class);
ConfiguredBeanLocator loc = bus.getExtension(ConfiguredBeanLocator.class);
if (loc != null) {
for (FactoryBeanListener f : loc.getBeansOfType(FactoryBeanListener.class)) {
listeners.add(0, f);
}
}
}
Aggregations