Package org.hyperledger.fabric.sdk
Class NetworkConfig
- java.lang.Object
 - 
- org.hyperledger.fabric.sdk.NetworkConfig
 
 
- 
public class NetworkConfig extends java.lang.ObjectHolds details of network and channel configurations typically loaded from an external config file.
Also contains convenience methods for utilizing the config details, including the mainHFClient.getChannel(String)method 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNetworkConfig.CAInfoHolds the details of a Certificate Authoritystatic classNetworkConfig.OrgInfoHolds details of an Organizationstatic classNetworkConfig.UserInfoHolds details of a User 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NetworkConfigfromJsonFile(java.io.File configFile)Creates a new NetworkConfig instance configured with details supplied in a JSON file.static NetworkConfigfromJsonObject(javax.json.JsonObject jsonConfig)Creates a new NetworkConfig instance configured with details supplied in a JSON objectstatic NetworkConfigfromJsonStream(java.io.InputStream configStream)Creates a new NetworkConfig instance configured with details supplied in JSON formatstatic NetworkConfigfromYamlFile(java.io.File configFile)Creates a new NetworkConfig instance configured with details supplied in a YAML file.static NetworkConfigfromYamlStream(java.io.InputStream configStream)Creates a new NetworkConfig instance configured with details supplied in YAML formatjava.util.Set<java.lang.String>getChannelNames()Get the channel names found.NetworkConfig.OrgInfogetClientOrganization()java.util.Collection<java.lang.String>getEventHubNames()Names of EventHubs foundjava.util.PropertiesgetEventHubsProperties(java.lang.String name)Get properties for a specific eventhub.java.util.Collection<java.lang.String>getOrdererNames()Names of Orderers foundjava.util.PropertiesgetOrdererProperties(java.lang.String name)Get properties for a specific Orderer.NetworkConfig.OrgInfogetOrganizationInfo(java.lang.String orgName)java.util.Collection<NetworkConfig.OrgInfo>getOrganizationInfos()NetworkConfig.UserInfogetPeerAdmin()Returns the admin user associated with the client organizationNetworkConfig.UserInfogetPeerAdmin(java.lang.String orgName)Returns the admin user associated with the specified organizationjava.util.Collection<java.lang.String>getPeerNames()Names of Peers foundjava.util.PropertiesgetPeerProperties(java.lang.String name)Get properties for a specific peer.voidsetEventHubProperties(java.lang.String name, java.util.Properties properties)Set a specific eventhub's properties.voidsetOrdererProperties(java.lang.String name, java.util.Properties properties)Set a specific orderer's properties.voidsetPeerProperties(java.lang.String name, java.util.Properties properties)Set a specific peer's properties. 
 - 
 
- 
- 
Method Detail
- 
getPeerNames
public java.util.Collection<java.lang.String> getPeerNames()
Names of Peers found- Returns:
 - Collection of peer names found.
 
 
- 
getOrdererNames
public java.util.Collection<java.lang.String> getOrdererNames()
Names of Orderers found- Returns:
 - Collection of peer names found.
 
 
- 
getEventHubNames
public java.util.Collection<java.lang.String> getEventHubNames()
Names of EventHubs found- Returns:
 - Collection of eventhubs names found.
 
 
- 
getPeerProperties
public java.util.Properties getPeerProperties(java.lang.String name) throws InvalidArgumentExceptionGet properties for a specific peer.- Parameters:
 name- Name of peer to get the properties for.- Returns:
 - The peer's properties.
 - Throws:
 InvalidArgumentException
 
- 
getOrdererProperties
public java.util.Properties getOrdererProperties(java.lang.String name) throws InvalidArgumentExceptionGet properties for a specific Orderer.- Parameters:
 name- Name of orderer to get the properties for.- Returns:
 - The orderer's properties.
 - Throws:
 InvalidArgumentException
 
- 
getEventHubsProperties
public java.util.Properties getEventHubsProperties(java.lang.String name) throws InvalidArgumentExceptionGet properties for a specific eventhub.- Parameters:
 name- Name of eventhub to get the properties for.- Returns:
 - The eventhubs's properties.
 - Throws:
 InvalidArgumentException
 
- 
setPeerProperties
public void setPeerProperties(java.lang.String name, java.util.Properties properties) throws InvalidArgumentExceptionSet a specific peer's properties.- Parameters:
 name- The name of the peer's property to set.properties- The properties to set.- Throws:
 InvalidArgumentException
 
- 
setOrdererProperties
public void setOrdererProperties(java.lang.String name, java.util.Properties properties) throws InvalidArgumentExceptionSet a specific orderer's properties.- Parameters:
 name- The name of the orderer's property to set.properties- The properties to set.- Throws:
 InvalidArgumentException
 
- 
setEventHubProperties
public void setEventHubProperties(java.lang.String name, java.util.Properties properties) throws InvalidArgumentExceptionSet a specific eventhub's properties.- Parameters:
 name- The name of the eventhub's property to set.properties- The properties to set.- Throws:
 InvalidArgumentException
 
- 
fromYamlFile
public static NetworkConfig fromYamlFile(java.io.File configFile) throws InvalidArgumentException, java.io.IOException, NetworkConfigurationException
Creates a new NetworkConfig instance configured with details supplied in a YAML file.- Parameters:
 configFile- The file containing the network configuration- Returns:
 - A new NetworkConfig instance
 - Throws:
 InvalidArgumentExceptionjava.io.IOExceptionNetworkConfigurationException
 
- 
fromJsonFile
public static NetworkConfig fromJsonFile(java.io.File configFile) throws InvalidArgumentException, java.io.IOException, NetworkConfigurationException
Creates a new NetworkConfig instance configured with details supplied in a JSON file.- Parameters:
 configFile- The file containing the network configuration- Returns:
 - A new NetworkConfig instance
 - Throws:
 InvalidArgumentExceptionjava.io.IOExceptionNetworkConfigurationException
 
- 
fromYamlStream
public static NetworkConfig fromYamlStream(java.io.InputStream configStream) throws InvalidArgumentException, NetworkConfigurationException
Creates a new NetworkConfig instance configured with details supplied in YAML format- Parameters:
 configStream- A stream opened on a YAML document containing network configuration details- Returns:
 - A new NetworkConfig instance
 - Throws:
 InvalidArgumentExceptionNetworkConfigurationException
 
- 
fromJsonStream
public static NetworkConfig fromJsonStream(java.io.InputStream configStream) throws InvalidArgumentException, NetworkConfigurationException
Creates a new NetworkConfig instance configured with details supplied in JSON format- Parameters:
 configStream- A stream opened on a JSON document containing network configuration details- Returns:
 - A new NetworkConfig instance
 - Throws:
 InvalidArgumentExceptionNetworkConfigurationException
 
- 
fromJsonObject
public static NetworkConfig fromJsonObject(javax.json.JsonObject jsonConfig) throws InvalidArgumentException, NetworkConfigurationException
Creates a new NetworkConfig instance configured with details supplied in a JSON object- Parameters:
 jsonConfig- JSON object containing network configuration details- Returns:
 - A new NetworkConfig instance
 - Throws:
 InvalidArgumentExceptionNetworkConfigurationException
 
- 
getClientOrganization
public NetworkConfig.OrgInfo getClientOrganization()
 
- 
getOrganizationInfo
public NetworkConfig.OrgInfo getOrganizationInfo(java.lang.String orgName)
 
- 
getOrganizationInfos
public java.util.Collection<NetworkConfig.OrgInfo> getOrganizationInfos()
 
- 
getPeerAdmin
public NetworkConfig.UserInfo getPeerAdmin() throws NetworkConfigurationException
Returns the admin user associated with the client organization- Returns:
 - The admin user details
 - Throws:
 NetworkConfigurationException
 
- 
getPeerAdmin
public NetworkConfig.UserInfo getPeerAdmin(java.lang.String orgName) throws NetworkConfigurationException
Returns the admin user associated with the specified organization- Parameters:
 orgName- The name of the organization- Returns:
 - The admin user details
 - Throws:
 NetworkConfigurationException
 
- 
getChannelNames
public java.util.Set<java.lang.String> getChannelNames()
Get the channel names found.- Returns:
 - A set of the channel names found in the configuration file or empty set if none found.
 
 
 - 
 
 -