/** * Write the DN to the outputStream. If the DN characters are unsafe, * the DN is encoded. * * @param dn the DN to write */ private void writeDN(String dn) throws IOException { writeLine(Base64.isLDIFSafe(dn)? "dn: "+dn: "dn:: "+ Base64.encode(dn)); return; }
/** * Retrieves the optional requestID attribute on a BatchRequests. * @return requestID on a batchRequest or <tt>null</tt> if requestID is not * specified or the content is in a batchResponse. */ public String getBatchRequestID(){ return this.handler.getBatchRequestID(); }
/** * Creates a string that represents this RDN, according to RFC 2253 * * @return An RDN string */ public String toString(){ return toString(false); }
protected void endElement() { try { byte[] temp; String name = getName(); String value = getValue(); if (this.isBase64) { temp = Base64.decode(value); } else { temp = value.getBytes("UTF-8"); } //getParent().addValue("value", temp); getParent().addValue(name, temp); } catch (UnsupportedEncodingException e) { } } protected void handleAttributes(Attributes attributes) throws SAXException {
/** * Returns true if the string conforms to distinguished name syntax. * @param dn String to evaluate fo distinguished name syntax. * @return true if the dn is valid. */ public static boolean isValid(String dn){ try { new DN(dn); } catch (IllegalArgumentException iae){ return false; } return true; }
/** * 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; }
/** * Writes the Delete request requested within a LDAP Delete * request * @param request a search request entry */ private void writeDeleteRequest(LDAPDeleteRequest request) throws IOException, LDAPLocalException { writeDeleteRequestEntry( request, request.getControls(), DOMWriter.findRequestID(request)); return; }
/** * Writes the Extended request requested within a LDAP Extended * request * @param request a Extended request entry */ private void writeExtendedRequest(LDAPExtendedRequest request) throws IOException, LDAPLocalException { writeExtendedRequestEntry( request, request.getControls(), DOMWriter.findRequestID(request)); return; }
/** * Writes the Modify request requested within a LDAP Modify * request * @param request a search request entry */ private void writeModifyDNRequest(LDAPModifyDNRequest request) throws IOException, LDAPLocalException { writeModifyDNRequestEntry( request, request.getControls(), DOMWriter.findRequestID(request)); return; }
/** * Writes the Search request requested within a LDAP search * request * @param request a search request entry */ private void writeSearchRequest(LDAPSearchRequest request) throws IOException, LDAPLocalException { writeSearchRequestEntry( request, request.getControls(), DOMWriter.findRequestID(request)); return; }
/** * Writes the Compare request requested within a LDAP Compare * request * @param request a search request entry */ private void writeCompareRequest(LDAPCompareRequest request) throws IOException, LDAPLocalException { writeCompareRequestEntry( request, request.getControls(), DOMWriter.findRequestID(request)); return; }
/** * Writes the Modify request requested within a LDAP Modify * request * @param request a search request entry */ private void writeModifyRequest(LDAPModifyRequest request) throws IOException, LDAPLocalException { writeModifyRequestEntry( request, request.getControls(), DOMWriter.findRequestID(request)); return; }
/** * Writes the entries returned within search responses. * @param result a search result entry */ private void writeSearchResponse(LDAPSearchResult result) throws IOException, LDAPLocalException { writeEntry( result.getEntry(), result.getControls(), DOMWriter.findRequestID(result)); return; }
/** Default Constructor with element name for this Handler and parent * LDAPXMLHandler to be processed. * @param ElementName String name of the XML element to process. * @param parent LDAPXMLHandler , which is the parent of this Element. */ public LDAPXMLHandler(String ElementName, LDAPXMLHandler parent) { elementName = ElementName; parenthandler = parent; state = INIT; initHandler(); } /**
public ArrayList getErrors() { return this.handler.getErrors(); } }
/** * If requests in a batchRequest can be executed in parallel, this specifies * whether the responses can be written in any order. * * <p>This is determined by reading the "responseOrder" attribute on the tag * batchRequest. This attribute can take on the values of "sequential" or * "unordered" and defaults to "sequential" when the attribute is absent.<p> * * @return <tt>true</tt> if the content is a batchRequest with the attribute * <tt>responseOrder</tt> equal to <tt>unordered</tt>; and false otherwise. * */ public boolean isResponseUnordered(){ return this.handler.isResponseUnordered(); }
/** * Write an LDAP record into LDIF file as LDAPContent data. * * <p>You are not allowed to mix request data and content data</p> * * @param entry LDAPEntry object * * @throws IOException if an I/O error occurs. * * @see com.novell.ldap.LDAPEntry */ public void writeEntry(LDAPEntry entry) throws IOException { writeEntry(entry, new LDAPControl[]{}); return; }
/** * Write attribute name and value into outputStream. * * <p>Check if attrVal starts with NUL, LF, CR, ' ', ':', or '<' * or contains any NUL, LF, or CR, and then write it out</p> */ private void writeAttribute(String attrName, String attrVal) throws IOException { if (attrVal != null) { writeLine( Base64.isLDIFSafe(attrVal)? attrName + ": " + attrVal : attrName + ":: " + Base64.encode(attrVal) ); } return; }
/** * Retrieves the optional requestID attribute on a BatchRequests. * @return requestID on a batchRequest or <tt>null</tt> if requestID is not * specified or the content is in a batchResponse. */ public String getBatchRequestID(){ return this.handler.getBatchRequestID(); }