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


Java ServerEntry.add方法代码示例

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


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

示例1: addObjectClasses

import org.apache.directory.shared.ldap.entry.ServerEntry; //导入方法依赖的package包/类
private static void addObjectClasses(ServerEntry serverEntry, List<String> objectClasses)
        throws DirectoryServerException {

    for (String objectClass : objectClasses) {
        try {
            serverEntry.add("objectClass", objectClass);
        } catch (LdapException e) {
            throwDirectoryServerException("Could not add class to partition " +
                    serverEntry.getDn().getName(), e);
        }
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:13,代码来源:ApacheDirectoryPartitionManager.java

示例2: addPartitionAttributes

import org.apache.directory.shared.ldap.entry.ServerEntry; //导入方法依赖的package包/类
private void addPartitionAttributes(String partitionDN, List<String> objectClasses,
                                    String realm, String dc)
        throws DirectoryServerException {

    try {
        DN adminDN = new DN(partitionDN);
        ServerEntry serverEntry = this.directoryService.newEntry(adminDN);

        addObjectClasses(serverEntry, objectClasses);

        serverEntry.add("o", realm);

        if (dc == null) {
            logger.warn("Domain component not found for partition with DN - " + partitionDN +
                    ". Not setting domain component.");
        } else {
            serverEntry.add("dc", dc);
        }

        addAccessControlAttributes(serverEntry);

        this.directoryService.getAdminSession().add(serverEntry);

    } catch (Exception e) {

        String msg = "Could not add partition attributes for partition - " + partitionDN;
        throwDirectoryServerException(msg, e);
    }

}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:31,代码来源:ApacheDirectoryPartitionManager.java

示例3: initDirectoryService

import org.apache.directory.shared.ldap.entry.ServerEntry; //导入方法依赖的package包/类
/**
 * Initialize the server. It creates the partition, injects the context
 * entries for the created partitions, and loads an LDIF file (
 * {@link #ldifLoadFile}) for initial entries.
 *
 * @param workDir
 *          the directory to be used for storing the data
 * @throws Exception
 *           if there were some problems while initializing the system
 */
private void initDirectoryService(File workDir) throws Exception {
  // Initialize the LDAP service
  service = new DefaultDirectoryService();
  service.setWorkingDirectory(workDir);

  // first load the schema
  initSchemaPartition();

  // then the system partition
  // this is a MANDATORY partition
  Partition systemPartition = addPartition("system",
      ServerDNConstants.SYSTEM_DN);
  service.setSystemPartition(systemPartition);

  // create the partition for testing
  Partition testingPartition = addPartition("ldapTesting",
      "ou=ldapTesting,dc=pune,dc=gemstone,dc=com");

  // Disable the shutdown hook
  service.setShutdownHookEnabled(false);
  // Disable the ChangeLog system
  service.getChangeLog().setEnabled(false);
  service.setDenormalizeOpAttrsEnabled(true);

  // And start the service
  service.startup();

  // inject the entry for testing
  if (!service.getAdminSession().exists(testingPartition.getSuffixDn())) {
    DN dnTesting = new DN("ou=ldapTesting,dc=pune,dc=gemstone,dc=com");
    ServerEntry entryTesting = service.newEntry(dnTesting);
    entryTesting.add("objectClass", "top", "domain", "extensibleObject");
    entryTesting.add("dc", "pune");
    service.getAdminSession().add(entryTesting);
  }

  // load schema from LDIF
  if (ldifLoadFile != null) {
    LdifFileLoader ldifLoader = new LdifFileLoader(
        service.getAdminSession(), ldifLoadFile);
    int numLoaded = ldifLoader.execute();
    if (numLoaded <= 0) {
      throw new Exception(
          "Failed to load any entries from " + ldifLoadFile);
    } else {
      System.out.println(
          "LDAP loaded " + numLoaded + " entries from " + ldifLoadFile);
    }
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:61,代码来源:LdapTestServer.java

示例4: initDirectoryService

import org.apache.directory.shared.ldap.entry.ServerEntry; //导入方法依赖的package包/类
/**
 * Initialize the server. It creates the partition, adds the index, and
 * injects the context entries for the created partitions.
 *
 * @param workDir the directory to be used for storing the data
 * @throws Exception if there were some problems while initializing
 */
private void initDirectoryService(final ServletContext servletContext,
        final File workDir)
        throws Exception {

    // Initialize the LDAP service
    service = new DefaultDirectoryService();
    service.setWorkingDirectory(workDir);

    // first load the schema
    initSchemaPartition(servletContext);

    // then the system partition
    // this is a MANDATORY partition
    Partition systemPartition = addPartition("system",
            ServerDNConstants.SYSTEM_DN);
    service.setSystemPartition(systemPartition);

    // Disable the ChangeLog system
    service.getChangeLog().setEnabled(false);
    service.setDenormalizeOpAttrsEnabled(true);

    // Now we can create as many partitions as we need
    Partition ispPartition = addPartition("isp", "o=isp");
    addIndex(ispPartition, "objectClass", "ou", "uid");

    // And start the service
    service.startup();

    // Inject the foo root entry if it does not already exist
    try {
        service.getAdminSession().lookup(ispPartition.getSuffixDn());
    } catch (LdapException lnnfe) {
        DN dnIsp = new DN("o=isp");
        ServerEntry rootEntry = service.newEntry(dnIsp);
        rootEntry.add("objectClass", "top", "organization");
        rootEntry.add("o", "isp");
        service.getAdminSession().add(rootEntry);

        DN dnPeople = new DN("ou=People,o=isp");
        ServerEntry peopleEntry = service.newEntry(dnPeople);
        peopleEntry.add("objectClass", "top", "organizationalUnit");
        peopleEntry.add("ou", "People");
        service.getAdminSession().add(peopleEntry);
    }
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:53,代码来源:ApacheDSStartStopListener.java

示例5: addAccessControlAttributes

import org.apache.directory.shared.ldap.entry.ServerEntry; //导入方法依赖的package包/类
private void addAccessControlAttributes(ServerEntry serverEntry)
        throws LdapException {
    serverEntry.add("administrativeRole", "accessControlSpecificArea");
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:5,代码来源:ApacheDirectoryPartitionManager.java

示例6: initDirectoryService

import org.apache.directory.shared.ldap.entry.ServerEntry; //导入方法依赖的package包/类
/**
 * Initialize the server. It creates the partition, adds the index, and
 * injects the context entries for the created partitions.
 *
 * @param workDir the directory to be used for storing the data
 * @throws Exception if there were some problems while initializing the system
 */
private void initDirectoryService(File workDir) throws Exception {
  // Initialize the LDAP service
  service = new DefaultDirectoryService();
  service.setWorkingDirectory(workDir);

  // first load the schema
  initSchemaPartition();

  // then the system partition
  // this is a MANDATORY partition
  Partition systemPartition = addPartition("system", ServerDNConstants.SYSTEM_DN);
  service.setSystemPartition(systemPartition);

  // Disable the ChangeLog system
  service.getChangeLog().setEnabled(false);
  service.setDenormalizeOpAttrsEnabled(true);

  // Now we can create as many partitions as we need
  // Create some new partitions named 'foo', 'bar' and 'apache'.
  Partition fooPartition = addPartition("foo", "dc=foo,dc=com");

  // Index some attributes on the apache partition
  addIndex(fooPartition, "objectClass", "ou", "uid");

  // And start the service
  service.startup();

  DN dnFoo = new DN("dc=foo,dc=com");
  ServerEntry entryFoo = service.newEntry(dnFoo);
  entryFoo.add("objectClass", "top", "domain", "extensibleObject");
  entryFoo.add("dc", "foo");
  service.getAdminSession().add(entryFoo);

  DN usersDN=new DN("ou=users,dc=foo,dc=com");
  ServerEntry usersEntry=service.newEntry(usersDN);
  usersEntry.add("objectClass","organizationalUnit","top");
  usersEntry.add("ou","users");
  service.getAdminSession().add(usersEntry);

}
 
开发者ID:vert-x3,项目名称:vertx-auth,代码行数:48,代码来源:EmbeddedADS.java

示例7: addDefaultLdapGroup

import org.apache.directory.shared.ldap.entry.ServerEntry; //导入方法依赖的package包/类
/**
 * Creates a new group which matches default schema pattern, which is:
 *
 * <ul>
 *   <li>objectClass=groupOfNames
 *   <li>rdn - ou={name}
 *   <li>cn={name}
 *   <li>members.foreach(m -> member={m})
 * </ul>
 *
 * @param name a name of a group
 * @return newly created and added group entry
 * @throws Exception when any error occurs
 */
public ServerEntry addDefaultLdapGroup(String name, List<String> members) throws Exception {
  final ServerEntry group = newEntry("ou", name);
  group.put("objectClass", "top", "groupOfNames");
  group.put("cn", name);
  group.put("ou", name);
  for (String member : members) {
    group.add("member", member);
  }
  addEntry(group);
  return group;
}
 
开发者ID:codenvy,项目名称:codenvy,代码行数:26,代码来源:EmbeddedLdapServer.java


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