mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Convert AppEngineConnection to use HttpTransport
Make AppEngineConnection use HttpTransport through HttpRequestFactory and create factory factories for localhost and HTTPOverRPC. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143680257
This commit is contained in:
parent
0cf62be403
commit
270734fd9b
8 changed files with 255 additions and 67 deletions
|
@ -49,7 +49,9 @@ final class RegistryCli {
|
|||
|
||||
// Do not make this final - compile-time constant inlining may interfere with JCommander.
|
||||
@ParametersDelegate
|
||||
private AppEngineConnection connection = new AppEngineConnection();
|
||||
private AppEngineConnectionFlags appEngineConnectionFlags =
|
||||
new AppEngineConnectionFlags();
|
||||
|
||||
|
||||
// Do not make this final - compile-time constant inlining may interfere with JCommander.
|
||||
@ParametersDelegate
|
||||
|
@ -115,13 +117,29 @@ final class RegistryCli {
|
|||
return;
|
||||
}
|
||||
loggingParams.configureLogging(); // Must be called after parameters are parsed.
|
||||
injectReflectively(RegistryToolComponent.class, DaggerRegistryToolComponent.create(), command);
|
||||
|
||||
// Decide which HTTP connection to use for App Engine
|
||||
HttpRequestFactoryComponent requestFactoryComponent;
|
||||
if (appEngineConnectionFlags.getServer().getHostText().equals("localhost")) {
|
||||
requestFactoryComponent = new LocalhostRequestFactoryComponent();
|
||||
} else {
|
||||
requestFactoryComponent = new BasicHttpRequestFactoryComponent();
|
||||
}
|
||||
|
||||
// Create the main component and use it to inject the command class.
|
||||
RegistryToolComponent component = DaggerRegistryToolComponent.builder()
|
||||
.httpRequestFactoryComponent(requestFactoryComponent)
|
||||
.appEngineConnectionFlagsModule(
|
||||
new AppEngineConnectionFlagsModule(appEngineConnectionFlags))
|
||||
.build();
|
||||
injectReflectively(RegistryToolComponent.class, component, command);
|
||||
|
||||
if (!(command instanceof RemoteApiCommand)) {
|
||||
command.run();
|
||||
return;
|
||||
}
|
||||
|
||||
AppEngineConnection connection = component.appEngineConnection();
|
||||
if (command instanceof ServerSideCommand) {
|
||||
((ServerSideCommand) command).setConnection(connection);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue