/** * Get a String representation of a Compare Request * * @return A Compare Request String */ public String toString() { StringBuilder sb = new StringBuilder(); sb.append( " Compare request\n" ); sb.append( " Entry : '" ).append( name.toString() ).append( "'\n" ); sb.append( " Attribute description : '" ).append( attrId ).append( "'\n" ); sb.append( " Attribute value : '" ); if ( !attrVal.isBinary() ) { sb.append( attrVal.get() ); } else { byte[] binVal = attrVal.getBytes(); sb.append( StringTools.utf8ToString( binVal ) ).append( '/' ).append( StringTools.dumpBytes( binVal ) ).append( "'\n" ); } return sb.toString(); } }
/** * Converts an {@link EntryAttribute} to an {@link Attribute}. * * @param entryAttribute * the {@link EntryAttribute} to convert * @return * the equivalent {@link Attribute} */ public static Attribute toAttribute( EntryAttribute entryAttribute ) { if ( entryAttribute != null ) { Attribute attribute = new BasicAttribute( entryAttribute.getId() ); // Looping on values for ( Iterator<Value<?>> valueIterator = entryAttribute.iterator(); valueIterator.hasNext(); ) { Value<?> value = valueIterator.next(); attribute.add( value.get() ); } return attribute; } return null; }
valList.add( value.get() );
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public K getNormalized( K attrVal ) throws Exception { if ( attrVal instanceof Long ) { return attrVal; } if ( attrVal instanceof String ) { return ( K ) normalizer.normalize( ( String ) attrVal ); } else { return ( K ) normalizer.normalize( new BinaryValue( ( byte[] ) attrVal ) ).get(); } }
( ( AvlIndex ) index ).add( value.get(), id );
/** * Convert a ServerAttribute into a BasicAttribute. The DN is lost * during this conversion, as the Attributes object does not store * this element. * * @return An instance of a AttributesImpl() object */ public static Attribute toBasicAttribute( EntryAttribute entryAttribute ) { AttributeType attributeType = entryAttribute.getAttributeType(); Attribute attribute = new BasicAttribute( attributeType.getName() ); for ( Value<?> value: entryAttribute ) { attribute.add( value.get() ); } return attribute; }
binaryValue = new BinaryValue( attributeType, (byte[])val.get() );
( ( AvlIndex ) index ).drop( value.get(), id );
if ( StringTools.equals( atav.getNormType(), normalizedType ) ) return atav.getNormValue().get();
Object newNormValue = newAtav.getNormValue().get(); AttributeType newRdnAttrType = schemaManager.lookupAttributeTypeRegistry( newNormType );
/** * Compares a whether a given attribute's value matches that of the * existing value of the attribute present in the entry with the given DN * * @param dn the target entry's DN * @param attributeName the attribute's name * @param value a Value<?> value with which the target entry's attribute value to be compared with * @return compare operation's response * @throws LdapException */ public CompareResponse compare( DN dn, String attributeName, Value<?> value ) throws LdapException { CompareRequest compareRequest = new CompareRequest(); compareRequest.setEntryDn( dn ); compareRequest.setAttrName( attributeName ); compareRequest.setValue( value.get() ); return compare( compareRequest ); }
contextName = new LdapDN( (String)namingContext.get() );
private void sendAllEntries( ReplicationContext ctx ) throws Exception { ServerEntry rootDSE = ctx.getDirectoryService().getPartitionNexus().getRootDSE( null ); EntryAttribute namingContextsAttr = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT ); if ( namingContextsAttr == null || namingContextsAttr.size() == 0 ) { SessionLog.warn( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId() + "] No namingContexts attributes in rootDSE." ); return; } // Iterate all context partitions to send all entries of them. for ( Value<?> namingContext : namingContextsAttr ) { // Convert attribute value to JNDI name. LdapDN contextName; contextName = new LdapDN( ( String ) namingContext.get() ); SessionLog.info( ctx.getSession(), "[Replica-" + ctx.getConfiguration().getReplicaId() + "] Sending entries under '" + contextName + '\'' ); Map<String, OidNormalizer> mapping = ctx.getDirectoryService().getRegistries().getAttributeTypeRegistry() .getNormalizerMapping(); contextName.normalize( mapping ); sendAllEntries( ctx, contextName ); } }