| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public AddOperation createOperation( |
| | | InternalClientConnection connection, DN newDN) |
| | |
| | | // Msg encoding |
| | | // ============ |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public byte[] getBytes_V1() throws UnsupportedEncodingException |
| | | { |
| | |
| | | return resultByteArray; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public byte[] getBytes_V23() throws UnsupportedEncodingException |
| | | { |
| | |
| | | return resultByteArray; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public byte[] getBytes_V45(short reqProtocolVersion) |
| | | throws UnsupportedEncodingException |
| | |
| | | { |
| | | builder.add(s); |
| | | } |
| | | Attribute attr = builder.toAttribute(); |
| | | new LDAPAttribute(builder.toAttribute()).write(writer); |
| | | |
| | | new LDAPAttribute(attr).write(writer); |
| | | |
| | | // Encode the user attributes (AttributeList). |
| | | for (List<Attribute> list : userAttributes.values()) |
| | | { |
| | | for (Attribute a : list) |
| | | { |
| | | if (!EntryHistorical.isHistoricalAttribute(a) && !a.isVirtual()) |
| | | { |
| | | new LDAPAttribute(a).write(writer); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // Encode the operational attributes (AttributeList). |
| | | for (List<Attribute> list : operationalAttributes.values()) |
| | | { |
| | | for (Attribute a : list) |
| | | { |
| | | if (!EntryHistorical.isHistoricalAttribute(a)) |
| | | if (!a.isVirtual()) |
| | | new LDAPAttribute(a).write(writer); |
| | | } |
| | | } |
| | | // Encode the user and operational attributes (AttributeList). |
| | | encodeAttributes(userAttributes, writer); |
| | | encodeAttributes(operationalAttributes, writer); |
| | | } |
| | | catch(Exception e) |
| | | { |
| | |
| | | return byteBuilder.toByteArray(); |
| | | } |
| | | |
| | | private void encodeAttributes(Map<AttributeType, List<Attribute>> attributes, |
| | | ASN1Writer writer) throws Exception |
| | | { |
| | | for (List<Attribute> list : attributes.values()) |
| | | { |
| | | for (Attribute a : list) |
| | | { |
| | | if (!a.isVirtual() && !EntryHistorical.isHistoricalAttribute(a)) |
| | | { |
| | | new LDAPAttribute(a).write(writer); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private byte[] encodeAttributes( |
| | | Attribute objectClass, |
| | | Collection<Attribute> userAttributes, |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | if (protocolVersion == ProtocolVersion.REPLICATION_PROTOCOL_V1) |
| | | if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V1) |
| | | { |
| | | return "AddMsg content: " + |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + csn + |
| | | " uniqueId: " + entryUUID + |
| | | " assuredFlag: " + assuredFlag; |
| | | } |
| | | if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2) |
| | | { |
| | | return "AddMsg content: " + |
| | | " protocolVersion: " + protocolVersion + |
| | | " dn: " + dn + |
| | | " changeNumber: " + csn + |
| | | " csn: " + csn + |
| | | " uniqueId: " + entryUUID + |
| | | " assuredFlag: " + assuredFlag + |
| | | " assuredMode: " + assuredMode + |
| | | " safeDataLevel: " + safeDataLevel; |
| | | (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2 ? |
| | | " assuredMode: " + assuredMode + |
| | | " safeDataLevel: " + safeDataLevel |
| | | : ""); |
| | | } |
| | | return "!!! Unknown version: " + protocolVersion + "!!!"; |
| | | } |
| | |
| | | return parentEntryUUID; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public int size() |
| | | { |