import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import java.util.UUID;
public class DefaultScope implements Scope {
private List<Scope> _parents;
- private int _count;
private Map<String, Object> _properties;
private Map<String, Object> _runtimes;
private Map<String, ProvidedInterfaceImplementation> _provided;
public DefaultScope(ProvidedInterface[] aExternallyProvided,
List<Scope> aParent) {
_parents = new ArrayList<Scope>(aParent);
- _count = 0;
- _properties = new TreeMap<String, Object>();
- _runtimes = new TreeMap<String, Object>();
- _provided = new TreeMap<String, ProvidedInterfaceImplementation>();
+ _properties = new HashMap<String, Object>();
+ _runtimes = new HashMap<String, Object>();
+ _provided = new HashMap<String, ProvidedInterfaceImplementation>();
_externallyProvided = aExternallyProvided;
}
@Override
synchronized public void publishInterface(ProvidedInterface aInterface,
Object aImplementation) {
- String id = "" + _count++;
+ String id = UUID.randomUUID().toString();
_provided.put(id, new ProvidedInterfaceImplementation(aInterface,
aImplementation));
aInterface.setUniqueId(id);