當前位置: 首頁>>代碼示例>>Java>>正文


Java NamingManager.setObjectFactoryBuilder方法代碼示例

本文整理匯總了Java中javax.naming.spi.NamingManager.setObjectFactoryBuilder方法的典型用法代碼示例。如果您正苦於以下問題:Java NamingManager.setObjectFactoryBuilder方法的具體用法?Java NamingManager.setObjectFactoryBuilder怎麽用?Java NamingManager.setObjectFactoryBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.naming.spi.NamingManager的用法示例。


在下文中一共展示了NamingManager.setObjectFactoryBuilder方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

import javax.naming.spi.NamingManager; //導入方法依賴的package包/類
@Override
public void start(BundleContext bundleContext) throws Exception {

    try {
        NamingManager.setInitialContextFactoryBuilder(new DefaultContextFactoryBuilder());
        NamingManager.setObjectFactoryBuilder(new DefaultObjectFactoryBuilder());

        Dictionary<String, String> propertyMap = new Hashtable<>();
        propertyMap.put(JNDIConstants.JNDI_URLSCHEME, "java");
        bundleContext.registerService(ObjectFactory.class, new JavaURLContextFactory(), propertyMap);

        //register osgi url scheme
        Dictionary<String, String> osgiPropertyMap = new Hashtable<>();
        osgiPropertyMap.put(JNDIConstants.JNDI_URLSCHEME, "osgi");
        bundleContext.registerService(ObjectFactory.class.getName(),
                new OSGiURLContextServiceFactory(), osgiPropertyMap);

        // InitialContextFactory Provider should be registered with its implementation class as well as the
        // InitialContextFactory class.
        bundleContext.registerService(InitialContextFactory.class, new InMemoryInitialContextFactory(), null);

        logger.debug("Registering JNDIContextManager OSGi service.");
        bundleContext.registerService(JNDIContextManager.class, new JNDIContextManagerServiceFactory(), null);
    } catch (Throwable e) {
        logger.error(e.getMessage(), e);
    }
}
 
開發者ID:wso2,項目名稱:carbon-jndi,代碼行數:28,代碼來源:JNDIActivator.java

示例2: myTestSetObjectFactoryBuilder_SetNormal

import javax.naming.spi.NamingManager; //導入方法依賴的package包/類
/**
 * Set the object factory builder to a mock instance.
 * 
 */
public void myTestSetObjectFactoryBuilder_SetNormal()
		throws NamingException {
	log.setMethod("myTestSetInitialContextFactoryBuilder_SetNormal");
	ObjectFactoryBuilder objectFactoryBuilder = NamingManagerTest.MockObjectFactoryBuilder
			.getInstance();
	NamingManager.setObjectFactoryBuilder(objectFactoryBuilder);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:12,代碼來源:NamingManagerBuilderTest.java

示例3: myTestSetObjectFactoryBuilder_ResetNormal

import javax.naming.spi.NamingManager; //導入方法依賴的package包/類
/**
 * Reset the object factory builder to another mock instance.
 * 
 */
public void myTestSetObjectFactoryBuilder_ResetNormal()
		throws NamingException {
	log.setMethod("myTestSetObjectFactoryBuilder_ResetNormal");
	try {
		NamingManager
				.setObjectFactoryBuilder(new NamingManagerTest.MockObjectFactoryBuilder());
		fail("Reset ObjectFactoryBuilder is forbidden!");
	} catch (IllegalStateException e) {
	}
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:15,代碼來源:NamingManagerBuilderTest.java

示例4: myTestSetObjectFactoryBuilder_ResetSame

import javax.naming.spi.NamingManager; //導入方法依賴的package包/類
/**
 * Reset the object factory builder to the same mock instance.
 * 
 */
public void myTestSetObjectFactoryBuilder_ResetSame()
		throws NamingException {
	log.setMethod("myTestSetObjectFactoryBuilder_ResetSame");
	try {
		NamingManager
				.setObjectFactoryBuilder(NamingManagerTest.MockObjectFactoryBuilder
						.getInstance());
		fail("Reset ObjectFactoryBuilder is forbidden!");
	} catch (IllegalStateException e) {
	}
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:16,代碼來源:NamingManagerBuilderTest.java

示例5: myTestSetObjectFactoryBuilder_ResetNull

import javax.naming.spi.NamingManager; //導入方法依賴的package包/類
/**
 * Reset the object factory builder to null.
 * 
 */
public void myTestSetObjectFactoryBuilder_ResetNull()
		throws NamingException {
	log.setMethod("myTestSetObjectFactoryBuilder_ResetNull");
	try {
		NamingManager.setObjectFactoryBuilder(null);
		fail("Reset ObjectFactoryBuilder to null is forbidden!");
	} catch (IllegalStateException e) {
	}
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:14,代碼來源:NamingManagerBuilderTest.java

示例6: myTestSetObjectFactoryBuilder_SetNormal

import javax.naming.spi.NamingManager; //導入方法依賴的package包/類
/**
 * Set the object factory builder to a mock instance.
 * 
 */
public void myTestSetObjectFactoryBuilder_SetNormal()
		throws NamingException {
	log.setMethod("myTestSetObjectFactoryBuilder_SetNormal");
	ObjectFactoryBuilder objectFactoryBuilder = MockObjectFactoryBuilder
			.getInstance();
	NamingManager.setObjectFactoryBuilder(objectFactoryBuilder);
	// NamingManager.setObjectFactoryBuilder(objectFactoryBuilder);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:13,代碼來源:DirectoryManagerBuilderTest.java

示例7: myTestSetObjectFactoryBuilder_SetNull

import javax.naming.spi.NamingManager; //導入方法依賴的package包/類
/**
 * Set the object factory builder to null.
 * 
 */
public void myTestSetObjectFactoryBuilder_SetNull() throws NamingException {
	log.setMethod("myTestSetObjectFactoryBuilder_SetNull");
	NamingManager.setObjectFactoryBuilder(null);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:9,代碼來源:NamingManagerBuilderTest.java


注:本文中的javax.naming.spi.NamingManager.setObjectFactoryBuilder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。