// Path: src/main/java/crate/elasticsearch/action/import_/ImportContext.java
// public class ImportContext {
// 
//     private String nodePath;
//     private boolean compression;
//     private String directory;
//     private Pattern file_pattern;
//     private boolean mappings = false;
//     private boolean settings = false;
// 
//     public ImportContext(String nodePath) {
//         this.nodePath = nodePath;
//     }
// 
//     public boolean compression() {
//         return compression;
//     }
// 
//     public void compression(boolean compression) {
//         this.compression = compression;
//     }
// 
//     public String directory() {
//         return directory;
//     }
// 
//     public void directory(String directory) {
//         File file = new File(directory);
//         if (!file.isAbsolute() && nodePath != null) {
//             file = new File(nodePath, directory);
//             directory = file.getAbsolutePath();
//         }
//         this.directory = directory;
//     }
// 
//     public Pattern file_pattern() {
//         return file_pattern;
//     }
// 
//     public void file_pattern(Pattern file_pattern) {
//         this.file_pattern = file_pattern;
//     }
// 
//     public boolean mappings() {
//         return mappings;
//     }
// 
//     public void mappings(boolean mappings) {
//         this.mappings = mappings;
//     }
// 
//     public boolean settings() {
//         return settings;
//     }
// 
//     public void settings(boolean settings) {
//         this.settings = settings;
//     }
// }
// 
// Path: src/main/java/crate/elasticsearch/action/import_/parser/ImportParseException.java
// public class ImportParseException extends ElasticSearchException {
// 
//     private static final long serialVersionUID = 910205724931139923L;
// 
//     public ImportParseException(ImportContext context, String msg) {
//         super("Parse Failure [" + msg + "]");
//     }
// 
//     public ImportParseException(ImportContext context, String msg, Throwable cause) {
//         super("Parse Failure [" + msg + "]", cause);
//     }
// }


import crate.elasticsearch.action.dump.parser.DumpParser;
import crate.elasticsearch.action.import_.ImportContext;
import crate.elasticsearch.action.import_.parser.DirectoryParseElement;
import crate.elasticsearch.action.import_.parser.IImportParser;
import crate.elasticsearch.action.import_.parser.ImportParseElement;
import crate.elasticsearch.action.import_.parser.ImportParseException;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.collect.ImmutableMap;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
package crate.elasticsearch.action.restore.parser;



public class RestoreParser implements IImportParser {

    private final ImmutableMap<String, ImportParseElement> elementParsers;

    public static final String FILE_PATTERN = ".*_.*_.*\\.json\\.gz";

    public RestoreParser() {
        Map<String, ImportParseElement> elementParsers = new HashMap<String, ImportParseElement>();
        elementParsers.put("directory", new DirectoryParseElement());
        this.elementParsers = ImmutableMap.copyOf(elementParsers);
    }

    /**
     * Main method of this class to parse given payload of _restore action
     *
     * @param context
     * @param source
     * @throws org.elasticsearch.search.SearchParseException
     */
// Path: src/main/java/crate/elasticsearch/action/import_/ImportContext.java
// public class ImportContext {
// 
//     private String nodePath;
//     private boolean compression;
//     private String directory;
//     private Pattern file_pattern;
//     private boolean mappings = false;
//     private boolean settings = false;
// 
//     public ImportContext(String nodePath) {
//         this.nodePath = nodePath;
//     }
// 
//     public boolean compression() {
//         return compression;
//     }
// 
//     public void compression(boolean compression) {
//         this.compression = compression;
//     }
// 
//     public String directory() {
//         return directory;
//     }
// 
//     public void directory(String directory) {
//         File file = new File(directory);
//         if (!file.isAbsolute() && nodePath != null) {
//             file = new File(nodePath, directory);
//             directory = file.getAbsolutePath();
//         }
//         this.directory = directory;
//     }
// 
//     public Pattern file_pattern() {
//         return file_pattern;
//     }
// 
//     public void file_pattern(Pattern file_pattern) {
//         this.file_pattern = file_pattern;
//     }
// 
//     public boolean mappings() {
//         return mappings;
//     }
// 
//     public void mappings(boolean mappings) {
//         this.mappings = mappings;
//     }
// 
//     public boolean settings() {
//         return settings;
//     }
// 
//     public void settings(boolean settings) {
//         this.settings = settings;
//     }
// }
// 
// Path: src/main/java/crate/elasticsearch/action/import_/parser/ImportParseException.java
// public class ImportParseException extends ElasticSearchException {
// 
//     private static final long serialVersionUID = 910205724931139923L;
// 
//     public ImportParseException(ImportContext context, String msg) {
//         super("Parse Failure [" + msg + "]");
//     }
// 
//     public ImportParseException(ImportContext context, String msg, Throwable cause) {
//         super("Parse Failure [" + msg + "]", cause);
//     }
// }


// Path: src/main/java/crate/elasticsearch/action/restore/parser/RestoreParser.java
import crate.elasticsearch.action.dump.parser.DumpParser;
import crate.elasticsearch.action.import_.ImportContext;
import crate.elasticsearch.action.import_.parser.DirectoryParseElement;
import crate.elasticsearch.action.import_.parser.IImportParser;
import crate.elasticsearch.action.import_.parser.ImportParseElement;
import crate.elasticsearch.action.import_.parser.ImportParseException;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.collect.ImmutableMap;
import org.elasticsearch.common.xcontent.XContentFactory;
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;

package crate.elasticsearch.action.restore.parser;



public class RestoreParser implements IImportParser {

    private final ImmutableMap<String, ImportParseElement> elementParsers;

    public static final String FILE_PATTERN = ".*_.*_.*\\.json\\.gz";

    public RestoreParser() {
        Map<String, ImportParseElement> elementParsers = new HashMap<String, ImportParseElement>();
        elementParsers.put("directory", new DirectoryParseElement());
        this.elementParsers = ImmutableMap.copyOf(elementParsers);
    }

    /**
     * Main method of this class to parse given payload of _restore action
     *
     * @param context
     * @param source
     * @throws org.elasticsearch.search.SearchParseException
     */
    public void parseSource(ImportContext context, BytesReference source) throws ImportParseException {