java servicefactory_Java DirectoryServiceFactory.getDirectoryService方法代碼示例

本文整理匯總了Java中org.apache.directory.server.core.factory.DirectoryServiceFactory.getDirectoryService方法的典型用法代碼示例。如果您正苦於以下問題:Java DirectoryServiceFactory.getDirectoryService方法的具體用法?Java DirectoryServiceFactory.getDirectoryService怎麽用?Java DirectoryServiceFactory.getDirectoryService使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.directory.server.core.factory.DirectoryServiceFactory的用法示例。

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

示例1: startMasterLdapServer

​點讚 3

import org.apache.directory.server.core.factory.DirectoryServiceFactory; //導入方法依賴的package包/類

private static void startMasterLdapServer() throws Exception {

masterWorkingDir = createWorkingDir(masterWorkingDir, "master");

DirectoryServiceFactory dsf = new InMemoryDirectoryServiceFactory();

dsf.init(MASTER_DIRECTORY_NAME);

masterDirectoryService = dsf.getDirectoryService();

masterDirectoryService.getChangeLog().setEnabled(false);

SchemaManager schemaManager = masterDirectoryService.getSchemaManager();

createPartition(dsf, schemaManager, "simple", "dc=simple,dc=wildfly,dc=org", masterDirectoryService, masterWorkingDir);

createPartition(dsf, schemaManager, "group-to-principal", "dc=group-to-principal,dc=wildfly,dc=org", masterDirectoryService, masterWorkingDir);

createPartition(dsf, schemaManager, "principal-to-group", "dc=principal-to-group,dc=wildfly,dc=org", masterDirectoryService, masterWorkingDir);

CoreSession adminSession = masterDirectoryService.getAdminSession();

processLdif(schemaManager, adminSession, "memberOf-schema.ldif");

processLdif(schemaManager, adminSession, "simple-partition.ldif");

processLdif(schemaManager, adminSession, "group-to-principal.ldif");

processLdif(schemaManager, adminSession, "principal-to-group.ldif");

masterLdapServer = new LdapServer();

masterLdapServer.setServiceName("DefaultLDAP");

Transport ldap = new TcpTransport( "0.0.0.0", MASTER_LDAP_PORT, 3, 5 );

masterLdapServer.addTransports(ldap);

masterLdapServer.setDirectoryService(masterDirectoryService);

masterLdapServer.start();

}

開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:26,

示例2: startSlaveLdapServer

​點讚 3

import org.apache.directory.server.core.factory.DirectoryServiceFactory; //導入方法依賴的package包/類

private static void startSlaveLdapServer() throws Exception {

slaveWorkingDir = createWorkingDir(slaveWorkingDir, "slave");

DirectoryServiceFactory dsf = new InMemoryDirectoryServiceFactory();

dsf.init(SLAVE_DIRECTORY_NAME);

slaveDirectoryService = dsf.getDirectoryService();

slaveDirectoryService.getChangeLog().setEnabled(false);

SchemaManager schemaManager = slaveDirectoryService.getSchemaManager();

createPartition(dsf, schemaManager, "simple", "dc=simple,dc=wildfly,dc=org", slaveDirectoryService, slaveWorkingDir);

createPartition(dsf, schemaManager, "group-to-principal", "dc=group-to-principal,dc=wildfly,dc=org", slaveDirectoryService, slaveWorkingDir);

createPartition(dsf, schemaManager, "principal-to-group", "dc=principal-to-group,dc=wildfly,dc=org", slaveDirectoryService, slaveWorkingDir);

CoreSession adminSession = slaveDirectoryService.getAdminSession();

processLdif(schemaManager, adminSession, "memberOf-schema.ldif");

processLdif(schemaManager, adminSession, "simple-partition-slave.ldif");

processLdif(schemaManager, adminSession, "group-to-principal-slave.ldif");

processLdif(schemaManager, adminSession, "principal-to-group-slave.ldif");

slaveLdapServer = new LdapServer();

slaveLdapServer.setServiceName("DefaultLDAP");

Transport ldap = new TcpTransport( "0.0.0.0", SLAVE_LDAP_PORT, 3, 5 );

slaveLdapServer.addTransports(ldap);

slaveLdapServer.setDirectoryService(slaveDirectoryService);

slaveLdapServer.start();

}

開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:26,

示例3: start

​點讚 2

import org.apache.directory.server.core.factory.DirectoryServiceFactory; //導入方法依賴的package包/類

public void start() throws Exception {

DirectoryServiceFactory factory = new DefaultDirectoryServiceFactory();

factory.init("server");

service = factory.getDirectoryService();

service.addPartition(createPartition("default", "cn=test"));

service.addPartition(createPartition("domain", "dc=example,dc=com"));

server = new LdapServer();

server.setDirectoryService(service);

server.setTransports(new TcpTransport(PORT));

server.start();

}

開發者ID:ctco,項目名稱:cukes,代碼行數:13,

示例4: initializeDefaultDirectoryService

​點讚 2

import org.apache.directory.server.core.factory.DirectoryServiceFactory; //導入方法依賴的package包/類

protected void initializeDefaultDirectoryService()

throws DirectoryServerException {

try {

DirectoryServiceFactory factory = CarbonDirectoryServiceFactory.DEFAULT;

this.service = factory.getDirectoryService();

configureDirectoryService();

factory.init(this.ldapConfigurations.getInstanceId());

} catch (Exception e) {

throw new DirectoryServerException("Can not start the Default apacheds service ", e);

}

}

開發者ID:wso2-attic,項目名稱:carbon-identity,代碼行數:16,

示例5: setupDirectoryService

​點讚 2

import org.apache.directory.server.core.factory.DirectoryServiceFactory; //導入方法依賴的package包/類

public static SetupResult setupDirectoryService(Class> testClass) throws Exception {

// Define a default class DS then

DirectoryServiceFactory dsf = DefaultDirectoryServiceFactory.class.newInstance();

SetupResult result = new SetupResult();

result.directoryService = dsf.getDirectoryService();

result.directoryService.getChangeLog().setEnabled(true);

dsf.init("default" + UUID.randomUUID().toString());

// Apply the class LDIFs

ApplyLdifFiles applyLdifFiles = testClass.getAnnotation(ApplyLdifFiles.class);

if (applyLdifFiles != null) {

LOG.debug("Applying {} to {}", applyLdifFiles.value(), testClass.getName());

DSAnnotationProcessor.injectLdifFiles(applyLdifFiles.clazz(), result.directoryService, applyLdifFiles.value());

}

// check if it has a LdapServerBuilder then use the DS created above

CreateLdapServer ldapServerAnnotation = testClass.getAnnotation(CreateLdapServer.class);

if (ldapServerAnnotation != null) {

result.ldapServer = ServerAnnotationProcessor.instantiateLdapServer(ldapServerAnnotation, result.directoryService);

result.ldapServer.setDirectoryService(result.directoryService);

result.ldapServer.start();

}

// print out information which partition factory we use

DirectoryServiceFactory dsFactory = DefaultDirectoryServiceFactory.class.newInstance();

PartitionFactory partitionFactory = dsFactory.getPartitionFactory();

LOG.debug("Using partition factory {}", partitionFactory.getClass().getSimpleName());

return result;

}

開發者ID:wildfly-extras,項目名稱:wildfly-camel,代碼行數:34,

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值