From 59e9d77ecc6a6da6c13b5a90b1eb746bd6f7d4ba Mon Sep 17 00:00:00 2001 From: mcilwain Date: Wed, 18 May 2016 12:23:23 -0700 Subject: [PATCH] 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 --- java/google/registry/flows/FlowRegistry.java | 24 ++++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/java/google/registry/flows/FlowRegistry.java b/java/google/registry/flows/FlowRegistry.java index 350abd301..5eac4b01f 100644 --- a/java/google/registry/flows/FlowRegistry.java +++ b/java/google/registry/flows/FlowRegistry.java @@ -16,6 +16,7 @@ package google.registry.flows; 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.ImmutableSet; import com.google.common.collect.ImmutableTable; @@ -292,6 +293,18 @@ public class FlowRegistry { : null; }}; + private static final ImmutableList 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. */ public static Class getFlowClass(EppInput eppInput) throws EppException { // 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 // match multiple FlowProviders and so more specific matches are tried first. - for (FlowProvider flowProvider : new FlowProvider[] { - 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}) { + for (FlowProvider flowProvider : FLOW_PROVIDERS) { Class flowClass = flowProvider.get(eppInput); if (flowClass == UnimplementedFlow.class) { break; // We found it, but it's marked as not implemented.