| | |
| | | |
| | | |
| | | // The mapping between entry DNs and the corresponding entries. |
| | | private final ConcurrentHashMap<DN, SearchResultEntry> entryMap = new ConcurrentHashMap<DN, SearchResultEntry>(); |
| | | private final ConcurrentHashMap<DN, Entry> entryMap = new ConcurrentHashMap<DN, Entry>(); |
| | | |
| | | // The grizzly transport. |
| | | private final TCPNIOTransport transport = TransportFactory.getInstance() |
| | |
| | | private LDAPServer() |
| | | { |
| | | // Add the root dse first. |
| | | entryMap.put(DN.rootDN(), Responses.newSearchResultEntry(DN.rootDN())); |
| | | entryMap.put(DN.rootDN(), Types.unmodifiableEntry(new LinkedHashMapEntry())); |
| | | for (int i = 0; i < 1000; i++) |
| | | { |
| | | final String dn = String.format("uid=user.%d,ou=people,o=test", i); |
| | |
| | | final String uid = String.format("uid: user.%d", i); |
| | | |
| | | final DN d = DN.valueOf(dn); |
| | | final SearchResultEntry e = Responses.newSearchResultEntry("dn: " + dn, |
| | | final Entry e = new LinkedHashMapEntry("dn: " + dn, |
| | | "objectclass: person", "objectclass: inetorgperson", |
| | | "objectclass: top", cn, sn, uid); |
| | | entryMap.put(d, e); |
| | | entryMap.put(d, Types.unmodifiableEntry(e)); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | // Get the entry. |
| | | final SearchResultEntry entry = entryMap.get(dn); |
| | | final Entry entry = entryMap.get(dn); |
| | | final AttributeDescription attrDesc = request.getAttributeDescription(); |
| | | for (final Attribute attr : entry.getAllAttributes(attrDesc)) |
| | | { |
| | |
| | | return; |
| | | } |
| | | |
| | | final SearchResultEntry e = entryMap.get(dn); |
| | | final SearchResultEntry e = Responses.newSearchResultEntry( |
| | | new LinkedHashMapEntry(entryMap.get(dn))); |
| | | // Check we have had any controls in the request. |
| | | for (final Control control : request.getControls()) |
| | | { |
| | |
| | | * @param port |
| | | * @exception IOException |
| | | */ |
| | | public void start(final int port) throws IOException |
| | | public synchronized void start(final int port) throws IOException |
| | | { |
| | | if (isRunning) |
| | | { |
| | |
| | | /** |
| | | * Stops the server. |
| | | */ |
| | | public void stop() |
| | | public synchronized void stop() |
| | | { |
| | | if (!isRunning) |
| | | { |