本文整理汇总了Java中org.apache.directory.server.ldap.LdapServer.setServiceName方法的典型用法代码示例。如果您正苦于以下问题:Java LdapServer.setServiceName方法的具体用法?Java LdapServer.setServiceName怎么用?Java LdapServer.setServiceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.server.ldap.LdapServer
的用法示例。
在下文中一共展示了LdapServer.setServiceName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTcpServer
import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
/**
* Adds a TCP server to the directory service.
*
* Note: The TCP server is not started until start() is called on this Builder.
*
* @param serviceName - The name of this server.
* @param hostName - The host name to listen on.
* @param port - The port to listen on.
* @return This Builder for subsequent changes.
*/
public Builder addTcpServer(final String serviceName, final String hostName, final int port, final String keyStore, final String keyStorePassword) throws URISyntaxException {
assertNotStarted();
if (directoryService == null) {
throw new IllegalStateException("The Directory service has not been created.");
}
LdapServer server = new LdapServer();
server.setServiceName(serviceName);
Transport ldaps = new TcpTransport( hostName, port, 3, 5 );
ldaps.enableSSL(true);
server.addTransports(ldaps);
server.setKeystoreFile(getClass().getResource(keyStore).getFile());
server.setCertificatePassword(keyStorePassword);
server.setDirectoryService(directoryService);
servers.add(server);
return this;
}
示例2: startMasterLdapServer
import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的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();
}
示例3: startSlaveLdapServer
import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的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();
}