本文整理汇总了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;
}
示例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;
}
}