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


Java LdapServer.setTransports方法代码示例

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


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

示例1: EmbeddedLdapServer

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
public EmbeddedLdapServer(
    File workingDir,
    String partitionDn,
    String partitionId,
    int port,
    boolean enableChangelog,
    boolean allowAnonymousAccess,
    long maxSizeLimit)
    throws Exception {
  requireNonNull(partitionDn, "Required non-null partition dn");
  requireNonNull(partitionId, "Required non-null partition id");
  this.workingDir = workingDir;
  this.baseDn = new DN(partitionDn);
  this.port = port > 0 ? port : PORT_SERVICE.acquire();
  this.url = "ldap://localhost:" + this.port;
  ldapServer = new LdapServer();
  ldapServer.setTransports(new TcpTransport(this.port));
  if (maxSizeLimit > 0) {
    ldapServer.setMaxSizeLimit(maxSizeLimit);
  }
  service =
      initDirectoryService(
          workingDir, partitionId, partitionDn, enableChangelog, allowAnonymousAccess);
  ldapServer.setDirectoryService(service);
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:26,代码来源:EmbeddedLdapServer.java

示例2: afterPropertiesSet

import org.apache.directory.server.ldap.LdapServer; //导入方法依赖的package包/类
public void afterPropertiesSet() throws Exception {

		if (this.enabledLdapOverSsl && this.keyStoreFile == null) {
			throw new IllegalArgumentException("When LdapOverSsl is enabled, the keyStoreFile property must be set.");
		}

		if (workingDir == null) {
			String apacheWorkDir = System.getProperty("apacheDSWorkDir");

			if (apacheWorkDir == null) {
				apacheWorkDir = createTempDirectory("apacheds-spring-security-");
			}

			setWorkingDirectory(new File(apacheWorkDir));
		}

		server = new LdapServer();

		// AbstractLdapIntegrationTests assume IPv4, so we specify the same here
		TcpTransport transport = new TcpTransport(port);

		if (enabledLdapOverSsl) {
			transport.setEnableSSL(true);
			server.setKeystoreFile(this.keyStoreFile.getAbsolutePath());
			server.setCertificatePassword(this.keyStorePassword);
		}

		server.setTransports(transport);
		server.setDirectoryService(service);
		start();
	}
 
开发者ID:spring-cloud,项目名称:spring-cloud-dataflow,代码行数:32,代码来源:ApacheDSContainerWithSecurity.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: 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

示例8: 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

示例9: 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


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