FileDocCategorySizeDatePackage
ServerPeerJMSDestinationFactory.javaAPI DocJBoss 4.2.12930Fri Jul 13 20:53:54 BST 2007org.jboss.ejb3.jms

ServerPeerJMSDestinationFactory

public class ServerPeerJMSDestinationFactory extends JMSDestinationFactory
Use ServerPeer for creation of destinations. JBoss AS 5.0
author
Carlo de Wolf
version
$Revision: $

Fields Summary
private static final Logger
log
Constructors Summary
ServerPeerJMSDestinationFactory()

   
   // Do not instantiate outside package
   
   
      
   
Methods Summary
public voidcreateDestination(java.lang.Class type, java.lang.String jndiSuffix)

      String methodName;
      String destinationContext;
      if (type == Topic.class)
      {
         destinationContext = "topic";
         methodName = "createTopic";
      }
      else if (type == Queue.class)
      {
         destinationContext = "queue";
         methodName = "createQueue";
      }
      else
      {
         // type was not a Topic or Queue, bad user
         throw new IllegalArgumentException
                 ("Expected javax.jms.Queue or javax.jms.Topic: " + type);
      }
      
      String name = jndiSuffix;
      String jndiName = destinationContext + "/" + jndiSuffix;
      
      ObjectName serverPeerName = new ObjectName("jboss.messaging:service=ServerPeer");
      
      KernelAbstraction kernel = KernelAbstractionFactory.getInstance();
      // invoke the server to create the destination
      Object result = kernel.invoke(serverPeerName,
              methodName,
              new Object[]{name, jndiName},
              new String[]{"java.lang.String", "java.lang.String"});
      
      log.debug("result = " + result);