Le 16/09/15 10:46, Radovan Semancik a écrit :
> Hi,
>
> I agree, of course.
>
> Just a bit more information. Currently there is a way how to do this
> ... kind of ...
>
> boolean schemaQuirksMode = ....
> DefaultSchemaLoader schemaLoader = new
> DefaultSchemaLoader(connection, schemaQuirksMode);
> DefaultSchemaManager schemaManager = new
> DefaultSchemaManager(schemaLoader);
> try {
> if (schemaQuirksMode) {
> schemaManager.setRelaxed();
> schemaManager.loadAllEnabledRelaxed();
> } else {
> schemaManager.loadAllEnabled();
> }
> } catch (Exception e) {
> throw new ConnectorIOException(e.getMessage(), e);
> }
> if ( !schemaManager.getErrors().isEmpty() ) {
> if (schemaQuirksMode) {
> LOG.ok("There are {0} schema errors, but we
> are in quirks mode so we are ignoring them",
> defSchemaManager.getErrors().size());
> for (Throwable error:
> schemaManager.getErrors()) {
> LOG.ok("Schema error (ignored): {0}: {1}",
> error.getClass().getName(), error.getMessage());
> }
> } else {
> throw new ConnectorIOException("Errors loading
> schema "+schemaManager.getErrors());
> }
> }
I know come with a much simpler code to do teh same thing :
LdapConnection ldapConnection = new LdapNetworkConnection(
serverName, serverPort );
ldapConnection.loadSchemaRelaxed();
And that's it ! The SchemaManager can be taken from the ldapConnection,
it contains whatever the loader was able to load...