Package convex.cli
Class Main
java.lang.Object
convex.cli.Main
- All Implemented Interfaces:
Runnable
Convex CLI implementation
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addKeyPairToStore(AKeyPair keyPair)
Adds key pair to store.connectAsPeer(int peerIndex)
connectToSessionPeer(String hostname, int port, Address address, AKeyPair keyPair)
generateKeyPairs(int count)
Generate key pairs and add to store.Gets the current key storegetKeystore(boolean create)
Gets the current key store.Gets the keystore file name currently used for the CLIGet the currently configured password for the keystore.protected boolean
Loads the specified config file.loadKeyFromStore(String publicKey)
Loads a keypair from configured keystorestatic void
Java main(...) entry point when run as a Java application.int
mainExecute(String[] args)
Command line execution entry point.void
printError(Result result)
void
void
void
printRecord(RecordOutput output)
void
printResult(Result result)
void
run()
void
setPassword(String password)
Sets the currently defined keystore password
-
Constructor Details
-
Main
public Main()
-
-
Method Details
-
run
public void run() -
main
Java main(...) entry point when run as a Java application. Exits JVM process with specified exit code -
mainExecute
Command line execution entry point. Can be run from Java code without terminating the JVM.- Parameters:
args
- Command line arguments- Returns:
- Process result value
-
loadConfig
protected boolean loadConfig()Loads the specified config file.- Returns:
- true if config file correctly loaded, false otherwise (e.g. if it does not exist)
-
getSessionFilename
-
getPassword
Get the currently configured password for the keystore. Will emit warning and default to blank password if not provided- Returns:
- Password string
-
setPassword
Sets the currently defined keystore password- Parameters:
password
- Password to use
-
getKeyStoreFilename
Gets the keystore file name currently used for the CLI- Returns:
- File name, or null if not specified
-
getEtchStoreFilename
-
getKeystore
Gets the current key store- Returns:
- KeyStore instance, or null if it does not exist
-
getKeystore
Gets the current key store.- Parameters:
create
- Flag to indicate if keystore should be created- Returns:
- KeyStore instance
-
loadKeyFromStore
Loads a keypair from configured keystore- Parameters:
publicKey
- String identifying the public key. May be a prefix- Returns:
- Keypair instance, or null if not found
-
connectToSessionPeer
-
connectAsPeer
- Throws:
Error
-
generateKeyPairs
Generate key pairs and add to store. Does not save store!- Parameters:
count
- Number of key pairs to generate- Returns:
- List of key pairs
-
addKeyPairToStore
Adds key pair to store. Does not save keystore!- Parameters:
keyPair
- Keypair to add
-
println
-
printError
-
printResult
-
printRecord
-
println
-