You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2007/07/05 22:35:15 UTC
svn commit: r553626 - in
/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core:
internal/model/ jobs/ model/
Author: seelmann
Date: Thu Jul 5 13:35:14 2007
New Revision: 553626
URL: http://svn.apache.org/viewvc?view=rev&rev=553626
Log:
Workaround for DIRSTUDIO-143. Using filter (|(objectClass=subentry)(objectClass=ldapSubentry)) when requesting subentries.
Modified:
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionSearchHandler.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesJob.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenJob.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java?view=diff&rev=553626&r1=553625&r2=553626
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java Thu Jul 5 13:35:14 2007
@@ -404,6 +404,9 @@
modifyHandler.connectionClosed();
searchHandler.connectionClosed();
+ this.rootDSE = null;
+ this.schema = Schema.DEFAULT_SCHEMA;
+
EventRegistry.fireConnectionUpdated( new ConnectionUpdateEvent( this,
ConnectionUpdateEvent.EventDetail.CONNECTION_CLOSED ), this );
System.gc();
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionSearchHandler.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionSearchHandler.java?view=diff&rev=553626&r1=553625&r2=553626
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionSearchHandler.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/ConnectionSearchHandler.java Thu Jul 5 13:35:14 2007
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.studio.ldapbrowser.core.internal.model;
@@ -167,7 +167,7 @@
initFlags( entry, record, searchParameter );
// fill the attributes
- fillAttributes( entry, record, searchParameter );
+ fillAttributes( entry, record, search.getSearchParameter() );
searchResultList
.add( new org.apache.directory.studio.ldapbrowser.core.internal.model.SearchResult(
@@ -338,8 +338,9 @@
}
- if ( search.getControls() != null
+ if ( ( search.getControls() != null
&& Arrays.asList( search.getControls() ).contains( Control.SUBENTRIES_CONTROL ) )
+ || ISearch.FILTER_SUBENTRY.equalsIgnoreCase( search.getFilter() ) )
{
entry.setSubentry( true );
entry.setHasChildrenHint( false );
@@ -464,7 +465,7 @@
if ( search.getReturningAttributes() != null )
{
String[] ras = search.getReturningAttributes();
-
+
// special case *
if( Arrays.asList( ras ).contains( ISearch.ALL_USER_ATTRIBUTES ) )
{
@@ -484,7 +485,7 @@
}
}
}
-
+
// special case +
if( Arrays.asList( ras ).contains( ISearch.ALL_OPERATIONAL_ATTRIBUTES ) )
{
@@ -504,8 +505,8 @@
}
}
}
-
-
+
+
for ( int r = 0; r < ras.length; r++ )
{
// clear attributes requested from server, also include subtypes
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesJob.java?view=diff&rev=553626&r1=553625&r2=553626
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeAttributesJob.java Thu Jul 5 13:35:14 2007
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.studio.ldapbrowser.core.jobs;
@@ -34,6 +34,7 @@
import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
import org.apache.directory.studio.ldapbrowser.core.model.IConnection;
import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+import org.apache.directory.studio.ldapbrowser.core.model.IRootDSE;
import org.apache.directory.studio.ldapbrowser.core.model.ISearch;
import org.apache.directory.studio.ldapbrowser.core.model.schema.AttributeTypeDescription;
import org.apache.directory.studio.ldapbrowser.core.model.schema.SchemaUtils;
@@ -153,14 +154,34 @@
// entry.setAttributesInitialized(false, entry.getConnection());
- // search
- ISearch search = new Search( null, entry.getConnection(), entry.getDn(), ISearch.FILTER_TRUE, attributes,
- ISearch.SCOPE_OBJECT, 0, 0, IConnection.DEREFERENCE_ALIASES_NEVER, IConnection.HANDLE_REFERRALS_IGNORE,
- false, false, null );
- entry.getConnection().search( search, monitor );
-
- // set initialized state
- entry.setAttributesInitialized( true );
+ if ( entry instanceof IRootDSE )
+ {
+ IEntry[] oldChildren = entry.getChildren();
+ for ( int i = 0; oldChildren != null && i < oldChildren.length; i++ )
+ {
+ if ( oldChildren[i] != null )
+ {
+ entry.deleteChild( oldChildren[i] );
+ }
+ }
+ entry.setChildrenInitialized( false );
+
+ // special handling for Root DSE
+ entry.getConnection().fetchRootDSE( monitor );
+ entry.setAttributesInitialized( true );
+ entry.setChildrenInitialized( true );
+ }
+ else
+ {
+ // search
+ ISearch search = new Search( null, entry.getConnection(), entry.getDn(), entry.isSubentry()?ISearch.FILTER_SUBENTRY:ISearch.FILTER_TRUE, attributes,
+ ISearch.SCOPE_OBJECT, 0, 0, IConnection.DEREFERENCE_ALIASES_NEVER, IConnection.HANDLE_REFERRALS_IGNORE,
+ false, false, null );
+ entry.getConnection().search( search, monitor );
+
+ // set initialized state
+ entry.setAttributesInitialized( true );
+ }
}
}
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenJob.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenJob.java?view=diff&rev=553626&r1=553625&r2=553626
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenJob.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/InitializeChildrenJob.java Thu Jul 5 13:35:14 2007
@@ -6,16 +6,16 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
- *
+ * under the License.
+ *
*/
package org.apache.directory.studio.ldapbrowser.core.jobs;
@@ -117,32 +117,28 @@
public static void initializeChildren( IEntry parent, ExtendedProgressMonitor monitor )
{
- monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_sub,
- new String[]
- { parent.getDn().toString() } ) );
-
- // clear old children
- IEntry[] oldChildren = parent.getChildren();
- for ( int i = 0; oldChildren != null && i < oldChildren.length; i++ )
- {
- if ( oldChildren[i] != null )
- {
- parent.deleteChild( oldChildren[i] );
- }
- }
- parent.setChildrenInitialized( false );
-
if ( parent instanceof IRootDSE )
{
- // special handling for Root DSE
- //parent.setChildrenInitialized( true );
- //return;
- parent.getConnection().fetchRootDSE( monitor );
- parent.setChildrenInitialized( true );
+ // special handling for Root DSE
return;
}
else
{
+ monitor.reportProgress( BrowserCoreMessages.bind( BrowserCoreMessages.jobs__init_entries_progress_sub,
+ new String[]
+ { parent.getDn().toString() } ) );
+
+ // clear old children
+ IEntry[] oldChildren = parent.getChildren();
+ for ( int i = 0; oldChildren != null && i < oldChildren.length; i++ )
+ {
+ if ( oldChildren[i] != null )
+ {
+ parent.deleteChild( oldChildren[i] );
+ }
+ }
+ parent.setChildrenInitialized( false );
+
// determine alias and referral handling
int scope = ISearch.SCOPE_ONELEVEL;
int derefAliasMethod = parent.getConnection().getAliasesDereferencingMethod();
@@ -156,7 +152,7 @@
handleReferralsMethod = parent.isReferral() ? IConnection.HANDLE_REFERRALS_FOLLOW
: IConnection.HANDLE_REFERRALS_IGNORE;
}
-
+
// get children,
ISearch search = new Search( null, parent.getConnection(), parent.getDn(), parent.getChildrenFilter(),
ISearch.NO_ATTRIBUTES, scope, parent.getConnection().getCountLimit(),
@@ -173,7 +169,7 @@
// fill children in search result
if ( srs != null && srs.length > 0 )
{
-
+
/*
* clearing old children before filling new subenties is
* necessary to handle aliases and referrals.
@@ -187,7 +183,7 @@
}
}
parent.setChildrenInitialized( false );
-
+
for ( int i = 0; srs != null && i < srs.length; i++ )
{
if ( parent.isReferral() )
@@ -216,9 +212,9 @@
{
parent.setHasChildrenHint( false );
}
-
+
// get subentries
- ISearch subSearch = new Search( null, parent.getConnection(), parent.getDn(), parent.getChildrenFilter(),
+ ISearch subSearch = new Search( null, parent.getConnection(), parent.getDn(), parent.getChildrenFilter()!=null?parent.getChildrenFilter():ISearch.FILTER_SUBENTRY,
ISearch.NO_ATTRIBUTES, scope, parent.getConnection().getCountLimit(),
parent.getConnection().getTimeLimit(), derefAliasMethod, handleReferralsMethod, BrowserCorePlugin
.getDefault().getPluginPreferences().getBoolean( BrowserCoreConstants.PREFERENCE_CHECK_FOR_CHILDREN ),
@@ -237,22 +233,21 @@
// fill children in search result
if ( subSrs != null && subSrs.length > 0 )
{
-
+
for ( int i = 0; subSrs != null && i < subSrs.length; i++ )
{
parent.addChild( subSrs[i].getEntry() );
}
}
}
-
+
// check exceeded limits / canceled
parent.setHasMoreChildren( search.isCountLimitExceeded() || subSearch.isCountLimitExceeded()
|| monitor.isCanceled() );
+
+ // set initialized state
+ parent.setChildrenInitialized( true );
}
-
- // set initialized state
- parent.setChildrenInitialized( true );
-
}
}
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java?view=diff&rev=553626&r1=553625&r2=553626
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java Thu Jul 5 13:35:14 2007
@@ -56,6 +56,9 @@
/** False filter (!(objectClass=*)) */
public static final String FILTER_FALSE = "(!(objectClass=*))"; //$NON-NLS-1$
+ /** Filter for fetching subentries (|(objectClass=subentry)(objectClass=ldapSubentry)) */
+ public static final String FILTER_SUBENTRY = "(|(objectClass=subentry)(objectClass=ldapSubentry))"; //$NON-NLS-1$
+
/** Search scope object */
public static final int SCOPE_OBJECT = 0;