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


Java Schema.getSchema方法代码示例

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


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

示例1: getSchemasInArray

import com.unboundid.ldap.sdk.schema.Schema; //导入方法依赖的package包/类
private Schema[] getSchemasInArray() throws LDAPSDKException, IOException {
    Schema[] schemaArray;
    int i = 0;

    if (_includeStandardSchema) {
        schemaArray = new Schema[_schemas.size() + 1];
        schemaArray[i++] = Schema.getDefaultStandardSchema();
    } else {
        schemaArray = new Schema[_schemas.size()];
    }

    for (SchemaFileSupplier schemaFileSupplier : _schemas) {
        File schemaFile = schemaFileSupplier.getFile();
        try {
            Schema schema = Schema.getSchema(schemaFile);
            schemaArray[i++] = schema;
            if (schemaFileSupplier.isBackedByTempFile()) {
                schemaFile.deleteOnExit();
            }
        } catch (LDIFException e) {
            throw new RuntimeException("Could not load schema file: " + schemaFile.getAbsolutePath(), e);
        }
    }

    return schemaArray;
}
 
开发者ID:zagyi,项目名称:adsync4j,代码行数:27,代码来源:EmbeddedUnboundIDLdapServer.java

示例2: configureAndStartServer

import com.unboundid.ldap.sdk.schema.Schema; //导入方法依赖的package包/类
/**
 * Configures and starts the local LDAP server.  This method is invoked by start().
 *
 * @throws Exception
 */
protected synchronized void configureAndStartServer() throws Exception {
    LOG.info(">>>LdapServerImpl.configureServer()");

    Collection<InMemoryListenerConfig> listenerConfigs = getInMemoryListenerConfigs();

    Schema schema = null;
    if (configuration.getSchema() == null || StringUtils.isEmpty(configuration.getSchema().getName())) {
        schema = Schema.getDefaultStandardSchema();
    } else {
        final String schemaName = configuration.getSchema().getName();
        URL schemaUrl = this.getClass().getClassLoader().getResource(schemaName);
        File schemaFile = new File(schemaUrl.toURI());
        schema = Schema.getSchema(schemaFile);
    }

    final String rootObjectDN = configuration.getRoot().getObjectDn();
    InMemoryDirectoryServerConfig config = new InMemoryDirectoryServerConfig(new DN(rootObjectDN));
    //LOG.debug(System.getProperty("java.class.path"));

    config.setSchema(schema);  //schema can be set on the rootDN too, per javadoc.
    config.setListenerConfigs(listenerConfigs);

    LOG.info(config.getSchema().toString());

    /* Add handlers for debug and acccess log events.  These classes can be extended or dependency injected in a future version for more robust behavior. */
    config.setLDAPDebugLogHandler(new LDAPDebugLogHandler());
    config.setAccessLogHandler(new AccessLogHandler());
    config.addAdditionalBindCredentials(configuration.getBindDn(), configuration.getPassword());

    server = new InMemoryDirectoryServer(config);

    try {
        /* Clear entries from server. */
        server.clear();
        server.startListening();

        loadRootEntry();
        loadEntries();
        loadLdifFiles();
        resetPersonPasswords();

        LOG.info("   Total entry count: {}", server.countEntries());
        LOG.info("<<<LdapServerImpl.configureServer()");
    } catch (LDAPException ldape) {
        if (ldape.getMessage().contains("java.net.BindException")) {
            throw new BindException(ldape.getMessage());
        }
        throw ldape;
    }

}
 
开发者ID:inbloom,项目名称:ldap-in-memory,代码行数:57,代码来源:LdapServerImpl.java


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