/** * newPeer create a new peer * * @param name * @param grpcURL to the peer's location * @return Peer * @throws InvalidArgumentException */ public Peer newPeer(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return Peer.createNewInstance(name, grpcURL, null); }
/** * Create a new event hub * * @param name Name of eventhup should match peer's name it's associated with. * @param grpcURL The http url location of the event hub * @return event hub * @throws InvalidArgumentException */ public EventHub newEventHub(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return newEventHub(name, grpcURL, null); }
/** * Create a new urlOrderer. * * @param name name of the orderer. * @param grpcURL url location of orderer grpc or grpcs protocol. * @return a new Orderer. * @throws InvalidArgumentException */ public Orderer newOrderer(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return newOrderer(name, grpcURL, null); }
clientCheck(); return EventHub.createNewInstance(name, grpcURL, executorService, properties);
clientCheck(); return Orderer.createNewInstance(name, grpcURL, properties);
clientCheck(); return Peer.createNewInstance(name, grpcURL, properties);
/** * Get signature for channel configuration * * @param channelConfiguration * @param signer * @return byte array with the signature * @throws InvalidArgumentException */ public byte[] getChannelConfigurationSignature(ChannelConfiguration channelConfiguration, User signer) throws InvalidArgumentException { clientCheck(); Channel systemChannel = Channel.newSystemChannel(this); return systemChannel.getChannelConfigurationSignature(channelConfiguration, signer); }
/** * Get signature for update channel configuration * * @param updateChannelConfiguration * @param signer * @return byte array with the signature * @throws InvalidArgumentException */ public byte[] getUpdateChannelConfigurationSignature(UpdateChannelConfiguration updateChannelConfiguration, User signer) throws InvalidArgumentException { clientCheck(); Channel systemChannel = Channel.newSystemChannel(this); return systemChannel.getUpdateChannelConfigurationSignature(updateChannelConfiguration, signer); }
/** * newChannel - already configured channel. * * @param name * @return a new channel. * @throws InvalidArgumentException */ public Channel newChannel(String name) throws InvalidArgumentException { clientCheck(); if (Utils.isNullOrEmpty(name)) { throw new InvalidArgumentException("Channel name can not be null or empty string."); } synchronized (channels) { if (channels.containsKey(name)) { throw new InvalidArgumentException(format("Channel by the name %s already exists", name)); } logger.trace("Creating channel :" + name); Channel newChannel = Channel.createNewInstance(name, this); channels.put(name, newChannel); return newChannel; } }
/** * Configures a channel based on information loaded from a Network Config file. * Note that it is up to the caller to initialize the returned channel. * * @param channelName The name of the channel to be configured * @param networkConfig The network configuration to use to configure the channel * @return The configured channel, or null if the channel is not defined in the configuration * @throws InvalidArgumentException */ public Channel loadChannelFromConfig(String channelName, NetworkConfig networkConfig) throws InvalidArgumentException, NetworkConfigurationException { clientCheck(); // Sanity checks if (channelName == null || channelName.isEmpty()) { throw new InvalidArgumentException("channelName must be specified"); } if (networkConfig == null) { throw new InvalidArgumentException("networkConfig must be specified"); } if (channels.containsKey(channelName)) { throw new InvalidArgumentException(format("Channel with name %s already exists", channelName)); } return networkConfig.loadChannel(this, channelName); }
/** * Create a new channel * * @param name The channel's name * @param orderer Orderer to create the channel with. * @param channelConfiguration Channel configuration data. * @param channelConfigurationSignatures byte arrays containing ConfigSignature's proto serialized. * See {@link Channel#getChannelConfigurationSignature} on how to create * @return a new channel. * @throws TransactionException * @throws InvalidArgumentException */ public Channel newChannel(String name, Orderer orderer, ChannelConfiguration channelConfiguration, byte[]... channelConfigurationSignatures) throws TransactionException, InvalidArgumentException { clientCheck(); if (Utils.isNullOrEmpty(name)) { throw new InvalidArgumentException("Channel name can not be null or empty string."); } synchronized (channels) { if (channels.containsKey(name)) { throw new InvalidArgumentException(format("Channel by the name %s already exits", name)); } logger.trace("Creating channel :" + name); Channel newChannel = Channel.createNewInstance(name, this, orderer, channelConfiguration, channelConfigurationSignatures); channels.put(name, newChannel); return newChannel; } }
/** * Send install chaincode request proposal to peers. * * @param installProposalRequest * @param peers Collection of peers to install on. * @return responses from peers. * @throws InvalidArgumentException * @throws ProposalException */ public Collection<ProposalResponse> sendInstallProposal(InstallProposalRequest installProposalRequest, Collection<Peer> peers) throws ProposalException, InvalidArgumentException { clientCheck(); installProposalRequest.setSubmitted(); Channel systemChannel = Channel.newSystemChannel(this); return systemChannel.sendInstallProposal(installProposalRequest, peers); }
/** * Query the peer for installed chaincode information * * @param peer The peer to query. * @return List of ChaincodeInfo on installed chaincode @see {@link ChaincodeInfo} * @throws InvalidArgumentException * @throws ProposalException */ public List<ChaincodeInfo> queryInstalledChaincodes(Peer peer) throws InvalidArgumentException, ProposalException { clientCheck(); if (null == peer) { throw new InvalidArgumentException("peer set to null"); } try { //Run this on a system channel. Channel systemChannel = Channel.newSystemChannel(this); return systemChannel.queryInstalledChaincodes(peer); } catch (ProposalException e) { logger.error(format("queryInstalledChaincodes for peer %s failed." + e.getMessage(), peer.getName()), e); throw e; } }
/** * Query the joined channels for peers * * @param peer the peer to query * @return A set of strings with the names of the channels the peer has joined. * @throws InvalidArgumentException * @throws ProposalException */ public Set<String> queryChannels(Peer peer) throws InvalidArgumentException, ProposalException { clientCheck(); if (null == peer) { throw new InvalidArgumentException("peer set to null"); } //Run this on a system channel. try { Channel systemChannel = Channel.newSystemChannel(this); return systemChannel.queryChannels(peer); } catch (InvalidArgumentException e) { throw e; //dont log } catch (ProposalException e) { logger.error(format("queryChannels for peer %s failed." + e.getMessage(), peer.getName()), e); throw e; } }
/** * newPeer create a new peer * * @param name * @param grpcURL to the peer's location * @return Peer * @throws InvalidArgumentException */ public Peer newPeer(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return Peer.createNewInstance(name, grpcURL, null); }
/** * Create a new event hub * * @param name Name of eventhup should match peer's name it's associated with. * @param grpcURL The http url location of the event hub * @return event hub * @throws InvalidArgumentException */ public EventHub newEventHub(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return newEventHub(name, grpcURL, null); }
/** * newPeer create a new peer * * @param name * @param grpcURL to the peer's location * @return Peer * @throws InvalidArgumentException */ public Peer newPeer(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return Peer.createNewInstance(name, grpcURL, null); }
/** * Create a new urlOrderer. * * @param name name of the orderer. * @param grpcURL url location of orderer grpc or grpcs protocol. * @return a new Orderer. * @throws InvalidArgumentException */ public Orderer newOrderer(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return newOrderer(name, grpcURL, null); }
/** * Create a new urlOrderer. * * @param name name of the orderer. * @param grpcURL url location of orderer grpc or grpcs protocol. * @return a new Orderer. * @throws InvalidArgumentException */ public Orderer newOrderer(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return newOrderer(name, grpcURL, null); }
/** * Create a new event hub * * @param name Name of eventhup should match peer's name it's associated with. * @param grpcURL The http url location of the event hub * @return event hub * @throws InvalidArgumentException */ public EventHub newEventHub(String name, String grpcURL) throws InvalidArgumentException { clientCheck(); return newEventHub(name, grpcURL, null); }