Now added support for ProvidedInterfaces in Container.
[utils] / system / general / src / main / java / org / wamblee / system / core / AbstractComponent.java
index 9608f4179d2aca1a07b4ed4ed81d96d6217d9113..6567e4e74067cf13f563e5e0f7f4ab6aa4cdc4be 100644 (file)
@@ -63,12 +63,12 @@ public abstract class AbstractComponent<Type> implements Component<Type> {
                this(aName, new ProvidedInterface[0], new RequiredInterface[0]);
        }
        
-       protected AbstractComponent addProvidedInterface(ProvidedInterface aProvided) { 
+       public AbstractComponent addProvidedInterface(ProvidedInterface aProvided) { 
                _provided.add(aProvided);
                return this; 
        }
        
-       protected AbstractComponent addRequiredInterface(RequiredInterface aRequired) { 
+       public AbstractComponent addRequiredInterface(RequiredInterface aRequired) { 
                _required.add(aRequired);
                return this;
        }
@@ -87,6 +87,7 @@ public abstract class AbstractComponent<Type> implements Component<Type> {
                }
        }
        
+       @Override
        public String getContext() {
                return _context;
        }
@@ -111,12 +112,13 @@ public abstract class AbstractComponent<Type> implements Component<Type> {
 
        @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);
@@ -163,7 +165,9 @@ public abstract class AbstractComponent<Type> implements Component<Type> {
 
        @Override
        public void stop(Type aRuntime) {
+           LOG.info("Stopping initiated '" + getQualifiedName() + "'");
                doStop(aRuntime);
+               LOG.info("Stopping completed '" + getQualifiedName() + "'");
        }
 
        protected abstract void doStop(Type aRuntime);