Title: RE: How can I get all attributes of a context?

I never tried myself but this should work.

Play by giving different arguments to CompositeName().  You can refer to JNDI documentation for more details.

import javax.naming.*;

public void list()
{
        try
        {
                Context ctx = new InitialContext();
                Name name = new CompositeName("env");  //Get every thing bound to env namespace
                NamingEnumeration enu = ctx.list(name);
                while(enu.hasMore())
                {
                        final NameClassPair pair = (NameClassPair)enu.next();
                        String name = pair.getName();
                        System.out.println("Name = " + name);
                        //Now you got the name you can get the object reference by lookup on context.
                }
                enu.close();
                enu = null;
                name = null;
        } catch(Exception ex)
        {
                ex.printStackTrace();
        }
}

Kesav Kumar Kolla
Voquette Inc
650 356 3740(W)
510 889 6840(R)
Voquette...Delivering Sound Information



-----Original Message-----
From: Robert Ren [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 19, 2001 12:49 PM
To: Orion-Interest
Subject: How can I get all attributes of a context?


Hi,
Could anybody give me an example to list all the objects including EJBs,
JDBC etc of a context after I initialized it in Orion?
Thanks in advance!

Rob

Reply via email to