001package jmri.jmrit.logixng.implementation;
002
003import java.util.*;
004
005import jmri.jmrit.logixng.FemaleSocketManager;
006import jmri.jmrit.logixng.FemaleSocketFactory;
007
008/**
009 *
010 * @author daniel
011 */
012public class DefaultFemaleSocketManager implements FemaleSocketManager {
013
014    private static final Map<String, SocketType> femaleSocketTypes = new HashMap<>();
015    
016    public DefaultFemaleSocketManager() {
017        for (FemaleSocketFactory actionFactory : ServiceLoader.load(FemaleSocketFactory.class)) {
018            femaleSocketTypes.put(actionFactory.getFemaleSocketType().getName(), actionFactory.getFemaleSocketType());
019        }
020    }
021    
022    @Override
023    public Map<String, SocketType> getSocketTypes() {
024        return Collections.unmodifiableMap(femaleSocketTypes);
025    }
026    
027    @Override
028    public SocketType getSocketTypeByType(String type) {
029        return femaleSocketTypes.get(type);
030    }
031    
032}