本文整理汇总了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);
}
}
示例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");
}
}
示例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");
}
}
示例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();
}
}
示例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");
}
示例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");
}
示例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");
}
示例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);
}