Search in sources :

Example 1 with MspConfig

use of org.hyperledger.fabric.protos.msp.MspConfig in project fabric-sdk-java by hyperledger.

the class Channel method traverseConfigGroupsMSP.

private Map<String, MSP> traverseConfigGroupsMSP(String name, ConfigGroup configGroup, Map<String, MSP> msps) throws InvalidProtocolBufferException {
    ConfigValue mspv = configGroup.getValuesMap().get("MSP");
    if (null != mspv) {
        if (!msps.containsKey(name)) {
            MspConfig.MSPConfig mspConfig = MspConfig.MSPConfig.parseFrom(mspv.getValue());
            MspConfig.FabricMSPConfig fabricMSPConfig = MspConfig.FabricMSPConfig.parseFrom(mspConfig.getConfig());
            msps.put(name, new MSP(name, fabricMSPConfig));
        }
    }
    for (Map.Entry<String, ConfigGroup> gm : configGroup.getGroupsMap().entrySet()) {
        traverseConfigGroupsMSP(gm.getKey(), gm.getValue(), msps);
    }
    return msps;
}
Also used : ConfigValue(org.hyperledger.fabric.protos.common.Configtx.ConfigValue) MspConfig(org.hyperledger.fabric.protos.msp.MspConfig) ProtoUtils.getSignatureHeaderAsByteString(org.hyperledger.fabric.sdk.transaction.ProtoUtils.getSignatureHeaderAsByteString) ByteString(com.google.protobuf.ByteString) ConfigGroup(org.hyperledger.fabric.protos.common.Configtx.ConfigGroup) Map(java.util.Map) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap)

Aggregations

ByteString (com.google.protobuf.ByteString)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 ConfigGroup (org.hyperledger.fabric.protos.common.Configtx.ConfigGroup)1 ConfigValue (org.hyperledger.fabric.protos.common.Configtx.ConfigValue)1 MspConfig (org.hyperledger.fabric.protos.msp.MspConfig)1 ProtoUtils.getSignatureHeaderAsByteString (org.hyperledger.fabric.sdk.transaction.ProtoUtils.getSignatureHeaderAsByteString)1