Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions core/src/main/java/google/registry/beam/rde/RdePipeline.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import static google.registry.beam.rde.RdePipeline.TupleTags.EXTERNAL_HOST_FRAGMENTS;
import static google.registry.beam.rde.RdePipeline.TupleTags.HOST_TO_PENDING_DEPOSIT;
import static google.registry.beam.rde.RdePipeline.TupleTags.PENDING_DEPOSIT;
import static google.registry.beam.rde.RdePipeline.TupleTags.REFERENCED_CONTACTS;
import static google.registry.beam.rde.RdePipeline.TupleTags.REFERENCED_HOSTS;
import static google.registry.beam.rde.RdePipeline.TupleTags.REVISION_ID;
import static google.registry.beam.rde.RdePipeline.TupleTags.SUPERORDINATE_DOMAINS;
Expand Down Expand Up @@ -131,9 +130,8 @@
*
* After the most recent (live) domain resources are loaded from the corresponding history objects,
* we marshall them to deposit fragments and emit the (pending deposit: deposit fragment) pairs for
* further processing. We also find all the contacts and hosts referenced by a given domain and emit
* pairs of (contact/host repo ID: pending deposit) for all RDE pending deposits for further
* processing.
* further processing. We also find all the hosts referenced by a given domain and emit pairs of
* (host repo ID: pending deposit) for all RDE pending deposits for further processing.
*
* <h3>{@link Host}</h3>
*
Expand Down Expand Up @@ -373,8 +371,8 @@ private <T extends HistoryEntry> EppResource loadResourceByHistoryEntryId(
* Remove unreferenced resources by joining the (repoId, pendingDeposit) pair with the (repoId,
* revisionId) on the repoId.
*
* <p>The (repoId, pendingDeposit) pairs denote resources (contact, host) that are referenced from
* a domain, that are to be included in the corresponding pending deposit.
* <p>The (repoId, pendingDeposit) pairs denote hosts that are referenced from a domain, that are
* to be included in the corresponding pending deposit.
*
* <p>The (repoId, revisionId) paris come from the most recent history entry query, which can be
* used to load the embedded resources themselves.
Expand Down Expand Up @@ -424,7 +422,7 @@ private PCollectionTuple processDomainHistories(PCollection<KV<String, Long>> do
Counter domainFragmentCounter = Metrics.counter("RDE", "DomainFragment");
Counter referencedHostCounter = Metrics.counter("RDE", "ReferencedHost");
return domainHistories.apply(
"Map DomainHistory to DepositFragment " + "and emit referenced Contact and Host",
"Map DomainHistory to DepositFragment and emit referenced Host",
ParDo.of(
new DoFn<KV<String, Long>, KV<PendingDeposit, DepositFragment>>() {
@ProcessElement
Expand Down Expand Up @@ -466,8 +464,7 @@ public void processElement(
});
}
})
.withOutputTags(
DOMAIN_FRAGMENTS, TupleTagList.of(REFERENCED_CONTACTS).and(REFERENCED_HOSTS)));
.withOutputTags(DOMAIN_FRAGMENTS, TupleTagList.of(REFERENCED_HOSTS)));
}

private PCollectionTuple processHostHistories(
Expand Down Expand Up @@ -628,9 +625,6 @@ protected abstract static class TupleTags {
protected static final TupleTag<KV<PendingDeposit, DepositFragment>> DOMAIN_FRAGMENTS =
new TupleTag<>() {};

protected static final TupleTag<KV<String, PendingDeposit>> REFERENCED_CONTACTS =
new TupleTag<>() {};

protected static final TupleTag<KV<String, PendingDeposit>> REFERENCED_HOSTS =
new TupleTag<>() {};

Expand Down
66 changes: 12 additions & 54 deletions core/src/main/java/google/registry/flows/FlowComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@
import dagger.Subcomponent;
import google.registry.batch.BatchModule;
import google.registry.dns.DnsModule;
import google.registry.flows.contact.ContactCheckFlow;
import google.registry.flows.contact.ContactCreateFlow;
import google.registry.flows.contact.ContactDeleteFlow;
import google.registry.flows.contact.ContactInfoFlow;
import google.registry.flows.contact.ContactTransferApproveFlow;
import google.registry.flows.contact.ContactTransferCancelFlow;
import google.registry.flows.contact.ContactTransferQueryFlow;
import google.registry.flows.contact.ContactTransferRejectFlow;
import google.registry.flows.contact.ContactTransferRequestFlow;
import google.registry.flows.contact.ContactUpdateFlow;
import google.registry.flows.custom.CustomLogicModule;
import google.registry.flows.domain.DomainCheckFlow;
import google.registry.flows.domain.DomainClaimsCheckFlow;
Expand All @@ -54,6 +44,8 @@
import google.registry.flows.session.LoginFlow;
import google.registry.flows.session.LogoutFlow;
import google.registry.model.eppcommon.Trid;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/** Dagger component for flow classes. */
@FlowScope
Expand All @@ -69,16 +61,6 @@ public interface FlowComponent {
FlowRunner flowRunner();

// Flows must be added here and in FlowComponentModule below.
ContactCheckFlow contactCheckFlow();
ContactCreateFlow contactCreateFlow();
ContactDeleteFlow contactDeleteFlow();
ContactInfoFlow contactInfoFlow();
ContactTransferApproveFlow contactTransferApproveFlow();
ContactTransferCancelFlow contactTransferCancelFlow();
ContactTransferQueryFlow contactTransferQueryFlow();
ContactTransferRejectFlow contactTransferRejectFlow();
ContactTransferRequestFlow contactTransferRequestFlow();
ContactUpdateFlow contactUpdateFlow();
DomainCheckFlow domainCheckFlow();
DomainClaimsCheckFlow domainClaimsCheckFlow();
DomainCreateFlow domainCreateFlow();
Expand Down Expand Up @@ -118,40 +100,16 @@ class FlowComponentModule {
// TODO(b/29874464): fix this in a cleaner way.
@Provides
static Flow provideFlow(FlowComponent flows, Class<? extends Flow> clazz) {
return clazz.equals(ContactCheckFlow.class) ? flows.contactCheckFlow()
: clazz.equals(ContactCreateFlow.class) ? flows.contactCreateFlow()
: clazz.equals(ContactDeleteFlow.class) ? flows.contactDeleteFlow()
: clazz.equals(ContactInfoFlow.class) ? flows.contactInfoFlow()
: clazz.equals(ContactTransferApproveFlow.class) ? flows.contactTransferApproveFlow()
: clazz.equals(ContactTransferCancelFlow.class) ? flows.contactTransferCancelFlow()
: clazz.equals(ContactTransferQueryFlow.class) ? flows.contactTransferQueryFlow()
: clazz.equals(ContactTransferRejectFlow.class) ? flows.contactTransferRejectFlow()
: clazz.equals(ContactTransferRequestFlow.class) ? flows.contactTransferRequestFlow()
: clazz.equals(ContactUpdateFlow.class) ? flows.contactUpdateFlow()
: clazz.equals(DomainCheckFlow.class) ? flows.domainCheckFlow()
: clazz.equals(DomainClaimsCheckFlow.class) ? flows.domainClaimsCheckFlow()
: clazz.equals(DomainCreateFlow.class) ? flows.domainCreateFlow()
: clazz.equals(DomainDeleteFlow.class) ? flows.domainDeleteFlow()
: clazz.equals(DomainInfoFlow.class) ? flows.domainInfoFlow()
: clazz.equals(DomainRenewFlow.class) ? flows.domainRenewFlow()
: clazz.equals(DomainRestoreRequestFlow.class) ? flows.domainRestoreRequestFlow()
: clazz.equals(DomainTransferApproveFlow.class) ? flows.domainTransferApproveFlow()
: clazz.equals(DomainTransferCancelFlow.class) ? flows.domainTransferCancelFlow()
: clazz.equals(DomainTransferQueryFlow.class) ? flows.domainTransferQueryFlow()
: clazz.equals(DomainTransferRejectFlow.class) ? flows.domainTransferRejectFlow()
: clazz.equals(DomainTransferRequestFlow.class) ? flows.domainTransferRequestFlow()
: clazz.equals(DomainUpdateFlow.class) ? flows.domainUpdateFlow()
: clazz.equals(HostCheckFlow.class) ? flows.hostCheckFlow()
: clazz.equals(HostCreateFlow.class) ? flows.hostCreateFlow()
: clazz.equals(HostDeleteFlow.class) ? flows.hostDeleteFlow()
: clazz.equals(HostInfoFlow.class) ? flows.hostInfoFlow()
: clazz.equals(HostUpdateFlow.class) ? flows.hostUpdateFlow()
: clazz.equals(PollAckFlow.class) ? flows.pollAckFlow()
: clazz.equals(PollRequestFlow.class) ? flows.pollRequestFlow()
: clazz.equals(HelloFlow.class) ? flows.helloFlow()
: clazz.equals(LoginFlow.class) ? flows.loginFlow()
: clazz.equals(LogoutFlow.class) ? flows.logoutFlow()
: null;
String simpleName = clazz.getSimpleName();
// The method name is the same as the class name but with the first character being lowercase
String methodName = Character.toLowerCase(simpleName.charAt(0)) + simpleName.substring(1);
try {
Method method = FlowComponent.class.getMethod(methodName);
method.setAccessible(true);
return (Flow) method.invoke(flows);
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading