directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cyberh...@openmailbox.org
Subject LDAP Entry implementation
Date Fri, 14 Nov 2014 13:15:48 GMT
Dear Apache development team,

I need your help working with the LDAP APache API. I am working on a big 
application that uses LDAP for saving/accessing useraccounts, groups and 
machines. To access LDAP I decided to use your API, because after 
testing and reading the guide and the javadocs it seemed very sane and 
flexible to me. However now I run into some problems I cannot explain or 
solve:

The following code works as expected.

DefaultEntry user = (DefaultEntry) ldapController.loadObject(...); // 
public Entry loadObject(...)

user is now an object that is filled with attributes from the LDAP 
server and can be worked with normally.

However, DefaultEntry is not sufficient for my application, I need to 
extend it. Since DefaultEntry is a final class, I did the following:

public interface UserLDAPInterface extends Entry {

// some user-specific methods

}

public class UserLDAP implements UserLDAPInterface {

// implementation of both Entry methods and UserLDAPInterface methods

}

Now it should have worked, however:

UserLDAP user = (UserLDAP) ldapController.loadObject(...);

produces a ClassCastException. The above example with DefaultEntry does 
not produce a ClassCastException, but works as expected. I copied all 
the methods from DefaultEntry... So really don't understand what is the 
issue there.



Mime
View raw message