Tabnine Logo
RenameOperationContext
Code IndexAdd Tabnine to your IDE (free)

How to use
RenameOperationContext
in
org.apache.directory.server.core.api.interceptor.context

Best Java code snippets using org.apache.directory.server.core.api.interceptor.context.RenameOperationContext (Showing top 18 results out of 315)

origin: org.apache.directory.server/apacheds-interceptors-changelog

/**
 * {@inheritDoc}
 */
@Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
  Entry serverEntry = null;
  if ( renameContext.getEntry() != null )
  {
    serverEntry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getOriginalEntry();
  }
  next( renameContext );
  // After this point, the entry has been modified. The cloned entry contains
  // the modified entry, the originalEntry has changed
  if ( !changeLog.isEnabled() )
  {
    return;
  }
  LdifEntry forward = new LdifEntry();
  forward.setChangeType( ChangeType.ModRdn );
  forward.setDn( renameContext.getDn() );
  forward.setNewRdn( renameContext.getNewRdn().getName() );
  forward.setDeleteOldRdn( renameContext.getDeleteOldRdn() );
  List<LdifEntry> reverses = LdifRevertor.reverseRename(
    serverEntry, renameContext.getNewRdn(), renameContext.getDeleteOldRdn() );
  renameContext.setChangeLogEvent( changeLog.log( getPrincipal( renameContext ), forward, reverses ) );
}
origin: org.apache.directory.server/apacheds-core-shared

/**
 * {@inheritDoc}
 */
@Override
public void rename( ModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException
{
  RenameOperationContext renameContext = new RenameOperationContext( this, modifyDnRequest );
  renameContext.setLogChange( log );
  OperationManager operationManager = directoryService.getOperationManager();
  try
  {
    operationManager.rename( renameContext );
  }
  catch ( LdapException e )
  {
    modifyDnRequest.getResultResponse().addAllControls( renameContext.getResponseControls() );
    throw e;
  }
  modifyDnRequest.getResultResponse().addAllControls( renameContext.getResponseControls() );
}
origin: org.apache.directory.server/apacheds-ldif-partition

/**
 * {@inheritDoc}
 */
public void rename( RenameOperationContext renameContext ) throws LdapException
{
  PartitionTxn partitionTxn = renameContext.getTransaction(); 
  Dn oldDn = renameContext.getDn();
  String entryId = getEntryId( partitionTxn, oldDn );
  // Create the new entry
  super.rename( renameContext );
  // Get the modified entry and store it in the context for post usage
  Dn newDn = oldDn.getParent().add( renameContext.getNewRdn() );
  Entry modifiedEntry = fetch( renameContext.getTransaction(), entryId, newDn );
  renameContext.setModifiedEntry( modifiedEntry );
  // Now move the potential children for the old entry
  // and remove the old entry
  try
  {
    entryMoved( partitionTxn, oldDn, modifiedEntry, entryId );
  }
  catch ( Exception e )
  {
    throw new LdapOperationErrorException( e.getMessage(), e );
  }
}
origin: org.apache.directory.server/apacheds-core-shared

/**
 * {@inheritDoc}
 */
@Override
public void rename( Dn dn, Rdn newRdn, boolean deleteOldRdn, LogChange log ) throws LdapException
{
  RenameOperationContext renameContext = new RenameOperationContext( this, dn, newRdn, deleteOldRdn );
  renameContext.setLogChange( log );
  OperationManager operationManager = directoryService.getOperationManager();
  operationManager.rename( renameContext );
}
origin: org.apache.directory.server/apacheds-interceptors-subtree

public void rename( RenameOperationContext renameContext ) throws LdapException
  Dn oldDn = renameContext.getDn();
  Entry entry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getClonedEntry();
    Dn newName = oldDn.getParent();
    newName = newName.add( renameContext.getNewRdn() );
    SearchOperationContext searchOperationContext = new SearchOperationContext( renameContext.getSession(),
      baseDn,
      filter, controls );
    searchOperationContext.setAliasDerefMode( AliasDerefMode.NEVER_DEREF_ALIASES );
    searchOperationContext.setPartition( renameContext.getPartition() );
    searchOperationContext.setTransaction( renameContext.getTransaction() );
          nexus.modify( new ModifyOperationContext( renameContext.getSession(), dn,
            getOperationalModsForReplace(
              oldDn, newName, subentry, candidate ) ) );
    Dn newName = renameContext.getNewDn();
      ModifyOperationContext newModifyContext = new ModifyOperationContext( renameContext.getSession(), newName, mods );
      newModifyContext.setPartition( renameContext.getPartition() );
      newModifyContext.setTransaction( renameContext.getTransaction() );
      nexus.modify( newModifyContext );
origin: org.apache.directory.server/apacheds-interceptors-journal

ldif.setDn( renameContext.getDn() );
ldif.setNewRdn( renameContext.getNewRdn().getName() );
ldif.setDeleteOldRdn( renameContext.getDeleteOldRdn() );
origin: org.apache.directory.server/apacheds-core-jndi

  public void entryRenamed( RenameOperationContext renameContext )
  {
    try
    {
      if ( listener instanceof NamespaceChangeListener )
      {
        Binding newBinding = new Binding( renameContext.getDn().getName(),
          ServerEntryUtils.toBasicAttributes( renameContext.getEntry() ), false );
        Binding oldBinding = new Binding( renameContext.getDn().getName(),
          ServerEntryUtils.toBasicAttributes( ( ( ClonedServerEntry ) renameContext.getEntry() )
            .getOriginalEntry() ), false );
        NamingEvent evt = new NamingEvent( source, NamingEvent.OBJECT_RENAMED,
          newBinding, oldBinding, null );
        ( ( NamespaceChangeListener ) listener ).objectRenamed( evt );
      }
    }
    catch ( Exception e )
    {
      deliverNamingExceptionEvent( e );
    }
  }
}
origin: org.apache.directory.server/apacheds-core-api

/**
 * Rename a Schema Object.
 *
 * @param renameContext The contect contaoning the rename informations
 * @param doCascadeModify unused
 * @throws LdapException If the rename failed
 */
public void rename( RenameOperationContext renameContext, boolean doCascadeModify )
  throws LdapException
{
  Entry originalEntry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getOriginalEntry();
  Attribute oc = originalEntry.get( objectClassAT );
  for ( Value value : oc )
  {
    String oid = schemaManager.getObjectClassRegistry().getOidByName( value.getValue() );
    if ( objectClass2synchronizerMap.containsKey( oid ) )
    {
      RegistrySynchronizer synchronizer = objectClass2synchronizerMap.get( oid );
      synchronizer.rename( originalEntry, renameContext.getNewRdn(), doCascadeModify );
      return;
    }
  }
  if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
  {
    schemaSynchronizer.rename( originalEntry, renameContext.getNewRdn(), doCascadeModify );
    return;
  }
  throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM );
}
origin: org.apache.directory.server/apacheds-core-api

  /**
   * @see Object#toString()
   */
  public String toString()
  {
    return "RenameContext for old Dn '" + getDn().getName() + "'" + ", new Rdn '" + newRdn + "'"
      + ( deleteOldRdn ? ", delete old Rdn" : "" );
  }
}
origin: org.apache.directory.server/apacheds-interceptors-operational

/**
 * {@inheritDoc}
 */
@Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
  Entry entry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getClonedEntry();
  entry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
  entry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
  Entry modifiedEntry = renameContext.getOriginalEntry().clone();
  modifiedEntry.put( SchemaConstants.MODIFIERS_NAME_AT, getPrincipal( renameContext ).getName() );
  modifiedEntry.put( SchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
  Attribute csnAt = new DefaultAttribute( directoryService.getAtProvider().getEntryCSN(), directoryService
    .getCSN().toString() );
  modifiedEntry.put( csnAt );
  renameContext.setModifiedEntry( modifiedEntry );
  next( renameContext );
}
origin: org.apache.directory.server/apacheds-interceptors-admin

  /**
   * {@inheritDoc}
   */
  @Override
  public void rename( RenameOperationContext renameContext ) throws LdapException
  {
    LOG.debug( ">>> Entering into the Administrative Interceptor, renameRequest" );
    Entry entry = renameContext.getEntry();

    // Check if we are renaming an Administrative Point
    Attribute adminPoint = entry.get( directoryService.getAtProvider().getAdministrativeRole() );

    if ( adminPoint == null )
    {
      // Nope, go on.
      next( renameContext );

      LOG.debug( "Exit from Administrative Interceptor" );

      return;
    }

    // Else throw an UnwillingToPerform exception ATM
    String message = "Cannot rename an Administrative Point in the current version";
    LOG.error( message );
    throw new LdapUnwillingToPerformException( message );
  }
}
origin: org.apache.directory.server/apacheds-core-jndi

/**
 * Used to encapsulate [de]marshalling of controls before and after rename operations.
 * 
 * @param oldDn The old Dn
 * @param newRdn The new Rdn
 * @param delOldRdn If we should delete the old Rdn
 * @throws Exception If the rename failed
 */
protected void doRename( Dn oldDn, Rdn newRdn, boolean delOldRdn ) throws Exception
{
  // setup the op context and populate with request controls
  RenameOperationContext renameContext = new RenameOperationContext( session, oldDn, newRdn, delOldRdn );
  renameContext.addRequestControls( convertControls( true, requestControls ) );
  // Inject the referral handling into the operation context
  injectReferralControl( renameContext );
  // execute rename operation
  OperationManager operationManager = service.getOperationManager();
  operationManager.rename( renameContext );
  // clear the request controls and set the response controls
  requestControls = EMPTY_CONTROLS;
  responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(),
    renameContext.getResponseControls() );
}
origin: org.apache.directory.server/apacheds-protocol-ldap

  localDn.getName(), remoteRdn.getName(), String.valueOf( deleteOldRdn ) );
RenameOperationContext renCtx = new RenameOperationContext( session, localDn, remoteRdn,
  deleteOldRdn );
renCtx.setReplEvent( true );
renCtx.setRid( rid );
directoryService.getOperationManager().rename( renCtx );
origin: org.apache.directory.server/apacheds-ldif-partition

/**
 * {@inheritDoc}
 */
@Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
  synchronized ( lock )
  {
    super.rename( renameContext );
    dirty = true;
    rewritePartitionData( renameContext.getTransaction() );
  }
}
origin: org.apache.directory.server/apacheds-core-shared

/**
 * {@inheritDoc}
 */
@Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
  Partition partition = getPartition( renameContext.getDn() );
  partition.rename( renameContext );
}
origin: org.apache.directory.server/apacheds-core-shared

/**
 * {@inheritDoc}
 */
@Override
public void rename( Dn dn, Rdn newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log )
  throws LdapException
{
  OperationManager operationManager = directoryService.getOperationManager();
  RenameOperationContext renameContext = new RenameOperationContext( this, dn, newRdn, deleteOldRdn );
  renameContext.setLogChange( log );
  setReferralHandling( renameContext, ignoreReferral );
  operationManager.rename( renameContext );
}
origin: org.apache.directory.server/apacheds-interceptors-trigger

public void rename( RenameOperationContext renameContext ) throws LdapException
  Dn name = renameContext.getDn();
  Rdn newRdn = renameContext.getNewRdn();
  boolean deleteOldRn = renameContext.getDeleteOldRdn();
  Entry renamedEntry = ( ( ClonedServerEntry ) renameContext.getEntry() ).getClonedEntry();
origin: org.apache.directory.server/apacheds-interceptors-authn

/**
 * {@inheritDoc}
 */
@Override
public void rename( RenameOperationContext renameContext ) throws LdapException
{
  if ( IS_DEBUG )
  {
    LOG.debug( "Operation Context: {}", renameContext );
  }
  checkAuthenticated( renameContext );
  checkPwdReset( renameContext );
  next( renameContext );
  invalidateAuthenticatorCaches( renameContext.getDn() );
}
org.apache.directory.server.core.api.interceptor.contextRenameOperationContext

Javadoc

A RenameService context used for Interceptors. It contains all the informations needed for the modify Dn operation, and used by all the interceptors This is used when the modifyDN is about changing the Rdn, not the base Dn.

Most used methods

  • getDn
  • getEntry
  • getNewRdn
  • <init>
    Creates a new instance of RenameOperationContext.
  • getDeleteOldRdn
  • getResponseControls
  • getTransaction
  • setModifiedEntry
  • addRequestControls
  • getModifiedEntry
  • getNewDn
  • getOriginalEntry
  • getNewDn,
  • getOriginalEntry,
  • getPartition,
  • getSession,
  • hasRequestControl,
  • ignoreReferral,
  • setChangeLogEvent,
  • setInterceptors,
  • setLogChange,
  • setReplEvent

Popular in Java

  • Start an intent from android
  • addToBackStack (FragmentTransaction)
  • getSharedPreferences (Context)
  • getResourceAsStream (ClassLoader)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now