View Javadoc

1   //----------------------------------------------------------------------
2   // 
3   // PerfectJPattern: "Design patterns are good but components are better!" 
4   // IServiceLocator.java Copyright (c) 2009 Giovanni Azua Garcia
5   // bravegag@hotmail.com
6   //  
7   // This program is free software; you can redistribute it and/or
8   // modify it under the terms of the GNU General Public License
9   // as published by the Free Software Foundation; either version 3
10  // of the License, or (at your option) any later version.
11  //
12  // This program is distributed in the hope that it will be useful,
13  // but WITHOUT ANY WARRANTY; without even the implied warranty of
14  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  // GNU General Public License for more details.
16  //
17  // You should have received a copy of the GNU General Public License
18  // along with this program; if not, see <http://www.gnu.org/licenses/>.
19  //
20  //----------------------------------------------------------------------
21  package org.perfectjpattern.jee.api.business.servicelocator;
22  
23  /**
24   * <b>Service Locator Pattern</b>: Centralizes distributed service object 
25   * lookups, provides a centralized point of control, and may act as a cache 
26   * that eliminates redundant lookups. It also encapsulates any vendor-
27   * specific features of the lookup process. 
28   * <br/><br/>
29   * 
30   * <b>Responsibility</b> Abstract definition of the "Service Locator": <br/>
31   * <br/>
32   * <ul>
33   * <li>abstracts API lookup for naming services providing simpler 
34   * interface to clients</li>
35   * </ul>
36   *
37   * @param <S> <code>Service</code> type
38   * 
39   * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>
40   * @version $Revision: 1.0 $Date: Feb 6, 2009 9:35:08 PM $
41   */
42  public 
43  interface IServiceLocator
44  {
45      //------------------------------------------------------------------------
46      // public
47      //------------------------------------------------------------------------
48      /**
49       * Returns the matching Service found 
50       * 
51       * @param aName Name of Service to lookup
52       * @return matching Service found 
53       */
54      public <S> S
55      locate(String aName)
56      throws IllegalArgumentException;
57      
58      //------------------------------------------------------------------------
59      /**
60       * Shutdown {@link IServiceLocator} and releases resources
61       */
62      public void
63      shutdown();
64  }