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?

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. *

Reply via email to