[jboss-cvs] JBossAS SVN: r73731 - projects/integration/trunk/jboss-jca-spi/src/main/org/jboss/jca/spi.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed May 28 06:56:11 EDT 2008


Author: jesper.pedersen
Date: 2008-05-28 06:56:10 -0400 (Wed, 28 May 2008)
New Revision: 73731

Removed:
   projects/integration/trunk/jboss-jca-spi/src/main/org/jboss/jca/spi/EndpointActivationBusLocator.java
Log:
[JBAS-5426] Remove locator as the bus should be injected

Deleted: projects/integration/trunk/jboss-jca-spi/src/main/org/jboss/jca/spi/EndpointActivationBusLocator.java
===================================================================
--- projects/integration/trunk/jboss-jca-spi/src/main/org/jboss/jca/spi/EndpointActivationBusLocator.java	2008-05-28 09:46:30 UTC (rev 73730)
+++ projects/integration/trunk/jboss-jca-spi/src/main/org/jboss/jca/spi/EndpointActivationBusLocator.java	2008-05-28 10:56:10 UTC (rev 73731)
@@ -1,161 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jca.spi;
-
-import java.lang.reflect.Method;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.logging.Logger;
-
-/**
- * Locates the EndpointActivation bus.
- * 
- * @author <a href="adrian at jboss.org">Adrian Brock</a>
- * @author <a href="jesper.pedersen at jboss.org">Jesper Pedersen</a>
- * @version $Revision: $
- */
-public class EndpointActivationBusLocator
-{
-   /** Logger */
-   private static final Logger log = Logger.getLogger(EndpointActivationBusLocator.class);
-   
-   /** The JNDI Name */
-   private static final String JNDI_NAME = "java:/EndpointActivationBus";
-   
-   /** The instance */ 
-   private static EndpointActivationBusLocator instance = new EndpointActivationBusLocator();
-   
-   /** The endpoint activation bus */
-   private EndpointActivationBus eab;
-   
-   /**
-    * No external construction
-    */
-   private EndpointActivationBusLocator()
-   {
-   }
-   
-   /**
-    * Get the locator
-    * @return the locator
-    */
-   public static EndpointActivationBusLocator getInstance()
-   {
-      return instance;
-   }
-   
-   /**
-    * Locate the transaction manager
-    * @return the transaction manager
-    */
-   public static EndpointActivationBus locateEndpointActivationBus()
-   {
-      return getInstance().locate();
-   }
-   
-   /**
-    * Get the transaction manager
-    * @return the transaction manager
-    */
-   public EndpointActivationBus getEndpointActivationBus()
-   {
-      return locate();
-   }
-   
-   /**
-    * Locate the transaction manager
-    * @return the transaction manager
-    */
-   public EndpointActivationBus locate()
-   {
-      if (eab != null)
-         return eab;
-
-      EndpointActivationBus result = tryJNDI();
-      if (result == null)
-         result = usePrivateAPI();
-      if (result == null)
-         throw new RuntimeException("Unable to locate the endpoint activation bus");
-      
-      return result;
-   }
-   
-   /**
-    * Locate the endpoint activation bus in the well known jndi binding for JBoss
-    * @return The endpoint activation bus from jndi
-    */
-   protected EndpointActivationBus tryJNDI()
-   {
-      InitialContext ctx = null;
-      try
-      {
-         ctx = new InitialContext();
-         eab = (EndpointActivationBus) ctx.lookup(JNDI_NAME);
-         if (log.isTraceEnabled())
-            log.trace("Got a endpoint activation bus from jndi " + eab);
-      }
-      catch (NamingException e)
-      {
-         log.debug("Unable to lookup: " + JNDI_NAME, e);
-      }
-      finally
-      {
-         if (ctx != null)
-         {
-            try
-            {
-               ctx.close();
-            }
-            catch (NamingException ne)
-            {
-               // Ignore
-            }
-         }
-      }
-      return eab;
-   }
-   
-   /**
-    * Use the private api
-    * <p/>
-    * This is a fallback method for non JBossAS use.
-    * @return The endpoint activation bus from API
-    */
-   protected EndpointActivationBus usePrivateAPI()
-   {
-      EndpointActivationBus result = null;
-      try
-      {
-         Class<?> clazz = Class.forName("org.jboss.jca.EndpointActivationBusManager");
-         Method method = clazz.getMethod("getInstance");
-
-         result = (EndpointActivationBus) method.invoke((Object)null, (Object)null);
-      }
-      catch (Exception e)
-      {
-         log.debug("Unable to instantiate legacy transaction manager", e);
-      }
-      return result;
-   }
-}




More information about the jboss-cvs-commits mailing list