Code Comments
Programming Forum and web based access to our favorite programming groups.I'm trying to learn more about JNDI and LDAP by writing a simple little program to create users in an LDAP directory. However, I'd ideally like to be able to create users and subclasses of users using DirObjectFactory objects. For example, in OpenLDAP I can create a "person", or a "inetOrgPerson" which is a subclass of "person". I've created 2 objects: Person, which implements DirContext; and, InetOrgPerson which extends Person. My problem comes when trying to do a lookup on the objects I've just created. I've noticed if I put the InetOrgPersonFactory first in Context.OBJECT_FACTORIES, it is able to read an InetOrgPerson object with no problem. But, if I put PersonFactory first the cast fails. Obviously, it is because it is using the PersonFactory to create the object instead of the InetOrgPersonFactory. My question is, what is the best way to handle these object factories so that subclasses are created by the appropriate factory, and not by the super class's factory? Is there a good strategy to use? Any thoughts? Steve
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.