public class NetworkConfig extends Object
HFClient.getChannel(String)
methodModifier and Type | Class and Description |
---|---|
static class |
NetworkConfig.CAInfo
Holds the details of a Certificate Authority
|
static interface |
NetworkConfig.NetworkConfigAddOrdererHandler
Interface defining handler for adding orderers.
|
static interface |
NetworkConfig.NetworkConfigAddPeerHandler
Interface defining handler for adding peers.
|
static class |
NetworkConfig.OrgInfo
Holds details of an Organization
|
static class |
NetworkConfig.UserInfo
Holds details of a User
|
Modifier and Type | Method and Description |
---|---|
static NetworkConfig |
fromJsonFile(File configFile)
Creates a new NetworkConfig instance configured with details supplied in a JSON file.
|
static NetworkConfig |
fromJsonObject(javax.json.JsonObject jsonConfig)
Creates a new NetworkConfig instance configured with details supplied in a JSON object
|
static NetworkConfig |
fromJsonStream(InputStream configStream)
Creates a new NetworkConfig instance configured with details supplied in JSON format
|
static NetworkConfig |
fromYamlFile(File configFile)
Creates a new NetworkConfig instance configured with details supplied in a YAML file.
|
static NetworkConfig |
fromYamlStream(InputStream configStream)
Creates a new NetworkConfig instance configured with details supplied in YAML format
|
Set<String> |
getChannelNames()
Get the channel names found.
|
NetworkConfig.OrgInfo |
getClientOrganization() |
Collection<String> |
getOrdererNames()
Names of Orderers found
|
Properties |
getOrdererProperties(String name)
Get properties for a specific Orderer.
|
NetworkConfig.OrgInfo |
getOrganizationInfo(String orgName) |
NetworkConfig.UserInfo |
getPeerAdmin()
Returns the admin user associated with the client organization
|
NetworkConfig.UserInfo |
getPeerAdmin(String orgName)
Returns the admin user associated with the specified organization
|
Collection<String> |
getPeerNames()
Names of Peers found
|
Map<String,NetworkConfig.OrgInfo> |
getPeerOrgInfos(String peerName)
Find organizations for a peer.
|
Properties |
getPeerProperties(String name)
Get properties for a specific peer.
|
String |
getPeerUrl(String name)
Get URL for a specific peer.
|
void |
setOrdererProperties(String name,
Properties properties)
Set a specific orderer's properties.
|
void |
setPeerProperties(String name,
Properties properties)
Set a specific peer's properties.
|
public Collection<String> getPeerNames()
public Collection<String> getOrdererNames()
public Properties getPeerProperties(String name)
name
- Name of peer to get the properties for.public Properties getOrdererProperties(String name)
name
- Name of orderer to get the properties for.public void setPeerProperties(String name, Properties properties)
name
- The name of the peer's property to set.properties
- The properties to set.public void setOrdererProperties(String name, Properties properties)
name
- The name of the orderer's property to set.properties
- The properties to set.public String getPeerUrl(String name)
name
- Name of peer to get the URL for.public static NetworkConfig fromYamlFile(File configFile) throws IOException, NetworkConfigurationException
configFile
- The file containing the network configurationIOException
- if an error occurs reading the fileNetworkConfigurationException
- if the configuration is invalidpublic static NetworkConfig fromJsonFile(File configFile) throws IOException, NetworkConfigurationException
configFile
- The file containing the network configurationIOException
- if an error occurs reading the fileNetworkConfigurationException
- if the configuration is invalidpublic static NetworkConfig fromYamlStream(InputStream configStream) throws NetworkConfigurationException
configStream
- A stream opened on a YAML document containing network configuration detailsNetworkConfigurationException
- if the configuration is invalidpublic static NetworkConfig fromJsonStream(InputStream configStream) throws NetworkConfigurationException
configStream
- A stream opened on a JSON document containing network configuration detailsNetworkConfigurationException
- if the configuration is invalidpublic static NetworkConfig fromJsonObject(javax.json.JsonObject jsonConfig) throws NetworkConfigurationException
jsonConfig
- JSON object containing network configuration detailsNetworkConfigurationException
- if the configuration is invalidpublic NetworkConfig.OrgInfo getClientOrganization()
public NetworkConfig.OrgInfo getOrganizationInfo(String orgName)
public Map<String,NetworkConfig.OrgInfo> getPeerOrgInfos(String peerName)
peerName
- name of peerNetworkConfig.OrgInfo
that the peer belongs to.public NetworkConfig.UserInfo getPeerAdmin() throws NetworkConfigurationException
NetworkConfigurationException
- if the configuration is invalidpublic NetworkConfig.UserInfo getPeerAdmin(String orgName) throws NetworkConfigurationException
orgName
- The name of the organizationNetworkConfigurationException
- if the configuration is invalidCopyright © 2022. All rights reserved.