geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: How to look up a JMS Topic via the Kernel?
Date Fri, 16 Feb 2007 21:11:45 GMT

On Feb 16, 2007, at 12:25 PM, Aman Nanner/MxI Technologies wrote:

>
> Hi,
>
> I have a GBean from which I need to grab a reference to a JMS
> TopicConnectionFactory and a JMS Topic.  Currently, I am attempting  
> to use
> the GBean Kernel API to grab these references.  I have succesfully
> retrieved the TopicConnectionFactory using the following method:
>
> ----
>    public TopicConnectionFactory getTopicConnectionFactory( String
> aTopicConnFactoryJndi )
>    {
>       TopicConnectionFactory lTopicConnFactory = null;
>       Kernel lKernel = KernelRegistry.getSingleKernel();
>       Iterator lConnectorIt =
>          lKernel.listGBeans(
>             new AbstractNameQuery(
>
> "org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory"
>                )
>             )
>                .iterator();
>
>       try {
>          while ( lConnectorIt.hasNext() ) {
>             AbstractName lName = ( AbstractName ) lConnectorIt.next();
>
>             String lConInterface =
>                ( String ) lKernel.getAttribute( lName,
> "connectionFactoryInterface" );
>             if ( lConInterface.equals 
> ( "javax.jms.TopicConnectionFactory" )
> ) {
>                String lPoolName = lName.getNameProperty( "name" );
>                if ( lPoolName.equals( aTopicConnFactoryJndi ) ) {
>                   lTopicConnFactory =
>                      ( TopicConnectionFactory ) lKernel.invoke( lName,
> "$getResource" );
>
>                   break;
>                }
>             }
>          }
>       } catch ( Exception e ) {
>          throw new RuntimeException( "Could not retrieve topic  
> connection
> factory", e );
>       }
>
>       return lTopicConnFactory;
>    }
> ----
>
> However, I do not know how to retrieve a JMS Topic using the same  
> technique
> as I don't know what my AbstractNameQuery should be, nor what  
> attributes of
> the GBean I should be searching for.  Does anybody know how to do  
> this?

For the ANQ try something like
#org.apache.geronimo.connector.AdminObjectSource

or
#org.apache.geronimo.connector.AdminObjectWrapper

and try the adminObjectInterface or adminObjectClass attributes.

You call $getResource on these as well to get the actual admin object.

Hope this helps.

we need to get an easy way for these to get into global jndi, this is  
ridiculously complicated :-(

david jencks


>
> Thanks,
> Aman
>
> ______________________________________________________________________ 
> ____________
> * This message is intended only for the use of the individual or  
> entity to which it is addressed, and may contain information that  
> is privileged, confidential and exempt from disclosure under  
> applicable law. Unless you are the addressee (or authorized to  
> receive for the addressee), you may not use, copy or disclose the  
> message or any information contained in the message. If you have  
> received this message in error, please advise the sender by reply e- 
> mail , and delete the message, or call (collect) 001 613 747 4698. *
>


Mime
View raw message