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 2011/03/08 01:22:38 UTC
svn commit: r1079048 [4/4] - in /directory/shared/branches/akarasulu: ./
all/ asn1/ asn1/src/ asn1/src/site/ dsml/ dsml/parser/
dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/
dsml/parser/src/main/java/org/apache/directory/shared/dsmlv2/r...
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntryAttribute.java Tue Mar 8 00:22:33 2011
@@ -160,6 +160,27 @@ public class DefaultEntryAttribute imple
/**
* Create a new instance of a EntryAttribute, without ID nor value.
+ */
+ /* No qualifier */ DefaultEntryAttribute( AttributeType attributeType, String upId, String normId, boolean isHR, int hashCode, Value<?>... values)
+ {
+ this.attributeType = attributeType;
+ this.upId = upId;
+ this.id = normId;
+ this.isHR = isHR;
+ this.h = hashCode;
+
+ if ( values != null )
+ {
+ for ( Value<?> value : values )
+ {
+ this.values.add( value );
+ }
+ }
+ }
+
+
+ /**
+ * Create a new instance of a EntryAttribute, without ID nor value.
*
* @param attributeType the attributeType for the empty attribute added into the entry
*/
@@ -2421,11 +2442,11 @@ public class DefaultEntryAttribute imple
// Write the value, using the correct method
if ( value instanceof StringValue)
{
- ((StringValue)value).serialize( out );
+ StringValue.serialize( value, out );
}
else
{
- ((BinaryValue)value).serialize( out );
+ BinaryValue.serialize( value, out );
}
}
}
@@ -2462,13 +2483,11 @@ public class DefaultEntryAttribute imple
if ( isHR )
{
- value = new StringValue( attributeType );
- ((StringValue)value).deserialize( in );
+ value = StringValue.deserialize( null, in );
}
else
{
- value = new BinaryValue( attributeType );
- ((BinaryValue)value).deserialize( in );
+ value = BinaryValue.deserialize( null, in );
}
try
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryUtils.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryUtils.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/EntryUtils.java Tue Mar 8 00:22:33 2011
@@ -62,6 +62,8 @@ public class EntryUtils
*/
static class MR extends MatchingRule
{
+ private static final long serialVersionUID = 1L;
+
protected MR( String oid )
{
super( oid );
@@ -83,6 +85,8 @@ public class EntryUtils
}
static class S extends LdapSyntax
{
+ private static final long serialVersionUID = 1L;
+
public S( String oid, boolean humanReadible )
{
super( oid, "", humanReadible );
@@ -96,6 +100,8 @@ public class EntryUtils
syntax.setSyntaxChecker( new SyntaxChecker( "1.1.2.1" )
{
+ private static final long serialVersionUID = 1L;
+
public boolean isValidSyntax( Object value )
{
if ( !( value instanceof String ) )
@@ -122,6 +128,8 @@ public class EntryUtils
matchingRule.setLdapComparator( new LdapComparator<String>( matchingRule.getOid() )
{
+ private static final long serialVersionUID = 1L;
+
public int compare( String o1, String o2 )
{
return ( o1 == null ?
@@ -132,6 +140,9 @@ public class EntryUtils
Normalizer normalizer = new Normalizer( "1.1.1" )
{
+ private static final long serialVersionUID = 1L;
+
+
public Value<?> normalize( Value<?> value ) throws LdapException
{
if ( !value.isBinary() )
@@ -166,6 +177,8 @@ public class EntryUtils
syntax.setSyntaxChecker( new SyntaxChecker( "1.1.2" )
{
+ private static final long serialVersionUID = 1L;
+
public boolean isValidSyntax( Object value )
{
return ((String)value == null) || (((String)value).length() < 7) ;
@@ -178,6 +191,8 @@ public class EntryUtils
matchingRule.setLdapComparator( new LdapComparator<String>( matchingRule.getOid() )
{
+ private static final long serialVersionUID = 1L;
+
public int compare( String o1, String o2 )
{
return ( ( o1 == null ) ?
@@ -202,6 +217,8 @@ public class EntryUtils
syntax.setSyntaxChecker( new SyntaxChecker( "1.2.1" )
{
+ private static final long serialVersionUID = 1L;
+
public boolean isValidSyntax( Object value )
{
return ( value == null ) || ( ((byte[])value).length < 5 );
@@ -215,6 +232,8 @@ public class EntryUtils
matchingRule.setNormalizer( new Normalizer( "1.1.1" )
{
+ private static final long serialVersionUID = 1L;
+
public Value<?> normalize( Value<?> value ) throws LdapException
{
if ( value.isBinary() )
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/StringValue.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/StringValue.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/StringValue.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/StringValue.java Tue Mar 8 00:22:33 2011
@@ -25,12 +25,13 @@ import java.io.ObjectOutput;
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.model.exception.LdapException;
-import org.apache.directory.shared.util.exception.NotImplementedException;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.LdapComparator;
import org.apache.directory.shared.ldap.model.schema.Normalizer;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.util.Strings;
import org.apache.directory.shared.util.Unicode;
+import org.apache.directory.shared.util.exception.NotImplementedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -546,110 +547,15 @@ public class StringValue extends Abstrac
/**
- * We will write the value and the normalized value, only
- * if the normalized value is different.
- *
- * If the value is empty, a flag is written at the beginning with
- * the value true, otherwise, a false is written.
- *
- * The data will be stored following this structure :
- * [empty value flag]
- * [UP value]
- * [normalized] (will be false if the value can't be normalized)
- * [same] (a flag set to true if the normalized value equals the UP value)
- * [Norm value] (the normalized value if different from the UP value)
- *
- * @param out the buffer in which we will stored the serialized form of the value
- * @throws IOException if we can't write into the buffer
+ * {@inheritDoc}
*/
- public void serialize( ObjectOutput out ) throws IOException
+ public static StringValue deserialize( SchemaManager schemaManager, ObjectInput in ) throws IOException
{
- if ( wrappedValue != null )
- {
- // write a flag indicating that the value is not null
- out.writeBoolean( true );
-
- // Write the data
- Unicode.writeUTF(out, wrappedValue);
-
- // Normalize the data
- try
- {
- normalize();
- out.writeBoolean( true );
-
- if ( wrappedValue.equals( normalizedValue ) )
- {
- out.writeBoolean( true );
- }
- else
- {
- out.writeBoolean( false );
- Unicode.writeUTF(out, normalizedValue);
- }
- }
- catch ( LdapException ne )
- {
- // The value can't be normalized, we don't write the
- // normalized value.
- normalizedValue = null;
- out.writeBoolean( false );
- }
- }
- else
- {
- // Write a flag indicating that the value is null
- out.writeBoolean( false );
- }
-
- out.flush();
+ return (StringValue)AbstractValue.deserialize( schemaManager, in );
}
/**
- * Deserialize a StringValue.
- *
- * @param in the buffer containing the bytes with the serialized value
- * @throws IOException
- * @throws ClassNotFoundException
- */
- public void deserialize( ObjectInput in ) throws IOException, ClassNotFoundException
- {
- // If the value is null, the flag will be set to false
- if ( !in.readBoolean() )
- {
- wrappedValue = null;
- normalizedValue = null;
- return;
- }
-
- // Read the value
- String wrapped = Unicode.readUTF(in);
-
- wrappedValue = wrapped;
-
- // Read the normalized flag
- normalized = in.readBoolean();
-
- if ( normalized )
- {
- normalized = true;
-
- // Read the 'same' flag
- if ( in.readBoolean() )
- {
- normalizedValue = wrapped;
- }
- else
- {
- // The normalized value is different. Read it
- normalizedValue = Unicode.readUTF(in);
- }
- }
- }
-
-
- /**
* @see Object#toString()
*/
public String toString()
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Value.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Value.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Value.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/entry/Value.java Tue Mar 8 00:22:33 2011
@@ -23,7 +23,6 @@ package org.apache.directory.shared.ldap
import java.io.Externalizable;
import org.apache.directory.shared.ldap.model.exception.LdapException;
-
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.ldap.model.schema.Normalizer;
import org.apache.directory.shared.ldap.model.schema.SyntaxChecker;
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntry.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntry.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntry.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntry.java Tue Mar 8 00:22:33 2011
@@ -30,8 +30,15 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.directory.shared.ldap.model.entry.*;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntry;
+import org.apache.directory.shared.ldap.model.entry.DefaultEntryAttribute;
+import org.apache.directory.shared.ldap.model.entry.DefaultModification;
+import org.apache.directory.shared.ldap.model.entry.Entry;
+import org.apache.directory.shared.ldap.model.entry.EntryAttribute;
+import org.apache.directory.shared.ldap.model.entry.Modification;
+import org.apache.directory.shared.ldap.model.entry.ModificationOperation;
import org.apache.directory.shared.ldap.model.entry.StringValue;
+import org.apache.directory.shared.ldap.model.entry.Value;
import org.apache.directory.shared.ldap.model.exception.LdapException;
import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.shared.ldap.model.message.Control;
@@ -54,11 +61,8 @@ import org.apache.directory.shared.util.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class LdifEntry implements Cloneable, Externalizable
+public class LdifEntry implements Cloneable
{
- /** The serial version UID */
- private static final long serialVersionUID = 2L;
-
/** Used in toArray() */
public static final Modification[] EMPTY_MODS = new Modification[0];
@@ -88,7 +92,7 @@ public class LdifEntry implements Clonea
/**
- * Creates a new Entry object.
+ * Creates a new LdifEntry object.
*/
public LdifEntry()
{
@@ -101,6 +105,19 @@ public class LdifEntry implements Clonea
/**
+ * Creates a new LdifEntry object, storing an Entry
+ */
+ public LdifEntry( Entry entry )
+ {
+ changeType = ChangeType.None; // Default LDIF content
+ modificationList = new LinkedList<Modification>();
+ modificationItems = new HashMap<String, Modification>();
+ this.entry = entry;
+ controls = null;
+ }
+
+
+ /**
* Set the Distinguished Name
*
* @param dn The Distinguished Name
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java Tue Mar 8 00:22:33 2011
@@ -36,7 +36,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.schema.MatchingRule;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
import org.apache.directory.shared.util.Strings;
-import org.apache.directory.shared.util.Unicode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -782,9 +781,35 @@ public final class Ava implements Extern
throw new IOException( message );
}
- Unicode.writeUTF(out, upName);
- Unicode.writeUTF(out, upType);
- Unicode.writeUTF(out, normType);
+ if ( upName != null )
+ {
+ out.writeBoolean( true );
+ out.writeUTF( upName );
+ }
+ else
+ {
+ out.writeBoolean( false);
+ }
+
+ if ( upType != null )
+ {
+ out.writeBoolean( true );
+ out.writeUTF( upType );
+ }
+ else
+ {
+ out.writeBoolean( false);
+ }
+
+ if ( normType != null )
+ {
+ out.writeBoolean( true );
+ out.writeUTF( normType );
+ }
+ else
+ {
+ out.writeBoolean( false);
+ }
boolean isHR = !normValue.isBinary();
@@ -792,15 +817,13 @@ public final class Ava implements Extern
if ( isHR )
{
- Unicode.writeUTF(out, upValue.getString());
- Unicode.writeUTF(out, normValue.getString());
+ StringValue.serialize( upValue, out );
+ StringValue.serialize( normValue, out );
}
else
{
- out.writeInt( upValue.length() );
- out.write( upValue.getBytes() );
- out.writeInt( normValue.length() );
- out.write( normValue.getBytes() );
+ BinaryValue.serialize( upValue, out );
+ BinaryValue.serialize( normValue, out );
}
}
@@ -814,28 +837,43 @@ public final class Ava implements Extern
*/
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
{
- upName = Unicode.readUTF(in);
- upType = Unicode.readUTF(in);
- normType = Unicode.readUTF(in);
+ boolean hasUpName = in.readBoolean();
+
+ if ( hasUpName )
+ {
+ upName = in.readUTF();
+ }
+
+ boolean hasUpType = in.readBoolean();
+
+ if ( hasUpType )
+ {
+ upType = in.readUTF();
+ }
+
+ boolean hasNormType = in.readBoolean();
+
+ if ( hasNormType )
+ {
+ normType = in.readUTF();
+ }
boolean isHR = in.readBoolean();
if ( isHR )
{
- upValue = new StringValue( Unicode.readUTF(in) );
- normValue = new StringValue( Unicode.readUTF(in) );
+ upValue = StringValue.deserialize( schemaManager, in );
+ normValue = StringValue.deserialize( schemaManager, in );
}
else
{
- int upValueLength = in.readInt();
- byte[] upValueBytes = new byte[upValueLength];
- in.readFully( upValueBytes );
- upValue = new BinaryValue( upValueBytes );
-
- int valueLength = in.readInt();
- byte[] normValueBytes = new byte[valueLength];
- in.readFully( normValueBytes );
- normValue = new BinaryValue( normValueBytes );
+ upValue = BinaryValue.deserialize( schemaManager, in );
+ normValue = BinaryValue.deserialize( schemaManager, in );
+ }
+
+ if ( schemaManager != null )
+ {
+ attributeType = schemaManager.getAttributeType( upType );
}
}
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/AvaSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/AvaSerializer.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/AvaSerializer.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/AvaSerializer.java Tue Mar 8 00:22:33 2011
@@ -23,13 +23,8 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import org.apache.directory.shared.ldap.model.entry.BinaryValue;
-import org.apache.directory.shared.ldap.model.entry.StringValue;
-import org.apache.directory.shared.ldap.model.entry.Value;
import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
-import org.apache.directory.shared.util.Strings;
-import org.apache.directory.shared.util.Unicode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -75,65 +70,14 @@ public final class AvaSerializer
* <li>valueLength</li>
* <li>value</li> The normalized value.
*
- * @param atav the AttributeTypeAndValue to serialize
+ * @param ava the AttributeTypeAndValue to serialize
* @param out the OutputStream in which the atav will be serialized
* @throws IOException If we can't serialize the atav
*/
- public static void serialize( Ava atav, ObjectOutput out ) throws IOException
+ public static void serialize( Ava ava, ObjectOutput out ) throws IOException
{
- if ( Strings.isEmpty(atav.getUpName())
- || Strings.isEmpty(atav.getUpType())
- || Strings.isEmpty(atav.getNormType())
- || ( atav.getUpValue().isNull() )
- || ( atav.getNormValue().isNull() ) )
- {
- String message = "Cannot serialize an wrong ATAV, ";
-
- if ( Strings.isEmpty(atav.getUpName()) )
- {
- message += "the upName should not be null or empty";
- }
- else if ( Strings.isEmpty(atav.getUpType()) )
- {
- message += "the upType should not be null or empty";
- }
- else if ( Strings.isEmpty(atav.getNormType()) )
- {
- message += "the normType should not be null or empty";
- }
- else if ( atav.getUpValue().isNull() )
- {
- message += "the upValue should not be null";
- }
- else if ( atav.getNormValue().isNull() )
- {
- message += "the value should not be null";
- }
-
- LOG.error( message );
- throw new IOException( message );
- }
-
- Unicode.writeUTF(out, atav.getUpName());
- Unicode.writeUTF(out, atav.getUpType());
- Unicode.writeUTF(out, atav.getNormType());
-
- boolean isHR = !atav.getNormValue().isBinary();
-
- out.writeBoolean( isHR );
-
- if ( isHR )
- {
- Unicode.writeUTF(out, atav.getUpValue().getString());
- Unicode.writeUTF(out, atav.getNormValue().getString());
- }
- else
- {
- out.writeInt( atav.getUpValue().length() );
- out.write( atav.getUpValue().getBytes() );
- out.writeInt( atav.getNormValue().length() );
- out.write( atav.getNormValue().getBytes() );
- }
+ ava.writeExternal( out );
+ out.flush();
}
@@ -151,45 +95,17 @@ public final class AvaSerializer
public static Ava deserialize( SchemaManager schemaManager, ObjectInput in )
throws IOException, LdapInvalidDnException
{
- String upName = Unicode.readUTF(in);
- String upType = Unicode.readUTF(in);
- String normType = Unicode.readUTF(in);
+ Ava ava = new Ava( schemaManager );
- boolean isHR = in.readBoolean();
-
try
{
- if ( isHR )
- {
- Value<String> upValue = new StringValue( Unicode.readUTF(in) );
- Value<String> normValue = new StringValue( Unicode.readUTF(in) );
-
- Ava atav =
- new Ava( schemaManager, upType, normType, upValue, normValue );
-
- return atav;
- }
- else
- {
- int upValueLength = in.readInt();
- byte[] upValue = new byte[upValueLength];
- in.readFully( upValue );
-
- int valueLength = in.readInt();
- byte[] normValue = new byte[valueLength];
- in.readFully( normValue );
-
- Ava atav =
- new Ava( upType, normType,
- new BinaryValue( upValue) ,
- new BinaryValue( normValue ), upName );
-
- return atav;
- }
+ ava.readExternal( in );
}
- catch ( LdapInvalidDnException ine )
+ catch ( ClassNotFoundException cnfe )
{
- throw new IOException( ine.getMessage() );
+ throw new IOException( cnfe.getMessage() );
}
+
+ return ava;
}
}
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java Tue Mar 8 00:22:33 2011
@@ -21,6 +21,10 @@
package org.apache.directory.shared.ldap.model.name;
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
@@ -59,7 +63,7 @@ import org.slf4j.LoggerFactory;
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public final class Dn implements Iterable<Rdn>
+public final class Dn implements Iterable<Rdn>, Externalizable
{
/** The LoggerFactory used by this class */
protected static final Logger LOG = LoggerFactory.getLogger( Dn.class );
@@ -301,7 +305,9 @@ public final class Dn implements Iterabl
Dn( SchemaManager schemaManager, String upName, String normName, Rdn... rdns )
{
this.schemaManager = schemaManager;
- normalized = schemaManager != null;
+
+ normalized = ( schemaManager != null ) || ( normName != null );
+
this.upName = upName;
this.normName = normName;
bytes = Strings.getBytesUtf8( upName );
@@ -1681,4 +1687,72 @@ public final class Dn implements Iterabl
return true;
}
+
+
+ public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
+ {
+ // Read the UPName
+ upName = in.readUTF();
+
+ // Read the NormName
+ normName = in.readUTF();
+
+ if ( normName.length() == 0 )
+ {
+ // As the normName is equal to the upName,
+ // we didn't saved the nbnormName on disk.
+ // restore it by copying the upName.
+ normName = upName;
+ }
+
+ // Read the RDNs. Is it's null, the number will be -1.
+ int nbRdns = in.readInt();
+
+ rdns = new ArrayList<Rdn>( nbRdns );
+
+ for ( int i = 0; i < nbRdns; i++ )
+ {
+ Rdn rdn = new Rdn( schemaManager );
+ rdn.readExternal( in );
+ rdns.add( rdn );
+ }
+ }
+
+
+ public void writeExternal( ObjectOutput out ) throws IOException
+ {
+ if ( upName == null )
+ {
+ String message = "Cannot serialize a NULL Dn";
+ LOG.error( message );
+ throw new IOException( message );
+ }
+
+ // Write the UPName
+ out.writeUTF( upName );
+
+ // Write the NormName if different
+ if ( upName.equals( normName ) )
+ {
+ out.writeUTF( "" );
+ }
+ else
+ {
+ out.writeUTF( normName );
+ }
+
+ // Should we store the byte[] ???
+
+ // Write the RDNs.
+ // First the number of RDNs
+ out.writeInt( size() );
+
+ // Loop on the RDNs
+ for ( Rdn rdn : rdns )
+ {
+ rdn.writeExternal( out );
+ }
+
+ out.flush();
+ }
}
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/DnSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/DnSerializer.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/DnSerializer.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/DnSerializer.java Tue Mar 8 00:22:33 2011
@@ -29,7 +29,6 @@ import java.io.ObjectOutputStream;
import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
-import org.apache.directory.shared.util.Unicode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -76,8 +75,6 @@ public final class DnSerializer
serialize( dn, out );
- out.flush();
-
return baos.toByteArray();
}
@@ -101,37 +98,8 @@ public final class DnSerializer
*/
public static void serialize( Dn dn, ObjectOutput out ) throws IOException
{
- if ( dn.getName() == null )
- {
- String message = "Cannot serialize a NULL Dn";
- LOG.error( message );
- throw new IOException( message );
- }
-
- // Write the UPName
- Unicode.writeUTF(out, dn.getName());
-
- // Write the NormName if different
- if ( dn.getName().equals( dn.getNormName() ) )
- {
- Unicode.writeUTF(out, "");
- }
- else
- {
- Unicode.writeUTF(out, dn.getNormName());
- }
-
- // Should we store the byte[] ???
-
- // Write the RDNs.
- // First the number of RDNs
- out.writeInt( dn.size() );
-
- // Loop on the RDNs
- for ( Rdn rdn:dn.getRdns() )
- {
- RdnSerializer.serialize( rdn, out );
- }
+ dn.writeExternal( out );
+ out.flush();
}
@@ -171,32 +139,16 @@ public final class DnSerializer
public static Dn deserialize( SchemaManager schemaManager, ObjectInput in )
throws IOException, LdapInvalidDnException
{
- // Read the UPName
- String upName = Unicode.readUTF(in);
-
- // Read the NormName
- String normName = Unicode.readUTF(in);
-
- if ( normName.length() == 0 )
+ Dn dn = new Dn( schemaManager );
+
+ try
{
- // As the normName is equal to the upName,
- // we didn't saved the nbnormName on disk.
- // restore it by copying the upName.
- normName = upName;
+ dn.readExternal( in );
}
-
- // Read the RDNs. Is it's null, the number will be -1.
- int nbRdns = in.readInt();
-
- Rdn[] rdns = new Rdn[nbRdns];
-
- for ( int i = 0; i < nbRdns; i++ )
+ catch ( ClassNotFoundException cnfe )
{
- Rdn rdn = RdnSerializer.deserialize( schemaManager, in );
- rdns[i] = rdn;
+ throw new IOException( cnfe.getMessage() );
}
-
- Dn dn = new Dn( schemaManager, upName, normName, rdns );
return dn;
}
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java Tue Mar 8 00:22:33 2011
@@ -1485,15 +1485,15 @@ public final class Rdn implements Clonea
public void writeExternal( ObjectOutput out ) throws IOException
{
out.writeInt( nbAtavs );
- Unicode.writeUTF(out, upName);
+ out.writeUTF( upName );
if ( upName.equals( normName ) )
{
- Unicode.writeUTF(out, "");
+ out.writeUTF( "" );
}
else
{
- Unicode.writeUTF(out, normName);
+ out.writeUTF( normName );
}
switch ( nbAtavs )
@@ -1502,13 +1502,13 @@ public final class Rdn implements Clonea
break;
case 1:
- out.writeObject( atav );
+ atav.writeExternal( out );
break;
default:
- for ( Ava value : atavs )
+ for ( Ava ava : atavs )
{
- out.writeObject( value );
+ ava.writeExternal( out );
}
break;
@@ -1532,10 +1532,10 @@ public final class Rdn implements Clonea
nbAtavs = in.readInt();
// Read the UPName
- upName = Unicode.readUTF(in);
+ upName = in.readUTF();
// Read the normName
- normName = Unicode.readUTF(in);
+ normName = in.readUTF();
if ( Strings.isEmpty(normName) )
{
@@ -1549,7 +1549,8 @@ public final class Rdn implements Clonea
break;
case 1:
- atav = (Ava) in.readObject();
+ atav = new Ava( schemaManager );
+ atav.readExternal( in );
atavType = atav.getNormType();
break;
@@ -1561,9 +1562,10 @@ public final class Rdn implements Clonea
for ( int i = 0; i < nbAtavs; i++ )
{
- Ava value = (Ava) in.readObject();
- atavs.add( value );
- atavTypes.put( value.getNormType(), value );
+ Ava ava = new Ava( schemaManager );
+ ava.readExternal( in );
+ atavs.add( ava );
+ atavTypes.put( ava.getNormType(), ava );
}
atav = null;
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/RdnSerializer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/RdnSerializer.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/RdnSerializer.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/RdnSerializer.java Tue Mar 8 00:22:33 2011
@@ -25,8 +25,6 @@ import java.io.ObjectOutput;
import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
import org.apache.directory.shared.ldap.model.schema.SchemaManager;
-import org.apache.directory.shared.util.Strings;
-import org.apache.directory.shared.util.Unicode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -71,23 +69,8 @@ public final class RdnSerializer
*/
public static void serialize( Rdn rdn, ObjectOutput out ) throws IOException
{
- out.writeInt( rdn.getNbAtavs() );
- Unicode.writeUTF(out, rdn.getName());
- Unicode.writeUTF(out, rdn.getNormName());
-
- switch ( rdn.getNbAtavs() )
- {
- case 0 :
- break;
-
- default :
- for ( Ava atav:rdn )
- {
- AvaSerializer.serialize(atav, out);
- }
-
- break;
- }
+ rdn.writeExternal( out );
+ out.flush();
}
@@ -106,45 +89,15 @@ public final class RdnSerializer
public static Rdn deserialize( SchemaManager schemaManager, ObjectInput in )
throws IOException, LdapInvalidDnException
{
- // Read the ATAV number
- int nbAtavs = in.readInt();
-
- // Read the UPName
- String upName = Unicode.readUTF(in);
-
- // Read the normName
- String normName = Unicode.readUTF(in);
-
- if ( Strings.isEmpty(normName) )
+ Rdn rdn = new Rdn( schemaManager );
+
+ try
{
- normName = upName;
+ rdn.readExternal( in );
}
-
- Rdn rdn = null;
-
- // Read through the Atavs
- switch ( nbAtavs )
+ catch ( ClassNotFoundException cnfe )
{
- case 0 :
- rdn = new Rdn( schemaManager, upName, normName, (Ava[])null );
- break;
-
- case 1 :
- Ava ava = AvaSerializer.deserialize( schemaManager, in );
-
- rdn = new Rdn( schemaManager, upName, normName, ava );
- break;
-
- default :
- Ava[] avas = new Ava[nbAtavs];
-
- for ( int i = 0; i < nbAtavs; i++ )
- {
- ava = AvaSerializer.deserialize( schemaManager, in );
- avas[i] = ava;
- }
-
- rdn = new Rdn( schemaManager, upName, normName, avas );
+ throw new IOException( cnfe.getMessage() );
}
return rdn;
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/AttributeType.java Tue Mar 8 00:22:33 2011
@@ -141,6 +141,8 @@ import org.slf4j.LoggerFactory;
*/
public class AttributeType extends AbstractSchemaObject implements Cloneable
{
+ private static final long serialVersionUID = 1L;
+
/** A logger for this class */
private static final Logger LOG = LoggerFactory.getLogger( AttributeType.class );
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/DITContentRule.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/DITContentRule.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/DITContentRule.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/DITContentRule.java Tue Mar 8 00:22:33 2011
@@ -119,6 +119,8 @@ import org.apache.directory.shared.ldap.
@SuppressWarnings("PMD.OverrideBothEqualsAndHashcode")
public class DITContentRule extends AbstractSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/** The list of Auxiliary ObjectClass OIDs entries may belong to */
private List<String> auxObjectClassOids;
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/DITStructureRule.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/DITStructureRule.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/DITStructureRule.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/DITStructureRule.java Tue Mar 8 00:22:33 2011
@@ -84,6 +84,8 @@ import org.apache.directory.shared.util.
@SuppressWarnings("PMD.OverrideBothEqualsAndHashcode")
public class DITStructureRule extends AbstractSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/** The rule ID. A DSR does not have an OID */
private int ruleId;
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/LdapSyntax.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/LdapSyntax.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/LdapSyntax.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/LdapSyntax.java Tue Mar 8 00:22:33 2011
@@ -74,6 +74,8 @@ import org.apache.directory.shared.ldap.
@SuppressWarnings("PMD.OverrideBothEqualsAndHashcode")
public class LdapSyntax extends AbstractSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/** the human readable flag */
protected boolean isHumanReadable = false;
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRule.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRule.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRule.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRule.java Tue Mar 8 00:22:33 2011
@@ -89,6 +89,8 @@ import org.slf4j.LoggerFactory;
@SuppressWarnings("PMD.OverrideBothEqualsAndHashcode")
public class MatchingRule extends AbstractSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/** A logger for this class */
private static final Logger LOG = LoggerFactory.getLogger( MatchingRule.class );
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRuleUse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRuleUse.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRuleUse.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/MatchingRuleUse.java Tue Mar 8 00:22:33 2011
@@ -88,6 +88,8 @@ import org.apache.directory.shared.ldap.
@SuppressWarnings("PMD.OverrideBothEqualsAndHashcode")
public class MatchingRuleUse extends AbstractSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/** The list of attributes types OID the matching rule applies to */
private List<String> applicableAttributeOids;
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/NameForm.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/NameForm.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/NameForm.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/NameForm.java Tue Mar 8 00:22:33 2011
@@ -98,6 +98,8 @@ import org.apache.directory.shared.ldap.
@SuppressWarnings("PMD.OverrideBothEqualsAndHashcode")
public class NameForm extends AbstractSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/** The structural object class OID this rule applies to */
private String structuralObjectClassOid;
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/ObjectClass.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/ObjectClass.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/ObjectClass.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/ObjectClass.java Tue Mar 8 00:22:33 2011
@@ -79,6 +79,8 @@ import org.apache.directory.shared.ldap.
@SuppressWarnings("PMD.OverrideBothEqualsAndHashcode")
public class ObjectClass extends AbstractSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/** The ObjectClass type : ABSTRACT, AUXILIARY or STRUCTURAL */
private ObjectClassTypeEnum objectClassType = ObjectClassTypeEnum.STRUCTURAL;
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/DnComparator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/DnComparator.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/DnComparator.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/comparators/DnComparator.java Tue Mar 8 00:22:33 2011
@@ -33,7 +33,6 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-@SuppressWarnings("serial")
public class DnComparator extends LdapComparator<Object>
{
/** The serial version UID */
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/LdapComparatorDescription.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/LdapComparatorDescription.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/LdapComparatorDescription.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/LdapComparatorDescription.java Tue Mar 8 00:22:33 2011
@@ -32,6 +32,8 @@ import org.apache.directory.shared.ldap.
*/
public class LdapComparatorDescription extends LoadableSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/**
* A constructor for a LdapComparatorDescription.
* @param oid The associated OID
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/NormalizerDescription.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/NormalizerDescription.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/NormalizerDescription.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/NormalizerDescription.java Tue Mar 8 00:22:33 2011
@@ -32,6 +32,8 @@ import org.apache.directory.shared.ldap.
*/
public class NormalizerDescription extends LoadableSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/**
* Default constructor for a NormalizerDecription
* @param oid The SyntaxChecker OID
Modified: directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/SyntaxCheckerDescription.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/SyntaxCheckerDescription.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/SyntaxCheckerDescription.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/schema/parsers/SyntaxCheckerDescription.java Tue Mar 8 00:22:33 2011
@@ -17,7 +17,6 @@
* under the License.
*
*/
-
package org.apache.directory.shared.ldap.model.schema.parsers;
@@ -32,6 +31,8 @@ import org.apache.directory.shared.ldap.
*/
public class SyntaxCheckerDescription extends LoadableSchemaObject
{
+ private static final long serialVersionUID = 1L;
+
/**
* Default constructor for a SyntaxCheckerDecription
* @param oid The SyntaxChecker OID
Modified: directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueAttributeTypeTest.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueAttributeTypeTest.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueAttributeTypeTest.java Tue Mar 8 00:22:33 2011
@@ -88,6 +88,8 @@ public class BinaryValueAttributeTypeTes
mr.setLdapComparator( new ByteArrayComparator( "1.1.1" ) );
mr.setNormalizer( new Normalizer( "1.1.1" )
{
+ private static final long serialVersionUID = 1L;
+
public Value<?> normalize( Value<?> value ) throws LdapException
{
if ( value.isBinary() )
@@ -134,7 +136,7 @@ public class BinaryValueAttributeTypeTes
try
{
oOut = new ObjectOutputStream( out );
- value.serialize( oOut );
+ BinaryValue.serialize( value, oOut );
}
catch ( IOException ioe )
{
@@ -172,8 +174,7 @@ public class BinaryValueAttributeTypeTes
{
oIn = new ObjectInputStream( in );
- BinaryValue value = new BinaryValue( at );
- value.deserialize( oIn );
+ BinaryValue value = BinaryValue.deserialize( null, oIn );
return value;
}
Modified: directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueTest.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueTest.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/BinaryValueTest.java Tue Mar 8 00:22:33 2011
@@ -62,6 +62,8 @@ public class BinaryValueTest
private static final Normalizer BINARY_NORMALIZER = new Normalizer( "1.1.1" )
{
+ private static final long serialVersionUID = 1L;
+
public Value<?> normalize( Value<?> value ) throws LdapException
{
if ( value.isBinary() )
@@ -94,6 +96,8 @@ public class BinaryValueTest
*/
private static final Normalizer BINARY_NORMALIZER_EMPTY = new Normalizer( "1.1.1" )
{
+ private static final long serialVersionUID = 1L;
+
public Value<?> normalize( Value<?> value ) throws LdapException
{
if ( value.isBinary() )
@@ -113,6 +117,8 @@ public class BinaryValueTest
private static final SyntaxChecker BINARY_CHECKER = new SyntaxChecker( "1.1.1" )
{
+ private static final long serialVersionUID = 1L;
+
public boolean isValidSyntax( Object value )
{
if ( value == null )
Modified: directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueAttributeTypeTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueAttributeTypeTest.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueAttributeTypeTest.java (original)
+++ directory/shared/branches/akarasulu/ldap/model/src/test/java/org/apache/directory/shared/ldap/model/entry/StringValueAttributeTypeTest.java Tue Mar 8 00:22:33 2011
@@ -106,7 +106,7 @@ public class StringValueAttributeTypeTes
try
{
oOut = new ObjectOutputStream( out );
- value.serialize( oOut );
+ StringValue.serialize( value, oOut );
}
catch ( IOException ioe )
{
@@ -135,7 +135,7 @@ public class StringValueAttributeTypeTes
/**
* Deserialize a StringValue
*/
- private StringValue deserializeValue( ByteArrayOutputStream out, AttributeType at ) throws IOException, ClassNotFoundException
+ private StringValue deserializeValue( ByteArrayOutputStream out ) throws IOException, ClassNotFoundException
{
ObjectInputStream oIn = null;
ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() );
@@ -144,8 +144,7 @@ public class StringValueAttributeTypeTes
{
oIn = new ObjectInputStream( in );
- StringValue value = new StringValue( at );
- value.deserialize( oIn );
+ StringValue value = StringValue.deserialize( null, oIn );
return value;
}
@@ -445,6 +444,8 @@ public class StringValueAttributeTypeTes
@Test public void testConstrainedString()
{
s.setSyntaxChecker( new SyntaxChecker( "1.1.1.1" ) {
+ private static final long serialVersionUID = 1L;
+
public boolean isValidSyntax( Object value )
{
if ( value instanceof String )
@@ -459,6 +460,8 @@ public class StringValueAttributeTypeTes
mr.setSyntax( s );
mr.setLdapComparator( new LdapComparator<String>( mr.getOid() )
{
+ private static final long serialVersionUID = 1L;
+
public int compare( String o1, String o2 )
{
if ( o1 == null )
@@ -691,7 +694,7 @@ public class StringValueAttributeTypeTes
assertEquals( "test test", normalized );
assertEquals( " Test Test ", ssv.getString() );
- StringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+ StringValue ssvSer = deserializeValue( serializeValue( ssv ) );
assertEquals( ssv, ssvSer );
}
@@ -711,7 +714,7 @@ public class StringValueAttributeTypeTes
assertEquals( "test", normalized );
assertEquals( "test", ssv.getString() );
- StringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+ StringValue ssvSer = deserializeValue( serializeValue( ssv ) );
assertEquals( ssv, ssvSer );
}
@@ -731,7 +734,7 @@ public class StringValueAttributeTypeTes
assertNull( normalized );
assertNull( ssv.get() );
- StringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+ StringValue ssvSer = deserializeValue( serializeValue( ssv ) );
assertEquals( ssv, ssvSer );
}
@@ -751,7 +754,7 @@ public class StringValueAttributeTypeTes
assertEquals( "", normalized );
assertEquals( "", ssv.getString() );
- StringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+ StringValue ssvSer = deserializeValue( serializeValue( ssv ) );
assertEquals( ssv, ssvSer );
}
@@ -763,11 +766,11 @@ public class StringValueAttributeTypeTes
@Test public void testStringValueEmptyNormalizedSerialization() throws LdapException, IOException, ClassNotFoundException
{
// First check with a value which will be normalized
- StringValue ssv = new StringValue( at, " " );
+ StringValue ssv = new StringValue( " " );
assertEquals( " ", ssv.getString() );
- StringValue ssvSer = deserializeValue( serializeValue( ssv ), at );
+ StringValue ssvSer = deserializeValue( serializeValue( ssv ) );
assertEquals( ssv, ssvSer );
}
Propchange: directory/shared/branches/akarasulu/ldap/net/mina/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 8 00:22:33 2011
@@ -1,3 +1,4 @@
+/directory/shared/branches/milestones/ldap/net/mina:1078333-1079042
/directory/shared/branches/milestones/ldap-codec:1072811-1074633
/directory/shared/branches/milestones/ldap-protocol-codec:1074637-1075326
/directory/shared/branches/shared-codec-merge/ldap:982370-987558
@@ -5,5 +6,6 @@
/directory/shared/branches/shared-dnfactory-experiment/ldap:980352-980933
/directory/shared/branches-dnfactory-experiment/ldap:980350-980351
/directory/shared/trunk/ldap:1066124-1067784
+/directory/shared/trunk/ldap/net/mina:1075835-1079037
/directory/shared/trunk/ldap-codec:1067785-1067995,1068025-1072732,1072797-1074636
/directory/shared/trunk/ldap-protocol-codec:1074637-1075328
Modified: directory/shared/branches/akarasulu/ldap/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/ldap/pom.xml?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/ldap/pom.xml (original)
+++ directory/shared/branches/akarasulu/ldap/pom.xml Tue Mar 8 00:22:33 2011
@@ -40,22 +40,4 @@
<module>extras</module>
</modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/directory/shared/trunk/ldap</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/directory/shared/trunk/ldap</developerConnection>
- <url>http://svn.apache.org/viewvc/directory/shared/trunk/ldap</url>
- </scm>
-
</project>
Propchange: directory/shared/branches/akarasulu/ldap/schema/data/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 8 00:22:33 2011
@@ -1,5 +1,6 @@
/directory/apacheds/branches/apacheds-replication/schema-data:749790-764110
/directory/shared/branches/antoine/ldap-schema:1038306-1044343
+/directory/shared/branches/milestones/ldap/schema/data:1078333-1079042
/directory/shared/branches/milestones/ldap-schema:1072811-1074633,1074637-1075326
/directory/shared/branches/shared-codec-merge/ldap-schema:982370-987558
/directory/shared/branches/shared-config/ldap-schema:1023444-1029061
@@ -9,4 +10,5 @@
/directory/shared/branches/shared-subtree/ldap-schema:965208-965686
/directory/shared/branches/xdbm-refactoring/ldap-schema:945830-946347
/directory/shared/branches-dnfactory-experiment/ldap-schema:980350-980351
+/directory/shared/trunk/ldap/schema/data:1075835-1079037
/directory/shared/trunk/ldap-schema:1066124-1067995,1068025-1072732,1072797-1075328
Propchange: directory/shared/branches/akarasulu/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 8 00:22:33 2011
@@ -1,4 +1,5 @@
/directory/shared/branches/antoine/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:1038306-1044343
+/directory/shared/branches/milestones/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl:1078333-1079042
/directory/shared/branches/milestones/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl:1072811-1074633,1074637-1075326
/directory/shared/branches/shared-codec-merge/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:982370-987558
/directory/shared/branches/shared-config/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:1023444-1029061
@@ -8,5 +9,6 @@
/directory/shared/branches/shared-subtree/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:965208-965686
/directory/shared/branches/xdbm-refactoring/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:945830-946347
/directory/shared/branches-dnfactory-experiment/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:980350-980351
+/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl:1075835-1079037
/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl:1066124-1067995,1068025-1072732,1072797-1075328
/directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl:806622-894844*
Propchange: directory/shared/branches/akarasulu/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Mar 8 00:22:33 2011
@@ -1,4 +1,5 @@
/directory/shared/branches/antoine/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:1038306-1044343
+/directory/shared/branches/milestones/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java:1078333-1079042
/directory/shared/branches/milestones/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java:1072811-1074633,1074637-1075326
/directory/shared/branches/shared-codec-merge/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:982370-987558
/directory/shared/branches/shared-config/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:1023444-1029061
@@ -8,5 +9,6 @@
/directory/shared/branches/shared-subtree/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:965208-965686
/directory/shared/branches/xdbm-refactoring/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:945830-946347
/directory/shared/branches-dnfactory-experiment/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:980350-980351
+/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java:1075835-1079037
/directory/shared/trunk/ldap-schema/src/main/java/org/apache/directory/shared/ldap/schemamanager/impl/DefaultSchemaManager.java:1066124-1067995,1068025-1072732,1072797-1075328
/directory/shared/trunk/ldap-schema-manager/src/main/java/org/apache/directory/shared/ldap/schema/manager/impl/DefaultSchemaManager.java:806622-894844
Modified: directory/shared/branches/akarasulu/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/pom.xml?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/pom.xml (original)
+++ directory/shared/branches/akarasulu/pom.xml Tue Mar 8 00:22:33 2011
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.directory.project</groupId>
<artifactId>project</artifactId>
- <version>20</version>
+ <version>21</version>
<relativePath/>
</parent>
@@ -53,12 +53,14 @@
<mina.core.version>2.0.2</mina.core.version>
<org.osgi.version>3.0.0</org.osgi.version>
<org.osgi.core.version>4.2.0</org.osgi.core.version>
- <org.apache.felix.version>3.0.2</org.apache.felix.version>
+ <org.apache.felix.version>3.0.9</org.apache.felix.version>
<slf4j.api.version>1.6.1</slf4j.api.version>
<slf4j.log4j12.version>1.6.1</slf4j.log4j12.version>
<xml.apis.version>2.0.2</xml.apis.version>
<xpp3.version>1.1.4c</xpp3.version>
- <pax-exam.version>1.2.3</pax-exam.version>
+ <pax-exam.version>2.0.0-M1</pax-exam.version>
+ <pax-exam-container-default.version>1.2.4</pax-exam-container-default.version>
+ <pax-exam-junit.version>1.2.4</pax-exam-junit.version>
<findbugs.annotations.version>1.0.0</findbugs.annotations.version>
</properties>
@@ -113,13 +115,14 @@
<!-- Missing license header in dependency reduced pom, see http://jira.codehaus.org/browse/MSHADE-48 -->
<exclude>**/dependency-reduced-pom.xml</exclude>
<!-- Generated ldif files -->
- <exclude>ldap-schema/src/main/resources/schema/**</exclude>
- <exclude>ldap-schema/src/main/resources/schema-all.ldif</exclude>
+ <exclude>ldap/schema/data/src/main/resources/schema/**</exclude>
+ <exclude>ldap/schema/data/src/main/resources/schema-all.ldif</exclude>
+ <exclude>schema/data/src/main/resources/schema/**</exclude>
+ <exclude>schema/data/src/main/resources/schema-all.ldif</exclude>
+ <exclude>data/src/main/resources/schema/**</exclude>
+ <exclude>data/src/main/resources/schema-all.ldif</exclude>
<exclude>src/main/resources/schema/**</exclude>
<exclude>src/main/resources/schema-all.ldif</exclude>
- <!-- Files having a Bouncy Castle license -->
- <exclude>ldap/src/main/java/org/apache/directory/shared/asn1/der/*.java</exclude>
- <exclude>src/main/java/org/apache/directory/shared/asn1/der/*.java</exclude>
</excludes>
</configuration>
</plugin>
@@ -150,20 +153,20 @@
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
+ <artifactId>maven-jxr-plugin</artifactId>
<configuration>
- <aggregate>true</aggregate>
+ <aggregate>true</aggregate>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
<configuration>
- <aggregate>true</aggregate>
+ <aggregate>true</aggregate>
</configuration>
</plugin>
-
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
@@ -537,14 +540,14 @@
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit</artifactId>
- <version>${pax-exam.version}</version>
+ <version>${pax-exam-junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-default</artifactId>
- <version>${pax-exam.version}</version>
+ <version>${pax-exam-container-default.version}</version>
<scope>test</scope>
</dependency>
Modified: directory/shared/branches/akarasulu/util/src/main/java/org/apache/directory/shared/util/OsgiUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/akarasulu/util/src/main/java/org/apache/directory/shared/util/OsgiUtils.java?rev=1079048&r1=1079047&r2=1079048&view=diff
==============================================================================
--- directory/shared/branches/akarasulu/util/src/main/java/org/apache/directory/shared/util/OsgiUtils.java (original)
+++ directory/shared/branches/akarasulu/util/src/main/java/org/apache/directory/shared/util/OsgiUtils.java Tue Mar 8 00:22:33 2011
@@ -140,7 +140,8 @@ public class OsgiUtils
public static Set<File> getClasspathCandidates( FileFilter filter )
{
Set<File> candidates = new HashSet<File>();
- String[] cpElements = System.getProperty( "java.class.path" ).split( ":" );
+ String separator = System.getProperty( "path.separator" );
+ String[] cpElements = System.getProperty( "java.class.path" ).split( separator );
for ( String element : cpElements )
{