(no commit message)
[utils] / system / general / src / main / java / org / wamblee / system / AbstractComponent.java
index 074e3ab0fe408a3e111f569b7a77d1df76bf0c23..a9752d1f09e7104cee6af9c75685ca9ae7b53a75 100644 (file)
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2007 the original author or authors.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */ 
 package org.wamblee.system;
 
 import java.util.ArrayList;
@@ -68,6 +83,12 @@ public abstract class AbstractComponent implements Component {
                LOG.info("Initializing '" + aContext + "." + _name + "'");
                doStart(aContext + "." + getName());
                _status = Status.RUNNING;
+               if ( _running.size() != _provided.size()) { 
+                       List<ProvidedInterface> remaining = 
+                               new ArrayList<ProvidedInterface>(_provided);
+                       remaining.removeAll(_running);
+                       throw new SystemAssemblyException(aContext + "." + getName() + ": not all services were started, missing " + remaining);
+               }
        }
 
        /**