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 java.util.List; 20 import java.util.Map; 21 22 import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException; 23 import org.codehaus.plexus.component.repository.exception.ComponentLookupException; 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 // Component lookup 33 // ---------------------------------------------------------------------- 34 35 Object lookup(String componentKey) throws ComponentLookupException; 36 37 Object lookup(String role, String roleHint) throws ComponentLookupException; 38 39 Map lookupMap(String role) throws ComponentLookupException; 40 41 List lookupList(String role) throws ComponentLookupException; 42 43 // ---------------------------------------------------------------------- 44 // Component release 45 // ---------------------------------------------------------------------- 46 47 void release(Object component) throws ComponentLifecycleException; 48 49 void releaseAll(Map components) throws ComponentLifecycleException; 50 51 void releaseAll(List components) throws ComponentLifecycleException; 52 53 // ---------------------------------------------------------------------- 54 // Component discovery 55 // ---------------------------------------------------------------------- 56 57 boolean hasComponent(String componentKey); 58 59 boolean hasComponent(String role, String roleHint); 60 }