private byte[] getPlaintextStorageXml() throws Exception { ByteArrayOutputStream plaintextByteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream plaintextOutputStream = new DataOutputStream(plaintextByteArrayOutputStream); plaintextOutputStream.writeInt(transferSettings.getType().getBytes().length); plaintextOutputStream.write(transferSettings.getType().getBytes()); GZIPOutputStream plaintextGzipOutputStream = new GZIPOutputStream(plaintextOutputStream); new Persister(new Format(0)).write(transferSettings, plaintextGzipOutputStream); plaintextGzipOutputStream.close(); return plaintextByteArrayOutputStream.toByteArray(); } }
private void initConnection(ConfigTO configTO) throws ConfigException { if (configTO.getTransferSettings() != null) { plugin = Plugins.get(configTO.getTransferSettings().getType(), TransferPlugin.class); if (plugin == null) { throw new ConfigException("Plugin not supported: " + configTO.getTransferSettings().getType()); } try { transferSettings = configTO.getTransferSettings(); } catch (Exception e) { throw new ConfigException("Cannot initialize storage: " + e.getMessage(), e); } } }
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(); } }
RepoTO repoTO = ConfigHelper.loadRepoTO(localDir, configTO); String pluginId = (configTO.getTransferSettings() != null) ? configTO.getTransferSettings().getType() : null; TransferPlugin plugin = Plugins.get(pluginId, TransferPlugin.class);
private TransferSettings askPluginSettings(TransferSettings settings, Map<String, String> knownPluginSettings) throws StorageException { if (isInteractive) { out.println(); out.println("Connection details for " + settings.getType() + " connection:");