本文整理汇总了Java中org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex类的典型用法代码示例。如果您正苦于以下问题:Java JdbmIndex类的具体用法?Java JdbmIndex怎么用?Java JdbmIndex使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JdbmIndex类属于org.apache.directory.server.core.partition.impl.btree.jdbm包,在下文中一共展示了JdbmIndex类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startDirectoryService
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
private ApacheDS startDirectoryService() throws Exception {
Preconditions.checkState(!directoryService.isStarted());
directoryService.setShutdownHookEnabled(false);
File workDir = new File("target/ldap-work/" + realm);
if (workDir.exists()) {
FileUtils.deleteDirectory(workDir);
}
directoryService.setWorkingDirectory(workDir);
JdbmPartition partition = new JdbmPartition();
partition.setId("test");
partition.setSuffix(baseDn);
partition.setIndexedAttributes(Sets.<Index<?, ServerEntry>> newHashSet(
new JdbmIndex<String, ServerEntry>("ou"),
new JdbmIndex<String, ServerEntry>("uid"),
new JdbmIndex<String, ServerEntry>("dc"),
new JdbmIndex<String, ServerEntry>("objectClass")));
directoryService.setPartitions(Sets.newHashSet(partition));
directoryService.startup();
return this;
}
示例2: addPartition
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
/**
* Add a new partition to the server
*
* @param partitionId
* The partition Id
* @param partitionDn
* The partition DN
* @param attributes
* Attributes.
* @return The newly added partition
* @throws Exception
* If the partition can't be added
*/
private Partition addPartition(String partitionId, String partitionDn, String... attributes)
throws Exception {
// Create a new partition named 'foo'.
Partition partition = new JdbmPartition();
partition.setId(partitionId);
partition.setSuffix(partitionDn);
getDirectoryService().addPartition(partition);
HashSet<Index<?, ServerEntry>> indexedAttributes = new HashSet<Index<?, ServerEntry>>();
for (String attribute : attributes) {
indexedAttributes.add(new JdbmIndex<String, ServerEntry>(attribute));
}
((JdbmPartition) partition).setIndexedAttributes(indexedAttributes);
return partition;
}
示例3: addIndex
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
/**
* Add a new set of index on the given attributes.
*
* @param partition The partition on which we want to add index
* @param attrs The list of attributes to index
*/
private void addIndex(final Partition partition, final String... attrs) {
// Index some attributes on the apache partition
HashSet<Index<?, ServerEntry, Long>> indexedAttributes =
new HashSet<Index<?, ServerEntry, Long>>();
for (String attribute : attrs) {
indexedAttributes.add(
new JdbmIndex<String, ServerEntry>(attribute));
}
((JdbmPartition) partition).setIndexedAttributes(indexedAttributes);
}
示例4: addIndex
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
private void addIndex(Partition partition, String... attrs) {
Set indexedAttributes = new HashSet();
for (String attribute : attrs) {
indexedAttributes.add(new JdbmIndex<>(attribute, false));
}
((JdbmPartition) partition).setIndexedAttributes(indexedAttributes);
}
示例5: addIndex
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
/**
* Add a new set of index on the given attributes
*
* @param partition
* The partition on which we want to add index
* @param attrs
* The list of attributes to index
*/
private void addIndex(Partition partition, String... attrs) {
// Index some attributes on the apache partition
HashSet<Index<?, ServerEntry, Long>> indexedAttributes = new HashSet<Index<?, ServerEntry, Long>>();
for (String attribute : attrs) {
indexedAttributes.add(new JdbmIndex<String, ServerEntry>(attribute));
}
((JdbmPartition) partition).setIndexedAttributes(indexedAttributes);
}
示例6: addIndex
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
/**
* Add a new set of index on the given attributes.
*
* @param partition The partition on which we want to add index
* @param attrs The list of attributes to index
*/
private void addIndex(final Partition partition, final String... attrs) {
// Index some attributes on the apache partition
Set<Index<?, String>> indexedAttributes = new HashSet<>();
for (String attribute : attrs) {
indexedAttributes.add(new JdbmIndex<String>(attribute, false));
}
((JdbmPartition) partition).setIndexedAttributes(indexedAttributes);
}
示例7: addIndex
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
/**
* Add a new set of index on the given attributes
*
* @param partition The partition on which we want to add index
* @param attrs The list of attributes to index
*/
private void addIndex(Partition partition, String... attrs) {
// Index some attributes on the apache partition
HashSet<Index<?, ServerEntry, Long>> indexedAttributes = new HashSet<>();
for (String attribute : attrs) {
indexedAttributes.add(new JdbmIndex<String, ServerEntry>(attribute));
}
((JdbmPartition) partition).setIndexedAttributes(indexedAttributes);
}
示例8: addIndex
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
/**
* Add a new set of index on the given attributes
*
* @param partition The partition on which we want to add index
* @param attrs The list of attributes to index
*/
protected void addIndex(Partition partition, String... attrs) {
// Index some attributes on the apache partition
Set<Index<?, String>> indexedAttributes = new HashSet<Index<?, String>>();
for (String attribute : attrs) {
indexedAttributes.add(new JdbmIndex<String>(attribute, false));
}
((JdbmPartition) partition).setIndexedAttributes(indexedAttributes);
}
示例9: initDirectoryService
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
private void initDirectoryService() throws Exception {
ds = new DefaultDirectoryService();
ds.setInstanceLayout(new InstanceLayout(workDir));
CacheService cacheService = new CacheService();
ds.setCacheService(cacheService);
// first load the schema
InstanceLayout instanceLayout = ds.getInstanceLayout();
File schemaPartitionDirectory = new File(
instanceLayout.getPartitionsDirectory(), "schema");
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor(
instanceLayout.getPartitionsDirectory());
extractor.extractOrCopy();
SchemaLoader loader = new LdifSchemaLoader(schemaPartitionDirectory);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
schemaManager.loadAllEnabled();
ds.setSchemaManager(schemaManager);
// Init the LdifPartition with schema
LdifPartition schemaLdifPartition = new LdifPartition(schemaManager);
schemaLdifPartition.setPartitionPath(schemaPartitionDirectory.toURI());
// The schema partition
SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
schemaPartition.setWrappedPartition(schemaLdifPartition);
ds.setSchemaPartition(schemaPartition);
JdbmPartition systemPartition = new JdbmPartition(ds.getSchemaManager());
systemPartition.setId("system");
systemPartition.setPartitionPath(new File(
ds.getInstanceLayout().getPartitionsDirectory(),
systemPartition.getId()).toURI());
systemPartition.setSuffixDn(new Dn(ServerDNConstants.SYSTEM_DN));
systemPartition.setSchemaManager(ds.getSchemaManager());
ds.setSystemPartition(systemPartition);
ds.getChangeLog().setEnabled(false);
ds.setDenormalizeOpAttrsEnabled(true);
ds.addLast(new KeyDerivationInterceptor());
// create one partition
String orgName= conf.getProperty(ORG_NAME).toLowerCase(Locale.ENGLISH);
String orgDomain = conf.getProperty(ORG_DOMAIN).toLowerCase(Locale.ENGLISH);
JdbmPartition partition = new JdbmPartition(ds.getSchemaManager());
partition.setId(orgName);
partition.setPartitionPath(new File(
ds.getInstanceLayout().getPartitionsDirectory(), orgName).toURI());
partition.setSuffixDn(new Dn("dc=" + orgName + ",dc=" + orgDomain));
ds.addPartition(partition);
// indexes
Set<Index<?, ?, String>> indexedAttributes = new HashSet<Index<?, ?, String>>();
indexedAttributes.add(new JdbmIndex<String, Entry>("objectClass", false));
indexedAttributes.add(new JdbmIndex<String, Entry>("dc", false));
indexedAttributes.add(new JdbmIndex<String, Entry>("ou", false));
partition.setIndexedAttributes(indexedAttributes);
// And start the ds
ds.setInstanceId(conf.getProperty(INSTANCE));
ds.startup();
// context entry, after ds.startup()
Dn dn = new Dn("dc=" + orgName + ",dc=" + orgDomain);
Entry entry = ds.newEntry(dn);
entry.add("objectClass", "top", "domain");
entry.add("dc", orgName);
ds.getAdminSession().add(entry);
}
示例10: initDirectoryService
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
private void initDirectoryService() throws Exception {
ds = new DefaultDirectoryService();
ds.setInstanceLayout(new InstanceLayout(workDir));
CacheService cacheService = new CacheService();
ds.setCacheService(cacheService);
// first load the schema
InstanceLayout instanceLayout = ds.getInstanceLayout();
File schemaPartitionDirectory = new File(instanceLayout.getPartitionsDirectory(), "schema");
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor(instanceLayout.getPartitionsDirectory());
extractor.extractOrCopy();
SchemaLoader loader = new LdifSchemaLoader(schemaPartitionDirectory);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
schemaManager.loadAllEnabled();
ds.setSchemaManager(schemaManager);
// Init the LdifPartition with schema
LdifPartition schemaLdifPartition = new LdifPartition(schemaManager);
schemaLdifPartition.setPartitionPath(schemaPartitionDirectory.toURI());
// The schema partition
SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
schemaPartition.setWrappedPartition(schemaLdifPartition);
ds.setSchemaPartition(schemaPartition);
JdbmPartition systemPartition = new JdbmPartition(ds.getSchemaManager());
systemPartition.setId("system");
systemPartition.setPartitionPath(
new File(ds.getInstanceLayout().getPartitionsDirectory(), systemPartition.getId()).toURI());
systemPartition.setSuffixDn(new Dn(ServerDNConstants.SYSTEM_DN));
systemPartition.setSchemaManager(ds.getSchemaManager());
ds.setSystemPartition(systemPartition);
ds.getChangeLog().setEnabled(false);
ds.setDenormalizeOpAttrsEnabled(true);
ds.addLast(new KeyDerivationInterceptor());
// create one partition
String orgName = conf.getProperty(ORG_NAME).toLowerCase(Locale.ENGLISH);
String orgDomain = conf.getProperty(ORG_DOMAIN).toLowerCase(Locale.ENGLISH);
JdbmPartition partition = new JdbmPartition(ds.getSchemaManager());
partition.setId(orgName);
partition.setPartitionPath(new File(ds.getInstanceLayout().getPartitionsDirectory(), orgName).toURI());
partition.setSuffixDn(new Dn("dc=" + orgName + ",dc=" + orgDomain));
ds.addPartition(partition);
// indexes
Set<Index<?, ?, String>> indexedAttributes = new HashSet<Index<?, ?, String>>();
indexedAttributes.add(new JdbmIndex<String, Entry>("objectClass", false));
indexedAttributes.add(new JdbmIndex<String, Entry>("dc", false));
indexedAttributes.add(new JdbmIndex<String, Entry>("ou", false));
partition.setIndexedAttributes(indexedAttributes);
// And start the ds
ds.setInstanceId(conf.getProperty(INSTANCE));
ds.startup();
// context entry, after ds.startup()
Dn dn = new Dn("dc=" + orgName + ",dc=" + orgDomain);
Entry entry = ds.newEntry(dn);
entry.add("objectClass", "top", "domain");
entry.add("dc", orgName);
ds.getAdminSession().add(entry);
}
示例11: createNewPartition
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
private JdbmPartition createNewPartition(String partitionId, String partitionSuffix)
throws DirectoryServerException {
try {
JdbmPartition partition = new JdbmPartition();
String partitionDirectoryName = this.workingDirectory + File.separator + partitionId;
File partitionDirectory = new File(partitionDirectoryName);
partition.setId(partitionId);
partition.setSuffix(partitionSuffix);
partition.setPartitionDir(partitionDirectory);
Set<Index<?, ServerEntry, Long>> indexedAttrs =
new HashSet<Index<?, ServerEntry, Long>>();
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("1.3.6.1.4.1.18060.0.4.1.2.1"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("1.3.6.1.4.1.18060.0.4.1.2.2"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("1.3.6.1.4.1.18060.0.4.1.2.3"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("1.3.6.1.4.1.18060.0.4.1.2.4"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("1.3.6.1.4.1.18060.0.4.1.2.5"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("1.3.6.1.4.1.18060.0.4.1.2.6"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("1.3.6.1.4.1.18060.0.4.1.2.7"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("ou"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("dc"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("objectClass"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("cn"));
indexedAttrs.add(new JdbmIndex<String, ServerEntry>("uid"));
partition.setIndexedAttributes(indexedAttrs);
String message = MessageFormat.format(
"Partition created with following attributes, partition id - {0}, Partition " +
"domain - {1}, Partition working directory {2}", partitionId,
partitionSuffix, partitionDirectoryName);
if (logger.isDebugEnabled()) {
logger.debug(message);
}
return partition;
} catch (LdapInvalidDnException e) {
String msg = "Could not add a new partition with partition id " + partitionId +
" and suffix " + partitionSuffix;
logger.error(msg, e);
throw new DirectoryServerException(msg, e);
}
}
示例12: initDirectoryService
import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex; //导入依赖的package包/类
private void initDirectoryService() throws Exception {
ds = new DefaultDirectoryService();
ds.setInstanceLayout(new InstanceLayout(workDir));
CacheService cacheService = new CacheService();
ds.setCacheService(cacheService);
// first load the schema
InstanceLayout instanceLayout = ds.getInstanceLayout();
File schemaPartitionDirectory = new File(
instanceLayout.getPartitionsDirectory(), "schema");
SchemaLdifExtractor extractor = new DefaultSchemaLdifExtractor(
instanceLayout.getPartitionsDirectory());
extractor.extractOrCopy();
SchemaLoader loader = new LdifSchemaLoader(schemaPartitionDirectory);
SchemaManager schemaManager = new DefaultSchemaManager(loader);
schemaManager.loadAllEnabled();
ds.setSchemaManager(schemaManager);
// Init the LdifPartition with schema
LdifPartition schemaLdifPartition = new LdifPartition(schemaManager);
schemaLdifPartition.setPartitionPath(schemaPartitionDirectory.toURI());
// The schema partition
SchemaPartition schemaPartition = new SchemaPartition(schemaManager);
schemaPartition.setWrappedPartition(schemaLdifPartition);
ds.setSchemaPartition(schemaPartition);
JdbmPartition systemPartition = new JdbmPartition(ds.getSchemaManager());
systemPartition.setId("system");
systemPartition.setPartitionPath(new File(
ds.getInstanceLayout().getPartitionsDirectory(),
systemPartition.getId()).toURI());
systemPartition.setSuffixDn(new Dn(ServerDNConstants.SYSTEM_DN));
systemPartition.setSchemaManager(ds.getSchemaManager());
ds.setSystemPartition(systemPartition);
ds.getChangeLog().setEnabled(false);
ds.setDenormalizeOpAttrsEnabled(true);
ds.addLast(new KeyDerivationInterceptor());
// create one partition
String orgName= conf.getProperty(ORG_NAME).toLowerCase();
String orgDomain = conf.getProperty(ORG_DOMAIN).toLowerCase();
JdbmPartition partition = new JdbmPartition(ds.getSchemaManager());
partition.setId(orgName);
partition.setPartitionPath(new File(
ds.getInstanceLayout().getPartitionsDirectory(), orgName).toURI());
partition.setSuffixDn(new Dn("dc=" + orgName + ",dc=" + orgDomain));
ds.addPartition(partition);
// indexes
Set<Index<?, ?, String>> indexedAttributes = new HashSet<Index<?, ?, String>>();
indexedAttributes.add(new JdbmIndex<String, Entry>("objectClass", false));
indexedAttributes.add(new JdbmIndex<String, Entry>("dc", false));
indexedAttributes.add(new JdbmIndex<String, Entry>("ou", false));
partition.setIndexedAttributes(indexedAttributes);
// And start the ds
ds.setInstanceId(conf.getProperty(INSTANCE));
ds.startup();
// context entry, after ds.startup()
Dn dn = new Dn("dc=" + orgName + ",dc=" + orgDomain);
Entry entry = ds.newEntry(dn);
entry.add("objectClass", "top", "domain");
entry.add("dc", orgName);
ds.getAdminSession().add(entry);
}