private NetworkConfig(JsonObject jsonConfig) throws InvalidArgumentException, NetworkConfigurationException { this.jsonConfig = jsonConfig; // Extract the main details String configName = getJsonValueAsString(jsonConfig.get("name")); if (configName == null || configName.isEmpty()) { throw new InvalidArgumentException("Network config must have a name"); } String configVersion = getJsonValueAsString(jsonConfig.get("version")); if (configVersion == null || configVersion.isEmpty()) { throw new InvalidArgumentException("Network config must have a version"); // TODO: Validate the version } // Preload and create all peers, orderers, etc createAllPeers(); createAllOrderers(); Map<String, JsonObject> foundCertificateAuthorities = findCertificateAuthorities(); //createAllCertificateAuthorities(); createAllOrganizations(foundCertificateAuthorities); // Validate the organization for this client JsonObject jsonClient = getJsonObject(jsonConfig, "client"); String orgName = jsonClient == null ? null : getJsonValueAsString(jsonClient.get("organization")); if (orgName == null || orgName.isEmpty()) { throw new InvalidArgumentException("A client organization must be specified"); } clientOrganization = getOrganizationInfo(orgName); if (clientOrganization == null) { throw new InvalidArgumentException("Client organization " + orgName + " is not defined"); } }
private NetworkConfig(JsonObject jsonConfig) throws InvalidArgumentException, NetworkConfigurationException { this.jsonConfig = jsonConfig; // Extract the main details String configName = getJsonValueAsString(jsonConfig.get("name")); if (configName == null || configName.isEmpty()) { throw new InvalidArgumentException("Network config must have a name"); } String configVersion = getJsonValueAsString(jsonConfig.get("version")); if (configVersion == null || configVersion.isEmpty()) { throw new InvalidArgumentException("Network config must have a version"); // TODO: Validate the version } // Preload and create all peers, orderers, etc createAllPeers(); createAllOrderers(); Map<String, JsonObject> foundCertificateAuthorities = findCertificateAuthorities(); //createAllCertificateAuthorities(); createAllOrganizations(foundCertificateAuthorities); // Validate the organization for this client JsonObject jsonClient = getJsonObject(jsonConfig, "client"); String orgName = jsonClient == null ? null : getJsonValueAsString(jsonClient.get("organization")); if (orgName == null || orgName.isEmpty()) { throw new InvalidArgumentException("A client organization must be specified"); } clientOrganization = getOrganizationInfo(orgName); if (clientOrganization == null) { throw new InvalidArgumentException("Client organization " + orgName + " is not defined"); } }
private NetworkConfig(JsonObject jsonConfig) throws InvalidArgumentException, NetworkConfigurationException { this.jsonConfig = jsonConfig; // Extract the main details String configName = getJsonValueAsString(jsonConfig.get("name")); if (configName == null || configName.isEmpty()) { throw new InvalidArgumentException("Network config must have a name"); } String configVersion = getJsonValueAsString(jsonConfig.get("version")); if (configVersion == null || configVersion.isEmpty()) { throw new InvalidArgumentException("Network config must have a version"); // TODO: Validate the version } // Preload and create all peers, orderers, etc createAllPeers(); createAllOrderers(); Map<String, JsonObject> foundCertificateAuthorities = findCertificateAuthorities(); //createAllCertificateAuthorities(); createAllOrganizations(foundCertificateAuthorities); // Validate the organization for this client JsonObject jsonClient = getJsonObject(jsonConfig, "client"); String orgName = jsonClient == null ? null : getJsonValueAsString(jsonClient.get("organization")); if (orgName == null || orgName.isEmpty()) { throw new InvalidArgumentException("A client organization must be specified"); } clientOrganization = getOrganizationInfo(orgName); if (clientOrganization == null) { throw new InvalidArgumentException("Client organization " + orgName + " is not defined"); } }