how to pass in a wildcard as an argument to a method

Hi,

I am calling to a method which "normally" works like this:

sContext.lookup(jndiName)

The argument jndiName which I am passing looks like:

/jms/topic/my/topic

If the above jndiName exists, the method looks it up. If it does not exist, obviously an exception occurs.

However, what I want to do is to pass a wildcard like * as an agrument for the method, so that it looks up everything that does exist. Or better yet, I want to lookup everything that starts with /jms/topic/*/*/*.

Is this possible to do by using some wildcard? Or is there another way to do this?

Thanks!

[630 byte] By [ahujava] at [2007-11-26 22:34:12]
# 1
and what would this wildcard method return? why would you want to do this, anyway? you'd still have to look up specific objects one by one in order to use them
georgemca at 2007-7-10 11:41:55 > top of Java-index,Java Essentials,Java Programming...
# 2

I want do this because what if I don't know the jndiName (which is a string) - and I want to lookup all the ones that do exist.

Once I get a list of all the jndiName's that exist - I will display them to the user - so the user is now aware of all the ones that exist.

Yes, at this time the user will pass the now known jndiName as an argument and then I will look up the specifc object to use them.

The lookup method is in the class:

javax.naming.InitialContext

which implements interface Context

ahujava at 2007-7-10 11:41:55 > top of Java-index,Java Essentials,Java Programming...
# 3

sounds odd, but it's your code. I don't think this can be done, but re-ask the question on [url=http://forum.java.sun.com/forum.jspa?forumID=51]this[/url] forum for a better chance of the definitive answer. mention that you've posted it here and been redirected, or someone will jump down your throat for "crossposting"

georgemca at 2007-7-10 11:41:55 > top of Java-index,Java Essentials,Java Programming...