Search in sources :

Example 1 with TransferManagerBuilder

use of org.syncany.plugins.transfer.TransferManagerFactory.TransferManagerBuilder in project syncany by syncany.

the class AbstractInitOperation method createTransferManagerFromNullConfig.

protected TransferManager createTransferManagerFromNullConfig(ConfigTO configTo) throws IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException, StorageException {
    // Init plugin and transfer manager
    TransferPlugin plugin = Plugins.get(configTo.getTransferSettings().getType(), TransferPlugin.class);
    TransferSettings transferSettings = configTo.getTransferSettings();
    transferSettings.setUserInteractionListener(listener);
    TransferManager transferManager = plugin.createTransferManager(transferSettings, config);
    // constructor is not visible and config seems to be null at this point, hence we cannot use the build method here
    Constructor<TransferManagerBuilder> tmbConstructor = TransferManagerBuilder.class.getDeclaredConstructor(Config.class, TransferManager.class);
    tmbConstructor.setAccessible(true);
    return tmbConstructor.newInstance(config, transferManager).withFeature(ReadAfterWriteConsistent.class).asDefault();
}
Also used : TransferPlugin(org.syncany.plugins.transfer.TransferPlugin) TransferManager(org.syncany.plugins.transfer.TransferManager) ReadAfterWriteConsistent(org.syncany.plugins.transfer.features.ReadAfterWriteConsistent) TransferSettings(org.syncany.plugins.transfer.TransferSettings) TransferManagerBuilder(org.syncany.plugins.transfer.TransferManagerFactory.TransferManagerBuilder)

Aggregations

TransferManager (org.syncany.plugins.transfer.TransferManager)1 TransferManagerBuilder (org.syncany.plugins.transfer.TransferManagerFactory.TransferManagerBuilder)1 TransferPlugin (org.syncany.plugins.transfer.TransferPlugin)1 TransferSettings (org.syncany.plugins.transfer.TransferSettings)1 ReadAfterWriteConsistent (org.syncany.plugins.transfer.features.ReadAfterWriteConsistent)1