2 * Copyright 2005-2010 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
22 * the started components and is (usually) the result of starting a container.
24 * @author Erik Brakkee
26 public interface Scope {
28 * Gets the provided interfaces by this scope.
30 * @return Provided interfaces.
32 List<ProvidedInterface> getProvidedInterfaces();
35 * Adds a key value pair to the scope.
42 void put(String aKey, Object aValue);
45 * Retrieves a value for the key.
52 Object get(String aKey);
55 * Adds the runtime of a started component.
62 void addRuntime(Component aComponent, Object aRuntime);
65 * Publishes an implementation of a provided interface.
68 * Interface that is provided.
69 * @param aImplementation
70 * Implementation of the interface.
72 void publishInterface(ProvidedInterface aInterface, Object aImplementation);
74 <T> T getInterfaceImplementation(ProvidedInterface aProvided, Class<T> aType);
77 * Gets the runtime for a component.
80 * Component for which we want to get the runtime.
84 Object getRuntime(Component aComponent);
87 * Gets the runtime for a component based on the name of the component
88 * (excluding its context).
93 * @return Component name.
95 Object getRuntime(String aName);