<commit_before>/*
 * Copyright 2003-2012 MarkLogic Corporation
 *
 * 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 com.marklogic.contentpump;

import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.OutputFormat;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import com.marklogic.mapreduce.ContentOutputFormat;
import com.marklogic.mapreduce.ContentType;

/**
 * Enum of supported input type.
 * 
 * @author jchen
 *
 */
public enum InputType {
    DOCUMENTS {
        @Override
        public Class<? extends FileInputFormat> getInputFormatClass(
            ContentType contentType, boolean compressed) {
            if (compressed) {
                return CompressedDocumentInputFormat.class;
            } else {
                return CombineDocumentInputFormat.class;
            }
        }

        @Override
        public Class<? extends Mapper> getMapperClass(ContentType contentType) {
            return DocumentMapper.class;
          }

        @Override
        public Class<? extends OutputFormat> getOutputFormatClass(
            ContentType contentType) {
            // TODO Auto-generated method stub
            return ContentOutputFormat.class;
        }
    },
    AGGREGATES {
        @Override
        public Class<? extends FileInputFormat> getInputFormatClass(
                ContentType contentType, boolean compressed) {
            if (compressed) {
                return CompressedAggregateXMLInputFormat.class;
            } else {
                return AggregateXMLInputFormat.class;
            }
        }

        @Override
        public Class<? extends Mapper> getMapperClass(
                ContentType contentType) {
            return DocumentMapper.class;
        }

        @Override
        public Class<? extends OutputFormat> getOutputFormatClass(
            ContentType contentType) {
            // TODO Auto-generated method stub
            return null;
        }
    },   
    DELIMITED_TEXT {
        @Override
        public Class<? extends FileInputFormat> getInputFormatClass(
                ContentType contentType, boolean compressed) {
            if (compressed) {
                return CompressedDelimitedTextInputFormat.class;
            } else {
                return DelimitedTextInputFormat.class;
            }
        }

        @Override
        public Class<? extends Mapper> getMapperClass(
                ContentType contentType) {
            return DocumentMapper.class;
        }

        @Override
        public Class<? extends OutputFormat> getOutputFormatClass(
            ContentType contentType) {
            // TODO Auto-generated method stub
            return ContentOutputFormat.class;
        }
    },
    ARCHIVE {
        @Override
        public Class<? extends FileInputFormat> getInputFormatClass(
                ContentType contentType, boolean compressed) {
            // TODO Auto-generated method stub<commit_msg>Bug:16352 fix a bug on outputformat class for aggregate<commit_after>/*
 * Copyright 2003-2012 MarkLogic Corporation
 *
 * 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 com.marklogic.contentpump;

import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.OutputFormat;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;

import com.marklogic.mapreduce.ContentOutputFormat;
import com.marklogic.mapreduce.ContentType;

/**
 * Enum of supported input type.
 * 
 * @author jchen
 *
 */
public enum InputType {
    DOCUMENTS {
        @Override
        public Class<? extends FileInputFormat> getInputFormatClass(
            ContentType contentType, boolean compressed) {
            if (compressed) {
                return CompressedDocumentInputFormat.class;
            } else {
                return CombineDocumentInputFormat.class;
            }
        }

        @Override
        public Class<? extends Mapper> getMapperClass(ContentType contentType) {
            return DocumentMapper.class;
          }

        @Override
        public Class<? extends OutputFormat> getOutputFormatClass(
            ContentType contentType) {
            // TODO Auto-generated method stub
            return ContentOutputFormat.class;
        }
    },
    AGGREGATES {
        @Override
        public Class<? extends FileInputFormat> getInputFormatClass(
                ContentType contentType, boolean compressed) {
            if (compressed) {
                return CompressedAggregateXMLInputFormat.class;
            } else {
                return AggregateXMLInputFormat.class;
            }
        }

        @Override
        public Class<? extends Mapper> getMapperClass(
                ContentType contentType) {
            return DocumentMapper.class;
        }

        @Override
        public Class<? extends OutputFormat> getOutputFormatClass(
            ContentType contentType) {
            // TODO Auto-generated method stub
            return ContentOutputFormat.class;
        }
    },   
    DELIMITED_TEXT {
        @Override
        public Class<? extends FileInputFormat> getInputFormatClass(
                ContentType contentType, boolean compressed) {
            if (compressed) {
                return CompressedDelimitedTextInputFormat.class;
            } else {
                return DelimitedTextInputFormat.class;
            }
        }

        @Override
        public Class<? extends Mapper> getMapperClass(
                ContentType contentType) {
            return DocumentMapper.class;
        }

        @Override
        public Class<? extends OutputFormat> getOutputFormatClass(
            ContentType contentType) {
            // TODO Auto-generated method stub
            return ContentOutputFormat.class;
        }
    },
    ARCHIVE {
        @Override
        public Class<? extends FileInputFormat> getInputFormatClass(
                ContentType contentType, boolean compressed) {
            // TODO Auto-generated method stub
{'fraction_non_alphanumeric': 0.06608745192992452, 'fraction_numerical': 0.004130465745620282, 'mean_word_length': 2.123665480427046, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '138494', 'n_tokens_mistral': 1705, 'n_tokens_neox': 1626, 'n_words': 497}