mirror of
https://github.com/google/nomulus.git
synced 2025-07-23 19:20:44 +02:00
Use Dagger to @Inject DnsQueue everywhere that is feasible
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136062053
This commit is contained in:
parent
a13f6aded8
commit
6a738557fb
17 changed files with 47 additions and 15 deletions
|
@ -18,6 +18,7 @@ import dagger.Module;
|
|||
import dagger.Provides;
|
||||
import dagger.Subcomponent;
|
||||
import google.registry.config.ConfigModule;
|
||||
import google.registry.dns.DnsModule;
|
||||
import google.registry.flows.async.AsyncFlowsModule;
|
||||
import google.registry.flows.contact.ContactCheckFlow;
|
||||
import google.registry.flows.contact.ContactCreateFlow;
|
||||
|
@ -65,6 +66,7 @@ import google.registry.util.SystemSleeper.SystemSleeperModule;
|
|||
@Subcomponent(modules = {
|
||||
AsyncFlowsModule.class,
|
||||
ConfigModule.class,
|
||||
DnsModule.class,
|
||||
FlowModule.class,
|
||||
FlowComponent.FlowComponentModule.class,
|
||||
SystemSleeperModule.class})
|
||||
|
|
|
@ -33,6 +33,7 @@ import google.registry.model.eppoutput.CreateData.DomainCreateData;
|
|||
import google.registry.model.eppoutput.EppOutput;
|
||||
import google.registry.model.eppoutput.Result;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import javax.inject.Inject;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** An EPP flow that creates or allocates a new domain resource. */
|
||||
|
@ -41,6 +42,8 @@ public abstract class DomainCreateOrAllocateFlow
|
|||
|
||||
protected boolean isAnchorTenantViaExtension;
|
||||
|
||||
@Inject DnsQueue dnsQueue;
|
||||
|
||||
@Override
|
||||
protected final void initDomainCreateFlow() {
|
||||
isAnchorTenantViaExtension =
|
||||
|
@ -85,7 +88,7 @@ public abstract class DomainCreateOrAllocateFlow
|
|||
@Override
|
||||
protected final void enqueueTasks() {
|
||||
if (newResource.shouldPublishToDns()) {
|
||||
DnsQueue.create().addDomainRefreshTask(newResource.getFullyQualifiedDomainName());
|
||||
dnsQueue.addDomainRefreshTask(newResource.getFullyQualifiedDomainName());
|
||||
}
|
||||
enqueueLordnTaskIfNeeded();
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ public final class DomainDeleteFlow extends LoggedInFlow implements Transactiona
|
|||
@Inject @ClientId String clientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject HistoryEntry.Builder historyBuilder;
|
||||
@Inject DnsQueue dnsQueue;
|
||||
@Inject DomainDeleteFlow() {}
|
||||
|
||||
@Override
|
||||
|
@ -140,7 +141,7 @@ public final class DomainDeleteFlow extends LoggedInFlow implements Transactiona
|
|||
// If there's a pending transfer, the gaining client's autorenew billing
|
||||
// event and poll message will already have been deleted in
|
||||
// ResourceDeleteFlow since it's listed in serverApproveEntities.
|
||||
DnsQueue.create().addDomainRefreshTask(existingDomain.getFullyQualifiedDomainName());
|
||||
dnsQueue.addDomainRefreshTask(existingDomain.getFullyQualifiedDomainName());
|
||||
// Cancel any grace periods that were still active.
|
||||
for (GracePeriod gracePeriod : existingDomain.getGracePeriods()) {
|
||||
// No cancellation is written if the grace period was not for a billable event.
|
||||
|
|
|
@ -108,6 +108,7 @@ public final class DomainRestoreRequestFlow extends LoggedInFlow implements Tran
|
|||
@Inject @ClientId String clientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject HistoryEntry.Builder historyBuilder;
|
||||
@Inject DnsQueue dnsQueue;
|
||||
@Inject DomainRestoreRequestFlow() {}
|
||||
|
||||
@Override
|
||||
|
@ -157,7 +158,7 @@ public final class DomainRestoreRequestFlow extends LoggedInFlow implements Tran
|
|||
entitiesToSave.add(newDomain, historyEntry, autorenewEvent, autorenewPollMessage);
|
||||
ofy().save().entities(entitiesToSave.build());
|
||||
ofy().delete().key(existingDomain.getDeletePollMessage());
|
||||
DnsQueue.create().addDomainRefreshTask(existingDomain.getFullyQualifiedDomainName());
|
||||
dnsQueue.addDomainRefreshTask(existingDomain.getFullyQualifiedDomainName());
|
||||
return createOutput(SUCCESS, null, createResponseExtensions(restoreCost, renewCost, feeUpdate));
|
||||
}
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ public final class DomainUpdateFlow extends LoggedInFlow implements Transactiona
|
|||
@Inject @ClientId String clientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject HistoryEntry.Builder historyBuilder;
|
||||
@Inject DnsQueue dnsQueue;
|
||||
@Inject DomainUpdateFlow() {}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +160,7 @@ public final class DomainUpdateFlow extends LoggedInFlow implements Transactiona
|
|||
}
|
||||
}
|
||||
validateNewState(newDomain);
|
||||
DnsQueue.create().addDomainRefreshTask(targetId);
|
||||
dnsQueue.addDomainRefreshTask(targetId);
|
||||
handleExtraFlowLogic(existingDomain, historyEntry);
|
||||
ImmutableList.Builder<ImmutableObject> entitiesToSave = new ImmutableList.Builder<>();
|
||||
entitiesToSave.add(newDomain, historyEntry);
|
||||
|
|
|
@ -74,6 +74,7 @@ public final class HostCreateFlow extends LoggedInFlow implements TransactionalF
|
|||
@Inject @ClientId String clientId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject HistoryEntry.Builder historyBuilder;
|
||||
@Inject DnsQueue dnsQueue;
|
||||
@Inject HostCreateFlow() {}
|
||||
|
||||
@Override
|
||||
|
@ -126,7 +127,7 @@ public final class HostCreateFlow extends LoggedInFlow implements TransactionalF
|
|||
.build());
|
||||
// Only update DNS if this is a subordinate host. External hosts have no glue to write, so
|
||||
// they are only written as NS records from the referencing domain.
|
||||
DnsQueue.create().addHostRefreshTask(targetId);
|
||||
dnsQueue.addHostRefreshTask(targetId);
|
||||
}
|
||||
ofy().save().entities(entitiesToSave);
|
||||
return createOutput(SUCCESS, HostCreateData.create(targetId, now));
|
||||
|
|
|
@ -105,6 +105,7 @@ public final class HostUpdateFlow extends LoggedInFlow implements TransactionalF
|
|||
@Inject @TargetId String targetId;
|
||||
@Inject HistoryEntry.Builder historyBuilder;
|
||||
@Inject AsyncFlowEnqueuer asyncFlowEnqueuer;
|
||||
@Inject DnsQueue dnsQueue;
|
||||
@Inject HostUpdateFlow() {}
|
||||
|
||||
@Override
|
||||
|
@ -219,14 +220,14 @@ public final class HostUpdateFlow extends LoggedInFlow implements TransactionalF
|
|||
// Only update DNS for subordinate hosts. External hosts have no glue to write, so they
|
||||
// are only written as NS records from the referencing domain.
|
||||
if (existingResource.getSuperordinateDomain() != null) {
|
||||
DnsQueue.create().addHostRefreshTask(existingResource.getFullyQualifiedHostName());
|
||||
dnsQueue.addHostRefreshTask(existingResource.getFullyQualifiedHostName());
|
||||
}
|
||||
// In case of a rename, there are many updates we need to queue up.
|
||||
if (((Update) resourceCommand).getInnerChange().getFullyQualifiedHostName() != null) {
|
||||
// If the renamed host is also subordinate, then we must enqueue an update to write the new
|
||||
// glue.
|
||||
if (newResource.getSuperordinateDomain() != null) {
|
||||
DnsQueue.create().addHostRefreshTask(newResource.getFullyQualifiedHostName());
|
||||
dnsQueue.addHostRefreshTask(newResource.getFullyQualifiedHostName());
|
||||
}
|
||||
// We must also enqueue updates for all domains that use this host as their nameserver so
|
||||
// that their NS records can be updated to point at the new name.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue