ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components WrapperServiceManager.java
Date Sun, 30 Jun 2002 09:48:12 GMT
donaldp     2002/06/30 02:48:12

  Added:       container/src/test/org/apache/myrmidon/components
                        WrapperServiceManager.java
  Log:
  Add in class that adapts an AntServiceKernel into a ServiceManager
  
  Revision  Changes    Path
  1.1                  jakarta-ant-myrmidon/container/src/test/org/apache/myrmidon/components/WrapperServiceManager.java
  
  Index: WrapperServiceManager.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.myrmidon.components;
  
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.myrmidon.components.service.DefaultAntServiceKernel;
  
  /**
   * ServiceManager Wrapper of ServiceKernel.
   *
   * @author <a href="mailto:peter@apache.org">Peter Donald</a>
   * @version $Revision: 1.1 $ $Date: 2002/06/30 09:48:12 $
   */
  class WrapperServiceManager
      implements ServiceManager
  {
      private DefaultAntServiceKernel m_serviceKernel;
  
      public WrapperServiceManager( final DefaultAntServiceKernel serviceKernel )
      {
          m_serviceKernel = serviceKernel;
      }
  
      public Object lookup( final String role )
          throws ServiceException
      {
          return m_serviceKernel.getService( role );
      }
  
      public boolean hasService( final String role )
      {
          try
          {
              m_serviceKernel.getService( role );
              return true;
          }
          catch( ServiceException e )
          {
              return false;
          }
      }
  
      public void release( final Object object )
      {
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message