Java Code Examples for org.apache.cxf.bus.extension.ExtensionManagerBus#initialize()

The following examples show how to use org.apache.cxf.bus.extension.ExtensionManagerBus#initialize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CdiBusBean.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public ExtensionManagerBus create(final CreationalContext< ExtensionManagerBus > ctx) {
    final ExtensionManagerBus instance = injectionTarget.produce(ctx);
    if ("true".equals(SystemPropertyAction.getProperty("org.apache.cxf.cdi.unwrap.proxies", "true"))) {
        instance.setProperty(ClassUnwrapper.class.getName(), new CdiClassUnwrapper());
    }
    BusFactory.possiblySetDefaultBus(instance);
    instance.initialize();

    injectionTarget.inject(instance, ctx);
    injectionTarget.postConstruct(instance);
    return instance;
}
 
Example 2
Source File: CXFBusFactory.java    From cxf with Apache License 2.0 5 votes vote down vote up
public Bus createBus(Map<Class<?>, Object> e, Map<String, Object> properties) {
    ExtensionManagerBus bus = new ExtensionManagerBus(e, properties);
    possiblySetDefaultBus(bus);
    initializeBus(bus);
    bus.initialize();
    return bus;
}
 
Example 3
Source File: Whiteboard.java    From aries-jax-rs-whiteboard with Apache License 2.0 4 votes vote down vote up
private ExtensionManagerBus createBus(
    Map<String, ServiceTuple<Object>> extensions) {

    BundleWiring wiring = _bundleContext.getBundle().adapt(
        BundleWiring.class);

    Map<String, Object> properties = new HashMap<>(_configurationMap);
    properties.putIfAbsent(
        "replace.loopback.address.with.localhost", "false");

    HashMap<Class<?>, Object> cxfExtensions = new HashMap<>();

    if (extensions.isEmpty()) {
        cxfExtensions = null;
    }
    else {
        for (Map.Entry<String, ServiceTuple<Object>> entry :
            extensions.entrySet()) {

            String className = entry.getKey();

            ServiceTuple<Object> serviceTuple = entry.getValue();

            ClassLoader classLoader = getClassLoader(serviceTuple);

            try {
                Class<?> clazz = classLoader.loadClass(className);

                cxfExtensions.put(clazz, serviceTuple.getService());
            }
            catch (Exception e) {
                if (_log.isErrorEnabled()) {
                    _log.error("Could not load extension for CXF bus", e);
                }
            }
        }
    }

    if (_log.isDebugEnabled()) {
        _log.debug(
            "Creating CXF Bus with extensions {} and properties {}",
            extensions, properties);
    }

    ExtensionManagerBus bus = new ExtensionManagerBus(
        cxfExtensions, properties, wiring.getClassLoader());

    bus.initialize();

    if (_log.isDebugEnabled()) {
        _log.debug(
            "Created CXF Bus with extensions {} and properties {}",
            extensions, properties);
    }

    return bus;
}