mavibot-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java [196:277]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @Override
    public int compare( ParentIdAndRdn type1, ParentIdAndRdn type2 )
    {
        return type1.compareTo( type2 );
    }


    @Override
    public Comparator<ParentIdAndRdn> getComparator()
    {
        return comparator;
    }


    public static void setSchemaManager( SchemaManager schemaManager )
    {
        MavibotParentIdAndRdnSerializer.schemaManager = schemaManager;
    }


    /**
     * {@inheritDoc}
     */
    @Override
    public ParentIdAndRdn fromBytes( byte[] buffer ) throws IOException
    {
        return fromBytes( buffer, 0 );
    }


    /**
     * {@inheritDoc}
     */
    @Override
    public ParentIdAndRdn fromBytes( byte[] buffer, int pos ) throws IOException
    {
        try
        {
            ParentIdAndRdn parentIdAndRdn = new ParentIdAndRdn();

            // Read the number of rdns, if any
            int nbRdns = Serialize.deserializeInt( buffer, pos );
            pos += 4;

            if ( nbRdns == 0 )
            {
                parentIdAndRdn.setRdns( new Rdn[0] );
            }
            else
            {
                Rdn[] rdns = new Rdn[nbRdns];

                for ( int i = 0; i < nbRdns; i++ )
                {
                    Rdn rdn = new Rdn( schemaManager );
                    pos = rdn.deserialize( buffer, pos );
                    rdns[i] = rdn;
                }

                parentIdAndRdn.setRdns( rdns );
            }

            // Read the parent ID
            byte[] uuidBytes = Serialize.deserializeBytes( buffer, pos );
            pos += 4 + uuidBytes.length;
            String uuid = Strings.utf8ToString( uuidBytes );

            parentIdAndRdn.setParentId( uuid );

            // Read the number of children and descendants
            int nbChildren = Serialize.deserializeInt( buffer, pos );
            pos += 4;

            int nbDescendants = Serialize.deserializeInt( buffer, pos );
            pos += 4;

            parentIdAndRdn.setNbChildren( nbChildren );
            parentIdAndRdn.setNbDescendants( nbDescendants );

            return parentIdAndRdn;
        }
        catch ( LdapInvalidAttributeValueException cnfe )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



mavibotv2-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/mavibot/MavibotParentIdAndRdnSerializer.java [205:286]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    @Override
    public int compare( ParentIdAndRdn type1, ParentIdAndRdn type2 )
    {
        return type1.compareTo( type2 );
    }


    @Override
    public Comparator<ParentIdAndRdn> getComparator()
    {
        return comparator;
    }


    public static void setSchemaManager( SchemaManager schemaManager )
    {
        MavibotParentIdAndRdnSerializer.schemaManager = schemaManager;
    }


    /**
     * {@inheritDoc}
     */
    @Override
    public ParentIdAndRdn fromBytes( byte[] buffer ) throws IOException
    {
        return fromBytes( buffer, 0 );
    }


    /**
     * {@inheritDoc}
     */
    @Override
    public ParentIdAndRdn fromBytes( byte[] buffer, int pos ) throws IOException
    {
        try
        {
            ParentIdAndRdn parentIdAndRdn = new ParentIdAndRdn();

            // Read the number of rdns, if any
            int nbRdns = Serialize.deserializeInt( buffer, pos );
            pos += 4;

            if ( nbRdns == 0 )
            {
                parentIdAndRdn.setRdns( new Rdn[0] );
            }
            else
            {
                Rdn[] rdns = new Rdn[nbRdns];

                for ( int i = 0; i < nbRdns; i++ )
                {
                    Rdn rdn = new Rdn( schemaManager );
                    pos = rdn.deserialize( buffer, pos );
                    rdns[i] = rdn;
                }

                parentIdAndRdn.setRdns( rdns );
            }

            // Read the parent ID
            byte[] uuidBytes = Serialize.deserializeBytes( buffer, pos );
            pos += 4 + uuidBytes.length;
            String uuid = Strings.utf8ToString( uuidBytes );

            parentIdAndRdn.setParentId( uuid );

            // Read the number of children and descendants
            int nbChildren = Serialize.deserializeInt( buffer, pos );
            pos += 4;

            int nbDescendants = Serialize.deserializeInt( buffer, pos );
            pos += 4;

            parentIdAndRdn.setNbChildren( nbChildren );
            parentIdAndRdn.setNbDescendants( nbDescendants );

            return parentIdAndRdn;
        }
        catch ( LdapInvalidAttributeValueException cnfe )
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



