// Copyright 2017 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 static google.registry.flows.host.HostFlowUtils.lookupSuperordinateDomain; import static google.registry.mapreduce.MapreduceRunner.PARAM_MAP_SHARDS; import static google.registry.model.ofy.ObjectifyService.ofy; import static google.registry.util.PipelineUtils.createJobPath; import com.google.appengine.tools.mapreduce.Mapper; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.net.InternetDomainName; import com.googlecode.objectify.Key; import com.googlecode.objectify.VoidWork; import google.registry.config.RegistryConfig.Config; import google.registry.mapreduce.MapreduceRunner; import google.registry.model.domain.DomainResource; import google.registry.model.host.HostResource; import google.registry.request.Action; import google.registry.request.Parameter; import google.registry.request.Response; import google.registry.util.FormattingLogger; import google.registry.xjc.JaxbFragment; import google.registry.xjc.rdehost.XjcRdeHost; import google.registry.xjc.rdehost.XjcRdeHostElement; import javax.inject.Inject; import org.joda.time.DateTime; /** * A mapreduce that links hosts from an escrow file to their superordinate domains. * *
This mapreduce is run as the last step of the process of importing escrow files. For each host * in the escrow file, the corresponding {@link HostResource} record in Datastore is linked to its * superordinate {@link DomainResource} only if it is an in-zone host. This is necessary because all * hosts must exist before domains can be imported, due to references in host objects, and domains * must exist before hosts can be linked to their superordinate domains. * *
Specify the escrow file to import with the "path" parameter.
*/
@Action(path = "/_dr/task/linkRdeHosts")
public class RdeHostLinkAction implements Runnable {
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private final MapreduceRunner mrRunner;
private final Response response;
private final String importBucketName;
private final String importFileName;
private final Optional