validateRequiredInterfaces(required);
- addProvidersOfRequiredInterfaces(provided);
- validateRequiredProvidedMatch(provided, required);
- }
-
- /**
- *
- * @param aProvided
- * All provided interfaces.
- * @param aRequired
- * All required interfaces.
- * @return
- */
- private void validateRequiredProvidedMatch(
- List<ProvidedInterface> aProvided, List<RequiredInterface> aRequired) {
-
- for (Component component : _components) {
- initializeProvidersForRequiredInterfaces(aProvided, component, true);
- }
+ doStartOptionalDryRun(null, true);
}
private void validateRequiredInterfaces(List<RequiredInterface> aRequired) {
@Override
protected Scope doStart(Scope aExternalScope) {
+ return doStartOptionalDryRun(aExternalScope, false);
+ }
+
+ private Scope doStartOptionalDryRun(Scope aExternalScope, boolean aDryRun) {
LOG.info("Starting '" + getQualifiedName() + "'");
Scope scope = new DefaultScope(getProvidedInterfaces(), aExternalScope);
for (Component component : _components) {
try {
initializeProvidersForRequiredInterfaces(allProvided,
- component, false);
+ component, aDryRun);
// Start the service.
- Object runtime = component.start(scope);
- scope.addRuntime(component, runtime);
- started.add(component);
+ if (!aDryRun) {
+ Object runtime = component.start(scope);
+ scope.addRuntime(component, runtime);
+ started.add(component);
+ }
// add all provided services
ProvidedInterface[] provided = component
// components
for (int i = aStarted.size() - 1; i >= 0; i--) {
try {
- aStarted.get(i).stop(aScope);
+ Component component = aStarted.get(i);
+ aStarted.get(i).stop(aScope.getRuntime(component));
} catch (Throwable t) {
LOG.error(getQualifiedName() + ": error stopping "
+ aStarted.get(i).getQualifiedName());