+package org.wamblee.system;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+public class DefaultServiceRegistry implements ServiceRegistry {
+
+ private int _count;
+ private Map<String, Service> _services;
+
+ public DefaultServiceRegistry() {
+ _count = 0;
+ _services = new HashMap<String, Service>();
+ }
+
+ @Override
+ public synchronized Service register(ServiceDescriptor aDescriptor,
+ Object aService) {
+ _count++;
+ String id = "" + _count;
+ Service svc = new DefaultService(id, aDescriptor, aService);
+ _services.put(id, svc);
+ return svc;
+ }
+
+ @Override
+ public synchronized Service find(String id) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Service[] listAllServices() {
+ return new ArrayList<Service>(_services.values())
+ .toArray(new Service[0]);
+ }
+}