use of com.novell.ldapchai.impl.generic.entry.GenericEntryFactory in project ldapchai by ldapchai.
the class ChaiUtility method getRootDSE.
public static ChaiEntry getRootDSE(final ChaiProvider provider) throws ChaiUnavailableException {
final List<String> splitUrls = provider.getChaiConfiguration().bindURLsAsList();
final StringBuilder newUrlConfig = new StringBuilder();
boolean currentURLsHavePath = false;
for (final String splitUrl : splitUrls) {
final URI uri = URI.create(splitUrl);
final String newURI = uri.getScheme() + "://" + uri.getHost() + ":" + uri.getPort();
newUrlConfig.append(newURI);
if (uri.getPath() != null && uri.getPath().length() > 0) {
currentURLsHavePath = true;
}
newUrlConfig.append(",");
}
final ChaiConfiguration rootDSEChaiConfig = ChaiConfiguration.builder(provider.getChaiConfiguration()).setSetting(ChaiSetting.BIND_URLS, newUrlConfig.toString()).build();
final ChaiProvider rootDseProvider = currentURLsHavePath ? provider.getProviderFactory().newProvider(rootDSEChaiConfig) : provider;
// can not call the VendorFactory here, because VendorFactory in turn calls this method to get the
// directory vendor. Instead, we will go directly to the Generic VendorFactory
final GenericEntryFactory genericEntryFactory = new GenericEntryFactory();
return genericEntryFactory.newChaiEntry("", rootDseProvider);
}
Aggregations