/** * {@inheritDoc} */ public ClonedServerEntry lookup( DN dn ) throws Exception { OperationManager operationManager = directoryService.getOperationManager(); return operationManager.lookup( new LookupOperationContext( this, dn ) ); }
/** * {@inheritDoc} */ public ClonedServerEntry lookup( DN dn, String[] attrId ) throws Exception { OperationManager operationManager = directoryService.getOperationManager(); return operationManager.lookup( new LookupOperationContext( this, dn, attrId ) ); }
public boolean hasEntry( NextInterceptor nextInterceptor, EntryOperationContext entryContext ) throws Exception { // Ask others first. boolean hasEntry = nextInterceptor.hasEntry( entryContext ); // If the entry exists, if ( hasEntry ) { // Check DELETED attribute. try { ServerEntry entry = nextInterceptor.lookup( new LookupOperationContext( entryContext.getSession(), entryContext.getDn() ) ); hasEntry = !isDeleted( entry ); } catch ( NameNotFoundException e ) { hasEntry = false; } } return hasEntry; }
/** * Make sure the specified <tt>newEntryName</tt> already exists. It * checked {@link Constants#ENTRY_DELETED} additionally to see if the * entry actually exists in a {@link Partition} but maked as deleted. * * @param newEntryName makes sure an entry already exists. */ private void checkBeforeAdd( LdapDN newEntryName ) throws Exception { LdapDN adminDn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED ); adminDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() ); CoreSession adminSession = new DefaultCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), ds ); if ( nexus.hasEntry( new EntryOperationContext( adminSession, newEntryName ) ) ) { ServerEntry entry = nexus.lookup( new LookupOperationContext( adminSession, newEntryName ) ); EntryAttribute deleted = entry.get( Constants.ENTRY_DELETED ); Object value = deleted == null ? null : deleted.get(); /* * Check first if the entry has been marked as deleted before * throwing an exception and delete the entry if so and return * without throwing an exception. */ if ( value != null && "TRUE".equalsIgnoreCase( value.toString() ) ) { return; } throw new NameAlreadyBoundException( newEntryName.toString() + " already exists." ); } }
ServerEntry entry = nexus.lookup( new LookupOperationContext( adminSession, name ) ); LOG.info( "[Replica-{}] Purge: " + name + " (" + entry + ')', configuration.getReplicaId() ); nexus.delete( new DeleteOperationContext( adminSession, name ) );
LookupOperationContext lookupContext = new LookupOperationContext( coreSession, name ); ServerEntry entry = nexus.lookup( lookupContext );
/** * Inject the entry into the local server * * @param nexus the local partition to update * @param store not used... Just for inheritence sake. * @param coreSession the current session */ protected void execute0( PartitionNexus nexus, ReplicationStore store, CoreSession coreSession ) throws Exception { if ( ! EntryUtil.isEntryUpdatable( coreSession, entry.getDn(), getCSN() ) ) { return; } EntryUtil.createGlueEntries( coreSession, entry.getDn(), false ); // Replace the entry if an entry with the same name exists. if ( nexus.lookup( new LookupOperationContext( coreSession, entry.getDn() ) ) != null ) { recursiveDelete( nexus, entry.getDn(), coreSession ); } nexus.add( new AddOperationContext( coreSession, (ServerEntry)entry ) ); }