public Attributes lookup( NextInterceptor next, LdapDN name ) throws NamingException { return ( Attributes ) nexus.lookup( name ).clone(); }
public Attributes lookup( NextInterceptor next, LdapDN dn, String[] attrIds ) throws NamingException { return ( Attributes ) nexus.lookup( dn, attrIds ).clone(); }
/** * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name, * java.lang.String[]) */ public Attributes getAttributes( Name name, String[] attrIds ) throws NamingException { return getNexusProxy().lookup( buildTarget( name ), attrIds ); }
/** * @see javax.naming.directory.DirContext#getAttributes(javax.naming.Name) */ public Attributes getAttributes( Name name ) throws NamingException { return getNexusProxy().lookup( buildTarget( name ) ); }
private void loadAdministrators() throws NamingException { // read in the administrators and cache their normalized names Set newAdministrators = new HashSet( 2 ); Attributes adminGroup = nexus.lookup( ADMIN_GROUP_DN_NORMALIZED ); if ( adminGroup == null ) { return; } Attribute uniqueMember = adminGroup.get( "uniqueMember" ); for ( int ii = 0; ii < uniqueMember.size(); ii++ ) { LdapDN memberDn = new LdapDN( ( String ) uniqueMember.get( ii ) ); memberDn.normalize( normalizerMapping ); newAdministrators.add( memberDn.toNormName() ); } administrators = newAdministrators; }
assertHasEntry( nextInterceptor, msg, name ); Attributes entry = nexus.lookup( name ); NamingEnumeration attrIds = attrs.getIDs(); while ( attrIds.hasMore() )
public void checkModify( LdapDN normName, ModificationItemImpl[] mods ) throws NamingException { Attributes originalEntry = nexus.lookup( normName ); Attributes targetEntry = SchemaUtils.getTargetEntry( mods, originalEntry ); Attribute targetObjectClasses = targetEntry.get( "objectClass" ); if ( AttributeUtils.containsValueCaseIgnore( targetObjectClasses, "collectiveAttributeSubentry" ) ) { return; } if ( addsAnyCollectiveAttributes( mods ) ) { /* * TODO: Replace the Exception and the ResultCodeEnum with the correct ones. */ throw new LdapSchemaViolationException( "Cannot operate on collective attributes in non-collectiveAttributeSubentries", ResultCodeEnum.OTHER); } }
public void delete( NextInterceptor next, LdapDN name ) throws NamingException { Attributes entry = nexus.lookup( name ); super.delete( next, name ); Set selecting = getSelectingSources( name, entry ); if ( selecting.isEmpty() ) { return; } Iterator list = selecting.iterator(); while ( list.hasNext() ) { EventSourceRecord rec = ( EventSourceRecord ) list.next(); NamingListener listener = rec.getNamingListener(); if ( listener instanceof NamespaceChangeListener ) { NamespaceChangeListener nclistener = ( NamespaceChangeListener ) listener; Binding binding = new Binding( name.getUpName(), entry, false ); nclistener.objectRemoved( new NamingEvent( rec.getEventContext(), NamingEvent.OBJECT_REMOVED, null, binding, entry ) ); } } }
private void notifyOnModify( LdapDN name, ModificationItemImpl[] mods, Attributes oriEntry ) throws NamingException { Attributes entry = nexus.lookup( name ); Set selecting = getSelectingSources( name, entry ); if ( selecting.isEmpty() ) { return; } Iterator list = selecting.iterator(); while ( list.hasNext() ) { EventSourceRecord rec = ( EventSourceRecord ) list.next(); NamingListener listener = rec.getNamingListener(); if ( listener instanceof ObjectChangeListener ) { ObjectChangeListener oclistener = ( ObjectChangeListener ) listener; Binding before = new Binding( name.getUpName(), oriEntry, false ); Binding after = new Binding( name.getUpName(), entry, false ); oclistener.objectChanged( new NamingEvent( rec.getEventContext(), NamingEvent.OBJECT_CHANGED, after, before, mods ) ); } } }
private void notifyOnNameChange( LdapDN oldName, LdapDN newName ) throws NamingException { Attributes entry = nexus.lookup( newName ); Set selecting = getSelectingSources( oldName, entry ); if ( selecting.isEmpty() ) { return; } Iterator list = selecting.iterator(); while ( list.hasNext() ) { EventSourceRecord rec = ( EventSourceRecord ) list.next(); NamingListener listener = rec.getNamingListener(); if ( listener instanceof NamespaceChangeListener ) { NamespaceChangeListener nclistener = ( NamespaceChangeListener ) listener; Binding oldBinding = new Binding( oldName.getUpName(), entry, false ); Binding newBinding = new Binding( newName.getUpName(), entry, false ); nclistener.objectRenamed( new NamingEvent( rec.getEventContext(), NamingEvent.OBJECT_RENAMED, newBinding, oldBinding, entry ) ); } } }
Attributes attributes = nexusProxy.lookup( target );
/** * Checks to see the entry being modified exists, otherwise throws the appropriate LdapException. */ public void modify( NextInterceptor nextInterceptor, LdapDN name, ModificationItemImpl[] items ) throws NamingException { // check if entry to modify exists String msg = "Attempt to modify non-existant entry: "; assertHasEntry( nextInterceptor, msg, name ); Attributes entry = nexus.lookup( name ); for ( int ii = 0; ii < items.length; ii++ ) { if ( items[ii].getModificationOp() == DirContext.ADD_ATTRIBUTE ) { Attribute modAttr = items[ii].getAttribute(); Attribute entryAttr = entry.get( modAttr.getID() ); if ( entryAttr != null ) { for ( int jj = 0; jj < modAttr.size(); jj++ ) { if ( entryAttr.contains( modAttr.get( jj ) ) ) { throw new LdapAttributeInUseException( "Trying to add existing value '" + modAttr.get( jj ) + "' to attribute " + modAttr.getID() ); } } } } } nextInterceptor.modify( name, items ); }
/** * 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 ) );
public void delete( NextInterceptor next, LdapDN name ) throws NamingException Attributes entry = nexus.lookup( name ); Attribute objectClasses = ServerUtils.getAttribute( objectClassType, entry );
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 ) ); }
public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName ) throws NamingException Attributes entry = nexus.lookup( oriChildName ); Attribute objectClasses = entry.get( "objectClass" );
public void move( NextInterceptor next, LdapDN oriChildName, LdapDN newParentName, String newRn, boolean deleteOldRn ) throws NamingException Attributes entry = nexus.lookup( oriChildName ); Attribute objectClasses = ServerUtils.getAttribute( objectClassType, entry );
public void modifyRn( NextInterceptor next, LdapDN name, String newRn, boolean deleteOldRn ) throws NamingException Attributes entry = nexus.lookup( name ); Attribute objectClasses = ServerUtils.getAttribute( objectClassType, entry );