org.apache.openejb.client
Class GenericServiceLocator

java.lang.Object
  extended by org.apache.openejb.client.ServiceLocator
      extended by org.apache.openejb.client.GenericServiceLocator

public class GenericServiceLocator
extends ServiceLocator

Version:
$Rev: 607077 $ $Date: 2007-12-27 15:55:23 +0100 (Do, 27. Dez 2007) $

Constructor Summary
GenericServiceLocator(Context context, String commonPrefix)
           
GenericServiceLocator(URI serverUri, String commonPrefix)
           
GenericServiceLocator(URI serverUri, String username, String password, String commonPrefix)
           
GenericServiceLocator(URI serverUri, String username, String password, String realm, String commonPrefix)
           
 
Method Summary
<T> T
lookup(Class<T> type)
          Usable with JNDI name formats ending in the full class name of the interface Such as: - {interfaceClass} Or with commonPrefix (supplied in constructor) such as: - {moduleId}/{interfaceClass} - ejb/{moduleId}/{interfaceClass}
<T,B> T
lookup(Class<T> type, Class<B> ejbClass)
          Usable with JNDI name formats comprised of the interfaceClass and ejbClass For variation, the interface class is the prefix and the ejb class is the suffix.
 Object lookup(String name)
           
<T> T
lookup(String prefix, Class<T> type)
          Usable with JNDI name formats including a varying prefix such as ejbName or deploymentID and ending in the full class name of the interface Such as: - {ejbName}/{interfaceClass} - {deploymentId}/{interfaceClass} Or with commonPrefix (supplied in constructor) such as: - {moduleId}/{ejbName}/{interfaceClass} - ejb/{moduleId}/{deploymentId}/{interfaceClass}
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericServiceLocator

public GenericServiceLocator(URI serverUri,
                             String commonPrefix)
                      throws NamingException
Throws:
NamingException

GenericServiceLocator

public GenericServiceLocator(URI serverUri,
                             String username,
                             String password,
                             String commonPrefix)
                      throws NamingException
Throws:
NamingException

GenericServiceLocator

public GenericServiceLocator(URI serverUri,
                             String username,
                             String password,
                             String realm,
                             String commonPrefix)
                      throws NamingException
Throws:
NamingException

GenericServiceLocator

public GenericServiceLocator(Context context,
                             String commonPrefix)
Method Detail

lookup

public Object lookup(String name)
Overrides:
lookup in class ServiceLocator

lookup

public <T> T lookup(Class<T> type)
Usable with JNDI name formats ending in the full class name of the interface Such as: - {interfaceClass} Or with commonPrefix (supplied in constructor) such as: - {moduleId}/{interfaceClass} - ejb/{moduleId}/{interfaceClass}

Parameters:
type - the interfaceClass
Returns:
(T) lookup(type.getName())

lookup

public <T> T lookup(String prefix,
                    Class<T> type)
Usable with JNDI name formats including a varying prefix such as ejbName or deploymentID and ending in the full class name of the interface Such as: - {ejbName}/{interfaceClass} - {deploymentId}/{interfaceClass} Or with commonPrefix (supplied in constructor) such as: - {moduleId}/{ejbName}/{interfaceClass} - ejb/{moduleId}/{deploymentId}/{interfaceClass}

Parameters:
prefix - such as ejbName or deploymentId
type - the interfaceClass
Returns:
(T) lookup(prefix + "/" + type.getName())

lookup

public <T,B> T lookup(Class<T> type,
                      Class<B> ejbClass)
Usable with JNDI name formats comprised of the interfaceClass and ejbClass For variation, the interface class is the prefix and the ejb class is the suffix. This is neat as the the prefix (the interface class name) becomes a jndi context with one binding in it for each implementing ejb class. Works with: - {interfaceClass}/{ejbClass} Or with commonPrefix (supplied in constructor) such as: - {moduleId}/{interfaceClass}/{ejbClass} - ejb/{moduleId}/{interfaceClass}/{ejbClass}

Parameters:
type - the interfaceClass
ejbClass - the ejbClass
Returns:
(T) lookup(type.getName() + "/" + ejbClass.getName())


Copyright © 1999-2011 The Apache OpenEJB development community. All Rights Reserved.