@Override
public final Type start(Scope aScope) {
- LOG.info("Initializing '" + getQualifiedName() + "'");
+ LOG.info("Initialization starting '" + getQualifiedName() + "'");
List<ProvidedInterface> oldRemaining = _remaining.get();
_remaining.set(new ArrayList<ProvidedInterface>(Arrays.asList(getProvidedInterfaces())));
try {
Type runtime = doStart(aScope);
checkNotStartedInterfaces();
+ LOG.info("Initialization finished '" + getQualifiedName() + "'");
return runtime;
} finally {
_remaining.set(oldRemaining);
Object aService, Scope aScope) {
LOG.info("Interface '" + getQualifiedName() + "."
+ aDescriptor.getName() + "' started.");
- _remaining.get().remove(aDescriptor);
+ if ( !_remaining.get().remove(aDescriptor) ) {
+ throw new SystemAssemblyException("Component '" + getQualifiedName() + "' started an unexpected interface '" +
+ aDescriptor + "' that was not registerd as a provided interface before");
+ }
aScope.publishInterface(aDescriptor, aService);
}
@Override
public void stop(Type aRuntime) {
- LOG.info("Stopping '" + getQualifiedName() + "'");
+ LOG.info("Stopping initiated '" + getQualifiedName() + "'");
doStop(aRuntime);
+ LOG.info("Stopping completed '" + getQualifiedName() + "'");
}
protected abstract void doStop(Type aRuntime);
public String toString() {
return getQualifiedName();
}
+
+ public ProvidedInterface findProvidedInterface(String aName) {
+ for (ProvidedInterface provided: getProvidedInterfaces()) {
+ if ( provided.getName().equals(aName)) {
+ return provided;
+ }
+ }
+ return null;
+ }
+
+ public RequiredInterface findRequiredInterface(String aName) {
+ for (RequiredInterface required: getRequiredInterfaces()) {
+ if ( required.getName().equals(aName)) {
+ return required;
+ }
+ }
+ return null;
+ }
}