Package org.syncany.config.to.RepoTO

Examples of org.syncany.config.to.RepoTO.TransformerTO


  public static List<TransformerTO> createTransformerTOs() {
    if (!cryptoEnabled) {
      return null;
    }
    else {
      TransformerTO gzipTransformerTO = new TransformerTO();
      gzipTransformerTO.setType(GzipTransformer.TYPE);

      Map<String, String> cipherTransformerSettings = new HashMap<String, String>();
      cipherTransformerSettings.put(CipherTransformer.PROPERTY_CIPHER_SPECS, "1,2");

      TransformerTO cipherTransformerTO = new TransformerTO();
      cipherTransformerTO.setType(CipherTransformer.TYPE);
      cipherTransformerTO.setSettings(cipherTransformerSettings);

      return Lists.newArrayList(gzipTransformerTO, cipherTransformerTO);
    }
  }
View Full Code Here


    else {
      ArrayList<TransformerTO> transformerTOs = new ArrayList<TransformerTO>(repoTO.getTransformers());
      Transformer lastTransformer = null;

      for (int i = transformerTOs.size() - 1; i >= 0; i--) {
        TransformerTO transformerTO = transformerTOs.get(i);
        Transformer transformer = Transformer.getInstance(transformerTO.getType());

        if (transformer == null) {
          throw new ConfigException("Cannot find transformer '" + transformerTO.getType() + "'");
        }

        if (transformer instanceof CipherTransformer) { // Dirty workaround
          transformerTO.getSettings().put(CipherTransformer.PROPERTY_MASTER_KEY, StringUtil.toHex(getMasterKey().getEncoded()));
          transformerTO.getSettings().put(CipherTransformer.PROPERTY_MASTER_KEY_SALT, StringUtil.toHex(getMasterKey().getSalt()));
        }

        transformer.init(transformerTO.getSettings());

        if (lastTransformer != null) {
          transformer.setNextTransformer(lastTransformer);
        }
View Full Code Here

    repoTO.setChunkerTO(TestConfigUtil.createFixedChunkerTO()); // <<< valid
    repoTO.setMultiChunker(TestConfigUtil.createZipMultiChunkerTO()); // <<< valid
    repoTO.setRepoId(new byte[] { 0x01, 0x02 }); // <<< valid
   
    // Set invalid transformer
    TransformerTO invalidTransformerTO = new TransformerTO();
    invalidTransformerTO.setType("invalid-typeXXX");
    invalidTransformerTO.setSettings(new HashMap<String, String>());   

    ArrayList<TransformerTO> transformers = new ArrayList<TransformerTO>();
    transformers.add(invalidTransformerTO);
   
    repoTO.setTransformers(transformers); // <<< INVALID !
View Full Code Here

    repoTO.setMultiChunker(TestConfigUtil.createZipMultiChunkerTO()); // <<< valid
    repoTO.setRepoId(new byte[] { 0x01, 0x02 }); // <<< valid
    configTO.setMasterKey(createDummyMasterKey()); // <<< valid
   
    // Set invalid transformer
    TransformerTO invalidTransformerTO = new TransformerTO();
    invalidTransformerTO.setType("cipher");
    invalidTransformerTO.setSettings(new HashMap<String, String>() {
      {
        put("cipherspecs", "1,2");
      }
    });
View Full Code Here

    repoTO.setMultiChunker(TestConfigUtil.createZipMultiChunkerTO()); // <<< valid
    repoTO.setRepoId(new byte[] { 0x01, 0x02 }); // <<< valid
    configTO.setMasterKey(createDummyMasterKey()); // <<< valid
   
    // Set invalid transformer
    TransformerTO invalidTransformerTO = new TransformerTO();
    invalidTransformerTO.setType("cipher");
    invalidTransformerTO.setSettings(new HashMap<String, String>() {
      {
        put("cipherspecs", "1,INVALIDXXXX"); // <<<< INVALID !
      }
    });
View Full Code Here

    if (gzipEnabled) {
      transformersTO.add(getGzipTransformerTO());
    }

    if (cipherSpecs.size() > 0) {
      TransformerTO cipherTransformerTO = getCipherTransformerTO(cipherSpecs);
      transformersTO.add(cipherTransformerTO);
    }

    return transformersTO;
  }
View Full Code Here

    return multichunkerTO;
  }

  protected TransformerTO getGzipTransformerTO() {
    TransformerTO gzipTransformerTO = new TransformerTO();
    gzipTransformerTO.setType(GzipTransformer.TYPE);

    return gzipTransformerTO;
  }
View Full Code Here

    Map<String, String> cipherTransformerSettings = new HashMap<String, String>();
    cipherTransformerSettings.put(CipherTransformer.PROPERTY_CIPHER_SPECS, cipherSuitesIdStr);
    // Note: Property 'password' is added dynamically by CommandLineClient

    TransformerTO cipherTransformerTO = new TransformerTO();
    cipherTransformerTO.setType(CipherTransformer.TYPE);
    cipherTransformerTO.setSettings(cipherTransformerSettings);

    return cipherTransformerTO;
  }
View Full Code Here

TOP

Related Classes of org.syncany.config.to.RepoTO.TransformerTO

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.