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;
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.
26 * @author Erik Brakkee
28 public interface Scope {
32 * @return DOCUMENT ME!
37 * @return DOCUMENT ME!
40 * Gets the provided interfaces by this scope.
41 * @return Provided interfaces.
43 List<ProvidedInterface> getProvidedInterfaces();
46 * Adds a key value pair to the scope.
49 * @param aValue Value.
51 void put(String aKey, Object aValue);
54 * Retrieves a value for the key.
60 Object get(String aKey);
63 * Adds the runtime of a started component.
65 * @param aComponent Component.
66 * @param aRuntime Runtime.
68 void addRuntime(Component aComponent, Object aRuntime);
71 * Publishes an implementation of a provided interface.
73 * @param aInterface Interface that is provided.
74 * @param aImplementation Implementation of the interface.
76 void publishInterface(ProvidedInterface aInterface, Object aImplementation);
81 * @param <T> DOCUMENT ME!
82 * @param aProvided DOCUMENT ME!
83 * @param aType DOCUMENT ME!
85 * @return DOCUMENT ME!
87 <T> T getInterfaceImplementation(ProvidedInterface aProvided, Class<T> aType);
90 * Gets the runtime for a component.
92 * @param aComponent Component for which we want to get the runtime.
96 Object getRuntime(Component aComponent);
99 * Gets the runtime for a component based on the name of the
100 * component (excluding its context).
102 * @param aName Component name.
104 * @return Component name.
106 Object getRuntime(String aName);