* the local cache with cached LDAP information
* @return a <code>SelectedObjectStructures</code> instance holding the cached structure
* information.
*/
public SelectedObjectStructures getModelStructures(SelectedObjectClasses classes, LdapStructureServerCache ldapCache) {
SelectedObjectStructures structures = new SelectedObjectStructures(classes);
DefaultClassStructureRetrieverCallback callback = new DefaultClassStructureRetrieverCallback();
ObjectClassStructureRetriever retriever = new ObjectClassStructureRetriever();
retriever.setLdapCache(ldapCache);
retriever.retrieveStructures(
classes.getClassDefinitionOids(),
classes.getLdapLocation(),
callback,
true,
new DummyWaitService() /* TODO: Use a real WaitService */);
ObjectClassStructure[] structs = callback.getStructures();
if (structs == null) {
// Happens if there is an error on the server side, e.g. the user credentials
// specified in the LDAP target are wrong
return null;
}
for (ObjectClassStructure struct : structs) {
structures.addStructure(struct.getOid(), struct);
}
return structures;
}