2 * Copyright 2008 the original author or authors.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.wamblee.system.core;
18 import java.util.List;
21 * A scope represents a set of running services and the runtime information for the
22 * started components and is (usually) the result of
23 * starting a container.
25 * @author Erik Brakkee
27 public interface Scope {
30 * Gets the provided interfaces by this scope.
31 * @return Provided interfaces.
33 List<ProvidedInterface> getProvidedInterfaces();
36 * Adds a key value pair to the scope.
38 * @param aValue Value.
40 void put(String aKey, Object aValue);
43 * Retrieves a value for the key.
47 Object get(String aKey);
50 * Adds the runtime of a started component.
51 * @param aComponent Component.
52 * @param aRuntime Runtime.
54 void addRuntime(Component aComponent, Object aRuntime);
57 * Publishes an implementation of a provided interface.
58 * @param aInterface Interface that is provided.
59 * @param aImplementation Implementation of the interface.
61 void publishInterface(ProvidedInterface aInterface, Object aImplementation);
64 * Retrieves an implementation of a provided interface.
66 * rovided interface. If it is null then null is returned.
67 * @param aType Type of implementation that is expected.
68 * @return Retrieved interface.
70 <T> T getInterfaceImplementation(ProvidedInterface aProvided, Class<T> aType );
73 * Gets the runtime for a component.
74 * @param aComponent Component for which we want to get the runtime.
77 Object getRuntime(Component aComponent);
80 * Gets the runtime for a component based on the name of the component
81 * (excluding its context).
82 * @param aName Component name.
83 * @return Component name.
85 Object getRuntime(String aName);