import java.util.HashMap;
import java.util.Map;
+import org.oransc.policyagent.exceptions.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public Services() {
}
+ public synchronized Service getService(String name) throws ServiceException {
+ Service s = services.get(name);
+ if (s == null) {
+ throw new ServiceException("Could not find service: " + name);
+ }
+ return s;
+ }
+
+ public synchronized Service get(String name) {
+ return services.get(name);
+ }
+
+ public synchronized void put(Service service) {
+ logger.debug("Put service: " + service.getName());
+ services.put(service.getName(), service);
+ }
+
+ public synchronized Iterable<Service> getAll() {
+ return services.values();
+ }
+
+ public synchronized void remove(String name) {
+ services.remove(name);
+ }
+
+ public synchronized int size() {
+ return services.size();
+ }
+
}