public void add(LDAPEntry entry, LDAPConstraints cont) throws LDAPException { LDAPControl[] conts = cont != null ? cont.getControls() : null; LDAPAddRequest add = new LDAPAddRequest(entry,conts); this.sendMessage(add); }
/** * Return an ASN1 representation of this add request. * * #return an ASN1 representation of this object. */ public String toString() { return getASN1Object().toString(); } protected void setDeserializedValues(LDAPMessage readObject, RfcControls asn1Ctrls)
/** * Writes the Add request requested within a LDAP Add * request * @param request a search request entry */ private void writeAddRequest(LDAPAddRequest request) throws IOException, LDAPLocalException { writeAddRequestEntry( request, request.getControls(), DOMWriter.findRequestID(request)); return; }
protected void setDeserializedValues(LDAPMessage readObject, RfcControls asn1Ctrls) throws IOException, ClassNotFoundException { // Check if it is the correct message type if(!(readObject instanceof LDAPAddRequest)) throw new ClassNotFoundException("Error occured while deserializing " + "LDAPAddRequest object"); LDAPAddRequest tmp = (LDAPAddRequest)readObject; LDAPEntry entry = tmp.getEntry(); tmp = null; //remove reference after getting properties RfcRequest operation = new RfcAddRequest( new RfcLDAPDN(entry.getDN()), LDAPAddRequest.makeRfcAttrList( entry)); message = new RfcLDAPMessage(operation, asn1Ctrls); // Garbage collect the readObject from readDSML().. readObject = null; } }
private void writeAddRequestEntry( LDAPAddRequest request, LDAPControl[] controls, String requestID) throws IOException, LDAPLocalException { checkState(false); LDAPEntry entry=request.getEntry(); LDAPAttributeSet set = entry.getAttributeSet(); Iterator i = set.iterator(); while (i.hasNext()){ writeAttribute( (LDAPAttribute) i.next()); } if( (controls !=null) && (controls.length != 0)) { writeControls(controls, 3); } newLine(1); out.write("</addRequest>"); return; }
/** * Constructs a request to add an entry to the directory. * * @param entry The LDAPEntry to add to the directory. * * @param cont Any controls that apply to the add request, * or null if none. */ public LDAPAddRequest( LDAPEntry entry, LDAPControl[] cont) throws LDAPException { super( LDAPMessage.ADD_REQUEST, new RfcAddRequest( new RfcLDAPDN(entry.getDN()), makeRfcAttrList( entry)), cont); return; }
e = doc.createElement("addRequest"); LDAPAddRequest add = (LDAPAddRequest)message; LDAPEntry entry = add.getEntry(); e.setAttribute("dn", entry.getDN()); Iterator attrs = entry.getAttributeSet().iterator();
LDAPMessage msg = new LDAPAddRequest( entry, cons.getControls());
String dn = ((LDAPAddRequest) message).getEntry().getDN(); out.write(" dn=\"" + this.makeAttributeSafe(dn) + "\"");
/** * Constructs an LDAPEntry that represents the add request * * @return an LDAPEntry that represents the add request. */ public LDAPEntry getEntry() { RfcAddRequest addreq = (RfcAddRequest)getASN1Object().getRequest(); LDAPAttributeSet attrs = new LDAPAttributeSet(); // Build the list of attributes ASN1Object[] seqArray = addreq.getAttributes().toArray(); for(int i = 0; i < seqArray.length; i++) { RfcAttributeTypeAndValues seq = (RfcAttributeTypeAndValues)seqArray[i]; LDAPAttribute attr = new LDAPAttribute(((ASN1OctetString)seq.get(0)).stringValue()); // Add the values to the attribute ASN1SetOf set = (ASN1SetOf)seq.get(1); Object[] setArray = set.toArray(); for(int j = 0; j < setArray.length; j++) { attr.addValue(((ASN1OctetString)setArray[j]).byteValue()); } attrs.add(attr); } return new LDAPEntry( getASN1Object().getRequestDN(), attrs); }
this.currentRequest = new LDAPAddRequest(currentEntry, controls); break; case LDAPMessage.ADD_REQUEST : this.currentRequest = new LDAPAddRequest(currentEntry, controls); break; case LDAPMessage.DEL_REQUEST :
writeAddRequest(areq.getEntry(), controls); break; case LDAPMessage.DEL_REQUEST:
new LDAPControl[controls.size()]); message = new LDAPAddRequest(entry, cons); if (requestID != null) { message.setTag(requestID);