Extract list of flow providers to a field

This is the first step toward being able to add more providers on a
per-TLD basis.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=122656117
This commit is contained in:
mcilwain 2016-05-18 12:23:23 -07:00 committed by Ben McIlwain
parent cca77709e1
commit 59e9d77ecc

View file

@ -16,6 +16,7 @@ package google.registry.flows;
import static google.registry.model.domain.launch.LaunchCreateExtension.CreateType.APPLICATION; import static google.registry.model.domain.launch.LaunchCreateExtension.CreateType.APPLICATION;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableTable; import com.google.common.collect.ImmutableTable;
@ -292,6 +293,18 @@ public class FlowRegistry {
: null; : null;
}}; }};
private static final ImmutableList<FlowProvider> FLOW_PROVIDERS =
ImmutableList.of(
HELLO_FLOW_PROVIDER,
SESSION_FLOW_PROVIDER,
POLL_FLOW_PROVIDER,
DOMAIN_RESTORE_FLOW_PROVIDER,
ALLOCATE_FLOW_PROVIDER,
APPLICATION_CRUD_FLOW_PROVIDER,
DOMAIN_CHECK_FLOW_PROVIDER,
RESOURCE_CRUD_FLOW_PROVIDER,
TRANSFER_FLOW_PROVIDER);
/** Return the appropriate flow to handle this EPP command. */ /** Return the appropriate flow to handle this EPP command. */
public static Class<? extends Flow> getFlowClass(EppInput eppInput) throws EppException { public static Class<? extends Flow> getFlowClass(EppInput eppInput) throws EppException {
// Do some sanity checking on the input; anything but Hello must have a command type. // Do some sanity checking on the input; anything but Hello must have a command type.
@ -301,16 +314,7 @@ public class FlowRegistry {
} }
// Try the FlowProviders until we find a match. The order matters because it's possible to // Try the FlowProviders until we find a match. The order matters because it's possible to
// match multiple FlowProviders and so more specific matches are tried first. // match multiple FlowProviders and so more specific matches are tried first.
for (FlowProvider flowProvider : new FlowProvider[] { for (FlowProvider flowProvider : FLOW_PROVIDERS) {
HELLO_FLOW_PROVIDER,
SESSION_FLOW_PROVIDER,
POLL_FLOW_PROVIDER,
DOMAIN_RESTORE_FLOW_PROVIDER,
ALLOCATE_FLOW_PROVIDER,
APPLICATION_CRUD_FLOW_PROVIDER,
DOMAIN_CHECK_FLOW_PROVIDER,
RESOURCE_CRUD_FLOW_PROVIDER,
TRANSFER_FLOW_PROVIDER}) {
Class<? extends Flow> flowClass = flowProvider.get(eppInput); Class<? extends Flow> flowClass = flowProvider.get(eppInput);
if (flowClass == UnimplementedFlow.class) { if (flowClass == UnimplementedFlow.class) {
break; // We found it, but it's marked as not implemented. break; // We found it, but it's marked as not implemented.