Package org.jboss.jms.jndi

Examples of org.jboss.jms.jndi.JMSProviderAdapter


   protected void jmsCreate() throws Exception
   {
      //    Get the JMS provider
      // todo get rid of server module dependency
      JMSProviderAdapter adapter = getJMSProviderAdapter();
      log.debug("Provider adapter: " + adapter);
 
      // Connect to the JNDI server and get a reference to root context
      Context context = adapter.getInitialContext();
      log.debug("context: " + context);

      // if we can't get the root context then exit with an exception
      if (context == null)
      {
View Full Code Here


    *
    * @throws NamingException    Failed to lookup provider adapter.
    */
   private JMSProviderAdapter getProviderAdapter() throws NamingException
   {
      JMSProviderAdapter adapter;

      if (mcf.getJmsProviderAdapterJNDI() != null)
      {
         // lookup the adapter from JNDI
         Context ctx = new InitialContext();
View Full Code Here

   {
      boolean trace = log.isTraceEnabled();

      try
      {
         JMSProviderAdapter adapter = getProviderAdapter();
         Context context = adapter.getInitialContext();
         Object factory;
         boolean transacted = info.isTransacted();
         int ack = Session.AUTO_ACKNOWLEDGE;

         if (info.getType() == JmsConnectionFactory.TOPIC)
         {
            String jndi = adapter.getTopicFactoryRef();
            if (jndi == null)
               throw new IllegalStateException("No configured 'TopicFactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
            factory = context.lookup(jndi);
            con = ConnectionFactoryHelper.createTopicConnection(factory, user, pwd);
            if (info.getClientID() != null)
               con.setClientID(info.getClientID());
            con.setExceptionListener(this);
            if (trace)
               log.trace("created connection: " + con);

            if (con instanceof XATopicConnection)
            {
               xaTopicSession = ((XATopicConnection)con).createXATopicSession();
               topicSession = xaTopicSession.getTopicSession();
               xaTransacted = true;
            }
            else if (con instanceof TopicConnection)
            {
               topicSession =
                  ((TopicConnection)con).createTopicSession(transacted, ack);
               if (trace)
                  log.trace("Using a non-XA TopicConnection.  " +
                            "It will not be able to participate in a Global UOW");
            }
            else
               throw new JBossResourceException("Connection was not recognizable: " + con);

            if (trace)
               log.trace("xaTopicSession=" + xaTopicSession + ", topicSession=" + topicSession);
         }
         else if (info.getType() == JmsConnectionFactory.QUEUE)
         {
            String jndi = adapter.getQueueFactoryRef();
            if (jndi == null)
               throw new IllegalStateException("No configured 'QueueFactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
            factory = context.lookup(jndi);
            con = ConnectionFactoryHelper.createQueueConnection(factory, user, pwd);
            if (info.getClientID() != null)
               con.setClientID(info.getClientID());
            con.setExceptionListener(this);
            if (trace)
               log.debug("created connection: " + con);

            if (con instanceof XAQueueConnection)
            {
               xaQueueSession =
                  ((XAQueueConnection)con).createXAQueueSession();
               queueSession = xaQueueSession.getQueueSession();
               xaTransacted = true;
            }
            else if (con instanceof QueueConnection)
            {
               queueSession =
                  ((QueueConnection)con).createQueueSession(transacted, ack);
               if (trace)
                  log.trace("Using a non-XA QueueConnection.  " +
                            "It will not be able to participate in a Global UOW");
            }
            else
               throw new JBossResourceException("Connection was not reconizable: " + con);

            if (trace)
               log.trace("xaQueueSession=" + xaQueueSession + ", queueSession=" + queueSession);
         }
         else
         {
            String jndi = adapter.getFactoryRef();
            if (jndi == null)
               throw new IllegalStateException("No configured 'FactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
            factory = context.lookup(jndi);
            con = ConnectionFactoryHelper.createConnection(factory, user, pwd);
            if (info.getClientID() != null)
View Full Code Here

   {
      JmsActivationSpec spec = activation.getActivationSpec();
      String user = spec.getDLQUser();
      String pass = spec.getDLQPassword();
      String clientID = spec.getDLQClientID();
      JMSProviderAdapter adapter = activation.getProviderAdapter();
      String queueFactoryRef = adapter.getQueueFactoryRef();
      log.debug("Attempting to lookup dlq connection factory " + queueFactoryRef);
      QueueConnectionFactory qcf = (QueueConnectionFactory) Util.lookup(ctx, queueFactoryRef, QueueConnectionFactory.class);
      log.debug("Got dlq connection factory " + qcf + " from " + queueFactoryRef);
      log.debug("Attempting to create queue connection with user " + user);
      if (user != null)
View Full Code Here

      //Now install local JMSProviderAdaptor classes
     
      Properties props1 = new Properties();
      props1.putAll(ServerManagement.getJNDIEnvironment(1));
       
      JMSProviderAdapter targetAdaptor =
         new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor1");
     
      sc.installJMSProviderAdaptor("adaptor1", targetAdaptor);
     
      sc.startRecoveryManager();     
View Full Code Here

      // Get the JMS Provider Adapter
      if (providerName == null)
         throw new IllegalArgumentException("Null provider name");
      Context ctx = new InitialContext();
     
      JMSProviderAdapter adapter = (JMSProviderAdapter) ctx.lookup(providerName);

      // Determine the XAConnectionFactory name
      String connectionFactoryRef = adapter.getFactoryRef();
      if (connectionFactoryRef == null)
         throw new IllegalStateException("Provider '" + providerName + "' has no FactoryRef");
     
      // Lookup the connection factory
      ctx = adapter.getInitialContext();
      try
      {
         return (XAConnectionFactory) Util.lookup(ctx, connectionFactoryRef, XAConnectionFactory.class);
      }
      finally
View Full Code Here

    // Now install local JMSProviderAdaptor classes

    Properties p1 = new Properties();
    p1.putAll(ServerManagement.getJNDIEnvironment(1));

    JMSProviderAdapter targetAdaptor = new TestJMSProviderAdaptor(p1,
        "/XAConnectionFactory", "adaptor1");

    sc.installJMSProviderAdaptor("adaptor1", targetAdaptor);

    sc.startRecoveryManager();
View Full Code Here

      //Now install local JMSProviderAdaptor classes
     
      Properties props1 = new Properties();
      props1.putAll(ServerManagement.getJNDIEnvironment(1));
       
      JMSProviderAdapter targetAdaptor =
         new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor1");
     
      sc.installJMSProviderAdaptor("adaptor1", targetAdaptor);
     
      sc.startRecoveryManager();     
View Full Code Here

   {
      if (log.isTraceEnabled()) { log.trace(this + " look up CF via provider " + providerAdaptorName); }
     
      Context ctx = new InitialContext();
     
      JMSProviderAdapter adapter = (JMSProviderAdapter) ctx.lookup(providerAdaptorName);

      String connectionFactoryRef = adapter.getFactoryRef();
      if (connectionFactoryRef == null)
         throw new IllegalStateException("Provider '" + providerAdaptorName + "' has no FactoryRef");
     
      // Lookup the connection factory
      ctx = adapter.getInitialContext();

      try
      {
         JBossConnectionFactory factory = (JBossConnectionFactory)Util.lookup(ctx, connectionFactoryRef, JBossConnectionFactory.class);
View Full Code Here

         throw new IllegalArgumentException("Null provider name");
      String providerAdapterJNDI = providerName;
      if (providerAdapterJNDI.startsWith("java:") == false)
         providerAdapterJNDI = "java:" + providerAdapterJNDI;
      Context ctx = new InitialContext();
      JMSProviderAdapter adapter = (JMSProviderAdapter) Util.lookup(providerAdapterJNDI, JMSProviderAdapter.class);

      // Determine the XAConnectionFactory name
      String connectionFactoryRef = adapter.getFactoryRef();
      if (connectionFactoryRef == null)
         throw new IllegalStateException("Provider '" + providerName + "' has no FactoryRef");
     
      // Lookup the connection factory
      ctx = adapter.getInitialContext();
      try
      {
         return (XAConnectionFactory) Util.lookup(ctx, connectionFactoryRef, XAConnectionFactory.class);
      }
      finally
View Full Code Here

TOP

Related Classes of org.jboss.jms.jndi.JMSProviderAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.