import javax.sql.DataSource;
-public class Application extends AbstractSubSystem {
- private static final ServiceDescriptor[] REQUIRED =
- new ServiceDescriptor[] {
- new DefaultServiceDescriptor(DataSource.class),
- new DefaultServiceDescriptor(Integer.class)
+import org.wamblee.test.EventTracker;
+
+public class Application extends AbstractComponent {
+ private static RequiredInterface[] required() {
+ return
+ new RequiredInterface[] {
+ new DefaultRequiredInterface("datasource", DataSource.class),
+ new DefaultRequiredInterface("integer", Integer.class)
};
+ }
+
+ private EventTracker<String> _tracker;
public Application() {
- super("application", new ServiceDescriptor[0], REQUIRED);
+ super("application", new ProvidedInterface[0], required());
+ }
+
+ public Application(EventTracker<String> aTracker) {
+ this();
+ _tracker = aTracker;
}
@Override
- protected void doStart(String aContext, ServiceRegistry aRegistry, Service[] aRequiredServices) {
- // Empty, no services provided externally.
+ protected void doStart(String aContext) {
+ track("start." + getName());
}
@Override
- protected void doStop(String aContext) {
- // Empty.
+ protected void doStop() {
+ track("stop." + getName());
+ }
+
+ private void track(String aString) {
+ if ( _tracker == null ) {
+ return;
+ }
+ _tracker.eventOccurred(aString);
}
}