Refactor update snapshot view servlet into a Daggerized Action

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120224051
This commit is contained in:
mcilwain 2016-04-19 06:47:25 -07:00 committed by Justine Tunney
parent 4fbf613955
commit c5d09227c5
8 changed files with 68 additions and 121 deletions

View file

@ -17,9 +17,13 @@ package com.google.domain.registry.export;
import static com.google.domain.registry.export.BigqueryPollJobAction.CHAINED_TASK_QUEUE_HEADER;
import static com.google.domain.registry.export.BigqueryPollJobAction.JOB_ID_HEADER;
import static com.google.domain.registry.export.BigqueryPollJobAction.PROJECT_ID_HEADER;
import static com.google.domain.registry.export.UpdateSnapshotViewAction.SNAPSHOT_DATASET_ID_PARAM;
import static com.google.domain.registry.export.UpdateSnapshotViewAction.SNAPSHOT_KIND_PARAM;
import static com.google.domain.registry.export.UpdateSnapshotViewAction.SNAPSHOT_TABLE_ID_PARAM;
import static com.google.domain.registry.request.RequestParameters.extractRequiredHeader;
import com.google.domain.registry.request.Header;
import com.google.domain.registry.request.Parameter;
import dagger.Module;
import dagger.Provides;
@ -29,6 +33,25 @@ import javax.servlet.http.HttpServletRequest;
/** Dagger module for data export tasks. */
@Module
public final class ExportRequestModule {
@Provides
@Parameter(SNAPSHOT_DATASET_ID_PARAM)
static String provideDatasetId(HttpServletRequest req) {
return extractRequiredHeader(req, SNAPSHOT_DATASET_ID_PARAM);
}
@Provides
@Parameter(SNAPSHOT_TABLE_ID_PARAM)
static String provideTableId(HttpServletRequest req) {
return extractRequiredHeader(req, SNAPSHOT_TABLE_ID_PARAM);
}
@Provides
@Parameter(SNAPSHOT_KIND_PARAM)
static String provideKind(HttpServletRequest req) {
return extractRequiredHeader(req, SNAPSHOT_KIND_PARAM);
}
@Provides
@Header(CHAINED_TASK_QUEUE_HEADER)
static String provideChainedTaskQueue(HttpServletRequest req) {