You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Peter Donald <pe...@apache.org> on 2002/11/09 04:06:59 UTC
Re: cvs commit: jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lookup FortressServiceManager.java
Could someone check that this still all works as expected - in particular with
respect to nested containers and stuff (if you use em).
On Sat, 9 Nov 2002 13:54, donaldp@apache.org wrote:
> donaldp 2002/11/08 18:54:54
>
> Modified: fortress/src/java/org/apache/excalibur/fortress/lookup
> FortressServiceManager.java
> Log:
> Remove JNDI Integration
>
> Revision Changes Path
> 1.22 +16 -11
> jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/lo
>okup/FortressServiceManager.java
>
> Index: FortressServiceManager.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/f
>ortress/lookup/FortressServiceManager.java,v retrieving revision 1.21
> retrieving revision 1.22
> diff -u -r1.21 -r1.22
> --- FortressServiceManager.java 8 Nov 2002 06:06:12 -0000 1.21
> +++ FortressServiceManager.java 9 Nov 2002 02:54:54 -0000 1.22
> @@ -57,7 +57,6 @@
> import org.apache.avalon.framework.service.ServiceSelector;
> import org.apache.avalon.framework.service.WrapperServiceSelector;
> import org.apache.commons.collections.StaticBucketMap;
> -import org.apache.excalibur.container.lookup.AbstractServiceManager;
> import org.apache.excalibur.fortress.Container;
> import org.apache.excalibur.fortress.handler.ComponentHandler;
>
> @@ -70,7 +69,7 @@
> * @version CVS $Revision$ $Date$
> */
> public class FortressServiceManager
> - extends AbstractServiceManager
> + implements ServiceManager
> {
> private final Container m_container;
> private final Map m_used;
> @@ -83,23 +82,26 @@
> public FortressServiceManager( final Container container,
> final ServiceManager parent )
> {
> - super( parent );
> if( null == container )
> {
> throw new NullPointerException( "container" );
> }
> + if( null == parent )
> + {
> + throw new NullPointerException( "parent" );
> + }
>
> m_parent = parent;
> m_container = container;
> m_used = new StaticBucketMap();
> }
>
> - protected Object obtainService( final String key )
> + public Object lookup( final String key )
> throws ServiceException
> {
> if( !m_container.has( key, null ) )
> {
> - return null;
> + return m_parent.lookup( key );
> }
>
> final Object result = m_container.get( key, null );
> @@ -115,7 +117,8 @@
>
> if( !( result instanceof ComponentHandler ) )
> {
> - throw new ServiceException( key, "Invalid entry in component
> manager" ); + final String message = "Invalid entry in component
> manager"; + throw new ServiceException( key, message );
> }
>
> try
> @@ -136,16 +139,18 @@
> }
> catch( final Exception e )
> {
> - throw new ServiceException( key, "Could not return a
> reference to the Component", e ); + final String message =
> + "Could not return a reference to the Component";
> + throw new ServiceException( key, message, e );
> }
> }
>
> - protected boolean serviceExists( String role )
> + public boolean hasService( final String key )
> {
> - return m_container.has( role, null );
> + return m_container.has( key, null );
> }
>
> - public void release( Object component )
> + public void release( final Object component )
> {
> final ComponentHandler handler =
> (ComponentHandler)m_used.remove( component ); if( null == handler )
--
Cheers,
Peter Donald
----------------------------------------
"Liberty means responsibility. That is
why most men dread it." - Locke
----------------------------------------
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>