mirror of
https://github.com/google/nomulus.git
synced 2025-05-27 22:50:08 +02:00
Add mapper to import domains from RDE deposits
With some additional cleanup by Ben McIlwain. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=146695665
This commit is contained in:
parent
d6e6e8a49c
commit
a904f2c6ee
37 changed files with 2916 additions and 268 deletions
|
@ -21,8 +21,9 @@ import com.google.appengine.tools.cloudstorage.RetryParams;
|
|||
import com.google.appengine.tools.mapreduce.InputReader;
|
||||
import google.registry.config.RegistryConfig.ConfigModule;
|
||||
import google.registry.gcs.GcsUtils;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import google.registry.xjc.JaxbFragment;
|
||||
import google.registry.xjc.rdecontact.XjcRdeContactElement;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
|
@ -31,7 +32,8 @@ import javax.annotation.concurrent.NotThreadSafe;
|
|||
|
||||
/** Mapreduce {@link InputReader} for reading contacts from escrow files */
|
||||
@NotThreadSafe
|
||||
public class RdeContactReader extends InputReader<ContactResource> implements Serializable {
|
||||
public class RdeContactReader extends InputReader<JaxbFragment<XjcRdeContactElement>>
|
||||
implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3688793834175577691L;
|
||||
|
||||
|
@ -80,23 +82,26 @@ public class RdeContactReader extends InputReader<ContactResource> implements Se
|
|||
}
|
||||
|
||||
@Override
|
||||
public ContactResource next() throws IOException {
|
||||
public JaxbFragment<XjcRdeContactElement> next() throws IOException {
|
||||
if (count < maxResults) {
|
||||
if (parser == null) {
|
||||
parser = newParser();
|
||||
if (parser.isAtContact()) {
|
||||
count++;
|
||||
return XjcToContactResourceConverter.convertContact(parser.getContact());
|
||||
return readContact();
|
||||
}
|
||||
}
|
||||
if (parser.nextContact()) {
|
||||
count++;
|
||||
return XjcToContactResourceConverter.convertContact(parser.getContact());
|
||||
return readContact();
|
||||
}
|
||||
}
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
private JaxbFragment<XjcRdeContactElement> readContact() {
|
||||
count++;
|
||||
return JaxbFragment.create(new XjcRdeContactElement(parser.getContact()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endSlice() throws IOException {
|
||||
super.endSlice();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue