@@ -0,0 +1,1395 @@
+package org.jboss.weld.bootstrap.api.helpers;%0A%0Aimport java.util.Hashtable;%0Aimport java.util.Map;%0A%0Aimport org.jboss.weld.bootstrap.api.Singleton;%0Aimport org.jboss.weld.bootstrap.api.SingletonProvider;%0A%0A/**%0A *%0A * @author mathieuancelin%0A */%0Apublic class RegistrySingletonProvider extends SingletonProvider %7B%0A    public static final String STATIC_INSTANCE = %22STATIC_INSTANCE%22;%0A%0A    @Override%0A    public %3CT%3E Singleton%3CT%3E create(Class%3C? extends T%3E type) %7B%0A        return new RegistrySingleton%3CT%3E(type);%0A    %7D%0A%0A    private static class RegistrySingleton%3CT%3E implements Singleton%3CT%3E %7B%0A        // use Hashtable for concurrent access%0A        private final Map%3CString, T%3E store = new Hashtable%3CString, T%3E();%0A%0A        private final Class%3C? extends T%3E clazz;%0A%0A        public RegistrySingleton(Class%3C? extends T%3E clazz) %7B%0A            this.clazz = clazz;%0A        %7D%0A%0A        public T get(String id) %7B%0A            T instance = store.get(id);%0A            if (instance == null) %7B%0A                throw new IllegalStateException(%22Singleton not set for %22 + id + %22 =%3E %22 + store.keySet());%0A            %7D%0A            return instance;%0A        %7D%0A%0A        public void set(String id, T object) %7B%0A            store.put(id, object);%0A        %7D%0A%0A        public void clear(String id) %7B%0A            store.remove(id);%0A        %7D%0A%0A        public boolean isSet(String id) %7B%0A            return store.containsKey(id);%0A        %7D%0A    %7D%0A%7D%0A

Add a registry singleton provider