Search in sources :

Example 1 with KarafInitialContextFactory

use of org.apache.karaf.jndi.KarafInitialContextFactory in project karaf by apache.

the class Activator method doStart.

@Override
protected void doStart() throws Exception {
    ProxyManager proxyManager = getTrackedService(ProxyManager.class);
    register(InitialContextFactory.class, new KarafInitialContextFactory());
    JndiServiceImpl service = new JndiServiceImpl();
    service.setBundleContext(bundleContext);
    service.setProxyManager(proxyManager);
    Hashtable<String, String> props = new Hashtable<>();
    // bind the JNDI service itself in the JNDI context
    props.put("osgi.jndi.service.name", "jndi");
    register(JndiService.class, service, props);
    JndiMBeanImpl mbean = new JndiMBeanImpl();
    mbean.setJndiService(service);
    registerMBean(mbean, "type=jndi");
}
Also used : KarafInitialContextFactory(org.apache.karaf.jndi.KarafInitialContextFactory) JndiServiceImpl(org.apache.karaf.jndi.internal.JndiServiceImpl) Hashtable(java.util.Hashtable) ProxyManager(org.apache.aries.proxy.ProxyManager) JndiMBeanImpl(org.apache.karaf.jndi.internal.JndiMBeanImpl)

Aggregations

Hashtable (java.util.Hashtable)1 ProxyManager (org.apache.aries.proxy.ProxyManager)1 KarafInitialContextFactory (org.apache.karaf.jndi.KarafInitialContextFactory)1 JndiMBeanImpl (org.apache.karaf.jndi.internal.JndiMBeanImpl)1 JndiServiceImpl (org.apache.karaf.jndi.internal.JndiServiceImpl)1