@Override public void start() { try { String keystorePath = console.getLine("Enter keystore path"); String secDatPath = console.getLine("Enter secure data path"); Licence licence = licenceCreator(); String licencePath = console.getLine("Enter path to save licence"); licenceEncryptionService.encryptAndSign(licence, keystorePath, secDatPath, licencePath); System.out.println(SUCCESS_MESSAGE); } catch (Exception e) { System.err.println(GENERAL_ERROR_MESSAGE + e); } }
public static void main(String... args) { String guiString = System.getProperty("gui", Boolean.TRUE.toString()); boolean gui = Boolean.parseBoolean(guiString); if (gui) { ApplicationFrame.main(args); } else { ConsoleApplication.main(args); } }
private String propertiesCreator() { StringBuilder stringBuilder = new StringBuilder(); System.out.println("Enter in line one property with given scheme: KEY=VALUE."); System.out.println("When finish enter 'q'\n"); String propertyLine = StringUtils.EMPTY; while (!"q".equals(propertyLine)) { stringBuilder.append(propertyLine).append("\n"); propertyLine = console.getLine("Enter KEY=VALUE or 'q'"); } return stringBuilder.toString(); }
private Licence licenceCreator() { licenceBuilder .withLicenceUID(console.getLine("Enter licence UID")) .withCustomerID(console.getLine("Enter customer ID")) .withCustomerName(console.getLine("Enter customer name")) .withCustomerAddress(console.getLine("Enter customer address")) .withCustomerPhone(console.getLine("Enter customer phone")) .withProductName(console.getLine("Enter product name")) .withProductVersion(console.getLine("Enter product version")) .withStartOfValid(console.getLine("Licence valid from (YYYY-MM-DD hh:mm:ss)")) .withEndOfValid(console.getLine("Licence valid to (YYYY-MM-DD hh:mm:ss)")) .withProperties(propertiesCreator()); return licenceBuilder.build(); }