예제 #1
0
  @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);
    }
  }
예제 #2
0
 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);
   }
 }
예제 #3
0
  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();
  }
예제 #4
0
  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();
  }