public static DirectoryVendor determineDirectoryVendor ( final ChaiEntry rootDSE ) throws ChaiUnavailableException , ChaiOperationException { final Set < String > interestedAttributes = new HashSet <> ( ) ; for ( final DirectoryVendor directoryVendor : DirectoryVendor . values ( ) ) { interestedAttributes . addAll ( directoryVendor . getVendorFactory ( ) . interestedDseAttributes ( ) ) ; } final SearchHelper searchHelper = new SearchHelper ( ) ; searchHelper . setAttributes ( interestedAttributes . toArray ( new String [ interestedAttributes . size ( ) ] ) ) ; searchHelper . setFilter ( "(objectClass=*)" ) ; searchHelper . setMaxResults ( 1 ) ; searchHelper . setSearchScope ( SearchScope . BASE ) ; final Map < String , Map < String , List < String > > > results = rootDSE . getChaiProvider ( ) . searchMultiValues ( "" , searchHelper ) ; if ( results != null && ! results . isEmpty ( ) ) { final Map < String , List < String > > rootDseSearchResults = results . values ( ) . iterator ( ) . next ( ) ; for ( final DirectoryVendor directoryVendor : DirectoryVendor . values ( ) ) { if ( directoryVendor . getVendorFactory ( ) . detectVendorFromRootDSEData ( rootDseSearchResults ) ) { return directoryVendor ; } } } return DirectoryVendor . GENERIC ; }
Determines the vendor of a the ldap directory by reading RootDSE attributes .