[jboss-cvs] JBossAS SVN: r68367 - projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Dec 18 00:58:06 EST 2007


Author: ALRubinger
Date: 2007-12-18 00:58:06 -0500 (Tue, 18 Dec 2007)
New Revision: 68367

Added:
   projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocator.java
   projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocatorImpl.java
   projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiHostNotFoundException.java
   projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiServiceLocator.java
Removed:
   projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/CachingServiceLocator.java
   projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiCachingServiceLocator.java
   projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/ServiceLocator.java
Modified:
   projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3NotFoundException.java
   projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/ServiceLocatorFactory.java
Log:
Client-side Service Locator Development; ready for integration w/ Ejb3Registry and autodiscovery

Deleted: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/CachingServiceLocator.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/CachingServiceLocator.java	2007-12-18 05:51:36 UTC (rev 68366)
+++ projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/CachingServiceLocator.java	2007-12-18 05:58:06 UTC (rev 68367)
@@ -1,286 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2007, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt 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.ejb3.locator.client;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public abstract class CachingServiceLocator implements ServiceLocator
-{
-   // Class Members
-
-   private static final Log logger = LogFactory.getLog(CachingServiceLocator.class);
-
-   // Instance Members
-
-   /**
-    * Object cache used for storing stubs to remote services/beans, indexed by unique business interface
-    */
-   private Map<Class<?>, Object> objectCache = Collections.synchronizedMap(new HashMap<Class<?>, Object>());
-
-   // Required Implementations
-
-   /**
-    * Obtains a stub to the the SLSB service with the specified business 
-    * interface.  If this is the first request for this service, it will 
-    * be obtained from JNDI and placed in a cache such that subsequent 
-    * requests will not require the overhead of a JNDI lookup. 
-    * 
-    * @param <T>
-    * @param clazz The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on any of the configured local/remote hosts
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the configured local/remote hosts, or if the
-    *   specified class is no an interface 
-    */
-   public <T> T getStatelessService(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
-   {
-      // Log
-      logger.trace("getStatelessService requesting " + clazz.getName());
-
-      // Obtain object, from cache if possible
-      return this.getObject(clazz, true);
-   }
-
-   /**
-    * Obtains a stub to the the SFSB with the specified business 
-    * interface.  This call will always result in a call to JNDI 
-    * for a new stub; no caching will take place
-    * 
-    * @param <T>
-    * @param clazz The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on any of the configured local/remote hosts
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the configured local/remote hosts, or if the
-    *   specified class is no an interface 
-    */
-   public <T> T getStatefulBean(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
-   {
-      // Log
-      logger.trace("getStatefulBean requesting " + clazz.getName());
-
-      // Obtain object, never from cache (Stateful stubs must be unique)
-      return this.getObject(clazz, false);
-   }
-
-   /**
-    * Obtains a stub to the the JMX (MBean, Singleton) service with 
-    * the specified business interface.  If this is the first 
-    * request for this service, it will be obtained from JNDI and 
-    * placed in a cache such that subsequent requests will not 
-    * require the overhead of a JNDI lookup.  Convenience
-    * method; equivalent to <code>getStatelessService</code>
-    * 
-    * @param <T>
-    * @param clazz The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on any of the configured local/remote hosts
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the configured local/remote hosts, or if the
-    *   specified class is no an interface 
-    */
-   public <T> T getJmxService(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
-   {
-      // Log
-      logger.trace("getJmxService requesting " + clazz.getName());
-
-      // Obtain object, from cache if possible
-      return this.getObject(clazz, true);
-   }
-
-   // Internal Methods
-
-   /**
-    * Obtains the object associated with the specified business interface.  
-    * This may be obtained from the cache if possible when the "useCache" 
-    * flag is set, otherwise caching will be bypassed and a unique lookup 
-    * will take place on each subsequent request.
-    * 
-    * @param <T>
-    * @param clazz The business interface of the desired service
-    * @param useCache Whether or not to retrieve the object from the cache, if possible.
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on any of the configured local/remote hosts
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the configured local/remote hosts, or if the
-    *   specified class is no an interface 
-    */
-   protected <T> T getObject(Class<T> clazz, boolean useCache) throws Ejb3NotFoundException, IllegalArgumentException
-   {
-      // Ensure specified business interface is an interface
-      if (!clazz.isInterface())
-      {
-         throw new IllegalArgumentException("Specified class \"" + clazz.getName() + "\" is not an interface");
-      }
-
-      // If caching is enabled and the object exists in the cache
-      if (useCache && this.isObjectCached(clazz))
-      {
-         // Obtain from cache
-         T obj = this.getObjectFromCache(clazz);
-
-         // Ensure implements specified interface
-         if (!clazz.isAssignableFrom(obj.getClass()))
-         {
-            // Object was placed into cache under incorrect key; integrity of cache broken
-            throw new ServiceLocatorException("Object in cache under key " + clazz.getName()
-                  + " does not implement this interface; cache integrity compromised.");
-         }
-
-         // Return from cache
-         return obj;
-      }
-
-      // Obtain from the remote host
-      T obj = this.getObject(clazz);
-
-      // If caching is enabled 
-      if (useCache)
-      {
-         // Place into the cache
-         this.addInterfaceAndSuperinterfacesToCache(clazz, obj);
-      }
-
-      // Return
-      return obj;
-
-   }
-
-   /**
-    * Determines whether an object with the specified business interface 
-    * is currently cached
-    * 
-    * @param clazz
-    * @return
-    */
-   private boolean isObjectCached(Class<?> clazz)
-   {
-      return this.objectCache.containsKey(clazz);
-   }
-
-   /**
-    * Obtains the specified object from the cache
-    * 
-    * @param <T>
-    * @param clazz
-    * @return
-    */
-   @SuppressWarnings(value = "unchecked")
-   private <T> T getObjectFromCache(Class<T> clazz)
-   {
-      // Obtain
-      T obj = (T) this.objectCache.get(clazz);
-
-      // Ensure present
-      if (obj == null)
-      {
-         throw new ServiceLocatorException("Call to retrieve object implementing " + clazz.getName()
-               + " from cache failed; object is not cached.");
-      }
-
-      // Return
-      return obj;
-   }
-
-   /**
-    * Adds the specified class and all superclasses to the cache of bound
-    * objects
-    * 
-    * @param interfaze
-    * @param obj
-    */
-   private <T> void addInterfaceAndSuperinterfacesToCache(Class<T> interfaze, T obj)
-   {
-      // Ensure not already cached, escape
-      if (!this.isObjectCached(interfaze))
-      {
-         // Add the object to the list of objects implementing this
-         // interface
-         this.objectCache.put(interfaze, obj);
-      }
-
-      // Add all super interfaces recursively
-      for (Class<T> superInterface : interfaze.getInterfaces())
-      {
-         this.addInterfaceAndSuperinterfacesToCache(superInterface, obj);
-      }
-   }
-
-   // Contracts
-
-   /**
-    * Obtains the object associated with the specified business interface 
-    * from one of the configured remote hosts.
-    * 
-    * @param <T>
-    * @param clazz The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on any of the configured local/remote hosts
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the configured local/remote hosts, or if the
-    *   specified class is not an interface 
-    */
-   public abstract <T> T getObject(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException;
-
-   /**
-    * Obtains the object associated with the specified business interface 
-    * from the host with the specified ID.
-    * 
-    * @param <T>
-    * @param hostId The ID of the host from which to obtain the 
-    *   object with the specified business interface
-    * @param clazz The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on the specified host
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the specified host, if the
-    *   specified class is not an interface, or if the specified host ID is not 
-    *   valid for one of the configured hosts 
-    */
-   public abstract <T> T getObject(String hostId, Class<T> clazz) throws Ejb3NotFoundException,
-         IllegalArgumentException;
-
-}

Modified: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3NotFoundException.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3NotFoundException.java	2007-12-18 05:51:36 UTC (rev 68366)
+++ projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3NotFoundException.java	2007-12-18 05:58:06 UTC (rev 68367)
@@ -22,9 +22,12 @@
 package org.jboss.ejb3.locator.client;
 
 /**
+ * Ejb3NotFoundException
  * 
+ * Thrown upon failed attempt to lookup an EJB3 component
+ * 
  * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- * @version $Revision $
+ * @version $Revision $$
  *
  */
 public class Ejb3NotFoundException extends RuntimeException

Copied: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocator.java (from rev 68344, projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/CachingServiceLocator.java)
===================================================================
--- projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocator.java	                        (rev 0)
+++ projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocator.java	2007-12-18 05:58:06 UTC (rev 68367)
@@ -0,0 +1,286 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.ejb3.locator.client;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public abstract class Ejb3ServiceLocator implements JndiServiceLocator
+{
+   // Class Members
+
+   private static final Log logger = LogFactory.getLog(Ejb3ServiceLocator.class);
+
+   // Instance Members
+
+   /**
+    * Object cache used for storing stubs to remote services/beans, indexed by unique business interface
+    */
+   private Map<Class<?>, Object> objectCache = Collections.synchronizedMap(new HashMap<Class<?>, Object>());
+
+   // Required Implementations
+
+   /**
+    * Obtains a stub to the the SLSB service with the specified business 
+    * interface.  If this is the first request for this service, it will 
+    * be obtained from JNDI and placed in a cache such that subsequent 
+    * requests will not require the overhead of a JNDI lookup. 
+    * 
+    * @param <T>
+    * @param clazz The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException 
+    *   If no services implementing the specified business interface 
+    *   could be found on any of the configured local/remote hosts
+    * @throws IllegalArgumentException
+    *   If the specified class is a business interface implemented by more than 
+    *   one service across the configured local/remote hosts, or if the
+    *   specified class is no an interface 
+    */
+   public <T> T getStatelessService(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
+   {
+      // Log
+      logger.trace("getStatelessService requesting " + clazz.getName());
+
+      // Obtain object, from cache if possible
+      return this.getObject(clazz, true);
+   }
+
+   /**
+    * Obtains a stub to the the SFSB with the specified business 
+    * interface.  This call will always result in a call to JNDI 
+    * for a new stub; no caching will take place
+    * 
+    * @param <T>
+    * @param clazz The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException 
+    *   If no services implementing the specified business interface 
+    *   could be found on any of the configured local/remote hosts
+    * @throws IllegalArgumentException
+    *   If the specified class is a business interface implemented by more than 
+    *   one service across the configured local/remote hosts, or if the
+    *   specified class is no an interface 
+    */
+   public <T> T getStatefulBean(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
+   {
+      // Log
+      logger.trace("getStatefulBean requesting " + clazz.getName());
+
+      // Obtain object, never from cache (Stateful stubs must be unique)
+      return this.getObject(clazz, false);
+   }
+
+   /**
+    * Obtains a stub to the the JMX (MBean, Singleton) service with 
+    * the specified business interface.  If this is the first 
+    * request for this service, it will be obtained from JNDI and 
+    * placed in a cache such that subsequent requests will not 
+    * require the overhead of a JNDI lookup.  Convenience
+    * method; equivalent to <code>getStatelessService</code>
+    * 
+    * @param <T>
+    * @param clazz The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException 
+    *   If no services implementing the specified business interface 
+    *   could be found on any of the configured local/remote hosts
+    * @throws IllegalArgumentException
+    *   If the specified class is a business interface implemented by more than 
+    *   one service across the configured local/remote hosts, or if the
+    *   specified class is no an interface 
+    */
+   public <T> T getJmxService(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
+   {
+      // Log
+      logger.trace("getJmxService requesting " + clazz.getName());
+
+      // Obtain object, from cache if possible
+      return this.getObject(clazz, true);
+   }
+
+   // Internal Methods
+
+   /**
+    * Obtains the object associated with the specified business interface.  
+    * This may be obtained from the cache if possible when the "useCache" 
+    * flag is set, otherwise caching will be bypassed and a unique lookup 
+    * will take place on each subsequent request.
+    * 
+    * @param <T>
+    * @param clazz The business interface of the desired service
+    * @param useCache Whether or not to retrieve the object from the cache, if possible.
+    * @return
+    * @throws Ejb3NotFoundException 
+    *   If no services implementing the specified business interface 
+    *   could be found on any of the configured local/remote hosts
+    * @throws IllegalArgumentException
+    *   If the specified class is a business interface implemented by more than 
+    *   one service across the configured local/remote hosts, or if the
+    *   specified class is no an interface 
+    */
+   protected <T> T getObject(Class<T> clazz, boolean useCache) throws Ejb3NotFoundException, IllegalArgumentException
+   {
+      // Ensure specified business interface is an interface
+      if (!clazz.isInterface())
+      {
+         throw new IllegalArgumentException("Specified class \"" + clazz.getName() + "\" is not an interface");
+      }
+
+      // If caching is enabled and the object exists in the cache
+      if (useCache && this.isObjectCached(clazz))
+      {
+         // Obtain from cache
+         T obj = this.getObjectFromCache(clazz);
+
+         // Ensure implements specified interface
+         if (!clazz.isAssignableFrom(obj.getClass()))
+         {
+            // Object was placed into cache under incorrect key; integrity of cache broken
+            throw new ServiceLocatorException("Object in cache under key " + clazz.getName()
+                  + " does not implement this interface; cache integrity compromised.");
+         }
+
+         // Return from cache
+         return obj;
+      }
+
+      // Obtain from the remote host
+      T obj = this.getObject(clazz);
+
+      // If caching is enabled 
+      if (useCache)
+      {
+         // Place into the cache
+         this.addInterfaceAndSuperinterfacesToCache(clazz, obj);
+      }
+
+      // Return
+      return obj;
+
+   }
+
+   /**
+    * Determines whether an object with the specified business interface 
+    * is currently cached
+    * 
+    * @param clazz
+    * @return
+    */
+   private boolean isObjectCached(Class<?> clazz)
+   {
+      return this.objectCache.containsKey(clazz);
+   }
+
+   /**
+    * Obtains the specified object from the cache
+    * 
+    * @param <T>
+    * @param clazz
+    * @return
+    */
+   @SuppressWarnings(value = "unchecked")
+   private <T> T getObjectFromCache(Class<T> clazz)
+   {
+      // Obtain
+      T obj = (T) this.objectCache.get(clazz);
+
+      // Ensure present
+      if (obj == null)
+      {
+         throw new ServiceLocatorException("Call to retrieve object implementing " + clazz.getName()
+               + " from cache failed; object is not cached.");
+      }
+
+      // Return
+      return obj;
+   }
+
+   /**
+    * Adds the specified class and all superclasses to the cache of bound
+    * objects
+    * 
+    * @param interfaze
+    * @param obj
+    */
+   private <T> void addInterfaceAndSuperinterfacesToCache(Class<T> interfaze, T obj)
+   {
+      // Ensure not already cached, escape
+      if (!this.isObjectCached(interfaze))
+      {
+         // Add the object to the list of objects implementing this
+         // interface
+         this.objectCache.put(interfaze, obj);
+      }
+
+      // Add all super interfaces recursively
+      for (Class<T> superInterface : interfaze.getInterfaces())
+      {
+         this.addInterfaceAndSuperinterfacesToCache(superInterface, obj);
+      }
+   }
+
+   // Contracts
+
+   /**
+    * Obtains the object associated with the specified business interface 
+    * from one of the configured remote hosts.
+    * 
+    * @param <T>
+    * @param clazz The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException 
+    *   If no services implementing the specified business interface 
+    *   could be found on any of the configured local/remote hosts
+    * @throws IllegalArgumentException
+    *   If the specified class is a business interface implemented by more than 
+    *   one service across the configured local/remote hosts, or if the
+    *   specified class is not an interface 
+    */
+   public abstract <T> T getObject(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException;
+
+   /**
+    * Obtains the object associated with the specified business interface 
+    * from the host with the specified ID.
+    * 
+    * @param <T>
+    * @param hostId The ID of the host from which to obtain the 
+    *   object with the specified business interface
+    * @param clazz The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException 
+    *   If no services implementing the specified business interface 
+    *   could be found on the specified host
+    * @throws IllegalArgumentException
+    *   If the specified class is a business interface implemented by more than 
+    *   one service across the specified host, if the
+    *   specified class is not an interface, or if the specified host ID is not 
+    *   valid for one of the configured hosts 
+    */
+   public abstract <T> T getObject(String hostId, Class<T> clazz) throws Ejb3NotFoundException,
+         IllegalArgumentException;
+
+}


Property changes on: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocator.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocatorImpl.java (from rev 68344, projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiCachingServiceLocator.java)
===================================================================
--- projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocatorImpl.java	                        (rev 0)
+++ projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocatorImpl.java	2007-12-18 05:58:06 UTC (rev 68367)
@@ -0,0 +1,368 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ejb3.locator.client;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Ejb3ServiceLocatorImpl
+ * 
+ * Implementation of the Service Locator; will attempt to obtain
+ * services from one of a set of configured JNDI Directories (Hosts).
+ * 
+ * @version $Revision $&
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ */
+public final class Ejb3ServiceLocatorImpl extends Ejb3ServiceLocator
+{
+
+   // Class Members
+   private static final Log logger = LogFactory.getLog(Ejb3ServiceLocatorImpl.class);
+
+   // Instance Members
+
+   /**
+    * JNDI Hosts on which Services may be bound
+    */
+   private final Map<String, JndiHost> jndiHosts = Collections.synchronizedMap(new HashMap<String, JndiHost>());
+
+   /**
+    * Mapping of JNDI Hosts to Naming Contexts
+    */
+   private final Map<String, Context> contexts = Collections.synchronizedMap(new HashMap<String, Context>());
+
+   /**
+    * Mapping of Business Interface to the JNDI Name on which its mapped
+    */
+   private final Map<Class<?>, String> serviceMappings = Collections.synchronizedMap(new HashMap<Class<?>, String>());
+
+   // Constructor
+
+   /**
+    * Constructor
+    */
+   Ejb3ServiceLocatorImpl(Map<String, JndiHost> jndiHosts)
+   {
+      super();
+      this.jndiHosts.putAll(jndiHosts);
+      this.contexts.putAll(this.createNamingContextsFromJndiHosts());
+   }
+
+   // Contracts
+
+   /**
+    * Obtains the object associated with the specified business interface from
+    * one of the configured remote hosts.
+    * 
+    * @param <T>
+    * @param clazz
+    *            The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException
+    *             If no services implementing the specified business interface
+    *             could be found on any of the configured local/remote hosts
+    * @throws IllegalArgumentException
+    *             If the specified class is a business interface implemented by
+    *             more than one service across the configured local/remote
+    *             hosts, or if the specified class is not an interface
+    */
+   public <T> T getObject(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
+   {
+      // Initialize
+      T obj = null;
+
+      // For all configured hosts
+      for (JndiHost host : this.jndiHosts.values())
+      {
+         T retrievedObj = null;
+         try
+         {
+            retrievedObj = this.getObject(host, clazz);
+         }
+         // Ignore, simply not present on this one host
+         catch (Ejb3NotFoundException enfe)
+         {
+            continue;
+         }
+
+         // Ensure that an EJB with this business interface has not already
+         // been found on another host
+         if (obj != null)
+         {
+            throw new IllegalArgumentException("EJB3 with business interface " + clazz.getName()
+                  + " is not unique across all configured hosts and may not be looked up by interface alone.");
+         }
+
+         // Set retrieved object to obj and continue searching through other
+         // configured hosts to ensure uniqueness
+         obj = retrievedObj;
+      }
+
+      // If not found on any hosts
+      if (obj == null)
+      {
+         throw new Ejb3NotFoundException("Could not find EJB3 with business interface " + clazz.getName()
+               + " on any configured hosts.");
+      }
+
+      // Return
+      return obj;
+   }
+
+   /**
+    * Obtains the object associated with the specified business interface from
+    * the host with the specified ID.
+    * 
+    * @param <T>
+    * @param hostId
+    *            The ID of the host from which to obtain the object with the
+    *            specified business interface
+    * @param clazz
+    *            The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException
+    *             If no services implementing the specified business interface
+    *             could be found on the specified host
+    * @throws IllegalArgumentException
+    *             If the specified class is a business interface implemented by
+    *             more than one service across the specified host, if the
+    *             specified class is not an interface, or if the specified host
+    *             ID is not valid for one of the configured hosts
+    */
+   public <T> T getObject(String hostId, Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
+   {
+      // Obtain configured host by ID
+      JndiHost host = this.jndiHosts.get(hostId);
+
+      // Ensure ID is valid
+      if (host == null)
+      {
+         throw new IllegalArgumentException("There are no configured hosts with ID of \"" + hostId + "\"");
+      }
+
+      // Return
+      return this.getObject(host, clazz);
+
+   }
+
+   /**
+    * Fetches the object bound at the specified JNDI Address from the JNDI Host
+    * with the specified ID
+    * 
+    * @param hostId
+    * @param jndiName
+    * @return
+    * @throws NameNotFoundException
+    *             If the specified JNDI Address is not a valid binding for the
+    *             specified host
+    */
+   public Object getObject(String hostId, String jndiName) throws NameNotFoundException
+   {
+
+      // Initialize
+      Context context = null;
+
+      // Obtain context
+      context = this.contexts.get(hostId);
+
+      // Obtain JNDI Host
+      JndiHost host = null;
+      try
+      {
+         host = this.getJndiHost(hostId);
+      }
+      catch (JndiHostNotFoundException jhnfe)
+      {
+         throw new IllegalStateException(jhnfe);
+      }
+
+      // Obtain JNP URL for logging
+      String jnpUrl = this.constructJnpUrl(host);
+
+      // Ensure defined
+      if (context == null)
+      {
+         throw new ServiceLocatorException("A JNDI Host with ID \"" + hostId
+               + "\" has not been defined in configuration; cannot lookup \"" + jndiName + "\" from " + jnpUrl);
+      }
+
+      // Lookup
+      try
+      {
+         logger.debug("Performing JNDI Lookup of \"" + jndiName + "\" on " + jnpUrl);
+         return context.lookup(jndiName);
+      }
+      catch (NamingException e)
+      {
+         // Wrap as runtime error
+         throw new ServiceLocatorException(e);
+      }
+
+   }
+
+   // Convenience Methods
+
+   /**
+    * Obtains the JNDI Host with the specified ID;
+    * may only be used after JNDI Hosts have been
+    * initialized
+    */
+   protected JndiHost getJndiHost(String id) throws JndiHostNotFoundException
+   {
+      // Initialize
+      JndiHost host = null;
+
+      // Obtain
+      host = this.jndiHosts.get(id);
+
+      // Ensure found
+      if (host == null)
+      {
+         throw new JndiHostNotFoundException("JNDI Host with ID " + id + " has not been properly initialized");
+      }
+
+      // Return
+      return host;
+   }
+
+   // Internal Helper Methods
+
+   /**
+    * Obtains a Map of JNDI Hosts to Naming Contexts from the currently-defined 
+    * JNDI Hosts
+    */
+   private Map<String, Context> createNamingContextsFromJndiHosts()
+   {
+      // Initialize
+      Map<String, Context> contexts = new HashMap<String, Context>();
+
+      assert (this.jndiHosts != null);
+      if (this.jndiHosts == null)
+      {
+         throw new IllegalStateException(
+               "createNamingContextsFromJndiHosts cannot be called until JNDI Hosts have been initialized");
+      }
+
+      // For each JNDI Host
+      for (JndiHost host : this.jndiHosts.values())
+      {
+         // Populate Properties for naming context
+         Properties props = this.getVendorNamingContextProperties();
+         this.setNamingContextProviderUrl(props, host);
+
+         Context context = null;
+         try
+         {
+            context = new InitialContext(props);
+         }
+         catch (NamingException e)
+         {
+            throw new ServiceLocatorException(e);
+         }
+
+         // Add to Map
+         contexts.put(host.getId(), context);
+      }
+
+      return contexts;
+   }
+
+   /**
+    * Return vendor-specific properties for the naming context
+    * 
+    * @return
+    */
+   // TODO Externalize to allow for other vendor implementations
+   private Properties getVendorNamingContextProperties()
+   {
+      Properties props = new Properties();
+      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
+      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
+      return props;
+   }
+
+   private void setNamingContextProviderUrl(Properties props, JndiHost host)
+   {
+      // Place into properties
+      props.put(Context.PROVIDER_URL, this.constructJnpUrl(host));
+   }
+
+   private String constructJnpUrl(JndiHost host)
+   {
+      // Initialize
+      StringBuffer sb = new StringBuffer();
+
+      // Construct URL
+      sb.append("jnp://");
+      sb.append(host.getAddress());
+      sb.append(":");
+      sb.append(host.getPort());
+
+      // Return
+      return sb.toString();
+   }
+
+   /**
+    * 
+    */
+   private <T> T getObject(JndiHost host, Class<T> clazz) throws Ejb3NotFoundException
+   {
+      // Determine JNDI Host providing type
+      String jndiName = this.getJndiNameForClass(clazz);
+
+      // Look up
+      try
+      {
+         return (T) this.getObject(host.getId(), jndiName);
+      }
+      catch (NameNotFoundException e)
+      {
+         throw new ServiceLocatorException(e);
+      }
+
+   }
+
+   /**
+    * Determines the JNDI Name for the specified class
+    * 
+    * @param clazz
+    * @return
+    * @throws Ejb3NotFoundException
+    */
+   private String getJndiNameForClass(Class<?> clazz) throws Ejb3NotFoundException
+   {
+      throw new RuntimeException("IMPLEMENT");
+   }
+
+}


Property changes on: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/Ejb3ServiceLocatorImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiCachingServiceLocator.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiCachingServiceLocator.java	2007-12-18 05:51:36 UTC (rev 68366)
+++ projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiCachingServiceLocator.java	2007-12-18 05:58:06 UTC (rev 68367)
@@ -1,176 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2007, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.ejb3.locator.client;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * JndiCachingServiceLocator
- * 
- * JNDI-based implementation of the Service Locator; will attempt to obtain
- * services from one of a set of configured JNDI Directories (Hosts).
- * 
- * @version $Revision $
- * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
- */
-public final class JndiCachingServiceLocator extends CachingServiceLocator
-{
-
-   // Class Members
-   private static final Log logger = LogFactory.getLog(JndiCachingServiceLocator.class);
-
-   private static JndiCachingServiceLocator instance = null;
-
-   // Instance Members
-
-   /**
-    * List of JNDI Hosts on which Services may be bound
-    */
-   private final Map<String, JndiHost> jndiHosts = Collections.synchronizedMap(new HashMap<String, JndiHost>());
-
-   /**
-    * Mapping of Business Interface to the JNDI Host upon which it resides
-    */
-   private final Map<Class<?>, JndiHost> serviceMappings = Collections
-         .synchronizedMap(new HashMap<Class<?>, JndiHost>());
-
-   // Constructor
-
-   /**
-    * Constructor
-    */
-   JndiCachingServiceLocator(Map<String, JndiHost> jndiHosts)
-   {
-      super();
-      this.jndiHosts.putAll(jndiHosts);
-   }
-
-   // Contracts
-
-   /**
-    * Obtains the object associated with the specified business interface from
-    * one of the configured remote hosts.
-    * 
-    * @param <T>
-    * @param clazz
-    *            The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException
-    *             If no services implementing the specified business interface
-    *             could be found on any of the configured local/remote hosts
-    * @throws IllegalArgumentException
-    *             If the specified class is a business interface implemented by
-    *             more than one service across the configured local/remote
-    *             hosts, or if the specified class is not an interface
-    */
-   public <T> T getObject(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
-   {
-      // Initialize
-      T obj = null;
-
-      // For all configured hosts
-      for (JndiHost host : this.jndiHosts.values())
-      {
-         T retrievedObj = null;
-         try
-         {
-            retrievedObj = this.getObject(host, clazz);
-         }
-         // Ignore, simply not present on this one host
-         catch (Ejb3NotFoundException enfe)
-         {
-            continue;
-         }
-
-         // Ensure that an EJB with this business interface has not already been found on another host
-         if (obj != null)
-         {
-            throw new IllegalArgumentException("EJB3 with business interface " + clazz.getName()
-                  + " is not unique across all configured hosts and may not be looked up by interface alone.");
-         }
-
-         // Set retrieved object to obj and continue searching through other configured hosts to ensure uniqueness
-         obj = retrievedObj;
-      }
-
-      // If not found on any hosts
-      if (obj == null)
-      {
-         throw new Ejb3NotFoundException("Could not find EJB3 with business interface " + clazz.getName()
-               + " on any configured hosts.");
-      }
-
-      // Return
-      return obj;
-   }
-
-   /**
-    * Obtains the object associated with the specified business interface 
-    * from the host with the specified ID.
-    * 
-    * @param <T>
-    * @param hostId The ID of the host from which to obtain the 
-    *   object with the specified business interface
-    * @param clazz The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on the specified host
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the specified host, if the
-    *   specified class is not an interface, or if the specified host ID is not 
-    *   valid for one of the configured hosts 
-    */
-   public <T> T getObject(String hostId, Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
-   {
-      // Obtain configured host by ID
-      JndiHost host = this.jndiHosts.get(hostId);
-
-      // Ensure ID is valid
-      if (host == null)
-      {
-         throw new IllegalArgumentException("There are no configured hosts with ID of \"" + hostId + "\"");
-      }
-      
-      // Return
-      return this.getObject(host, clazz);
-
-   }
-
-   // Internal Helper Methods
-
-   /**
-    * 
-    */
-   private <T> T getObject(JndiHost host, Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException
-   {
-      throw new RuntimeException("IMPLEMENT");
-   }
-
-}

Added: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiHostNotFoundException.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiHostNotFoundException.java	                        (rev 0)
+++ projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiHostNotFoundException.java	2007-12-18 05:58:06 UTC (rev 68367)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.ejb3.locator.client;
+
+/**
+ * JndiHostNotFoundException
+ * 
+ * Thrown upon failed attempt to lookup a JNDI Host
+ * by its ID
+ * 
+ * @author <a href="mailto:andrew.rubinger at redhat.com">ALR</a>
+ * @version $Revision $$
+ *
+ */
+public class JndiHostNotFoundException extends Exception
+{
+   // Class Members
+
+   private static final long serialVersionUID = 2054153832183595691L;
+
+   // Constructors
+   public JndiHostNotFoundException(String arg0)
+   {
+      super(arg0);
+   }
+
+   public JndiHostNotFoundException(String arg0, Throwable arg1)
+   {
+      super(arg0, arg1);
+   }
+
+   public JndiHostNotFoundException(Throwable arg0)
+   {
+      super(arg0);
+   }
+}


Property changes on: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiHostNotFoundException.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiServiceLocator.java (from rev 68344, projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/ServiceLocator.java)
===================================================================
--- projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiServiceLocator.java	                        (rev 0)
+++ projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiServiceLocator.java	2007-12-18 05:58:06 UTC (rev 68367)
@@ -0,0 +1,108 @@
+/*
+  * JBoss, Home of Professional Open Source
+  * Copyright 2007, JBoss Inc., and individual contributors as indicated
+  * by the @authors tag. See the copyright.txt 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.ejb3.locator.client;
+
+import javax.naming.NameNotFoundException;
+
+/**
+ * ServiceLocator
+ * 
+ * 
+ * 
+ * @version $Revision $
+ * @author <a href="mailto:alr at alrubinger.com">ALR</a>
+ */
+public interface JndiServiceLocator
+{
+
+   /**
+    * Obtains a stub to the the SLSB service with the specified business 
+    * interface.  If this is the first request for this service, it will 
+    * be obtained from JNDI and placed in a cache such that subsequent 
+    * requests will not require the overhead of a JNDI lookup. 
+    * 
+    * @param <T>
+    * @param clazz The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException 
+    *   If no services implementing the specified business interface 
+    *   could be found on any of the configured local/remote hosts
+    * @throws IllegalArgumentException
+    *   If the specified class is a business interface implemented by more than 
+    *   one service across the configured local/remote hosts, or if the
+    *   specified class is no an interface 
+    */
+   public <T> T getStatelessService(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException;
+
+   /**
+    * Obtains a stub to the the SFSB with the specified business 
+    * interface.  This call will always result in a call to JNDI 
+    * for a new stub; no caching will take place
+    * 
+    * @param <T>
+    * @param clazz The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException 
+    *   If no services implementing the specified business interface 
+    *   could be found on any of the configured local/remote hosts
+    * @throws IllegalArgumentException
+    *   If the specified class is a business interface implemented by more than 
+    *   one service across the configured local/remote hosts, or if the
+    *   specified class is no an interface 
+    */
+   public <T> T getStatefulBean(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException;
+
+   /**
+    * Obtains a stub to the the JMX (MBean, Singleton) service with 
+    * the specified business interface.  If this is the first 
+    * request for this service, it will be obtained from JNDI and 
+    * placed in a cache such that subsequent requests will not 
+    * require the overhead of a JNDI lookup.  Convenience
+    * method; equivalent to <code>getStatelessService</code>
+    * 
+    * @param <T>
+    * @param clazz The business interface of the desired service
+    * @return
+    * @throws Ejb3NotFoundException 
+    *   If no services implementing the specified business interface 
+    *   could be found on any of the configured local/remote hosts
+    * @throws IllegalArgumentException
+    *   If the specified class is a business interface implemented by more than 
+    *   one service across the configured local/remote hosts, or if the
+    *   specified class is no an interface 
+    */
+   public <T> T getJmxService(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException;
+   
+   
+   /**
+    * Fetches the object bound at the specified JNDI Address
+    * from the JNDI Host with the specified ID
+    * 
+    * @param hostId
+    * @param jndiName
+    * @return
+    * @throws NameNotFoundException If the specified JNDI Address is 
+    * 	not a valid binding for the specified host
+    */
+   public Object getObject(String hostId,String jndiName) throws NameNotFoundException;
+
+}


Property changes on: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/JndiServiceLocator.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/ServiceLocator.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/ServiceLocator.java	2007-12-18 05:51:36 UTC (rev 68366)
+++ projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/ServiceLocator.java	2007-12-18 05:58:06 UTC (rev 68367)
@@ -1,93 +0,0 @@
-/*
-  * JBoss, Home of Professional Open Source
-  * Copyright 2007, JBoss Inc., and individual contributors as indicated
-  * by the @authors tag. See the copyright.txt 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.ejb3.locator.client;
-
-/**
- * ServiceLocator
- * 
- * 
- * 
- * @version $Revision $
- * @author <a href="mailto:alr at alrubinger.com">ALR</a>
- */
-public interface ServiceLocator
-{
-
-   /**
-    * Obtains a stub to the the SLSB service with the specified business 
-    * interface.  If this is the first request for this service, it will 
-    * be obtained from JNDI and placed in a cache such that subsequent 
-    * requests will not require the overhead of a JNDI lookup. 
-    * 
-    * @param <T>
-    * @param clazz The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on any of the configured local/remote hosts
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the configured local/remote hosts, or if the
-    *   specified class is no an interface 
-    */
-   public <T> T getStatelessService(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException;
-
-   /**
-    * Obtains a stub to the the SFSB with the specified business 
-    * interface.  This call will always result in a call to JNDI 
-    * for a new stub; no caching will take place
-    * 
-    * @param <T>
-    * @param clazz The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on any of the configured local/remote hosts
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the configured local/remote hosts, or if the
-    *   specified class is no an interface 
-    */
-   public <T> T getStatefulBean(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException;
-
-   /**
-    * Obtains a stub to the the JMX (MBean, Singleton) service with 
-    * the specified business interface.  If this is the first 
-    * request for this service, it will be obtained from JNDI and 
-    * placed in a cache such that subsequent requests will not 
-    * require the overhead of a JNDI lookup.  Convenience
-    * method; equivalent to <code>getStatelessService</code>
-    * 
-    * @param <T>
-    * @param clazz The business interface of the desired service
-    * @return
-    * @throws Ejb3NotFoundException 
-    *   If no services implementing the specified business interface 
-    *   could be found on any of the configured local/remote hosts
-    * @throws IllegalArgumentException
-    *   If the specified class is a business interface implemented by more than 
-    *   one service across the configured local/remote hosts, or if the
-    *   specified class is no an interface 
-    */
-   public <T> T getJmxService(Class<T> clazz) throws Ejb3NotFoundException, IllegalArgumentException;
-
-}

Modified: projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/ServiceLocatorFactory.java
===================================================================
--- projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/ServiceLocatorFactory.java	2007-12-18 05:51:36 UTC (rev 68366)
+++ projects/ejb3/trunk/locator/src/main/java/org/jboss/ejb3/locator/client/ServiceLocatorFactory.java	2007-12-18 05:58:06 UTC (rev 68367)
@@ -32,7 +32,7 @@
 {
 
    // Class Members
-   private static ServiceLocator serviceLocator = null;
+   private static JndiServiceLocator serviceLocator = null;
    
    private static final String CONFIGURATION_FILE_USER_OVERRIDE_FILENAME_SYSTEM_PROPERTY_KEY = "jboss.servicelocator.location";
    
@@ -83,7 +83,7 @@
       }
 
       // Parse
-      ServiceLocatorFactory.serviceLocator = new JndiCachingServiceLocator(JndiHostConfigurationParser.getInstance()
+      ServiceLocatorFactory.serviceLocator = new Ejb3ServiceLocatorImpl(JndiHostConfigurationParser.getInstance()
             .parse(configuration));
    }
 
@@ -92,7 +92,7 @@
     * 
     * @return
     */
-   public ServiceLocator getServiceLocator()
+   public JndiServiceLocator getServiceLocator()
    {
       return ServiceLocatorFactory.serviceLocator;
    }




More information about the jboss-cvs-commits mailing list