directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r496521 - in /directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core: internal/model/ model/
Date Mon, 15 Jan 2007 22:31:50 GMT
Author: seelmann
Date: Mon Jan 15 14:31:49 2007
New Revision: 496521

URL: http://svn.apache.org/viewvc?view=rev&rev=496521
Log:
Added Javadoc, removed warings.

Modified:
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Attribute.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/AttributeHierarchy.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IAttribute.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IValue.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/URL.java

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Attribute.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Attribute.java?view=diff&rev=496521&r1=496520&r2=496521
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Attribute.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Attribute.java
Mon Jan 15 14:31:49 2007
@@ -22,7 +22,6 @@
 
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -46,31 +45,36 @@
 import org.eclipse.search.ui.ISearchPageScoreComputer;
 
 
+/**
+ * Default implementation of IAttribute.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class Attribute implements IAttribute
 {
 
+    /** The serialVersionUID. */
     private static final long serialVersionUID = -5679384884002589786L;
 
+    /** The attribute description */
     private AttributeDescription attributeDescription;
 
+    /** The entry this attribute belongs to */
     private IEntry entry;
 
-    private List valueList;
-
-
-    protected Attribute()
-    {
-    }
+    /** The values */
+    private List<IValue> valueList;
 
 
     /**
-     * Creates an Attribute with the given description and no value for the
-     * given entry.
+     * Creates an new instance of Attribute with the given description
+     * and no value.
      * 
      * @param entry
      *                The entry of this attribute, mustn't be null
      * @param description
-     *                The attribute descrption, mustn't be null or empty.
+     *                The attribute descrption, mustn't be null.
      * @throws ModelModificationException
      *                 if the attribute name is null or empty.
      */
@@ -80,33 +84,38 @@
         {
             throw new ModelModificationException( BrowserCoreMessages.model__empty_entry
);
         }
-        if ( description == null /* || "".equals(description) */)
-        { //$NON-NLS-1$
+        if ( description == null )
+        {
             throw new ModelModificationException( BrowserCoreMessages.model__empty_attribute
);
         }
 
         this.entry = entry;
         this.attributeDescription = new AttributeDescription( description );
-        this.valueList = new ArrayList();
-        // this.valueList = new LinkedHashSet();
+        this.valueList = new ArrayList<IValue>();
 
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public IEntry getEntry()
     {
-        return this.entry;
+        return entry;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isConsistent()
     {
-        if ( this.valueList.isEmpty() )
+        if ( valueList.isEmpty() )
         {
             return false;
         }
 
-        for ( Iterator it = this.valueList.iterator(); it.hasNext(); )
+        for ( Iterator it = valueList.iterator(); it.hasNext(); )
         {
             IValue value = ( IValue ) it.next();
             if ( value.isEmpty() )
@@ -119,19 +128,22 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isMustAttribute()
     {
-        if ( this.isObjectClassAttribute() )
+        if ( isObjectClassAttribute() )
         {
             return true;
         }
         else
         {
-            String[] mustAttributeNames = this.entry.getSubschema().getMustAttributeNames();
+            String[] mustAttributeNames = getEntry().getSubschema().getMustAttributeNames();
             for ( int i = 0; i < mustAttributeNames.length; i++ )
             {
                 String must = mustAttributeNames[i];
-                if ( must.equalsIgnoreCase( this.getType() ) )
+                if ( must.equalsIgnoreCase( getType() ) )
                 {
                     return true;
                 }
@@ -141,45 +153,61 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isMayAttribute()
     {
-        // return
-        // Arrays.asList(this.entry.getSubschema().getMayAttributeNames()).contains(this.getType());
         return !isObjectClassAttribute() && !isMustAttribute() && !isOperationalAttribute();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isOperationalAttribute()
     {
         return getAttributeTypeDescription() == null || SchemaUtils.isOperational( getAttributeTypeDescription()
);
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isObjectClassAttribute()
     {
-        return OBJECTCLASS_ATTRIBUTE.equalsIgnoreCase( this.getDescription() );
+        return OBJECTCLASS_ATTRIBUTE.equalsIgnoreCase( getDescription() );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isString()
     {
-        return !this.isBinary();
+        return !isBinary();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isBinary()
     {
-        return this.getAttributeTypeDescription().isBinary();
+        return getAttributeTypeDescription().isBinary();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void addEmptyValue( ModelModifier source )
     {
         try
         {
             IValue emptyValue = new Value( this );
-            this.valueList.add( emptyValue );
-            this.attributeModified( new EmptyValueAddedEvent( this.entry.getConnection(),
this.entry, this, emptyValue,
+            valueList.add( emptyValue );
+            this.attributeModified( new EmptyValueAddedEvent( getEntry().getConnection(),
getEntry(), this, emptyValue,
                 source ) );
         }
         catch ( ModelModificationException mme )
@@ -189,6 +217,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void deleteEmptyValue( ModelModifier source )
     {
         for ( Iterator it = this.valueList.iterator(); it.hasNext(); )
@@ -197,20 +228,31 @@
             if ( value.isEmpty() )
             {
                 it.remove();
-                this.attributeModified( new EmptyValueDeletedEvent( this.entry.getConnection(),
this.entry, this,
-                    value, source ) );
+                attributeModified( new EmptyValueDeletedEvent( getEntry().getConnection(),
getEntry(), this, value,
+                    source ) );
                 return;
             }
         }
     }
 
 
+    /**
+     * Fires an EntryModificationEvent.
+     *
+     * @param event the EntryModificationEvent
+     */
     private void attributeModified( EntryModificationEvent event )
     {
-        EventRegistry.fireEntryUpdated( event, this.getEntry() );
+        EventRegistry.fireEntryUpdated( event, getEntry() );
     }
 
 
+    /**
+     * Checks if the given value is valid.
+     *
+     * @param value the value to check
+     * @throws ModelModificationException if the value is not valid
+     */
     private void checkValue( IValue value ) throws ModelModificationException
     {
         if ( value == null )
@@ -224,9 +266,15 @@
     }
 
 
+    /**
+     * Deletes the given value from value list.
+     *
+     * @param valueToDelete the value to delete
+     * @return true if deleted
+     */
     private boolean deleteValue( IValue valueToDelete )
     {
-        for ( Iterator it = this.valueList.iterator(); it.hasNext(); )
+        for ( Iterator it = valueList.iterator(); it.hasNext(); )
         {
             IValue value = ( IValue ) it.next();
             if ( value.equals( valueToDelete ) )
@@ -239,28 +287,36 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void addValue( IValue valueToAdd, ModelModifier source ) throws ModelModificationException
     {
         this.checkValue( valueToAdd );
 
-        this.valueList.add( valueToAdd );
-        this
-            .attributeModified( new ValueAddedEvent( this.entry.getConnection(), this.entry,
this, valueToAdd, source ) );
+        valueList.add( valueToAdd );
+        attributeModified( new ValueAddedEvent( getEntry().getConnection(), getEntry(), this,
valueToAdd, source ) );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void deleteValue( IValue valueToDelete, ModelModifier source ) throws ModelModificationException
     {
         this.checkValue( valueToDelete );
 
         if ( this.deleteValue( valueToDelete ) )
         {
-            this.attributeModified( new ValueDeletedEvent( this.entry.getConnection(), this.entry,
this, valueToDelete,
+            this.attributeModified( new ValueDeletedEvent( getEntry().getConnection(), getEntry(),
this, valueToDelete,
                 source ) );
         }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void modifyValue( IValue oldValue, IValue newValue, ModelModifier source ) throws
ModelModificationException
     {
         this.checkValue( oldValue );
@@ -268,41 +324,59 @@
 
         this.deleteValue( oldValue );
         this.valueList.add( newValue );
-        this.attributeModified( new ValueModifiedEvent( this.entry.getConnection(), this.entry,
this, oldValue,
+        this.attributeModified( new ValueModifiedEvent( getEntry().getConnection(), getEntry(),
this, oldValue,
             newValue, source ) );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public IValue[] getValues()
     {
-        return ( IValue[] ) this.valueList.toArray( new IValue[0] );
+        return ( IValue[] ) valueList.toArray( new IValue[0] );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int getValueSize()
     {
         return this.valueList.size();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String getDescription()
     {
-        return this.attributeDescription.getDescription();
+        return getAttributeDescription().getDescription();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String getType()
     {
-        return this.attributeDescription.getParsedAttributeType();
+        return getAttributeDescription().getParsedAttributeType();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString()
     {
-        return this.getDescription();
+        return getDescription();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals( Object o )
     {
         // check argument
@@ -313,41 +387,50 @@
         IAttribute a = ( IAttribute ) o;
 
         // compare entries
-        if ( !this.getEntry().equals( a.getEntry() ) )
+        if ( !getEntry().equals( a.getEntry() ) )
         {
             return false;
         }
 
         // compare attribute description
-        return this.getDescription().equals( a.getDescription() );
+        return getDescription().equals( a.getDescription() );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode()
     {
-        return this.getDescription().hashCode();
+        return getDescription().hashCode();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public byte[][] getBinaryValues()
     {
-        List binaryValueList = new ArrayList();
+        List<byte[]> binaryValueList = new ArrayList<byte[]>();
 
-        IValue[] values = this.getValues();
+        IValue[] values = getValues();
         for ( int i = 0; i < values.length; i++ )
         {
             binaryValueList.add( values[i].getBinaryValue() );
         }
 
-        return ( byte[][] ) binaryValueList.toArray( new byte[0][] );
+        return binaryValueList.toArray( new byte[0][] );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String getStringValue()
     {
         if ( getValueSize() > 0 )
         {
-            return ( ( IValue ) this.valueList.get( 0 ) ).getStringValue();
+            return ( ( IValue ) valueList.get( 0 ) ).getStringValue();
         }
         else
         {
@@ -356,42 +439,52 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String[] getStringValues()
     {
-        List stringValueList = new ArrayList();
+        List<String> stringValueList = new ArrayList<String>();
 
-        IValue[] values = this.getValues();
+        IValue[] values = getValues();
         for ( int i = 0; i < values.length; i++ )
         {
             stringValueList.add( values[i].getStringValue() );
         }
 
-        return ( String[] ) stringValueList.toArray( new String[stringValueList.size()] );
+        return stringValueList.toArray( new String[stringValueList.size()] );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public AttributeTypeDescription getAttributeTypeDescription()
     {
-        return getEntry().getConnection().getSchema().getAttributeTypeDescription( this.getType()
);
+        return getEntry().getConnection().getSchema().getAttributeTypeDescription( getType()
);
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getAdapter( Class adapter )
     {
 
-        if ( adapter.isAssignableFrom( ISearchPageScoreComputer.class ) )
+        Class<?> clazz = ( Class<?> ) adapter;
+        if ( clazz.isAssignableFrom( ISearchPageScoreComputer.class ) )
         {
             return new LdapSearchPageScoreComputer();
         }
-        if ( adapter == IConnection.class )
+        if ( clazz.isAssignableFrom( IConnection.class ) )
         {
-            return this.getConnection();
+            return getEntry().getConnection();
         }
-        if ( adapter == IEntry.class )
+        if ( clazz.isAssignableFrom( IEntry.class ) )
         {
-            return this.getEntry();
+            return getEntry();
         }
-        if ( adapter == IAttribute.class )
+        if ( clazz.isAssignableFrom( IAttribute.class ) )
         {
             return this;
         }
@@ -400,18 +493,9 @@
     }
 
 
-    public IConnection getConnection()
-    {
-        return this.entry.getConnection();
-    }
-
-
-    public IAttribute getAttribute()
-    {
-        return this;
-    }
-
-
+    /**
+     * {@inheritDoc}
+     */
     public AttributeDescription getAttributeDescription()
     {
         return attributeDescription;

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java?view=diff&rev=496521&r1=496520&r2=496521
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/internal/model/Value.java
Mon Jan 15 14:31:49 2007
@@ -36,22 +36,30 @@
 
 /**
  * Default implementation of IValue.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public class Value implements IValue
 {
 
+    /** The serialVersionUID. */
     private static final long serialVersionUID = -9039209604742682740L;
 
+    /** The attribute this value belongs to */
     private IAttribute attribute;
 
+    /** The raw value, either a String or a byte[] */
     private Object rawValue;
 
 
-    protected Value()
-    {
-    }
-
-
+    /**
+     * Creates a new instance of Value.
+     *
+     * @param attribute the attribute this value belongs to 
+     * @param rawValue the raw value, either a String or a byte[]
+     * @throws ModelModificationException if one of the parameter is null
+     */
     public Value( IAttribute attribute, Object rawValue ) throws ModelModificationException
     {
         this.init( attribute, rawValue );
@@ -63,12 +71,25 @@
     }
 
 
+    /**
+     * Creates a new instance of Value with an empty value.
+     *
+     * @param attribute the attribute this value belongs to
+     * @throws ModelModificationException if one of the parameter is null
+     */
     public Value( IAttribute attribute ) throws ModelModificationException
     {
         this.init( attribute, null );
     }
 
 
+    /**
+     * Initializes this Value.
+     *
+     * @param attribute the attribute this value belongs to 
+     * @param rawValue the raw value, either a String or a byte[] or null 
+     * @throws ModelModificationException
+     */
     private void init( IAttribute attribute, Object rawValue ) throws ModelModificationException
     {
         if ( attribute == null )
@@ -96,18 +117,27 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public IAttribute getAttribute()
     {
         return this.attribute;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getRawValue()
     {
         return this.rawValue;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String getStringValue()
     {
 
@@ -134,9 +164,11 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public byte[] getBinaryValue()
     {
-
         if ( this.rawValue == EMPTY_STRING_VALUE )
         {
             return EMPTY_STRING_VALUE.getBinaryValue();
@@ -160,24 +192,36 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isString()
     {
         return this.rawValue == EMPTY_STRING_VALUE || this.attribute.isString();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isBinary()
     {
         return this.rawValue == EMPTY_BINARY_VALUE || this.attribute.isBinary();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean isEmpty()
     {
         return this.rawValue == EMPTY_STRING_VALUE || this.rawValue == EMPTY_BINARY_VALUE;
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals( Object o )
     {
         // check argument
@@ -213,37 +257,47 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode()
     {
         return rawValue.hashCode();
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public String toString()
     {
         return attribute + ":" + ( this.isString() ? this.getStringValue() : "BINARY" );
//$NON-NLS-1$ //$NON-NLS-2$
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public Object getAdapter( Class adapter )
     {
-        if ( adapter.isAssignableFrom( ISearchPageScoreComputer.class ) )
+        Class<?> clazz = ( Class<?> ) adapter;
+        if ( clazz.isAssignableFrom( ISearchPageScoreComputer.class ) )
         {
             return new LdapSearchPageScoreComputer();
         }
-        if ( adapter == IConnection.class )
+        if ( clazz.isAssignableFrom( IConnection.class ) )
         {
-            return this.getConnection();
+            return getAttribute().getEntry().getConnection();
         }
-        if ( adapter == IEntry.class )
+        if ( clazz.isAssignableFrom( IEntry.class ) )
         {
-            return this.getEntry();
+            return getAttribute().getEntry();
         }
-        if ( adapter == IAttribute.class )
+        if ( clazz.isAssignableFrom( IAttribute.class ) )
         {
-            return this.getAttribute();
+            return getAttribute();
         }
-        if ( adapter == IValue.class )
+        if ( clazz.isAssignableFrom( IValue.class ) )
         {
             return this;
         }
@@ -251,24 +305,9 @@
     }
 
 
-    public IConnection getConnection()
-    {
-        return this.attribute.getEntry().getConnection();
-    }
-
-
-    public IEntry getEntry()
-    {
-        return this.attribute.getEntry();
-    }
-
-
-    public IValue getValue()
-    {
-        return this;
-    }
-
-
+    /**
+     * {@inheritDoc}
+     */
     public boolean isRdnPart()
     {
         RDNPart[] parts = getAttribute().getEntry().getRdn().getParts();
@@ -282,4 +321,5 @@
         }
         return false;
     }
+
 }

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/AttributeHierarchy.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/AttributeHierarchy.java?view=diff&rev=496521&r1=496520&r2=496521
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/AttributeHierarchy.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/AttributeHierarchy.java
Mon Jan 15 14:31:49 2007
@@ -25,16 +25,38 @@
 import java.util.Iterator;
 
 
+/**
+ * An AttributeHierarchy is a container for an attribute including all its subtypes. 
+ * <p>
+ * Example:
+ * <ul>
+ * <li>attributeDescription is <code>name</code>
+ * <li>attributes contains <code>cn:test1</code>, <code>sn:test2</code>
and <code>givenName:test3</code>
+ * </ul>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class AttributeHierarchy
 {
 
+    /** The entry */
     private IEntry entry;
 
+    /** The attribute description */
     private String attributeDescription;
 
+    /** The attributes */
     private IAttribute[] attributes;
 
 
+    /**
+     * Creates a new instance of AttributeHierarchy.
+     *
+     * @param entry the entry
+     * @param attributeDescription the attribute description
+     * @param attributes the attributes
+     */
     public AttributeHierarchy( IEntry entry, String attributeDescription, IAttribute[] attributes
)
     {
         if ( entry == null || attributeDescription == null || attributes == null || attributes.length
< 1
@@ -48,42 +70,79 @@
     }
 
 
+    /**
+     * Gets the attributes.
+     *
+     * @return the attributes
+     */
     public IAttribute[] getAttributes()
     {
         return attributes;
     }
 
 
-    public boolean contains( IAttribute att )
-    {
-        return Arrays.asList( attributes ).contains( att );
+    /**
+     * Checks whether the given attribute is contained 
+     * in this attribute hierarchy. 
+     *
+     * @param attribute the attribute to check
+     * @return true if the attribute is contained in this attribute hierarchy
+     */
+    public boolean contains( IAttribute attribute )
+    {
+        return Arrays.asList( attributes ).contains( attribute );
     }
 
 
-    public Iterator iterator()
+    /**
+     * Returns an iterator over the elements of this attribute hierarchy.
+     *
+     * @return an iterator over the elements of this attribute hierarchy
+     */
+    public Iterator<IAttribute> iterator()
     {
         return Arrays.asList( attributes ).iterator();
     }
 
 
+    /**
+     * Gets the first attribute.
+     *
+     * @return the first attribute
+     */
     public IAttribute getAttribute()
     {
         return attributes[0];
     }
 
 
+    /**
+     * Gets the number of attributes.
+     *
+     * @return the number of attributes
+     */
     public int size()
     {
         return attributes.length;
     }
 
 
+    /**
+     * Gets the attribute description.
+     *
+     * @return the attribute description
+     */
     public String getAttributeDescription()
     {
         return attributeDescription;
     }
 
 
+    /**
+     * Gets the entry.
+     *
+     * @return the entry
+     */
     public IEntry getEntry()
     {
         return entry;

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IAttribute.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IAttribute.java?view=diff&rev=496521&r1=496520&r2=496521
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IAttribute.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IAttribute.java
Mon Jan 15 14:31:49 2007
@@ -33,7 +33,7 @@
 
 
 /**
- * The IAttribute interface represents an LDAP attribute.
+ * An IAttribute represents an LDAP attribute.
  */
 public interface IAttribute extends Serializable, IAdaptable, AttributePropertyPageProvider,
EntryPropertyPageProvider,
     ConnectionPropertyPageProvider
@@ -134,39 +134,27 @@
      */
     public static final String OPERATIONAL_ATTRIBUTE_VENDOR_VERSION = "vendorVersion"; //$NON-NLS-1$
 
-    /**
-     * objectClass
-     */
+    /** The attribute type objectClass */
     public static final String OBJECTCLASS_ATTRIBUTE = "objectClass"; //$NON-NLS-1$
 
-    /**
-     * objectClass
-     */
+    /** The OID of the objectClass attribute, 2.5.4.0 */
     public static final String OBJECTCLASS_ATTRIBUTE_OID = "2.5.4.0"; //$NON-NLS-1$
 
-    /**
-     * ref
-     */
+    /** The attribute type ref */
     public static final String REFERRAL_ATTRIBUTE = "ref"; //$NON-NLS-1$
 
-    /**
-     * aliasedObjectName
-     */
+    /** The attribute type aliasedObjectName */
     public static final String ALIAS_ATTRIBUTE = "aliasedObjectName"; //$NON-NLS-1$
 
-    /**
-     * ;
-     */
+    /** The options delimiter ';' */
     public static final String OPTION_DELIMITER = ";"; //$NON-NLS-1$
 
-    /**
-     * lang-
-     */
+    /** The language tag prefix 'lang-' */
     public static final String OPTION_LANG_PREFIX = "lang-"; //$NON-NLS-1$
 
 
     /**
-     * Returns the entry of this attribute.
+     * Gets the entry of this attribute.
      * 
      * @return the entry of this attribute, never null
      */
@@ -178,8 +166,8 @@
      * conditions must be fulfilled:
      * 
      * <ul>
-     * <li>There must be at least one value</li>
-     * <li>There mustn't be any empty value</li>
+     * <li>The attribute must contain at least one value</li>
+     * <li>The attribute mustn't contain any empty value</li>
      * </ul>
      * 
      * @return true if the attribute ist consistent
@@ -189,7 +177,7 @@
 
     /**
      * Returns true if this attribute is a must attribute of its entry
-     * according to the entry's subschema.
+     * according to the schema and the entry's object classes.
      * 
      * @return true if this attribute is a must attribute of its entry.
      */
@@ -198,7 +186,7 @@
 
     /**
      * Returns true if this attribute is a may attribute of its entry
-     * according to the entry's subschema.
+     * according to the schema and the entry's object classes.
      * 
      * @return true if this attribute is a may attribute of its entry.
      */
@@ -207,7 +195,7 @@
 
     /**
      * Returns true if this attribute is an operational attribute according
-     * to the entry's subschema.
+     * to the schema.
      * 
      * @return true if this attribute is an operational attribute.
      */
@@ -215,9 +203,9 @@
 
 
     /**
-     * Return true if this attribute is the objectclass attribute.
+     * Return true if this attribute is the objeCtclass attribute.
      * 
-     * @return true if this attribute is the objectclass attribute.
+     * @return true if this attribute is the objectClass attribute.
      */
     public abstract boolean isObjectClassAttribute();
 
@@ -303,16 +291,15 @@
 
 
     /**
-     * Returns the values of this attribute, wrapped into IValue objects.
+     * Gets the values of this attribute.
      * 
-     * @return the values of this attribute, may be an empty array, never
-     *         null.
+     * @return the values of this attribute, may be an empty array, never null.
      */
     public abstract IValue[] getValues();
 
 
     /**
-     * Returns the number of values in this attribute.
+     * Gets the number of values in this attribute.
      * 
      * @return the number of values in this attribute.
      */
@@ -320,7 +307,8 @@
 
 
     /**
-     * Returns the description of this attribute.
+     * Gets the description of this attribute. The description 
+     * consists of the attribute type and optional options.
      * 
      * @return the description of this attribute.
      */
@@ -328,7 +316,7 @@
 
 
     /**
-     * Returns the type of this attribute (description without options).
+     * Gets the type of this attribute (description without options).
      * 
      * @return the attribute type.
      */
@@ -336,7 +324,7 @@
 
 
     /**
-     * Returns all values as byte[]. If the values aren't binary they are
+     * Gets all values as byte[]. If the values aren't binary they are
      * converted to byte[] using UTF-8 encoding.
      * 
      * @return The binary values
@@ -345,7 +333,7 @@
 
 
     /**
-     * Returns the first value as string if one is present, null otherwise
+     * Gets the first value as string if one is present, null otherwise
      * 
      * @return The first value if one present, null otherwise
      */
@@ -353,7 +341,7 @@
 
 
     /**
-     * Returns all values as String. If the values aren't strings they are
+     * Gets all values as String. If the values aren't strings they are
      * converted using UTF-8 encoding.
      * 
      * @return The string values
@@ -376,7 +364,7 @@
 
 
     /**
-     * Returns the AttributeTypeDescription of this attribute.
+     * Gets the AttributeTypeDescription of this attribute.
      * 
      * @return the AttributeTypeDescription of this attribute, may be the
      *         default or a dummy
@@ -385,7 +373,7 @@
 
 
     /**
-     * Returns the AttributeDescription of this attribute.
+     * Gets the AttributeDescription of this attribute.
      * 
      * @return the AttributeDescription of this attribute,.
      */

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IValue.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IValue.java?view=diff&rev=496521&r1=496520&r2=496521
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IValue.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/IValue.java
Mon Jan 15 14:31:49 2007
@@ -32,26 +32,53 @@
 
 
 /**
- * A wrapper for raw LDAP values.
+ * An IValue represents a value of a LDAP attribute.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
  */
 public interface IValue extends Serializable, IAdaptable, ValuePropertyPageProvider, AttributePropertyPageProvider,
     EntryPropertyPageProvider, ConnectionPropertyPageProvider
 {
 
+    /**
+     * EmptyValue is used to indicate an empty value.
+     *
+     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+     * @version $Rev$, $Date$
+     */
     interface EmptyValue
     {
-        public String toString();
-
 
+        /**
+         * Gets the string value.
+         *
+         * @return the string value
+         */
         public String getStringValue();
 
 
+        /**
+         * Gets the binary value.
+         * 
+         * @return the binary value
+         */
         public byte[] getBinaryValue();
 
 
+        /**
+         * Checks if is string.
+         * 
+         * @return true, if is string
+         */
         public boolean isString();
 
 
+        /**
+         * Checks if is binary.
+         * 
+         * @return true, if is binary
+         */
         public boolean isBinary();
     }
 
@@ -60,30 +87,46 @@
      */
     public static final EmptyValue EMPTY_STRING_VALUE = new EmptyValue()
     {
+
+        /**
+         * {@inheritDoc}
+         */
         public String toString()
         {
             return BrowserCoreMessages.model__empty_string_value;
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public boolean isString()
         {
             return true;
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public boolean isBinary()
         {
             return false;
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public byte[] getBinaryValue()
         {
             return new byte[0];
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public String getStringValue()
         {
             return ""; //$NON-NLS-1$
@@ -95,30 +138,46 @@
      */
     public static final EmptyValue EMPTY_BINARY_VALUE = new EmptyValue()
     {
+
+        /**
+         * {@inheritDoc}
+         */
         public String toString()
         {
             return BrowserCoreMessages.model__empty_binary_value;
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public boolean isString()
         {
             return false;
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public boolean isBinary()
         {
             return true;
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public byte[] getBinaryValue()
         {
             return new byte[0];
         }
 
 
+        /**
+         * {@inheritDoc}
+         */
         public String getStringValue()
         {
             return ""; //$NON-NLS-1$
@@ -135,7 +194,7 @@
 
 
     /**
-     * Returns the raw value or an EmptyValue
+     * Gets the raw value or an EmptyValue
      * 
      * @return The raw value or an EmptyValue, never null.
      */
@@ -143,7 +202,10 @@
 
 
     /**
-     * Returns the String value of this value.
+     * Gets the string value of this value.
+     * 
+     * If the value is binary a String with UTF-8 decoded
+     * byte[] is returned. 
      * 
      * @return the String value
      */
@@ -151,7 +213,10 @@
 
 
     /**
-     * Returns the binary value of this value.
+     * Gets the binary value of this value.
+     * 
+     * If the value is string a byte[] with the 
+     * UTF-8 encoded String is returned. 
      * 
      * @return the binary value
      */
@@ -159,9 +224,11 @@
 
 
     /**
-     * Return true if the value is empty.
+     * Returns true if the value is empty.
+     * 
+     * A value is empty if its raw value is an EmptyValue.
      * 
-     * @return true if the value is the empty.
+     * @return true if the value is empty.
      */
     public abstract boolean isEmpty();
 
@@ -183,9 +250,9 @@
 
 
     /**
-     * Returns true if this value is part of its entries RDN.
+     * Returns true if this value is part of its entry's RDN.
      * 
-     * @return true if this value is part of its entries RDN.
+     * @return true if this value is part of its entry's RDN.
      */
     public abstract boolean isRdnPart();
 

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/URL.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/URL.java?view=diff&rev=496521&r1=496520&r2=496521
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/URL.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/URL.java
Mon Jan 15 14:31:49 2007
@@ -23,12 +23,17 @@
 
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
-import java.util.Arrays;
 
 import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
 import org.apache.directory.ldapstudio.browser.core.utils.Utils;
 
 
+/**
+ * An URL represents a LDAP URL.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class URL
 {
 
@@ -51,23 +56,37 @@
     // token = oid from section 4.1 of [3]
     // xtoken = ("X-" / "x-") token
 
+    /** The protocoll, ldap or ldaps */
     private String protocol = null;
 
+    /** The host */
     private String host = null;
 
+    /** The port */
     private String port = null;
 
+    /** The dn */
     private String dn = null;
 
+    /** The attributes */
     private String attributes = null;
 
+    /** The scope */
     private String scope = null;
 
+    /** The filter */
     private String filter = null;
 
+    /** The extensions */
     private String extensions = null;
 
 
+    /**
+     * Creates a new instance of URL. The given string is 
+     * parsed to an URL.
+     *
+     * @param url the URL
+     */
     public URL( String url )
     {
         if ( url == null )
@@ -79,6 +98,13 @@
     }
 
 
+    /**
+     * Creates a new instance of URL, based on the given connection and DN. 
+     * Only the fields protocol, host, port and dn exists when using this constructor.
+     *
+     * @param connection the connection
+     * @param dn the DN
+     */
     public URL( IConnection connection, DN dn )
     {
         this( connection );
@@ -92,6 +118,12 @@
     }
 
 
+    /**
+     * Creates a new instance of URL, based on the given connection. Only
+     * the fields protocol, host and port exists when using this constructor.
+     *
+     * @param connection the connection
+     */
     public URL( IConnection connection )
     {
         if ( connection == null )
@@ -112,6 +144,12 @@
     }
 
 
+    /**
+     * Creates a new instance of URL, based on the given search. Initializes
+     * the fields protocol, host, port, dn, attributes, scope and filter.
+     *
+     * @param search the search
+     */
     public URL( ISearch search )
     {
         this( search.getConnection(), search.getSearchBase() );
@@ -129,6 +167,9 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public boolean equals( Object o ) throws ClassCastException
     {
         if ( o instanceof URL )
@@ -139,12 +180,18 @@
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public int hashCode()
     {
         return this.toString().hashCode();
     }
 
 
+    /**
+     * Returns the string representation of this LDAP URL.
+     */
     public String toString()
     {
         StringBuffer sb = new StringBuffer();
@@ -188,6 +235,11 @@
     }
 
 
+    /**
+     * Parses the given string represntation of the URL.
+     *
+     * @param url the URL
+     */
     private void parseUrl( String url )
     {
 
@@ -286,25 +338,11 @@
     }
 
 
-    public static final void main( String[] args )
-    {
-        // String url = "ldap://";
-        // String url = "ldap://localhost";
-        // String url = "ldap://:389";
-        // String url = "ldap://localhost:389";
-        // String url = "ldap:///??one";
-        // String url = "ldap://localhost:389/cn=abc??sub";
-
-        // String url =
-        // "ldap://localhost:389/cn=abc?givenName,sn,mail?sub?(objectClass=*)?ext";
-
-        String url = "cn=abc"; //$NON-NLS-1$
-        String[] protocolAndRest = url.split( "\\?", 2 ); //$NON-NLS-1$
-        System.out.println( Arrays.asList( protocolAndRest ) );
-        System.out.println( protocolAndRest.length );
-    }
-
-
+    /**
+     * Checks for protocol.
+     * 
+     * @return true, if has protocol
+     */
     public boolean hasProtocol()
     {
         try
@@ -319,6 +357,12 @@
     }
 
 
+    /**
+     * Gets the protocol.
+     * 
+     * @return the protocol
+     * @throws NoSuchFieldException if not has protocol
+     */
     public String getProtocol() throws NoSuchFieldException
     {
         if ( protocol == null )
@@ -330,6 +374,11 @@
     }
 
 
+    /**
+     * Checks for host.
+     * 
+     * @return true, if has host
+     */
     public boolean hasHost()
     {
         try
@@ -344,6 +393,12 @@
     }
 
 
+    /**
+     * Gets the host.
+     * 
+     * @return the host
+     * @throws NoSuchFieldException if not has host
+     */
     public String getHost() throws NoSuchFieldException
     {
         if ( host == null )
@@ -355,6 +410,11 @@
     }
 
 
+    /**
+     * Checks for port.
+     * 
+     * @return true, if has port
+     */
     public boolean hasPort()
     {
         try
@@ -369,6 +429,12 @@
     }
 
 
+    /**
+     * Gets the port.
+     * 
+     * @return the port
+     * @throws NoSuchFieldException if not has port
+     */
     public String getPort() throws NoSuchFieldException
     {
         try
@@ -390,6 +456,11 @@
     }
 
 
+    /**
+     * Checks for dn.
+     * 
+     * @return true, if has dn
+     */
     public boolean hasDn()
     {
         try
@@ -404,6 +475,12 @@
     }
 
 
+    /**
+     * Gets the dn.
+     * 
+     * @return the dn
+     * @throws NoSuchFieldException if not has dn
+     */
     public DN getDn() throws NoSuchFieldException
     {
         if ( dn == null )
@@ -422,6 +499,11 @@
     }
 
 
+    /**
+     * Checks for attributes.
+     * 
+     * @return true, if has attributes
+     */
     public boolean hasAttributes()
     {
         try
@@ -436,6 +518,12 @@
     }
 
 
+    /**
+     * Gets the attributes.
+     * 
+     * @return the attributes
+     * @throws NoSuchFieldException if not has attributes
+     */
     public String[] getAttributes() throws NoSuchFieldException
     {
         if ( attributes == null )
@@ -448,6 +536,11 @@
     }
 
 
+    /**
+     * Checks for scope.
+     * 
+     * @return true, if has scope
+     */
     public boolean hasScope()
     {
         try
@@ -462,6 +555,12 @@
     }
 
 
+    /**
+     * Gets the scope.
+     * 
+     * @return the scope
+     * @throws NoSuchFieldException if not has scope
+     */
     public int getScope() throws NoSuchFieldException
     {
         if ( scope == null )
@@ -485,6 +584,11 @@
     }
 
 
+    /**
+     * Checks for filter.
+     * 
+     * @return true, if has filter
+     */
     public boolean hasFilter()
     {
         try
@@ -499,6 +603,12 @@
     }
 
 
+    /**
+     * Gets the filter.
+     * 
+     * @return the filter
+     * @throws NoSuchFieldException if not has filter
+     */
     public String getFilter() throws NoSuchFieldException
     {
         if ( filter == null )
@@ -510,6 +620,11 @@
     }
 
 
+    /**
+     * Checks for extensions.
+     * 
+     * @return true, if has extensions
+     */
     public boolean hasExtensions()
     {
         try
@@ -524,6 +639,12 @@
     }
 
 
+    /**
+     * Gets the extensions.
+     * 
+     * @return the extensions
+     * @throws NoSuchFieldException if not has extensions
+     */
     public String getExtensions() throws NoSuchFieldException
     {
         if ( extensions == null )



Mime
View raw message