Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

JNDI, DirContext.OBJECT_FACTORIES, and subclasses
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

Report this thread to moderator Post Follow-up to this message
Old Post
Steve Nakhla
09-27-04 09:02 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:36 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.