Package org.jboss.jms.jndi

Examples of org.jboss.jms.jndi.JMSProviderAdapter


         throw new IllegalArgumentException("Target destination lookup cannot be null");
      }
     
      InitialContext ic = new InitialContext();
     
      JMSProviderAdapter sourceAdaptor = (JMSProviderAdapter)ic.lookup(sourceProviderAdaptorLookup);

      boolean sameSourceAndTarget = sourceProviderAdaptorLookup.equals(targetProviderAdaptorLookup);
     
      JMSProviderAdapter targetAdaptor;
     
      if (sameSourceAndTarget)
      {
         targetAdaptor = sourceAdaptor;
      }
      else
      {
         targetAdaptor = (JMSProviderAdapter)ic.lookup(targetProviderAdaptorLookup);
      }
     
      Context icSource = sourceAdaptor.getInitialContext();
     
      Context icTarget = targetAdaptor.getInitialContext();
     
      Destination sourceDest = (Destination)icSource.lookup(sourceDestinationLookup);
     
      Destination targetDest = (Destination)icTarget.lookup(targetDestinationLookup);
           
      String sourceCFRef = sourceAdaptor.getFactoryRef();
     
      String targetCFRef = targetAdaptor.getFactoryRef();
     
      ConnectionFactoryFactory sourceCff =
         new JNDIConnectionFactoryFactory(sourceAdaptor.getProperties(), sourceCFRef);
     
      ConnectionFactoryFactory destCff =
         new JNDIConnectionFactoryFactory(targetAdaptor.getProperties(), targetCFRef);
     
      bridge.setSourceDestination(sourceDest);
     
      bridge.setTargetDestination(targetDest);
     
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

      // 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

      // 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 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

      props1.putAll(ServerManagement.getJNDIEnvironment(1));
     
      Properties props2 = new Properties();
      props2.putAll(ServerManagement.getJNDIEnvironment(2));
     
      JMSProviderAdapter sourceAdaptor = new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor1");
     
      JMSProviderAdapter targetAdaptor = new TestJMSProviderAdaptor(props2, "/XAConnectionFactory", "adaptor2");
     
      ServerManagement.installJMSProviderAdaptor(0, "adaptor1", sourceAdaptor);
     
      ServerManagement.installJMSProviderAdaptor(0, "adaptor2", targetAdaptor);
     
View Full Code Here

         props1.putAll(ServerManagement.getJNDIEnvironment(1));
        
         Properties props2 = new Properties();
         props2.putAll(ServerManagement.getJNDIEnvironment(2));
        
         JMSProviderAdapter sourceAdaptor = new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor1");
        
         JMSProviderAdapter targetAdaptor = new TestJMSProviderAdaptor(props2, "/XAConnectionFactory", "adaptor2");
        
         ServerManagement.installJMSProviderAdaptor(0, "adaptor1", sourceAdaptor);
        
         ServerManagement.installJMSProviderAdaptor(0, "adaptor2", targetAdaptor);
        
View Full Code Here

      props0.putAll(ServerManagement.getJNDIEnvironment(0));
     
      Properties props1 = new Properties();
      props1.putAll(ServerManagement.getJNDIEnvironment(1));
       
      JMSProviderAdapter sourceAdaptor =
         new TestJMSProviderAdaptor(props0, "/XAConnectionFactory", "adaptor1");
      JMSProviderAdapter targetAdaptor =
         new TestJMSProviderAdaptor(props1, "/XAConnectionFactory", "adaptor2");
     
      sc.installJMSProviderAdaptor("adaptor1", sourceAdaptor);
      sc.installJMSProviderAdaptor("adaptor2", targetAdaptor);
     
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.