当前位置: 首页>>代码示例>>Java>>正文


Java EmbeddedRegistryService类代码示例

本文整理汇总了Java中org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedRegistryService类的具体用法?Java EmbeddedRegistryService怎么用?Java EmbeddedRegistryService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EmbeddedRegistryService类属于org.wso2.carbon.registry.core.jdbc包,在下文中一共展示了EmbeddedRegistryService类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRegistryService

import org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService; //导入依赖的package包/类
private void createRegistryService(Class realClass, WithRegistry withRegistry) {
    try {
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(withRegistry.tenantDomain());
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(withRegistry.tenantId());
        RegistryContext registryContext = RegistryContext.getBaseInstance(IdentityTenantUtil.getRealmService());
        DataSource dataSource = MockInitialContextFactory
                .initializeDatasource(REG_DB_JNDI_NAME, realClass, new String[] { REG_DB_SQL_FILE });
        registryContext.setDataAccessManager(new JDBCDataAccessManager(dataSource));
        RegistryService registryService = new EmbeddedRegistryService(registryContext);

        OSGiDataHolder.getInstance().setRegistryService(registryService);
        PrivilegedCarbonContext.getThreadLocalCarbonContext()
                .setRegistry(RegistryType.USER_GOVERNANCE, registryService.getRegistry());
        Class[] singletonClasses = withRegistry.injectToSingletons();
        injectSingletonVariables(registryService, RegistryService.class, singletonClasses);
    } catch (RegistryException e) {
        log.error("Error creating the registry.", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:CarbonBasedTestListener.java

示例2: setUp

import org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService; //导入依赖的package包/类
public void setUp() throws RegistryException {
        super.setUp();
/*        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain("foo.com");
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(1);*/
        if (registry == null) {
            super.setUp();
            EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
            RegistryCoreServiceComponent component = new RegistryCoreServiceComponent() {
                {
                    setRealmService(ctx.getRealmService());
                }
            };
            component.registerBuiltInHandlers(embeddedRegistry);
            registry = embeddedRegistry.getGovernanceUserRegistry("admin", "admin");
        }
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:17,代码来源:MessageManagerImplTest.java

示例3: setUp

import org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService; //导入依赖的package包/类
public void setUp() throws RegistryException {
        // below SOP will be removed after the testing.
        System.out.println("ActivityManagerImplTest:setUp()");
        super.setUp();
/*        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain("foo.com");
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(1);*/
        if (registry == null) {
            super.setUp();
            EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
            RegistryCoreServiceComponent component = new RegistryCoreServiceComponent() {
                {
                    setRealmService(ctx.getRealmService());
                }
            };
            component.registerBuiltInHandlers(embeddedRegistry);
            registry = embeddedRegistry.getGovernanceUserRegistry("admin", "admin");
        }
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:19,代码来源:ActivityManagerImplTest.java

示例4: setUp

import org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService; //导入依赖的package包/类
public void setUp() throws RegistryException {
    super.setUp();
    if (registry == null) {
        EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
        registry = embeddedRegistry.getConfigSystemRegistry();
    }

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:9,代码来源:IndexingTest.java

示例5: setUp

import org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService; //导入依赖的package包/类
public void setUp() throws RegistryException {
        super.setUp();
/*        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain("foo.com");
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(1);*/
        ctx.addAspect(LIFECYCLE_NAME, new DefaultLifecycle(), MultitenantConstants.SUPER_TENANT_ID);
        EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
        new RegistryCoreServiceComponent().registerBuiltInHandlers(embeddedRegistry);
        registry = embeddedRegistry.getRegistry("admin", "admin");
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:10,代码来源:DefaultLifecycleTest.java

示例6: setUp

import org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService; //导入依赖的package包/类
public void setUp() throws RegistryException {
    if (System.getProperty("carbon.home") == null) {
        File file = new File("src/test/resources/carbon-home");
        if (file.exists()) {
            System.setProperty("carbon.home", file.getAbsolutePath());
        }
    }
    PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain("foo.com");
    PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(1);
    // The line below is responsible for initializing the cache.
    CarbonContext.getThreadLocalCarbonContext();

    String carbonHome = System.getProperty("carbon.home");
    String carbonXMLPath = carbonHome + File.separator + "repository"
            + File.separator + "conf" + File.separator + "carbon.xml";
    RegistryConfiguration regConfig = new RegistryConfiguration(carbonXMLPath);
    RegistryCoreServiceComponent.setRegistryConfig(regConfig);

    RealmService realmService = new InMemoryRealmService();
    RegistryDataHolder.getInstance().setRealmService(realmService);
    InputStream is = null;

    try {
        is = this.getClass().getClassLoader().getResourceAsStream("registry.xml");
        ctx = RegistryContext.getBaseInstance(is, realmService);
    } finally {
        if( is != null) {
            try {
                is.close();
            } catch (IOException ignore) {

            }
        }
    }

    ctx.setSetup(true);
    ctx.selectDBConfig("h2-db");

    EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
    new RegistryCoreServiceComponent().registerBuiltInHandlers(embeddedRegistry);
    registry = embeddedRegistry.getRegistry("admin", "admin");
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:43,代码来源:BaseTestCase.java

示例7: setUp

import org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    if (System.getProperty("carbon.home") == null) {
        File file = getResourcePath("carbon-home").toFile();
        if (file.exists()) {
            System.setProperty("carbon.home", file.getAbsolutePath());
        }
    }
    PrivilegedCarbonContext.startTenantFlow();
    PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(-1234, true);
    // The line below is responsible for initializing the cache.
    CarbonContext.getThreadLocalCarbonContext();

    String carbonHome = System.getProperty("carbon.home");
    String carbonXMLPath = carbonHome + File.separator + "repository"
            + File.separator + "conf" + File.separator + "carbon.xml";
    RegistryConfiguration regConfig = new RegistryConfiguration(carbonXMLPath);
    RegistryCoreServiceComponent.setRegistryConfig(regConfig);

    RealmService realmService = new InMemoryRealmService();
    RegistryDataHolder.getInstance().setRealmService(realmService);
    InputStream is = null;

    try {
        is = this.getClass().getClassLoader().getResourceAsStream("registry.xml");
        ctx = RegistryContext.getBaseInstance(is, realmService);
    } finally {
        if( is != null) {
            try {
                is.close();
            } catch (IOException ignore) {

            }
        }
    }

    ctx.setSetup(true);
    ctx.selectDBConfig("h2-db");

    EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
    new RegistryCoreServiceComponent().registerBuiltInHandlers(embeddedRegistry);
    registry = embeddedRegistry.getRegistry("admin", "admin");
    configRegistry = embeddedRegistry.getConfigUserRegistry("admin", "admin");
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:45,代码来源:BaseTestCase.java

示例8: setUp

import org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService; //导入依赖的package包/类
public void setUp() throws Exception {
    if (System.getProperty("carbon.home") == null) {
        File file = new File("src/test/resources/carbon-home");
        if (file.exists()) {
            System.setProperty("carbon.home", file.getAbsolutePath());
        }
    }
    PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID);
    PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
    // The line below is responsible for initializing the cache.
    CarbonContext.getThreadLocalCarbonContext();

    String carbonHome = System.getProperty("carbon.home");
    System.out.println("carbon home " + carbonHome);
    String carbonXMLPath = carbonHome + File.separator + "repository"
            + File.separator + "conf" + File.separator + "carbon.xml";
    RegistryConfiguration regConfig = new RegistryConfiguration(carbonXMLPath);
    RegistryCoreServiceComponent.setRegistryConfig(regConfig);

    RealmService realmService = new InMemoryRealmService();
    RegistryDataHolder.getInstance().setRealmService(realmService);
    InputStream is;

    try {
        is = this.getClass().getClassLoader().getResourceAsStream(
                "registry.xml");
    } catch (Exception e) {
        is = null;
    }
    ctx = RegistryContext.getBaseInstance(is, realmService);
    //RegistryConfigurationProcessor.populateRegistryConfig(is, ctx);
    ctx.setSetup(true);
    ctx.selectDBConfig("h2-db");
    ctx.addAspect("DefaultLifecycle", new DefaultLifecycle(), MultitenantConstants.SUPER_TENANT_ID);
    EmbeddedRegistryService embeddedRegistry = ctx.getEmbeddedRegistryService();
    new RegistryCoreServiceComponent().registerBuiltInHandlers(embeddedRegistry);
    registry = embeddedRegistry.getGovernanceUserRegistry("admin", "admin");

    ArtifactCache cache = ArtifactCacheFactory.createArtifactCache();
    ArtifactCacheManager.getCacheManager().addTenantArtifactCache(cache, MultitenantConstants.SUPER_TENANT_ID);
}
 
开发者ID:wso2,项目名称:carbon-governance,代码行数:42,代码来源:BaseTestCase.java


注:本文中的org.wso2.carbon.registry.core.jdbc.EmbeddedRegistryService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。