ServiceManager.java
01 /*
02  * Copyright 2009-2012 the original author or authors.
03  *
04  * Licensed under the Apache License, Version 2.0 (the "License");
05  * you may not use this file except in compliance with the License.
06  * You may obtain a copy of the License at
07  *
08  *      http://www.apache.org/licenses/LICENSE-2.0
09  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package griffon.core;
18 
19 import java.util.Map;
20 
21 /**
22  * Helper class capable of dealing with services.
23  *
24  @author Andres Almiray
25  @since 0.9.4
26  */
27 public interface ServiceManager extends ApplicationHandler {
28     /**
29      * Returns a read-only view of all available services
30      *
31      @return a non-null Map of services keyed by name
32      */
33     Map<String, GriffonService> getServices();
34 
35     /**
36      * Finds an service by name.<p>
37      * Never returns null for a matching service name.
38      * If a service instance is not yet available then this method will create it.
39      *
40      @param name the name of the service to search for
41      @return a service instance if there's a match, null otherwise.
42      */
43     GriffonService findService(String name);
44 }