org.apache.directory.server.core.api.partition.Partition类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(262)

本文整理了Java中org.apache.directory.server.core.api.partition.Partition类的一些代码示例,展示了Partition类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partition类的具体详情如下:
包路径:org.apache.directory.server.core.api.partition.Partition
类名称:Partition

Partition介绍

[英]Interface for entry stores containing a part of the DIB (Directory Information Base). Partitions are associated with a specific suffix, and all entries contained in the them have the same Dn suffix in common.
[中]包含DIB(目录信息库)一部分的条目存储的接口。分区与特定的后缀相关联,分区中包含的所有条目都有相同的Dn后缀。

代码示例

代码示例来源:origin: org.apache.directory.server/apacheds-core-shared

partition.saveContextCsn( partition.beginReadTransaction() );
partition.sync();

代码示例来源:origin: org.apache.directory.server/apacheds-core-shared

String key = partition.getSuffixDn().getNormName();
if ( !partition.isInitialized() )
  partition.setCacheService( directoryService.getCacheService() );
  partition.initialize();
  Dn partitionSuffix = partition.getSuffixDn();
    throw new LdapOtherException( I18n.err( I18n.ERR_267, partition.getId() ) );
  partitionLookupTree.add( partition.getSuffixDn(), partition );

代码示例来源:origin: org.apache.directory.server/apacheds-core-api

/**
 * {@inheritDoc}
 */
@Override
protected void doInit() throws LdapException
{
  if ( !initialized )
  {
    // -----------------------------------------------------------------------
    // Load apachemeta schema from within the ldap-schema Jar with all the
    // schema it depends on.  This is a minimal mandatory set of schemas.
    // -----------------------------------------------------------------------
    wrapped.setId( SCHEMA_ID );
    wrapped.setSuffixDn( schemaDN );
    wrapped.setSchemaManager( schemaManager );
    try
    {
      wrapped.initialize();
      synchronizer = new RegistrySynchronizerAdaptor( schemaManager );
    }
    catch ( Exception e )
    {
      LOG.error( I18n.err( I18n.ERR_90 ), e );
      throw new RuntimeException( e );
    }
    schemaModificationDN = new Dn( schemaManager, SchemaConstants.SCHEMA_MODIFICATIONS_DN );
  }
}

代码示例来源:origin: ctco/cukes

private Partition createPartition(String id, String suffix) throws LdapInvalidDnException {
  Partition partition = new AvlPartition(service.getSchemaManager());
  partition.setId(id);
  partition.setSuffixDn(new Dn(suffix));
  return partition;
}

代码示例来源:origin: org.apache.directory.server/apacheds-service

/**
 * Try to repair the partitions. Precondition is that this service was started before.
 *
 * @param instanceLayout the on disk location's layout of the intance to be repaired
 * @throws Exception If the repair failed
 */
public void repair( InstanceLayout instanceLayout ) throws Exception
{
  File partitionsDir = instanceLayout.getPartitionsDirectory();
  System.out.println( "Repairing partition dir " + partitionsDir.getAbsolutePath() );
  Set<? extends Partition> partitions = getDirectoryService().getPartitions();
  // Iterate on the partitions to repair them
  for ( Partition partition : partitions )
  {
    try
    {
      partition.repair();
    }
    catch ( Exception e )
    {
      System.out.println( "Failed to repair the partition " + partition.getId() );
      e.printStackTrace();
      return;
    }
  }
}

代码示例来源:origin: org.apache.directory.server/apacheds-core-shared

String partitionSuffix = partition.getSuffixDn().getNormName();
  partitionLookupTree.remove( partition.getSuffixDn() );
  partition.destroy( partition.beginReadTransaction() );

代码示例来源:origin: org.apache.directory.server/apacheds-interceptors-admin

searchOperationContext.setPartition( partition );
try ( PartitionTxn partitionTxn = partition.beginReadTransaction() )

代码示例来源:origin: org.apache.directory.server/apacheds-core-shared

Dn contextDn = partition.getSuffixDn();
PartitionTxn partitionTxn = partition.beginReadTransaction();
HasEntryOperationContext hasEntryContext = new HasEntryOperationContext(
  searchContext.getSession(), contextDn );
if ( partition.hasEntry( hasEntryContext ) )
  cursors.add( partition.search( searchContext ) );
PartitionTxn partitionTxn = partition.beginReadTransaction();
Dn contextDn = partition.getSuffixDn();
HasEntryOperationContext hasEntryContext = new HasEntryOperationContext(
  searchContext.getSession(), contextDn );
searchContext.setTransaction( partitionTxn );
if ( partition.hasEntry( hasEntryContext ) )
  EntryFilteringCursor cursor = partition.search( searchContext );

代码示例来源:origin: org.apache.directory.server/apacheds-interceptors-number

try ( PartitionTxn partitionTxn = systemPartition.beginReadTransaction() )
  entry = systemPartition.lookup( lookupContext );
    partitionTxn = systemPartition.beginWriteTransaction();
    addContext.setTransaction( partitionTxn );
    systemPartition.add( addContext );
    partitionTxn.commit();

代码示例来源:origin: org.apache.knox/gateway-test-ldap

public void addPartition( Partition partition ) throws Exception
{
 partition.setSchemaManager( schemaManager );
 try
 {
  // can be null when called before starting up
  if ( partitionNexus != null )
  {
   partitionNexus.addContextPartition( partition );
  }
 }
 catch ( LdapException le )
 {
  // We've got an exception, we cannot add the partition to the partitions
  throw le;
 }
 // Now, add the partition to the set of managed partitions
 partitions.add( partition );
}

代码示例来源:origin: org.apache.directory.server/apacheds-service

Cursor<Entry> cursor = session.search( partition.getSuffixDn(), SearchScope.SUBTREE, filter,
  AliasDerefMode.NEVER_DEREF_ALIASES, MANDATORY_ENTRY_ATOP_AT );
cursor.beforeFirst();
    modifyContext.setDn( entry.getDn() );
    modifyContext.setModItems( mods );
    partition.modify( modifyContext );

代码示例来源:origin: org.apache.directory.server/apacheds-core-shared

/**
 * {@inheritDoc}
 */
@Override
public Dn getSuffixDn( Dn dn ) throws LdapException
{
  Partition partition = getPartition( dn );
  return partition.getSuffixDn();
}

代码示例来源:origin: org.apache.knox/gateway-test-ldap

LookupOperationContext loc = new LookupOperationContext( getAdminSession(), systemPartition.getSuffixDn(),
  SchemaConstants.ALL_ATTRIBUTES_ARRAY );
Entry entry = systemPartition.lookup( loc );

代码示例来源:origin: org.apache.knox/gateway-test-ldap

schemaPartition.initialize();
partitions.add( schemaPartition );
systemPartition.setCacheService( cacheService );
systemPartition.getSuffixDn().apply( schemaManager );
    .getSuffixDn().getName();
  partitionNexus.getRootDse( null ).add( SchemaConstants.CHANGELOG_CONTEXT_AT, clSuffix );

代码示例来源:origin: org.apache.directory.server/apacheds-core-api

/**
 * {@inheritDoc}
 */
public void modify( ModifyOperationContext modifyContext ) throws LdapException
{
  Entry entry = modifyContext.getEntry();
  if ( entry == null )
  {
    LookupOperationContext lookupCtx = new LookupOperationContext( modifyContext.getSession(),
      modifyContext.getDn() );
    lookupCtx.setPartition( this );
    lookupCtx.setTransaction( modifyContext.getTransaction() );
    entry = wrapped.lookup( lookupCtx );
    modifyContext.setEntry( entry );
  }
  Entry targetEntry = SchemaUtils.getTargetEntry( modifyContext.getModItems(), entry );
  boolean cascade = modifyContext.hasRequestControl( Cascade.OID );
  boolean hasModification = synchronizer.modify( modifyContext, targetEntry, cascade );
  if ( hasModification )
  {
    wrapped.modify( modifyContext );
  }
  if ( !modifyContext.getDn().equals( schemaModificationDN ) )
  {
    updateSchemaModificationAttributes( modifyContext );
  }
}

代码示例来源:origin: keeps/roda

if (!session.exists(rodaPartition.getSuffixDn())) {
 rodaPartition.repair();

代码示例来源:origin: org.apache.directory.server/apacheds-protocol-ldap

String contextCsn;
try ( PartitionTxn partitionTxn = partition.beginReadTransaction() )
  contextCsn = partition.getContextCsn( partitionTxn );
try ( PartitionTxn partitionTxn = partition.beginReadTransaction() )

代码示例来源:origin: org.apache.knox/gateway-test-ldap

private void initializeSystemPartition() throws Exception
{
 Partition system = getSystemPartition();
 // Add root context entry for system partition
 Dn systemSuffixDn = getDnFactory().create( ServerDNConstants.SYSTEM_DN );
 CoreSession adminSession = getAdminSession();
 if ( !system.hasEntry( new HasEntryOperationContext( adminSession, systemSuffixDn ) ) )
 {
  Entry systemEntry = new DefaultEntry( schemaManager, systemSuffixDn );
  // Add the ObjectClasses
  systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC,
    SchemaConstants.ORGANIZATIONAL_UNIT_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );
  // Add some operational attributes
  systemEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN );
  systemEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
  systemEntry.add( SchemaConstants.ENTRY_CSN_AT, getCSN().toString() );
  systemEntry.add( SchemaConstants.ENTRY_UUID_AT, UUID.randomUUID().toString() );
  systemEntry.put( DnUtils.getRdnAttributeType( ServerDNConstants.SYSTEM_DN ), DnUtils
    .getRdnValue( ServerDNConstants.SYSTEM_DN ) );
  AddOperationContext addOperationContext = new AddOperationContext( adminSession, systemEntry );
  system.add( addOperationContext );
 }
}

代码示例来源:origin: stackoverflow.com

File workingDirectory = ...;

Partition partition = new JdbmPartition();
partition.setId(...);
partition.setSuffix(...);

DirectoryService directoryService = new DefaultDirectoryService();
directoryService.setWorkingDirectory(workingDirectory);
directoryService.addPartition(partition);

LdapService ldapService = new LdapService();
ldapService.setSocketAcceptor(new SocketAcceptor(null));
ldapService.setIpPort(...);
ldapService.setDirectoryService(directoryService);

directoryService.startup();
ldapService.start();

代码示例来源:origin: org.apache.directory.server/apacheds-core-api

/**
 * {@inheritDoc}
 */
public Entry lookup( LookupOperationContext lookupContext ) throws LdapException
{
  return wrapped.lookup( lookupContext );
}

相关文章