/** * {@inheritDoc} */ public ClonedServerEntry lookup( DN dn ) throws Exception { OperationManager operationManager = directoryService.getOperationManager(); return operationManager.lookup( new LookupOperationContext( this, dn ) ); }
public ClonedServerEntry lookup( NextInterceptor nextInterceptor, LookupOperationContext lookupContext ) throws Exception { if ( lookupContext.getAttrsId() != null ) { boolean found = false; String[] attrIds = lookupContext.getAttrsIdArray(); // Look for 'entryDeleted' attribute is in attrIds. for ( String attrId:attrIds ) { if ( Constants.ENTRY_DELETED.equals( attrId ) ) { found = true; break; } } // If not exists, add one. if ( !found ) { String[] newAttrIds = new String[attrIds.length + 1]; System.arraycopy( attrIds, 0, newAttrIds, 0, attrIds.length ); newAttrIds[attrIds.length] = Constants.ENTRY_DELETED; lookupContext.setAttrsId( newAttrIds ); } } ClonedServerEntry entry = nextInterceptor.lookup( lookupContext ); ensureNotDeleted( lookupContext, entry ); return entry; }
public ClonedServerEntry lookup( LookupOperationContext opContext ) throws Exception { ID id = getEntryId( opContext.getDn().getNormName() ); if ( id == null ) { return null; } ClonedServerEntry entry = lookup( id ); if ( ( opContext.getAttrsId() == null ) || ( opContext.getAttrsId().size() == 0 ) ) { return entry; } for ( AttributeType attributeType : ( ( ServerEntry ) entry.getOriginalEntry() ).getAttributeTypes() ) { if ( !opContext.getAttrsId().contains( attributeType.getOid() ) ) { entry.removeAttributes( attributeType ); } } return entry; }
public ClonedServerEntry lookup(LookupOperationContext ctx) { DN dn = ctx.getDn(); /* if (log.isDebugEnabled()) { log.debug("lookup(dn=" + ctx.getDn() + ")"); for (int i = 0; i < dn.size(); i++) { log.debug("DN.get(" + i + ")" + dn.get(i)); log.debug("DN.getSuffix(" + i + ")" + dn.getSuffix(i)); log.debug("DN.getPrefix(" + i + ")" + dn.getPrefix(i)); log.debug("DN.getRdn(" + i + ")" + dn.getRdn(i)); } } */ ServerEntry se = m_EntryCache.get(ctx.getDn().getName()); if (se == null) { //todo log.debug("lookup()::No cached entry found for " + dn.getName()); return null; } else { log.debug("lookup()::Cached entry found for " + dn.getName()); return new ClonedServerEntry(se); } }//lookup
/** * {@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 ) ); }