/** * Construct an AVA. The type and value are normalized : * <li> the type is trimmed and lowercased </li> * <li> the value is trimmed </li> * <p> * Note that the upValue should <b>not</b> be null or empty, or resolved * to an empty string after having trimmed it. * * @param upType The Usrr Provided type * @param normType The normalized type * @param upValue The User Provided value * @param normValue The normalized value */ public AVA( String upType, String normType, byte[] upValue, byte[] normValue ) throws LdapInvalidDnException { this( upType, normType, new BinaryValue( upValue ), new BinaryValue( normValue ) ); }
/** * Sets the attribute value to use in the comparison. * * @param attrVal * the attribute value used in comparison. */ public void setAssertionValue( byte[] attrVal ) { if ( attrVal != null ) { this.attrVal = new BinaryValue( attrVal ); } else { this.attrVal = null; } }
/** * @see EntryAttribute#remove(byte[]...) * * @return <code>true</code> if all the values shave been removed from this attribute */ public boolean remove( byte[]... vals ) { if ( isHR ) { return false; } boolean removed = true; for ( byte[] val:vals ) { BinaryValue value = new BinaryValue( attributeType, val ); removed &= values.remove( value ); } return removed; }
public Object normalizeByOid( String oid, byte[] val ) throws LdapException { return normalizer.normalize( new BinaryValue( val ) ); }
public Object normalizeByName( String name, byte[] val ) throws LdapException { return normalizer.normalize( new BinaryValue( val ) ); }
/** * @see NameComponentNormalizer#normalizeByOid(String, String) */ public Object normalizeByOid( String oid, byte[] value ) throws LdapException { return lookup( oid ).normalize( new BinaryValue( value ) ); }
byte[] upValueBytes = new byte[upValueLength]; in.readFully( upValueBytes ); upValue = new BinaryValue( upValueBytes ); normValue = new BinaryValue( normValueBytes );
BinaryValue value = new BinaryValue( attributeType, val );
BinaryValue value = new BinaryValue( val ); removed &= values.remove( value );
BinaryValue value = new BinaryValue( StringTools.getBytesUtf8( val ) ); removed &= values.remove( value );
public Value<?> normalize( Value<?> value ) throws LdapException { if ( value.isBinary() ) { byte[] val = value.getBytes(); // each byte will be changed to be > 0, and spaces will be trimmed byte[] newVal = new byte[ val.length ]; int i = 0; for ( byte b:val ) { newVal[i++] = (byte)(b & 0x007F); } return new BinaryValue( StringTools.trim( newVal ) ); } throw new IllegalStateException( I18n.err( I18n.ERR_474 ) ); }
/** * {@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(); } }
value = new BinaryValue( attributeType ); ((BinaryValue)value).deserialize( in );
/** * The initialization action */ public void action( IAsn1Container container ) throws DecoderException { LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container; SearchRequestCodec searchRequest = ldapMessageContainer.getSearchRequest(); TLV tlv = ldapMessageContainer.getCurrentTLV(); // Store the value. ExtensibleMatchFilter extensibleMatchFilter = ( ExtensibleMatchFilter ) searchRequest .getTerminalFilter(); byte[] value = tlv.getValue().getData(); extensibleMatchFilter.setMatchValue( new BinaryValue( value ) ); // unstack the filters if needed searchRequest.unstackFilters( container ); if ( IS_DEBUG ) { log.debug( "Stored a match value : {}", value ); } } }
/** * Convert the ServerAttribute to a ClientAttribute * * @return An instance of ClientAttribute */ public EntryAttribute toClientAttribute() { // Create the new EntryAttribute EntryAttribute clientAttribute = new DefaultClientAttribute( upId ); // Copy the values for ( Value<?> value:this ) { Value<?> clientValue = null; if ( value instanceof StringValue ) { clientValue = new StringValue( value.getString() ); } else { clientValue = new BinaryValue( value.getBytes() ); } clientAttribute.add( clientValue ); } return clientAttribute; }
new BinaryValue( Base64.decode( nextText.trim().toCharArray() ) ) );
Value<byte[]> value = new BinaryValue( Base64.decode( nextText.trim().toCharArray() ) ); assertion.setAssertionValue( value );
/** * @see NameComponentNormalizer#normalizeByName(String, String) */ public Object normalizeByName( String name, byte[] value ) throws LdapException { AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( name ); if ( !attributeType.getSyntax().isHumanReadable() ) { return lookup( name ).normalize( new BinaryValue( value ) ); } else { try { String valStr = new String( value, "UTF-8" ); return lookup( name ).normalize( valStr ); } catch ( UnsupportedEncodingException uee ) { String message = I18n.err( I18n.ERR_04223 ); LOG.error( message ); throw new LdapException( message ); } } }
/** * @see NameComponentNormalizer#normalizeByName(String, String) */ public Object normalizeByName( String name, String value ) throws LdapException { AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( name ); if ( attributeType.getSyntax().isHumanReadable() ) { return lookup( name ).normalize( value ); } else { try { String unescaped = unescape( value ); byte[] valBytes = unescaped.getBytes( "UTF-8" ); return lookup( name ).normalize( new BinaryValue( valBytes ) ); } catch ( UnsupportedEncodingException uee ) { String message = I18n.err( I18n.ERR_04222 ); LOG.error( message ); throw new LdapException( message ); } } }
val = new BinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) ); val = new BinaryValue( attributeType, (byte[])value );