mirror of
https://github.com/google/nomulus
synced 2026-01-06 13:36:48 +00:00
Dagger, meet Flows. Flows, meet Dagger.
Daggerizes all of the EPP flows. This does not change anything yet about the flows themselves, just how they are invoked, but after this CL it's safe to @Inject things into flow classes. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=125382478
This commit is contained in:
@@ -27,12 +27,17 @@ import google.registry.model.host.HostResource;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that checks whether a host can be provisioned.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceCheckFlow.TooManyResourceChecksException}
|
||||
*/
|
||||
public class HostCheckFlow extends ResourceCheckFlow<HostResource, Check> {
|
||||
|
||||
@Inject HostCheckFlow() {}
|
||||
|
||||
@Override
|
||||
protected CheckData getCheckData() {
|
||||
Set<String> existingIds = checkResourcesExist(resourceClass, targetIds, now);
|
||||
|
||||
@@ -40,6 +40,8 @@ import google.registry.model.host.HostResource.Builder;
|
||||
import google.registry.model.ofy.ObjectifyService;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that creates a new host resource.
|
||||
*
|
||||
@@ -67,6 +69,8 @@ public class HostCreateFlow extends ResourceCreateFlow<HostResource, Builder, Cr
|
||||
*/
|
||||
private Optional<Ref<DomainResource>> superordinateDomain;
|
||||
|
||||
@Inject HostCreateFlow() {}
|
||||
|
||||
@Override
|
||||
protected void initResourceCreateOrMutateFlow() throws EppException {
|
||||
superordinateDomain = Optional.fromNullable(lookupSuperordinateDomain(
|
||||
|
||||
@@ -36,6 +36,8 @@ import google.registry.model.host.HostResource;
|
||||
import google.registry.model.host.HostResource.Builder;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that deletes a host resource.
|
||||
*
|
||||
@@ -49,6 +51,8 @@ public class HostDeleteFlow extends ResourceAsyncDeleteFlow<HostResource, Builde
|
||||
/** In {@link #isLinkedForFailfast}, check this (arbitrary) number of resources from the query. */
|
||||
private static final int FAILFAST_CHECK_COUNT = 5;
|
||||
|
||||
@Inject HostDeleteFlow() {}
|
||||
|
||||
@Override
|
||||
protected boolean isLinkedForFailfast(final Ref<HostResource> ref) {
|
||||
// Query for the first few linked domains, and if found, actually load them. The query is
|
||||
|
||||
@@ -18,9 +18,13 @@ import google.registry.flows.ResourceInfoFlow;
|
||||
import google.registry.model.host.HostCommand;
|
||||
import google.registry.model.host.HostResource;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that reads a host.
|
||||
*
|
||||
* @error {@link google.registry.flows.ResourceQueryFlow.ResourceToQueryDoesNotExistException}
|
||||
*/
|
||||
public class HostInfoFlow extends ResourceInfoFlow<HostResource, HostCommand.Info> {}
|
||||
public class HostInfoFlow extends ResourceInfoFlow<HostResource, HostCommand.Info> {
|
||||
@Inject HostInfoFlow() {}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ import org.joda.time.Duration;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* An EPP flow that updates a host resource.
|
||||
*
|
||||
@@ -72,6 +74,8 @@ public class HostUpdateFlow extends ResourceUpdateFlow<HostResource, Builder, Up
|
||||
private String newHostName;
|
||||
private boolean isHostRename;
|
||||
|
||||
@Inject HostUpdateFlow() {}
|
||||
|
||||
@Override
|
||||
protected void initResourceCreateOrMutateFlow() throws EppException {
|
||||
String suppliedNewHostName = command.getInnerChange().getFullyQualifiedHostName();
|
||||
|
||||
Reference in New Issue
Block a user