public void start ( String [ ] args ) { Options options = new Options ( ) ; options . addOption ( "a" , "peerAddress" , true , "Address of peer to connect to" ) ; options . addOption ( "s" , "securityEnabled" , false , "Present if security is enabled" ) ; options . addOption ( "i" , "id" , true , "Identity of chaincode" ) ; options . addOption ( "o" , "hostNameOverride" , true , "Hostname override for server certificate" ) ; try { CommandLine cl = new DefaultParser ( ) . parse ( options , args ) ; if ( cl . hasOption ( ' ' ) ) { host = cl . getOptionValue ( ' ' ) ; port = new Integer ( host . split ( ":" ) [ 1 ] ) ; host = host . split ( ":" ) [ 0 ] ; } if ( cl . hasOption ( ' ' ) ) { tlsEnabled = true ; logger . debug ( "TLS enabled" ) ; if ( cl . hasOption ( ' ' ) ) { hostOverrideAuthority = cl . getOptionValue ( ' ' ) ; logger . debug ( "server host override given " + hostOverrideAuthority ) ; } } if ( cl . hasOption ( ' ' ) ) { id = cl . getOptionValue ( ' ' ) ; } } catch ( ParseException e ) { logger . warn ( "cli parsing failed with exception" , e ) ; } Runnable chaincode = ( ) -> { logger . trace ( "chaincode started" ) ; ManagedChannel connection = newPeerClientConnection ( ) ; logger . trace ( "connection created" ) ; chatWithPeer ( connection ) ; logger . trace ( "chatWithPeer DONE" ) ; } ; new Thread ( chaincode ) . start ( ) ; }
Start entry point for chaincodes bootstrap .