| | |
| | | public LDIFReader(LDIFImportConfig importConfig) |
| | | throws IOException |
| | | { |
| | | |
| | | ensureNotNull(importConfig); |
| | | this.importConfig = importConfig; |
| | | |
| | |
| | | public Entry readEntry() |
| | | throws IOException, LDIFException |
| | | { |
| | | |
| | | return readEntry(importConfig.validateSchema()); |
| | | } |
| | | |
| | |
| | | public Entry readEntry(boolean checkSchema) |
| | | throws IOException, LDIFException |
| | | { |
| | | |
| | | |
| | | while (true) |
| | | { |
| | | // Read the set of lines that make up the next entry. |
| | |
| | | public ChangeRecordEntry readChangeRecord(boolean defaultAdd) |
| | | throws IOException, LDIFException |
| | | { |
| | | |
| | | while (true) |
| | | { |
| | | // Read the set of lines that make up the next entry. |
| | |
| | | private LinkedList<StringBuilder> readEntryLines() |
| | | throws IOException, LDIFException |
| | | { |
| | | |
| | | // Read the entry lines into a buffer. |
| | | LinkedList<StringBuilder> lines = new LinkedList<StringBuilder>(); |
| | | int lastLine = -1; |
| | |
| | | private DN readDN(LinkedList<StringBuilder> lines) |
| | | throws LDIFException |
| | | { |
| | | |
| | | if (lines.isEmpty()) |
| | | { |
| | | // This is possible if the contents of the first "entry" were just |
| | |
| | | private String readChangeType(LinkedList<StringBuilder> lines) |
| | | throws LDIFException |
| | | { |
| | | |
| | | if (lines.isEmpty()) |
| | | { |
| | | // Error. There must be other entries. |
| | |
| | | HashMap<AttributeType,List<Attribute>> operationalAttributes) |
| | | throws LDIFException |
| | | { |
| | | |
| | | // Parse the attribute type description. |
| | | int colonPos = parseColonPosition(lines, line); |
| | | String attrDescr = line.substring(0, colonPos); |
| | |
| | | LinkedList<StringBuilder> lines, StringBuilder line, DN entryDN, |
| | | String attributeName) throws LDIFException |
| | | { |
| | | |
| | | // Parse the attribute type description. |
| | | int colonPos = parseColonPosition(lines, line); |
| | | String attrDescr = line.substring(0, colonPos); |
| | |
| | | */ |
| | | public long getLastEntryLineNumber() |
| | | { |
| | | |
| | | return lastEntryLineNumber; |
| | | } |
| | | |
| | |
| | | */ |
| | | public void rejectLastEntry(String message) |
| | | { |
| | | |
| | | entriesRejected++; |
| | | |
| | | BufferedWriter rejectWriter = importConfig.getRejectWriter(); |
| | |
| | | */ |
| | | public void close() |
| | | { |
| | | |
| | | importConfig.close(); |
| | | } |
| | | |
| | |
| | | */ |
| | | private static Attribute parseAttrDescription(String attrDescr) |
| | | { |
| | | |
| | | String attrName; |
| | | String lowerName; |
| | | LinkedHashSet<String> options; |
| | |
| | | */ |
| | | public long getEntriesRead() |
| | | { |
| | | |
| | | return entriesRead; |
| | | } |
| | | |
| | |
| | | */ |
| | | public long getEntriesIgnored() |
| | | { |
| | | |
| | | return entriesIgnored; |
| | | } |
| | | |
| | |
| | | */ |
| | | public long getEntriesRejected() |
| | | { |
| | | |
| | | return entriesRejected; |
| | | } |
| | | |
| | |
| | | DN entryDN, |
| | | String attributeName) throws LDIFException |
| | | { |
| | | |
| | | Attribute attr = |
| | | readSingleValueAttribute(lines, line, entryDN, attributeName); |
| | | LinkedHashSet<AttributeValue> values = attr.getValues(); |