View Javadoc
1   package org.codehaus.plexus.personality.plexus.lifecycle.phase;
2   
3   /*
4    * Copyright 2001-2006 Codehaus Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
20  import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
21  
22  import java.util.List;
23  import java.util.Map;
24  
25  /**
26   * Provides services to components by means of a lookup.
27   * 
28   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
29   */
30  public interface ServiceLocator
31  {
32  	//----------------------------------------------------------------------
33      // Component lookup
34      // ----------------------------------------------------------------------
35  
36      Object lookup( String componentKey )
37          throws ComponentLookupException;
38  
39      Object lookup( String role, String roleHint )
40          throws ComponentLookupException;
41  
42      Map lookupMap( String role )
43          throws ComponentLookupException;
44  
45      List lookupList( String role )
46          throws ComponentLookupException;
47      
48      //----------------------------------------------------------------------
49      // Component release
50      // ----------------------------------------------------------------------
51  
52      void release( Object component )
53          throws ComponentLifecycleException;
54  
55      void releaseAll( Map components )
56          throws ComponentLifecycleException;
57  
58      void releaseAll( List components )
59          throws ComponentLifecycleException;
60  
61      // ----------------------------------------------------------------------
62      // Component discovery
63      // ----------------------------------------------------------------------
64  
65      boolean hasComponent( String componentKey );
66  
67      boolean hasComponent( String role, String roleHint );
68  }