// Path: src/libra/common/json/JsonSerializer.java
// public class JsonSerializer {
//     
//     private ObjectMapper mapper;
//             
//     public JsonSerializer() {
//         this.mapper = new ObjectMapper();
//     }
//     
//     public JsonSerializer(boolean prettyformat) {
//         this.mapper = new ObjectMapper();
//         this.mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, prettyformat);
//     }
//     
//     public String toJson(Object obj) throws IOException {
//         StringWriter writer = new StringWriter();
//         this.mapper.writeValue(writer, obj);
//         return writer.getBuffer().toString();
//     }
//     
//     public void toJsonConfiguration(Configuration conf, String key, Object obj) throws IOException {
//         String jsonString = toJson(obj);
//         
//         conf.set(key, jsonString);
//     }
//     
//     public void toJsonFile(File f, Object obj) throws IOException {
//         this.mapper.writeValue(f, obj);
//     }
//     
//     public void toJsonFile(FileSystem fs, Path file, Object obj) throws IOException {
//         if(!fs.exists(file.getParent())) {
//             fs.mkdirs(file.getParent());
//         }
//         
//         DataOutputStream ostream = fs.create(file, true, 64 * 1024, (short)3, 1024 * 1024);
//         this.mapper.writeValue(ostream, obj);
//         ostream.close();
//     }
//     
//     public Object fromJson(String json, Class<?> cls) throws IOException {
//         if(json == null) {
//             return null;
//         }
//         StringReader reader = new StringReader(json);
//         return this.mapper.readValue(reader, cls);
//     }
//     
//     public Object fromJsonConfiguration(Configuration conf, String key, Class<?> cls) throws IOException {
//         String jsonString = conf.get(key);
//         
//         if(jsonString == null) {
//             return null;
//         }
//         
//         return fromJson(jsonString, cls);
//     }
//     
//     public Object fromJsonFile(File f, Class<?> cls) throws IOException {
//         return this.mapper.readValue(f, cls);
//     }
//     
//     public Object fromJsonFile(FileSystem fs, Path file, Class<?> cls) throws IOException {
//         DataInputStream istream = fs.open(file);
//         Object obj = this.mapper.readValue(istream, cls);
//         
//         istream.close();
//         return obj;
//     }
// }


import java.io.File;
import java.io.IOException;
import java.util.Comparator;
import libra.common.json.JsonSerializer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;
/*
 * Copyright 2016 iychoi.
 *
 * 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 libra.preprocess.common.samplegroup;


/**
 *
 * @author iychoi
 */
public class SampleInfo {
    
    private static final Log LOG = LogFactory.getLog(SampleInfo.class);
    
    private static final String HADOOP_CONFIG_KEY = "libra.preprocess.common.samplegroup.sampleinfo";
    
    private String path;
    private long size;
    
    public static SampleInfo createInstance(File file) throws IOException {
// Path: src/libra/common/json/JsonSerializer.java
// public class JsonSerializer {
//     
//     private ObjectMapper mapper;
//             
//     public JsonSerializer() {
//         this.mapper = new ObjectMapper();
//     }
//     
//     public JsonSerializer(boolean prettyformat) {
//         this.mapper = new ObjectMapper();
//         this.mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, prettyformat);
//     }
//     
//     public String toJson(Object obj) throws IOException {
//         StringWriter writer = new StringWriter();
//         this.mapper.writeValue(writer, obj);
//         return writer.getBuffer().toString();
//     }
//     
//     public void toJsonConfiguration(Configuration conf, String key, Object obj) throws IOException {
//         String jsonString = toJson(obj);
//         
//         conf.set(key, jsonString);
//     }
//     
//     public void toJsonFile(File f, Object obj) throws IOException {
//         this.mapper.writeValue(f, obj);
//     }
//     
//     public void toJsonFile(FileSystem fs, Path file, Object obj) throws IOException {
//         if(!fs.exists(file.getParent())) {
//             fs.mkdirs(file.getParent());
//         }
//         
//         DataOutputStream ostream = fs.create(file, true, 64 * 1024, (short)3, 1024 * 1024);
//         this.mapper.writeValue(ostream, obj);
//         ostream.close();
//     }
//     
//     public Object fromJson(String json, Class<?> cls) throws IOException {
//         if(json == null) {
//             return null;
//         }
//         StringReader reader = new StringReader(json);
//         return this.mapper.readValue(reader, cls);
//     }
//     
//     public Object fromJsonConfiguration(Configuration conf, String key, Class<?> cls) throws IOException {
//         String jsonString = conf.get(key);
//         
//         if(jsonString == null) {
//             return null;
//         }
//         
//         return fromJson(jsonString, cls);
//     }
//     
//     public Object fromJsonFile(File f, Class<?> cls) throws IOException {
//         return this.mapper.readValue(f, cls);
//     }
//     
//     public Object fromJsonFile(FileSystem fs, Path file, Class<?> cls) throws IOException {
//         DataInputStream istream = fs.open(file);
//         Object obj = this.mapper.readValue(istream, cls);
//         
//         istream.close();
//         return obj;
//     }
// }


// Path: src/libra/preprocess/common/samplegroup/SampleInfo.java
import java.io.File;
import java.io.IOException;
import java.util.Comparator;
import libra.common.json.JsonSerializer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonProperty;

/*
 * Copyright 2016 iychoi.
 *
 * 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 libra.preprocess.common.samplegroup;


/**
 *
 * @author iychoi
 */
public class SampleInfo {
    
    private static final Log LOG = LogFactory.getLog(SampleInfo.class);
    
    private static final String HADOOP_CONFIG_KEY = "libra.preprocess.common.samplegroup.sampleinfo";
    
    private String path;
    private long size;
    
    public static SampleInfo createInstance(File file) throws IOException {
        JsonSerializer serializer = new JsonSerializer();