1 package org.wamblee.system;
3 import javax.sql.DataSource;
5 import org.wamblee.test.EventTracker;
8 public class Environment extends AbstractComponent {
10 private static final ProvidedInterface[] provided() {
11 return new ProvidedInterface[] {
12 new DefaultProvidedInterface("datasource", DataSource.class),
13 new DefaultProvidedInterface("integer", Integer.class)
17 private EventTracker<String> _tracker;
19 public Environment() {
20 super("environment", provided(), new RequiredInterface[0]);
23 public Environment(EventTracker aTracker) {
29 protected void doStart(String aContext) {
30 addService(aContext, getProvidedServices()[0], new Integer(1));
31 addService(aContext, getProvidedServices()[1], new Integer(2));
32 track("start." + getName());
36 protected void doStop() {
37 track("stop." + getName());
40 private void track(String aString) {
41 if ( _tracker == null ) {
44 _tracker.eventOccurred(aString);