/** * Add a new ServerAttribute, with its upId. If the upId is null, * default to the AttributeType name. * * Updates the serverAttributeMap. */ private void createAttribute( String upId, AttributeType attributeType, byte[]... values ) { EntryAttribute attribute = new DefaultServerAttribute( attributeType, values ); attribute.setUpId( upId, attributeType ); attributes.put( attributeType, attribute ); }
/** * Create a new instance of a EntryAttribute. * * @param upId the ID for the added attribute * @param attributeType The attributeType added on creation * @param vals the added values for this attribute */ public DefaultServerAttribute( String upId, AttributeType attributeType, String... vals ) { if ( attributeType == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04442 ) ); } setAttributeType( attributeType ); add( vals ); setUpId( upId, attributeType ); }
/** * Deserialize a ServerModification * * @param in The buffer containing the serialized value * @param atRegistry The AttributeType registry * @throws IOException If we weren't able to deserialize the data * @throws ClassNotFoundException if we weren't able to construct a Modification instance * @throws LdapException If we didn't found the AttributeType in the registries */ public void deserialize( ObjectInput in, SchemaManager schemaManager ) throws IOException, ClassNotFoundException, LdapException { // Read the operation int op = in.readInt(); operation = ModificationOperation.getOperation( op ); // Read the attribute OID String oid = in.readUTF(); // Lookup for tha associated AttributeType AttributeType attributeType = schemaManager.lookupAttributeTypeRegistry( oid ); attribute = new DefaultServerAttribute( attributeType ); // Read the attribute ((DefaultServerAttribute)attribute).deserialize( in ); }
/** * Create a new instance of a EntryAttribute, without value. * * @param upId the ID for the added attributeType * @param attributeType the added AttributeType */ public DefaultServerAttribute( String upId, AttributeType attributeType ) { if ( attributeType == null ) { String message = I18n.err( I18n.ERR_04442 ); LOG.error( message ); throw new IllegalArgumentException( message ); } setAttributeType( attributeType ); setUpId( upId, attributeType ); }
/** * Serialize a ServerModification. */ public void serialize( ObjectOutput out ) throws IOException { if ( attribute == null ) { throw new IOException( I18n.err( I18n.ERR_04471 ) ); } // Write the operation out.writeInt( operation.getValue() ); AttributeType at = ((DefaultServerAttribute)attribute).getAttributeType(); // Write the attribute's oid out.writeUTF( at.getOid() ); // Write the attribute ((DefaultServerAttribute)attribute).serialize( out ); }
if ( add( newValue ) != 0 )
/** * Create a new instance of a EntryAttribute, without ID nor value. * * @param attributeType the attributeType for the empty attribute added into the entry */ public DefaultServerAttribute( AttributeType attributeType ) { if ( attributeType == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04442 ) ); } setAttributeType( attributeType ); }
attribute.serialize( out );
if ( add( value ) != 0 )
/** * Add a new ServerAttribute, with its upId. If the upId is null, * default to the AttributeType name. * * Updates the serverAttributeMap. */ private void createAttribute( String upId, AttributeType attributeType, String... values ) { EntryAttribute attribute = new DefaultServerAttribute( attributeType, values ); attribute.setUpId( upId, attributeType ); attributes.put( attributeType, attribute ); }
DefaultServerAttribute attribute = new DefaultServerAttribute( attributeType ); attribute.deserialize( in );
/** * Create a new instance of a EntryAttribute, with some byte[] values. * * @param upId the ID for the added attribute * @param attributeType the AttributeType to be added * @param vals the values for the added attribute */ public DefaultServerAttribute( String upId, AttributeType attributeType, byte[]... vals ) { if ( attributeType == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04442 ) ); } setAttributeType( attributeType ); add( vals ); setUpId( upId, attributeType ); }
/** * Add a new ServerAttribute, with its upId. If the upId is null, * default to the AttributeType name. * * Updates the serverAttributeMap. */ private void createAttribute( String upId, AttributeType attributeType, Value<?>... values ) { EntryAttribute attribute = new DefaultServerAttribute( attributeType, values ); attribute.setUpId( upId, attributeType ); attributes.put( attributeType, attribute ); }
/** * Doc me more! * * If the value does not correspond to the same attributeType, then it's * wrapped value is copied into a new Value which uses the specified * attributeType. * * Otherwise, the value is stored, but as a reference. It's not a copy. * * @param upId the ID of the added attribute * @param attributeType the attribute type according to the schema * @param vals an initial set of values for this attribute */ public DefaultServerAttribute( String upId, AttributeType attributeType, Value<?>... vals ) { if ( attributeType == null ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_04442 ) ); } setAttributeType( attributeType ); setUpId( upId, attributeType ); add( vals ); }
/** * Convert a Modification to an instance of a ServerModification object. * * @param modificationImpl the modification instance to convert * @param attributeType the associated attributeType * @return a instance of a ServerModification object */ private static Modification toServerModification( Modification modification, AttributeType attributeType ) { if ( modification instanceof ServerModification ) { return modification; } Modification serverModification = new ServerModification( modification.getOperation(), new DefaultServerAttribute( attributeType, modification.getAttribute() ) ); return serverModification; }
EntryAttribute attribute = attributes.put( attributeType, new DefaultServerAttribute( attributeType ) );
new DefaultServerAttribute( upId, attributeType ));
private final void injectNames( List<String> names, ServerEntry entry, SchemaManager schemaManager ) throws LdapException { if ( ( names == null ) || ( names.size() == 0 ) ) { return; } EntryAttribute attr = new DefaultServerAttribute( schemaManager.lookupAttributeTypeRegistry( MetaSchemaConstants.M_NAME_AT ) ); for ( String name:names ) { attr.add( name ); } entry.put( attr ); }