setUpId( null, attributeType ); if ( attributeType.getSyntax().isHumanReadable() )
buf.append( syntax.getSchemaName() ); if ( syntax.isHumanReadable() )
/** * Creates a BinaryValue without an initial wrapped value. * * @param attributeType the schema type associated with this BinaryValue */ public BinaryValue( AttributeType attributeType ) { if ( attributeType == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04442 ) ); } if ( attributeType.getSyntax() == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04445 ) ); } if ( attributeType.getSyntax().isHumanReadable() ) { LOG.warn( "Treating a value of a human readible attribute {} as binary: ", attributeType.getName() ); } this.attributeType = attributeType; }
/** * Creates a StringValue without an initial wrapped value. * * @param attributeType the schema type associated with this StringValue */ public StringValue( AttributeType attributeType ) { if ( attributeType == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04442 ) ); } if ( attributeType.getSyntax() == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04445 ) ); } if ( ! attributeType.getSyntax().isHumanReadable() ) { LOG.warn( "Treating a value of a binary attribute {} as a String: " + "\nthis could cause data corruption!", attributeType.getName() ); } this.attributeType = attributeType; }
/** * @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 ); } } }
if ( attributeType.getSyntax().isHumanReadable() )
/** * @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 ); } } }
public ServerEntry getAttributes( LdapSyntax syntax, Schema schema, SchemaManager schemaManager ) throws LdapException { ServerEntry entry = new DefaultServerEntry( schemaManager ); entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, MetaSchemaConstants.META_SYNTAX_OC ); entry.put( MetaSchemaConstants.X_HUMAN_READABLE_AT, getBoolean( syntax.isHumanReadable() ) ); entry.put( SchemaConstants.CREATORS_NAME_AT, schema.getOwner() ); entry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() ); injectCommon( syntax, entry, schemaManager ); return entry; }
if ( type.getSyntax().isHumanReadable() )
if ( attributeType.getSyntax().isHumanReadable() )
isHR = attributeType.getSyntax().isHumanReadable();