Java LdapServer.start方法代码示例

本文整理汇总了Java中org.apache.directory.server.ldap.LdapServer.start方法的典型用法代码示例。如果您正苦于以下问题:Java LdapServer.start方法的具体用法?Java LdapServer.start怎么用?Java LdapServer.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.directory.server.ldap.LdapServer的用法示例。


Java LdapServer.start方法代码示例

在下文中一共展示了LdapServer.start方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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();
} 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:LdapTestSuite.java

示例2: 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();
} 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:26,代码来源:LdapTestSuite.java

示例3: contextInitialized

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
/**
 * Startup ApacheDS embedded.
 *
 * @param sce ServletContext event
 */
@Override
public void contextInitialized(final ServletContextEvent sce) {
    File workDir = (File) sce.getServletContext().getAttribute(
            "javax.servlet.context.tempdir");
    workDir = new File(workDir, "server-work");
    if (!workDir.mkdirs()) {
        throw new RuntimeException("Could not create " + workDir.
                getAbsolutePath());
    }

    Entry result;
    try {
        initDirectoryService(sce.getServletContext(), workDir);

        server = new LdapServer();
        server.setTransports(new TcpTransport(Integer.valueOf(
                sce.getServletContext().
                getInitParameter("testds.port"))));
        server.setDirectoryService(service);

        server.start();

        // store directoryService in context to provide it to servlets etc.
        sce.getServletContext().setAttribute(DirectoryService.JNDI_KEY,
                service);

        result = service.getAdminSession().lookup(new DN("o=isp"));
    } catch (Exception e) {
        sce.getServletContext().log("Fatal error in context init", e);
        throw new RuntimeException(e);
    }

    if (result == null) {
        throw new RuntimeException("Base DN not found");
    } else {
        sce.getServletContext().log(
                "ApacheDS startup completed succesfully");
    }
} 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:45,代码来源:ApacheDSStartStopListener.java

示例4: startServer

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
/**
 * starts the LdapServer
 *
 * @throws Exception
 */
public void startServer() throws Exception {
	server = new LdapServer();
	int serverPort = 10389;
	server.setTransports(new TcpTransport(serverPort));
	server.setDirectoryService(service);

	server.start();
} 
开发者ID:OWASP,项目名称:Benchmark,代码行数:14,代码来源:LDAPServer.java

示例5: start

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的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,代码来源:EmbeddedLDAPServer.java

示例6: contextInitialized

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
/**
 * Startup ApacheDS embedded.
 *
 * @param sce ServletContext event
 */
@Override
public void contextInitialized(final ServletContextEvent sce) {
    File workDir = (File) sce.getServletContext().getAttribute("javax.servlet.context.tempdir");
    workDir = new File(workDir, "server-work");

    final boolean loadDefaultContent = !workDir.exists();

    if (loadDefaultContent && !workDir.mkdirs()) {
        throw new RuntimeException("Could not create " + workDir.getAbsolutePath());
    }

    Entry result;
    try {
        initDirectoryService(sce.getServletContext(), workDir, loadDefaultContent);

        server = new LdapServer();
        server.setTransports(new TcpTransport(Integer.parseInt(
                WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext()).
                getBean("testds.port", String.class))));
        server.setDirectoryService(service);

        server.start();

        // store directoryService in context to provide it to servlets etc.
        sce.getServletContext().setAttribute(DirectoryService.JNDI_KEY, service);

        result = service.getAdminSession().lookup(new Dn("o=isp"));
    } catch (Exception e) {
        LOG.error("Fatal error in context init", e);
        throw new RuntimeException(e);
    }

    if (result == null) {
        throw new RuntimeException("Base DN not found");
    } else {
        LOG.info("ApacheDS startup completed succesfully");
    }
} 
开发者ID:apache,项目名称:syncope,代码行数:44,代码来源:ApacheDSStartStopListener.java

示例7: start

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
public LdapService start() throws Exception {
    assertNotStarted();
    started = true;

    for (LdapServer current : servers) {
        current.start();
    }

    return new LdapService(directoryService, servers);
} 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:11,代码来源:LdapService.java

示例8: startServer

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
/**
 * starts the LdapServer
 *
 * @throws Exception
 */
public void startServer() throws Exception {
  server = new LdapServer();
  int serverPort = 10389;
  server.setTransports(new TcpTransport(serverPort));
  server.setDirectoryService(service);

  server.start();
} 
开发者ID:vert-x3,项目名称:vertx-auth,代码行数:14,代码来源:EmbeddedADS.java

示例9: newEmbeddedServer

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
public static EmbeddedLdapServer newEmbeddedServer(String defaultPartitionName, String defaultPartitionSuffix, int port)
        throws Exception{
    workingDirectory = new File(System.getProperty("java.io.tmpdir") + "/apacheds-test1");
    FileUtils.deleteDirectory(workingDirectory);

    DefaultDirectoryService directoryService = new DefaultDirectoryService();
    directoryService.setShutdownHookEnabled(true);
    directoryService.setAllowAnonymousAccess(true);

    directoryService.setWorkingDirectory(workingDirectory);
    directoryService.getChangeLog().setEnabled( false );

    JdbmPartition partition = new JdbmPartition();
    partition.setId(defaultPartitionName);
    partition.setSuffix(defaultPartitionSuffix);
    directoryService.addPartition(partition);

    directoryService.startup();

    // Inject the apache root entry if it does not already exist
    if ( !directoryService.getAdminSession().exists( partition.getSuffixDn() ) )
    {
        ServerEntry entry = directoryService.newEntry(new LdapDN(defaultPartitionSuffix));
        entry.add("objectClass", "top", "domain", "extensibleObject");
        entry.add("dc", defaultPartitionName);
        directoryService.getAdminSession().add( entry );
    }

    LdapServer ldapServer = new LdapServer();
    ldapServer.setDirectoryService(directoryService);

    TcpTransport ldapTransport = new TcpTransport(port);
    ldapServer.setTransports( ldapTransport );
    ldapServer.start();

    return new EmbeddedLdapServer(directoryService, ldapServer);
} 
开发者ID:spring-projects,项目名称:spring-ldap,代码行数:38,代码来源:EmbeddedLdapServer.java

示例10: startServer

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
/**
 * starts the LdapServer
 *
 * @throws Exception
 */
public void startServer() throws Exception {
  ldapService = new LdapServer();
  Properties properties = loadTestProperties();
  String port = properties.getProperty("ldap.server.port");
  ldapService.setTransports(new TcpTransport(Integer.parseInt(port)));
  ldapService.setDirectoryService(service);
  ldapService.start();
} 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:14,代码来源:LdapTestEnvironment.java

本文标签属性:

示例:示例英语

代码:代码转换器

java:java自行车

上一篇:Java BarcodeFactory.createCode128A方法代码示例
下一篇:C++ SOC_DOUBLE_TLV函数代码示例

为您推荐