/** * Encodes the add request protocol op to an ASN.1 element. * * @return The ASN.1 element with the encoded add request protocol op. */ public ASN1Element encodeProtocolOp() { // Create the add request protocol op. final ASN1Element[] attrElements = new ASN1Element[attributes.size()]; for (int i=0; i < attrElements.length; i++) { attrElements[i] = attributes.get(i).encode(); } final ASN1Element[] addRequestElements = { new ASN1OctetString(dn), new ASN1Sequence(attrElements) }; return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_ADD_REQUEST, addRequestElements); }
/** * {@inheritDoc} */ public ASN1Element encodeProtocolOp() { final ArrayList<ASN1Element> attrElements = new ArrayList<ASN1Element>(attributes.size()); for (final Attribute a : attributes) { attrElements.add(a.encode()); } return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_ADD_REQUEST, new ASN1OctetString(dn), new ASN1Sequence(attrElements)); }
/** * Encodes the add request protocol op to an ASN.1 element. * * @return The ASN.1 element with the encoded add request protocol op. */ public ASN1Element encodeProtocolOp() { // Create the add request protocol op. final ASN1Element[] attrElements = new ASN1Element[attributes.size()]; for (int i=0; i < attrElements.length; i++) { attrElements[i] = attributes.get(i).encode(); } final ASN1Element[] addRequestElements = { new ASN1OctetString(dn), new ASN1Sequence(attrElements) }; return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_ADD_REQUEST, addRequestElements); }
/** * {@inheritDoc} */ public ASN1Element encodeProtocolOp() { final ArrayList<ASN1Element> attrElements = new ArrayList<ASN1Element>(attributes.size()); for (final Attribute a : attributes) { attrElements.add(a.encode()); } return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_SEARCH_RESULT_ENTRY, new ASN1OctetString(dn), new ASN1Sequence(attrElements)); }
/** * {@inheritDoc} */ public ASN1Element encodeProtocolOp() { final ArrayList<ASN1Element> attrElements = new ArrayList<ASN1Element>(attributes.size()); for (final Attribute a : attributes) { attrElements.add(a.encode()); } return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_SEARCH_RESULT_ENTRY, new ASN1OctetString(dn), new ASN1Sequence(attrElements)); }
/** * {@inheritDoc} */ public ASN1Element encodeProtocolOp() { final ArrayList<ASN1Element> attrElements = new ArrayList<ASN1Element>(attributes.size()); for (final Attribute a : attributes) { attrElements.add(a.encode()); } return new ASN1Sequence(LDAPMessage.PROTOCOL_OP_TYPE_ADD_REQUEST, new ASN1OctetString(dn), new ASN1Sequence(attrElements)); }
/** * Encodes this joined entry to an ASN.1 element. * * @return An ASN.1 element containing the encoded representation of this * joined entry. */ ASN1Element encode() { final ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(3); elements.add(new ASN1OctetString(getDN())); final ArrayList<ASN1Element> attrElements = new ArrayList<ASN1Element>(); for (final Attribute a : getAttributes()) { attrElements.add(a.encode()); } elements.add(new ASN1Sequence(attrElements)); if (! nestedJoinResults.isEmpty()) { final ArrayList<ASN1Element> nestedElements = new ArrayList<ASN1Element>(nestedJoinResults.size()); for (final JoinedEntry je : nestedJoinResults) { nestedElements.add(je.encode()); } elements.add(new ASN1Sequence(nestedElements)); } return new ASN1Sequence(elements); }
/** * Encodes the provided information as appropriate for an auth entry. * * @param type The BER type to use for the element. * @param authID The authID to be encoded, if available. * @param authEntry The entry to be encoded. * * @return The ASN.1 sequence containing the encoded auth entry. */ private static ASN1Sequence encodeAuthEntry(final byte type, final String authID, final ReadOnlyEntry authEntry) { final ArrayList<ASN1Element> elements = new ArrayList<ASN1Element>(3); if (authID != null) { elements.add(new ASN1OctetString(TYPE_AUTHID, authID)); } elements.add(new ASN1OctetString(TYPE_AUTHDN, authEntry.getDN())); final Collection<Attribute> attributes = authEntry.getAttributes(); final ArrayList<ASN1Element> attrElements = new ArrayList<ASN1Element>(attributes.size()); for (final Attribute a : attributes) { attrElements.add(a.encode()); } elements.add(new ASN1Sequence(TYPE_ATTRIBUTES, attrElements)); return new ASN1Sequence(type, elements); }
/** * Encodes the provided information into an octet string that can be used as * the value for this control. * * @param entry The entry to include in this pre-read response control. It * must not be {@code null}. * * @return An ASN.1 octet string that can be used as the value for this * control. */ private static ASN1OctetString encodeValue(final ReadOnlyEntry entry) { ensureNotNull(entry); final Collection<Attribute> attrs = entry.getAttributes(); final ArrayList<ASN1Element> attrElements = new ArrayList<ASN1Element>(attrs.size()); for (final Attribute a : attrs) { attrElements.add(a.encode()); } final ASN1Element[] entryElements = { new ASN1OctetString(entry.getDN()), new ASN1Sequence(attrElements) }; return new ASN1OctetString(new ASN1Sequence(entryElements).encode()); }
/** * Encodes the provided information into an octet string that can be used as * the value for this control. * * @param entry The entry to include in this post-read response control. It * must not be {@code null}. * * @return An ASN.1 octet string that can be used as the value for this * control. */ private static ASN1OctetString encodeValue(final ReadOnlyEntry entry) { ensureNotNull(entry); final Collection<Attribute> attrs = entry.getAttributes(); final ArrayList<ASN1Element> attrElements = new ArrayList<ASN1Element>(attrs.size()); for (final Attribute a : attrs) { attrElements.add(a.encode()); } final ASN1Element[] entryElements = { new ASN1OctetString(entry.getDN()), new ASN1Sequence(attrElements) }; return new ASN1OctetString(new ASN1Sequence(entryElements).encode()); }
for (final Attribute a : otherAttributes) attrElements.add(a.encode());
for (final Attribute a : attrs) attrElements.add(a.encode());