    001package com.hammurapi.common.concurrent;
    002
    003import java.util.HashMap;
    004import java.util.Map;
    005import java.util.concurrent.ExecutorService;
    006import java.util.concurrent.locks.ReadWriteLock;
    007import java.util.concurrent.locks.ReentrantReadWriteLock;
    008
    009import com.hammurapi.common.Context;
    010import com.hammurapi.convert.Converter;
    011
    012/**
    013 * Property set which uses in-memory collections and reentrant read-write lock
    014 * @author Pavel Vlasov
    015 *
    016 * @param <KP>
    017 * @param <KE>
    018 */
    019public abstract class LocalAbstractPropertySet<KP, KE> extends AbstractPropertySet<KP, KE> {
    020
    021        private Map<KE, Object> valueStore = new HashMap<KE, Object>();
    022        private Map<KE, AbstractPropertySet<KP, KE>> subSetStore = new HashMap<KE, AbstractPropertySet<KP,KE>>();
    023        private Map<KE, PropertySet<KP>> mounts = new HashMap<KE, PropertySet<KP>>();
    024
    025        protected LocalAbstractPropertySet(
    026                        ExecutorService executorService,
    027                        Converter converter,
    028//                      ClassLoader classLoader,
    029                        Context context,
    030                        PropertySet<KP>... shadows) {
    031                super(executorService, converter, /* classLoader,*/ context, shadows);
    032        }
    033
    034        @Override
    035        protected Map<KE, Object> getValueStore() {
    036                return valueStore;
    037        }
    038
    039        @Override
    040        protected Map<KE, AbstractPropertySet<KP, KE>> getSubSetStore() {
    041                return subSetStore;
    042        }
    043
    044        @Override
    045        protected Map<KE, PropertySet<KP>> getMounts() {
    046                return mounts;
    047        }
    048
    049}