Refactor RDE import stuff into its own rde.imports package

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=141566236
This commit is contained in:
mcilwain 2016-12-09 09:38:17 -08:00 committed by Ben McIlwain
parent 58b7babc2b
commit a56a0677ba
66 changed files with 97 additions and 9248 deletions

View file

@ -468,8 +468,8 @@ public final class ConfigModule {
/**
* Returns the Google Cloud Storage bucket for importing escrow files.
*
* @see google.registry.rde.RdeContactImportAction
* @see google.registry.rde.RdeHostImportAction
* @see google.registry.rde.imports.RdeContactImportAction
* @see google.registry.rde.imports.RdeHostImportAction
*/
@Provides
@Config("rdeImportBucket")

View file

@ -32,6 +32,7 @@ java_library(
"//java/google/registry/monitoring/metrics",
"//java/google/registry/monitoring/whitebox",
"//java/google/registry/rde",
"//java/google/registry/rde/imports",
"//java/google/registry/request",
"//java/google/registry/request:modules",
"//java/google/registry/tmch",

View file

@ -50,13 +50,14 @@ import google.registry.monitoring.whitebox.MetricsExportAction;
import google.registry.monitoring.whitebox.VerifyEntityIntegrityAction;
import google.registry.monitoring.whitebox.WhiteboxModule;
import google.registry.rde.BrdaCopyAction;
import google.registry.rde.RdeContactImportAction;
import google.registry.rde.RdeHostImportAction;
import google.registry.rde.RdeModule;
import google.registry.rde.RdeReportAction;
import google.registry.rde.RdeReporter;
import google.registry.rde.RdeStagingAction;
import google.registry.rde.RdeUploadAction;
import google.registry.rde.imports.RdeContactImportAction;
import google.registry.rde.imports.RdeHostImportAction;
import google.registry.rde.imports.RdeImportsModule;
import google.registry.request.RequestComponentBuilder;
import google.registry.request.RequestModule;
import google.registry.request.RequestScope;
@ -82,6 +83,7 @@ import google.registry.tmch.TmchSmdrlAction;
ExportRequestModule.class,
MapreduceModule.class,
RdeModule.class,
RdeImportsModule.class,
RequestModule.class,
SheetModule.class,
TmchModule.class,

View file

@ -28,7 +28,7 @@ import org.joda.time.DateTime;
/**
* Dagger module for RDE package.
*
* @see "google.registry.module.backend.BackendComponent"
* @see "google.registry.module.backend.BackendRequestComponent"
*/
@Module
public final class RdeModule {
@ -53,10 +53,4 @@ public final class RdeModule {
static Queue provideQueueRdeReport() {
return getQueue("rde-report");
}
@Provides
@Parameter(PATH)
static String providePath(HttpServletRequest req) {
return RequestParameters.extractRequiredParameter(req, PATH);
}
}

View file

@ -0,0 +1,37 @@
package(
default_visibility = ["//visibility:public"],
)
licenses(["notice"]) # Apache 2.0
java_library(
name = "imports",
srcs = glob(["*.java"]),
deps = [
"//java/com/google/common/annotations",
"//java/com/google/common/base",
"//java/com/google/common/collect",
"//java/com/google/common/html",
"//java/com/google/common/io",
"//java/com/google/common/math",
"//java/com/google/common/net",
"//java/google/registry/config",
"//java/google/registry/gcs",
"//java/google/registry/mapreduce",
"//java/google/registry/model",
"//java/google/registry/request",
"//java/google/registry/util",
"//java/google/registry/xjc",
"//third_party/java/appengine:appengine-api",
"//third_party/java/appengine_gcs_client",
"//third_party/java/appengine_mapreduce2:appengine_mapreduce",
"//third_party/java/auto:auto_factory",
"//third_party/java/auto:auto_value",
"//third_party/java/dagger",
"//third_party/java/joda_time",
"//third_party/java/jsr305_annotations",
"//third_party/java/jsr330_inject",
"//third_party/java/objectify:objectify-v4_1",
"//third_party/java/servlet/servlet_api",
],
)

View file

@ -12,11 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import static google.registry.mapreduce.MapreduceRunner.PARAM_MAP_SHARDS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.rde.RdeModule.PATH;
import static google.registry.util.PipelineUtils.createJobPath;
import com.google.appengine.tools.cloudstorage.GcsService;
@ -58,7 +57,7 @@ public class RdeContactImportAction implements Runnable {
MapreduceRunner mrRunner,
Response response,
@Config("rdeImportBucket") String importBucketName,
@Parameter(PATH) String importFileName,
@Parameter("path") String importFileName,
@Parameter(PARAM_MAP_SHARDS) Optional<Integer> mapShards) {
this.mrRunner = mrRunner;
this.response = response;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import static com.google.common.math.IntMath.divide;
import static java.math.RoundingMode.CEILING;
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableList;
import google.registry.config.ConfigModule;
import google.registry.gcs.GcsUtils;
import google.registry.model.contact.ContactResource;
import google.registry.rde.RdeParser.RdeHeader;
import google.registry.rde.imports.RdeParser.RdeHeader;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.appengine.tools.cloudstorage.GcsService;

View file

@ -12,11 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import static google.registry.mapreduce.MapreduceRunner.PARAM_MAP_SHARDS;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.rde.RdeModule.PATH;
import static google.registry.util.PipelineUtils.createJobPath;
import com.google.appengine.tools.cloudstorage.GcsService;
@ -58,7 +57,7 @@ public class RdeHostImportAction implements Runnable {
MapreduceRunner mrRunner,
Response response,
@Config("rdeImportBucket") String importBucketName,
@Parameter(PATH) String importFileName,
@Parameter("path") String importFileName,
@Parameter(PARAM_MAP_SHARDS) Optional<Integer> mapShards) {
this.mrRunner = mrRunner;
this.response = response;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import static com.google.common.base.Preconditions.checkArgument;
@ -27,7 +27,7 @@ import com.google.common.collect.ImmutableList;
import google.registry.config.ConfigModule;
import google.registry.gcs.GcsUtils;
import google.registry.model.host.HostResource;
import google.registry.rde.RdeParser.RdeHeader;
import google.registry.rde.imports.RdeParser.RdeHeader;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.appengine.tools.cloudstorage.GcsService;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;

View file

@ -0,0 +1,36 @@
// Copyright 2016 The Nomulus Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde.imports;
import dagger.Module;
import dagger.Provides;
import google.registry.request.Parameter;
import google.registry.request.RequestParameters;
import javax.servlet.http.HttpServletRequest;
/**
* Dagger module for RDE imports package.
*
* @see "google.registry.module.backend.BackendRequestComponent"
*/
@Module
public final class RdeImportsModule {
@Provides
@Parameter("path")
static String providePath(HttpServletRequest req) {
return RequestParameters.extractRequiredParameter(req, "path");
}
}

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import static com.google.common.base.Preconditions.checkArgument;
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import com.google.common.base.Joiner;
import google.registry.model.EppResource;

View file

@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package google.registry.rde;
package google.registry.rde.imports;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;