Search in sources :

Example 1 with ConfiguredBeanLocator

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);
}
Also used : ConfiguredBeanLocator(org.apache.cxf.configuration.ConfiguredBeanLocator) BusException(org.apache.cxf.BusException) BindingFactory(org.apache.cxf.binding.BindingFactory) AbstractBindingFactory(org.apache.cxf.binding.AbstractBindingFactory)

Example 2 with ConfiguredBeanLocator

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());
    }
}
Also used : ConfiguredBeanLocator(org.apache.cxf.configuration.ConfiguredBeanLocator) JMException(javax.management.JMException) AutomaticWorkQueue(org.apache.cxf.workqueue.AutomaticWorkQueue) BusLifeCycleManager(org.apache.cxf.buslifecycle.BusLifeCycleManager) InstrumentationManager(org.apache.cxf.management.InstrumentationManager) Resource(javax.annotation.Resource)

Example 3 with ConfiguredBeanLocator

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();
    }
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) AbstractApplicationContext(org.springframework.context.support.AbstractApplicationContext) AbstractApplicationContext(org.springframework.context.support.AbstractApplicationContext) ConfiguredBeanLocator(org.apache.cxf.configuration.ConfiguredBeanLocator) ConfigurerImpl(org.apache.cxf.configuration.spring.ConfigurerImpl) ApplicationListener(org.springframework.context.ApplicationListener) ApplicationEvent(org.springframework.context.ApplicationEvent) ResourceManager(org.apache.cxf.resource.ResourceManager)

Example 4 with ConfiguredBeanLocator

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;
}
Also used : ConfiguredBeanLocator(org.apache.cxf.configuration.ConfiguredBeanLocator)

Example 5 with ConfiguredBeanLocator

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);
        }
    }
}
Also used : ConfiguredBeanLocator(org.apache.cxf.configuration.ConfiguredBeanLocator) Resource(javax.annotation.Resource)

Aggregations

ConfiguredBeanLocator (org.apache.cxf.configuration.ConfiguredBeanLocator)17 TransactionManager (javax.transaction.TransactionManager)4 Resource (javax.annotation.Resource)3 ConnectionFactory (javax.jms.ConnectionFactory)1 JMException (javax.management.JMException)1 SystemException (javax.transaction.SystemException)1 QName (javax.xml.namespace.QName)1 Bus (org.apache.cxf.Bus)1 BusException (org.apache.cxf.BusException)1 AbstractBindingFactory (org.apache.cxf.binding.AbstractBindingFactory)1 BindingFactory (org.apache.cxf.binding.BindingFactory)1 BusLifeCycleManager (org.apache.cxf.buslifecycle.BusLifeCycleManager)1 ConfigurerImpl (org.apache.cxf.configuration.spring.ConfigurerImpl)1 InstrumentationManager (org.apache.cxf.management.InstrumentationManager)1 ResourceManager (org.apache.cxf.resource.ResourceManager)1 JMSEndpoint (org.apache.cxf.transport.jms.uri.JMSEndpoint)1 MyBeanLocator (org.apache.cxf.transport.jms.uri.MyBeanLocator)1 JMSDestinationResolver (org.apache.cxf.transport.jms.util.JMSDestinationResolver)1 JndiHelper (org.apache.cxf.transport.jms.util.JndiHelper)1 AutomaticWorkQueue (org.apache.cxf.workqueue.AutomaticWorkQueue)1