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/10/27 15:22:26 UTC
svn commit: r589094 [1/2] - in /directory/studio/trunk:
studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/
studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/searc...
Author: seelmann
Date: Sat Oct 27 06:22:25 2007
New Revision: 589094
URL: http://svn.apache.org/viewvc?rev=589094&view=rev
Log:
Code cleaning and Javadoc.
Modified:
directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/BrowserSelectionUtils.java
directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/SearchPageWrapper.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ISearch.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AliasBaseEntry.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AttributeInfo.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Bookmark.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ChildrenInfo.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Search.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/SearchResult.java
directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Value.java
Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/BrowserSelectionUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/BrowserSelectionUtils.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/BrowserSelectionUtils.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/actions/BrowserSelectionUtils.java Sat Oct 27 06:22:25 2007
@@ -131,19 +131,19 @@
else if ( obj instanceof IEntry )
{
IEntry entry = ( IEntry ) obj;
- exampleSearch.setConnection( entry.getBrowserConnection() );
+ exampleSearch.setBrowserConnection( entry.getBrowserConnection() );
exampleSearch.setSearchBase( entry.getDn() );
}
else if ( obj instanceof ISearchResult )
{
ISearchResult searchResult = ( ISearchResult ) obj;
- exampleSearch.setConnection( searchResult.getEntry().getBrowserConnection() );
+ exampleSearch.setBrowserConnection( searchResult.getEntry().getBrowserConnection() );
exampleSearch.setSearchBase( searchResult.getEntry().getDn() );
}
else if ( obj instanceof IBookmark )
{
IBookmark bookmark = ( IBookmark ) obj;
- exampleSearch.setConnection( bookmark.getBrowserConnection() );
+ exampleSearch.setBrowserConnection( bookmark.getBrowserConnection() );
exampleSearch.setSearchBase( bookmark.getDn() );
}
@@ -187,7 +187,7 @@
}
}
- exampleSearch.setConnection( entry.getBrowserConnection() );
+ exampleSearch.setBrowserConnection( entry.getBrowserConnection() );
exampleSearch.setSearchBase( entry.getDn() );
StringBuffer filter = new StringBuffer();
if ( filterSet.size() > 1 )
@@ -213,7 +213,7 @@
else if ( obj instanceof IBrowserConnection )
{
IBrowserConnection connection = ( IBrowserConnection ) obj;
- exampleSearch.setConnection( connection );
+ exampleSearch.setBrowserConnection( connection );
if ( connection.getRootDSE().getChildrenCount() > 0 )
{
exampleSearch.setSearchBase( connection.getRootDSE().getChildren()[0].getDn() );
@@ -226,7 +226,7 @@
else if ( obj instanceof BrowserCategory )
{
BrowserCategory cat = ( BrowserCategory ) obj;
- exampleSearch.setConnection( cat.getParent() );
+ exampleSearch.setBrowserConnection( cat.getParent() );
if ( cat.getParent().getRootDSE().getChildrenCount() > 0 )
{
exampleSearch.setSearchBase( cat.getParent().getRootDSE().getChildren()[0].getDn() );
Modified: directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/SearchPageWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/SearchPageWrapper.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/SearchPageWrapper.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/widgets/search/SearchPageWrapper.java Sat Oct 27 06:22:25 2007
@@ -652,7 +652,7 @@
if ( browserConnectionWidget != null && browserConnectionWidget.getBrowserConnection() != null
&& browserConnectionWidget.getBrowserConnection() != search.getBrowserConnection() )
{
- search.setConnection( browserConnectionWidget.getBrowserConnection() );
+ search.setBrowserConnection( browserConnectionWidget.getBrowserConnection() );
searchModified = true;
}
if ( searchBaseWidget != null && searchBaseWidget.getDn() != null
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?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- 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 Sat Oct 27 06:22:25 2007
@@ -365,13 +365,13 @@
/**
- * Sets the connection.
+ * Sets the browser connection.
*
* Calling this method causes firing a search update event.
*
- * @param connection the connection
+ * @param browserConnection the browser connection
*/
- public abstract void setConnection( IBrowserConnection connection );
+ public abstract void setBrowserConnection( IBrowserConnection browserConnection );
/**
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java Sat Oct 27 06:22:25 2007
@@ -24,7 +24,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
@@ -55,6 +54,11 @@
/**
* Base implementation of the {@link IEntry} interface.
+ *
+ * The class is optimized to save memory. It doesn't hold members to
+ * its children or attributes. Instead the {@link ChildrenInfo} and
+ * {@link AttributeInfo} instances are stored in a map in the
+ * {@link BrowserConnection} instance.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
@@ -62,79 +66,98 @@
public abstract class AbstractEntry implements IEntry
{
- public static final int HAS_CHILDREN_HINT_FLAG = 1;
+ private static final int HAS_CHILDREN_HINT_FLAG = 1;
- public static final int IS_DIRECTORY_ENTRY_FLAG = 2;
+ private static final int IS_DIRECTORY_ENTRY_FLAG = 2;
- public static final int IS_ALIAS_FLAG = 4;
+ private static final int IS_ALIAS_FLAG = 4;
- public static final int IS_REFERRAL_FLAG = 8;
+ private static final int IS_REFERRAL_FLAG = 8;
- public static final int IS_SUBENTRY_FLAG = 16;
+ private static final int IS_SUBENTRY_FLAG = 16;
private volatile int flags;
+ /**
+ * Creates a new instance of AbstractEntry.
+ */
protected AbstractEntry()
{
this.flags = HAS_CHILDREN_HINT_FLAG;
}
+ /**
+ * Sets the parent entry.
+ *
+ * @param newParent the new parent entry
+ */
protected abstract void setParent( IEntry newParent );
+ /**
+ * Sets the RDN.
+ *
+ * @param newRdn the new RDN
+ */
protected abstract void setRdn( RDN newRdn );
+ /**
+ * {@inheritDoc}
+ */
public void addChild( IEntry childToAdd )
{
-
- ChildrenInfo ci = this.getJNDIConnection().getChildrenInfo( this );
+ ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
if ( ci == null )
{
ci = new ChildrenInfo();
- this.getJNDIConnection().setChildrenInfo( this, ci );
+ getBrowserConnectionImpl().setChildrenInfo( this, ci );
}
if ( ci.childrenSet == null )
{
- ci.childrenSet = new LinkedHashSet();
+ ci.childrenSet = new LinkedHashSet<IEntry>();
}
ci.childrenSet.add( childToAdd );
- this.entryModified( new EntryAddedEvent( childToAdd.getBrowserConnection(), childToAdd ) );
+ entryModified( new EntryAddedEvent( childToAdd.getBrowserConnection(), childToAdd ) );
}
+ /**
+ * {@inheritDoc}
+ */
public void deleteChild( IEntry childToDelete )
{
-
- ChildrenInfo ci = this.getJNDIConnection().getChildrenInfo( this );
+ ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
if ( ci != null )
{
ci.childrenSet.remove( childToDelete );
if ( ci.childrenSet == null || ci.childrenSet.isEmpty() )
{
- this.getJNDIConnection().setChildrenInfo( this, null );
+ getBrowserConnectionImpl().setChildrenInfo( this, null );
}
- this.entryModified( new EntryDeletedEvent( this.getJNDIConnection(), childToDelete ) );
+ entryModified( new EntryDeletedEvent( getBrowserConnectionImpl(), childToDelete ) );
}
}
+ /**
+ * {@inheritDoc}
+ */
public void addAttribute( IAttribute attributeToAdd ) throws IllegalArgumentException
{
String oidString = attributeToAdd.getAttributeDescription().toOidString( getBrowserConnection().getSchema() );
-
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai == null )
{
ai = new AttributeInfo();
- this.getJNDIConnection().setAttributeInfo( this, ai );
+ getBrowserConnectionImpl().setAttributeInfo( this, ai );
}
- if ( !this.equals( attributeToAdd.getEntry() ) )
+ if ( !equals( attributeToAdd.getEntry() ) )
{
throw new IllegalArgumentException( BrowserCoreMessages.model__attributes_entry_is_not_myself );
}
@@ -145,24 +168,27 @@
else
{
ai.attributeMap.put( oidString.toLowerCase(), attributeToAdd );
- this.entryModified( new AttributeAddedEvent( this.getJNDIConnection(), this, attributeToAdd ) );
+ entryModified( new AttributeAddedEvent( getBrowserConnectionImpl(), this, attributeToAdd ) );
}
}
+ /**
+ * {@inheritDoc}
+ */
public void deleteAttribute( IAttribute attributeToDelete ) throws IllegalArgumentException
{
String oidString = attributeToDelete.getAttributeDescription().toOidString( getBrowserConnection().getSchema() );
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai != null && ai.attributeMap != null && ai.attributeMap.containsKey( oidString.toLowerCase() ) )
{
IAttribute attribute = ( IAttribute ) ai.attributeMap.get( oidString.toLowerCase() );
ai.attributeMap.remove( oidString.toLowerCase() );
if ( ai.attributeMap.isEmpty() )
{
- this.getJNDIConnection().setAttributeInfo( this, null );
+ getBrowserConnectionImpl().setAttributeInfo( this, null );
}
- this.entryModified( new AttributeDeletedEvent( this.getJNDIConnection(), this, attribute ) );
+ entryModified( new AttributeDeletedEvent( getBrowserConnectionImpl(), this, attribute ) );
}
else
{
@@ -171,10 +197,12 @@
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isConsistent()
{
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
-
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai == null || ai.attributeMap == null )
{
return isDirectoryEntry();
@@ -182,15 +210,15 @@
// check empty attributes and empty values
Map<String, IAttribute> aiAttributeMap = new HashMap<String, IAttribute>( ai.attributeMap );
- Iterator attributeIterator = aiAttributeMap.values().iterator();
- while ( attributeIterator.hasNext() )
+ for ( IAttribute attribute : aiAttributeMap.values() )
{
- IAttribute attribute = ( IAttribute ) attributeIterator.next();
if ( !attribute.isConsistent() )
+ {
return false;
+ }
}
- if ( !this.isDirectoryEntry() )
+ if ( !isDirectoryEntry() )
{
// check objectclass attribute
if ( !ai.attributeMap.containsKey( IAttribute.OBJECTCLASS_ATTRIBUTE_OID.toLowerCase() ) )
@@ -203,7 +231,7 @@
boolean structuralObjectClassAvailable = false;
for ( int i = 0; i < ocValues.length; i++ )
{
- ObjectClassDescription ocd = this.getBrowserConnection().getSchema().getObjectClassDescription( ocValues[i] );
+ ObjectClassDescription ocd = getBrowserConnection().getSchema().getObjectClassDescription( ocValues[i] );
if ( ocd.isStructural() )
{
structuralObjectClassAvailable = true;
@@ -216,18 +244,13 @@
}
// check must-attributes
- // String[] mustAttributeNames =
- // this.getSubschema().getMustAttributeNames();
- // for(int i=0; i<mustAttributeNames.length; i++) {
- // if(!ai.attributeMap.containsKey(mustAttributeNames[i].toLowerCase()))
- // return false;
- // }
- AttributeTypeDescription[] mustAtds = this.getSubschema().getMustAttributeTypeDescriptions();
- for ( int i = 0; i < mustAtds.length; i++ )
+ AttributeTypeDescription[] mustAtds = getSubschema().getMustAttributeTypeDescriptions();
+ for ( AttributeTypeDescription mustAtd : mustAtds )
{
- AttributeTypeDescription mustAtd = mustAtds[i];
if ( !ai.attributeMap.containsKey( mustAtd.getNumericOID().toLowerCase() ) )
+ {
return false;
+ }
}
}
@@ -235,99 +258,136 @@
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isDirectoryEntry()
{
- return ( this.flags & IS_DIRECTORY_ENTRY_FLAG ) != 0;
+ return ( flags & IS_DIRECTORY_ENTRY_FLAG ) != 0;
}
+ /**
+ * {@inheritDoc}
+ */
public void setDirectoryEntry( boolean isDirectoryEntry )
{
if ( isDirectoryEntry )
- this.flags = this.flags | IS_DIRECTORY_ENTRY_FLAG;
+ {
+ flags = flags | IS_DIRECTORY_ENTRY_FLAG;
+ }
else
- this.flags = this.flags & ~IS_DIRECTORY_ENTRY_FLAG;
+ {
+ flags = flags & ~IS_DIRECTORY_ENTRY_FLAG;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isAlias()
{
- if ( ( this.flags & IS_ALIAS_FLAG ) != 0 )
+ if ( ( flags & IS_ALIAS_FLAG ) != 0 )
{
return true;
}
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai != null )
{
- return Arrays.asList( this.getSubschema().getObjectClassNames() )
- .contains( ObjectClassDescription.OC_ALIAS );
+ return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_ALIAS );
}
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public void setAlias( boolean b )
{
if ( b )
- this.flags = this.flags | IS_ALIAS_FLAG;
+ {
+ flags = flags | IS_ALIAS_FLAG;
+ }
else
- this.flags = this.flags & ~IS_ALIAS_FLAG;
+ {
+ flags = flags & ~IS_ALIAS_FLAG;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isReferral()
{
- if ( ( this.flags & IS_REFERRAL_FLAG ) != 0 )
+ if ( ( flags & IS_REFERRAL_FLAG ) != 0 )
{
return true;
}
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai != null )
{
- return Arrays.asList( this.getSubschema().getObjectClassNames() ).contains(
- ObjectClassDescription.OC_REFERRAL );
+ return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_REFERRAL );
}
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public void setReferral( boolean b )
{
if ( b )
- this.flags = this.flags | IS_REFERRAL_FLAG;
+ {
+ flags = flags | IS_REFERRAL_FLAG;
+ }
else
- this.flags = this.flags & ~IS_REFERRAL_FLAG;
+ {
+ flags = flags & ~IS_REFERRAL_FLAG;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isSubentry()
{
- if ( ( this.flags & IS_SUBENTRY_FLAG ) != 0 )
+ if ( ( flags & IS_SUBENTRY_FLAG ) != 0 )
{
return true;
}
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai != null )
{
- return Arrays.asList( this.getSubschema().getObjectClassNames() ).contains(
- ObjectClassDescription.OC_SUBENTRY );
+ return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_SUBENTRY );
}
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public void setSubentry( boolean b )
{
if ( b )
- this.flags = this.flags | IS_SUBENTRY_FLAG;
+ {
+ flags = flags | IS_SUBENTRY_FLAG;
+ }
else
- this.flags = this.flags & ~IS_SUBENTRY_FLAG;
+ {
+ flags = flags & ~IS_SUBENTRY_FLAG;
+ }
}
@@ -342,47 +402,58 @@
}
+ /**
+ * {@inheritDoc}
+ */
public RDN getRdn()
{
- return this.getDn().getRdn();
+ return getDn().getRdn();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isAttributesInitialized()
{
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
- return ai != null && ai.attributesInitialzed;
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
+ return ai != null && ai.attributesInitialized;
}
+ /**
+ * {@inheritDoc}
+ */
public void setAttributesInitialized( boolean b )
{
-
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai == null && b )
{
ai = new AttributeInfo();
- this.getJNDIConnection().setAttributeInfo( this, ai );
+ getBrowserConnectionImpl().setAttributeInfo( this, ai );
}
if ( ai != null )
{
- ai.attributesInitialzed = b;
+ ai.attributesInitialized = b;
}
if ( ai != null && !b )
{
ai.attributeMap.clear();
- this.getJNDIConnection().setAttributeInfo( this, null );
+ getBrowserConnectionImpl().setAttributeInfo( this, null );
}
- this.entryModified( new AttributesInitializedEvent( this ) );
+ entryModified( new AttributesInitializedEvent( this ) );
}
+ /**
+ * {@inheritDoc}
+ */
public IAttribute[] getAttributes()
{
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai == null || ai.attributeMap == null )
{
return null;
@@ -394,9 +465,12 @@
}
+ /**
+ * {@inheritDoc}
+ */
public IAttribute getAttribute( String attributeDescription )
{
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai == null || ai.attributeMap == null )
{
return null;
@@ -410,17 +484,19 @@
}
+ /**
+ * {@inheritDoc}
+ */
public AttributeHierarchy getAttributeWithSubtypes( String attributeDescription )
{
-
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai == null || ai.attributeMap == null )
{
return null;
}
else
{
- List attributeList = new ArrayList();
+ List<IAttribute> attributeList = new ArrayList<IAttribute>();
IAttribute myAttribute = getAttribute( attributeDescription );
if ( myAttribute != null )
@@ -429,12 +505,9 @@
}
AttributeDescription ad = new AttributeDescription( attributeDescription );
- Map clonedAttributeMap = new HashMap( ai.attributeMap );
- Iterator iterator = clonedAttributeMap.values().iterator();
- while ( iterator.hasNext() )
+ Map<String, IAttribute> clonedAttributeMap = new HashMap<String, IAttribute>( ai.attributeMap );
+ for ( IAttribute attribute : clonedAttributeMap.values() )
{
- IAttribute attribute = ( IAttribute ) iterator.next();
-
AttributeDescription other = attribute.getAttributeDescription();
if ( other.isSubtypeOf( ad, getBrowserConnection().getSchema() ) )
{
@@ -448,7 +521,7 @@
}
else
{
- IAttribute[] attributes = ( IAttribute[] ) attributeList.toArray( new IAttribute[attributeList.size()] );
+ IAttribute[] attributes = attributeList.toArray( new IAttribute[attributeList.size()] );
AttributeHierarchy ah = new AttributeHierarchy( this, attributeDescription, attributes );
return ah;
}
@@ -456,13 +529,16 @@
}
+ /**
+ * {@inheritDoc}
+ */
public Subschema getSubschema()
{
- AttributeInfo ai = this.getJNDIConnection().getAttributeInfo( this );
+ AttributeInfo ai = getBrowserConnectionImpl().getAttributeInfo( this );
if ( ai == null )
{
ai = new AttributeInfo();
- this.getJNDIConnection().setAttributeInfo( this, ai );
+ getBrowserConnectionImpl().setAttributeInfo( this, ai );
}
if ( ai.subschema == null )
{
@@ -473,18 +549,21 @@
}
+ /**
+ * {@inheritDoc}
+ */
public void setChildrenInitialized( boolean b )
{
- ChildrenInfo ci = this.getJNDIConnection().getChildrenInfo( this );
+ ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
if ( ci == null && b )
{
ci = new ChildrenInfo();
- this.getJNDIConnection().setChildrenInfo( this, ci );
+ getBrowserConnectionImpl().setChildrenInfo( this, ci );
}
if ( ci != null )
{
- ci.childrenInitialzed = b;
+ ci.childrenInitialized = b;
}
if ( ci != null && !b )
@@ -493,20 +572,26 @@
{
ci.childrenSet.clear();
}
- this.getJNDIConnection().setChildrenInfo( this, null );
+ getBrowserConnectionImpl().setChildrenInfo( this, null );
}
- this.entryModified( new ChildrenInitializedEvent( this ) );
+ entryModified( new ChildrenInitializedEvent( this ) );
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isChildrenInitialized()
{
- ChildrenInfo ci = this.getJNDIConnection().getChildrenInfo( this );
- return ci != null && ci.childrenInitialzed;
+ ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
+ return ci != null && ci.childrenInitialized;
}
+ /**
+ * {@inheritDoc}
+ */
public IEntry[] getChildren()
{
int count = getChildrenCount();
@@ -521,14 +606,14 @@
else
{
IEntry[] children = new IEntry[count];
- ChildrenInfo ci = this.getJNDIConnection().getChildrenInfo( this );
+ ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
int i = 0;
if ( ci.childrenSet != null )
{
- Iterator it = ci.childrenSet.iterator();
- for ( ; it.hasNext(); i++ )
+ for ( IEntry child : ci.childrenSet )
{
- children[i] = ( IEntry ) it.next();
+ children[i] = child;
+ i++;
}
}
return children;
@@ -536,13 +621,16 @@
}
+ /**
+ * {@inheritDoc}
+ */
public int getChildrenCount()
{
if ( isSubentry() )
{
return 0;
}
- ChildrenInfo ci = this.getJNDIConnection().getChildrenInfo( this );
+ ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
if ( ci == null )
{
return -1;
@@ -554,75 +642,110 @@
}
+ /**
+ * {@inheritDoc}
+ */
public void setHasMoreChildren( boolean b )
{
- ChildrenInfo ci = this.getJNDIConnection().getChildrenInfo( this );
+ ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
if ( ci == null )
{
ci = new ChildrenInfo();
- this.getJNDIConnection().setChildrenInfo( this, ci );
+ getBrowserConnectionImpl().setChildrenInfo( this, ci );
}
ci.hasMoreChildren = b;
- this.entryModified( new ChildrenInitializedEvent( this ) );
+ entryModified( new ChildrenInitializedEvent( this ) );
}
+ /**
+ * {@inheritDoc}
+ */
public boolean hasMoreChildren()
{
- ChildrenInfo ci = this.getJNDIConnection().getChildrenInfo( this );
+ ChildrenInfo ci = getBrowserConnectionImpl().getChildrenInfo( this );
return ci != null && ci.hasMoreChildren;
}
+ /**
+ * {@inheritDoc}
+ */
public void setHasChildrenHint( boolean b )
{
if ( b )
- this.flags = this.flags | HAS_CHILDREN_HINT_FLAG;
+ {
+ flags = flags | HAS_CHILDREN_HINT_FLAG;
+ }
else
- this.flags = this.flags & ~HAS_CHILDREN_HINT_FLAG;
+ {
+ flags = flags & ~HAS_CHILDREN_HINT_FLAG;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean hasChildren()
{
- return ( this.flags & HAS_CHILDREN_HINT_FLAG ) != 0 || this.getChildrenCount() > 0;
+ return ( flags & HAS_CHILDREN_HINT_FLAG ) != 0 || getChildrenCount() > 0;
}
+ /**
+ * {@inheritDoc}
+ */
public String getChildrenFilter()
{
- return this.getJNDIConnection().getChildrenFilter( this );
+ return getBrowserConnectionImpl().getChildrenFilter( this );
}
+ /**
+ * {@inheritDoc}
+ */
public void setChildrenFilter( String childrenFilter )
{
- this.getJNDIConnection().setChildrenFilter( this, childrenFilter );
+ getBrowserConnectionImpl().setChildrenFilter( this, childrenFilter );
}
+ /**
+ * {@inheritDoc}
+ */
public boolean hasParententry()
{
- return this.getParententry() != null;
+ return getParententry() != null;
}
- private BrowserConnection getJNDIConnection()
+ /**
+ * Gets the browser connection implementation.
+ *
+ * @return the browser connection implementation
+ */
+ private BrowserConnection getBrowserConnectionImpl()
{
- return ( BrowserConnection ) this.getBrowserConnection();
+ return ( BrowserConnection ) getBrowserConnection();
}
+ /**
+ * {@inheritDoc}
+ */
public String toString()
{
- return this.getDn().toString();
+ return getDn().toString();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean equals( Object o )
{
-
// check argument
if ( o == null || !( o instanceof IEntry ) )
{
@@ -631,11 +754,15 @@
IEntry e = ( IEntry ) o;
// compare dn and connection
- return this.getDn() == null ? e.getDn() == null : ( this.getDn().equals( e.getDn() ) && this.getBrowserConnection()
- .equals( e.getBrowserConnection() ) );
+ return getDn() == null ? e.getDn() == null : ( getDn().equals( e.getDn() ) && getBrowserConnection().equals(
+ e.getBrowserConnection() ) );
}
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
public Object getAdapter( Class adapter )
{
Class<?> clazz = ( Class<?> ) adapter;
@@ -649,7 +776,7 @@
}
if ( clazz.isAssignableFrom( IBrowserConnection.class ) )
{
- return this.getBrowserConnection();
+ return getBrowserConnection();
}
if ( clazz.isAssignableFrom( IEntry.class ) )
{
@@ -659,12 +786,9 @@
}
- public IEntry getEntry()
- {
- return this;
- }
-
-
+ /**
+ * {@inheritDoc}
+ */
public URL getUrl()
{
return new URL( getBrowserConnection(), getDn() );
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AliasBaseEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AliasBaseEntry.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AliasBaseEntry.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AliasBaseEntry.java Sat Oct 27 06:22:25 2007
@@ -25,6 +25,13 @@
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+/**
+ * An {@link AliasBaseEntry} represents the target
+ * (named by the aliasedObjectName attribute) of an alias entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class AliasBaseEntry extends DelegateEntry
{
@@ -36,6 +43,12 @@
}
+ /**
+ * Creates a new instance of AliasBaseEntry.
+ *
+ * @param connection the connection of the alias
+ * @param dn the DN of the alias target
+ */
public AliasBaseEntry( IBrowserConnection connection, DN dn )
{
super( connection, dn );
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AttributeInfo.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AttributeInfo.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AttributeInfo.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AttributeInfo.java Sat Oct 27 06:22:25 2007
@@ -25,26 +25,36 @@
import java.util.LinkedHashMap;
import java.util.Map;
+import org.apache.directory.studio.ldapbrowser.core.model.IAttribute;
import org.apache.directory.studio.ldapbrowser.core.model.schema.Subschema;
+/**
+ * A ChildrenInfo is used to hold the list of attributes of an entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class AttributeInfo implements Serializable
{
private static final long serialVersionUID = -298229262461058833L;
- public static int COUNTER = 0;
+ /** The attributes initialized flag. */
+ protected volatile boolean attributesInitialized = false;
- protected volatile boolean attributesInitialzed = false;
-
- protected volatile Map attributeMap = new LinkedHashMap();
+ /** The attribute map. */
+ protected volatile Map<String, IAttribute> attributeMap = new LinkedHashMap<String, IAttribute>();
+ /** The subschema. */
protected volatile Subschema subschema = null;
+ /**
+ * Creates a new instance of AttributeInfo.
+ */
public AttributeInfo()
{
- COUNTER++;
}
}
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Bookmark.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Bookmark.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Bookmark.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/Bookmark.java Sat Oct 27 06:22:25 2007
@@ -133,6 +133,7 @@
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("unchecked")
public Object getAdapter( Class adapter )
{
Class<?> clazz = ( Class<?> ) adapter;
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/BrowserConnection.java Sat Oct 27 06:22:25 2007
@@ -58,23 +58,32 @@
/** The connection. */
private Connection connection;
-
+
+ /** The root DSE. */
private IRootDSE rootDSE;
+ /** The schema. */
private Schema schema;
+ /** The search manager. */
private SearchManager searchManager;
+ /** The bookmark manager. */
private BookmarkManager bookmarkManager;
+ /** The dn to entry cache. */
private volatile Map<String, IEntry> dnToEntryCache;
+ /** The entry to children filter map. */
private volatile Map<IEntry, String> entryToChildrenFilterMap;
+ /** The entry to attribute info map. */
private volatile Map<IEntry, AttributeInfo> entryToAttributeInfoMap;
+ /** The entry to children info map. */
private volatile Map<IEntry, ChildrenInfo> entryToChildrenInfoMap;
+ /** The modification logger. */
transient ModificationLogger modificationLogger;
@@ -86,8 +95,8 @@
public BrowserConnection( org.apache.directory.studio.connection.core.Connection connection )
{
this.connection = connection;
-
- if( connection.getConnectionParameter().getExtendedProperty( CONNECTION_PARAMETER_COUNT_LIMIT ) == null )
+
+ if ( connection.getConnectionParameter().getExtendedProperty( CONNECTION_PARAMETER_COUNT_LIMIT ) == null )
{
connection.getConnectionParameter().setExtendedIntProperty( CONNECTION_PARAMETER_COUNT_LIMIT, 0 );
connection.getConnectionParameter().setExtendedIntProperty( CONNECTION_PARAMETER_TIME_LIMIT, 0 );
@@ -107,7 +116,7 @@
this.dnToEntryCache = new HashMap<String, IEntry>();
this.entryToAttributeInfoMap = new HashMap<IEntry, AttributeInfo>();
this.entryToChildrenInfoMap = new HashMap<IEntry, ChildrenInfo>();
-
+
this.schema = Schema.DEFAULT_SCHEMA;
this.rootDSE = new RootDSE( this );
cacheEntry( this.rootDSE );
@@ -116,10 +125,10 @@
ConnectionEventRegistry.addConnectionUpdateListener( this, ConnectionCorePlugin.getDefault().getEventRunner() );
}
-
-
+
+
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#getUrl()
+ * {@inheritDoc}
*/
public URL getUrl()
{
@@ -128,13 +137,13 @@
/**
- * Closes the connections, clears all caches
+ * CClears all caches.
*/
private void clearCaches()
{
for ( int i = 0; i < getSearchManager().getSearchCount(); i++ )
{
- this.getSearchManager().getSearches()[i].setSearchResults( null );
+ getSearchManager().getSearches()[i].setSearchResults( null );
}
dnToEntryCache.clear();
@@ -150,15 +159,14 @@
}
-
-
-
+ /**
+ * {@inheritDoc}
+ */
public IEntry getEntryFromCache( DN dn )
{
-
- if ( this.dnToEntryCache != null && this.dnToEntryCache.containsKey( dn.toOidString( this.schema ) ) )
+ if ( dnToEntryCache != null && dnToEntryCache.containsKey( dn.toOidString( getSchema() ) ) )
{
- return dnToEntryCache.get( dn.toOidString( this.schema ) );
+ return dnToEntryCache.get( dn.toOidString( getSchema() ) );
}
if ( getRootDSE().getDn().equals( dn ) )
{
@@ -167,10 +175,9 @@
return null;
}
-
-
+
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#isFetchBaseDNs()
+ * {@inheritDoc}
*/
public boolean isFetchBaseDNs()
{
@@ -179,7 +186,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#setFetchBaseDNs(boolean)
+ * {@inheritDoc}
*/
public void setFetchBaseDNs( boolean fetchBaseDNs )
{
@@ -189,7 +196,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#getBaseDN()
+ * {@inheritDoc}
*/
public DN getBaseDN()
{
@@ -205,7 +212,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#setBaseDN(org.apache.directory.studio.ldapbrowser.core.model.DN)
+ * {@inheritDoc}
*/
public void setBaseDN( DN baseDN )
{
@@ -215,7 +222,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#getCountLimit()
+ * {@inheritDoc}
*/
public int getCountLimit()
{
@@ -224,7 +231,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#setCountLimit(int)
+ * {@inheritDoc}
*/
public void setCountLimit( int countLimit )
{
@@ -234,7 +241,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#getAliasesDereferencingMethod()
+ * {@inheritDoc}
*/
public AliasDereferencingMethod getAliasesDereferencingMethod()
{
@@ -245,7 +252,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#setAliasesDereferencingMethod(AliasDereferencingMethod)
+ * {@inheritDoc}
*/
public void setAliasesDereferencingMethod( AliasDereferencingMethod aliasesDereferencingMethod )
{
@@ -256,7 +263,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#getReferralsHandlingMethod()
+ * {@inheritDoc}
*/
public ReferralHandlingMethod getReferralsHandlingMethod()
{
@@ -267,7 +274,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#setReferralsHandlingMethod(ReferralHandlingMethod)
+ * {@inheritDoc}
*/
public void setReferralsHandlingMethod( ReferralHandlingMethod referralsHandlingMethod )
{
@@ -278,7 +285,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#getTimeLimit()
+ * {@inheritDoc}
*/
public int getTimeLimit()
{
@@ -287,7 +294,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#setTimeLimit(int)
+ * {@inheritDoc}
*/
public void setTimeLimit( int timeLimit )
{
@@ -297,7 +304,7 @@
/**
- * @see org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection#getRootDSE()
+ * {@inheritDoc}
*/
public final IRootDSE getRootDSE()
{
@@ -305,32 +312,26 @@
}
+ /**
+ * {@inheritDoc}
+ */
public Schema getSchema()
{
return schema;
}
+ /**
+ * {@inheritDoc}
+ */
public void setSchema( Schema schema )
{
this.schema = schema;
}
-// public BrowserConnectionParameter getConnectionParameter()
-// {
-// return browserConnectionParameter;
-// }
-//
-//
-// public void setConnectionParameter( BrowserConnectionParameter connectionParameter )
-// {
-// this.browserConnectionParameter = connectionParameter;
-// }
-
-
/**
- * @see java.lang.Object#toString()
+ * This implementation returns the connection name
*/
public String toString()
{
@@ -338,32 +339,45 @@
}
+ /**
+ * {@inheritDoc}
+ */
public SearchManager getSearchManager()
{
return searchManager;
}
+ /**
+ * {@inheritDoc}
+ */
public BookmarkManager getBookmarkManager()
{
return bookmarkManager;
}
+ /**
+ * {@inheritDoc}
+ */
public ModificationLogger getModificationLogger()
{
return modificationLogger;
}
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
public Object getAdapter( Class adapter )
{
-
- if ( adapter.isAssignableFrom( ISearchPageScoreComputer.class ) )
+ Class<?> clazz = ( Class<?> ) adapter;
+ if ( clazz.isAssignableFrom( ISearchPageScoreComputer.class ) )
{
return new LdapSearchPageScoreComputer();
}
- if ( adapter == IBrowserConnection.class )
+ if ( clazz.isAssignableFrom( IBrowserConnection.class ) )
{
return this;
}
@@ -372,18 +386,29 @@
}
+ /**
+ * {@inheritDoc}
+ */
public void cacheEntry( IEntry entry )
{
- this.dnToEntryCache.put( entry.getDn().toOidString( this.schema ), entry );
+ dnToEntryCache.put( entry.getDn().toOidString( getSchema() ), entry );
}
+ /**
+ * Removes the entry from the cache.
+ *
+ * @param entry the entry to remove from cache
+ */
protected void uncacheEntry( IEntry entry )
{
- this.dnToEntryCache.remove( entry.getDn().toOidString( this.schema ) );
+ dnToEntryCache.remove( entry.getDn().toOidString( getSchema() ) );
}
-
+
+ /**
+ * {@inheritDoc}
+ */
public void uncacheEntryRecursive( IEntry entry )
{
IEntry[] children = entry.getChildren();
@@ -398,106 +423,178 @@
}
+ /**
+ * Removes the entry from the cache.
+ *
+ * @param dn the DN of the entry to remove from cache
+ */
protected void uncacheEntry( DN dn )
{
- this.dnToEntryCache.remove( dn.toOidString( this.schema ) );
+ dnToEntryCache.remove( dn.toOidString( getSchema() ) );
}
+ /**
+ * Gets the children filter of the entry.
+ *
+ * @param entry the entry
+ *
+ * @return the children filter of the entry, or null if no children filter is set
+ */
protected String getChildrenFilter( IEntry entry )
{
- return this.entryToChildrenFilterMap == null ? null : this.entryToChildrenFilterMap.get( entry );
+ return entryToChildrenFilterMap == null ? null : entryToChildrenFilterMap.get( entry );
}
+ /**
+ * Sets the children filter.
+ *
+ * @param entry the entry
+ * @param childrenFilter the children filter, null to remove the children filter
+ */
protected void setChildrenFilter( IEntry entry, String childrenFilter )
{
- if ( childrenFilter == null || "".equals( childrenFilter ) ) { //$NON-NLS-1$
- this.entryToChildrenFilterMap.remove( entry );
+ if ( childrenFilter == null || "".equals( childrenFilter ) ) //$NON-NLS-1$
+ {
+ entryToChildrenFilterMap.remove( entry );
}
else
{
- this.entryToChildrenFilterMap.put( entry, childrenFilter );
+ entryToChildrenFilterMap.put( entry, childrenFilter );
}
}
+ /**
+ * Gets the attribute info.
+ *
+ * @param entry the entry
+ *
+ * @return the attribute info, null if no attribute info exists
+ */
protected AttributeInfo getAttributeInfo( IEntry entry )
{
- return this.entryToAttributeInfoMap == null ? null : this.entryToAttributeInfoMap.get( entry );
+ return entryToAttributeInfoMap == null ? null : entryToAttributeInfoMap.get( entry );
}
+ /**
+ * Sets the attribute info.
+ *
+ * @param entry the entry
+ * @param ai the attribute info, null to remove the attribute info
+ */
protected void setAttributeInfo( IEntry entry, AttributeInfo ai )
{
if ( ai == null )
{
- this.entryToAttributeInfoMap.remove( entry );
+ entryToAttributeInfoMap.remove( entry );
}
else
{
- this.entryToAttributeInfoMap.put( entry, ai );
+ entryToAttributeInfoMap.put( entry, ai );
}
}
+ /**
+ * Gets the children info.
+ *
+ * @param entry the entry
+ *
+ * @return the children info, null if no children info exists
+ */
protected ChildrenInfo getChildrenInfo( IEntry entry )
{
- return this.entryToChildrenInfoMap == null ? null : this.entryToChildrenInfoMap.get( entry );
+ return entryToChildrenInfoMap == null ? null : entryToChildrenInfoMap.get( entry );
}
- protected void setChildrenInfo( IEntry entry, ChildrenInfo si )
+ /**
+ * Sets the children info.
+ *
+ * @param entry the entry
+ * @param ci the children info, null to remove the children info
+ */
+ protected void setChildrenInfo( IEntry entry, ChildrenInfo ci )
{
- if ( si == null )
+ if ( ci == null )
{
- this.entryToChildrenInfoMap.remove( entry );
+ entryToChildrenInfoMap.remove( entry );
}
else
{
- this.entryToChildrenInfoMap.put( entry, si );
+ entryToChildrenInfoMap.put( entry, ci );
}
}
+ /**
+ * {@inheritDoc}
+ */
public Connection getConnection()
{
return connection;
}
-
+
+
+ /**
+ * This implementation does nothing.
+ */
public void connectionAdded( org.apache.directory.studio.connection.core.Connection connection )
{
}
+
+
+ /**
+ * This implementation does nothing.
+ */
public void connectionRemoved( org.apache.directory.studio.connection.core.Connection connection )
{
}
+
+
+ /**
+ * This implementation does nothing.
+ */
public void connectionUpdated( org.apache.directory.studio.connection.core.Connection connection )
{
}
- public void connectionOpened( org.apache.directory.studio.connection.core.Connection connection )
+
+
+ /**
+ * This implementation opens the browser connection when the connection was opened.
+ */
+ public void connectionOpened( Connection connection )
{
- if(this.connection == connection)
+ if ( this.connection == connection )
{
new OpenBrowserConnectionsJob( this ).execute();
BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new BrowserConnectionUpdateEvent( this,
BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_OPENED );
- EventRegistry.fireBrowserConnectionUpdated( browserConnectionUpdateEvent , this );
+ EventRegistry.fireBrowserConnectionUpdated( browserConnectionUpdateEvent, this );
}
}
- public void connectionClosed( org.apache.directory.studio.connection.core.Connection connection )
+
+
+ /**
+ * This implementation closes the browser connection when the connection was closed.
+ */
+ public void connectionClosed( Connection connection )
{
- if(this.connection == connection)
+ if ( this.connection == connection )
{
clearCaches();
BrowserConnectionUpdateEvent browserConnectionUpdateEvent = new BrowserConnectionUpdateEvent( this,
BrowserConnectionUpdateEvent.Detail.BROWSER_CONNECTION_CLOSED );
- EventRegistry.fireBrowserConnectionUpdated( browserConnectionUpdateEvent , this );
+ EventRegistry.fireBrowserConnectionUpdated( browserConnectionUpdateEvent, this );
}
}
/**
- * @see org.apache.directory.studio.connection.core.event.ConnectionUpdateListener#connectionFolderModified(org.apache.directory.studio.connection.core.ConnectionFolder)
+ * This implementation does nothing.
*/
public void connectionFolderModified( ConnectionFolder connectionFolder )
{
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ChildrenInfo.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ChildrenInfo.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ChildrenInfo.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ChildrenInfo.java Sat Oct 27 06:22:25 2007
@@ -24,72 +24,36 @@
import java.io.Serializable;
import java.util.Set;
-import org.apache.directory.studio.ldapbrowser.core.model.DN;
-import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+import org.apache.directory.studio.ldapbrowser.core.model.IEntry;
+/**
+ * A ChildrenInfo is used to hold the list of children entries
+ * of a parent entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class ChildrenInfo implements Serializable
{
private static final long serialVersionUID = -4642987611142312896L;
- public static int COUNTER = 0;
+ /** The children initialized flag. */
+ protected volatile boolean childrenInitialized = false;
- protected volatile boolean childrenInitialzed = false;
-
- protected volatile Set childrenSet = null;
+ /** The children set. */
+ protected volatile Set<IEntry> childrenSet = null;
+ /** The has more children flag. */
protected volatile boolean hasMoreChildren = false;
+ /**
+ * Creates a new instance of ChildrenInfo.
+ */
public ChildrenInfo()
{
- COUNTER++;
- }
-
- class AliasOrReferral implements Serializable
- {
-
- private static final long serialVersionUID = -8339682035388780022L;
-
- protected IBrowserConnection connection;
-
- protected DN dn;
-
-
- protected AliasOrReferral()
- {
- }
-
-
- public AliasOrReferral( IBrowserConnection connection, DN dn )
- {
- this.connection = connection;
- this.dn = dn;
- }
-
-
- public boolean equals( Object o ) throws ClassCastException
- {
- if ( o instanceof AliasOrReferral )
- {
- return this.toString().equals( ( ( AliasOrReferral ) o ).toString() );
- }
- return false;
- }
-
-
- public int hashCode()
- {
- return this.toString().hashCode();
- }
-
-
- public String toString()
- {
- return connection.hashCode() + "_" + dn.toString(); //$NON-NLS-1$
- }
-
}
}
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DelegateEntry.java Sat Oct 27 06:22:25 2007
@@ -47,18 +47,29 @@
import org.eclipse.search.ui.ISearchPageScoreComputer;
+/**
+ * An implementation of {@link IEntry} that just holds another instance
+ * of {@link IEntry} and delegates all method calls to this instance.
+ * It is used for bookmarks, alias and referral entries.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class DelegateEntry implements IEntry, EntryUpdateListener
{
private static final long serialVersionUID = -4488685394817691963L;
- // private IConnection connection;
+ /** The connection id. */
private String connectionId;
+ /** The DN. */
private DN dn;
+ /** The entry does not exist flag. */
private boolean entryDoesNotExist;
+ /** The delegate. */
private IEntry delegate;
@@ -67,6 +78,12 @@
}
+ /**
+ * Creates a new instance of DelegateEntry.
+ *
+ * @param connection the connection of the delegate
+ * @param dn the DN of the delegate
+ */
public DelegateEntry( IBrowserConnection connection, DN dn )
{
this.connectionId = connection.getConnection().getId();
@@ -77,251 +94,420 @@
}
+ /**
+ * Gets the delegate.
+ *
+ * @return the delegate, may be null if the delegate doesn't exist.
+ */
protected IEntry getDelegate()
{
- if ( this.delegate != null && !this.delegate.getBrowserConnection().getConnection().getJNDIConnectionWrapper().isConnected() )
+ if ( delegate != null
+ && !delegate.getBrowserConnection().getConnection().getJNDIConnectionWrapper().isConnected() )
{
- this.entryDoesNotExist = false;
- this.delegate = null;
+ entryDoesNotExist = false;
+ delegate = null;
}
return delegate;
}
+ /**
+ * Sets the delegate.
+ *
+ * @param delegate the new delegate
+ */
protected void setDelegate( IEntry delegate )
{
this.delegate = delegate;
}
+ /**
+ * {@inheritDoc}
+ */
public IBrowserConnection getBrowserConnection()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getBrowserConnection();
+ }
else
- return BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnectionById( this.connectionId );
- // return connection;
+ {
+ return BrowserCorePlugin.getDefault().getConnectionManager().getBrowserConnectionById( connectionId );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public DN getDn()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getDn();
+ }
else
+ {
return dn;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public URL getUrl()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getUrl();
+ }
else
+ {
return new URL( getBrowserConnection(), getDn() );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isAttributesInitialized()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().isAttributesInitialized();
- else if ( this.entryDoesNotExist )
+ }
+ else if ( entryDoesNotExist )
+ {
return true;
+ }
else
+ {
return false;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isChildrenInitialized()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().isChildrenInitialized();
- else if ( this.entryDoesNotExist )
+ }
+ else if ( entryDoesNotExist )
+ {
return true;
+ }
else
+ {
return false;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isDirectoryEntry()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().isDirectoryEntry();
+ }
else
+ {
return true;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void addAttribute( IAttribute attributeToAdd )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().addAttribute( attributeToAdd );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void addChild( IEntry childrenToAdd )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().addChild( childrenToAdd );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void deleteAttribute( IAttribute attributeToDelete )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().deleteAttribute( attributeToDelete );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void deleteChild( IEntry childrenToDelete )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().deleteChild( childrenToDelete );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public IAttribute getAttribute( String attributeDescription )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getAttribute( attributeDescription );
+ }
else
+ {
return null;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public AttributeHierarchy getAttributeWithSubtypes( String attributeDescription )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getAttributeWithSubtypes( attributeDescription );
+ }
else
+ {
return null;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public IAttribute[] getAttributes()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getAttributes();
+ }
else
+ {
return null;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public IEntry getParententry()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getParententry();
+ }
else
+ {
return null;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public RDN getRdn()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getRdn();
+ }
else
- return this.dn.getRdn();
+ {
+ return dn.getRdn();
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public IEntry[] getChildren()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getChildren();
+ }
else
+ {
return null;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public int getChildrenCount()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getChildrenCount();
+ }
else
+ {
return -1;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public String getChildrenFilter()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getChildrenFilter();
+ }
else
+ {
return null;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public Subschema getSubschema()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().getSubschema();
+ }
else
+ {
return null;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean hasMoreChildren()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().hasMoreChildren();
+ }
else
+ {
return false;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean hasParententry()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().hasParententry();
+ }
else
+ {
return false;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean hasChildren()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().hasChildren();
+ }
else
+ {
return true;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isConsistent()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().isConsistent();
+ }
else
+ {
return true;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void setAttributesInitialized( boolean b )
{
-
if ( !b )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
{
getDelegate().setAttributesInitialized( b );
}
setDelegate( null );
- this.entryDoesNotExist = false;
+ entryDoesNotExist = false;
}
else
- /* if(b) */{
- if ( this.getDelegate() == null )
+ {
+ if ( getDelegate() == null )
{
- setDelegate( this.getBrowserConnection().getEntryFromCache( this.dn ) );
- if ( this.getDelegate() == null )
+ setDelegate( getBrowserConnection().getEntryFromCache( dn ) );
+ if ( getDelegate() == null )
{
// entry doesn't exist!
- this.entryDoesNotExist = true;
+ entryDoesNotExist = true;
}
}
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
{
getDelegate().setAttributesInitialized( b );
}
@@ -329,58 +515,79 @@
}
+ /**
+ * {@inheritDoc}
+ */
public void setDirectoryEntry( boolean b )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().setDirectoryEntry( b );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void setHasMoreChildren( boolean b )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().setHasMoreChildren( b );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void setHasChildrenHint( boolean b )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().setHasChildrenHint( b );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void setChildrenFilter( String filter )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().setChildrenFilter( filter );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void setChildrenInitialized( boolean b )
{
-
if ( !b )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
{
getDelegate().setChildrenInitialized( b );
}
- // setDelegate(null);
- this.entryDoesNotExist = false;
+ entryDoesNotExist = false;
}
else
- /* if(b) */{
+ {
if ( this.getDelegate() == null )
{
- setDelegate( this.getBrowserConnection().getEntryFromCache( this.dn ) );
+ setDelegate( getBrowserConnection().getEntryFromCache( dn ) );
if ( this.getDelegate() == null )
{
// entry doesn't exist!
- this.entryDoesNotExist = true;
+ entryDoesNotExist = true;
}
}
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
{
getDelegate().setChildrenInitialized( b );
}
@@ -388,60 +595,97 @@
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isAlias()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().isAlias();
+ }
else
+ {
return false;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void setAlias( boolean b )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().setAlias( b );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isReferral()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().isReferral();
+ }
else
+ {
return false;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void setReferral( boolean b )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().setReferral( b );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isSubentry()
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
return getDelegate().isSubentry();
+ }
else
+ {
return false;
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void setSubentry( boolean b )
{
- if ( this.getDelegate() != null )
+ if ( getDelegate() != null )
+ {
getDelegate().setSubentry( b );
+ }
}
+ /**
+ * {@inheritDoc}
+ */
public void entryUpdated( EntryModificationEvent event )
{
-
- if ( event.getModifiedEntry() == this.getDelegate() )
+ if ( event.getModifiedEntry() == getDelegate() )
{
-
if ( event instanceof AttributeAddedEvent )
{
AttributeAddedEvent e = ( AttributeAddedEvent ) event;
@@ -458,7 +702,6 @@
}
else if ( event instanceof AttributesInitializedEvent )
{
- AttributesInitializedEvent e = ( AttributesInitializedEvent ) event;
AttributesInitializedEvent delegateEvent = new AttributesInitializedEvent( this );
EventRegistry.fireEntryUpdated( delegateEvent, this );
}
@@ -476,21 +719,16 @@
.getModifiedAttribute(), e.getDeletedValue() );
EventRegistry.fireEntryUpdated( delegateEvent, this );
}
- // EntryAddedEvent
- // EntryDeletedEvent
- // EntryMovedEvent
- // EntryRenamedEvent
else if ( event instanceof ChildrenInitializedEvent )
{
- ChildrenInitializedEvent e = ( ChildrenInitializedEvent ) event;
ChildrenInitializedEvent delegateEvent = new ChildrenInitializedEvent( this );
EventRegistry.fireEntryUpdated( delegateEvent, this );
}
else if ( event instanceof ValueAddedEvent )
{
ValueAddedEvent e = ( ValueAddedEvent ) event;
- ValueAddedEvent delegateEvent = new ValueAddedEvent( e.getConnection(), this, e
- .getModifiedAttribute(), e.getAddedValue() );
+ ValueAddedEvent delegateEvent = new ValueAddedEvent( e.getConnection(), this, e.getModifiedAttribute(),
+ e.getAddedValue() );
EventRegistry.fireEntryUpdated( delegateEvent, this );
}
else if ( event instanceof ValueDeletedEvent )
@@ -510,19 +748,20 @@
else if ( event instanceof ValueRenamedEvent )
{
ValueRenamedEvent e = ( ValueRenamedEvent ) event;
- ValueRenamedEvent delegateEvent = new ValueRenamedEvent( e.getConnection(), this, e
- .getOldValue(), e.getNewValue() );
+ ValueRenamedEvent delegateEvent = new ValueRenamedEvent( e.getConnection(), this, e.getOldValue(), e
+ .getNewValue() );
EventRegistry.fireEntryUpdated( delegateEvent, this );
}
- // ValuesSetEvent
-
}
}
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
public Object getAdapter( Class adapter )
{
-
if ( adapter.isAssignableFrom( ISearchPageScoreComputer.class ) )
{
return new LdapSearchPageScoreComputer();
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java Sat Oct 27 06:22:25 2007
@@ -44,18 +44,35 @@
import org.apache.directory.studio.ldapbrowser.core.model.schema.Subschema;
+/**
+ * An {@link DummyEntry} is an implementation if {@link IEntry} that doesn't
+ * represent a directory entry.
+ *
+ * Most methods do nothing. It isn't possible to add child entries.
+ * It only contains a map for attributes and a connection to retrieve
+ * schema information.
+ *
+ * It is used for temporary {@link IEntry} objects, e.g. in the new entry wizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class DummyEntry implements IEntry
{
private static final long serialVersionUID = 4833907766031149971L;
+ /** The DN. */
private DN dn;
+ /** The dummy connection. */
private DummyConnection dummyConnection;
+ /** The connection id. */
private String connectionId;
- private Map attributeMap;
+ /** The attribute map. */
+ private Map<String, IAttribute> attributeMap;
protected DummyEntry()
@@ -63,46 +80,66 @@
}
- public DummyEntry( DN dn, IBrowserConnection connection )
+ /**
+ * Creates a new instance of DummyEntry.
+ *
+ * @param dn the DN
+ * @param browserConnection the browser connection
+ */
+ public DummyEntry( DN dn, IBrowserConnection browserConnection )
{
- if ( connection instanceof DummyConnection )
+ if ( browserConnection instanceof DummyConnection )
{
- this.dummyConnection = ( DummyConnection ) connection;
+ this.dummyConnection = ( DummyConnection ) browserConnection;
}
else
{
- this.connectionId = connection.getConnection().getId();
+ this.connectionId = browserConnection.getConnection().getId();
}
this.dn = dn;
- attributeMap = new LinkedHashMap();
+ attributeMap = new LinkedHashMap<String, IAttribute>();
}
+ /**
+ * Sets the DN.
+ *
+ * @param dn the new DN
+ */
public void setDn( DN dn )
{
this.dn = dn;
}
+ /**
+ * {@inheritDoc}
+ */
public void addAttribute( IAttribute attributeToAdd )
{
attributeMap.put( attributeToAdd.getDescription().toLowerCase(), attributeToAdd );
- EventRegistry.fireEntryUpdated( new AttributeAddedEvent( attributeToAdd.getEntry().getBrowserConnection(), this,
- attributeToAdd ), this );
+ EventRegistry.fireEntryUpdated( new AttributeAddedEvent( attributeToAdd.getEntry().getBrowserConnection(),
+ this, attributeToAdd ), this );
}
+ /**
+ * This implementation does nothing.
+ */
public void addChild( IEntry childrenToAdd )
{
}
+ /**
+ * {@inheritDoc}
+ */
public void deleteAttribute( IAttribute attributeToDelete )
{
attributeMap.remove( attributeToDelete.getDescription().toLowerCase() );
- EventRegistry.fireEntryUpdated( new AttributeDeletedEvent( attributeToDelete.getEntry().getBrowserConnection(), this,
- attributeToDelete ), this );
+ EventRegistry.fireEntryUpdated( new AttributeDeletedEvent( attributeToDelete.getEntry().getBrowserConnection(),
+ this, attributeToDelete ), this );
}
@@ -111,23 +148,25 @@
}
+ /**
+ * {@inheritDoc}
+ */
public IAttribute getAttribute( String attributeDescription )
{
- return ( IAttribute ) attributeMap.get( attributeDescription.toLowerCase() );
+ return attributeMap.get( attributeDescription.toLowerCase() );
}
+ /**
+ * {@inheritDoc}
+ */
public AttributeHierarchy getAttributeWithSubtypes( String attributeDescription )
{
-
AttributeDescription ad = new AttributeDescription( attributeDescription );
- List attributeList = new ArrayList();
- Iterator iterator = attributeMap.values().iterator();
- while ( iterator.hasNext() )
+ List<IAttribute> attributeList = new ArrayList<IAttribute>();
+ for ( IAttribute attribute : attributeList )
{
- IAttribute attribute = ( IAttribute ) iterator.next();
-
AttributeDescription other = new AttributeDescription( attributeDescription );
if ( other.isSubtypeOf( ad, getBrowserConnection().getSchema() ) )
{
@@ -141,19 +180,25 @@
}
else
{
- AttributeHierarchy ah = new AttributeHierarchy( this, attributeDescription, ( IAttribute[] ) attributeList
+ AttributeHierarchy ah = new AttributeHierarchy( this, attributeDescription, attributeList
.toArray( new IAttribute[attributeList.size()] ) );
return ah;
}
}
+ /**
+ * {@inheritDoc}
+ */
public IAttribute[] getAttributes()
{
- return ( IAttribute[] ) attributeMap.values().toArray( new IAttribute[attributeMap.size()] );
+ return attributeMap.values().toArray( new IAttribute[attributeMap.size()] );
}
+ /**
+ * {@inheritDoc}
+ */
public IBrowserConnection getBrowserConnection()
{
return dummyConnection != null ? dummyConnection : BrowserCorePlugin.getDefault().getConnectionManager()
@@ -161,106 +206,149 @@
}
+ /**
+ * {@inheritDoc}
+ */
public DN getDn()
{
return dn;
}
+ /**
+ * {@inheritDoc}
+ */
public URL getUrl()
{
return new URL( getBrowserConnection(), getDn() );
}
+ /**
+ * This implementation always returns null.
+ */
public IEntry getParententry()
{
return null;
}
+ /**
+ * {@inheritDoc}
+ */
public RDN getRdn()
{
return dn.getRdn();
}
+ /**
+ * This implementation always returns null.
+ */
public IEntry[] getChildren()
{
return null;
}
+ /**
+ * This implementation always returns -1.
+ */
public int getChildrenCount()
{
return -1;
}
+ /**
+ * This implementation always returns the empty string.
+ */
public String getChildrenFilter()
{
return ""; //$NON-NLS-1$
}
+ /**
+ * {@inheritDoc}
+ */
public Subschema getSubschema()
{
return new Subschema( this );
}
+ /**
+ * This implementation always returns false.
+ */
public boolean hasMoreChildren()
{
return false;
}
+ /**
+ * This implementation always returns false.
+ */
public boolean hasParententry()
{
return false;
}
+ /**
+ * This implementation always returns false.
+ */
public boolean hasChildren()
{
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isAlias()
{
- return Arrays.asList( this.getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_ALIAS );
+ return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_ALIAS );
}
+ /**
+ * This implementation always returns true.
+ */
public boolean isAttributesInitialized()
{
return true;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isConsistent()
{
// check empty attributes and empty values
- Iterator attributeIterator = attributeMap.values().iterator();
+ Iterator<IAttribute> attributeIterator = attributeMap.values().iterator();
while ( attributeIterator.hasNext() )
{
- IAttribute attribute = ( IAttribute ) attributeIterator.next();
+ IAttribute attribute = attributeIterator.next();
if ( !attribute.isConsistent() )
return false;
}
- // check objectclass attribute
+ // check objectClass attribute
if ( !attributeMap.containsKey( IAttribute.OBJECTCLASS_ATTRIBUTE.toLowerCase() ) )
{
return false;
}
- IAttribute ocAttribute = ( IAttribute ) attributeMap.get( IAttribute.OBJECTCLASS_ATTRIBUTE.toLowerCase() );
+ IAttribute ocAttribute = attributeMap.get( IAttribute.OBJECTCLASS_ATTRIBUTE.toLowerCase() );
String[] ocValues = ocAttribute.getStringValues();
boolean structuralObjectClassAvailable = false;
for ( int i = 0; i < ocValues.length; i++ )
{
- ObjectClassDescription ocd = this.getBrowserConnection().getSchema().getObjectClassDescription( ocValues[i] );
+ ObjectClassDescription ocd = this.getBrowserConnection().getSchema()
+ .getObjectClassDescription( ocValues[i] );
if ( ocd.isStructural() )
{
structuralObjectClassAvailable = true;
@@ -273,86 +361,131 @@
}
// check must-attributes
- String[] mustAttributeNames = this.getSubschema().getMustAttributeNames();
+ String[] mustAttributeNames = getSubschema().getMustAttributeNames();
for ( int i = 0; i < mustAttributeNames.length; i++ )
{
if ( !attributeMap.containsKey( mustAttributeNames[i].toLowerCase() ) )
+ {
return false;
+ }
}
return true;
}
+ /**
+ * This implementation always returns false.
+ */
public boolean isDirectoryEntry()
{
return false;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isReferral()
{
- return Arrays.asList( this.getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_REFERRAL );
+ return Arrays.asList( getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_REFERRAL );
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isSubentry()
{
return Arrays.asList( this.getSubschema().getObjectClassNames() ).contains( ObjectClassDescription.OC_SUBENTRY );
}
+ /**
+ * This implementation always returns false.
+ */
public boolean isChildrenInitialized()
{
return false;
}
+ /**
+ * This implementation does nothing.
+ */
public void setAlias( boolean b )
{
}
+ /**
+ * This implementation does nothing.
+ */
public void setAttributesInitialized( boolean b )
{
}
+ /**
+ * This implementation does nothing.
+ */
public void setDirectoryEntry( boolean isDirectoryEntry )
{
}
+ /**
+ * This implementation does nothing.
+ */
public void setHasMoreChildren( boolean b )
{
}
+ /**
+ * This implementation does nothing.
+ */
public void setHasChildrenHint( boolean b )
{
}
+ /**
+ * This implementation does nothing.
+ */
public void setReferral( boolean b )
{
}
+ /**
+ * This implementation does nothing.
+ */
public void setSubentry( boolean b )
{
}
+ /**
+ * This implementation does nothing.
+ */
public void setChildrenFilter( String filter )
{
}
+ /**
+ * This implementation does nothing.
+ */
public void setChildrenInitialized( boolean b )
{
}
+ /**
+ * This implementation always returns null.
+ */
+ @SuppressWarnings("unchecked")
public Object getAdapter( Class adapter )
{
return null;
Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java?rev=589094&r1=589093&r2=589094&view=diff
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java (original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/ReferralBaseEntry.java Sat Oct 27 06:22:25 2007
@@ -25,6 +25,13 @@
import org.apache.directory.studio.ldapbrowser.core.model.IBrowserConnection;
+/**
+ * An {@link ReferralBaseEntry} represents the target
+ * (named by the ref attribute) of an referral entry.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
public class ReferralBaseEntry extends DelegateEntry
{
@@ -36,6 +43,12 @@
}
+ /**
+ * Creates a new instance of ReferralBaseEntry.
+ *
+ * @param connection the connection of the referral target
+ * @param dn the DN of the referral target
+ */
public ReferralBaseEntry( IBrowserConnection connection, DN dn )
{
super( connection, dn );