Package org.syncany.config.to

Examples of org.syncany.config.to.DaemonConfigTO


   */
  public static boolean addToDaemonConfig(File localDir) throws ConfigException {
    File daemonConfigFile = new File(UserConfig.getUserConfigDir(), UserConfig.DAEMON_FILE);

    if (daemonConfigFile.exists()) {
      DaemonConfigTO daemonConfigTO = DaemonConfigTO.load(daemonConfigFile);
      String localDirPath = FileUtil.getCanonicalFile(localDir).getAbsolutePath();

      // Check if folder already exists
      boolean folderExists = false;

      for (FolderTO folderTO : daemonConfigTO.getFolders()) {
        if (localDirPath.equals(folderTO.getPath())) {
          folderExists = true;
          break;
        }
      }

      // Add to config if it's not already in there
      if (!folderExists) {
        logger.log(Level.INFO, "Adding folder to daemon config: " + localDirPath + ", and saving config at " + daemonConfigFile);

        daemonConfigTO.getFolders().add(new FolderTO(localDirPath));
        daemonConfigTO.save(daemonConfigFile);

        return true;
      }
      else {
        return false;
View Full Code Here


    defaultUserTO.setPassword(CipherUtil.createRandomAlphabeticString(12));

    ArrayList<UserTO> users = new ArrayList<>();
    users.add(defaultUserTO);

    DaemonConfigTO defaultDaemonConfigTO = new DaemonConfigTO();
    defaultDaemonConfigTO.setFolders(new ArrayList<>(folders));
    defaultDaemonConfigTO.setUsers(users);

    defaultDaemonConfigTO.save(configFile);

    return defaultDaemonConfigTO;
  }
View Full Code Here

    final TransferSettings testConnection = TestConfigUtil.createTestLocalConnection();   
    final TestClient clientA = new TestClient("ClientA", testConnection);
    int port = 58444;
   
    // Load config template
    DaemonConfigTO daemonConfig = TestDaemonUtil.loadDaemonConfig("daemonOneFolderNoWebServer.xml");
   
    // Set port to prevent conflicts with default daemons
    daemonConfig.getWebServer().setBindPort(port);
   
    // Dynamically insert paths
    daemonConfig.getFolders().get(0).setPath(clientA.getConfig().getLocalDir().getAbsolutePath());
   
    // Create access token (not needed in this test, but prevents errors in daemon)
    daemonConfig.setPortTO(TestDaemonUtil.createPortTO(port));
   
    // Register to event bus     
    LocalEventBus localEventBus = LocalEventBus.getInstance();
    localEventBus.register(this);
       
View Full Code Here

    final TestClient clientA = new TestClient("ClientA", testConnection);
    final TestClient clientB = new TestClient("ClientB", testConnection);
    int port = 58443;
   
    // Load config template
    DaemonConfigTO daemonConfig = TestDaemonUtil.loadDaemonConfig("daemonTwoFoldersNoWebServer.xml");
   
    // Set port to prevent conflicts with default daemons
    daemonConfig.getWebServer().setBindPort(port);
   
    // Dynamically insert paths
    daemonConfig.getFolders().get(0).setPath(clientA.getConfig().getLocalDir().getAbsolutePath());
    daemonConfig.getFolders().get(1).setPath(clientB.getConfig().getLocalDir().getAbsolutePath());
   
    // Create access token (not needed in this test, but prevents errors in daemon)
    daemonConfig.setPortTO(TestDaemonUtil.createPortTO(port));
     
    // Create watchServer
    WatchServer watchServer = new WatchServer();
   
    clientA.createNewFile("file-1");
View Full Code Here

TOP

Related Classes of org.syncany.config.to.DaemonConfigTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.