*/
private static IEntry createAndCacheEntry( IBrowserConnection browserConnection, LdapDN dn,
StudioProgressMonitor monitor )
{
StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );
IEntry entry = null;
// build tree to parent
LinkedList<LdapDN> parentDnList = new LinkedList<LdapDN>();
LdapDN parentDN = dn;
while ( parentDN != null && browserConnection.getEntryFromCache( parentDN ) == null )
{
parentDnList.addFirst( parentDN );
parentDN = DnUtils.getParent( parentDN );
}
for ( LdapDN aDN : parentDnList )
{
parentDN = DnUtils.getParent( aDN );
if ( parentDN == null )
{
// only the root DSE has a null parent
entry = browserConnection.getRootDSE();
}
else if ( !parentDN.isEmpty() && browserConnection.getEntryFromCache( parentDN ) != null )
{
// a normal entry has a parent but the parent isn't the rootDSE
IEntry parentEntry = browserConnection.getEntryFromCache( parentDN );
entry = new Entry( parentEntry, aDN.getRdn() );
entry.setDirectoryEntry( true );
parentEntry.addChild( entry );
parentEntry.setChildrenInitialized( true );
parentEntry.setHasMoreChildren( true );
parentEntry.setHasChildrenHint( true );
browserConnection.cacheEntry( entry );
}
else
{
// we have a base DN, check if the entry really exists in LDAP