Issue Details (XML | Word | Printable)

Key: DIRSERVER-75
Type: Bug Bug
Status: Closed Closed
Resolution: Duplicate
Priority: Major Major
Assignee: Emmanuel Lecharny
Reporter: Emmanuel Lecharny
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Directory ApacheDS

Control is a Class and an Interface in two packages.

Created: 27/Jan/06 09:58 AM   Updated: 07/Feb/06 01:29 PM
Return to search
Component/s: asn1
Affects Version/s: pre-1.0
Fix Version/s: pre-1.0

Time Tracking:
Not Specified

Resolution Date: 03/Feb/06 05:38 PM


 Description  « Hide
We have too elements with the same name : Control.

it's an Interface in org.apache.ldap.common.message and a class in org.apache.ldap.common.codec

We must keep only one of those two elements

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Van Nhu added a comment - 03/Feb/06 02:01 PM
It seems to me that we have two almost identical LDAP message libraries in ldap.common.codec and ldap.common.message with a lot of duplicated code.

This makes the TwixTransformer work double time just to convert a message from one format to another. And currently it converts LDAP requests from the Twix format to the "common" format and converts the LDAP responses from the "common" format to Twix format so that the ApacheDS server can decode the incoming requests and encode the responses before sending them back to the clients.

In addition, the TwixTransformer at the moment doesn't transform a "common" request to Twix request nor does it transform a Twix response to a "common" response. This makes it impossible to use the Twix codec together with MINA to implement an LDAP client or an LDAP proxy that acts like a client to an LDAP Server.

This is not a problem with the old Snickers codec, so I wonder if someone has a plan as how we can clean this up and make the Twix codec support ASN1 encoding of the requests and decoding of the responses. Thanks.

Emmanuel Lecharny added a comment - 03/Feb/06 05:38 PM
This is a duplicate of DIRLDAP-78.


Emmanuel Lecharny made changes - 03/Feb/06 05:38 PM
Field Original Value New Value
Resolution Duplicate [ 3 ]
Status Open [ 1 ] Closed [ 6 ]
Assignee Alex Karasulu [ akarasulu ] Emmanuel Lecharny [ elecharny ]
Emmanuel Lecharny added a comment - 03/Feb/06 05:52 PM
The LdapProxy (in sandbox) use the twix codec, so it seems that is is possible to use twix to write a proxy or a client ;-)

The big picture is the following :

1) CLIENT uses twix classes to prepare LdapMessage requests
2) CLIENT sends those messages to the PROXY/SERVER after having encoded them as BER, using twix
3) PROXY/SERVER receives a BER binary encoded data
4) PROXY/SERVER calls the decoder which produce a twix instance of the message
5) PROXY/SERVER then calls the transformer to switch from this twix representation to the internal message representation
6) PROXY/SERVER does it jobs ...
7) PROXY/SERVER creates an instance of the LdapMessage response using the internal representation
8) PROXY/SERVER calls the transformer to switch from the internal representation to the twix representation
9) PROXY/SERVER encodes the message as BER, using twix
10) PROXY/SERVER sends the binary data back to the CLIENT
11) CLIENT decodes the binary data and creates an instance of a twix representation of the message

I must admit that the transformation is a bit overkilling, to say the least, but it does not prevent the implementation of a client or a proxy. The merge between the internal representation and the twix representation is something that is planned in a forthcoming release.


Van Nhu added a comment - 06/Feb/06 10:23 AM
Thanks Emmanuel for your prompt response.

If I understand it correctly, your LDAP Proxy doesn't transform LDAP messages between Twix format and the "internal" message presentation.

Our LDAP client/proxy, when implemented with MINA + Twix Codec Provider, is currently failing to communicate with the server. It throws a NPE when running this segment of code:

    public void testEncodeBindRequest() throws EncoderException
    {
        final BindRequestImpl req0 = new BindRequestImpl( 1 );
        req0.setCredentials( "password".getBytes() );
        req0.setName( "cn=admin,dc=example,dc=com" );
        req0.setSimple( true );
        req0.setVersion3( true );

        final MessageEncoder encoder = new MessageEncoder();
        encoder.encode( req0 );
    }

I would suspect that a similar error will be received if you try to get the Twix Codec Provider to decode an LDAP response. The reasons for this are as I explained in my previous comment. We can discuss further off-line if that is more convenient to you.

Thanks and Regards,
Van


Emmanuel Lecharny added a comment - 06/Feb/06 04:07 PM
Hi Van (if Van is your firstname :),

it would work if you use the twix object instead of the internal object. In you piece of code, just do that :
 
   import org.apache.ldap.common.codec.bind.BindRequest;

   public void testEncodeBindRequest() throws EncoderException
    {
        final BindRequest req0 = new BindRequest();
        req0.setMessageId( 1 )
        ((SimpleAuthentication)req0.getAuthentication()).setSimple( "password".getBytes( "UTF8" ) );
        req0.setName( new LdapDN( "cn=admin,dc=example,dc=com" ) );
        req0.setVersion( 3 );
        try
        {
            ByteBuffer bb = req0.encode( null );
        }
        catch ( EncoderException ee )
        {
            ee.printStackTrace();
            fail( ee.getMessage() );
        }
    }

You will get a bytebuffer with the encoded value to be send to the server.

The twix API is not very confortable atm, but it can evelve in the future.

feel free to contact me directly if you need any information.

Alex Karasulu made changes - 07/Feb/06 01:29 PM
Key DIRSNICKERS-124 DIRSERVER-75
Type Improvement [ 4 ] Bug [ 1 ]
Component/s asn1 [ 12310712 ]
Affects Version/s pre-1.0 [ 12310782 ]
Fix Version/s pre-1.0 [ 12310782 ]
Project Directory ASN1 [ 10517 ] ApacheDS [ 12310260 ]