You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/10/11 21:37:33 UTC
svn commit: r583927 - in /directory/shared/branches/bigbang/ldap/src:
main/java/org/apache/directory/shared/ldap/common/
test/java/org/apache/directory/shared/ldap/common/
test/java/org/apache/directory/shared/ldap/name/
Author: akarasulu
Date: Thu Oct 11 12:37:32 2007
New Revision: 583927
URL: http://svn.apache.org/viewvc?rev=583927&view=rev
Log:
Some notes to clear up on these interfaces.
Modified:
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerAttribute.java
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerEntry.java
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/Value.java
directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/common/ServerAttributeTest.java
directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java?rev=583927&r1=583926&r2=583927&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/AbstractValue.java Thu Oct 11 12:37:32 2007
@@ -80,7 +80,7 @@
*
* @return The stored normalized value
*/
- public T getNormValue()
+ public T getNormalizedValue()
{
return normValue;
}
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerAttribute.java?rev=583927&r1=583926&r2=583927&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerAttribute.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerAttribute.java Thu Oct 11 12:37:32 2007
@@ -27,6 +27,7 @@
import org.apache.directory.shared.asn1.primitives.OID;
import org.apache.directory.shared.ldap.schema.Normalizer;
+
/**
* This interface defines the valid operations on a particular attribute of a
* directory entry.
@@ -59,6 +60,18 @@
* some methods have been removed, and which manipulates Value instead
* of Object
*
+ * @todo ALEX - Remove after resolution:
+ * Why not track the AttributeType associated with the ServerAttribute as we
+ * discussed a while back at LDAPCon? It makes sense to access the attributeType
+ * directly from the ServerAttribute instead of having to fish for it in the
+ * registries. Perhaps the attributeType can be dynamically looked up from within
+ * implementors of this interface (to respond to schema changes) to dynamically
+ * resolve their respective type information. Internally checks should be performed
+ * while adding values.
+ * @todo ALEX - Remove after resolution:
+ * Also I thought we would use polymorphism for the different kinds of attributes:
+ * Binary verses NonBinary. Is there value in this?
+ *
* @author <a href="mailto:dev@directory.apache.org"> Apache Directory Project</a>
* @version $Rev: 499013 $
*/
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerEntry.java?rev=583927&r1=583926&r2=583927&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerEntry.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/ServerEntry.java Thu Oct 11 12:37:32 2007
@@ -47,19 +47,19 @@
* The attribute collection is created when the directory entry is created.
* </p>
*
+ * @todo ALEX - Remove after resolution:
+ * Same reason as before for ServerAttribute: why not expose access to the ObjectClass
+ * that governs which attributes may and must be present within this entry? Also we
+ * may need two kinds of put, remove and add methods where one performs schema checks
+ * and the other does not. I don't know if this is mixing concerns but I'd like to
+ * explore the idea somewhat.
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
public interface ServerEntry extends Cloneable, Serializable
{
/**
- * This constant is used during deserialization to check the version which
- * created the serialized object.
- */
- static final long serialVersionUID = 2L;
-
-
- /**
* Removes all the attributes.
*/
void clear();
@@ -86,7 +86,7 @@
* @return the old attribute with the same OID, if exists; otherwise
* <code>null</code>
*/
- ServerAttribute copy( ServerAttribute attr );
+ ServerAttribute copy( ServerAttribute attribute );
/**
@@ -114,7 +114,7 @@
*
* @return The entry DN
*/
- public LdapDN getDn();
+ LdapDN getDn();
/**
@@ -122,7 +122,7 @@
*
* @param dn The LdapdN associated with this entry
*/
- public void setDn( LdapDN dn);
+ void setDn( LdapDN dn);
/**
@@ -145,7 +145,7 @@
* @return the old attribute with the same OID, if exists; otherwise
* <code>null</code>
*/
- ServerAttribute put( ServerAttribute attr );
+ ServerAttribute put( ServerAttribute attribute );
/**
@@ -198,7 +198,10 @@
* This method provides a mechanism to put an attribute with a
* <code>null</code> value: the value of <code>obj</code> may be
* <code>null</code>.
- *
+ *
+ * @todo ALEX - Remove after resolution:
+ * Why are we using the OID primitive ASN.1 value?
+ *
* @param oid the OID of the new attribute to be put
* @param val the value of the new attribute to be put
* @return the old attribute with the same OID, if exists; otherwise
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/Value.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/Value.java?rev=583927&r1=583926&r2=583927&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/Value.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/common/Value.java Thu Oct 11 12:37:32 2007
@@ -19,15 +19,17 @@
*/
package org.apache.directory.shared.ldap.common;
+
import java.io.Serializable;
import javax.naming.NamingException;
import org.apache.directory.shared.ldap.schema.Normalizer;
+
/**
- * A common interface for values stored into a ServerAttribute. Thos values can
- * be String or byte[]
+ * A common interface for values stored into a ServerAttribute. These values can
+ * be a String or a byte[].
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
@@ -35,15 +37,26 @@
public interface Value<T> extends Serializable, Cloneable
{
/**
- * Tells if the Value is a StringValue or a BinaryValue
+ * Tells if the Value is a StringValue or a BinaryValue.
*
* @return <code>true</code> if the Value is a BinaryVale, <code>false</code>
* otherwise
*/
boolean isBinary();
-
+
/**
- * Get the inner value
+ * Get the non-normalized value.
+ *
+ * @todo ALEX - Remove after resolution:
+ * If this value is normalized does this method return the original non-normalized
+ * value or the normalized value? The semantics of this is very important. Also
+ * when we serialize values in the backend I guess we use the non-normalized values
+ * within the master table for the entry. Storing the normalized value in addition
+ * to the original value will cost double the disk space and double the memory in
+ * the entry cache and the master.db cache for partitions. Should the on disk
+ * representation be the same as the in memory representation? So the question boils
+ * down to is this class optimized for handling operations in the server or optimized
+ * for storage in the partition?
*
* @return The stored value, in its original type (String or byte[])
*/
@@ -51,34 +64,36 @@
/**
- * Get the normalized inner value
+ * Get the normalized value.
*
- * @return The normalized stored value, in its original type (String or byte[])
+ * @return The normalized value, as either a String or byte[]
*/
- T getNormValue();
+ T getNormalizedValue();
/**
- * Store a value into the object
+ * Sets the non-normalized value.
*
- * @param value The value to store. Should be either a String or a byte[]
+ * @param value the value to set. Should be either a String or a byte[]
*/
void setValue( T value );
/**
- *
- * Normalize the value using the given normalizer
+ * Normalizes the value using the given normalizer
+ *
+ * @todo Alex - Remove after resolution:
+ * Come back to this later - I have a feeling this may be a problem to normalize
+ * this way. Don't know for sure why yet but I'll try to figure it out.
*
* @param normalizer The normalizer to use
- * @throws NamingException If the normalization fail
+ * @throws NamingException If the normalization fails
*/
void normalize( Normalizer normalizer ) throws NamingException;
/**
* Tells if the value has been normalized. It's a speedup.
*
- * @return <code>true</code> if the Value has been normalized, <code>false</code>
- * otherwise
+ * @return <code>true</code> if the Value has been normalized, <code>false</code> otherwise
*/
boolean isNormalized();
Modified: directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/common/ServerAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/common/ServerAttributeTest.java?rev=583927&r1=583926&r2=583927&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/common/ServerAttributeTest.java (original)
+++ directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/common/ServerAttributeTest.java Thu Oct 11 12:37:32 2007
@@ -338,7 +338,7 @@
}
});
- assertEquals( null, attr.get().getNormValue() );
+ assertEquals( null, attr.get().getNormalizedValue() );
assertEquals( null, attr.get().getValue() );
assertEquals( "test", attr.getID() );
assertEquals( oid, attr.getOid() );
@@ -375,13 +375,13 @@
while ( iter.hasNext() )
{
Value<?> v = iter.next();
- assertEquals( expectedLC[i], v.getNormValue() );
+ assertEquals( expectedLC[i], v.getNormalizedValue() );
assertEquals( expectedUC[i], v.getValue() );
i++;
}
- assertEquals( "test1", attr.get().getNormValue() );
+ assertEquals( "test1", attr.get().getNormalizedValue() );
assertEquals( "TEST1", attr.get().getValue() );
assertEquals( "test", attr.getID() );
assertEquals( oid, attr.getOid() );
@@ -488,7 +488,7 @@
assertEquals( 3, clone.size() );
Value<?> v = clone.get();
assertEquals( "TEST1", v.getValue() );
- assertEquals( "test1", v.getNormValue() );
+ assertEquals( "test1", v.getNormalizedValue() );
assertEquals( oid, clone.getOid() );
}
Modified: directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java?rev=583927&r1=583926&r2=583927&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java (original)
+++ directory/shared/branches/bigbang/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java Thu Oct 11 12:37:32 2007
@@ -2243,7 +2243,7 @@
//assertEquals( "2.5.4.11=some people", rdn.getNormName() );
assertEquals( "ou", rdn.getNormType() );
assertEquals( "ou", rdn.getUpType() );
- //assertEquals( "some people", rdn.getNormValue() );
+ //assertEquals( "some people", rdn.getNormalizedValue() );
//assertEquals( "ou= Some People ", rdn.getUpValue() );
LdapDN result = LdapDN.normalize( name, oids );
@@ -2257,7 +2257,7 @@
//assertEquals( "2.5.4.11=some people", rdn2.getNormName() );
assertEquals( "2.5.4.11", rdn2.getNormType() );
assertEquals( "ou", rdn2.getUpType() );
- //assertEquals( "some people", rdn2.getNormValue() );
+ //assertEquals( "some people", rdn2.getNormalizedValue() );
//assertEquals( "ou= Some People ", rdn2.getUpValue() );
}