Esempio n. 1
0
  public void setup() throws FileNotFoundException, IllegalAccessException {
    installResultManager.printWelcome();

    System.out.println(
        "Path to config files of Syncope CLI client will be: "
            + InstallConfigFileTemplate.dirPath());

    if (!FileSystemUtils.exists(InstallConfigFileTemplate.dirPath())) {
      throw new FileNotFoundException(
          "Directory: " + InstallConfigFileTemplate.dirPath() + " does not exists!");
    }

    if (!FileSystemUtils.canWrite(InstallConfigFileTemplate.dirPath())) {
      throw new IllegalAccessException(
          "Permission denied on " + InstallConfigFileTemplate.dirPath());
    }
    System.out.println("- File system permission checked");
    System.out.println("");

    try (Scanner scanIn = new Scanner(System.in)) {
      System.out.print("Syncope server schema [http/https]: ");
      String syncopeServerSchemaFromSystemIn = scanIn.nextLine();
      boolean schemaFound = false;
      while (!schemaFound) {
        if (("http".equalsIgnoreCase(syncopeServerSchemaFromSystemIn))
            || ("https".equalsIgnoreCase(syncopeServerSchemaFromSystemIn))) {
          syncopeServerSchema = syncopeServerSchemaFromSystemIn;
          schemaFound = true;
        } else {
          System.out.println("Please use one of below values: ");
          System.out.println("   - http");
          System.out.println("   - https");
          syncopeServerSchemaFromSystemIn = scanIn.nextLine();
        }
      }

      System.out.print("Syncope server hostname [e.g. " + syncopeServerHostname + "]: ");
      String syncopeServerHostnameFromSystemIn = scanIn.nextLine();
      boolean syncopeServerHostnameFound = false;
      while (!syncopeServerHostnameFound) {
        if (StringUtils.isNotBlank(syncopeServerHostnameFromSystemIn)) {
          syncopeServerHostname = syncopeServerHostnameFromSystemIn;
          syncopeServerHostnameFound = true;
        } else {
          System.out.print("Syncope server hostname [e.g. " + syncopeServerHostname + "]: ");
          syncopeServerHostnameFromSystemIn = scanIn.nextLine();
        }
      }

      System.out.print("Syncope server port [e.g. " + syncopeServerPort + "]: ");
      String syncopeServerPortFromSystemIn = scanIn.nextLine();
      boolean syncopeServerPortFound = false;
      while (!syncopeServerPortFound) {
        if (StringUtils.isNotBlank(syncopeServerPortFromSystemIn)) {
          syncopeServerPort = syncopeServerPortFromSystemIn;
          syncopeServerPortFound = true;
        } else if (!StringUtils.isNumeric(syncopeServerPortFromSystemIn)) {
          System.err.println(syncopeServerPortFromSystemIn + " is not a numeric string, try again");
          syncopeServerPortFromSystemIn = scanIn.nextLine();
        } else {
          System.out.print("Syncope server port [e.g. " + syncopeServerPort + "]: ");
          syncopeServerPortFromSystemIn = scanIn.nextLine();
        }
      }

      System.out.print("Syncope server rest context [e.g. " + syncopeServerRestContext + "]: ");
      String syncopeServerRestContextFromSystemIn = scanIn.nextLine();
      boolean syncopeServerRestContextFound = false;
      while (!syncopeServerRestContextFound) {
        if (StringUtils.isNotBlank(syncopeServerRestContextFromSystemIn)) {
          syncopeServerRestContext = syncopeServerRestContextFromSystemIn;
          syncopeServerRestContextFound = true;
        } else {
          System.out.print("Syncope server port [e.g. " + syncopeServerRestContext + "]: ");
          syncopeServerRestContextFromSystemIn = scanIn.nextLine();
        }
      }

      System.out.print("Syncope admin user: "******"Syncope admin user: "******"Syncope admin password: "******"Syncope admin user: "******"Error installing CLI", ex);
      installResultManager.manageProcessingException(ex);
    } catch (final Exception e) {
      LOG.error("Error installing CLI", e);
      installResultManager.manageException(e);
    }
  }
Esempio n. 2
0
 public static boolean isActivitiEnabledForAnyObjects(final SyncopeService syncopeService) {
   return syncopeService.platform().getAnyObjectWorkflowAdapter().contains("Activiti");
 }