source code formatting.
[utils] / system / general / src / main / java / org / wamblee / system / core / Scope.java
1 /*
2  * Copyright 2008 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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 package org.wamblee.system.core;
17
18 import java.util.List;
19
20
21 /**
22  * A scope represents a set of running services and the runtime information for the 
23  * started components and is (usually) the result of 
24  * starting a container. 
25  * 
26  * @author Erik Brakkee
27  */
28 public interface Scope {
29     /**
30      * DOCUMENT ME!
31      *
32      * @return DOCUMENT ME!
33      */
34 /**
35      * DOCUMENT ME!
36      *
37      * @return DOCUMENT ME!
38      */
39 /**
40          * Gets the provided interfaces by this scope. 
41          * @return Provided interfaces. 
42          */
43     List<ProvidedInterface> getProvidedInterfaces();
44
45     /**
46      * Adds a key value pair to the scope.
47      *
48      * @param aKey Key
49      * @param aValue Value.
50      */
51     void put(String aKey, Object aValue);
52
53     /**
54      * Retrieves a value for the key.
55      *
56      * @param aKey Key.
57      *
58      * @return Value.
59      */
60     Object get(String aKey);
61
62     /**
63      * Adds the runtime of a started component.
64      *
65      * @param aComponent Component.
66      * @param aRuntime Runtime.
67      */
68     void addRuntime(Component aComponent, Object aRuntime);
69
70     /**
71      * Publishes an implementation of a provided interface.
72      *
73      * @param aInterface Interface that is provided.
74      * @param aImplementation Implementation of the interface.
75      */
76     void publishInterface(ProvidedInterface aInterface, Object aImplementation);
77
78     /**
79      * DOCUMENT ME!
80      *
81      * @param <T> DOCUMENT ME!
82      * @param aProvided DOCUMENT ME!
83      * @param aType DOCUMENT ME!
84      *
85      * @return DOCUMENT ME!
86      */
87     <T> T getInterfaceImplementation(ProvidedInterface aProvided, Class<T> aType);
88
89     /**
90      * Gets the runtime for a component.
91      *
92      * @param aComponent Component for which we want to get the runtime.
93      *
94      * @return Runtime.
95      */
96     Object getRuntime(Component aComponent);
97
98     /**
99      * Gets the runtime for a component based on the name of the
100      * component (excluding its context).
101      *
102      * @param aName Component name.
103      *
104      * @return Component name.
105      */
106     Object getRuntime(String aName);
107 }