Package convex.cli
Class Helpers
java.lang.Object
convex.cli.Helpers
Helpers
Helper functions for the CLI classes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
createPath
(File file) Create a path if necessary to a File object.static File
createTempFile
(String name, String ext) static File
createTempKeystore
(String name, String password) static String
expandTilde
(String path) Expand a path string with a '~'.static SessionItem
getSessionItem
(String sessionFilename) Return a random session hostname, by looking at the session file.static SessionItem
getSessionItem
(String sessionFilename, int index) Return an indexed session item, by looking at the session file.splitArrayParameter
(String... parameterValues) Split a parameter list by ','.
-
Constructor Details
-
Helpers
public Helpers()
-
-
Method Details
-
expandTilde
Expand a path string with a '~'. The tilde is expanded to the users home path.- Parameters:
path
- Path string to expand.- Returns:
- Expanded string if a tilde is present.
-
createPath
Create a path if necessary to a File object. This is used to provide a feature to add the default `.convex` folder if it does not exist.- Parameters:
file
- File object to see if the path part of the filename exists, if not then create it.
-
getSessionItem
Return a random session hostname, by looking at the session file. The session file has a list of local peers open. This helper will find a random peer in the collection and returns hostname.- Parameters:
sessionFilename
- Session filename to open and get the random port nummber.- Returns:
- A random hostname or null if none can be found
- Throws:
IOException
- If IO error occurs
-
getSessionItem
Return an indexed session item, by looking at the session file. The session file has a list of local peers open. This helper will find a random peer in the collection and returns session item.- Parameters:
sessionFilename
- Session filename to open and get the random port nummber.index
- The index of the peer in the session list or if -1 a random selection is made.- Returns:
- A random session item or null if none can be found
- Throws:
IOException
-
splitArrayParameter
Split a parameter list by ','. Handles internal separators (sublists in strings) Trims resulting Strings of whitespace- Parameters:
parameterValues
- Array of parameter values- Returns:
- List of trimmed Strings
-
createTempFile
-
createTempKeystore
-