org.jpu.patterns.serviceLocator
Class SLSBLocator

java.lang.Object
  extended byorg.jpu.patterns.serviceLocator.Locator
      extended byorg.jpu.patterns.serviceLocator.SLSBLocator
All Implemented Interfaces:
ILocator, ISLSBLocator
Direct Known Subclasses:
SLSBLocator

public class SLSBLocator
extends Locator
implements ISLSBLocator

Subclass of Locator specialized for stateless session beans. This class overrides the lookup() method to call create() on the home object. Any exceptions thrown from create() are rethrown wrapped in ServiceLocatorException. Of course the home interface must define a public no-arg create() method (as all SLSB's must); else a ServiceLocatorException will result.


Nested Class Summary
 
Nested classes inherited from class org.jpu.patterns.serviceLocator.Locator
Locator.DefaultIdentifierParser, Locator.DefaultLookupStrategy, Locator.DefaultNarrowStrategy, Locator.NullCache
 
Nested classes inherited from class org.jpu.patterns.serviceLocator.ILocator
ILocator.ICache, ILocator.IIdentifierParser, ILocator.ILookupStrategy, ILocator.INarrowStrategy
 
Constructor Summary
SLSBLocator()
           
 
Method Summary
 java.lang.Object createSLSB(java.lang.Object homeobj, ServiceLocatorOptions options)
          Creates a SLSB given its home.
 java.lang.Object getSLSB(java.lang.String homeNamingIdentifier)
          Alias for "getSLSB(homeNamingIdentifier, (ServiceLocatorOptions)null)".
 java.lang.Object getSLSB(java.lang.String homeNamingIdentifier, java.lang.Class c)
          Alias for "getObject(homeNamingIdentifier, c)".
 java.lang.Object getSLSB(java.lang.String homeNamingIdentifier, ServiceLocatorOptions options)
          Alias for "getObject(homeNamingIdentifier, options)".
 java.lang.Object lookup(java.lang.String namingIdentifier, ServiceLocatorOptions options)
          Overrides the superclass version to create the SLSB from its remote interface.
 java.lang.Object narrowSLSBHome(java.lang.Object homeobj, ServiceLocatorOptions options)
          Narrows the reference to the given home to the appropriate type.
 
Methods inherited from class org.jpu.patterns.serviceLocator.Locator
clearCache, getCache, getDefaultCast, getLookupStrategy, getNarrowStrategy, getObject, getObject, getObject, narrow, narrow, newCache, newIdentifier, newLookupStrategy, newNarrowStrategy, removeFromCache, setCache, setLookupStrategy, setNarrowStrategy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jpu.patterns.serviceLocator.ILocator
clearCache, getCache, getDefaultCast, getLookupStrategy, getNarrowStrategy, getObject, getObject, getObject, narrow, narrow, newCache, newLookupStrategy, newNarrowStrategy, removeFromCache, setCache, setLookupStrategy, setNarrowStrategy
 

Constructor Detail

SLSBLocator

public SLSBLocator()
Method Detail

getSLSB

public java.lang.Object getSLSB(java.lang.String homeNamingIdentifier)
                         throws ServiceLocatorException
Alias for "getSLSB(homeNamingIdentifier, (ServiceLocatorOptions)null)".

Specified by:
getSLSB in interface ISLSBLocator
Throws:
ServiceLocatorException

getSLSB

public java.lang.Object getSLSB(java.lang.String homeNamingIdentifier,
                                java.lang.Class c)
                         throws ServiceLocatorException
Alias for "getObject(homeNamingIdentifier, c)".

Specified by:
getSLSB in interface ISLSBLocator
Throws:
ServiceLocatorException

getSLSB

public java.lang.Object getSLSB(java.lang.String homeNamingIdentifier,
                                ServiceLocatorOptions options)
                         throws ServiceLocatorException
Alias for "getObject(homeNamingIdentifier, options)".

Specified by:
getSLSB in interface ISLSBLocator
Throws:
ServiceLocatorException

lookup

public java.lang.Object lookup(java.lang.String namingIdentifier,
                               ServiceLocatorOptions options)
                        throws ServiceLocatorException
Overrides the superclass version to create the SLSB from its remote interface. To change the way the SLSB is created, override createSLSB(Object,ServiceLocatorOptions).

Overrides:
lookup in class Locator
Throws:
ServiceLocatorException

narrowSLSBHome

public java.lang.Object narrowSLSBHome(java.lang.Object homeobj,
                                       ServiceLocatorOptions options)
                                throws ServiceLocatorException
Narrows the reference to the given home to the appropriate type. The default implementation examines options and, if it is of type SLSBLocatorOptions with castHomeTo non-null, calls Locator.narrow(Object, Class) to narrow to this type; else it returns the original homeobj.

This method will be called by createSLSB(Object, ServiceLocatorOptions) just before it calls the home object's accessible no-arg create() method.

Throws:
ServiceLocatorException

createSLSB

public java.lang.Object createSLSB(java.lang.Object homeobj,
                                   ServiceLocatorOptions options)
                            throws ServiceLocatorException
Creates a SLSB given its home. Uses reflection to call the accessible no-arg create() method on the given home object. Does not narrow the resulting EJBObject. Calls narrowSLSBHome(Object, ServiceLocatorOptions) to narrow the EJBHome before calling create() on it. Subclasses are free to override this behavior as needed.

Throws:
ServiceLocatorException


Copyright (c) 2001-2003 - Apache Software Foundation