|
|
@ -25,12 +25,14 @@ public class MirrorRemoteAdmin { |
|
|
|
private final I18nService i18nService; |
|
|
|
private final I18nService i18nService; |
|
|
|
|
|
|
|
|
|
|
|
Client client; |
|
|
|
Client client; |
|
|
|
|
|
|
|
|
|
|
|
public MirrorRemoteAdmin(PasswordEncryptor passwordEncryptor, I18nService i18nService) { |
|
|
|
public MirrorRemoteAdmin(PasswordEncryptor passwordEncryptor, I18nService i18nService) { |
|
|
|
this.passwordEncryptor = passwordEncryptor; |
|
|
|
this.passwordEncryptor = passwordEncryptor; |
|
|
|
this.i18nService = i18nService; |
|
|
|
this.i18nService = i18nService; |
|
|
|
ClientConfig config = new DefaultClientConfig(); |
|
|
|
ClientConfig config = new DefaultClientConfig(); |
|
|
|
this.client = Client.create(config); |
|
|
|
this.client = Client.create(config); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void addToStream(StringOutputHandler outputHandler, String text) { |
|
|
|
private void addToStream(StringOutputHandler outputHandler, String text) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
outputHandler.process(new ByteArrayInputStream(text.getBytes())); |
|
|
|
outputHandler.process(new ByteArrayInputStream(text.getBytes())); |
|
|
@ -38,6 +40,7 @@ public class MirrorRemoteAdmin { |
|
|
|
log.error("Failed to process response: " + e.getMessage()); |
|
|
|
log.error("Failed to process response: " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void delete(MirrorSettings settings, Repository repository, StringOutputHandler outputHandler) { |
|
|
|
public void delete(MirrorSettings settings, Repository repository, StringOutputHandler outputHandler) { |
|
|
|
String plainPassword = passwordEncryptor.decrypt(settings.password); |
|
|
|
String plainPassword = passwordEncryptor.decrypt(settings.password); |
|
|
|
String plainPrivateToken = passwordEncryptor.decrypt(settings.privateToken); |
|
|
|
String plainPrivateToken = passwordEncryptor.decrypt(settings.privateToken); |
|
|
@ -54,6 +57,7 @@ public class MirrorRemoteAdmin { |
|
|
|
throw e; |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void delete(MirrorSettings settings, Repository repository, PasswordHandler passwordHandler) { |
|
|
|
private void delete(MirrorSettings settings, Repository repository, PasswordHandler passwordHandler) { |
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
ObjectMapper mapper = new ObjectMapper(); |
|
|
|
String plainPrivateToken = passwordEncryptor.decrypt(settings.privateToken); |
|
|
|
String plainPrivateToken = passwordEncryptor.decrypt(settings.privateToken); |
|
|
|